CommandStop.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using StageController.M3H;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. #if false
  8. namespace StageController
  9. {
  10. /// <summary>
  11. /// 4.3 电脑控制指定电机停机指令
  12. /// </summary>
  13. public class CommandStop : CommandBase
  14. {
  15. private Axis m_axis;
  16. private HandLock m_handLock;
  17. public CommandStop(Axis axis, HandLock handLock)
  18. {
  19. m_axis = axis;
  20. m_handLock = handLock;
  21. }
  22. /// <summary>
  23. ///
  24. /// </summary>
  25. /// <returns>@XF!</returns>
  26. public override string Make()
  27. {
  28. return "@" + Enum.GetName(typeof(Axis), m_axis) + Enum.GetName(typeof(HandLock), m_handLock) + "!";
  29. }
  30. /// <summary>
  31. ///
  32. /// </summary>
  33. /// <param name="response">@XF!</param>
  34. /// <returns></returns>
  35. public override bool Parse(string response)
  36. {
  37. bool retVal = false;
  38. string tmpRes = "@" + Enum.GetName(typeof(Axis), m_axis) + Enum.GetName(typeof(HandLock), m_handLock) + "!";
  39. if (tmpRes.CompareTo(response) == 0)
  40. {
  41. retVal = true;
  42. }
  43. return retVal;
  44. }
  45. }
  46. }
  47. #else
  48. using System;
  49. using System.Collections.Generic;
  50. using System.Linq;
  51. using System.Text;
  52. using System.Threading.Tasks;
  53. namespace StageController
  54. {
  55. /// <summary>
  56. /// 4.3 电脑控制指定电机停机指令
  57. /// </summary>
  58. public class CommandStop : CommandBase
  59. {
  60. private M3HAxisType m_axis;
  61. private HandLock m_handLock;
  62. public CommandStop(M3HAxisType axis, HandLock handLock)
  63. {
  64. m_axis = axis;
  65. m_handLock = handLock;
  66. }
  67. /// <summary>
  68. ///
  69. /// </summary>
  70. /// <returns>@XF!</returns>
  71. public override string Make()
  72. {
  73. return "@" + Enum.GetName(typeof(M3HAxisType), m_axis) + Enum.GetName(typeof(HandLock), m_handLock) + "!";
  74. }
  75. /// <summary>
  76. ///
  77. /// </summary>
  78. /// <param name="response">@XF!</param>
  79. /// <returns></returns>
  80. public override bool Parse(string response)
  81. {
  82. bool retVal = false;
  83. string tmpRes = "@" + Enum.GetName(typeof(M3HAxisType), m_axis) + Enum.GetName(typeof(HandLock), m_handLock) + "!";
  84. if (tmpRes.CompareTo(response) == 0)
  85. {
  86. retVal = true;
  87. }
  88. return retVal;
  89. }
  90. }
  91. }
  92. #endif