wiiSocket
index
/home/rockolo/workspace/WiiSocket/src/wiiSocket.py

#wiiSocket.py

 
Modules
       
socket
thread
time

 
Classes
       
WiiMote

 
class WiiMote
    represents a WiiMote-Bluetooth-HID as an readable and controllable oject
 
  Methods defined here:
__init__(self, name, address)
create WiiMote-Object with name and unique address
connect(self)
connects the WiiMote
led(self, which)
leds from 1 to 4 can be switched on, 0 switches all off
receive(self)
receive data from the bluetoothsocket and writes it into the instance-variable "message"
rumble(self, rumbleTime)
rumbles for the given Time

 
Functions
       
clientThread(clientsocket, WiiMotes)
thread wich sends the data of all WiiMotes to the given clientSocket
findWiiThread(wiiMotes)
thread who find WiiMotes in the bluetooth-enviroment
 
new wiiMotes are automaticlly attached
main(host, port, maxConnections)
WiiSocket, initialise with host(ip), port(number), and the maximum amount of connections
 
usage (standalone):
just execute the file, if you whish to use an other host, other port
or an other amount of maximal connections, simply adjust the arguments
in the last line of this document
 
usage (in your module):
put this module-file in one of your python-paths or in the same directory
as your using module.
>>>import WiiSocket as wiiSocket
>>>wiiSocket.main(ipOfLocalhost, portNumber, maxAmountOfClients)
readBluetoothThread(wiiMote, wiiMotes)
thread which reads in the data of the given WiiMote
 
deletes the WiiMote if it is shut down
testClientThread(wiiMotes)
simulated client-thread for testing-purposes

 
Data
        L2CAP = 0