-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDTC.java
57 lines (41 loc) · 1.18 KB
/
DTC.java
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
package DTCController;
public class DTC {
int idx;
private byte[] memory;
private DTCInfo dtcInfo;
public DTC(int idx,DTCInfo dtcInfo,byte[] memory) {
this.idx = idx;
this.memory = memory;
this.dtcInfo = dtcInfo;
}
String getbaseCode() {
return DTCInfo.getStr(memory[dtcInfo.codeAddr+2*idx],memory[dtcInfo.codeAddr+2*idx+1]);
}
String getCode(int n) {
return DTCInfo.getStr(memory[dtcInfo.faultPathAddr+8*idx+2*n],memory[dtcInfo.faultPathAddr+8*idx+2*n+1]);
}
int getDTCClass() {
return memory[dtcInfo.classAddr+idx];
}
void setDTCClass(int c) {
Dump.setMemory(memory,dtcInfo.classAddr+idx,c);
}
int getEnv(int n) {
return (int)memory[dtcInfo.envAddr+5*idx+n] & 0xFF;
}
void setEnv(int[] envs) {
for(int i=0;i<envs.length;i++)
Dump.setMemory(memory,dtcInfo.envAddr+5*idx+i,envs[i]);
}
boolean match(String filter) {
if(filter==null)
return true;
if(filter.isEmpty())
return true;
return getbaseCode().contains(filter) ||
getCode(0).contains(filter) ||
getCode(1).contains(filter) ||
getCode(2).contains(filter) ||
getCode(3).contains(filter);
}
}