천호석
2022-09-22 cc91325b1376aabea3511e4fe4450582b7ea1d3b
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
using MMCE_Test;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static MMCE_Test.NMCSDKLib;
 
namespace SHARP_CLAS_UI
{
    public class Slave
    {
        #region Property
        public ushort Board_Id { get; private set; }
 
        public ushort Device_Id { get; private set; }
 
        public EcState Slave_State { get; private set; }
        #endregion
 
        #region Construct
        public Slave(ushort Board_Id, ushort Device_Id)
        {
            this.Board_Id = Board_Id;
            this.Device_Id = Device_Id;
        }
        #endregion
 
        #region Function
        public bool Get_State(out EcState State)
        {
            try
            {
                byte data = 0;
 
                MC_STATUS mc;
                mc = SlaveGetCurState(Board_Id, Device_Id, ref data);
 
                if (mc == MC_STATUS.MC_OK)
                {
                    Slave_State = (EcState)data;
                    State = (EcState)data;
                    return true;
                }
                else
                {
                    throw new Exception($"Error : {mc}");
                }
            }
            catch (Exception ex)
            {
                State = EcState.eST_UNKNOWN;
                return false;
 
            }
        }
        #endregion
    }
}