(c) 2009 Andreas Boehler, andreas.boehler@fh-linz.at, http://klasseonline.dyndns.org
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
based on wiimote.py found online (through Google, doesn't seem to be published anymore)
Source: http://homepage.mac.com/wgwoods/wii/wiimote.py saved as wiimote_orig.py
v1.9.3, 2009/05/24
Feature: Added support for the Classic Controller
v1.9.2, 2009/05/22
Feature: Speed improvement by 100% by switching from simpleosc to pyliblo!
Drawback: pyliblo must be manually compiled on OS X
v1.9.1, 2009/05/18
Fix duplicate packet handling on OS X (again)
v1.9.0, 2009/05/18 - first version towards a 2.0.0 release
Completely reworked packet handling
Memory reading and writing should be more robust now
Reworked Initialization sequence
BalanceBoard initialization on OS X should work now
Fixed OS X compatibility by handling duplicate packets differently
v1.8.2, 2009/05/12
Feature: Nunchuk disconnection works properly
v1.8.1, 2009/05/12
Bugfix: BalanceBoard works now (IR must not be enabled on the BB; Setting the
registers seems to influence the BalanceBoard's sensitivity.
Note: On OS X the BalanceBoard sometimes does not work because of limitations
in the Perfect Pairing Patch of OSCulator. Author contacted!
v1.8, 2009/05/11
Bugfix: Connection with inserted nunchuk fixed
Bugfix: Restructure
Feature: Removed some cmd-line arguments, thus making backend invocation easier
(c) 2009 Andreas Boehler, andreas.boehler@fh-linz.at, http://klasseonline.dyndns.org
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
Requirements:
* pybluez (Windows/Linux), lightblue (OS X)
* pyliblo (all platforms)
Notes:
* wiimote_backend.py and wiimote_frontend.py need to be in the same dir!
* The current dir must be set to wiimote_[frontend|backend].py
* The Microsoft-BT Stack is NOT supported! Tested: Widcomm under XP
* The path in OS X must not contain spaces!
+v1.8.3, 2009/07/04
+Bugfix: Removed sys.stdout.flush() and added -u to python call instead
+
+v1.8.2, 2009/07/04
+Feature: Can not change Client IP and Port by Command-Line arguments
+
+v1.8.1, 2009/07/03
+Feature: Added sys.stdout.flush() for the GUI to work properly
+
v1.8, 2009/05/22
Feature: Migrated to pyliblo from simpleosc which is a major speed improvement
v1.7, 2009/05/11
Feature: Removed setup sequence, initialization is now completely automatic; only left: debug
v1.6.3, 2009/05/08
Bugfix: Forgot int(msg) in disconnect-code
v1.6.2, 2009/05/06
Bugfix: Path to python.exe is now taken from sys.executable (should work on all platforms)
v1,6.1, 2009/05/05
Feature: Added debugging/verbose parameter support
v1.6, 2009/04/28
Feature: All OSC IPs and Ports can be freely configured now!
v1.5.1, 2009/04/27
Feature: Added ping command, status still to be done
v1.5, 2009/04/26
Bugfix: Correctly Terminate the process on MacOS X.
v1.4, 2009/04/24
Bugfix: Correctly Terminate the process on Win32. This took me about 6h to figure out!
v1.3.1, 2009/04/23
Bugfix: Changed from SIGKILL to SIGTERM for Unix kill method
v1.3, 2009/04/23
Feature: Added Device Discovery Routine
Bugfix: Fixed Python 2.6 compatibility
v1.2, 2009/04/23
Bugfix: Frontend used 100% CPU because of infinite loop
v1.1, 2009/04/20
Bugfix: Fixed OS X Compatibility
v1.0, 2009/04/09
Bugfix: Fixed Windows Compatibility (tested on Vista)
Note: Path to python.exe is hardcoded for now!
v0.2, 2009/04/08
Feature: Added OSC support
v0.1, 2009/04/07
Feature: Initial Version w/o OSC support
OSC Format description:
Address: "/wiipy"
Format: [Type, Number, Options]
Tuple: ["setup", 0, "debug", 1]
Tuple: ["connect", 0, "00:4f:4e:13:56:40"]
Tuple: ["disconnect", 0]
Tuple: ["shutdown"] stops alls connections and quits the wiipy_frontend.py
Tuple: ["discover"] starts Bluetooth-Discovery and sends the results via OSC
Tuple: ["ping"] sends a simple "OK" via OSC
Tuple: ["status"] reports connections via OSC
Tuple: ["config", "ip", "127.0.0.1", "port", 5600] configure osc IP and Port to connect to
"""
import os
import subprocess
import sys
import time as timer
from liblo import *
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-i","--ip", dest="ip", help="OSC Server Address", default="127.0.0.1")
parser.add_option("-p","--port", dest="port", help="OSC Server Port", default=5601, type="int")
We only need a short OSC Server and need to handle termination correctly,
that is by stopping the server and disconnecting all clients.
Note that the OSC Server is, at least under Linux, only stopped upon reception
of the next message!
"""
s = oscServer(OSC_IP, OSC_PORT)
s.start()
print "wiipy_frontend.py initialized, waiting for commands"
try:
while s.connected:
timer.sleep(1)
except:
print "Exit"
s.stopOsc()
diff --git a/wiipy_gui.py b/wiipy_gui.py
new file mode 100755
--- /dev/null
+++ b/wiipy_gui.py
@@ -0,0 +1,291 @@
+#!/usr/bin/env python
+"""
+wiipy_gui.py, (c) 2009 Andreas Boehler, andreas.boehler@fh-linz.at, http://klasseonline.dyndns.org
+
+This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+v0.4, 2009/07/04
+Feature: Made it a bit more sane by disabling silly operations
+Feature: Commented the code :)
+Bugfix: Made handle_boxes() more efficient
+Bugfix: Added '-u' to python call for unbuffered stdout
+
+v0.3, 2009/07/04
+Feature: Can now configure Client Host & Port
+
+v0.2, 2009/07/03
+Bugfix: Small fixes for Win32
+Feature: Can now change Host and Port
+
+v0.1, 2009/07/03
+Basic Start, Stop and Debug functions. Tested only on Linux
+
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import subprocess2
+import sys
+import os
+import time
+
+class Base:
+ def check_text(self):
+ """
+ Checks whether new text has arrived from the pipe and updates