whyclxw
2020-09-19 1bffd54630f3c20c29879b20033804d759db4750
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
package com.dev.base.data;
 
import com.modbus.data.MyModbusMaster;
import com.modbus.data.MyModbusUtils;
import com.serotonin.modbus4j.BatchRead;
import com.serotonin.modbus4j.BatchResults;
import com.serotonin.modbus4j.code.DataType;
 
public class Dynamicload_button {
    
    public int dev_id;
    public int FZ_b1;            //FZ°´Å¥1
    public int FZ_b2;            //FZ°´Å¥2
    public int FZ_b3;            //FZ°´Å¥3
    public int FZ_b4;            //FZ°´Å¥4
    public int FZ_b5;            //FZ°´Å¥5
    public int FZ_b6;            //FZ°´Å¥6
    public int FZ_b7;            //FZ°´Å¥7
    public int FZ_b8;            //FZ°´Å¥8
    public int FZ_b9;            //FZ°´Å¥9
    public int FZ_b10;            //FZ°´Å¥10
    public int FZ_b11;            //FZ°´Å¥11
    public int FZ_fw1;            //FZ·´À¡°´Å¥1
    public int FZ_fw2;            //FZ·´À¡°´Å¥2
    public int FZ_fw3;            //FZ·´À¡°´Å¥3
    public int FZ_fw4;            //FZ·´À¡°´Å¥4
    public int FZ_fw5;            //FZ·´À¡°´Å¥5
    public int FZ_fw6;            //FZ·´À¡°´Å¥6
    public int FZ_fw7;            //FZ·´À¡°´Å¥7
    public int FZ_fw8;            //FZ·´À¡°´Å¥8
    public int FZ_fw9;            //FZ·´À¡°´Å¥9
    public int FZ_fw10;            //FZ·´À¡°´Å¥10
    public int FZ_fw11;            //FZ·´À¡°´Å¥11
    public int FZ_ex1;            //FZÊä³ö°´Å¥1
    public int FZ_ex2;            //FZÊä³ö°´Å¥2
    public int FZ_ex3;            //FZÊä³ö°´Å¥3
    public int FZ_ex4;            //FZÊä³ö°´Å¥4
    public int FZ_ex5;            //FZÊä³ö°´Å¥5
    public int FZ_ex6;            //FZÊä³ö°´Å¥6
    public int FZ_ex7;            //FZÊä³ö°´Å¥7
    public int FZ_ex8;            //FZÊä³ö°´Å¥8
    public int FZ_ex9;            //FZÊä³ö°´Å¥9
    public int FZ_ex10;            //FZÊä³ö°´Å¥10
    public int FZ_ex11;            //FZÊä³ö°´Å¥11
    public String note;
    
    
    public Dynamicload_button(int dev_id) {
        this.dev_id = dev_id;
    }
    
    public int getDev_id() {
        return dev_id;
    }
    public int getFZ_b1() {
        return FZ_b1;
    }
    public int getFZ_b2() {
        return FZ_b2;
    }
    public int getFZ_b3() {
        return FZ_b3;
    }
    public int getFZ_b4() {
        return FZ_b4;
    }
    public int getFZ_b5() {
        return FZ_b5;
    }
    public int getFZ_b6() {
        return FZ_b6;
    }
    public int getFZ_b7() {
        return FZ_b7;
    }
    public int getFZ_b8() {
        return FZ_b8;
    }
    public int getFZ_b9() {
        return FZ_b9;
    }
    public int getFZ_b10() {
        return FZ_b10;
    }
    public int getFZ_b11() {
        return FZ_b11;
    }
    public int getFZ_fw1() {
        return FZ_fw1;
    }
    public int getFZ_fw2() {
        return FZ_fw2;
    }
    public int getFZ_fw3() {
        return FZ_fw3;
    }
    public int getFZ_fw4() {
        return FZ_fw4;
    }
    public int getFZ_fw5() {
        return FZ_fw5;
    }
    public int getFZ_fw6() {
        return FZ_fw6;
    }
    public int getFZ_fw7() {
        return FZ_fw7;
    }
    public int getFZ_fw8() {
        return FZ_fw8;
    }
    public int getFZ_fw9() {
        return FZ_fw9;
    }
    public int getFZ_fw10() {
        return FZ_fw10;
    }
    public int getFZ_fw11() {
        return FZ_fw11;
    }
    public int getFZ_ex1() {
        return FZ_ex1;
    }
    public int getFZ_ex2() {
        return FZ_ex2;
    }
    public int getFZ_ex3() {
        return FZ_ex3;
    }
    public int getFZ_ex4() {
        return FZ_ex4;
    }
    public int getFZ_ex5() {
        return FZ_ex5;
    }
    public int getFZ_ex6() {
        return FZ_ex6;
    }
    public int getFZ_ex7() {
        return FZ_ex7;
    }
    public int getFZ_ex8() {
        return FZ_ex8;
    }
    public int getFZ_ex9() {
        return FZ_ex9;
    }
    public int getFZ_ex10() {
        return FZ_ex10;
    }
    public int getFZ_ex11() {
        return FZ_ex11;
    }
    public String getNote() {
        return note;
    }
    public void setDev_id(int dev_id) {
        this.dev_id = dev_id;
    }
    public void setFZ_b1(int fZ_b1) {
        FZ_b1 = fZ_b1;
    }
    public void setFZ_b2(int fZ_b2) {
        FZ_b2 = fZ_b2;
    }
    public void setFZ_b3(int fZ_b3) {
        FZ_b3 = fZ_b3;
    }
    public void setFZ_b4(int fZ_b4) {
        FZ_b4 = fZ_b4;
    }
    public void setFZ_b5(int fZ_b5) {
        FZ_b5 = fZ_b5;
    }
    public void setFZ_b6(int fZ_b6) {
        FZ_b6 = fZ_b6;
    }
    public void setFZ_b7(int fZ_b7) {
        FZ_b7 = fZ_b7;
    }
    public void setFZ_b8(int fZ_b8) {
        FZ_b8 = fZ_b8;
    }
    public void setFZ_b9(int fZ_b9) {
        FZ_b9 = fZ_b9;
    }
    public void setFZ_b10(int fZ_b10) {
        FZ_b10 = fZ_b10;
    }
    public void setFZ_b11(int fZ_b11) {
        FZ_b11 = fZ_b11;
    }
    public void setFZ_fw1(int fZ_fw1) {
        FZ_fw1 = fZ_fw1;
    }
    public void setFZ_fw2(int fZ_fw2) {
        FZ_fw2 = fZ_fw2;
    }
    public void setFZ_fw3(int fZ_fw3) {
        FZ_fw3 = fZ_fw3;
    }
    public void setFZ_fw4(int fZ_fw4) {
        FZ_fw4 = fZ_fw4;
    }
    public void setFZ_fw5(int fZ_fw5) {
        FZ_fw5 = fZ_fw5;
    }
    public void setFZ_fw6(int fZ_fw6) {
        FZ_fw6 = fZ_fw6;
    }
    public void setFZ_fw7(int fZ_fw7) {
        FZ_fw7 = fZ_fw7;
    }
    public void setFZ_fw8(int fZ_fw8) {
        FZ_fw8 = fZ_fw8;
    }
    public void setFZ_fw9(int fZ_fw9) {
        FZ_fw9 = fZ_fw9;
    }
    public void setFZ_fw10(int fZ_fw10) {
        FZ_fw10 = fZ_fw10;
    }
    public void setFZ_fw11(int fZ_fw11) {
        FZ_fw11 = fZ_fw11;
    }
    public void setFZ_ex1(int fZ_ex1) {
        FZ_ex1 = fZ_ex1;
    }
    public void setFZ_ex2(int fZ_ex2) {
        FZ_ex2 = fZ_ex2;
    }
    public void setFZ_ex3(int fZ_ex3) {
        FZ_ex3 = fZ_ex3;
    }
    public void setFZ_ex4(int fZ_ex4) {
        FZ_ex4 = fZ_ex4;
    }
    public void setFZ_ex5(int fZ_ex5) {
        FZ_ex5 = fZ_ex5;
    }
    public void setFZ_ex6(int fZ_ex6) {
        FZ_ex6 = fZ_ex6;
    }
    public void setFZ_ex7(int fZ_ex7) {
        FZ_ex7 = fZ_ex7;
    }
    public void setFZ_ex8(int fZ_ex8) {
        FZ_ex8 = fZ_ex8;
    }
    public void setFZ_ex9(int fZ_ex9) {
        FZ_ex9 = fZ_ex9;
    }
    public void setFZ_ex10(int fZ_ex10) {
        FZ_ex10 = fZ_ex10;
    }
    public void setFZ_ex11(int fZ_ex11) {
        FZ_ex11 = fZ_ex11;
    }
    public void setNote(String note) {
        this.note = note;
    }
    @Override
    public String toString() {
        return "Dynamicload_button [dev_id=" + dev_id + ", FZ_b1=" + FZ_b1 + ", FZ_b2=" + FZ_b2 + ", FZ_b3=" + FZ_b3
                + ", FZ_b4=" + FZ_b4 + ", FZ_b5=" + FZ_b5 + ", FZ_b6=" + FZ_b6 + ", FZ_b7=" + FZ_b7 + ", FZ_b8=" + FZ_b8
                + ", FZ_b9=" + FZ_b9 + ", FZ_b10=" + FZ_b10 + ", FZ_b11=" + FZ_b11 + ", FZ_fw1=" + FZ_fw1 + ", FZ_fw2="
                + FZ_fw2 + ", FZ_fw3=" + FZ_fw3 + ", FZ_fw4=" + FZ_fw4 + ", FZ_fw5=" + FZ_fw5 + ", FZ_fw6=" + FZ_fw6
                + ", FZ_fw7=" + FZ_fw7 + ", FZ_fw8=" + FZ_fw8 + ", FZ_fw9=" + FZ_fw9 + ", FZ_fw10=" + FZ_fw10
                + ", FZ_fw11=" + FZ_fw11 + ", FZ_ex1=" + FZ_ex1 + ", FZ_ex2=" + FZ_ex2 + ", FZ_ex3=" + FZ_ex3
                + ", FZ_ex4=" + FZ_ex4 + ", FZ_ex5=" + FZ_ex5 + ", FZ_ex6=" + FZ_ex6 + ", FZ_ex7=" + FZ_ex7
                + ", FZ_ex8=" + FZ_ex8 + ", FZ_ex9=" + FZ_ex9 + ", FZ_ex10=" + FZ_ex10 + ", FZ_ex11=" + FZ_ex11
                + ", note=" + note + "]";
    }
 
    /**
     * ´´½¨¶ÁÈ¡Êý¾Ý¼¯ºÏ
     * @param master
     * @return
     */
    public BatchRead<Integer> createBatchRead(MyModbusMaster master){
        BatchRead<Integer> batch = new BatchRead<Integer>();        
        batch.addLocator(0,MyModbusUtils.createBaseLocator(80 ,master));//°´Å¥1
        batch.addLocator(1,MyModbusUtils.createBaseLocator(81 ,master));
        batch.addLocator(2,MyModbusUtils.createBaseLocator(82 , master));
        batch.addLocator(3,MyModbusUtils.createBaseLocator(83, master));                                
        batch.addLocator(4,MyModbusUtils.createBaseLocator(84, master));                                    
        batch.addLocator(5,MyModbusUtils.createBaseLocator(85, master));                                
        batch.addLocator(6,MyModbusUtils.createBaseLocator(86, master));                                
        batch.addLocator(7,MyModbusUtils.createBaseLocator(87, master));                                
        batch.addLocator(8,MyModbusUtils.createBaseLocator(88, master));                                
        batch.addLocator(9,MyModbusUtils.createBaseLocator(89, master));                                    
        batch.addLocator(10,MyModbusUtils.createBaseLocator(90, master));//°´Å¥11
        
        batch.addLocator(11,MyModbusUtils.createBaseLocator(4020,master));//·´À¡1
        batch.addLocator(12,MyModbusUtils.createBaseLocator(4021,master));
        batch.addLocator(13,MyModbusUtils.createBaseLocator(4022, master));
        batch.addLocator(14,MyModbusUtils.createBaseLocator(4023, master));                                
        batch.addLocator(15,MyModbusUtils.createBaseLocator(4024, master));                                    
        batch.addLocator(16,MyModbusUtils.createBaseLocator(4025, master));                                
        batch.addLocator(17,MyModbusUtils.createBaseLocator(4026, master));                                
        batch.addLocator(18,MyModbusUtils.createBaseLocator(4027, master));                                
        batch.addLocator(19,MyModbusUtils.createBaseLocator(4028, master));                                
        batch.addLocator(20,MyModbusUtils.createBaseLocator(4029, master));                                    
        batch.addLocator(21,MyModbusUtils.createBaseLocator(4030, master));//·´À¡11
        
        batch.addLocator(22,MyModbusUtils.createBaseLocator(8000,master));//Êä³ö1
        batch.addLocator(23,MyModbusUtils.createBaseLocator(8001 ,master));
        batch.addLocator(24,MyModbusUtils.createBaseLocator(8002 ,master));
        batch.addLocator(25,MyModbusUtils.createBaseLocator(8003, master));                                
        batch.addLocator(26,MyModbusUtils.createBaseLocator(8004, master));                                    
        batch.addLocator(27,MyModbusUtils.createBaseLocator(8005, master));                                
        batch.addLocator(28,MyModbusUtils.createBaseLocator(8006, master));                                
        batch.addLocator(29,MyModbusUtils.createBaseLocator(8007, master));                                
        batch.addLocator(30,MyModbusUtils.createBaseLocator(8008, master));                                
        batch.addLocator(31,MyModbusUtils.createBaseLocator(8009, master));                                    
        batch.addLocator(32,MyModbusUtils.createBaseLocator(8010, master));//Êä³ö11
        
        return batch;
    }
    /**
     * ½âÎö·µ»ØÇëÇó
     * @param res
     */
    public void putBatchResult(BatchResults<Integer> res) {
        if(res != null) {
            this.FZ_b1 = MyModbusUtils.readBooleanToInt(res.getValue(0));    //°´Å¥1
            this.FZ_b2 = MyModbusUtils.readBooleanToInt(res.getValue(1));    
            this.FZ_b3 = MyModbusUtils.readBooleanToInt(res.getValue(2));    
            this.FZ_b4 = MyModbusUtils.readBooleanToInt(res.getValue(3));                
            this.FZ_b5 = MyModbusUtils.readBooleanToInt(res.getValue(4));                
            this.FZ_b6 = MyModbusUtils.readBooleanToInt(res.getValue(5));            
            this.FZ_b7 = MyModbusUtils.readBooleanToInt(res.getValue(6));                
            this.FZ_b8 = MyModbusUtils.readBooleanToInt(res.getValue(7));        
            this.FZ_b9 = MyModbusUtils.readBooleanToInt(res.getValue(8));                
            this.FZ_b10= MyModbusUtils.readBooleanToInt(res.getValue(9));                
            this.FZ_b11= MyModbusUtils.readBooleanToInt(res.getValue(10));    //°´Å¥11
            
            this.FZ_fw1 = MyModbusUtils.readBooleanToInt(res.getValue(11));    //·´À¡1
            this.FZ_fw2 = MyModbusUtils.readBooleanToInt(res.getValue(12));    //·´À¡2
            this.FZ_fw3 = MyModbusUtils.readBooleanToInt(res.getValue(13));    //·´À¡3
            this.FZ_fw4 = MyModbusUtils.readBooleanToInt(res.getValue(14));    //·´À¡4
            this.FZ_fw5 = MyModbusUtils.readBooleanToInt(res.getValue(15));    //·´À¡5
            this.FZ_fw6 = MyModbusUtils.readBooleanToInt(res.getValue(16));    //·´À¡6
            this.FZ_fw7 = MyModbusUtils.readBooleanToInt(res.getValue(17));    //·´À¡7
            this.FZ_fw8 = MyModbusUtils.readBooleanToInt(res.getValue(18));    //·´À¡8
            this.FZ_fw9 = MyModbusUtils.readBooleanToInt(res.getValue(19));    //·´À¡9
            this.FZ_fw10= MyModbusUtils.readBooleanToInt(res.getValue(20));    //·´À¡10
            this.FZ_fw11= MyModbusUtils.readBooleanToInt(res.getValue(21));    //·´À¡11
            
            this.FZ_ex1 = MyModbusUtils.readBooleanToInt(res.getValue(22));    //Êä³ö1
            this.FZ_ex2 = MyModbusUtils.readBooleanToInt(res.getValue(23));    //Êä³ö2
            this.FZ_ex3 = MyModbusUtils.readBooleanToInt(res.getValue(24));    //Êä³ö3
            this.FZ_ex4 = MyModbusUtils.readBooleanToInt(res.getValue(25));    //Êä³ö4
            this.FZ_ex5 = MyModbusUtils.readBooleanToInt(res.getValue(26));    //Êä³ö5
            this.FZ_ex6 = MyModbusUtils.readBooleanToInt(res.getValue(27));    //Êä³ö6
            this.FZ_ex7 = MyModbusUtils.readBooleanToInt(res.getValue(28));    //Êä³ö7
            this.FZ_ex8 = MyModbusUtils.readBooleanToInt(res.getValue(29));    //Êä³ö8
            this.FZ_ex9 = MyModbusUtils.readBooleanToInt(res.getValue(30));    //Êä³ö9
            this.FZ_ex10= MyModbusUtils.readBooleanToInt(res.getValue(31));    //Êä³ö10
            this.FZ_ex11= MyModbusUtils.readBooleanToInt(res.getValue(32));    //Êä³ö11
        }
    }
    
}