AutoEFDiagnosisService.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. using AI.Common;
  2. using AI.Common.Log;
  3. using AIDiagnosis.Common.Enums;
  4. using AIDiagnosis.Common.Models;
  5. using AutoEFCalculationLib;
  6. using AutoEFDiagnosisSDK.Enums;
  7. using System;
  8. using System.Collections.Concurrent;
  9. using System.Collections.Generic;
  10. using System.IO;
  11. using System.Linq;
  12. using System.Threading;
  13. using Vinno.AI.AutoEFDiagnosisSDK.Enums;
  14. using Vinno.AI.AutoEFDiagnosisSDK.Interfaces;
  15. using Vinno.AI.AutoEFDiagnosisSDK.Models;
  16. using Vinno.AI.AutoEFDiagnosisService.Tools;
  17. using Vinno.AI.CommonSDK.Enums;
  18. using Vinno.AI.CommonSDK.Models;
  19. using Vinno.AI.CommonSDK.Tools;
  20. using Vinno.AI.Service.Common.Interfaces;
  21. using Vinno.AI.Service.Common.Models;
  22. using Vinno.AI.Service.Common.Tools;
  23. using AutoEFDiagnosis = AutoEFDiagnosisSDK.AutoEFDiagnosis;
  24. namespace Vinno.AI.AutoEFDiagnosisService
  25. {
  26. public class AutoEFDiagnosisService : IAutoEFDiagnosisService, IDisposable, IEngine
  27. {
  28. private readonly string _modelFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Networks");
  29. private readonly ConcurrentStack<byte[]> _singleImageCache;
  30. private PipeServer _singleImagePipeServer;
  31. private ImageProvider _imageProvider;
  32. private AutoEFDiagnosis _autoEFDiagnosis;
  33. private bool _disposed;
  34. public static List<FunctionInfo> AllFunctions { get; }
  35. static AutoEFDiagnosisService()
  36. {
  37. AllFunctions = AutoEFDiagnosis.AllFunctions;
  38. }
  39. public static void Init(FunctionInfo enableFunction, FunctionInfo currentUsedFunction)
  40. {
  41. AutoEFDiagnosis.Init(enableFunction, currentUsedFunction);
  42. }
  43. public AutoEFDiagnosisService()
  44. {
  45. try
  46. {
  47. _singleImageCache = new ConcurrentStack<byte[]>();
  48. _singleImagePipeServer = new PipeServer(AIDiagnosisSystemConsts.PipeForAutoEFDiagnosisSingleImage);
  49. _singleImagePipeServer.LogMsgThrow += OnLogMsgThrow;
  50. _singleImagePipeServer.DataReceived += OnDataReceived;
  51. _singleImagePipeServer.StartAndReceive();
  52. _imageProvider = new ImageProvider(AIEnumType.AutoEFDiagnosis);
  53. }
  54. catch (Exception ex)
  55. {
  56. Logger.Error($"AutoEFDiagnosisService-Constructor error:{ex}");
  57. }
  58. }
  59. /// <summary>
  60. /// 切换引擎
  61. /// </summary>
  62. /// <param name="functionInfo"></param>
  63. public void SwitchEngines(FunctionInfo functionInfo)
  64. {
  65. try
  66. {
  67. AutoEFDiagnosis.SwitchAIEngines(functionInfo);
  68. if (_autoEFDiagnosis != null)
  69. {
  70. _autoEFDiagnosis.SwitchAIEngines2(functionInfo);
  71. }
  72. }
  73. catch (Exception ex)
  74. {
  75. Logger.Error($"AutoEFDiagnosisService-SwitchEngines error:{ex}");
  76. }
  77. }
  78. public void Initialize(AutoEFDiagnosisParameter autoEFDiagnosisParameter, bool hasImageProvider)
  79. {
  80. try
  81. {
  82. CloseDiagnosis();
  83. var cpuNumber = autoEFDiagnosisParameter.CPUNumber;
  84. var layerCount = autoEFDiagnosisParameter.LayerCount;
  85. var edcontrolLayersCount = autoEFDiagnosisParameter.EdcontrolLayersCount;
  86. var escontrolLayersCount = autoEFDiagnosisParameter.EscontrolLayersCount;
  87. var isReturnEveryImgResult = autoEFDiagnosisParameter.IsReturnEveryImgResult;
  88. var detectMode = (EnumDetectMode)autoEFDiagnosisParameter.DetectMode;
  89. var detectTps = autoEFDiagnosisParameter.DetectTps;
  90. var intervalTime = autoEFDiagnosisParameter.IntervalTime;
  91. var cmPerPixel = autoEFDiagnosisParameter.CmPerPixel;
  92. var reprocess = (EnumReprocess)autoEFDiagnosisParameter.Reprocess;
  93. EnumAutoEFDiagnosisType diagnosisType = autoEFDiagnosisParameter.AutoEFDiagnosisType == AIEnumAutoEFDiagnosisType.HumanAutoEFDiagnosis ? EnumAutoEFDiagnosisType.HumanAutoEFDiagnosis : EnumAutoEFDiagnosisType.VetAutoEFDiagnosis;
  94. _autoEFDiagnosis = new AutoEFDiagnosis(cpuNumber, _modelFolder, Setting.Instance.IsSaveDetectImage, Setting.Instance.IsSaveAllImage, Logger.LogDir, layerCount, escontrolLayersCount, edcontrolLayersCount, isReturnEveryImgResult, diagnosisType, hasImageProvider ? _imageProvider : null, cmPerPixel, detectMode, detectTps, intervalTime, reprocess);
  95. _autoEFDiagnosis.StartEvaluation += OnStartEvaluation;
  96. _autoEFDiagnosis.FinishEvaluation += OnFinishEvaluation;
  97. _autoEFDiagnosis.NotifyError += OnNotifyError;
  98. _autoEFDiagnosis.NotifyLog += OnNotifyLog;
  99. }
  100. catch (Exception ex)
  101. {
  102. Logger.Error($"AutoEFDiagnosisService-Initialize error:{ex}");
  103. }
  104. }
  105. /// <summary>
  106. /// 启用AutoEF
  107. /// </summary>
  108. /// <param name="totalFrameCount">整个视频帧数</param>
  109. /// <param name="cmPerPixel">探头中像素与实际单位转换的参数</param>
  110. public void StartAutotEFCalculation(long totalFrameCount, double cmPerPixel, AIEnumReprocess reprocess)
  111. {
  112. try
  113. {
  114. if (_autoEFDiagnosis == null)
  115. {
  116. Logger.Error($"StartAutotEF Error:AutoEF Diagnosis is null");
  117. return;
  118. }
  119. EnumReprocess enumReprocess = (EnumReprocess)reprocess;
  120. _autoEFDiagnosis.StartAutotEFCalculation(totalFrameCount, cmPerPixel, enumReprocess);
  121. }
  122. catch (Exception ex)
  123. {
  124. Logger.Error($"AutoEFDiagnosisService-StartAutotEFCalculation error:{ex}");
  125. }
  126. }
  127. /// <summary>
  128. /// 推入一张裸图并返回AutoEF结果
  129. /// </summary>
  130. /// <param name="frameTime"></param>
  131. /// <returns></returns>
  132. public void DetectOneRawImageForAutoEFCalculation(int height, int width, AIEnumColorType colorType, double frameTime)
  133. {
  134. try
  135. {
  136. byte[] byteImage = null;
  137. int retryCount = 0;
  138. while (!_singleImageCache.TryPop(out byteImage) && retryCount < 50)
  139. {
  140. Thread.Sleep(10);
  141. retryCount++;
  142. }
  143. if (byteImage == null)
  144. {
  145. Logger.Error($"AutoEFDiagnosisService-DetectOneRawImageForAutoEFCalculation Get Image Cache Fail");
  146. return;
  147. }
  148. var rawImage = new RawImage(byteImage, width, height, (EnumColorType)colorType);
  149. _autoEFDiagnosis.DetectOneImageAsync(rawImage, frameTime);
  150. }
  151. catch (Exception ex)
  152. {
  153. Logger.Error($"AutoEFDiagnosisService-DetectOneRawImageForAutoEFCalculation error:{ex}");
  154. }
  155. }
  156. /// <summary>
  157. /// 推入一张图并返回AutoEF结果
  158. /// </summary>
  159. /// <param name="rawImage"></param>
  160. /// <param name="frameTime"></param>
  161. /// <returns></returns>
  162. public void DetectOneByteImageForAutoEFCalculation(double frameTime)
  163. {
  164. try
  165. {
  166. byte[] byteImage = null;
  167. int retryCount = 0;
  168. while (!_singleImageCache.TryPop(out byteImage) && retryCount < 50)
  169. {
  170. Thread.Sleep(10);
  171. retryCount++;
  172. }
  173. if (byteImage == null)
  174. {
  175. Logger.Error($"AutoEFDiagnosisService-DetectOneByteImageForAutoEFCalculation Get Image Cache Fail");
  176. return;
  177. }
  178. _autoEFDiagnosis.DetectOneImageAsync(byteImage, frameTime);
  179. }
  180. catch (Exception ex)
  181. {
  182. Logger.Error($"AutoEFDiagnosisService-DetectOneByteImageForAutoEFCalculation error:{ex}");
  183. }
  184. }
  185. /// <summary>
  186. /// 停止AutoEF并返回结果,若IsReturnEveryImgResult为True,则返回所有帧的AutoEF结果,若IsReturnEveryImgResult为False,则只返回ES,ED两张图的结果
  187. /// </summary>
  188. /// <returns></returns>
  189. public Dictionary<double, AIEDESDetectResult> StopAutoEFCalculation()
  190. {
  191. try
  192. {
  193. var result = _autoEFDiagnosis.StopAutotEFCalculation();
  194. if (result == null)
  195. {
  196. return null;
  197. }
  198. else
  199. {
  200. Dictionary<double, AIEDESDetectResult> dict = new Dictionary<double, AIEDESDetectResult>();
  201. foreach (var key in result.Keys.ToArray())
  202. {
  203. var aiEDESDetectResult = AIConvertHelper.ConvertEDESDetectResultToAIEDESDetectResult(result[key]);
  204. dict.Add(key, aiEDESDetectResult);
  205. }
  206. return dict;
  207. }
  208. }
  209. catch (Exception ex)
  210. {
  211. Logger.Error($"AutoEFDiagnosisService-StopAutoEFCalculation error:{ex}");
  212. return null;
  213. }
  214. }
  215. public void Start()
  216. {
  217. try
  218. {
  219. if (_autoEFDiagnosis != null)
  220. {
  221. _autoEFDiagnosis.Start();
  222. }
  223. }
  224. catch (Exception ex)
  225. {
  226. Logger.Error($"AutoEFDiagnosisService-Start error:{ex}");
  227. }
  228. }
  229. public void Stop()
  230. {
  231. try
  232. {
  233. if (_autoEFDiagnosis != null)
  234. {
  235. _autoEFDiagnosis.Stop();
  236. }
  237. }
  238. catch (Exception ex)
  239. {
  240. Logger.Error($"AutoEFDiagnosisService-Stop error:{ex}");
  241. }
  242. }
  243. public void SetDetectTps(int detectTps)
  244. {
  245. try
  246. {
  247. if (_autoEFDiagnosis != null)
  248. {
  249. _autoEFDiagnosis.DetectTps = detectTps;
  250. }
  251. }
  252. catch (Exception ex)
  253. {
  254. Logger.Error($"AutoEFDiagnosisService-SetDetectTps error:{ex}");
  255. }
  256. }
  257. public void SetIntervalTime(int intervalTime)
  258. {
  259. try
  260. {
  261. if (_autoEFDiagnosis != null)
  262. {
  263. _autoEFDiagnosis.IntervalTime = intervalTime;
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. Logger.Error($"AutoEFDiagnosisService-SetIntervalTime error:{ex}");
  269. }
  270. }
  271. public void SetDetectMode(AIEnumDetectMode detectMode)
  272. {
  273. try
  274. {
  275. if (_autoEFDiagnosis != null)
  276. {
  277. _autoEFDiagnosis.DetectMode = (EnumDetectMode)detectMode;
  278. }
  279. }
  280. catch (Exception ex)
  281. {
  282. Logger.Error($"AutoEFDiagnosisService-SetDetectMode error:{ex}");
  283. }
  284. }
  285. /// <summary>
  286. /// 设置一个像素代表的实际物理距离是多少cm
  287. /// </summary>
  288. /// <param name="cmPerPixel"></param>
  289. public void SetCmPerPixel(double cmPerPixel)
  290. {
  291. try
  292. {
  293. if (_autoEFDiagnosis != null)
  294. {
  295. _autoEFDiagnosis.CmPerPixel = cmPerPixel;
  296. }
  297. }
  298. catch (Exception ex)
  299. {
  300. Logger.Error($"AutoEFDiagnosisService-SetCmPerPixel error:{ex}");
  301. }
  302. }
  303. /// <summary>
  304. /// 设置后处理方式(仅人用支持)
  305. /// </summary>
  306. /// <param name="reprocess"></param>
  307. public void SetReprocess(AIEnumReprocess reprocess)
  308. {
  309. try
  310. {
  311. if (_autoEFDiagnosis != null)
  312. {
  313. _autoEFDiagnosis.Reprocess = (EnumReprocess)reprocess;
  314. }
  315. }
  316. catch (Exception ex)
  317. {
  318. Logger.Error($"AutoEFDiagnosisService-SetReprocess error:{ex}");
  319. }
  320. }
  321. /// <summary>
  322. /// 检测单张Byte Image
  323. /// </summary>
  324. /// <param name="cmPerPixel">图像上一个像素实际代表的物理距离是多少cm</param>
  325. /// <returns></returns>
  326. public AILVVolumeCalcResult DetectOneByteImage(double cmPerPixel, AIEnumReprocess reprocess)
  327. {
  328. try
  329. {
  330. byte[] byteImage = null;
  331. int retryCount = 0;
  332. while (!_singleImageCache.TryPop(out byteImage) && retryCount < 50)
  333. {
  334. Thread.Sleep(10);
  335. retryCount++;
  336. }
  337. if (byteImage == null)
  338. {
  339. Logger.Error($"AutoEFDiagnosisService-DetectOneByteImage Get Image Cache Fail");
  340. return null;
  341. }
  342. var autoDFRCalcResult = _autoEFDiagnosis.DetectOneImage(byteImage, cmPerPixel, (EnumReprocess)reprocess);
  343. return AIConvertHelper.ConvertLVVolumeCalcResultToAILVVolumeCalcResult(autoDFRCalcResult);
  344. }
  345. catch (Exception ex)
  346. {
  347. Logger.Error($"AutoEFDiagnosisService-DetectOneByteImage error:{ex}");
  348. return null;
  349. }
  350. }
  351. public AILVVolumeCalcResult DetectOneRawImage(int height, int width, AIEnumColorType colorType, double cmPerPixel, AIEnumReprocess reprocess)
  352. {
  353. try
  354. {
  355. byte[] byteImage = null;
  356. int retryCount = 0;
  357. while (!_singleImageCache.TryPop(out byteImage) && retryCount < 50)
  358. {
  359. Thread.Sleep(10);
  360. retryCount++;
  361. }
  362. if (byteImage == null)
  363. {
  364. Logger.Error($"AutoEFDiagnosisService-DetectOneRawImage Get Image Cache Fail");
  365. return null;
  366. }
  367. var rawImage = new RawImage(byteImage, width, height, (EnumColorType)colorType);
  368. var autoDFRCalcResult = _autoEFDiagnosis.DetectOneImage(rawImage, cmPerPixel, (EnumReprocess)reprocess);
  369. return AIConvertHelper.ConvertLVVolumeCalcResultToAILVVolumeCalcResult(autoDFRCalcResult);
  370. }
  371. catch (Exception ex)
  372. {
  373. Logger.Error($"AutoEFDiagnosisService-DetectOneRawImage error:{ex}");
  374. return null;
  375. }
  376. }
  377. public Dictionary<double, AIEDESDetectResult> GetEDESFrameResult(Dictionary<double, AILVVolumeCalcResult> allImageResults)
  378. {
  379. try
  380. {
  381. if (allImageResults == null)
  382. {
  383. Logger.Error($"AutoEFDiagnosisService-GetEDESFrameResult error:allImageResults is null");
  384. return null;
  385. }
  386. if (allImageResults.Count == 0)
  387. {
  388. Logger.Error($"AutoEFDiagnosisService-GetEDESFrameResult error:allImageResults is empty");
  389. return null;
  390. }
  391. Dictionary<double, LVVolumeCalcResult> imageResults = new Dictionary<double, LVVolumeCalcResult>();
  392. foreach (var key in allImageResults.Keys.ToArray())
  393. {
  394. var result = AIConvertHelper.ConvertAILVVolumeCalcResultToLVVolumeCalcResult(allImageResults[key]);
  395. imageResults.Add(key, result);
  396. }
  397. var edesResults = _autoEFDiagnosis.GetEDESFrameResult(imageResults);
  398. Dictionary<double, AIEDESDetectResult> aiEDESResults;
  399. if (edesResults == null)
  400. {
  401. aiEDESResults = null;
  402. }
  403. else
  404. {
  405. aiEDESResults = new Dictionary<double, AIEDESDetectResult>();
  406. foreach (var key in edesResults.Keys.ToArray())
  407. {
  408. var aiEDESResult = AIConvertHelper.ConvertEDESDetectResultToAIEDESDetectResult(edesResults[key]);
  409. aiEDESResults.Add(key, aiEDESResult);
  410. }
  411. }
  412. return aiEDESResults;
  413. }
  414. catch (Exception ex)
  415. {
  416. Logger.Error($"AutoEFDiagnosisService-GetEDESFrameResult error:{ex}");
  417. return null;
  418. }
  419. }
  420. /// <summary>
  421. /// Send Raw Image Data For Pipe
  422. /// </summary>
  423. /// <param name="height"></param>
  424. /// <param name="width"></param>
  425. /// <param name="colorType"></param>
  426. public void SendRawImageData(int height, int width, AIEnumColorType colorType)
  427. {
  428. try
  429. {
  430. _imageProvider?.ReceiveRawImageData(height, width, (EnumColorType)colorType);
  431. }
  432. catch (Exception ex)
  433. {
  434. Logger.Error($"AutoEFDiagnosisService-SendRawImageData error:{ex}");
  435. }
  436. }
  437. /// <summary>
  438. /// Send Byte Image Data For Pipe
  439. /// </summary>
  440. public void SendByteImageData()
  441. {
  442. try
  443. {
  444. _imageProvider?.ReceiveByteImageData();
  445. }
  446. catch (Exception ex)
  447. {
  448. Logger.Error($"AutoEFDiagnosisService-SendByteImageData error:{ex}");
  449. }
  450. }
  451. public void Close()
  452. {
  453. try
  454. {
  455. Logger.Info($"AutoEFDiagnosisService-Close Invoke");
  456. CloseDiagnosis();
  457. }
  458. catch (Exception ex)
  459. {
  460. Logger.Error($"AutoEFDiagnosisService-Close error:{ex}");
  461. }
  462. }
  463. private void CloseDiagnosis()
  464. {
  465. if (_autoEFDiagnosis != null)
  466. {
  467. _autoEFDiagnosis.StartEvaluation -= OnStartEvaluation;
  468. _autoEFDiagnosis.FinishEvaluation -= OnFinishEvaluation;
  469. _autoEFDiagnosis.NotifyError -= OnNotifyError;
  470. _autoEFDiagnosis.NotifyLog -= OnNotifyLog;
  471. _autoEFDiagnosis.Close();
  472. _autoEFDiagnosis = null;
  473. }
  474. }
  475. public void Dispose()
  476. {
  477. try
  478. {
  479. if (!_disposed)
  480. {
  481. Logger.Info($"AutoEFDiagnosisService-Start Dispose");
  482. CloseDiagnosis();
  483. if (_singleImagePipeServer != null)
  484. {
  485. _singleImagePipeServer.DataReceived -= OnDataReceived;
  486. _singleImagePipeServer.Dispose();
  487. _singleImagePipeServer.LogMsgThrow -= OnLogMsgThrow;
  488. _singleImagePipeServer = null;
  489. }
  490. _disposed = true;
  491. Logger.Info($"AutoEFDiagnosisService Dispose End");
  492. }
  493. }
  494. catch (Exception ex)
  495. {
  496. Logger.Error($"AutoEFDiagnosisService-Dispose error:{ex}");
  497. }
  498. }
  499. private void OnStartEvaluation(object sender, EventArgs e)
  500. {
  501. NotificationSender.SendNotification(new AINotificationArgs() { NotificationType = AIEnumNotificationType.AutoEFDiagnosisStartEvaluationRaised });
  502. }
  503. private void OnFinishEvaluation(object sender, LVVolumeCalcResult e)
  504. {
  505. var aiLVVolumeCalcResult = AIConvertHelper.ConvertLVVolumeCalcResultToAILVVolumeCalcResult(e);
  506. NotificationSender.SendNotification(new AINotificationArgs() { NotificationType = AIEnumNotificationType.AutoEFDiagnosisFinishEvaluationRaised, Params = aiLVVolumeCalcResult });
  507. }
  508. private void OnNotifyLog(object sender, LogEventArgs e)
  509. {
  510. if (e == null)
  511. {
  512. return;
  513. }
  514. switch (e.LogType)
  515. {
  516. case EnumLogType.InfoLog:
  517. Logger.Info($"AutoEFDiagnosisService OnNotifyLog:{e.Msg}");
  518. break;
  519. case EnumLogType.WarnLog:
  520. Logger.Warning($"AutoEFDiagnosisService OnNotifyLog:{e.Msg}");
  521. break;
  522. case EnumLogType.ErrorLog:
  523. case EnumLogType.FatalLog:
  524. default:
  525. Logger.Error($"AutoEFDiagnosisService OnNotifyLog:{e.Msg}");
  526. break;
  527. }
  528. var logEventArgs = AICommonServiceConvertHelper.ConvertLogEventArgsToAILogEventArgs(e);
  529. NotificationSender.SendNotification(new AINotificationArgs() { NotificationType = AIEnumNotificationType.AutoEFDiagnosisNotifyLogRaised, Params = logEventArgs });
  530. }
  531. private void OnNotifyError(object sender, ErrorEventArgs e)
  532. {
  533. Logger.Error($"AutoEFDiagnosisService OnNotifyError:{e.GetException()}");
  534. var logEventArgs = AICommonServiceConvertHelper.ConvertErrorEventArgsToAILogEventArgs(e);
  535. NotificationSender.SendNotification(new AINotificationArgs() { NotificationType = AIEnumNotificationType.AutoEFDiagnosisNotifyLogRaised, Params = logEventArgs });
  536. }
  537. private void OnLogMsgThrow(object sender, AILogEventArgs e)
  538. {
  539. if (e == null)
  540. {
  541. return;
  542. }
  543. switch (e.LogType)
  544. {
  545. case AIEnumLogType.ErrorLog:
  546. case AIEnumLogType.FatalLog:
  547. Logger.Error(e.Msg);
  548. break;
  549. case AIEnumLogType.WarnLog:
  550. Logger.Warning(e.Msg);
  551. break;
  552. case AIEnumLogType.InfoLog:
  553. default:
  554. Logger.Info(e.Msg);
  555. break;
  556. }
  557. }
  558. private void OnDataReceived(object sender, byte[] e)
  559. {
  560. try
  561. {
  562. _singleImageCache.Push(e);
  563. }
  564. catch (Exception ex)
  565. {
  566. Logger.Error($"AutoEFDiagnosisService-OnDataReceived error:{ex}");
  567. }
  568. }
  569. }
  570. }