huang
2025-10-30 a99650cb00bf5b0650c33f39a4221b765201d228
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.mes.connect.industrialinterface;
 
import java.io.IOException;
 
 
/**
 * 通信统一接口 - 客户端模式
 *
 * @author yzx
 * @version 1.0
 */
public interface IndustrialClient extends AutoCloseable {
    /**
     * 开启连接
     * @throws IOException
     */
    void connect() throws IOException;
 
    /**
     * 关闭连接
     */
    void disconnect();
 
    /**
     * 当前连接状态
     * @return
     */
    boolean isConnected();
 
    /**
     * 数据读写方法
     * @param address
     * @return
     * @throws IOException
     */
    boolean readBit(String address) throws IOException;
 
    /**
     * 读bit 位
     * @param address
     * @param value
     * @throws IOException
     */
    void writeBit(String address, boolean value) throws IOException;
 
    /**
     * 读取地址线圈
     * @param address
     * @return
     * @throws IOException
     */
    int readRegister(String address) throws IOException;
 
    /**
     * 写入地址线圈
     * @param address
     * @param value
     * @throws IOException
     */
    void writeRegister(String address, int value) throws IOException;
 
    /**
     * 读取地址 线圈 quantity个
     * @param address
     * @param quantity
     * @return
     * @throws IOException
     */
    int[] readRegisters(String address, int quantity) throws IOException;
 
    /**
     * 写入地址 线圈 quantity个
     * @param address
     * @param values
     * @throws IOException
     */
    void writeRegisters(String address, int[] values) throws IOException;
 
    /**
     * 读取地址 float类型
     * @param address
     * @return
     * @throws IOException
     */
    float readFloat(String address) throws IOException;
 
    /**
     * 写入地址 float类型
     * @param address
     * @param value
     * @throws IOException
     */
    void writeFloat(String address, float value) throws IOException;
 
    /**
     * 读取地址 String 类型
     * @param address
     * @param length
     * @return
     * @throws IOException
     */
    String readString(String address, int length) throws IOException;
 
    /**
     * 写入地址 String 类型
     * @param address
     * @param value
     * @throws IOException
     */
    void writeString(String address, String value) throws IOException;
 
    /**
     * 关闭连接
     * @throws IOException
     */
    @Override
    void close() throws IOException;
}