rendered paste body--- mk_tool/MkVerbindung.java 2008-04-02 10:56:30.000000000 +0200
+++ mk_tool.mine/MkVerbindung.java 2008-07-10 22:24:44.319985000 +0200
@@ -54,31 +54,26 @@
try {
serialPort = (SerialPort) portId.open("MK-Tool", 2000);
+ inputStream = serialPort.getInputStream();
+ outputstream = serialPort.getOutputStream();
+ serialPort.addEventListener(this);
+ serialPort.notifyOnDataAvailable(true);
+ serialPort.setSerialPortParams(57600,
+ SerialPort.DATABITS_8,
+ SerialPort.STOPBITS_1,
+ SerialPort.PARITY_NONE);
+
+
} catch (PortInUseException e) {
System.err.println("Port in Benutzung");
}
-
- try {
- inputStream = serialPort.getInputStream();
- outputstream = serialPort.getOutputStream();
- } catch (IOException e) {
- System.err.println("Fehler beim holen des Input Streams");
- }
-
- try {
- serialPort.addEventListener(this);
- } catch (TooManyListenersException e) {
+ catch (IOException e) {
+ System.err.println("Fehler beim holen des Input Streams");
+ }
+ catch (TooManyListenersException e) {
System.err.println("Zuviele Listener.");
}
-
- serialPort.notifyOnDataAvailable(true);
-
- try {
- serialPort.setSerialPortParams(57600,
- SerialPort.DATABITS_8,
- SerialPort.STOPBITS_1,
- SerialPort.PARITY_NONE);
- } catch (UnsupportedCommOperationException e) {
+ catch (UnsupportedCommOperationException e) {
System.err.println("Fehler bei Modus Setzen");
}