|
|
@ -67,7 +67,9 @@ class Wiiboard: |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
self.datasocket = bluetooth.BluetoothSocket(bluetooth.L2CAP) |
|
|
|
self.datasocket = bluetooth.BluetoothSocket(bluetooth.L2CAP) |
|
|
|
|
|
|
|
self.datasocket.settimeout(2) |
|
|
|
self.controlsocket = bluetooth.BluetoothSocket(bluetooth.L2CAP) |
|
|
|
self.controlsocket = bluetooth.BluetoothSocket(bluetooth.L2CAP) |
|
|
|
|
|
|
|
self.controlsocket.settimeout(2) |
|
|
|
except ValueError: |
|
|
|
except ValueError: |
|
|
|
raise Exception("Error: Bluetooth not found") |
|
|
|
raise Exception("Error: Bluetooth not found") |
|
|
|
|
|
|
|
|
|
|
@ -83,9 +85,7 @@ class Wiiboard: |
|
|
|
print("Non existant address") |
|
|
|
print("Non existant address") |
|
|
|
return |
|
|
|
return |
|
|
|
self.datasocket.connect((address, 0x13)) |
|
|
|
self.datasocket.connect((address, 0x13)) |
|
|
|
self.datasocket.settimeout(2) |
|
|
|
|
|
|
|
self.controlsocket.connect((address, 0x11)) |
|
|
|
self.controlsocket.connect((address, 0x11)) |
|
|
|
self.controlsocket.settimeout(2) |
|
|
|
|
|
|
|
if self.datasocket and self.controlsocket: |
|
|
|
if self.datasocket and self.controlsocket: |
|
|
|
print("Connected to Wiiboard at address " + address) |
|
|
|
print("Connected to Wiiboard at address " + address) |
|
|
|
self.status = "Connected" |
|
|
|
self.status = "Connected" |
|
|
@ -217,7 +217,7 @@ class Wiiboard: |
|
|
|
def send(self, data): |
|
|
|
def send(self, data): |
|
|
|
if self.status != "Connected": |
|
|
|
if self.status != "Connected": |
|
|
|
return |
|
|
|
return |
|
|
|
senddata = b'0xa2'+data |
|
|
|
senddata = b'\xa2'+data |
|
|
|
|
|
|
|
|
|
|
|
self.datasocket.send(senddata) |
|
|
|
self.datasocket.send(senddata) |
|
|
|
|
|
|
|
|
|
|
|