NRZ.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Drawing;
  2. using System.Windows.Forms;
  3. using Uestc.Auto6.Dso.ComModel;
  4. using Uestc.Auto6.Dso.Core;
  5. using Uestc.Auto6.Dso.Core.Decode;
  6. using Uni_Trend.MSO7000X.Common.Helper;
  7. namespace Uestc.Auto6.Dso.Protocol.NRZ
  8. {
  9. public class NRZ : DecodeView
  10. {
  11. public override IProtocolView ProtocolView => new NRZSetControl();
  12. public override ITriggerSerialView TriggerSerialView => new NRZTriggerSetControl();
  13. public override SerialProtocolType ProtocolType => SerialProtocolType.NRZ;
  14. public override void DrawDecodeInfo(Graphics graphics, Rectangle rectangle, IProtocolPrsnt prsnt, Color foreColor, Font font)
  15. {
  16. if (prsnt is NRZDecodePrsnt decodePrsnt)
  17. {
  18. if (decodePrsnt.SignalType == ProtocolNRZ.SignalType.Difference)
  19. {
  20. TextRenderer.DrawText(graphics, $"{decodePrsnt.Source1}-{decodePrsnt.Source2}:{SIHelper.ValueChangeToSI(decodePrsnt.Threshold, 2, "V")}", font, GetRowRectangle(1), foreColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
  21. }
  22. else
  23. {
  24. TextRenderer.DrawText(graphics, $"{decodePrsnt.Source1}:{SIHelper.ValueChangeToSI(decodePrsnt.Threshold, 2, "V")}", font, GetRowRectangle(1), foreColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
  25. }
  26. TextRenderer.DrawText(graphics, $"{decodePrsnt.MSB_LSB}", font, GetRowRectangle(2), foreColor, TextFormatFlags.Left | TextFormatFlags.VerticalCenter);
  27. TextRenderer.DrawText(graphics, $"{SIHelper.ValueChangeToSI(decodePrsnt.RealSignalRate, 2, "bps")}", font, GetRowRectangle(2), foreColor, TextFormatFlags.Right | TextFormatFlags.VerticalCenter);
  28. }
  29. }
  30. }
  31. }