RorzeRobot751ReadHandler.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Aitex.Core.RT.Log;
  2. using MECF.Framework.Common.Communications;
  3. namespace athosRT.Modules.Robot
  4. {
  5. public class RorzeRobot751ReadHandler : RorzeRobot751Handler
  6. {
  7. public RorzeRobot751ReadHandler(RorzeRobot751 robot, string command, string parameter = null)
  8. : base(robot, command, parameter)
  9. {
  10. string text = (string.IsNullOrEmpty(parameter) ? parameter : "");
  11. LOG.Write(robot.Name + " execute read command " + command + " " + text + " in ASCII.", 2, "D:\\sorter\\trunk\\Efem\\Jet\\Jet_001_2P_Jet\\EfemRT\\Devices\\Rorze751\\RorzeRobot751Handler.cs", ".ctor", 87);
  12. }
  13. public override bool HandleMessage(MessageBase msg, out bool transactionComplete)
  14. {
  15. RorzeRobot751Message rorzeRobot751Message = msg as RorzeRobot751Message;
  16. if (!rorzeRobot751Message.RawMessage.Contains(_command))
  17. {
  18. transactionComplete = false;
  19. return false;
  20. }
  21. if (rorzeRobot751Message.IsEvent)
  22. {
  23. transactionComplete = false;
  24. return false;
  25. }
  26. if (!rorzeRobot751Message.IsAck)
  27. {
  28. base.Device.OnError("GetErrorMsg:" + rorzeRobot751Message.RawMessage);
  29. transactionComplete = true;
  30. return true;
  31. }
  32. base.Device.ParseReadData(_command, rorzeRobot751Message.Data);
  33. transactionComplete = true;
  34. return true;
  35. }
  36. }
  37. }