CardAxisEventArgs.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System;
  7. using static TeamAAS.Motion.Enums.MotionEnums;
  8. namespace TeamAAS.Motion.Events
  9. {
  10. public class CardAxisEventArgs
  11. {
  12. // ========== 轴事件基类 ==========
  13. public class AxisEventArgs : EventArgs
  14. {
  15. public int AxisNo { get; }
  16. public AxisEventArgs(int axisNo) => AxisNo = axisNo;
  17. }
  18. // ========== 轴运动事件参数 ==========
  19. public class AxisMotionEventArgs : AxisEventArgs
  20. {
  21. /// <summary>目标位置(对于点动或回零,可能为 NaN 或 0)</summary>
  22. public double TargetPosition { get; }
  23. /// <summary>实际到达位置(或当前停止位置)</summary>
  24. public double ActualPosition { get; }
  25. public AxisMotionEventArgs(int axisNo, double target, double actual) : base(axisNo)
  26. {
  27. TargetPosition = target;
  28. ActualPosition = actual;
  29. }
  30. }
  31. // ========== 轴状态变化事件参数 ==========
  32. public class AxisStateChangedEventArgs : AxisEventArgs
  33. {
  34. public AxisState OldState { get; }
  35. public AxisState NewState { get; }
  36. public AxisStateChangedEventArgs(int axisNo, AxisState oldState, AxisState newState) : base(axisNo)
  37. {
  38. OldState = oldState;
  39. NewState = newState;
  40. }
  41. }
  42. // ========== 轴错误事件参数 ==========
  43. public class AxisErrorEventArgs : AxisEventArgs
  44. {
  45. public string ErrorMessage { get; }
  46. public AxisErrorEventArgs(int axisNo, string message) : base(axisNo)
  47. {
  48. ErrorMessage = message;
  49. }
  50. }
  51. // ========== 控制卡连接状态变化事件参数 ==========
  52. public class ConnectionStateChangedEventArgs : EventArgs
  53. {
  54. public bool Connected { get; }
  55. public ConnectionStateChangedEventArgs(bool connected) => Connected = connected;
  56. }
  57. // ========== 控制卡错误事件参数 ==========
  58. public class ErrorOccurredEventArgs : EventArgs
  59. {
  60. public string ErrorMessage { get; }
  61. public ErrorOccurredEventArgs(string message) => ErrorMessage = message;
  62. }
  63. }
  64. }