RorzeRobot751SetHandler.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Aitex.Core.RT.Log;
  2. using athosRT.tool;
  3. using MECF.Framework.Common.Communications;
  4. using System.Diagnostics;
  5. namespace athosRT.Modules.Robot
  6. {
  7. public class RorzeRobot751SetHandler : RorzeRobot751Handler
  8. {
  9. private string cmd;
  10. public RorzeRobot751SetHandler(RorzeRobot751 robot, string command, string parameter = null)
  11. : base(robot, command, parameter)
  12. {
  13. cmd = command;
  14. string text = (string.IsNullOrEmpty(parameter) ? parameter : "");
  15. LOG.Write(robot.Name + " execute set command " + command + " " + text + " in ASCII.", 2, "D:\\sorter\\trunk\\Efem\\Jet\\Jet_001_2P_Jet\\EfemRT\\Devices\\Rorze751\\RorzeRobot751Handler.cs", ".ctor", 124);
  16. }
  17. public override bool HandleMessage(MessageBase msg, out bool transactionComplete)
  18. {
  19. //Trace.WriteLine("Ö´ÐÐÒÔÏÂÖ¸Áî");
  20. RorzeRobot751Message rorzeRobot751Message = msg as RorzeRobot751Message;
  21. LogObject.Info("Robot", $"Robot Handle Message: {rorzeRobot751Message.RawMessage}"+ $"{(rorzeRobot751Message.IsError ? $",Error:{rorzeRobot751Message.ErrorCode}":"")}");
  22. if (!rorzeRobot751Message.RawMessage.Contains(_command))
  23. {
  24. transactionComplete = false;
  25. return false;
  26. }
  27. if (rorzeRobot751Message.IsAck)
  28. {
  29. base.Device.OnActionDone(null);
  30. transactionComplete = true;
  31. return true;
  32. }
  33. transactionComplete = true;
  34. return false;
  35. }
  36. }
  37. }