From e34270918f2e831048114ecdfcfec3e3cdbb6fd7 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 26 五月 2022 17:42:58 +0800
Subject: [PATCH] Merge branch 'release0123' into wxr0114
---
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 27 ++
HDL-ON_Android/Properties/AndroidManifest.xml | 4
HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs | 1
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs | 1
HDL_ON/Common/ApiUtlis.cs | 4
HDL_ON/Entity/DB_ResidenceData.cs | 4
HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs | 7
HDL_ON/DAL/Mqtt/MqttClient.cs | 11
HDL_ON/Entity/FunctionList.cs | 19 +
HDL_ON/Entity/Function/Sensor.cs | 138 ++++++++++
HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs | 227 ++++++++--------
HDL-ON_iOS/Info.plist | 4
HDL_ON/DAL/DriverLayer/Control.cs | 77 +++++
HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs | 231 +++++++++++++++++
HDL_ON/UI/UI1-Login/LoginPage.cs | 4
15 files changed, 633 insertions(+), 126 deletions(-)
diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml
index bdc6cdf..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:versionCode="202203111" android:versionName="1.5.5" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools">
- <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="30" />
+<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 fa24946..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.502203111</string>
+ <string>1.5.502205201</string>
<key>CFBundleVersion</key>
- <string>1.5.503111</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 c2ac822..181c03b 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 f14125b..8045608 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)
@@ -655,6 +655,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 2adbeba..883d94a 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -1094,8 +1094,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 9fa20e5..f832656 100644
--- a/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
+++ b/HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
@@ -120,6 +120,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/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs
index bbe27bd..0113d52 100644
--- a/HDL_ON/Entity/DB_ResidenceData.cs
+++ b/HDL_ON/Entity/DB_ResidenceData.cs
@@ -470,6 +470,10 @@
#endregion
+ /// <summary>
+ /// 鍦烘櫙绛涢�夋椂锛岄�夋嫨鐨勬埧闂�
+ /// </summary>
+ public string sceneChooseRoomId = "";
/// <summary>
diff --git a/HDL_ON/Entity/Function/Sensor.cs b/HDL_ON/Entity/Function/Sensor.cs
index 82ed611..aff130f 100644
--- a/HDL_ON/Entity/Function/Sensor.cs
+++ b/HDL_ON/Entity/Function/Sensor.cs
@@ -64,7 +64,7 @@
}
}
double value = 0.0;
- double.TryParse( attr.state,out value);
+ double.TryParse(attr.state, out value);
return Convert.ToDouble(value);
}
@@ -126,6 +126,48 @@
}
return _intervalValue;
+ }
+
+ public string Unit(Function function)
+ {
+ string unit = "";
+
+ if (function.attrKeyConfigs.Count > 0)
+ {
+
+ foreach (var attrKey in function.attrKeyConfigs)
+ {
+ if (function.spk.Replace(".", "").Contains(attrKey.key.Replace(".", "")))
+ {
+ if (!string.IsNullOrEmpty(attrKey.unit))
+ return attrKey.unit;
+ }
+ }
+ }
+
+ switch (function.spk)
+ {
+ case SPK.SensorPm25:
+ unit = "ug/m虏";
+ break;
+ case SPK.SensorTemperature:
+ unit = "掳C";
+ break;
+ case SPK.SensorTVOC:
+ unit = "PPB";
+ break;
+ case SPK.SensorCO2:
+ unit = "PPM";
+ break;
+ case SPK.SensorHumidity:
+ unit = "%";
+ break;
+ case SPK.SensorHcho:
+ unit = "mg/m3";
+ break;
+ }
+
+ return unit;
}
/// <summary>
@@ -237,6 +279,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>
@@ -245,6 +350,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 55d26a3..ce16d6d 100644
--- a/HDL_ON/Entity/FunctionList.cs
+++ b/HDL_ON/Entity/FunctionList.cs
@@ -459,12 +459,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();
@@ -481,6 +494,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 c5577fa..949c341 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -217,6 +217,7 @@
//etAccount.Text = "18316120654";//tujie
//etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰
etAccount.Text = "18244942707";
+ etAccount.Text = "3083375423@qq.com";//闄堜紵娼� 鑷爺鍙瀵硅
}
else
{
@@ -243,7 +244,8 @@
//etAccount.Text = "13375012441";
//etAccount.Text = "info@smartlife-ks.com";
//etAccount.Text = "551775569@qq.com";//wcf
- etAccount.Text = "15626203746";
+ //etAccount.Text = "15626203746";
+ etAccount.Text = "18244942707";
//etAccount.Text = "zhangquansongjava@163.com";
//etAccount.Text = "s.savinov@hdlautomation.ru";
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
index f70fc3b..5d1ec08 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -98,6 +98,7 @@
public void LoadPage(Action backRefresh)
{
+ DB_ResidenceData.Instance.SupportFacePass
new TopViewDiv(bodyView, Language.StringByID(StringId.EditScene)).LoadTopView(backRefresh);
initPage();
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
index 5f4966d..8f089d6 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -156,9 +156,33 @@
{
unallocatedList.Add(function);
}
+
+ }
+ if (string.IsNullOrEmpty(DB_ResidenceData.Instance.sceneChooseRoomId))
+ {
+ LoadFunctionListRow(null);
+ }
+ else
+ {
+ var selectedRoom = Room.CurrentSpatial.RoomList.Find((obj) => obj.uid == DB_ResidenceData.Instance.sceneChooseRoomId);
+
+ var listAllFun = new List<Function>();
+ var listFun = new List<Function>();
+ listAllFun.AddRange(unallocatedList);
+ listAllFun.AddRange(allocatedList);
+
+ btnFloor.Text = selectedRoom.floorRoomName;
+ foreach(var funtion in listAllFun)
+ {
+ if (funtion.roomIds.Contains(selectedRoom.roomId))
+ {
+ listFun.Add(funtion);
+ }
+ }
+ LoadFunctionListRow(listFun);
+
}
- LoadFunctionListRow(null);
LoadEventList();
}
@@ -278,6 +302,7 @@
form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
{
nowSelectId = selectId;
+ DB_ResidenceData.Instance.sceneChooseRoomId = selectId;
//閲嶆柊鍒锋柊璁惧鍒楄〃
this.LoadFunctionListRow(listFun);
}, nowSelectId);
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
index 8ab3dc2..47800c8 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/ColorTureLampPageBLL.cs
@@ -26,8 +26,8 @@
if (!bodyView.onDimmerBar)
{
bodyView.dimmerBar.Progress = Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness));
- }
- bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%";
+ }
+ bodyView.btnBrightnessText.Text = updataTemp.GetAttrState(FunctionAttributeKey.Brightness) + "%";
bodyView.btnBrightnessText.Y = ((100 - Convert.ToInt32(updataTemp.GetAttrState(FunctionAttributeKey.Brightness))) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
}
else
@@ -38,8 +38,8 @@
bodyView.barColorTemplatrue.Enable = updataTemp.trait_on_off.curValue.ToString() == "on";
var cct = 27;
int.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CCT), out cct);
- bodyView.barColorTemplatrue.Progress = cct / 100;
- //璁剧疆鍒濆鍊�
+ bodyView.barColorTemplatrue.Progress = cct / 100;
+ //璁剧疆鍒濆鍊�
bodyView.barColorTemplatrue.SetCustomText(bodyView.barColorTemplatrue.Progress * 100 + "K");
}
@@ -59,7 +59,7 @@
LoadEvet_ChangeFadeTime();
LoadEvet_ChangeColorTemplatrue();
//鍥為��鍒锋柊淇℃伅浜嬩欢
- actionRefresh = () =>
+ actionRefresh = () =>
{
btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = function.GetRoomListName();
@@ -71,54 +71,54 @@
/// </summary>
void LoadEvet_ChangeFadeTime()
{
- if (function.GetAttribute(FunctionAttributeKey.FadeTime) != null)
- {
- barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
- {
- function.SetAttrState(FunctionAttributeKey.FadeTime, e.ToString());
- function.SaveFunctionFile();
- };
- }
+ if (function.GetAttribute(FunctionAttributeKey.FadeTime) != null)
+ {
+ barFadeTime.OnStopTrackingTouchEvent = (sender, e) =>
+ {
+ function.SetAttrState(FunctionAttributeKey.FadeTime, e.ToString());
+ function.SaveFunctionFile();
+ };
+ }
}
/// <summary>
/// 淇敼鑹叉俯
/// </summary>
void LoadEvet_ChangeColorTemplatrue()
- {
- if (!function.online)
- {
- new Tip()
- {
- CloseTime = 1,
- Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
- Direction = AMPopTipDirection.None,
- }.Show(MainPage.BaseView);
- return;
+ {
+ if (!function.online)
+ {
+ new Tip()
+ {
+ CloseTime = 1,
+ Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+ Direction = AMPopTipDirection.None,
+ }.Show(MainPage.BaseView);
+ return;
}
barColorTemplatrue.OnProgressChangedEvent += (sender, value) =>
{
- new System.Threading.Thread(() =>
- {
- Application.RunOnMainThread(() =>
- {
- //璁剧疆鑷畾涔夌殑鏂囨湰
- barColorTemplatrue.SetCustomText(value * 100 + "K");
- function.SetAttrState(FunctionAttributeKey.CCT, value * 100);
- //System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- //d.Add(FunctionAttributeKey.CCT, function.Attr_CCT.curValue.ToString());
- //Control.Ins.SendWriteCommand(function, d);
+ new System.Threading.Thread(() =>
+ {
+ Application.RunOnMainThread(() =>
+ {
+ //璁剧疆鑷畾涔夌殑鏂囨湰
+ barColorTemplatrue.SetCustomText(value * 100 + "K");
+ function.SetAttrState(FunctionAttributeKey.CCT, value * 100);
+ //System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ //d.Add(FunctionAttributeKey.CCT, function.Attr_CCT.curValue.ToString());
+ //Control.Ins.SendWriteCommand(function, d);
});
//System.Threading.Thread.Sleep(200);
}).Start();
- };
-
+ };
+
barColorTemplatrue.OnStopTrackingTouchEvent = (sender, value) =>
- {
- function.SetAttrState(FunctionAttributeKey.CCT, value * 100);
- System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- d.Add(FunctionAttributeKey.CCT, (value * 100 ).ToString());
- Control.Ins.SendWriteCommand(function, d);
+ {
+ function.SetAttrState(FunctionAttributeKey.CCT, value * 100);
+ System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ d.Add(FunctionAttributeKey.CCT, (value * 100 ).ToString());
+ Control.Ins.SendWriteCommand(function, d);
};
}
@@ -139,74 +139,79 @@
/// </summary>
void LoadEvent_DimmerBar()
{
- dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
- {
- if (!function.online)
- {
- new Tip()
- {
- CloseTime = 1,
- Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
- Direction = AMPopTipDirection.None,
- }.Show(MainPage.BaseView);
- return;
+ dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
+ {
+ if (!function.online)
+ {
+ new Tip()
+ {
+ CloseTime = 1,
+ Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+ Direction = AMPopTipDirection.None,
+ }.Show(MainPage.BaseView);
+ return;
}
onDimmerBar = false;
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));
+ if (dimmerBar.Progress > 0)
+ {
+ d.Add(FunctionAttributeKey.OnOff, "on");
+ }
Control.Ins.SendWriteCommand(function, d);
//function.fadeTime = barFadeTime.Progress;
- btnBrightnessText.Text = dimmerBar.Progress + "%";
-
- dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
- };
- if (function.online)
- {
- dimmerBar.OnStartTrackingTouchEvent = (sender, e) =>
- {
- onDimmerBar = true;
- };
- dimmerBar.OnProgressChangedEvent = (sender, e) =>
- {
- dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
- //function.fadeTime = 0;
- //if (!btnSwitch.IsSelected)
- //{
- // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
- //}
- //btnSwitch.IsSelected = e > 0 ? true : false;
- //function.brightness = e;
- //function.trait_on_off.curValue = e > 0 ? "on" : "off";
-
- //if (e == 0 || e == 100)
- //{
- // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
- // Control.Ins.SendWriteCommand(function, d);
- //}
- //else
- //{
- // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
- // {
- // function.refreshTime = DateTime.Now;
- // new System.Threading.Thread(() =>
- // {
- // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
- // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
- // Control.Ins.SendWriteCommand(function, d);
- // })
- // { IsBackground = true }.Start();
- // }
- //}
-
- //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
- //btnBrightnessText.Text = function.brightness + "%";
-
- btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
- btnBrightnessText.Text = dimmerBar.Progress + "%";
- };
-
+ btnBrightnessText.Text = dimmerBar.Progress + "%";
+
+ dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+ };
+ if (function.online)
+ {
+ dimmerBar.OnStartTrackingTouchEvent = (sender, e) =>
+ {
+ onDimmerBar = true;
+ };
+ dimmerBar.OnProgressChangedEvent = (sender, e) =>
+ {
+ dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+ //function.fadeTime = 0;
+ //if (!btnSwitch.IsSelected)
+ //{
+ // dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
+ //}
+ //btnSwitch.IsSelected = e > 0 ? true : false;
+ //function.brightness = e;
+ //function.trait_on_off.curValue = e > 0 ? "on" : "off";
+
+ //if (e == 0 || e == 100)
+ //{
+ // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
+ //}
+ //else
+ //{
+ // if (200 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
+ // {
+ // function.refreshTime = DateTime.Now;
+ // new System.Threading.Thread(() =>
+ // {
+ // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
+ // d.Add(FunctionAttributeKey.Brightness, function.brightness.ToString());
+ // Control.Ins.SendWriteCommand(function, d);
+ // })
+ // { IsBackground = true }.Start();
+ // }
+ //}
+
+ //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16 - 16) / 100) + Application.GetRealWidth(40);
+ //btnBrightnessText.Text = function.brightness + "%";
+
+ btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
+ btnBrightnessText.Text = dimmerBar.Progress + "%";
+ };
+
}
}
@@ -216,16 +221,16 @@
void LoadSwitchEvent()
{
btnSwitch.MouseUpEventHandler += (sender, e) =>
- {
- if (!function.online)
- {
- new Tip()
- {
- CloseTime = 1,
- Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
- Direction = AMPopTipDirection.None,
- }.Show(MainPage.BaseView);
- return;
+ {
+ if (!function.online)
+ {
+ new Tip()
+ {
+ CloseTime = 1,
+ Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+ Direction = AMPopTipDirection.None,
+ }.Show(MainPage.BaseView);
+ return;
}
//function.fadeTime = barFadeTime.Progress;
btnSwitch.IsSelected = !btnSwitch.IsSelected;
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs
index a8d34a9..a2706c7 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
new file mode 100644
index 0000000..d6b5a5e
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/Video/WanderingAlarmPage.cs
@@ -0,0 +1,231 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DAL.Server;
+using HDL_ON.UI.CSS;
+using Shared;
+namespace HDL_ON.UI.UI2.FuntionControlView.Video
+{
+ public class WanderingAlarmPage : FrameLayout
+ {
+ FrameLayout bodyView;
+ string deviceId;
+ public WanderingAlarmPage(string deviceId)
+ {
+ bodyView = this;
+ this.deviceId = deviceId;
+ }
+
+ VerticalScrolViewLayout contentView;
+
+ public void LoadPage()
+ {
+ bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
+ new TopViewDiv(bodyView, Language.StringByID(StringId.WanderingAlarm)).LoadTopView();
+
+ var btnTipMsg = new Button()
+ {
+ Y = Application.GetRealHeight(64),
+ X = Application.GetRealWidth(20),
+ Height = Application.GetRealHeight(58),
+ Width = Application.GetRealWidth(318),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ Text = "*鍙瀵硅鍙互鑷姩璇嗗埆闂ㄥ彛鍙枒浜哄憳锛屽苟鍙戣捣寰樺緤鎶ヨ璁板綍"
+ };
+ if(Language.CurrentLanguage != "Chinese")
+ {
+ btnTipMsg.Text = "*Visual intercom can automatically identify suspicious persons at the door and initiate wandering alarm records";
+ }
+ bodyView.AddChidren(btnTipMsg);
+
+ contentView = new VerticalScrolViewLayout()
+ {
+ Y = Application.GetRealHeight(64 + 62),
+ Height = Application.GetRealHeight(550),
+ };
+ bodyView.AddChidren(contentView);
+
+ LoadCloudData(20, 1);
+ }
+
+ /// <summary>
+ /// 璇诲彇浜戠鏁版嵁
+ /// </summary>
+ void LoadCloudData(int pageCount,int pageNo)
+ {
+ Loading loading = new Loading();
+ bodyView.AddChidren(loading);
+ loading.Start("");
+ new System.Threading.Thread(() => {
+ try
+ {
+ HttpServerRequest http = new HttpServerRequest();
+ var pack = http.GetAlarmRecords(deviceId, pageCount,pageNo);
+ if (pack.Code == StateCode.SUCCESS)
+ {
+ var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<AlarmRecordInfoPack>(pack.Data.ToString());
+ Application.RunOnMainThread(() =>
+ {
+ LoadSceneGallery(obj);
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"璇诲彇寰樺緤鎶ヨ鏁版嵁寮傚父锛歿ex.Message}");
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (loading != null)
+ {
+ loading.Hide();
+ loading.RemoveFromParent();
+ }
+ });
+ }
+ })
+ { IsBackground = true }.Start();
+
+ }
+
+ /// <summary>
+ /// 鍔犺浇鍦烘櫙鍥惧簱
+ /// </summary>
+ void LoadSceneGallery(AlarmRecordInfoPack pack)
+ {
+ FrameLayout sceneImageRow = new FrameLayout()
+ {
+ Height = Application.GetRealWidth(128),
+ };
+ new System.Threading.Thread(() =>
+ {
+ for (int i = 0; i < pack.list.Count; i++)
+ {
+ var item = pack.list[i];
+
+ var imageBytes = ImageUtlis.Current.DownImageByImageUrl(item.alarmImg);
+ Application.RunOnMainThread(() =>
+ {
+ var sceneImageView = new ImageView()
+ {
+ Width = Application.GetRealWidth(172),
+ Height = Application.GetRealHeight(90),
+ Radius = (uint)Application.GetRealWidth(12),
+ ImageBytes = imageBytes
+ };
+ var btnTime = new Button()
+ {
+ Width = Application.GetRealHeight(160),
+ Height = Application.GetRealHeight(41),
+ Y = Application.GetRealHeight(90),
+ Text = Utlis.UnixToDateTimeMS(item.alarmTime).ToString(),
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextAlignment = TextAlignment.Center
+ };
+ if (i % 2 == 0)
+ {
+ sceneImageRow = new FrameLayout()
+ {
+ Height = Application.GetRealHeight(90 + 53),
+ };
+ contentView.AddChidren(sceneImageRow);
+ sceneImageView.X = Application.GetRealWidth(10);
+ sceneImageRow.AddChidren(sceneImageView);
+ btnTime.X = Application.GetRealWidth(10);
+ sceneImageRow.AddChidren(btnTime);
+
+ }
+ else
+ {
+ sceneImageView.X = Application.GetRealWidth(194);
+ sceneImageRow.AddChidren(sceneImageView);
+
+ btnTime.X = Application.GetRealWidth(194);
+ sceneImageRow.AddChidren(btnTime);
+ }
+
+
+ sceneImageView.MouseUpEventHandler = (sender, e) =>
+ {
+ Dialog dialog = new Dialog();
+
+ FrameLayout dialogContentView = new FrameLayout();
+ dialog.AddChidren(dialogContentView);
+ dialogContentView.MouseUpEventHandler = (sender2, e2) =>
+ {
+ dialog.Close();
+ };
+ ImageView btnImage = new ImageView()
+ {
+ Gravity = Gravity.Center,
+ Height = Application.GetRealHeight(211),
+ ImageBytes = sceneImageView.ImageBytes,
+ };
+ dialogContentView.AddChidren(btnImage);
+
+
+ dialog.Show();
+ };
+
+ });
+ System.Threading.Thread.Sleep(20);
+
+ }
+ Application.RunOnMainThread(() =>
+ {
+ if (pack.totalPage > pack.pageNo)
+ {
+ var btnLoadMore = new Button()
+ {
+ TextAlignment = TextAlignment.Center,
+ TextID = StringId.GetMore,
+ Height = Application.GetRealHeight(60),
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ };
+ contentView.AddChidren(btnLoadMore);
+ btnLoadMore.MouseUpEventHandler = (sender, e) =>
+ {
+ LoadCloudData(20, pack.pageNo + 1);
+ btnLoadMore.RemoveFromParent();
+ };
+ }
+ });
+
+ })
+ { IsBackground = true }.Start();
+ }
+
+
+ }
+
+ public class AlarmRecordInfoPack
+ {
+ public int totalCount = 0;
+
+ public int totalPage = 0;
+
+ public int pageNo = 0;
+
+ public int pageSize = 0;
+
+ public List<AlarmRecordInfo> list = new List<AlarmRecordInfo>();
+ }
+
+ /// <summary>
+ /// 寰樺緤鎶ヨ淇℃伅
+ /// </summary>
+ public class AlarmRecordInfo
+ {
+ public string alarmImg = string.Empty;
+
+ public long alarmTime;
+
+ public string alarmType = string.Empty;
+
+ public string alarmTypeDesc = string.Empty;
+ }
+}
--
Gitblit v1.8.0