[tuxdroid-svn] r5373 - software_suite_v3/software/tool/tool-tux-controller/branches/user_mode/src/G
Status: Beta
Brought to you by:
ks156
|
From: ks156 <c2m...@c2...> - 2009-09-14 11:06:13
|
Author: ks156
Date: 2009-09-14 13:06:02 +0200 (Mon, 14 Sep 2009)
New Revision: 5373
Modified:
software_suite_v3/software/tool/tool-tux-controller/branches/user_mode/src/GUI/control/controlTux.java
Log:
* Added a test to determines if the server is on the port 270 or 54321
Modified: software_suite_v3/software/tool/tool-tux-controller/branches/user_mode/src/GUI/control/controlTux.java
===================================================================
--- software_suite_v3/software/tool/tool-tux-controller/branches/user_mode/src/GUI/control/controlTux.java 2009-09-14 10:42:19 UTC (rev 5372)
+++ software_suite_v3/software/tool/tool-tux-controller/branches/user_mode/src/GUI/control/controlTux.java 2009-09-14 11:06:02 UTC (rev 5373)
@@ -34,9 +34,27 @@
public controlTux(mainWindow winInstance) {
win = winInstance;
+
+ /* Try to connect with the port 270 */
tux = new TuxAPI("127.0.0.1", 270);
tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED,
"TuxController", "98765");
+
+ /* Wait 1 second, and check if the API is connected */
+ try {
+ Thread.sleep(1000);
+ }
+ catch(Exception except) {
+ except.printStackTrace();
+ }
+
+ /* If the API is not connected, try with the port 54321 */
+ if (tux.server.getConnected() != true)
+ {
+ tux = new TuxAPI("127.0.0.1", 54321);
+ tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED,
+ "TuxController", "98765");
+ }
tux.server.waitConnected(0.5);
registerEvents();
if (tux.radio.waitConnected(0.5))
|