diff options
Diffstat (limited to '')
-rw-r--r-- | ParrotZik.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/ParrotZik.py b/ParrotZik.py index 8e4b31b..52414b5 100644 --- a/ParrotZik.py +++ b/ParrotZik.py @@ -1,58 +1,6 @@ -import sys - -from resource_manager import GenericResourceManager from resource_manager import Version1ResourceManager from resource_manager import Version2ResourceManager -if sys.platform == "darwin": - import lightblue -else: - import bluetooth - - -def connect(addr=None): - uuids = ["0ef0f502-f0ee-46c9-986c-54ed027807fb", - "8B6814D3-6CE7-4498-9700-9312C1711F63"] - - if sys.platform == "darwin": - service_matches = lightblue.findservices( - name="Parrot RFcomm service", addr=addr) - else: - for uuid in uuids: - service_matches = bluetooth.find_service(uuid=uuid, - address=addr) - if service_matches: - break - - if len(service_matches) == 0: - print "Failed to find Parrot Zik RFCOMM service" - return GenericResourceManager(None) - - if sys.platform == "darwin": - first_match = service_matches[0] - port = first_match[1] - name = first_match[2] - host = first_match[0] - else: - first_match = service_matches[0] - port = first_match["port"] - name = first_match["name"] - host = first_match["host"] - - print "Connecting to \"%s\" on %s" % (name, host) - - if sys.platform == "darwin": - sock = lightblue.socket() - else: - sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM) - - sock.connect((host, port)) - - sock.send('\x00\x03\x00') - data = sock.recv(1024) - return GenericResourceManager(sock) - - class BatteryStates: CHARGED = 'charged' |