Skip to content

Commit

Permalink
Add read long by handle and uuid. Fix reliable write by uuid.
Browse files Browse the repository at this point in the history
  • Loading branch information
mibrown committed Jan 30, 2015
1 parent 8c81f9f commit ab8efe5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bgmodule.py
Expand Up @@ -210,16 +210,24 @@ def read_by_handle(self, handle, timeout=3):
raise BlueGigaModuleException("Read Attribute by Handle did not complete before timeout!")

def write_by_uuid(self, uuid, value, timeout=3):
self.write_by_handle(self.uuid_handle[uuid], value, timeout)
for handle in self.uuid_handle[uuid]:
self.write_by_handle(handle, value, timeout)

def write_by_handle(self, handle, value, timeout=3):
self.start_procedure(PROCEDURE)
self._api.ble_cmd_attclient_attribute_write(self.handle, handle, value)
if not self.wait_for_procedure(timeout=timeout):
raise BlueGigaModuleException("Write did not complete before timeout! Connection:%d - Handle:%d" % self.handle, handle)

def read_long_by_uuid(self, uuid, timeout=3):
for handle in self.uuid_handle[uuid]:
self.read_long_by_handle(self.uuid_handle[uuid])

def read_long_by_handle(self, handle, timeout=3):
pass
self.start_procedure(PROCEDURE)
self._api.ble_cmd_attclient_read_long(self.handle, handle)
if not self.wait_for_procedure(timeout=timeout):
raise BlueGigaModuleException("Long Read did not complete before timeout! Connection:%d - Handle:%d" % self.handle, handle)

def reliable_write_by_uuid(self, uuid, value, offset=0, timeout=3):
for handle in self.uuid_handle[uuid]:
Expand Down

0 comments on commit ab8efe5

Please sign in to comment.