schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
 
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; }
 
 
        /// <summary>
        /// 计数包括导轨收回,拍照计数,导轨伸出
        /// </summary>
        /// <returns></returns>
        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()
        {
        }
    }
}