aboutsummaryrefslogtreecommitdiff
path: root/ParrotZik.py
diff options
context:
space:
mode:
authorMarek Siarkowicz <mareksiarkowicz@gmail.com>2015-06-12 15:15:44 +0200
committerMarek Siarkowicz <mareksiarkowicz@gmail.com>2015-06-12 15:15:44 +0200
commit0d692102cd94f70e78cf036cb9f64c485ea8b6a5 (patch)
tree5099b8f97849d7d28cba74c6cac1d7eb2d139887 /ParrotZik.py
parentcac2d834faa85153fba2fca3c7faa1de34183b4d (diff)
downloadpyParrotZikTCP-0d692102cd94f70e78cf036cb9f64c485ea8b6a5.tar.xz
pyParrotZikTCP-0d692102cd94f70e78cf036cb9f64c485ea8b6a5.zip
Add Zik 2.0 compatibility.
Diffstat (limited to '')
-rw-r--r--ParrotZik.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/ParrotZik.py b/ParrotZik.py
index 65c3417..551d19a 100644
--- a/ParrotZik.py
+++ b/ParrotZik.py
@@ -9,13 +9,18 @@ from BeautifulSoup import BeautifulSoup
class ParrotZik(object):
def __init__(self, addr=None):
- uuid = "0ef0f502-f0ee-46c9-986c-54ed027807fb"
+ 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:
- service_matches = bluetooth.find_service(uuid=uuid, address=addr)
+ 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"
@@ -77,7 +82,10 @@ class ParrotZik(object):
@property
def version(self):
data = self.get("/api/software/version/get")
- return data.answer.software["version"]
+ try:
+ return data.answer.software["version"]
+ except KeyError:
+ return data.answer.software['sip6']
@property
def friendly_name(self):
@@ -110,7 +118,10 @@ class ParrotZik(object):
@property
def lou_reed_mode(self):
data = self.get("/api/audio/specific_mode/enabled/get")
- return data.answer.audio.specific_mode["enabled"]
+ try:
+ return data.answer.audio.specific_mode["enabled"]
+ except TypeError:
+ pass
@lou_reed_mode.setter
def lou_reed_mode(self, arg):