HttpHelper.cs 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Threading.Tasks;
  6. using UnityAsync;
  7. using Best.HTTP;
  8. using Best.HTTP.JSON;
  9. using Newtonsoft.Json;
  10. using Newtonsoft.Json.Linq;
  11. using UnityEngine;
  12. using UnityEngine.Networking;
  13. using Unity.VisualScripting;
  14. using static System.Net.WebRequestMethods;
  15. public class HttpHelper : MonoBehaviour
  16. {
  17. public Action OnSWYJRefresh;
  18. public static HttpHelper _Instance;
  19. public static Dictionary<string, DevicesId_Data> _devicesIdDatas = new Dictionary<string, DevicesId_Data>();
  20. public const int timeOut = 3;
  21. private async void Awake()
  22. {
  23. _Instance = this;
  24. GetSensorList();
  25. if (GlobalData.pageIndex == PageIndex.Page1 || GlobalData.pageIndex == PageIndex.Page2 || GlobalData.pageIndex == PageIndex.Page3)
  26. {
  27. Debug.Log("HttpInitYZTData");
  28. //可以并行,无需等待
  29. InitYZTData();
  30. }
  31. if (GlobalData.pageIndex == PageIndex.Page1)
  32. {
  33. SendBuYuan_GetSensorData();
  34. SendTaoKou_GetSensorData();
  35. GetBuYuanDevicesGroupInfo();
  36. }
  37. if (GlobalData.pageIndex == PageIndex.Page1)
  38. {
  39. Debug.Log("InitXHGKData");
  40. //可以并行,无需等待
  41. InitXHGKData();//已完成迁移
  42. }
  43. if (GlobalData.pageIndex == PageIndex.Page1)
  44. {
  45. Debug.Log("HttpInitGCJKData");
  46. //可以并行,无需等待
  47. InitGCJKData();
  48. }
  49. if (GlobalData.pageIndex == PageIndex.Page1)
  50. {
  51. Debug.Log("HttpInitXHDDData");
  52. //可以并行,无需等待
  53. InitXHDDData();
  54. }
  55. if (GlobalData.pageIndex == PageIndex.Page1)
  56. {
  57. Debug.Log("HttpInitRKZYData");
  58. //可以并行,无需等待
  59. InitRKZYData();
  60. }
  61. if (GlobalData.pageIndex == PageIndex.Page1 || GlobalData.pageIndex == PageIndex.Page2)
  62. {
  63. Debug.Log("HttpInitSWYJData");
  64. //可以并行,无需等待
  65. InitSWYJData();
  66. }
  67. if (GlobalData.pageIndex == PageIndex.Page1 || GlobalData.pageIndex == PageIndex.Page2)
  68. {
  69. Debug.Log("HttpInitGCYWData1");
  70. //可以并行,无需等待
  71. InitGCYWData1(0);
  72. }
  73. if (GlobalData.pageIndex == PageIndex.Page1 || GlobalData.pageIndex == PageIndex.Page2 || GlobalData.pageIndex == PageIndex.Page3)
  74. {
  75. Debug.Log("HttpInitFloorGateData");
  76. InitFloorGateData();
  77. }
  78. if (GlobalData.pageIndex == PageIndex.Page2)
  79. {
  80. Debug.Log("HttpInitDPSWData");
  81. InitDPSWData();
  82. }
  83. if (GlobalData.pageIndex == PageIndex.Page2)
  84. {
  85. Debug.Log("HttpInitGCYWData2");
  86. InitGCYWData2();
  87. }
  88. if (GlobalData.pageIndex == PageIndex.Page2)
  89. {
  90. Debug.Log("HttpInitYJSJData2");
  91. InitYJSJData2();
  92. }
  93. }
  94. private async Task InitGCYWData2()
  95. {
  96. bool successInternet = true;
  97. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetInspectionStatistics);
  98. requestData.timeout = timeOut;
  99. await requestData.SendWebRequest();
  100. try
  101. {
  102. if (requestData.result != UnityWebRequest.Result.Success)
  103. {
  104. Debug.LogWarning("大屏运维数据联网不成功,读本地缓存数据,原因:返request不成功");
  105. successInternet = false;
  106. }
  107. else
  108. {
  109. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  110. // 提取data字段的值
  111. JToken dataToken = jsonObject["data"];
  112. JToken codeToken = jsonObject["code"];
  113. if (codeToken.ToString() == "200")
  114. {
  115. GlobalData.InspectionStat = JsonConvert.DeserializeObject<List<StationInspection>>(dataToken.ToString());
  116. }
  117. else
  118. {
  119. Debug.LogWarning("大屏运维数据联网不成功,读本地缓存数据,原因:返序列化失败");
  120. successInternet = false;
  121. }
  122. }
  123. }
  124. catch (Exception e)
  125. {
  126. successInternet = false;
  127. Debug.LogWarning("大屏运维数据联网不成功,读本地缓存数据,原因:" + e.ToString());
  128. }
  129. requestData.Dispose();
  130. if (!successInternet)
  131. {
  132. WWW www = new WWW(Application.streamingAssetsPath + "/inspectionStatistics.json");
  133. await new UnityAsync.WaitUntil(() =>
  134. {
  135. return www.isDone;
  136. });
  137. GlobalData.InspectionStat = JsonConvert.DeserializeObject<List<StationInspection>>(www.text);
  138. www.Dispose();
  139. }
  140. }
  141. private async Task InitYJSJData2()
  142. {
  143. bool successInternet = true;
  144. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetAlertData);
  145. requestData.timeout = timeOut;
  146. await requestData.SendWebRequest();
  147. try
  148. {
  149. if (requestData.result != UnityWebRequest.Result.Success)
  150. {
  151. Debug.LogWarning("大屏预警数据联网不成功,读本地缓存数据,原因:返request不成功");
  152. successInternet = false;
  153. }
  154. else
  155. {
  156. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  157. // 提取data字段的值
  158. JToken dataToken = jsonObject["data"];
  159. JToken codeToken = jsonObject["code"];
  160. if (codeToken.ToString() == "200")
  161. {
  162. GlobalData.alertData = JsonConvert.DeserializeObject<AlertData>(dataToken.ToString());
  163. GlobalData.alertData.success = true;
  164. }
  165. else
  166. {
  167. Debug.LogWarning("大屏预警数据联网不成功,读本地缓存数据,原因:返序列化失败");
  168. successInternet = false;
  169. }
  170. }
  171. }
  172. catch (Exception e)
  173. {
  174. successInternet = false;
  175. Debug.LogWarning("大屏预警数据联网不成功,读本地缓存数据,原因:" + e.ToString());
  176. }
  177. requestData.Dispose();
  178. if (!successInternet)
  179. {
  180. WWW www = new WWW(Application.streamingAssetsPath + "/alertData.json");
  181. await new UnityAsync.WaitUntil(() =>
  182. {
  183. return www.isDone;
  184. });
  185. Debug.Log(www.text);
  186. GlobalData.alertData = JsonConvert.DeserializeObject<AlertData>(www.text.ToString());
  187. GlobalData.alertData.success = true;
  188. Debug.Log(GlobalData.alertData.alerts.threeLineWarnings[0].title);
  189. www.Dispose();
  190. }
  191. }
  192. private async Task InitFloorGateData()
  193. {
  194. bool successInternet = true;
  195. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetFloodGateData);
  196. requestData.timeout = timeOut;
  197. await requestData.SendWebRequest();
  198. try
  199. {
  200. if (requestData.result != UnityWebRequest.Result.Success)
  201. {
  202. Debug.LogWarning("大屏闸口数据联网不成功,读本地缓存数据,原因:返request不成功");
  203. successInternet = false;
  204. }
  205. else
  206. {
  207. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  208. // 提取data字段的值
  209. JToken dataToken = jsonObject["data"];
  210. JToken codeToken = jsonObject["code"];
  211. if (codeToken.ToString() == "200")
  212. {
  213. GlobalData.floorGateData = JsonConvert.DeserializeObject<FloodGateStatusData>(dataToken.ToString());
  214. GlobalData.floorGateData.success = true;
  215. }
  216. else
  217. {
  218. Debug.LogWarning("大屏闸口数据联网不成功,读本地缓存数据,原因:返序列化失败");
  219. successInternet = false;
  220. }
  221. }
  222. }
  223. catch (Exception e)
  224. {
  225. successInternet = false;
  226. Debug.LogWarning("大屏闸口数据联网不成功,读本地缓存数据,原因:" + e.ToString());
  227. }
  228. requestData.Dispose();
  229. if (!successInternet)
  230. {
  231. WWW www = new WWW(Application.streamingAssetsPath + "/floodGateStatusData.json");
  232. await new UnityAsync.WaitUntil(() =>
  233. {
  234. return www.isDone;
  235. });
  236. Debug.Log(www.text);
  237. GlobalData.floorGateData = JsonConvert.DeserializeObject<FloodGateStatusData>(www.text.ToString());
  238. GlobalData.floorGateData.success = true;
  239. www.Dispose();
  240. }
  241. }
  242. private async Task InitDPSWData()
  243. {
  244. GlobalData.locationWeatherData = new List<LocationWeatherData>();
  245. bool successInternet = true;
  246. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetHydrologicalData + "?projectType=1");
  247. requestData.timeout = timeOut;
  248. await requestData.SendWebRequest();
  249. try
  250. {
  251. if (requestData.result != UnityWebRequest.Result.Success)
  252. {
  253. Debug.LogWarning("大屏水文数据联网不成功,读本地缓存数据,原因:返request不成功");
  254. successInternet = false;
  255. }
  256. else
  257. {
  258. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  259. // 提取data字段的值
  260. JToken dataToken = jsonObject["data"];
  261. JToken codeToken = jsonObject["code"];
  262. if (codeToken.ToString() == "200")
  263. {
  264. LocationWeatherData data1 = JsonConvert.DeserializeObject<LocationWeatherData>(dataToken.ToString());
  265. GlobalData.locationWeatherData.Add(data1);
  266. }
  267. else
  268. {
  269. Debug.LogWarning("大屏水文数据联网不成功,读本地缓存数据,原因:返序列化失败");
  270. successInternet = false;
  271. }
  272. }
  273. }
  274. catch (Exception e)
  275. {
  276. successInternet = false;
  277. Debug.LogWarning("大屏水文数据联网不成功,读本地缓存数据,原因:" + e.ToString());
  278. }
  279. UnityWebRequest requestData1 = UnityWebRequest.Get(ServerAddress.APIGetHydrologicalData + "?projectType=2");
  280. requestData1.timeout = timeOut;
  281. await requestData1.SendWebRequest();
  282. try
  283. {
  284. if (requestData1.result != UnityWebRequest.Result.Success)
  285. {
  286. Debug.LogWarning("大屏水文数据联网不成功,读本地缓存数据,原因:返request不成功");
  287. successInternet = false;
  288. }
  289. else
  290. {
  291. JObject jsonObject = JObject.Parse(requestData1.downloadHandler.text);
  292. // 提取data字段的值
  293. JToken dataToken = jsonObject["data"];
  294. JToken codeToken = jsonObject["code"];
  295. if (codeToken.ToString() == "200")
  296. {
  297. LocationWeatherData data2 = JsonConvert.DeserializeObject<LocationWeatherData>(dataToken.ToString());
  298. GlobalData.locationWeatherData.Add(data2);
  299. }
  300. else
  301. {
  302. Debug.LogWarning("大屏水文数据联网不成功,读本地缓存数据,原因:返序列化失败");
  303. successInternet = false;
  304. }
  305. }
  306. }
  307. catch (Exception e)
  308. {
  309. successInternet = false;
  310. Debug.LogWarning("大屏水文数据联网不成功,读本地缓存数据,原因:" + e.ToString());
  311. }
  312. requestData.Dispose();
  313. if (!successInternet)
  314. {
  315. WWW www = new WWW(Application.streamingAssetsPath + "/hydrologicalData.json");
  316. await new UnityAsync.WaitUntil(() =>
  317. {
  318. return www.isDone;
  319. });
  320. Debug.Log(www.text);
  321. GlobalData.locationWeatherData = JsonConvert.DeserializeObject<List<LocationWeatherData>>(www.text.ToString());
  322. www.Dispose();
  323. }
  324. }
  325. public async Task InitYZTData()
  326. {
  327. InitYZTData1();//已完成迁移
  328. InitYZTData_BY_Obs();//已完成迁移
  329. InitYZTData_TK_Obs();//新增
  330. InitYZTData3();//已完成迁移
  331. }
  332. public async Task InitYZTData1()
  333. {
  334. bool successInternet = true;
  335. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetWaterManagerProject);
  336. requestData.timeout = timeOut;
  337. await requestData.SendWebRequest();
  338. try
  339. {
  340. if (requestData.result != UnityWebRequest.Result.Success)
  341. {
  342. Debug.LogWarning("YZTLayer联网不成功,读本地缓存数据,原因:返request不成功");
  343. successInternet = false;
  344. }
  345. else
  346. {
  347. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  348. // 提取data字段的值
  349. JToken dataToken = jsonObject["data"];
  350. JToken codeToken = jsonObject["code"];
  351. if (codeToken.ToString() == "200")
  352. {
  353. GlobalData.layerUnitDatas = JsonConvert.DeserializeObject<List<LayerUnitData>>(dataToken.ToString());
  354. }
  355. else
  356. {
  357. Debug.LogWarning("YZTLayer联网不成功,读本地缓存数据,原因:返序列化失败");
  358. successInternet = false;
  359. }
  360. }
  361. }
  362. catch (Exception e)
  363. {
  364. successInternet = false;
  365. Debug.LogWarning("YZTLayer联网不成功,读本地缓存数据,原因:" + e.ToString());
  366. }
  367. requestData.Dispose();
  368. if (!successInternet)
  369. {
  370. WWW www = new WWW(Application.streamingAssetsPath + "/layerUnitDatas.json");
  371. await new UnityAsync.WaitUntil(() =>
  372. {
  373. return www.isDone;
  374. });
  375. GlobalData.layerUnitDatas = JsonConvert.DeserializeObject<List<LayerUnitData>>(www.text);
  376. www.Dispose();
  377. }
  378. for (int i = 0; i < GlobalData.layerUnitDatas.Count; i++)
  379. {
  380. if (GlobalData.layerUnitDatas[i].type == LayerUnitType.JK)
  381. {
  382. GlobalData.obsCameraLib.Add(GlobalData.layerUnitDatas[i].name, GlobalData.layerUnitDatas[i].namePri);
  383. }
  384. }
  385. }
  386. public async Task InitYZTData_BY_Obs()
  387. {
  388. bool successInternet = true;
  389. string sendUrl = ServerAddress.API_GetDevicesInfo;
  390. sendUrl += "/34020000001180000001/channels?page=1&count=100";
  391. Debug.Log(sendUrl);
  392. UnityWebRequest requestData = UnityWebRequest.Get(sendUrl);
  393. requestData.timeout = timeOut;
  394. await requestData.SendWebRequest();
  395. try
  396. {
  397. if (requestData.result != UnityWebRequest.Result.Success)
  398. {
  399. Debug.LogWarning("补元监控数据联网不成功,原因:返request不成功:" + requestData.error);
  400. successInternet = false;
  401. }
  402. else
  403. {
  404. Debug.Log("补元监控数据返回:"+requestData.downloadHandler.text);
  405. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  406. // 提取data字段的值
  407. JToken dataToken = jsonObject["data"];
  408. JToken codeToken = jsonObject["code"];
  409. if (codeToken.ToString() == "0")
  410. {
  411. GlobalData.obsDatas_by = new List<ObsData>();
  412. ServerObsDatas serverObsDatas = JsonConvert.DeserializeObject<ServerObsDatas>(dataToken.ToString());
  413. for (int i = 0; i < serverObsDatas.list.Count; i++)
  414. {
  415. ObsData obsData = new ObsData();
  416. obsData.name = serverObsDatas.list[i].name;
  417. if (GlobalData.obsCameraLib.TryGetValue(obsData.name, out var value))
  418. {
  419. obsData.targetName = value;
  420. }
  421. // if (i > 0)
  422. // {
  423. // obsData.url =
  424. // "http://www.chatgpt918.top:9080/rtp/34020000001180000001_34020000001310000001/hls.m3u8";
  425. // }
  426. // else
  427. // {
  428. //obsData.url = await GetObsUrl(serverObsDatas.list[i].deviceId,serverObsDatas.list[i].channelId);
  429. //Debug.Log("!!!:"+obsData.url);
  430. //obsData.url = ServerAddress.ObsSeverM3U8Address + string.Format("/rtp/{0}_{1}/hls.m3u8", serverObsDatas.list[i].deviceId, serverObsDatas.list[i].channelId);
  431. //}
  432. obsData.type = obsType.BuYuanObs;
  433. obsData.deviceId = serverObsDatas.list[i].deviceId;
  434. obsData.channelId = serverObsDatas.list[i].channelId;
  435. obsData.status = serverObsDatas.list[i].status;
  436. GlobalData.obsDatas_by.Add(obsData);
  437. }
  438. }
  439. else
  440. {
  441. Debug.LogWarning("补元监控数据联网不成功,原因:返序列化失败");
  442. successInternet = false;
  443. }
  444. }
  445. }
  446. catch (Exception e)
  447. {
  448. successInternet = false;
  449. Debug.LogWarning("补元监控数据联网不成功,原因:" + e.ToString());
  450. }
  451. requestData.Dispose();
  452. if (!successInternet)
  453. {
  454. WWW www = new WWW(Application.streamingAssetsPath + "/ObsDatas_BY.json");
  455. await new UnityAsync.WaitUntil(() =>
  456. {
  457. return www.isDone;
  458. });
  459. Debug.Log($"缓存数据:{www.text}");
  460. GlobalData.obsDatas_by = JsonConvert.DeserializeObject<List<ObsData>>(www.text);
  461. www.Dispose();
  462. }
  463. }
  464. public async Task InitYZTData_TK_Obs()
  465. {
  466. bool successInternet = true;
  467. string sendUrl = ServerAddress.API_GetDevicesInfo;
  468. sendUrl += "/34020000001180000002/channels?page=1&count=100";
  469. Debug.Log(sendUrl);
  470. UnityWebRequest requestData = UnityWebRequest.Get(sendUrl);
  471. requestData.timeout = timeOut;
  472. await requestData.SendWebRequest();
  473. try
  474. {
  475. if (requestData.result != UnityWebRequest.Result.Success)
  476. {
  477. Debug.LogWarning("套口监控数据联网不成功,原因:返request不成功:" + requestData.error);
  478. successInternet = false;
  479. }
  480. else
  481. {
  482. Debug.Log("套口监控数据返回:"+requestData.downloadHandler.text);
  483. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  484. // 提取data字段的值
  485. JToken dataToken = jsonObject["data"];
  486. JToken codeToken = jsonObject["code"];
  487. if (codeToken.ToString() == "0")
  488. {
  489. GlobalData.obsDatas_tk = new List<ObsData>();
  490. ServerObsDatas serverObsDatas = JsonConvert.DeserializeObject<ServerObsDatas>(dataToken.ToString());
  491. for (int i = 0; i < serverObsDatas.list.Count; i++)
  492. {
  493. ObsData obsData = new ObsData();
  494. obsData.name = serverObsDatas.list[i].name;
  495. if (GlobalData.obsCameraLib.TryGetValue(obsData.name, out var value))
  496. {
  497. obsData.targetName = value;
  498. }
  499. //obsData.url = await GetObsUrl(serverObsDatas.list[i].deviceId,serverObsDatas.list[i].channelId);
  500. //ServerAddress.ObsSeverM3U8Address + string.Format("/rtp/{0}_{1}/hls.m3u8", serverObsDatas.list[i].deviceId, serverObsDatas.list[i].channelId);
  501. //}
  502. obsData.type = obsType.TaoKouObs;
  503. obsData.deviceId = serverObsDatas.list[i].deviceId;
  504. obsData.channelId = serverObsDatas.list[i].channelId;
  505. obsData.status = serverObsDatas.list[i].status;
  506. GlobalData.obsDatas_tk.Add(obsData);
  507. }
  508. }
  509. else
  510. {
  511. Debug.LogWarning("套口监控数据联网不成功,原因:返序列化失败");
  512. successInternet = false;
  513. }
  514. }
  515. }
  516. catch (Exception e)
  517. {
  518. successInternet = false;
  519. Debug.LogWarning("套口监控数据联网不成功,原因:" + e.ToString());
  520. }
  521. requestData.Dispose();
  522. if (!successInternet)
  523. {
  524. WWW www = new WWW(Application.streamingAssetsPath + "/ObsDatas_TK.json");
  525. await new UnityAsync.WaitUntil(() =>
  526. {
  527. return www.isDone;
  528. });
  529. Debug.Log($"缓存数据:{www.text}");
  530. GlobalData.obsDatas_tk = JsonConvert.DeserializeObject<List<ObsData>>(www.text);
  531. www.Dispose();
  532. }
  533. }
  534. public async Task<string> GetObsUrl(string deviceId,string channelId)
  535. {
  536. string result = "";
  537. string cmdUrl = ServerAddress.API_PlayStart;
  538. cmdUrl += $"/{deviceId}/{channelId}";
  539. Debug.Log($"send:{cmdUrl}");
  540. UnityWebRequest requestData = UnityWebRequest.Get(cmdUrl);
  541. await requestData.SendWebRequest();
  542. if (requestData.result != UnityWebRequest.Result.Success)
  543. {
  544. Debug.LogWarning($"获取监控播放地址不成功,原因:返request不成功:" + requestData.downloadHandler.text);
  545. }
  546. else
  547. {
  548. Debug.Log(requestData.downloadHandler.text);
  549. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  550. // 提取data字段的值
  551. JToken dataToken = jsonObject["data"];
  552. ObsPlayUrlData urlData = JsonConvert.DeserializeObject<ObsPlayUrlData>(dataToken.ToString());
  553. result = urlData.hls;
  554. Debug.Log("获取到监控播放路径:"+result);
  555. }
  556. requestData.Dispose();
  557. return result;
  558. }
  559. public async Task InitYZTData3()
  560. {
  561. bool successInternet = true;
  562. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetWaterHotPoint);
  563. requestData.timeout = timeOut;
  564. await requestData.SendWebRequest();
  565. try
  566. {
  567. if (requestData.result != UnityWebRequest.Result.Success)
  568. {
  569. Debug.LogWarning("YZTLayer联网不成功,读本地缓存数据,原因:返request不成功");
  570. successInternet = false;
  571. }
  572. else
  573. {
  574. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  575. // 提取data字段的值
  576. JToken dataToken = jsonObject["data"];
  577. JToken codeToken = jsonObject["code"];
  578. if (codeToken.ToString() == "200")
  579. {
  580. GlobalData.hotPointDatas = JsonConvert.DeserializeObject<List<HotPointData>>(dataToken.ToString());
  581. }
  582. else
  583. {
  584. Debug.LogWarning("YZTLayer联网不成功,读本地缓存数据,原因:返序列化失败");
  585. successInternet = false;
  586. }
  587. }
  588. }
  589. catch (Exception e)
  590. {
  591. successInternet = false;
  592. Debug.LogWarning("YZTLayer联网不成功,读本地缓存数据,原因:" + e.ToString());
  593. }
  594. requestData.Dispose();
  595. if (!successInternet)
  596. {
  597. WWW www = new WWW(Application.streamingAssetsPath + "/hotPoints.json");
  598. await new UnityAsync.WaitUntil(() =>
  599. {
  600. return www.isDone;
  601. });
  602. GlobalData.hotPointDatas = JsonConvert.DeserializeObject<List<HotPointData>>(www.text);
  603. Debug.Log(GlobalData.hotPointDatas.Count);
  604. www.Dispose();
  605. }
  606. }
  607. public async Task InitXHGKData()
  608. {
  609. bool successInternet = true;
  610. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetGetProjectMilestones);
  611. requestData.timeout = timeOut;
  612. await requestData.SendWebRequest();
  613. try
  614. {
  615. if (requestData.result != UnityWebRequest.Result.Success)
  616. {
  617. Debug.LogWarning("XHGKLayer联网不成功,读本地缓存数据,原因:返request不成功");
  618. successInternet = false;
  619. }
  620. else
  621. {
  622. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  623. // ȡdata ֶε ֵ
  624. JToken dataToken = jsonObject["data"];
  625. //Debug.Log(dataToken.ToString());
  626. JToken codeToken = jsonObject["code"];
  627. if (codeToken.ToString() == "200")
  628. {
  629. GlobalData.dsjContents = JsonConvert.DeserializeObject<List<DSJData>>(dataToken.ToString());
  630. }
  631. else
  632. {
  633. Debug.LogWarning("XHGKLayer联网不成功,读本地缓存数据,原因:返序列化失败");
  634. successInternet = false;
  635. }
  636. }
  637. }
  638. catch (Exception e)
  639. {
  640. successInternet = false;
  641. Debug.LogWarning("XHGKLayer联网不成功,读本地缓存数据,原因:" + e.ToString());
  642. }
  643. requestData.Dispose();
  644. if (!successInternet)
  645. {
  646. WWW www = new WWW(Application.streamingAssetsPath + "/dsj.json");
  647. await new UnityAsync.WaitUntil(() =>
  648. {
  649. return www.isDone;
  650. });
  651. GlobalData.dsjContents = JsonConvert.DeserializeObject<List<DSJData>>(www.text);
  652. www.Dispose();
  653. }
  654. }
  655. public async Task InitGCJKData()
  656. {
  657. bool successInternet = true;
  658. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetGeQXZData);
  659. requestData.timeout = timeOut;
  660. await requestData.SendWebRequest();
  661. try
  662. {
  663. if (requestData.result != UnityWebRequest.Result.Success)
  664. {
  665. Debug.LogWarning("水文站联网不成功,原因:返request不成功");
  666. successInternet = false;
  667. }
  668. else
  669. {
  670. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  671. // 提取data字段的值
  672. JToken dataToken = jsonObject["data"];
  673. JToken codeToken = jsonObject["code"];
  674. if (codeToken.ToString() == "200")
  675. {
  676. GlobalData.qXZDatas = JsonConvert.DeserializeObject<List<QXZData>>(dataToken.ToString());
  677. }
  678. else
  679. {
  680. Debug.LogWarning("水文站联网不成功,原因:返序列化失败");
  681. successInternet = false;
  682. }
  683. }
  684. }
  685. catch (Exception e)
  686. {
  687. successInternet = false;
  688. Debug.LogWarning("水文站联网不成功,原因:" + e.ToString());
  689. }
  690. requestData.Dispose();
  691. successInternet = true;
  692. UnityWebRequest requestData1 = UnityWebRequest.Get(ServerAddress.APIGetGeSWZData);
  693. await requestData1.SendWebRequest();
  694. try
  695. {
  696. if (requestData1.result != UnityWebRequest.Result.Success)
  697. {
  698. Debug.LogWarning("水文站联网不成功,原因:返request不成功");
  699. successInternet = false;
  700. }
  701. else
  702. {
  703. JObject jsonObject = JObject.Parse(requestData1.downloadHandler.text);
  704. // 提取data字段的值
  705. JToken dataToken = jsonObject["data"];
  706. JToken codeToken = jsonObject["code"];
  707. if (codeToken.ToString() == "200")
  708. {
  709. GlobalData.sWZDatas = JsonConvert.DeserializeObject<List<SWZData>>(dataToken.ToString());
  710. }
  711. else
  712. {
  713. Debug.LogWarning("水文站联网不成功,原因:返序列化失败");
  714. successInternet = false;
  715. }
  716. }
  717. }
  718. catch (Exception e)
  719. {
  720. successInternet = false;
  721. Debug.LogWarning("水文站联网不成功,原因:" + e.ToString());
  722. }
  723. requestData1.Dispose();
  724. }
  725. public async Task InitXHDDData()
  726. {
  727. WWW www = new WWW(Application.streamingAssetsPath + "/scheduling.json");
  728. await new UnityAsync.WaitUntil(() =>
  729. {
  730. return www.isDone;
  731. });
  732. GlobalData.schedulingData = JsonConvert.DeserializeObject<SchedulingData>(www.text);
  733. www.Dispose();
  734. }
  735. public async Task InitRKZYData()
  736. {
  737. bool successInternet = true;
  738. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetGetMovePlans);
  739. requestData.timeout = timeOut;
  740. await requestData.SendWebRequest();
  741. try
  742. {
  743. if (true)
  744. {
  745. Debug.LogWarning("RKZYLayer联网不成功,读本地缓存数据,原因:返request不成功");
  746. successInternet = false;
  747. }
  748. else
  749. {
  750. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  751. // 提取data字段的值
  752. JToken dataToken = jsonObject["data"];
  753. JToken codeToken = jsonObject["code"];
  754. if (codeToken.ToString() == "200")
  755. {
  756. GlobalData.allServerMovePlans = JsonConvert.DeserializeObject<List<ServerMovePlan>>(dataToken.ToString());
  757. }
  758. else
  759. {
  760. successInternet = false;
  761. Debug.LogWarning("XHGKLayer联网不成功,读本地缓存数据,原因:返序列化失败");
  762. }
  763. }
  764. }
  765. catch (Exception e)
  766. {
  767. successInternet = false;
  768. Debug.LogWarning("RKZYLayer联网不成功,读本地缓存数据,原因:" + e.ToString());
  769. }
  770. if (!successInternet)
  771. {
  772. WWW www = new WWW(Application.streamingAssetsPath + "/moveplan.json");
  773. await new UnityAsync.WaitUntil(() =>
  774. {
  775. return www.isDone;
  776. });
  777. GlobalData.allServerMovePlans = JsonConvert.DeserializeObject<List<ServerMovePlan>>(www.text);
  778. www.Dispose();
  779. }
  780. }
  781. public async Task InitSWYJData()
  782. {
  783. InitSWYJData0();
  784. await InitSWYJData1();
  785. await InitSWYJData2();
  786. OnSWYJRefresh?.Invoke();
  787. }
  788. public async Task InitSWYJData1()
  789. {
  790. GlobalData.BuYuanShuiWeiDataList = new List<ShuiWeiData>();
  791. var devicesInfo = _devicesIdDatas["上游水位计"];
  792. string sw1Result = await GetSingleDevicesInfo(devicesInfo.dataGid, devicesInfo.dataSid, 24);
  793. try
  794. {
  795. GetDevicesRequestData tempData = JsonConvert.DeserializeObject<GetDevicesRequestData>(sw1Result);
  796. if (tempData != null)
  797. {
  798. GlobalData.BuYuanShuiWeiDataList.Add(new ShuiWeiData()
  799. {
  800. name = "补元上游水位",
  801. targetName = "BY_ShuiWei_Up",
  802. value = tempData.datas[0].NodeValue / 100,
  803. type = shuiWeiType.BuYuanShuiWei,
  804. datas = tempData.datas.ToArray()
  805. });
  806. }
  807. }
  808. catch (Exception e)
  809. {
  810. Debug.LogWarning("补元上游水位不成功,原因:" + e.ToString());
  811. }
  812. var devicesInfo1 = _devicesIdDatas["下游水位计"];
  813. string sw2Result = await GetSingleDevicesInfo(devicesInfo1.dataGid, devicesInfo1.dataSid, 24);
  814. try
  815. {
  816. GetDevicesRequestData tempData = JsonConvert.DeserializeObject<GetDevicesRequestData>(sw2Result);
  817. if (tempData != null)
  818. {
  819. GlobalData.BuYuanShuiWeiDataList.Add(new ShuiWeiData()
  820. {
  821. name = "补元下游水位",
  822. targetName = "BY_ShuiWei_Down",
  823. value = tempData.datas[0].NodeValue / 100,
  824. type = shuiWeiType.BuYuanShuiWei,
  825. datas = tempData.datas.ToArray()
  826. });
  827. }
  828. }
  829. catch (Exception e)
  830. {
  831. Debug.LogWarning("补元下游水位不成功,原因:" + e.ToString());
  832. }
  833. string dayResult = await GetSingleDevicesInfo_day(devicesInfo.dataGid, devicesInfo.dataSid, 6);
  834. try
  835. {
  836. GetDevicesRequestData tempData = JsonConvert.DeserializeObject<GetDevicesRequestData>(dayResult);
  837. GlobalData.buYuanShuiWei_day = new ShuiWeiBianHuaData();
  838. GlobalData.buYuanShuiWei_day.name = new string[6];
  839. GlobalData.buYuanShuiWei_day.value = new double[6];
  840. for (int i = 0; i < tempData.datas.Count; i++)
  841. {
  842. GlobalData.buYuanShuiWei_day.name[i] = tempData.datas[i].RecvTime;
  843. GlobalData.buYuanShuiWei_day.value[i] = tempData.datas[i].NodeValue;
  844. }
  845. }
  846. catch (Exception e)
  847. {
  848. Debug.LogWarning("获取6天平均数据不成功,原因:" + e.ToString());
  849. }
  850. string monthResult = await GetSingleDevicesInfo_month(devicesInfo.dataGid, devicesInfo.dataSid, 6);
  851. try
  852. {
  853. GetDevicesRequestData tempData = JsonConvert.DeserializeObject<GetDevicesRequestData>(monthResult);
  854. GlobalData.buYuanShuiWei_month = new ShuiWeiBianHuaData();
  855. GlobalData.buYuanShuiWei_month.name = new string[6];
  856. GlobalData.buYuanShuiWei_month.value = new double[6];
  857. for (int i = 0; i < tempData.datas.Count; i++)
  858. {
  859. GlobalData.buYuanShuiWei_month.name[i] = tempData.datas[i].RecvTime;
  860. GlobalData.buYuanShuiWei_month.value[i] = tempData.datas[i].NodeValue;
  861. }
  862. }
  863. catch (Exception e)
  864. {
  865. Debug.LogWarning("获取6月平均数据不成功,原因:" + e.ToString());
  866. }
  867. string hourResult = await GetSingleDevicesInfo_hour(devicesInfo.dataGid, devicesInfo.dataSid, 6);
  868. try
  869. {
  870. GetDevicesRequestData tempData = JsonConvert.DeserializeObject<GetDevicesRequestData>(hourResult);
  871. GlobalData.buYuanShuiWei_hour = new ShuiWeiBianHuaData();
  872. GlobalData.buYuanShuiWei_hour.name = new string[6];
  873. GlobalData.buYuanShuiWei_hour.value = new double[6];
  874. for (int i = 0; i < tempData.datas.Count; i++)
  875. {
  876. GlobalData.buYuanShuiWei_hour.name[i] = tempData.datas[i].RecvTime;
  877. GlobalData.buYuanShuiWei_hour.value[i] = tempData.datas[i].NodeValue;
  878. }
  879. }
  880. catch (Exception e)
  881. {
  882. Debug.LogWarning("获取6小时平均数据不成功,原因:" + e.ToString());
  883. }
  884. }
  885. public async Task InitSWYJData2()
  886. {
  887. bool successInternet = true;
  888. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetGeSWData);
  889. requestData.timeout = timeOut;
  890. await requestData.SendWebRequest();
  891. try
  892. {
  893. if (requestData.result != UnityWebRequest.Result.Success)
  894. {
  895. Debug.LogWarning("水位高度联网不成功,原因:返request不成功");
  896. successInternet = false;
  897. }
  898. else
  899. {
  900. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  901. // 提取data字段的值
  902. JToken dataToken = jsonObject["data"];
  903. JToken codeToken = jsonObject["code"];
  904. if (codeToken.ToString() == "200")
  905. {
  906. GlobalData.swDatas = JsonConvert.DeserializeObject<List<StationData>>(dataToken.ToString());
  907. }
  908. else
  909. {
  910. Debug.LogWarning("水位高度联网不成功,原因:返序列化失败");
  911. successInternet = false;
  912. }
  913. for (int i = 0; i < GlobalData.BuYuanShuiWeiDataList.Count; i++)
  914. {
  915. StationData stationData = new StationData();
  916. stationData.LGTD = 113.910187f;
  917. stationData.LTTD = 30.1765823f;
  918. stationData.STNM = GlobalData.BuYuanShuiWeiDataList[i].name;
  919. stationData.upz = GlobalData.BuYuanShuiWeiDataList[i].name.Contains("上") ? GlobalData.BuYuanShuiWeiDataList[i].value : -1;
  920. stationData.dwz = GlobalData.BuYuanShuiWeiDataList[i].name.Contains("下") ? GlobalData.BuYuanShuiWeiDataList[i].value : -1;
  921. GlobalData.swDatas.Add(stationData);
  922. }
  923. }
  924. }
  925. catch (Exception e)
  926. {
  927. successInternet = false;
  928. Debug.LogWarning("水位高度联网不成功,原因:" + e.ToString());
  929. }
  930. }
  931. public async Task InitSWYJData0()
  932. {
  933. bool successInternet = true;
  934. UnityWebRequest requestData = UnityWebRequest.Get(ServerAddress.APIGetThreeLevel);
  935. requestData.timeout = timeOut;
  936. await requestData.SendWebRequest();
  937. try
  938. {
  939. if (requestData.result != UnityWebRequest.Result.Success)
  940. {
  941. Debug.LogWarning("三线水位联网不成功,原因:返request不成功");
  942. successInternet = false;
  943. }
  944. else
  945. {
  946. JObject jsonObject = JObject.Parse(requestData.downloadHandler.text);
  947. // 提取data字段的值
  948. JToken dataToken = jsonObject["data"];
  949. JToken codeToken = jsonObject["code"];
  950. if (codeToken.ToString() == "200")
  951. {
  952. GlobalData.threeLevelShuiWeiDatas = JsonConvert.DeserializeObject<List<ThreeLevelShuiWeiData>>(dataToken.ToString());
  953. }
  954. else
  955. {
  956. Debug.LogWarning("三线水位联网不成功,原因:返序列化失败");
  957. successInternet = false;
  958. }
  959. }
  960. }
  961. catch (Exception e)
  962. {
  963. successInternet = false;
  964. Debug.LogWarning("三线水位联网不成功,原因:" + e.ToString());
  965. }
  966. }
  967. public async Task SendBuYuan_GetSensorData()
  968. {
  969. UnityWebRequest www = UnityWebRequest.Get(ServerAddress.API_BuYuan_GetSensorData);
  970. await www.SendWebRequest();
  971. try
  972. {
  973. if (www.result != UnityWebRequest.Result.Success)
  974. {
  975. Debug.LogWarning("获取补元闸门设备数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  976. }
  977. else
  978. {
  979. GlobalData.buYuanSensorData = JsonUtility.FromJson<SensorDataResult>(www.downloadHandler.text);
  980. }
  981. }
  982. catch (Exception e)
  983. {
  984. Debug.LogWarning("获取补元闸门设备数据不成功,原因:" + e.ToString());
  985. }
  986. www.Dispose();
  987. }
  988. public async Task GetBuYuanDevicesGroupInfo()
  989. {
  990. //获取所有渗压记
  991. GetDevicesData tempData = new GetDevicesData();
  992. tempData.idsList = new List<DevicesMessage>();
  993. foreach (var device in _devicesIdDatas.Values)
  994. {
  995. if (device.stationName.Equals("补元") && device.sensorType.Equals("渗压计"))
  996. {
  997. tempData.idsList.Add(new DevicesMessage()
  998. {
  999. DeviceID = device.dataSid,
  1000. ChannelID = device.dataGid
  1001. });
  1002. }
  1003. }
  1004. // for (int i = 0; i < 13; i++)
  1005. // {
  1006. // var devicesInfo = _devicesIdDatas[$"P{i + 1}"];
  1007. // tempData.idsList.Add(new DevicesMessage()
  1008. // {
  1009. // DeviceID = devicesInfo.dataSid,
  1010. // ChannelID = devicesInfo.dataGid
  1011. // });
  1012. // }
  1013. string jsonStr;
  1014. try
  1015. {
  1016. jsonStr = await Devices(tempData);
  1017. jsonStr = "{\"datas\":" + jsonStr + "}";
  1018. Debug.Log(jsonStr);
  1019. GetDevicesRequestData resultData = JsonUtility.FromJson<GetDevicesRequestData>(jsonStr);
  1020. GlobalData.BuYuanShuiYaDataList = new List<ShuiYaData>();
  1021. for (int i = 0; i < resultData.datas.Count; i++)
  1022. {
  1023. GlobalData.BuYuanShuiYaDataList.Add(new ShuiYaData()
  1024. {
  1025. name = resultData.datas[i].NodeName,
  1026. value = resultData.datas[i].NodeValue,
  1027. type = shuiYaType.BuYuanShuiYa,
  1028. targetName = $"BY_{resultData.datas[i].NodeName}"
  1029. });
  1030. }
  1031. }
  1032. catch (Exception e)
  1033. {
  1034. Debug.LogWarning("获取补元水压计设备数据不成功,原因:" + e.ToString());
  1035. throw;
  1036. }
  1037. //获取所有位移记
  1038. tempData = new GetDevicesData();
  1039. tempData.idsList = new List<DevicesMessage>();
  1040. foreach (var device in _devicesIdDatas.Values)
  1041. {
  1042. if (device.stationName.Equals("补元") && device.sensorType.Equals("静力水准仪"))
  1043. {
  1044. tempData.idsList.Add(new DevicesMessage()
  1045. {
  1046. DeviceID = device.dataSid,
  1047. ChannelID = device.dataGid
  1048. });
  1049. }
  1050. }
  1051. // for (int i = 0; i < 8; i++)
  1052. // {
  1053. // var devicesInfo = _devicesIdDatas[$"M{i + 1}"];
  1054. // tempData.idsList.Add(new DevicesMessage()
  1055. // {
  1056. // DeviceID = devicesInfo.dataSid,
  1057. // ChannelID = devicesInfo.dataGid
  1058. // });
  1059. // }
  1060. try
  1061. {
  1062. jsonStr = await Devices(tempData);
  1063. jsonStr = "{\"datas\":" + jsonStr + "}";
  1064. GetDevicesRequestData resultData = JsonUtility.FromJson<GetDevicesRequestData>(jsonStr);
  1065. GlobalData.BuYuanWeiYiDataList = new List<WeiYiData>();
  1066. for (int i = 0; i < resultData.datas.Count; i++)
  1067. {
  1068. GlobalData.BuYuanWeiYiDataList.Add(new WeiYiData()
  1069. {
  1070. name = resultData.datas[i].NodeName,
  1071. value = resultData.datas[i].NodeValue,
  1072. type = weiYiType.BuYuanWeiYi,
  1073. targetName = $"BY_{resultData.datas[i].NodeName}"
  1074. });
  1075. }
  1076. }
  1077. catch (Exception e)
  1078. {
  1079. Debug.LogWarning("获取补元位移计设备数据不成功,原因:" + e.ToString());
  1080. throw;
  1081. }
  1082. }
  1083. public async Task SendTaoKou_GetSensorData()
  1084. {
  1085. UnityWebRequest www = UnityWebRequest.Get(ServerAddress.API_TaoKou_GetSensorData);
  1086. await www.SendWebRequest();
  1087. try
  1088. {
  1089. if (www.result != UnityWebRequest.Result.Success)
  1090. {
  1091. Debug.LogWarning("获取套口闸门设备数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1092. }
  1093. else
  1094. {
  1095. GlobalData.taoKouSensorData = JsonUtility.FromJson<SensorDataResult>(www.downloadHandler.text);
  1096. }
  1097. }
  1098. catch (Exception e)
  1099. {
  1100. Debug.LogWarning("获取套口闸门设备数据不成功,原因:" + e.ToString());
  1101. }
  1102. www.Dispose();
  1103. }
  1104. /// <summary>
  1105. /// 获取补元硬件组数据
  1106. /// </summary>
  1107. /// <param name="sendData"></param>
  1108. /// <returns></returns>
  1109. public async Task<string> Devices(GetDevicesData sendData)
  1110. {
  1111. string cmdUrl = ServerAddress.API_BuYuan_GetDevicesGroupInfo;
  1112. string tempStr = JsonConvert.SerializeObject(sendData);
  1113. var sendByte = System.Text.Encoding.UTF8.GetBytes(tempStr);
  1114. UnityWebRequest www = new UnityWebRequest(cmdUrl, "POST");
  1115. www.uploadHandler = new UploadHandlerRaw(sendByte);
  1116. www.downloadHandler = new DownloadHandlerBuffer();
  1117. www.SetRequestHeader("Content-Type", "application/json");
  1118. await www.SendWebRequest();
  1119. if (www.result != UnityWebRequest.Result.Success)
  1120. {
  1121. Debug.LogWarning($"获取设备数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1122. }
  1123. string result = www.downloadHandler.text;
  1124. www.Dispose();
  1125. return result;
  1126. }
  1127. /// <summary>
  1128. /// 获取设备的最近N条记录
  1129. /// </summary>
  1130. /// <param name="channelId"></param>
  1131. /// <param name="deviceId"></param>
  1132. /// <param name="count"></param>
  1133. /// <returns></returns>
  1134. public async Task<string> GetSingleDevicesInfo(int channelId, int deviceId, int count)
  1135. {
  1136. string cmdUrl = ServerAddress.API_BuYuan_GetSingleDevicesInfo;
  1137. GetSingleDeviceData sendData = new GetSingleDeviceData();
  1138. sendData.ChannelID = channelId;
  1139. sendData.DeviceID = deviceId;
  1140. sendData.N = count;
  1141. string tempStr = JsonConvert.SerializeObject(sendData);
  1142. var sendByte = System.Text.Encoding.UTF8.GetBytes(tempStr);
  1143. UnityWebRequest www = new UnityWebRequest(cmdUrl, "POST");
  1144. www.uploadHandler = new UploadHandlerRaw(sendByte);
  1145. www.downloadHandler = new DownloadHandlerBuffer();
  1146. www.SetRequestHeader("Content-Type", "application/json");
  1147. await www.SendWebRequest();
  1148. if (www.result != UnityWebRequest.Result.Success)
  1149. {
  1150. Debug.LogWarning("获取设备数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1151. }
  1152. string result = www.downloadHandler.text;
  1153. www.Dispose();
  1154. return result;
  1155. }
  1156. /// <summary>
  1157. /// 获取设备最近几天的平均数据
  1158. /// </summary>
  1159. /// <param name="channelId"></param>
  1160. /// <param name="deviceId"></param>
  1161. /// <param name="count"></param>
  1162. /// <returns></returns>
  1163. public async Task<string> GetSingleDevicesInfo_day(int channelId, int deviceId, int count)
  1164. {
  1165. string cmdUrl = ServerAddress.API_BuYuan_GetSingleDevicesInfo_avg;
  1166. GetSingleDeviceData_AvgType sendData = new GetSingleDeviceData_AvgType();
  1167. sendData.ChannelID = channelId;
  1168. sendData.DeviceID = deviceId;
  1169. sendData.AvgType = "day";
  1170. sendData.N = count;
  1171. string tempStr = JsonConvert.SerializeObject(sendData);
  1172. var sendByte = System.Text.Encoding.UTF8.GetBytes(tempStr);
  1173. UnityWebRequest www = new UnityWebRequest(cmdUrl, "POST");
  1174. www.uploadHandler = new UploadHandlerRaw(sendByte);
  1175. www.downloadHandler = new DownloadHandlerBuffer();
  1176. www.SetRequestHeader("Content-Type", "application/json");
  1177. await www.SendWebRequest();
  1178. if (www.result != UnityWebRequest.Result.Success)
  1179. {
  1180. Debug.LogWarning("获取设备天平均数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1181. }
  1182. string result = www.downloadHandler.text;
  1183. www.Dispose();
  1184. return result;
  1185. }
  1186. /// <summary>
  1187. /// 获取设备最近几小时的平均数据
  1188. /// </summary>
  1189. /// <param name="channelId"></param>
  1190. /// <param name="deviceId"></param>
  1191. /// <param name="count"></param>
  1192. /// <returns></returns>
  1193. public async Task<string> GetSingleDevicesInfo_hour(int channelId, int deviceId, int count)
  1194. {
  1195. string cmdUrl = ServerAddress.API_BuYuan_GetSingleDevicesInfo_avg;
  1196. GetSingleDeviceData_AvgType sendData = new GetSingleDeviceData_AvgType();
  1197. sendData.ChannelID = channelId;
  1198. sendData.DeviceID = deviceId;
  1199. sendData.AvgType = "hour";
  1200. sendData.N = count;
  1201. string tempStr = JsonConvert.SerializeObject(sendData);
  1202. var sendByte = System.Text.Encoding.UTF8.GetBytes(tempStr);
  1203. UnityWebRequest www = new UnityWebRequest(cmdUrl, "POST");
  1204. www.uploadHandler = new UploadHandlerRaw(sendByte);
  1205. www.downloadHandler = new DownloadHandlerBuffer();
  1206. www.SetRequestHeader("Content-Type", "application/json");
  1207. await www.SendWebRequest();
  1208. if (www.result != UnityWebRequest.Result.Success)
  1209. {
  1210. Debug.LogWarning("获取设备小时平均数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1211. }
  1212. string result = www.downloadHandler.text;
  1213. www.Dispose();
  1214. return result;
  1215. }
  1216. /// <summary>
  1217. /// 获取设备最近几个月的平均数据
  1218. /// </summary>
  1219. /// <param name="channelId"></param>
  1220. /// <param name="deviceId"></param>
  1221. /// <param name="count"></param>
  1222. /// <returns></returns>
  1223. public async Task<string> GetSingleDevicesInfo_month(int channelId, int deviceId, int count)
  1224. {
  1225. string cmdUrl = ServerAddress.API_BuYuan_GetSingleDevicesInfo_avg;
  1226. GetSingleDeviceData_AvgType sendData = new GetSingleDeviceData_AvgType();
  1227. sendData.ChannelID = channelId;
  1228. sendData.DeviceID = deviceId;
  1229. sendData.AvgType = "month";
  1230. sendData.N = count;
  1231. string tempStr = JsonConvert.SerializeObject(sendData);
  1232. var sendByte = System.Text.Encoding.UTF8.GetBytes(tempStr);
  1233. UnityWebRequest www = new UnityWebRequest(cmdUrl, "POST");
  1234. www.uploadHandler = new UploadHandlerRaw(sendByte);
  1235. www.downloadHandler = new DownloadHandlerBuffer();
  1236. www.SetRequestHeader("Content-Type", "application/json");
  1237. await www.SendWebRequest();
  1238. if (www.result != UnityWebRequest.Result.Success)
  1239. {
  1240. Debug.LogWarning("获取设备月平均数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1241. }
  1242. string result = www.downloadHandler.text;
  1243. www.Dispose();
  1244. return result;
  1245. }
  1246. /// <summary>
  1247. /// 0 补元 1套口
  1248. /// </summary>
  1249. /// <param name="type"></param>
  1250. public async Task InitGCYWData1(int type)
  1251. {
  1252. GlobalData.B08_Type = type;
  1253. string jsonStr;
  1254. try
  1255. {
  1256. jsonStr = await B08_API_data(ServerAddress.API_B08_dataStatis,type);
  1257. Debug.Log("API_B08_dataStatis" + jsonStr);
  1258. GlobalData.B08DataStatis = JsonConvert.DeserializeObject<B08_dataStatis>(jsonStr);
  1259. }
  1260. catch (Exception e)
  1261. {
  1262. Debug.LogWarning("获取API_B08_dataStatis数据不成功,原因:" + e.ToString());
  1263. }
  1264. try
  1265. {
  1266. jsonStr = await B08_API_data(ServerAddress.API_B08_inspectResult,type);
  1267. Debug.Log("API_B08_inspectResult" + jsonStr);
  1268. GlobalData.B08InspectResult = JsonConvert.DeserializeObject<B08_inspectResult>(jsonStr);
  1269. }
  1270. catch (Exception e)
  1271. {
  1272. Debug.LogWarning("获取API_B08_inspectResult数据不成功,原因:" + e.ToString());
  1273. }
  1274. try
  1275. {
  1276. jsonStr = await B08_API_data(ServerAddress.API_B08_projectExamine,type);
  1277. Debug.Log("API_B08_projectExamine" + jsonStr);
  1278. GlobalData.B08ProjectExamine = JsonConvert.DeserializeObject<B08_projectExamine>(jsonStr);
  1279. }
  1280. catch (Exception e)
  1281. {
  1282. Debug.LogWarning("获取API_B08_projectExamine数据不成功,原因:" + e.ToString());
  1283. }
  1284. try
  1285. {
  1286. jsonStr = await B08_API_data(ServerAddress.API_B08_event,type);
  1287. Debug.Log("API_B08_event" + jsonStr);
  1288. GlobalData.B08Event = JsonConvert.DeserializeObject<B08_event>(jsonStr);
  1289. }
  1290. catch (Exception e)
  1291. {
  1292. Debug.LogWarning("获取API_B08_event数据不成功,原因:" + e.ToString());
  1293. }
  1294. try
  1295. {
  1296. jsonStr = await B08_API_data(ServerAddress.API_B08_questionStatis,type);
  1297. Debug.Log("API_B08_questionStatis" + jsonStr);
  1298. GlobalData.B08QuestionStatis = JsonConvert.DeserializeObject<B08_questionStatis>(jsonStr);
  1299. }
  1300. catch (Exception e)
  1301. {
  1302. Debug.LogWarning("获取API_B08_questionStatis数据不成功,原因:" + e.ToString());
  1303. }
  1304. try
  1305. {
  1306. jsonStr = await B08_API_data(ServerAddress.API_B08_inspectType,type);
  1307. Debug.Log("API_B08_inspectType" + jsonStr);
  1308. GlobalData.B08InspectType = JsonConvert.DeserializeObject<B08_inspectType>(jsonStr);
  1309. }
  1310. catch (Exception e)
  1311. {
  1312. Debug.LogWarning("获取API_B08_inspectType数据不成功,原因:" + e.ToString());
  1313. }
  1314. }
  1315. public async Task<string> B08_API_data(string cmdUrl,int type)
  1316. {
  1317. if (type == 0)
  1318. {
  1319. cmdUrl += "1794245918999351298";
  1320. }
  1321. else
  1322. {
  1323. cmdUrl += "1798366756789653505";
  1324. }
  1325. UnityWebRequest www = new UnityWebRequest(cmdUrl, "Get");
  1326. www.downloadHandler = new DownloadHandlerBuffer();
  1327. www.SetRequestHeader("Content-Type", "application/json");
  1328. await www.SendWebRequest();
  1329. if (www.result != UnityWebRequest.Result.Success)
  1330. {
  1331. Debug.LogWarning($"获取{cmdUrl}数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1332. }
  1333. string result = www.downloadHandler.text;
  1334. www.Dispose();
  1335. return result;
  1336. }
  1337. /// <summary>
  1338. /// 获取站点水位信息
  1339. /// </summary>
  1340. /// <param name="stcd"></param>
  1341. /// <returns></returns>
  1342. public async Task<string> GetWaterTrend_Chart(string stcd)
  1343. {
  1344. UnityWebRequest www = new UnityWebRequest(ServerAddress.API_GetWaterTrend_chart+stcd, "Get");
  1345. www.downloadHandler = new DownloadHandlerBuffer();
  1346. www.SetRequestHeader("Content-Type", "application/json");
  1347. await www.SendWebRequest();
  1348. if (www.result != UnityWebRequest.Result.Success)
  1349. {
  1350. Debug.LogWarning($"获取stcd:{stcd},水位统计信息数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1351. }
  1352. string result = www.downloadHandler.text;
  1353. www.Dispose();
  1354. return result;
  1355. }
  1356. public async Task<string> GetWaterTrend_List(string stcd)
  1357. {
  1358. UnityWebRequest www = new UnityWebRequest(ServerAddress.API_GetWaterTrend_list+stcd, "Get");
  1359. www.downloadHandler = new DownloadHandlerBuffer();
  1360. www.SetRequestHeader("Content-Type", "application/json");
  1361. await www.SendWebRequest();
  1362. if (www.result != UnityWebRequest.Result.Success)
  1363. {
  1364. Debug.LogWarning($"获取stcd:{stcd},水位统计信息数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1365. }
  1366. string result = www.downloadHandler.text;
  1367. www.Dispose();
  1368. return result;
  1369. }
  1370. public void SaveFirstFrame(byte[] uploadData, string fileName, string _targetName)
  1371. {
  1372. StartCoroutine(SendSaveFirstFrame(uploadData, fileName, _targetName));
  1373. }
  1374. IEnumerator SendSaveFirstFrame(byte[] uploadData, string fileName, string _targetName)
  1375. {
  1376. Debug.Log(fileName);
  1377. WWWForm form = new WWWForm();
  1378. form.AddBinaryData("file", uploadData, fileName);
  1379. UnityWebRequest www = UnityWebRequest.Post(ServerAddress.API_TextureUploadPath, form);
  1380. yield return www.SendWebRequest();
  1381. if (www.result == UnityWebRequest.Result.Success)
  1382. {
  1383. ActionInstance._Instance.obsFmUpdata?.Invoke(_targetName);
  1384. }
  1385. Debug.Log(www.downloadHandler.text);
  1386. www.Dispose();
  1387. }
  1388. #region 摄像头远程控制
  1389. public void GetDeviceChannelId(string deviceId, Action<string> callBack)
  1390. {
  1391. StartCoroutine(SendGetDevicesChannel(deviceId, 1, 1, callBack));
  1392. }
  1393. IEnumerator SendGetDevicesChannel(string deviceId, int page, int count, Action<string> call)
  1394. {
  1395. string sendUrl = ServerAddress.API_GetDevicesInfo;
  1396. sendUrl += $"/{deviceId}/channels?page={page}&count={count}&query&online&channelType&catalogUnderDevice";
  1397. UnityWebRequest www = UnityWebRequest.Get(sendUrl);
  1398. yield return www.SendWebRequest();
  1399. ObsHttpRequestData tempData = JsonConvert.DeserializeObject<ObsHttpRequestData>(www.downloadHandler.text);
  1400. GetObsChannelRequestData channelData = tempData.data.ToObject<GetObsChannelRequestData>();
  1401. call?.Invoke(channelData.list[0].channelId);
  1402. www.Dispose();
  1403. }
  1404. IEnumerator SendStartRTSP(string deviceId, string channelId)
  1405. {
  1406. string sendUrl = ServerAddress.API_PlayStart;
  1407. sendUrl += $"/{deviceId}/{channelId}";
  1408. UnityWebRequest www = UnityWebRequest.Get(sendUrl);
  1409. yield return www.SendWebRequest();
  1410. Debug.Log(www.downloadHandler.text);
  1411. www.Dispose();
  1412. }
  1413. public void SendObsCameraCtrlCmd(string deviceId, string channelId, ObsCtrlType type)
  1414. {
  1415. StartCoroutine(SendCameraCtrl(deviceId, channelId, type.ToString()));
  1416. }
  1417. IEnumerator SendCameraCtrl(string deviceId, string channelId, string command)
  1418. {
  1419. string sendUrl = ServerAddress.API_CameraCtrl;
  1420. sendUrl += $"/{deviceId}/{channelId}?command={command}&horizonSpeed=10&verticalSpeed=10&zoomSpeed=10";
  1421. UnityWebRequest www = UnityWebRequest.Post(sendUrl, "");
  1422. Debug.Log("send:" + sendUrl);
  1423. yield return www.SendWebRequest();
  1424. Debug.Log(www.downloadHandler.text);
  1425. www.Dispose();
  1426. }
  1427. #endregion
  1428. // /// <summary>
  1429. // /// 所有硬件设备的获取信息
  1430. // /// </summary>
  1431. public async Task GetSensorList()
  1432. {
  1433. bool successInternet = true;
  1434. UnityWebRequest www = UnityWebRequest.Get(ServerAddress.API_GetAllSensorList);
  1435. await www.SendWebRequest();
  1436. try
  1437. {
  1438. if (www.result != UnityWebRequest.Result.Success)
  1439. {
  1440. successInternet = false;
  1441. Debug.LogWarning("获取设备数据不成功,原因:返request不成功:" + www.downloadHandler.text);
  1442. }
  1443. else
  1444. {
  1445. SensorListResult tempData = JsonUtility.FromJson<SensorListResult>(www.downloadHandler.text);
  1446. _devicesIdDatas = new Dictionary<string, DevicesId_Data>();
  1447. for (int i = 0; i < tempData.rows.Count; i++)
  1448. {
  1449. _devicesIdDatas.Add(tempData.rows[i].sensorName, tempData.rows[i]);
  1450. }
  1451. Debug.Log($"初始化设备列表成功!!! count:{tempData.total}");
  1452. }
  1453. }
  1454. catch (Exception e)
  1455. {
  1456. successInternet = false;
  1457. Debug.LogWarning("获取设备数据不成功,原因:" + e.ToString());
  1458. }
  1459. www.Dispose();
  1460. if (!successInternet)
  1461. {
  1462. WWW localWWW = new WWW(Application.streamingAssetsPath + "/SensorList.json");
  1463. await new UnityAsync.WaitUntil(() =>
  1464. {
  1465. return localWWW.isDone;
  1466. });
  1467. SensorListResult tempData = JsonUtility.FromJson<SensorListResult>(www.downloadHandler.text);
  1468. _devicesIdDatas = new Dictionary<string, DevicesId_Data>();
  1469. for (int i = 0; i < tempData.rows.Count; i++)
  1470. {
  1471. _devicesIdDatas.Add(tempData.rows[i].sensorName, tempData.rows[i]);
  1472. }
  1473. Debug.Log($"读取本地初始化设备列表成功!!! count:{tempData.total}");
  1474. www.Dispose();
  1475. }
  1476. }
  1477. // /// <summary>
  1478. // /// 初始化所有补元硬件设备的获取信息
  1479. // /// </summary>
  1480. // public void InItBuYuanDevicesList()
  1481. // {
  1482. // _devicesIdDatas = new Dictionary<string, DevicesId_Data>();
  1483. //
  1484. // _devicesIdDatas.Add("上游水位计", new DevicesId_Data()
  1485. // {
  1486. // dataGid = 7,
  1487. // dataSid = 4,
  1488. // sensorName = "上游水位计",
  1489. // realtimeValue1 = -1
  1490. // });
  1491. // _devicesIdDatas.Add("下游水位计", new DevicesId_Data()
  1492. // {
  1493. // dataGid = 8,
  1494. // dataSid = 4,
  1495. // sensorName = "上游水位计",
  1496. // realtimeValue1 = -1
  1497. // });
  1498. //
  1499. // #region P
  1500. //
  1501. // _devicesIdDatas.Add("P1", new DevicesId_Data()
  1502. // {
  1503. // dataGid = 1,
  1504. // dataSid = 2,
  1505. // sensorName = "P1/UP1",
  1506. // realtimeValue1 = -1
  1507. // });
  1508. // _devicesIdDatas.Add("P2", new DevicesId_Data()
  1509. // {
  1510. // dataGid = 2,
  1511. // dataSid = 2,
  1512. // sensorName = "P2/UP2",
  1513. // realtimeValue1 = -1
  1514. // });
  1515. // _devicesIdDatas.Add("P3", new DevicesId_Data()
  1516. // {
  1517. // dataGid = 3,
  1518. // dataSid = 2,
  1519. // sensorName = "P3",
  1520. // realtimeValue1 = -1
  1521. // });
  1522. // _devicesIdDatas.Add("P4", new DevicesId_Data()
  1523. // {
  1524. // dataGid = 4,
  1525. // dataSid = 2,
  1526. // sensorName = "P4/UP3",
  1527. // realtimeValue1 = -1
  1528. // });
  1529. // _devicesIdDatas.Add("P5", new DevicesId_Data()
  1530. // {
  1531. // dataGid = 1,
  1532. // dataSid = 3,
  1533. // sensorName = "P5/UP5",
  1534. // realtimeValue1 = -1
  1535. // });
  1536. // _devicesIdDatas.Add("P6", new DevicesId_Data()
  1537. // {
  1538. // dataGid = 2,
  1539. // dataSid = 3,
  1540. // sensorName = "P6/",
  1541. // realtimeValue1 = -1
  1542. // });
  1543. // _devicesIdDatas.Add("P7", new DevicesId_Data()
  1544. // {
  1545. // dataGid = 3,
  1546. // dataSid = 3,
  1547. // sensorName = "P7/UP5",
  1548. // realtimeValue1 = -1
  1549. // });
  1550. // _devicesIdDatas.Add("P8", new DevicesId_Data()
  1551. // {
  1552. // dataGid = 4,
  1553. // dataSid = 3,
  1554. // sensorName = "P8/UP6",
  1555. // realtimeValue1 = -1
  1556. // });
  1557. // _devicesIdDatas.Add("P5温度", new DevicesId_Data()
  1558. // {
  1559. // dataGid = 9,
  1560. // dataSid = 3,
  1561. // sensorName = "P5温度",
  1562. // realtimeValue1 = -1
  1563. // });
  1564. // _devicesIdDatas.Add("P6温度", new DevicesId_Data()
  1565. // {
  1566. // dataGid = 10,
  1567. // dataSid = 3,
  1568. // sensorName = "P6温度",
  1569. // realtimeValue1 = -1
  1570. // });
  1571. // _devicesIdDatas.Add("P7温度", new DevicesId_Data()
  1572. // {
  1573. // dataGid = 11,
  1574. // dataSid = 3,
  1575. // sensorName = "P7温度",
  1576. // realtimeValue1 = -1
  1577. // });
  1578. // _devicesIdDatas.Add("P8温度", new DevicesId_Data()
  1579. // {
  1580. // dataGid = 12,
  1581. // dataSid = 3,
  1582. // sensorName = "P8温度",
  1583. // realtimeValue1 = -1
  1584. // });
  1585. // _devicesIdDatas.Add("P9温度", new DevicesId_Data()
  1586. // {
  1587. // dataGid = 9,
  1588. // dataSid = 4,
  1589. // sensorName = "P9温度",
  1590. // realtimeValue1 = -1
  1591. // });
  1592. // _devicesIdDatas.Add("P10温度", new DevicesId_Data()
  1593. // {
  1594. // dataGid = 10,
  1595. // dataSid = 4,
  1596. // sensorName = "P10温度",
  1597. // realtimeValue1 = -1
  1598. // });
  1599. //
  1600. // _devicesIdDatas.Add("P12温度", new DevicesId_Data()
  1601. // {
  1602. // dataGid = 11,
  1603. // dataSid = 4,
  1604. // sensorName = "P12温度",
  1605. // realtimeValue1 = -1
  1606. // });
  1607. //
  1608. // _devicesIdDatas.Add("P9", new DevicesId_Data()
  1609. // {
  1610. // dataGid = 3,
  1611. // dataSid = 4,
  1612. // sensorName = "P9",
  1613. // realtimeValue1 = -1
  1614. // });
  1615. // _devicesIdDatas.Add("P10", new DevicesId_Data()
  1616. // {
  1617. // dataGid = 4,
  1618. // dataSid = 4,
  1619. // sensorName = "P10/UP7",
  1620. // realtimeValue1 = -1
  1621. // });
  1622. // _devicesIdDatas.Add("P11", new DevicesId_Data()
  1623. // {
  1624. // dataGid = 5,
  1625. // dataSid = 4,
  1626. // sensorName = "P11/UP8",
  1627. // realtimeValue1 = -1
  1628. // });
  1629. // _devicesIdDatas.Add("P12", new DevicesId_Data()
  1630. // {
  1631. // dataGid = 1,
  1632. // dataSid = 4,
  1633. // sensorName = "P12/UP9",
  1634. // realtimeValue1 = -1
  1635. // });
  1636. //
  1637. // _devicesIdDatas.Add("P13", new DevicesId_Data()
  1638. // {
  1639. // dataGid = 2,
  1640. // dataSid = 4,
  1641. // sensorName = "P13/UP10",
  1642. // realtimeValue1 = -1
  1643. // });
  1644. //
  1645. // #endregion
  1646. //
  1647. // #region M
  1648. //
  1649. // //M1-8
  1650. // int m_cid = 1;
  1651. // int m_did = 5;
  1652. // for (int i = 0; i < 8; i++)
  1653. // {
  1654. // _devicesIdDatas.Add($"M{i + 1}", new DevicesId_Data()
  1655. // {
  1656. // dataGid = m_cid + i,
  1657. // dataSid = m_did,
  1658. // sensorName = $"M{i + 1}",
  1659. // realtimeValue1 = -1
  1660. // });
  1661. // }
  1662. //
  1663. // //M温度
  1664. // _devicesIdDatas.Add($"M2温度", new DevicesId_Data()
  1665. // {
  1666. // dataGid = 10,
  1667. // dataSid = 5,
  1668. // sensorName = $"M2温度",
  1669. // realtimeValue1 = -1
  1670. // });
  1671. // _devicesIdDatas.Add($"M5温度", new DevicesId_Data()
  1672. // {
  1673. // dataGid = 13,
  1674. // dataSid = 5,
  1675. // sensorName = $"M5温度",
  1676. // realtimeValue1 = -1
  1677. // });
  1678. // _devicesIdDatas.Add($"M6温度", new DevicesId_Data()
  1679. // {
  1680. // dataGid = 14,
  1681. // dataSid = 5,
  1682. // sensorName = $"M6温度",
  1683. // realtimeValue1 = -1
  1684. // });
  1685. // _devicesIdDatas.Add($"M7温度", new DevicesId_Data()
  1686. // {
  1687. // dataGid = 15,
  1688. // dataSid = 5,
  1689. // sensorName = $"M7温度",
  1690. // realtimeValue1 = -1
  1691. // });
  1692. // _devicesIdDatas.Add($"M8温度", new DevicesId_Data()
  1693. // {
  1694. // dataGid = 16,
  1695. // dataSid = 5,
  1696. // sensorName = $"M8温度",
  1697. // realtimeValue1 = -1
  1698. // });
  1699. //
  1700. // #endregion
  1701. // }
  1702. }