Initial commit
This commit is contained in:
		
							
								
								
									
										91
									
								
								Handler/Project/Device/StateMachine.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								Handler/Project/Device/StateMachine.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,91 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace Project.Device | ||||
| { | ||||
| 	public class CSequence :  AR.StateMachineSequence | ||||
|     { | ||||
| 		public CSequence(int stepLen = 255) : base(stepLen) { } | ||||
|  | ||||
| 		public void Clear(eSMStep idx) | ||||
| 		{ | ||||
| 			base.Clear((int)idx); | ||||
| 		} | ||||
| 		public int Get(eSMStep idx) | ||||
| 		{ | ||||
| 			return base.Get((int)idx); | ||||
| 		} | ||||
|  | ||||
| 		public void Set(eSMStep idx, byte value) | ||||
| 		{ | ||||
| 			base.Set((int)idx, value); | ||||
| 		} | ||||
|  | ||||
|  | ||||
| 		public void Update(eSMStep idx, int incValue = 1) | ||||
| 		{ | ||||
| 			base.Update((int)idx, incValue); | ||||
| 		} | ||||
| 		public TimeSpan GetTime(eSMStep idx = 0) | ||||
| 		{ | ||||
| 			return base.GetTime((int)idx); | ||||
| 		} | ||||
| 		public int GetData(eSMStep idx) | ||||
| 		{ | ||||
| 			return base.GetData((int)idx); | ||||
| 		} | ||||
| 		public void ClearData(eSMStep idx) { base.ClearData((int)idx); } | ||||
| 		public void AddData(eSMStep idx, byte value = 1) | ||||
| 		{ | ||||
| 			base.AddData((int)idx, value); | ||||
| 		} | ||||
| 		public void SetData(eSMStep idx, byte value) | ||||
| 		{ | ||||
| 			_runseqdata[(int)idx] = value; | ||||
| 		} | ||||
|  | ||||
| 		public void UpdateTime(eSMStep idx) | ||||
| 		{ | ||||
| 			_runseqtime[(int)idx] = DateTime.Now; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public class CStateMachine : AR.StateMachine | ||||
| 	{ | ||||
| 		/// <summary> | ||||
| 		/// Sequece Value / data | ||||
| 		/// </summary> | ||||
| 		public CSequence seq; | ||||
| 		public eSMStep PrePauseStep = eSMStep.NOTSET; | ||||
| 		public CStateMachine() | ||||
| 		{ | ||||
| 			seq = new CSequence(255); | ||||
| 		} | ||||
|  | ||||
| 		public new eSMStep Step { get { return (eSMStep)base.Step; } } | ||||
| 		public void SetNewStep(eSMStep newstep_, Boolean force = false) | ||||
| 		{ | ||||
| 			//일시중지라면 중지전의 상태를 백업한다 | ||||
| 			if (newstep_ == eSMStep.PAUSE && this.Step != eSMStep.PAUSE && this.Step != eSMStep.WAITSTART) PrePauseStep = this.Step; | ||||
| 			base.SetNewStep((byte)newstep_, force); | ||||
| 		} | ||||
|  | ||||
| 		public new eSMStep getNewStep | ||||
| 		{ | ||||
| 			get | ||||
| 			{ | ||||
| 				return (eSMStep)newstep_; | ||||
| 			} | ||||
| 		} | ||||
| 		public new eSMStep getOldStep | ||||
| 		{ | ||||
| 			get | ||||
| 			{ | ||||
| 				return (eSMStep)oldstep_; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 ChiKyun Kim
					ChiKyun Kim