| | |
| | | <?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"/>--> |
| | |
| | | <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> |
| | |
| | | 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(); |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | set |
| | | { |
| | | if (_GatewayOnline_Local != value) |
| | | //if (_GatewayOnline_Local != value) |
| | | { |
| | | _GatewayOnline_Local = value; |
| | | if (value) |
| | |
| | | } |
| | | set |
| | | { |
| | | if (_GatewayOnline_Cloud != value) |
| | | //if (_GatewayOnline_Cloud != value) |
| | | { |
| | | _GatewayOnline_Cloud = value; |
| | | if(GatewayOnline_Local) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送读取命令 |
| | | /// 自动判断是否为A协议设备 |
| | | /// </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($"本地通讯 发送HDL-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) |
| | |
| | | //创建AES解密器对象 |
| | | 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 |
| | | |
| | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | double value = 0.0; |
| | | double.TryParse( attr.state,out value); |
| | | double.TryParse(attr.state, out value); |
| | | |
| | | return Convert.ToDouble(value); |
| | | } |
| | |
| | | return _intervalValue; |
| | | } |
| | | |
| | | public string Unit(Function function) |
| | | public string Unit(Function function) |
| | | { |
| | | string unit = ""; |
| | | |
| | |
| | | unit = "ug/m²"; |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | unit = "°C"; |
| | | unit = "°C"; |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | unit = "PPB"; |
| | |
| | | } |
| | | 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> |
| | |
| | | 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: |
| | |
| | | |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | //etAccount.Text = "18316120654";//tujie |
| | | //etAccount.Text = "13450425807";//黄竹溪 knx项目 |
| | | etAccount.Text = "18244942707"; |
| | | etAccount.Text = "13826414433";//陈伟潮 自研可视对讲 |
| | | etAccount.Text = "3083375423@qq.com";//陈伟潮 自研可视对讲 |
| | | } |
| | | else |
| | | { |
| | |
| | | //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"; |
| | | } |
| | |
| | | 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 + "%"; |
| | |
| | | dimmerBar.OnStartTrackingTouchEvent = (sender, e) => |
| | | { |
| | | onDimmerBar = true; |
| | | dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); |
| | | }; |
| | | dimmerBar.OnStopTrackingTouchEvent = (sender, e) => |
| | | { |
| | |
| | | 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) |
| | | //{ |
| | |
| | | }; |
| | | |
| | | }); |
| | | System.Threading.Thread.Sleep(50); |
| | | System.Threading.Thread.Sleep(20); |
| | | |
| | | } |
| | | Application.RunOnMainThread(() => |