Rev 1562 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1562 | Rev 1563 | ||
---|---|---|---|
Line 16... | Line 16... | ||
16 | import org.w3c.dom.Document; |
16 | import org.w3c.dom.Document; |
17 | import org.w3c.dom.Element; |
17 | import org.w3c.dom.Element; |
18 | import org.w3c.dom.NodeList; |
18 | import org.w3c.dom.NodeList; |
19 | import org.xml.sax.SAXException; |
19 | import org.xml.sax.SAXException; |
Line -... | Line 20... | ||
- | 20 | ||
- | 21 | import dongfang.mkt.comm.FrameQueue; |
|
- | 22 | import dongfang.mkt.comm.MKConnection; |
|
- | 23 | import dongfang.mkt.comm.serial.RXTXSerialPort; |
|
20 | 24 | import dongfang.mkt.comm.tcp.MKTCPConnection; |
|
21 | import dongfang.mkt.configuration.ConfigSet; |
25 | import dongfang.mkt.configuration.ConfigSet; |
22 | import dongfang.mkt.frames.UniversalReadParamSetRequestFrame; |
26 | import dongfang.mkt.frames.UniversalReadParamSetRequestFrame; |
23 | import dongfang.mkt.frames.UniversalReadParamSetResponseFrame; |
27 | import dongfang.mkt.frames.UniversalReadParamSetResponseFrame; |
24 | import dongfang.mkt.frames.UniversalWriteParamSetRequestFrame; |
28 | import dongfang.mkt.frames.UniversalWriteParamSetRequestFrame; |
25 | import dongfang.mkt.frames.UniversalWriteParamSetResponseFrame; |
- | |
26 | import dongfang.mkt.io.MKCommPort; |
- | |
27 | import dongfang.mkt.io.RXTXSerialPort; |
- | |
Line 28... | Line 29... | ||
28 | import dongfang.mkt.serial.FrameQueue; |
29 | import dongfang.mkt.frames.UniversalWriteParamSetResponseFrame; |
29 | 30 | ||
30 | public class UniversalConfigurator { |
31 | public class UniversalConfigurator { |
31 | private static void configure(String portIdentifier, UniversalWriteParamSetRequestFrame frame, |
32 | private static void configure(String portIdentifier, UniversalWriteParamSetRequestFrame frame, |
32 | int parameterSetNumber) throws IOException { |
33 | int parameterSetNumber) throws IOException { |
33 | MKCommPort port = new RXTXSerialPort(); |
34 | MKConnection port = new RXTXSerialPort(); |
Line 34... | Line 35... | ||
34 | port.init(portIdentifier); |
35 | port.init(portIdentifier); |
Line 60... | Line 61... | ||
60 | UniversalWriteParamSetRequestFrame frame = parseXMLParameterSet(inputStream); |
61 | UniversalWriteParamSetRequestFrame frame = parseXMLParameterSet(inputStream); |
61 | configure(portIdentifier, frame, parameterSetNumber); |
62 | configure(portIdentifier, frame, parameterSetNumber); |
62 | } |
63 | } |
Line 63... | Line 64... | ||
63 | 64 | ||
64 | private static ConfigSet readConfiguration(String portIdentifier, int parameterSetNumber) throws IOException { |
65 | private static ConfigSet readConfiguration(String portIdentifier, int parameterSetNumber) throws IOException { |
65 | MKCommPort port = new RXTXSerialPort(); |
66 | MKConnection port = new MKTCPConnection(); //new RXTXSerialPort();// |
66 | port.init(portIdentifier); |
67 | port.init(portIdentifier); |
67 | FrameQueue q = new FrameQueue(port); |
68 | FrameQueue q = new FrameQueue(port); |
Line 68... | Line 69... | ||
68 | ConfigSet cs = null; |
69 | ConfigSet cs = null; |
Line 242... | Line 243... | ||
242 | public static void main(String[] args) throws IOException { |
243 | public static void main(String[] args) throws IOException { |
243 | if (!"r".equals(args[0]) && !"w".equals(args[0])) help(); |
244 | if (!"r".equals(args[0]) && !"w".equals(args[0])) help(); |
244 | if ("w".equals(args[0]) && (args.length!=3 && args.length!=4)) help(); |
245 | if ("w".equals(args[0]) && (args.length!=3 && args.length!=4)) help(); |
245 | if ("r".equals(args[0]) && (args.length!=3 && args.length!=4)) help(); |
246 | if ("r".equals(args[0]) && (args.length!=3 && args.length!=4)) help(); |
Line 246... | Line 247... | ||
246 | 247 | ||
Line 247... | Line 248... | ||
247 | String portIdentifier = null; |
248 | String portIdentifier = "8080"; |
248 | 249 | ||
249 | if ("r".equals(args[0])) { |
250 | if ("r".equals(args[0])) { |
250 | readConfiguration(portIdentifier, Integer.parseInt(args[1])); |
251 | readConfiguration(portIdentifier, Integer.parseInt(args[1])); |