Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1540 | - | 1 | package dongfang.mkt.frames; |
2 | |||
3 | public class DebugResponseFrame extends ResponseFrame { |
||
4 | private int[] digital = new int[2]; |
||
5 | private int[] analog = new int[32]; |
||
6 | |||
7 | public DebugResponseFrame(int address) { |
||
8 | super(address); |
||
9 | } |
||
10 | |||
11 | public int[] getDigital() { |
||
12 | return digital; |
||
13 | } |
||
14 | |||
15 | public void setDigital(int index, int value) { |
||
16 | this.digital[index ]= value; |
||
17 | } |
||
18 | |||
19 | public int[] getAnalog() { |
||
20 | return analog; |
||
21 | } |
||
22 | |||
23 | public void setAnalog(int index, int value) { |
||
24 | this.analog[index ]= value; |
||
25 | } |
||
26 | |||
27 | @Override |
||
28 | public boolean isResponseTo(RequestFrame r) { |
||
29 | return r instanceof DebugRequestFrame; |
||
30 | } |
||
31 | |||
32 | public String toString() { |
||
33 | StringBuilder result = new StringBuilder(); |
||
34 | result.append(getClass().getSimpleName()+"\r"); |
||
35 | result.append("digital\r"); |
||
36 | for (int i=0; i<digital.length; i++) { |
||
37 | result.append(i); |
||
38 | result.append(':'); |
||
39 | result.append(digital[i]); |
||
40 | result.append('\r'); |
||
41 | } |
||
42 | result.append("analog\r"); |
||
43 | for (int i=0; i<analog.length; i++) { |
||
44 | result.append(i); |
||
45 | result.append(':'); |
||
46 | result.append(analog[i]); |
||
47 | result.append('\r'); |
||
48 | } |
||
49 | return result.toString(); |
||
50 | } |
||
51 | } |