| | |
| | | /// <param name="function"></param> |
| | | /// <param name="useRemote">是否直接使用远程发送</param> |
| | | /// <returns></returns> |
| | | public void SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false,int resend = 3) |
| | | public bool SendWriteCommand(Function function, Dictionary<string, string> commandDictionary, bool useRemote = false,int resend = 3) |
| | | { |
| | | function.controlCounter++; |
| | | function.refreshTime = DateTime.Now; |
| | | |
| | | |
| | | //如果是控制调光的开时,亮度值不能为0 |
| | | if (commandDictionary.Count > 2) |
| | |
| | | upDataObj.objects.Add(asd); |
| | | revString = Newtonsoft.Json.JsonConvert.SerializeObject(upDataObj); |
| | | UpdataFunctionStatus(revString, null, true); |
| | | return; |
| | | return true; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | /// <summary> |
| | | /// 全开全关功能 |
| | |
| | | } |
| | | else |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", doorlock.deviceId); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/remoteOpen", requestJson); |
| | | ConfirmUnlocking(doorlock.deviceId, extStr); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 确认开锁 |
| | | /// </summary> |
| | | /// <param name="functionId"></param> |
| | | /// <param name="pwd"></param> |
| | | public void ConfirmUnlocking(string functionId,string pwd) |
| | | { |
| | | Loading loading = new Loading(); |
| | | MainPage.BaseView.AddChidren(loading); |
| | | loading.BackgroundColor = 0x88000000; |
| | | loading.LodingBackgroundColor = UI.CSS.CSS_Color.BackgroundColor; |
| | | loading.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", functionId); |
| | | d.Add("pwd", pwd); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/pwdConfirm", requestJson); |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | Newtonsoft.Json.Linq.JObject pairs = Newtonsoft.Json.Linq.JObject.Parse(pack.Data.ToString()); |
| | | var scrip = pairs.GetValue("scrip"); |
| | | |
| | | d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", functionId); |
| | | d.Add("scrip", scrip); |
| | | requestJson = HttpUtil.GetSignRequestJson(d); |
| | | pack = HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/remoteOpen", requestJson); |
| | | //if(pack.Code == StateCode.SUCCESS) |
| | | //{ |
| | | // return true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // return false; |
| | | //} |
| | | if (pack.Code != StateCode.SUCCESS) { |
| | | Application.RunOnMainThread(() => { |
| | | new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), pack.message); |
| | | UserInfo.Current.doorPasswordString = "";// |
| | | UserInfo.Current.LastTimeOpenDoor = DateTime.MinValue; |
| | | }); |
| | | } |
| | | } |
| | | if (pack.Code != StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), pack.message); |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | loading.Hide(); |
| | | loading.RemoveFromParent(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | //密码冻结 |
| | | //密码验证 |
| | | |