HttpHelper.cs 65 KB

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