| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI; |
| | | using Shared; |
| | |
| | | |
| | | public class Control |
| | | { |
| | | |
| | | |
| | | static Control _control; |
| | | public static Control Ins |
| | | { |
| | |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | foreach (var temp in functions) |
| | | foreach (var function in functions) |
| | | { |
| | | Dictionary<string, string> d1 = new Dictionary<string, string>(); |
| | | d1.Add(FunctionAttributeKey.OnOff, open ? "on" : "off"); |
| | | SendWriteCommand(temp, d1); |
| | | if (function.spk == SPK.PanelSocket) |
| | | { |
| | | if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null) |
| | | { |
| | | d1.Add("on_off_usb", function.trait_on_off.curValue.ToString()); |
| | | } |
| | | } |
| | | SendWriteCommand(function, d1); |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | }) |
| | |
| | | topicAndLengthBytes.CopyTo(sendDataBytes, 0); |
| | | bodyBytes.CopyTo(sendDataBytes, topicAndLengthBytes.Length); |
| | | |
| | | //var sendDataString = Encoding.UTF8.GetString(sendDataBytes); |
| | | //MainPage.Log($"转换HDL-Link数据\r\n{sendDataString}\r\n"); |
| | | var sendDataString = Encoding.UTF8.GetString(sendDataBytes); |
| | | MainPage.Log($"转换HDL-Link数据\r\n{sendDataString}\r\n"); |
| | | //*************************************************************** |
| | | |
| | | return sendDataBytes; |
| | |
| | | var revString = Encoding.UTF8.GetString(receiveBytes); |
| | | receiveObj.BodyDataString = revString; |
| | | MainPage.Log($"局域网信息: 解密后:" + receiveObj.BodyDataString); |
| | | //if(receiveObj.Topic.EndsWith("/thing/property/up")) |
| | | //if (receiveObj.Topic.EndsWith("/thing/property/up")) |
| | | //{ |
| | | // MsgInfoList.Add(revString + "\r\n"); |
| | | //} |
| | |
| | | |
| | | if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast) |
| | | { |
| | | |
| | | |
| | | var bodyJObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(res[1]); |
| | | if (bodyJObj == null) |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | MainPage.Log(localFunction.name); |
| | | |
| | | if (Ins.GatewayOnline_Local && isCloudData)//本地链接,除了涂鸦设备数据之外的云端数据不处理 |
| | | { |
| | | if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk)) |
| | |
| | | { |
| | | localFunction.time_stamp = temp.time_stamp; |
| | | localFunction.SetAttrState(attr.key, attr.value); |
| | | //Console.WriteLine("音乐播放器添加缓存数据=======" + revString); |
| | | |
| | | } |
| | | |
| | |
| | | case SPK.ElectricSocket: |
| | | case SPK.PanelSocket: |
| | | SocketPage.UpdataState(localFunction); |
| | | SocketPage_InstantaneousValue.UpdataView(localFunction); |
| | | break; |
| | | case SPK.ElectricTV: |
| | | break; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | #region 门锁 |
| | | |
| | | /// <summary> |
| | | /// //一键(远程)开锁 |
| | | /// </summary> |
| | | public void OneKeyUnlocking(Function doorlock,string extStr) |
| | | { |
| | | if (Ins.GatewayOnline_Local) |
| | | { |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | var functionControlDataObj = doorlock.GetGatewayAlinkDoorlockData(UserInfo.Current.ID,extStr); |
| | | var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj); |
| | | var sendBytes = Ins.ConvertSendBodyData($"/base/{Control.Ins.GatewayId}/thing/service/doorRemoteOpen/down", functionControlDataJson); |
| | | new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, 0); |
| | | } |
| | | 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); |
| | | HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/remoteOpen", requestJson); |
| | | } |
| | | } |
| | | //密码冻结 |
| | | //密码验证 |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | } |