Rev 1532 | Rev 1562 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1532 | Rev 1545 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | import dongfang.mkt.frames.AnalogDebugLabelRequestFrame; |
16 | import dongfang.mkt.frames.AnalogDebugLabelRequestFrame; |
17 | import dongfang.mkt.frames.AnalogDebugLabelResponseFrame; |
17 | import dongfang.mkt.frames.AnalogDebugLabelResponseFrame; |
18 | import dongfang.mkt.frames.DebugRequestFrame; |
18 | import dongfang.mkt.frames.DebugRequestFrame; |
19 | import dongfang.mkt.frames.DebugResponseFrame; |
19 | import dongfang.mkt.frames.DebugResponseFrame; |
20 | import dongfang.mkt.frames.Frame; |
20 | import dongfang.mkt.frames.Frame; |
21 | import dongfang.mkt.frames.FrameFactory; |
- | |
22 | import dongfang.mkt.io.MKCommPort; |
21 | import dongfang.mkt.io.MKCommPort; |
23 | import dongfang.mkt.io.RXTXSerialPort; |
22 | import dongfang.mkt.io.RXTXSerialPort; |
24 | import dongfang.mkt.serial.FrameQueue; |
23 | import dongfang.mkt.serial.FrameQueue; |
25 | import dongfang.mkt.version.MKVersion; |
- | |
Line 26... | Line 24... | ||
26 | 24 | ||
27 | public class MKDebugLogger { |
25 | public class MKDebugLogger { |
28 | private static final PrintStream STDERR = System.out; |
26 | private static final PrintStream STDERR = System.out; |
Line 29... | Line 27... | ||
29 | private static final FrameFactory ff = MKVersion.getFrameFactory(null); |
27 | // private static final FrameFactory ff = MKVersion.getFrameFactory(null); |
30 | 28 | ||
31 | interface DebugLogger { |
29 | interface DebugLogger { |
32 | void setLabel(int index, String label); |
30 | void setLabel(int index, String label); |
Line 150... | Line 148... | ||
150 | 148 | ||
151 | int tries = 0; |
149 | int tries = 0; |
152 | while (!missing.isEmpty() && tries < 100) { |
150 | while (!missing.isEmpty() && tries < 100) { |
153 | int i = missing.get(0); |
151 | int i = missing.get(0); |
154 | tries++; |
152 | tries++; |
155 | AnalogDebugLabelRequestFrame f2 = ff |
153 | AnalogDebugLabelRequestFrame f2 = //ff.createAnalogDebugLabelRequestFrame(Frame.FC_ADDRESS, i); |
156 | .createAnalogDebugLabelRequestFrame(Frame.FC_ADDRESS, i); |
154 | new AnalogDebugLabelRequestFrame(Frame.FC_ADDRESS, i); |
157 | try { |
155 | try { |
158 | q.sendRequest(f2); |
156 | q.sendRequest(f2); |
159 | AnalogDebugLabelResponseFrame rf = (AnalogDebugLabelResponseFrame) q.getResponseFor(f2, 1000); |
157 | AnalogDebugLabelResponseFrame rf = (AnalogDebugLabelResponseFrame) q.getResponseFor(f2, 1000); |
160 | if (rf != null) { |
158 | if (rf != null) { |
Line 166... | Line 164... | ||
166 | } |
164 | } |
167 | } catch (IOException ex) { |
165 | } catch (IOException ex) { |
168 | } |
166 | } |
169 | } |
167 | } |
Line 170... | Line 168... | ||
170 | 168 | ||
- | 169 | DebugRequestFrame f = // ff.createDebugRequestFrame(Frame.FC_ADDRESS); |
|
171 | DebugRequestFrame f = ff.createDebugRequestFrame(Frame.FC_ADDRESS); |
170 | new DebugRequestFrame(Frame.FC_ADDRESS); |
172 | f.setAutoSendInterval(interval); |
171 | f.setAutoSendInterval(interval); |
173 | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); |
172 | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); |
174 | q.sendRequest(f); |
173 | q.sendRequest(f); |
175 | Long firsttimestamp = null; |
174 | Long firsttimestamp = null; |