| | |
| | | Array.Copy(arrMsgRec, buf, length); |
| | | lock (tcpClient.m_Buffer) |
| | | { |
| | | //tcpClient.m_Buffer.Add(buf); |
| | | var tcpDataString = System.Text.Encoding.UTF8.GetString(buf); |
| | | AnalysisTcpData(tcpDataString); |
| | | MainPage.Log(tcpDataString); |
| | |
| | | Thread.Sleep(100); |
| | | } |
| | | } |
| | | List<Entity.FunctionOid> tcpAddFunctionOidObjects = new List<Entity.FunctionOid>(); |
| | | /// <summary> |
| | | /// 处理tcp数据 |
| | | /// </summary> |
| | |
| | | switch (tcpType) |
| | | { |
| | | case "device_oid":// 用于原生态设备读写相关操作 |
| | | var addFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TcpAddFunctionOidObject>>(obj.GetValue("objects").ToString()); |
| | | tcpAddFunctionOidObjects = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Entity.FunctionOid>>(obj.GetValue("objects").ToString()); |
| | | |
| | | break; |
| | | case "device_sid": |
| | | var addSidFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<TcpAddFunctionSidObject>(tcpDataString); |
| | | |
| | | Shared.Application.RunOnMainThread(() => { |
| | | var tipDialog = new HDL_ON.UI.UpdataTcpResidenceDataDialog(); |
| | | tipDialog.ShowDialog(addSidFunction.objects, tcpAddFunctionOidObjects); |
| | | }); |
| | | break; |
| | | } |
| | | break; |
| | |
| | | } |
| | | |
| | | |
| | | public class TcpAddFunctionOidObject |
| | | { |
| | | public string oid; |
| | | public string name; |
| | | public string machine_id; |
| | | public string net_id; |
| | | public string dev_id; |
| | | public string channels; |
| | | } |
| | | |
| | | public class TcpAddFunctionSidObject |
| | | { |
| | | SidObject objects = new SidObject(); |
| | | public List<Entity.Function> objects; |
| | | |
| | | public string type;//device_sid |
| | | public string from_oid;//": null, |
| | |
| | | public string command;//": "add" |
| | | } |
| | | |
| | | public class SidObject |
| | | { |
| | | List<Entity.Trait> function = new List<Entity.Trait>(); |
| | | public string sid;//": "000101E10FEB7212040100010700", |
| | | public string name;//": "HVAC-1" |
| | | } |
| | | //public class SidObject |
| | | //{ |
| | | // public List<Entity.Trait> function = new List<Entity.Trait>(); |
| | | // public string sid;//": "000101E10FEB7212040100010700", |
| | | // public string name;//": "HVAC-1" |
| | | //} |
| | | |
| | | } |