From a170a2ecef6d5c87883ed552dbbc81cfb0358d13 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 19 十一月 2021 16:43:53 +0800
Subject: [PATCH] Merge branch 'WJC' into newBranch1
---
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 8
HDL-ON_Android/Properties/AndroidManifest.xml | 2
HDL-ON_Android/Assets/Language.ini | 7
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 194 +++++++-----
HDL-ON_iOS/AppDelegate.cs | 4
HDL_ON/HDL_ON.projitems | 1
HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs | 1
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 6
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs | 187 +++++++++++
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs | 4
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs | 2
HDL-ON_iOS/Resources/Language.ini | 8
HDL_ON/DAL/Server/NewAPI.cs | 4
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 184 ++++++++++++
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 6
HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 49 +++
HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs | 22
HDL_ON/Common/R.cs | 12
HDL_ON/UI/UI2/3-Intelligence/Automation/CalculatedDistance.cs | 63 ++++
HDL_ON/UI/MainPage.cs | 4
HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs | 49 ++
HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs | 39 ++
22 files changed, 729 insertions(+), 127 deletions(-)
diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index df14822..79bfdd8 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -1009,6 +1009,9 @@
7149=Manually
7150=Smart
7151=Good
+7152=Leave or arrive at a place
+7153=Leave
+7154=Arrive
@@ -2113,6 +2116,10 @@
7149=鎵嬪姩
7150=鏅鸿兘
7151=鑹ソ
+7152=绂诲紑鎴栧埌杈炬煇鍦�
+7153=绂诲紑
+7154=鍒拌揪
+
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index fb3d44f..64c39b9 100644
--- a/HDL-ON_Android/Properties/AndroidManifest.xml
+++ b/HDL-ON_Android/Properties/AndroidManifest.xml
@@ -176,5 +176,7 @@
<meta-data android:name="OPPO_APPID" android:value="OP-30619979" />
<meta-data android:name="OPPO_APPSECRET" android:value="OP-11d511c42f654cafac99588322681003" />
<!-- 鏋佸厜鎺ㄩ�佺粨鏉� -->
+ <!-- 璁剧疆楂樺痉鍦板浘key -->
+ <meta-data android:name="com.amap.api.v2.apikey" android:value="9901dd06e30b229efdd4c5bf5e076224" />
</application>
</manifest>
\ No newline at end of file
diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs
index e7b6565..2d22046 100644
--- a/HDL-ON_iOS/AppDelegate.cs
+++ b/HDL-ON_iOS/AppDelegate.cs
@@ -1,4 +1,4 @@
-锘縰sing System;
+锘縰sing System;
using Foundation;
using HDL_ON;
using Shared;
@@ -304,6 +304,8 @@
#endregion
+ //楂樺痉key
+ GDMapKit.setGDApiKey("f0635ea15c5d579c6e93d9f07a06da69");
Console.WriteLine("FinishedLaunching");
return true;
}
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index df14822..ad70402 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -1009,6 +1009,9 @@
7149=Manually
7150=Smart
7151=Good
+7152=Leave or arrive at a place
+7153=Leave
+7154=Arrive
@@ -2113,6 +2116,11 @@
7149=鎵嬪姩
7150=鏅鸿兘
7151=鑹ソ
+7152=绂诲紑鎴栧埌杈炬煇鍦�
+7153=绂诲紑
+7154=鍒拌揪
+
+
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index b4a8bf3..8827fcf 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -2620,6 +2620,18 @@
/// 鑹ソ
/// </summary>
public const int lianghao = 7151;
+ /// <summary>
+ /// 绂诲紑鎴栧埌杈炬煇鍦�
+ /// </summary>
+ public const int likiadaoda = 7152;
+ /// <summary>
+ /// 绂诲紑
+ /// </summary>
+ public const int likai = 7153;
+ /// <summary>
+ /// 鍒拌揪
+ /// </summary>
+ public const int daoda = 7154;
diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs
index 57644f5..3314fee 100644
--- a/HDL_ON/DAL/Server/NewAPI.cs
+++ b/HDL_ON/DAL/Server/NewAPI.cs
@@ -563,6 +563,10 @@
/// 鍚敤绂佺敤鑷姩鍖�
/// </summary>
public const string API_POST_Logic_Enable = "/home-wisdom/app/logic/enable";
+ /// <summary>
+ /// 鑷姩鍖栧湴鐞嗗洿鏍忕姸鎬佷笂鎶�
+ /// </summary>
+ public const string API_POST_Logic_GeoFenceStateReport = "/home-wisdom/app/logic/geoFenceStateReport";
#endregion
#region -- 绗笁鏂硅澶囩浉鍏虫帴鍙__________________________
diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems
index 4830611..8208893 100644
--- a/HDL_ON/HDL_ON.projitems
+++ b/HDL_ON/HDL_ON.projitems
@@ -486,6 +486,7 @@
<Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\A_EnvironmentalDataCenter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SceneControlZone.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\CalculatedDistance.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index 31d739d..91f346f 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -10,6 +10,7 @@
{
public static class MainPage
{
+
/// <summary>
/// BaseView
/// </summary>
@@ -144,7 +145,8 @@
BaseView = Application.MainPage;
Application.MainPage.BackgroundColor = CSS_Color.MainBackgroundColor;
-
+ ///鐩戝惉缁忕含搴�
+ HDL_ON.UI.UI2.Intelligence.Automation.LogicMethod.CurrLogicMethod.AppLatAndLonEvent();
//#region 娴嬭瘯
//var ddd = new UI.test.TestDialog();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
index 46264c7..d6d5c43 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -61,17 +61,29 @@
shiwaiView.frameLayout.Y = sceneView.frameLayout.Bottom;
shiwaiView.btnText.TextID = StringId.shiwaibainhua;
shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
-
+
if (MainView.IsGatewayType)
{
viewLayout.AddChidren(shiwaiView.FLayoutView());
}
-
+
+ //鍦扮悊鍥存爮
+ LogicView.SelectTypeView likiadaodaView = new LogicView.SelectTypeView();
+ likiadaodaView.frameLayout.Y = shiwaiView.frameLayout.Bottom;
+ likiadaodaView.btnText.TextID = StringId.likiadaoda;
+ likiadaodaView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
+
+ if (MainView.IsGatewayType)
+ {
+ viewLayout.AddChidren(likiadaodaView.FLayoutView());
+ }
+
#endregion
#region 鎵�鏈夌偣鍑讳簨浠�
//鏃堕棿
- timeView.btnClick.MouseUpEventHandler += (sen, e) => {
+ timeView.btnClick.MouseUpEventHandler += (sen, e) =>
+ {
TimeTpye timeTpye = new TimeTpye();
MainPage.BasePageView.AddChidren(timeTpye);
timeTpye.Show();
@@ -79,7 +91,8 @@
};
//鍔熻兘
- functionView.btnClick.MouseUpEventHandler += (sen, e) => {
+ functionView.btnClick.MouseUpEventHandler += (sen, e) =>
+ {
FunTpye funTpye = new FunTpye();
MainPage.BasePageView.AddChidren(funTpye);
funTpye.Show(LogicMethod.condition_if);
@@ -91,16 +104,23 @@
SceneMethod();
};
//瀹ゅ鍙樺寲
- shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => {
- if (string.IsNullOrEmpty(Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0)
- {
- new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured);
- return;
- }
+ shiwaiView.btnClick.MouseUpEventHandler += (sen, e) =>
+ {
+ //if (string.IsNullOrEmpty(Entity.DB_ResidenceData.Instance.CurrentRegion.homeAddress))//.longitude == 0 && Entity.DB_ResidenceData.Instance.CurrentRegion.latitude == 0)
+ //{
+ // new PublicAssmebly().TipMsg(StringId.tip, StringId.GatewayLocationInformationIsNotConfigured);
+ // return;
+ //}
Weather weather = new Weather();
MainPage.BasePageView.AddChidren(weather);
weather.Show();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+
+ //鍦扮悊鍥存爮
+ likiadaodaView.btnClick.MouseUpEventHandler += (sen, e) =>
+ {
+ LocationView(this, false);
};
#endregion
@@ -141,6 +161,150 @@
}
/// <summary>
+ /// 鍦扮悊鍥存爮View
+ /// </summary>
+ /// <param name="flMain">Fl main.</param>
+ /// <param name="edit">If set to <c>true</c> edit.</param>
+ public void LocationView(FrameLayout flMain, bool edit)
+ {
+ string strname = "";
+ ///閫氳繃璋冭瘯瀹濈粰鐨勭粡绾害<鏍囧噯GPS>
+ double latitude = Entity.DB_ResidenceData.Instance.CurrentRegion.latitude;//绾害
+ double longitude = Entity.DB_ResidenceData.Instance.CurrentRegion.longitude;//缁忓害
+ //WGS84鍧愭爣杞珮寰峰潗鏍�
+ LogicMethod.CurrLogicMethod.WGS84_to_GCJ02(Entity.DB_ResidenceData.Instance.CurrentRegion.longitude, Entity.DB_ResidenceData.Instance.CurrentRegion.latitude, out longitude, out latitude);
+ int r = 500;//鍗婂緞
+ if (edit)
+ {
+ for (var i = 0; i < Logic.currlogic.input.Count; i++)
+ {
+ var input = Logic.currlogic.input[i];
+ if (input.condition_type != "8")
+ {
+ continue;
+ }
+ if (input.condition[0]["value"] == "arrive")
+ {
+ //鍒拌揪鏌愬湴
+ strname = Language.StringByID(StringId.daoda);
+ }
+ else
+ {
+ //绂诲紑鍦扮偣
+ strname = Language.StringByID(StringId.likai);
+ }
+ //绾害
+ latitude = Convert.ToDouble(input.geo_fence.latitude);
+ //缁忓害
+ longitude = Convert.ToDouble(input.geo_fence.longitude);
+ //鍗婂緞
+ r = int.Parse(input.geo_fence.radius);
+ }
+ }
+ PublicInterface publicInterface = new PublicInterface();
+ var list = publicInterface.GetViewList("鍦扮悊鍥存爮");
+ publicInterface.SingleSelectionShow(flMain, list, Language.StringByID(StringId.likiadaoda), strname, (str) =>
+ {
+
+ string valueStr = "arrive";
+ if (str == Language.StringByID(StringId.daoda))
+ {
+ //鍒拌揪鏌愬湴
+ valueStr = "arrive";
+ }
+ else
+ {
+ //绂诲紑
+ valueStr = "leave";
+ }
+
+#if __Android__
+ //鐢宠瀹氫綅鏉冮檺
+ ((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
+ {
+ if (result1 == false) { return; }
+
+ //鐢宠鍏佽绋嬪簭鍐欏叆澶栭儴瀛樺偍锛屽SD鍗′笂鍐欐枃浠�
+ ((BaseActivity)Application.Activity).SetPermission((result2) =>
+ {
+ if (result2 == false) { return; }
+ //璇诲彇鐢佃瘽鐘舵�佹潈闄�
+ ((BaseActivity)Application.Activity).SetPermission((result3) =>
+ {
+ if (result3 == false) { return; }
+
+ //璋冪敤鏂规硶锛岃烦杞〉闈�
+ GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+ {
+ //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS)
+ double out_lng, out_lat;
+ LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
+ Input input = new Input();
+ input.sid = LogicMethod.CurrLogicMethod.NewSid();
+ input.condition_type = "8";
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "value", valueStr);
+ input.condition.Add(dic);
+ //绾害
+ input.geo_fence.latitude = out_lat.ToString();
+ //缁忓害
+ input.geo_fence.longitude = out_lng.ToString();
+ //鍗婂緞<鍗曚綅绫�>
+ input.geo_fence.radius = mRadius.ToString();
+ AddCondition(input);
+ LogicMethod.CurrLogicMethod.RemoveAllView();
+ AddLogic addLogic = new AddLogic();
+ MainPage.BasePageView.AddChidren(addLogic);
+ addLogic.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+
+ }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r);
+
+ }, "android.permission.READ_PHONE_STATE");
+
+ }, "android.permission.WRITE_EXTERNAL_STORAGE");
+ });
+#endif
+#if __IOS__
+ //璋冪敤鏂规硶锛岃烦杞〉闈�
+ GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
+ {
+ //楂樺痉鍧愭爣杞琖GS84鍧愭爣(楂樺痉鍦板浘璁剧疆GPS)
+ double out_lng, out_lat;
+ LogicMethod.CurrLogicMethod.GCJ02_to_WGS84(mLongitude, mLatitude, out out_lng, out out_lat);
+
+ Input input = new Input();
+ input.sid = LogicMethod.CurrLogicMethod.NewSid();
+ input.condition_type = "8";
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ LogicMethod.CurrLogicMethod.dictionary(dic, "key", "direction");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "value", "arrive");
+ input.condition.Add(dic);
+ //绾害
+ input.geo_fence.latitude = out_lat.ToString();
+ //缁忓害
+ input.geo_fence.longitude = out_lng.ToString();
+ //鍗婂緞<鍗曚綅绫�>
+ input.geo_fence.radius = mRadius.ToString();
+ AddCondition(input);
+ LogicMethod.CurrLogicMethod.RemoveAllView();
+ AddLogic addLogic = new AddLogic();
+ MainPage.BasePageView.AddChidren(addLogic);
+ addLogic.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }, strname, Language.StringByID(StringId.save), true, latitude, longitude, r);
+#endif
+ });
+
+
+ }
+
+ /// <summary>
/// 娣诲姞鏉′欢
/// </summary>
/// <param name="input"></param>
@@ -151,8 +315,9 @@
for (var i = 0; i < Logic.currlogic.input.Count; i++)
{
var condition_type = Logic.currlogic.input[i].condition_type;
- if (condition_type == "10")
+ if (condition_type == "10" || condition_type == "8")
{
+ //鏀寔鍦烘櫙=10锛屽湴鐞嗗洿鏍�=8
///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
index = i;
break;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
index 2ea187d..92d1584 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AirQuality.cs
@@ -57,17 +57,17 @@
if (text == Language.StringByID(StringId.kongqiyou))
{
//浼�
- value = "excellent";
+ value = "Excellent";
}
else if (text == Language.StringByID(StringId.kongqiliang))
{
//鑹�
- value = "good";
+ value = "Good";
}
else if (text == Language.StringByID(StringId.kongqicha))
{
//宸�
- value = "poor";
+ value = "Poor";
}
AddDic(value);
};
@@ -82,31 +82,35 @@
{
Input input = new Input();
input.sid = LogicMethod.CurrLogicMethod.NewSid();
- input.condition_type = "9";
+ input.condition_type = "6";
Dictionary<string, string> dic = new Dictionary<string, string>();
- LogicMethod.CurrLogicMethod.dictionary(dic, "key", "air_quality");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "key", "airquality");
LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
input.condition.Add(dic);
- AddCondition(input);
+ AddCondition(input, "airquality" ,"=");
}
/// <summary>
/// 娣诲姞鏉′欢
/// </summary>
/// <param name="input"></param>
- private void AddCondition(Input input)
+ private void AddCondition(Input input, string keyValue, string comparator)
{
///璁板綍绱㈠紩鍊�
int index = -1;
for (var i = 0; i < Logic.currlogic.input.Count; i++)
{
var condition_type = Logic.currlogic.input[i].condition_type;
- if (condition_type == "9")
+ if (condition_type == "6")
{
- ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
- index = i;
- break;
+ var dicList = Logic.currlogic.input[i].condition;
+ if (ExistKey(dicList, keyValue, comparator))
+ {
+ ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
+ index = i;
+ break;
+ }
}
}
if (index != -1)
@@ -128,5 +132,28 @@
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
+
+ /// <summary>
+ /// 鍒ゆ柇鏄惁瀛樺湪Key
+ /// </summary>
+ /// <param name="dicList"></param>
+ /// <param name="keyValue"></param>
+ /// <param name="comparator">姣旇緝鍏崇郴</param>
+ /// <returns></returns>
+ private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator)
+ {
+ for (int i = 0; i < dicList.Count; i++)
+ {
+ var dic = dicList[i];
+ string key = dic["key"];
+ string comparatorValue = dic["comparator"];
+ if (key == keyValue && comparatorValue == comparator)
+ {
+ //鍒ゆ柇鏄惁瀛樺湪
+ return true;
+ }
+ }
+ return false;
+ }
}
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/CalculatedDistance.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/CalculatedDistance.cs
new file mode 100644
index 0000000..58e9b54
--- /dev/null
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/CalculatedDistance.cs
@@ -0,0 +1,63 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Infrastructure.Service.Helper
+{
+ public class CalculatedDistance
+ {
+ private static double HaverSin(double theta)
+ {
+ var v = Math.Sin(theta / 2);
+ return v * v;
+ }
+
+ static double EARTH_RADIUS = 6371.0;//km 鍦扮悆鍗婂緞 骞冲潎鍊硷紝鍗冪背
+
+ /// <summary>
+ /// 缁欏畾鐨勭粡搴�1锛岀含搴�1锛涚粡搴�2锛岀含搴�2. 璁$畻2涓粡绾害涔嬮棿鐨勮窛绂汇��
+ /// </summary>
+ /// <param name="lat1">缁忓害1</param>
+ /// <param name="lon1">绾害1</param>
+ /// <param name="lat2">缁忓害2</param>
+ /// <param name="lon2">绾害2</param>
+ /// <returns>璺濈锛堝叕閲屻�佸崈绫筹級</returns>
+ public static int Distance(double lat1, double lon1, double lat2, double lon2)
+ {
+ //鐢╤aversine鍏紡璁$畻鐞冮潰涓ょ偣闂寸殑璺濈銆�
+ //缁忕含搴﹁浆鎹㈡垚寮у害
+ lat1 = ConvertDegreesToRadians(lat1);
+ lon1 = ConvertDegreesToRadians(lon1);
+ lat2 = ConvertDegreesToRadians(lat2);
+ lon2 = ConvertDegreesToRadians(lon2);
+
+ //宸��
+ var vLon = Math.Abs(lon1 - lon2);
+ var vLat = Math.Abs(lat1 - lat2);
+
+ //h is the great circle distance in radians, great circle灏辨槸涓�涓悆浣撲笂鐨勫垏闈紝瀹冪殑鍦嗗績鍗虫槸鐞冨績鐨勪竴涓懆闀挎渶澶х殑鍦嗐��
+ var h = HaverSin(vLat) + Math.Cos(lat1) * Math.Cos(lat2) * HaverSin(vLon);
+
+ var distance = (int)((2 * EARTH_RADIUS * Math.Asin(Math.Sqrt(h))) * 1000);
+
+ return distance;
+ }
+
+ /// <summary>
+ /// 灏嗚搴︽崲绠椾负寮у害銆�
+ /// </summary>
+ /// <param name="degrees">瑙掑害</param>
+ /// <returns>寮у害</returns>
+ private static double ConvertDegreesToRadians(double degrees)
+ {
+ return degrees * Math.PI / 180;
+ }
+
+ private static double ConvertRadiansToDegrees(double radian)
+ {
+ return radian * 180.0 / Math.PI;
+ }
+ }
+}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 61973d1..e6fc71d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -147,9 +147,11 @@
case SPK.CurtainRoller:
case SPK.CurtainTrietex:
//绌鸿皟
- case SPK.AcStandard:case SPK.HvacAC:
+ case SPK.AcStandard:
+ case SPK.HvacAC:
//鍦扮儹
- case SPK.HvacFloorHeat:case SPK.FloorHeatStandard:
+ case SPK.HvacFloorHeat:
+ case SPK.FloorHeatStandard:
//鏂伴
case SPK.AirFreshStandard:
case SPK.HvacAirFresh:
@@ -388,8 +390,8 @@
break;
case SPK.SensorTemperature:
{
-
- string str =new InpOrOutLogicMethod { }.GetText(dicList, "temperature");
+
+ string str = new InpOrOutLogicMethod { }.GetText(dicList, "temperature");
inputView.btnState.Text = str;
}
break;
@@ -431,8 +433,9 @@
}
}
break;
- case "4":
+ case "6":
{
+ //inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
string strtext = "";
string strvalue = "";
@@ -444,8 +447,9 @@
switch (key)
{
- case "outdoor_temp":
+ case "temperature":
{
+ //浜戠澶╂皵鏉′欢 鍩庡競娓╁害瑙﹀彂
strvalue = value + "鈩�";
if (comparator == ">")
{
@@ -458,8 +462,9 @@
}
break;
- case "outdoor_humity":
+ case "humidity":
{
+ //浜戠澶╂皵鏉′欢 鍩庡競婀垮害瑙﹀彂
strvalue = value + "%";
if (comparator == ">")
{
@@ -472,13 +477,68 @@
}
break;
- case "pm2.5":
+ case "pm25":
{
+ //浜戠澶╂皵鏉′欢 鍩庡競pm2.5瑙﹀彂
strtext = Language.StringByID(StringId.PM25);
strvalue = new PublicInterface { }.GetString("pm25", value);
}
break;
+ case "weather":
+ {
+ //浜戠澶╂皵鏉′欢 鍩庡競澶╂皵瑙﹀彂
+ strtext = Language.StringByID(StringId.tianqibianhua);
+ switch (value)
+ {
+ case "Sunny":
+ {
+ strtext = Language.StringByID(StringId.clearday);
+ }
+ break;
+ case "Cloudy":
+ {
+
+ strtext = Language.StringByID(StringId.cloudy);
+
+ }
+ break;
+ case "Rain":
+ {
+ strtext = Language.StringByID(StringId.rain);
+ }
+ break;
+
+ }
+ }
+ break;
+ case "airquality":
+ {
+ //浜戠澶╂皵鏉′欢 鍩庡競绌烘皵璐ㄩ噺
+ strtext = Language.StringByID(StringId.kongqizhiliang);
+ switch (value)
+ {
+ case "Excellent":
+ {
+ strtext = Language.StringByID(StringId.kongqiyou);
+
+ }
+ break;
+ case "Good":
+ {
+
+ strtext = Language.StringByID(StringId.kongqiliang);
+
+ }
+ break;
+ case "Poor":
+ {
+ strtext = Language.StringByID(StringId.kongqicha);
+ }
+ break;
+ }
+ }
+ break;
}
@@ -487,70 +547,27 @@
inputView.btnState.Text = strvalue;
}
break;
- case "6":
+ case "8":
{
- inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
+ inputView.btnIcon.UnSelectedImagePath = "LogicIcon/location.png";
foreach (var dic in dicList)
{
string strtext = "";
string value = dic["value"];
switch (value)
{
- case "sunny":
+ case "arrive":
{
- strtext = Language.StringByID(StringId.clearday);
-
+ strtext = Language.StringByID(StringId.daoda);
}
break;
- case "cloudy":
+ case "leave":
{
-
- strtext = Language.StringByID(StringId.cloudy);
-
+ strtext = Language.StringByID(StringId.likai);
}
break;
- case "rainy":
- {
- strtext = Language.StringByID(StringId.rain);
- }
- break;
-
}
- inputView.btnText.TextID = StringId.tianqibianhua;
- inputView.btnState.Text = strtext;
- }
- }
- break;
- case "9":
- {
- inputView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
- foreach (var dic in dicList)
- {
- string strtext = "";
- string value = dic["value"];
- switch (value)
- {
- case "excellent":
- {
- strtext = Language.StringByID(StringId.kongqiyou);
-
- }
- break;
- case "good":
- {
-
- strtext = Language.StringByID(StringId.kongqiliang);
-
- }
- break;
- case "poor":
- {
- strtext = Language.StringByID(StringId.kongqicha);
- }
- break;
-
- }
- inputView.btnText.TextID = StringId.kongqizhiliang;
+ inputView.btnText.TextID = StringId.likiadaoda;
inputView.btnState.Text = strtext;
}
}
@@ -737,10 +754,10 @@
else if (device.spk == SPK.SensorTemperature)
{
- new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae);
+ new InpOrOutLogicMethod().SensorView(thisView, device, "temperature", indexVulae);
}
- else if ( device.spk == SPK.SensorHumidity)
+ else if (device.spk == SPK.SensorHumidity)
{
new InpOrOutLogicMethod().SensorView(thisView, device, "humidity", indexVulae);
@@ -779,7 +796,7 @@
}
}
break;
- case "4":
+ case "6":
{
///褰撳墠鐨勭储寮曞�兼暟鎹璞�
Input inputedit = Logic.currlogic.input[indexVulae];
@@ -794,7 +811,7 @@
stateValue = dic["value"];
switch (key)
{
- case "outdoor_temp":
+ case "temperature":
{
if (comparator == ">")
{
@@ -808,7 +825,7 @@
}
break;
- case "outdoor_humity":
+ case "humidity":
{
if (comparator == ">")
@@ -822,42 +839,57 @@
}
break;
- case "pm2.5":
+ case "pm25":
{
intValue = StringId.PM25;
+ }
+ break;
+ case "weather":
+ {
+ intValue = StringId.tianqibianhua;
+ }
+ break;
+ case "airquality":
+ {
+ intValue = StringId.kongqizhiliang;
}
break;
}
}
OutdoorEnvironment outdoorEnvironment = new OutdoorEnvironment();
- if (intValue == StringId.PM25)
+ if (intValue == StringId.tianqibianhua)
{
+ //鍩庡競澶╂皵锛堟櫞澶╋紝涓嬮洦锛�
+ WeatherCondition weatherCondition = new WeatherCondition();
+ MainPage.BasePageView.AddChidren(weatherCondition);
+ weatherCondition.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
+ else if (intValue == StringId.PM25)
+ {
+ //鍩庡競澶╂皵锛坧m2.5锛�
outdoorEnvironment.PmAction(thisView, stateValue);
+ }
+ else if (intValue == StringId.kongqizhiliang)
+ {
+ //鍩庡競澶╂皵锛堢┖姘旇川閲忥級
+ AirQuality airQuality = new AirQuality();
+ MainPage.BasePageView.AddChidren(airQuality);
+ airQuality.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
else
{
+ //鍩庡競澶╂皵锛堟俯婀垮害锛�
outdoorEnvironment.InputBoxAction(intValue, stateValue);
}
-
}
break;
- case "6":
+ case "8":
{
-
- WeatherCondition weatherCondition = new WeatherCondition();
- MainPage.BasePageView.AddChidren(weatherCondition);
- weatherCondition.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- }
- break;
- case "9":
- {
-
- AirQuality airQuality = new AirQuality();
- MainPage.BasePageView.AddChidren(airQuality);
- airQuality.Show();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ AddInputType addInputType = new AddInputType();
+ addInputType.LocationView(thisView, true);
}
break;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
index 19c31ea..bbbea86 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -88,12 +88,12 @@
/// 鏃堕棿鐐规潯浠�=1;
/// 鏃堕棿娈垫潯浠�=2;
/// 璁惧鐘舵�佸彉鍖栨潯浠�=3;
- /// 鐜淇℃伅鏉′欢=4;
+ /// 鐜淇℃伅鏉′欢=4(搴熷純);
/// 瀹夐槻鏉′欢=5;
/// 浜戠澶╂皵鏉′欢=6;
/// 鏌愪釜閫昏緫/鍦烘櫙鐨勮緭鍑烘潯浠�=7;
/// 鍦扮悊鍥存爮=8;
- /// 绌烘皵璐ㄩ噺=9;
+ /// 绌烘皵璐ㄩ噺=9(搴熷純);
/// 鍦烘櫙=10;
/// </summary>
public string condition_type = "";
@@ -142,7 +142,7 @@
/// </summary>
public string latitude = string.Empty;
/// <summary>
- /// 鍗曚綅绫�
+ /// 鍗婂緞<鍗曚綅绫�>
/// </summary>
public string radius = string.Empty;
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index 023a2d1..7b289d7 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -709,6 +709,190 @@
}
}
+ #region 楂樺痉鍧愭爣杞琖GS84鍧愭爣
+ /// <summary>
+ /// 楂樺痉鍧愭爣杞琖GS84鍧愭爣
+ /// </summary>
+ /// <param name="in_lng"></param>
+ /// <param name="in_lat"></param>
+ /// <param name="out_lng"></param>
+ /// <param name="out_lat"></param>
+ public void GCJ02_to_WGS84(double in_lng, double in_lat, out double out_lng, out double out_lat)
+ {
+ if (OutOfChina(in_lat, in_lng))
+ {
+ out_lng = in_lng;
+ out_lat = in_lat;
+ return;
+ }
+
+ CalculateDev(in_lng, in_lat, out out_lng, out out_lat);
+ out_lng = in_lng - out_lng;
+ out_lat = in_lat - out_lat;
+ }
+ #endregion
+
+ #region WGS84鍧愭爣杞珮寰峰潗鏍�
+ /// <summary>
+ /// WGS84鍧愭爣杞珮寰峰潗鏍�
+ /// </summary>
+ /// <param name="in_lng">缁忓害</param>
+ /// <param name="in_lat">绾害</param>
+ /// <param name="out_lng"></param>
+ /// <param name="out_lat"></param>
+ public void WGS84_to_GCJ02(double in_lng, double in_lat, out double out_lng, out double out_lat)
+ {
+ if (OutOfChina(in_lat, in_lng))
+ {
+ out_lng = in_lng;
+ out_lat = in_lat;
+ return;
+ }
+
+ CalculateDev(in_lng, in_lat, out out_lng, out out_lat);
+ out_lng = in_lng + out_lng;
+ out_lat = in_lat + out_lat;
+ }
+ #endregion
+
+ /// <summary>
+ /// 鍧愭爣鏄惁鍦ㄤ腑鍥藉鍐�
+ /// </summary>
+ /// <param name="lat"></param>
+ /// <param name="lng"></param>
+ /// <returns></returns>
+ public bool OutOfChina(double lat, double lng)
+ {
+ if (lng < 72.004 || lng > 137.8347)
+ return true;
+ if (lat < 0.8293 || lat > 55.8271)
+ return true;
+ return false;
+ }
+ /// <summary>
+ /// 璁$畻鍋忓樊
+ /// </summary>
+ /// <param name="in_lng"></param>
+ /// <param name="in_lat"></param>
+ /// <param name="dLng"></param>
+ /// <param name="dLat"></param>
+ private void CalculateDev(double in_lng, double in_lat, out double dLng, out double dLat)
+ {
+ dLat = TransformLat(in_lng - 105.0, in_lat - 35.0);
+ dLng = TransformLng(in_lng - 105.0, in_lat - 35.0);
+
+ double radLat = in_lat / 180.0 * pi;
+ double magic = Math.Sin(radLat);
+ magic = 1 - ee * magic * magic;
+ double sqrtMagic = Math.Sqrt(magic);
+ dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
+ dLng = (dLng * 180.0) / (a / sqrtMagic * Math.Cos(radLat) * pi);
+ }
+
+ private double TransformLat(double x, double y)
+ {
+ double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.Sqrt(Math.Abs(x));
+ ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0;
+ ret += (20.0 * Math.Sin(y * pi) + 40.0 * Math.Sin(y / 3.0 * pi)) * 2.0 / 3.0;
+ ret += (160.0 * Math.Sin(y / 12.0 * pi) + 320 * Math.Sin(y * pi / 30.0)) * 2.0 / 3.0;
+ return ret;
+ }
+ private double TransformLng(double x, double y)
+ {
+ double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.Sqrt(Math.Abs(x));
+ ret += (20.0 * Math.Sin(6.0 * x * pi) + 20.0 * Math.Sin(2.0 * x * pi)) * 2.0 / 3.0;
+ ret += (20.0 * Math.Sin(x * pi) + 40.0 * Math.Sin(x / 3.0 * pi)) * 2.0 / 3.0;
+ ret += (150.0 * Math.Sin(x / 12.0 * pi) + 300.0 * Math.Sin(x / 30.0 * pi)) * 2.0 / 3.0;
+ return ret;
+ }
+ // 妞悆鍙傛暟-鍦嗗懆鐜�
+ private const double pi = 3.14159265358979324;
+
+ // (鍖椾含54)妞悆闀垮崐杞达紝鍗槦妞悆鍧愭爣鎶曞奖鍒板钩闈㈠湴鍥惧潗鏍囩郴鐨勬姇褰卞洜瀛�
+ private const double a = 6378245.0;
+ /*
+ * Krasovsky 1940 (鍖椾含54)妞悆闀垮崐杞寸涓�鍋忓績鐜囧钩鏂�
+ * 璁$畻鏂瑰紡锛�
+ * 闀垮崐杞达細
+ * a = 6378245.0
+ * 鎵佺巼锛�
+ * 1/f = 298.3锛堝彉閲忕浉鍏宠绠椾负锛�(a-b)/a锛�
+ * 鐭崐杞达細
+ * b = 6356863.0188 (鍙橀噺鐩稿叧璁$畻鏂规硶涓猴細b = a * (1 - f))
+ * 绗竴鍋忓績鐜囧钩鏂�:
+ * e2 = (a^2 - b^2) / a^2;
+ */
+ private const double ee = 0.00669342162296594323;
+
+ /// <summary>
+ /// APP涓婃姤GPS缁忕含搴�
+ /// </summary>
+ public void AppLatAndLonEvent()
+ {
+ Application.LocationAction += (lon, lat) =>
+ {
+ ////GPS鍧愭爣杞垚楂樺痉鍧愭爣
+ //double out_lng, out_lat;
+ //this.WGS84_to_GCJ02(lon, lat, out out_lng, out out_lat);
+ //涓婃姤缁忕含搴�
+ this.AutomatedGeofenceStatusReporting(lon, lat);
+ };
+ }
+
+ /// <summary>
+ /// 鑷姩鍖栧湴鐞嗗洿鏍忕姸鎬佷笂鎶ヤ簯绔�
+ /// </summary>
+ /// <param name="out_lng">APP GPS缁忓害</param>
+ /// <param name="out_lat">APP GPS绾害</param>
+ private void AutomatedGeofenceStatusReporting(double out_lng, double out_lat)
+ {
+ List<LogicData> logicDataList = new List<LogicData>();
+ logicDataList.Clear();
+ //鑾峰彇閫昏緫ID鍒楄〃
+ var idStr = Send.GetLogicIdList();
+ if (idStr.Code == "0" && idStr.Data != null && idStr.Data.ToString() != "")
+ {
+ var date = Newtonsoft.Json.JsonConvert.SerializeObject(idStr.Data);
+ logicDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogicData>>(date);
+ }
+ ///鏈夎嚜鍔ㄥ垪琛ㄦ墠澶勭悊
+ if (logicDataList.Count>0) {
+ ///閬嶅巻鎵�鏈夊垪琛�
+ for (int i = 0; i < logicDataList.Count; i++)
+ {
+ var logicDate = logicDataList[i];
+ ///鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忎笉澶勭悊
+ if (string.IsNullOrEmpty(logicDate.geo_fence.latitude) || string.IsNullOrEmpty(logicDate.geo_fence.longitude))
+ {
+ //缁忕含搴︿负绌�,璁や负鑷姩鍖栨病鏈夐厤缃湴鐞嗗洿鏍忥紝涓嶅鐞�;
+ continue;
+ }
+ //鑷姩鍖栫含搴�
+ double lat = Convert.ToDouble(logicDate.geo_fence.latitude);
+ //鑷姩鍖栫粡搴�
+ double lon = Convert.ToDouble(logicDate.geo_fence.longitude);
+ //鑷姩鍖栭厤缃緭鍏ユ潯浠�<鍦扮悊鍥存爮鍗婂緞><鍗曚綅锛屽叕閲屻�佸崈绫�.绫�>
+ int radius = int.Parse(logicDate.geo_fence.radius);
+ //璁$畻2涓粡绾害涔嬮棿鐨勮窛绂�
+ int r =Infrastructure.Service.Helper.CalculatedDistance.Distance(out_lat, out_lng, lat, lon);
+ //瀹氫箟涓�涓眬閮ㄥ彉閲�
+ string direction = string.Empty;
+ //涓ょ偣璺濈灏忎簬閰嶇疆璺濈<鏃㈣嚜鍔ㄥ寲閰嶇疆杈撳叆鏉′欢鍦扮悊鍥存爮鍗婂緞>,璇存槑杩涘叆鍖哄煙
+ if (r<radius) {
+ //鍒拌揪鏌愬湴
+ direction = "arrive";
+ } else {
+ //绂诲紑
+ direction = "leave";
+ }
+ bool f= Send.GeoFenceStateReport(logicDate.userLogicId,logicDate.sid, direction);
+ //if () { }
+ //Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd);
+ }
+
+ }
+
+ }
}
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
index da2a973..2bcf99d 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/brightnessView.cs
@@ -93,6 +93,10 @@
ProgressTextColor = CSS.CSS_Color.textColor,
ProgressTextSize = 10,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏�
SeekBarViewHeight = Application.GetRealHeight(8),//杩涘害鏉$殑楂樺害
+ MinValue=5,//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+ MaxValue=100,
+ Progress=5,//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+
};
/// <summary>
/// 鍥炬爣+
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index e933b09..f38003b 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -576,8 +576,10 @@
/// 閫昏緫浣胯兘锛堝紑锛屽叧锛�
/// </summary>
public string enable = "";
- //public CycleA cycle;
- //public string modifyTime = "";
+ /// <summary>
+ /// 鍦扮悊鍥存爮閰嶇疆
+ /// </summary>
+ public Fence geo_fence = new Fence();
}
class CycleA
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
index 661dbcd..0e7d6c0 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/OutdoorEnvironment.cs
@@ -129,31 +129,31 @@
{
case StringId.wendugaoyu:
{
- keyValue = "outdoor_temp";
+ keyValue = "temperature";
comparator = ">";
}
break;
case StringId.wendudiyu:
{
- keyValue = "outdoor_temp";
+ keyValue = "temperature";
comparator = "<";
}
break;
case StringId.shidugaoyu:
{
- keyValue = "outdoor_humity";
+ keyValue = "humidity";
comparator = ">";
}
break;
case StringId.shidudiyu:
{
- keyValue = "outdoor_humity";
+ keyValue = "humidity";
comparator = "<";
}
break;
}
- AddDic(keyValue, comparator, value);
+ AddDic(keyValue, comparator, value,"float");
});
}
/// <summary>
@@ -169,24 +169,24 @@
, (text) =>
{
var value= pmView.GetValue("pm25", text);
- AddDic("pm2.5", "in", value);
+ AddDic("pm25", "in", value, "integer");
});
}
/// <summary>
/// 灏佽鏁版嵁
/// </summary>
- /// <param name="keyValue">绫诲瀷鍊�(pm2.5锛沷utdoor_temp锛沷utdoor_humity)</param>
+ /// <param name="keyValue">绫诲瀷鍊�(pm25锛泃emperature锛沨umidity)</param>
/// <param name="comparator">姣旇緝鍏崇郴</param>
/// <param name="value">鍊�</param>
- private void AddDic(string keyValue, string comparator, string value)
+ public void AddDic(string keyValue, string comparator,string value,string data_type)
{
Input input = new Input();
input.sid = LogicMethod.CurrLogicMethod.NewSid();
- input.condition_type = "4";
+ input.condition_type = "6";
Dictionary<string, string> dic = new Dictionary<string, string>();
LogicMethod.CurrLogicMethod.dictionary(dic, "key", keyValue);
LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", comparator);
- LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "float");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", data_type);
LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
input.condition.Add(dic);
AddCondition(input, keyValue, comparator);
@@ -204,7 +204,7 @@
for (var i = 0; i < Logic.currlogic.input.Count; i++)
{
var condition_type = Logic.currlogic.input[i].condition_type;
- if (condition_type == "4")
+ if (condition_type == "6")
{
var dicList = Logic.currlogic.input[i].condition;
if (ExistKey(dicList, keyValue, comparator))
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index b05eac1..7398574 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -736,6 +736,14 @@
};
}
break;
+ case "鍦扮悊鍥存爮":
+ {
+ list = new List<string> {
+ Language.StringByID(StringId.likai ),
+ Language.StringByID(StringId.daoda),
+ };
+ }
+ break;
}
return list;
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
index a4aeaed..3097608 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -106,6 +106,14 @@
conditionArray.Add(conditionJOb);
}
inputTypeJOb.Add("condition",conditionArray);
+ if (dictionary.condition_type=="8") {
+ ///鍦扮悊鍥存爮
+ var geo_fencejob = new JObject();
+ geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
+ geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
+ geo_fencejob.Add("radius", dictionary.geo_fence.radius);
+ inputTypeJOb.Add("geo_fence", geo_fencejob);
+ }
inputArray.Add(inputTypeJOb);
}
@@ -217,6 +225,15 @@
conditionJOb.Add("data_type", dic["data_type"]);
conditionJOb.Add("value", dic["value"]);
conditionArray.Add(conditionJOb);
+ if (dictionary.condition_type == "8")
+ {
+ ///鍦扮悊鍥存爮
+ var geo_fencejob = new JObject();
+ geo_fencejob.Add("longitude", dictionary.geo_fence.longitude);
+ geo_fencejob.Add("latitude", dictionary.geo_fence.latitude);
+ geo_fencejob.Add("radius", dictionary.geo_fence.radius);
+ inputTypeJOb.Add("geo_fence", geo_fencejob);
+ }
}
inputTypeJOb.Add("condition", conditionArray);
inputArray.Add(inputTypeJOb);
@@ -333,6 +350,38 @@
}
return responsePackNew;
}
+
+
+ /// <summary>
+ /// 鑷姩鍖栧湴鐞嗗洿鏍忕姸鎬佷笂鎶�
+ /// </summary>
+ /// <param name="userLogicId">鑷姩鍖栦簯绔痠d<澶囨敞锛歭ogicSid涓巙serLogicId 涓嶈兘鍚屾椂涓虹┖></param>
+ /// <param name="logicSid">鑷姩鍖杝id<澶囨敞锛歭ogicSid涓巙serLogicId 涓嶈兘鍚屾椂涓虹┖></param>
+ /// <param name="direction">arrive:鍒拌揪(杩涘叆) leave锛氱寮�</param>
+ /// <returns></returns>
+ public static bool GeoFenceStateReport(string userLogicId, string logicSid, string direction)
+ {
+ var jObject = new JObject();
+ jObject.Add("homeId", LogicMethod.CurrLogicMethod.HomeId);
+ jObject.Add("userLogicId", userLogicId);
+ jObject.Add("sid", logicSid);
+ jObject.Add("direction", direction);
+ var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_GeoFenceStateReport);
+ //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
+ if (responsePackNew.Code == StateCode.TOKEN_EXPIRED)
+ {
+ RefreshToken();
+ GeoFenceStateReport(userLogicId, logicSid, direction);
+ }
+ if (responsePackNew.Code == "0")
+ {
+ //鎴愬姛
+ return true;
+ }
+ //澶辫触
+ return false;
+ }
+
/// <summary>
///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛�
/// </summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index e6f0701..4e8a634 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -90,6 +90,7 @@
brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom;
brightnessView.btnText.TextID = StringId.brightnesLogic;
fLayout.AddChidren(brightnessView.FLayoutView());
+ brightnessView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
#endregion
#region 鐐瑰嚮浜嬩欢
///寮�鍏崇偣鍑讳簨浠�
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
index 7bbf196..1c683eb 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/WeatherCondition.cs
@@ -56,15 +56,15 @@
string text = view.btnClick.Tag.ToString();
if (text == Language.StringByID(StringId.clearday))
{
- value = "sunny";
+ value = "Sunny";
}
else if (text == Language.StringByID(StringId.cloudy))
{
- value = "cloudy";
+ value = "Cloudy";
}
else if (text == Language.StringByID(StringId.rain))
{
- value = "rainy";
+ value = "Rain";
}
AddDic(value);
};
@@ -86,13 +86,13 @@
LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
LogicMethod.CurrLogicMethod.dictionary(dic, "value", value);
input.condition.Add(dic);
- AddCondition(input);
+ AddCondition(input, "weather", "=");
}
/// <summary>
/// 娣诲姞鏉′欢
/// </summary>
/// <param name="input"></param>
- private void AddCondition(Input input)
+ private void AddCondition(Input input, string keyValue, string comparator)
{
///璁板綍绱㈠紩鍊�
int index = -1;
@@ -101,6 +101,13 @@
var condition_type = Logic.currlogic.input[i].condition_type;
if (condition_type == "6")
{
+ var dicList = Logic.currlogic.input[i].condition;
+ if (ExistKey(dicList, keyValue, comparator))
+ {
+ ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
+ index = i;
+ break;
+ }
///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
index = i;
break;
@@ -125,5 +132,27 @@
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
+ /// <summary>
+ /// 鍒ゆ柇鏄惁瀛樺湪Key
+ /// </summary>
+ /// <param name="dicList"></param>
+ /// <param name="keyValue"></param>
+ /// <param name="comparator">姣旇緝鍏崇郴</param>
+ /// <returns></returns>
+ private bool ExistKey(List<Dictionary<string, string>> dicList, string keyValue, string comparator)
+ {
+ for (int i = 0; i < dicList.Count; i++)
+ {
+ var dic = dicList[i];
+ string key = dic["key"];
+ string comparatorValue = dic["comparator"];
+ if (key == keyValue && comparatorValue == comparator)
+ {
+ //鍒ゆ柇鏄惁瀛樺湪
+ return true;
+ }
+ }
+ return false;
+ }
}
}
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
index cc204e9..6a3e9c1 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
@@ -46,7 +46,7 @@
//viewLayout.AddChidren(banbenshengjiFL.FLayoutView());
- var versions = Pir.currPir.versions.Find((c) => c.module == "FW");
+ var versions = Pir.currPir.versions.Find((c) => c.module.Contains("FW"));
if (versions == null)
{
versions = new Entity.VersionInfo();
--
Gitblit v1.8.0