123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- using Aitex.Sorter.Common;
- using Efem;
- using Efem.Protocol;
- using System;
- namespace EFEM.RT.Tasks
- {
- public class SetEventTask : CheckImp, ITask
- {
- public SetEventTask()
- {
- HasInfoMessage = false;
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.System;
- EfemEventType type;
- if (!Enum.TryParse(args[0], out type))
- {
- result = PARAM_NG;
- return false;
- }
- EfemEventValue value;
- if (!Enum.TryParse(args[1], out value))
- {
- result = PARAM_NG;
- return false;
- }
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- if (!Check<MaintenancePolicy>(device, out result))
- {
- return false;
- }
- SystemServerModule entity = (SystemServerModule)GetEntity(device);
- entity.SetEvent(type, value);
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = string.Empty;
- return true;
- }
- }
- public class QueryEventTask : CheckImp, ITask
- {
- public QueryEventTask()
- {
- }
- public bool Execute(out string result, params string[] args)
- {
- string device = DeviceName.System;
- EfemEventType type;
- if (!Enum.TryParse(args[0], out type))
- {
- result = PARAM_NG;
- return false;
- }
- EfemEventValue value;
- if (!Enum.TryParse(args[1], out value))
- {
- result = PARAM_NG;
- return false;
- }
- if (!Check<NoReadyPolicy>(device, out result))
- {
- return false;
- }
- return true;
- }
- public bool? Monitor(out string result, params string[] args)
- {
- result = "ON";
- EfemEventType type;
- Enum.TryParse(args[0], out type);
- SystemServerModule entity = (SystemServerModule)GetEntity(DeviceName.System);
- if (entity.IsEventEnabled(type))
- result = string.Format("ON");
- else
- result = string.Format("OFF");
- return true;
- }
- }
- }
|