IOBase.cs
2.6 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSA_V.Common;
namespace TSA_V.DeviceLibrary
{
public abstract class IOBase
{
public ushort DIStartAddress = 200;
public ushort DoStartAddress = 100;
public static ushort DefaultDILength = 16;
public static ushort DefaultDOLength = 16;
public static IOBase instance = null;
public static byte DefualtSlaveID = 0x00;
public abstract void ConnectionKND(List<string> dIODeviceNameList);
/// <summary>
/// 没有轨道线体
/// </summary>
public static bool NoLine = false;
public static int IOType = Setting_NInit.Work_IOType;
public static void Init()
{
//int isAIOBox = ConfigAppSettings.GetIntValue(Setting_Init.UseAIOBOX);
IOType = Setting_NInit.Work_IOType;
if (IOType == 1)
{
instance = new AIOBOXManager();
}
else if (IOType == 2)
{
instance = new NanjingSDotIO();
}
else if (IOType == 3)
{
instance = new NiRenIO();
NoLine = true;
}else if (IOType == 99)
{
instance = new EmulationIO();
NoLine = true;
LogUtil.info("使用模拟IO");
}
else
{
instance = new KNDManager();
}
}
public static bool UseEmulationIO
{
get { return IOType == 99; }
set { }
}
public abstract void ReadAllDI(string deviceName, byte slaveId);
public abstract void ReadAllDO(string deviceName, byte slaveId);
public abstract void ConnectionIP(string kNDIP, ushort kNDPort);
public abstract void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value, int time);
public abstract bool IsConnection(string kNDIP);
public abstract void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value);
public abstract IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort v);
public abstract IO_VALUE GetDOValue(string deviceName, byte slaveID, ushort v);
public abstract IO_VALUE GetIOValue(ConfigIO configIO);
public abstract void CloseAllDO();
public abstract void CloseAllConnection();
public virtual void WriteSingleDI(string deviceName, byte slaveId, ushort index, IO_VALUE value)
{
}
}
}