IRoutine.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using athosRT.tool;
  2. using Caliburn.Micro;
  3. using MECF.Framework.Common.Device.Bases;
  4. using MECF.Framework.Common.Equipment;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace athosRT.FSM
  11. {
  12. public interface IRoutine
  13. {
  14. RState Start(params object[] objs);
  15. RState Monitor();
  16. void Abort();
  17. }
  18. public class ModuleRoutineBase
  19. {
  20. public ModuleName Module { get; set; }
  21. public string Name { get; set; }
  22. public bool NullFun() => true;
  23. public RoutineRunner Runner = new RoutineRunner();
  24. protected readonly int _delay_50ms = 50;
  25. protected readonly int _delay_1s = 1000;
  26. protected readonly int _delay_2s = 2000;
  27. protected readonly int _delay_3s = 3000;
  28. protected readonly int _delay_4s = 4000;
  29. protected readonly int _delay_5s = 5000;
  30. protected readonly int _delay_10s = 10000;
  31. protected readonly int _delay_20s = 20000;
  32. protected readonly int _delay_30s = 30000;
  33. protected readonly int _delay_60s = 60000;
  34. protected readonly int _delay_2m = 120000;
  35. protected readonly int _delay_3m = 180000;
  36. protected readonly int _delay_5m = 300000;
  37. public ModuleRoutineBase(ModuleName module)
  38. {
  39. Module = module;
  40. Runner.Reset();
  41. }
  42. protected void Notify(string message)
  43. {
  44. //log4net
  45. LogObject.Info("Notify:", message);
  46. }
  47. protected void Stop(string failReason)
  48. {
  49. //log4net
  50. LogObject.Info("Notify:", failReason);
  51. }
  52. public void Reset()
  53. {
  54. Runner.Reset();
  55. }
  56. }
  57. }