GroupReadingBlock.java
1.16 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
package com.tDiagnostics.diagnostics.blocks;
import com.fazecast.jSerialComm.SerialPort;
import com.tDiagnostics.communication.handler.ConnectionHandler;
public class GroupReadingBlock {
public Integer groupReadingData[][] = new Integer[4][3];///group,nr,data
//public String groupReadingDataString[][] = new String[26][4];
ConnectionHandler con;
public GroupReadingBlock(ConnectionHandler connection){
con = connection;
}
public int sendGroupReading(SerialPort port, int key){
System.out.println("START_sendGroupReading");
con.sendByte(port, 0x04, true);
con.readByte(port, 0x04, true);
if(con.WRONG_ANSWER)
return 1;
con.sendByte(port, con.blockCounter+1, true);
con.readByte(port, con.blockCounter+1, true);
if(con.WRONG_ANSWER)
return 1;
con.sendByte(port, 0x29, true);
con.readByte(port, 0x29, true);
if(con.WRONG_ANSWER)
return 1;
con.sendByte(port, key, true);
con.readByte(port, key, true);
if(con.WRONG_ANSWER)
return 1;
con.sendByte(port, 0x03, true);
return 0;
}
}