From e7d415df6d7e4ead4ed438e3b03f572be758fb8e Mon Sep 17 00:00:00 2001 From: morganjm Date: Sat, 20 Oct 2012 14:32:00 -0700 Subject: Fixes for SB5544 Router Added a delay between commands. Fixed reversed input/ouput in switch command. --- .../routercontrol/router/ShinyBow5544Router.java | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/net/tuschhcm/routercontrol/router/ShinyBow5544Router.java') diff --git a/src/net/tuschhcm/routercontrol/router/ShinyBow5544Router.java b/src/net/tuschhcm/routercontrol/router/ShinyBow5544Router.java index 17d9bd7..ef0e41e 100644 --- a/src/net/tuschhcm/routercontrol/router/ShinyBow5544Router.java +++ b/src/net/tuschhcm/routercontrol/router/ShinyBow5544Router.java @@ -10,7 +10,8 @@ import gnu.io.SerialPort; * */ public class ShinyBow5544Router implements Router { - + private static final int MSG_DELAY = 50; + private final SerialPort mSerialPort; private final PrintStream mOut; @@ -24,7 +25,7 @@ public class ShinyBow5544Router implements Router { CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(portName); // 9600 baud, 8 bit, no parity, 1 stop bit - mSerialPort = (SerialPort) portId.open("routercontrol", 1000); + mSerialPort = (SerialPort) portId.open("routercontrol", 100); mSerialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, @@ -48,7 +49,13 @@ public class ShinyBow5544Router implements Router { } - mOut.format("SBI0%dO0%d", output, input); + mOut.format("SBI0%dO0%d", input, output); + try { + Thread.sleep(MSG_DELAY); + + } catch (InterruptedException e) { + // ignore + } } @Override @@ -59,6 +66,13 @@ public class ShinyBow5544Router implements Router { } else { mOut.print("SBSYSMOF"); } + + try { + Thread.sleep(MSG_DELAY); + + } catch (InterruptedException e) { + // ignore + } } @Override @@ -69,6 +83,13 @@ public class ShinyBow5544Router implements Router { } else { mOut.print("SBSYSMUK"); } + + try { + Thread.sleep(MSG_DELAY); + + } catch (InterruptedException e) { + // ignore + } } @Override -- cgit v1.2.3