using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using XImageSystem.Service.Interface; using XImaging.Automation.Library.HxDriverLib; namespace BiosenSocketService.Runtime { class DeviceRuntime:IRuntime { private bool m_bIsBusy; private RuntimeState m_rtState = RuntimeState.OnIdle; public ErrorHandleDelegate errorHandle { get; set; } public FinishTestHandleDelegate finishHandle { get; set; } public bool Busy { get { return m_bIsBusy; } set { m_bIsBusy = value; } } public string ErrorState { get; set; } public RuntimeState State { get; set; } public int TroubleShoot { get; set; } /// /// 计数包括导轨收回,拍照计数,导轨伸出 /// /// public JObject Count_APIWrapper() { m_bIsBusy = true; //关门 MainForm.motionControl.CloseDoor(60); Thread.Sleep(60*1000); string imgFolder = Application.StartupPath + "\\"+MainForm.snap_folder; if (!Directory.Exists(imgFolder)) Directory.CreateDirectory(imgFolder); string imgFile = imgFolder + "\\" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss-fff.jpg"); MainForm.Snap(imgFile); return new JObject(); } public void OpenDoor_APIWrapper() { MainForm.motionControl.OpenDoor(60); } public void CloseDoor_APIWrapper() { MainForm.motionControl.CloseDoor(60); } public void ClawOpen_APIWrapper() { MainForm.motionControl.ClawOpen(60); } public void ClawClose_APIWrapper() { MainForm.motionControl.ClawClose(60); } public void Abort_APIWrapper() { } public RuntimeState GetStatus_APIWrapper() { LogConstant.logger.Print("GetStatus/Simulator"); return RuntimeState.OnIdle; } public void ReplyAbort() { } public void ReplyRetry() { } public void ReplyIgnore() { } } }