Skip to content

Commit

Permalink
add procedure_completed signal
Browse files Browse the repository at this point in the history
  • Loading branch information
andete committed Mar 2, 2014
1 parent d57d918 commit bdd01e5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class BLE(QtCore.QObject):
connection_status = QtCore.Signal(int, str, int)
timeout = QtCore.Signal()
service_result = QtCore.Signal(int, list, int, int)
procedure_completed = QtCore.Signal(int)

CONNECTED = 0

Expand Down Expand Up @@ -151,6 +152,7 @@ def start(self, port = None):
ble.send_command(ser, ble.ble_cmd_system_address_get())
ble.check_activity(ser, 1)
print "local device:", self.address
self.ble.ble_evt_attclient_procedure_completed += self.handle_attclient_procedure_completed

def send_command(self, cmd):
return self.ble.send_command(self.ser, cmd)
Expand Down Expand Up @@ -183,10 +185,15 @@ def handle_connection_status(self, sender, args):
def handle_attclient_group_found(self, sender, args):
#uuid = ''.join(["%02X" % c for c in reversed(args['uuid'])])
#print "Found attribute group for service: %s start=%d, end=%d" % (uuid, args['start'], args['end'])
print args
handle = args['connection']
uuid = args['uuid'][::-1]
self.service_result.emit(handle, uuid, args['start'], args['end'])

def handle_attclient_procedure_completed(self, sender, args):
handle = args['connection']
self.procedure_completed.emit(handle)

def check_activity(self):
return self.ble.check_activity(self.ser)

Expand Down
4 changes: 4 additions & 0 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def run_collection(self):
self.ble.scan_response.connect(self.scan_response)
self.ble.connection_status.connect(self.connection_status)
self.ble.service_result.connect(self.service_result)
self.ble.procedure_completed.connect(self.procedure_completed)
self.activity_thread.start()

def scan_response(self, args):
Expand Down Expand Up @@ -190,6 +191,9 @@ def service_result(self, handle, uuid, start, end):
device = self.handle_to_device[handle]
device.service_result(uuid, start, end)

def procedure_completed(self, handle):
print "procedure completed", handle

def main():
QtCore.QCoreApplication.setOrganizationName("productize")
QtCore.QCoreApplication.setOrganizationDomain("productize.be")
Expand Down

0 comments on commit bdd01e5

Please sign in to comment.