ARINC429.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Uestc.Auto6.Dso.Core;
  7. using Uestc.Auto6.Dso.ComModel;
  8. using System.Drawing;
  9. using Uestc.Auto6.Dso.Core.Decode;
  10. using System.Windows.Forms;
  11. using Uni_Trend.MSO7000X.Common.Helper;
  12. namespace Uestc.Auto6.Dso.Protocol.ARINC429
  13. {
  14. internal class ARINC429 : DecodeView
  15. {
  16. public override IProtocolView ProtocolView => new ARINC429SetControl();
  17. public override ITriggerSerialView TriggerSerialView => new ARINC429TriggerSetControl();
  18. public override SerialProtocolType ProtocolType => SerialProtocolType.ARINC429;
  19. public override void DrawDecodeInfo(Graphics graphics, Rectangle rectangle, IProtocolPrsnt prsnt, Color ForeColor, Font font)
  20. {
  21. if (prsnt is ARINC429DecodePrsnt decodePrsnt)
  22. {
  23. TextRenderer.DrawText(graphics, SIHelper.ValueChangeToSI(decodePrsnt.CustomBaud, 2, "bps"), font, GetRowRectangle(2), ForeColor, TextFormatFlags.Right | TextFormatFlags.VerticalCenter);
  24. TextRenderer.DrawText(graphics, decodePrsnt.InputMode == ProtocolARINC429.InputMode.Diff?$"{decodePrsnt.Source}-{decodePrsnt.SourceL}" :decodePrsnt.Source.ToString(), font, GetRowRectangle(0), ForeColor, TextFormatFlags.Right | TextFormatFlags.VerticalCenter);
  25. TextRenderer.DrawText(graphics,$"H:{SIHelper.ValueChangeToSI(decodePrsnt.ThresholdH,2,"V")} L:{SIHelper.ValueChangeToSI(decodePrsnt.ThresholdL,2,"V")}" , font, GetRowRectangle(1), ForeColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
  26. TextRenderer.DrawText(graphics, decodePrsnt.DecodeMode switch
  27. {
  28. ProtocolARINC429.DecodeMode.Mode_8_23_1=>"23bit",
  29. ProtocolARINC429.DecodeMode.Mode_8_2_19_1=>"19bit",
  30. _=>"19bit",
  31. }, font, GetRowRectangle(2), ForeColor, TextFormatFlags.Left | TextFormatFlags.Top);
  32. }
  33. }
  34. }
  35. }