Beispiel #1
0
        /// <summary>
        /// 平台运动前安全检查
        /// </summary>
        /// <param name="i"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public virtual bool RunSafeCheck(SafeCheckType target = SafeCheckType.Always, int i = -1)
        {
            LastSafeCheckError = string.Empty;

            if (SafeChecks.Count > 0)
            {
                var sc = SafeChecks.FindAll(s => s.Enable && s.Target == SafeCheckType.Always || s.Target == target);
                if (sc.Count > 0)
                {
                    var ret = sc.All(s => s.Check(this, i));
                    LastSafeCheckError = string.Join(",", sc.Select(s => s.Error));

                    //throw exception on task thread
                    if (_isAutoMode && !ret)
                    {
                        Task?.ThrowException($"{Name} {LastSafeCheckError}");
                    }
                    return(ret);
                }
            }

            if (Task != null)
            {
                AssertAutoMode(Task);
            }
            return(true);
        }
Beispiel #2
0
 public CarrierSafeCheck(PlatformEx up, PlatformEx down, ICylinderEx downGT, SafeCheckType target)
 {
     Target = target;
     Up     = up;
     Down   = down;
     DownGT = downGT;
 }
Beispiel #3
0
 public UpSafeCheck(PlatformEx carrier, SafeCheckType target)
 {
     Target  = target;
     Carrier = carrier;
 }
Beispiel #4
0
 public DownSafeCheck(PlatformEx carrier, ICylinderEx downGt, SafeCheckType target)
 {
     Carrier = carrier;
     DownGt  = downGt;
     Target  = target;
 }