RorzeRobot751SetHandler.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. public RorzeRobot751SetHandler(RorzeRobot751 robot, string command, string parameter = null)
  10. : base(robot, command, parameter)
  11. {
  12. string text = (string.IsNullOrEmpty(parameter) ? parameter : "");
  13. 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);
  14. }
  15. public override bool HandleMessage(MessageBase msg, out bool transactionComplete)
  16. {
  17. //Trace.WriteLine("Ö´ÐÐÒÔÏÂÖ¸Áî");
  18. RorzeRobot751Message rorzeRobot751Message = msg as RorzeRobot751Message;
  19. LogObject.Warning("Robot", $"Command:{(rorzeRobot751Message.Command != null ? $"{rorzeRobot751Message.Command}":"None")}," +
  20. $"RawMessage:{(rorzeRobot751Message.RawMessage != null ? $"{rorzeRobot751Message.RawMessage}" : "None")}" +
  21. $"{(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. }