File tree 1 file changed +18
-15
lines changed
1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -291,21 +291,24 @@ def _connect(self):
291
291
292
292
def work (self ):
293
293
""" runs in a seperate thread """
294
- while self ._running :
295
- if not self ._control .empty ():
296
- control , payload = self ._control .get ()
297
- if control == MSG_CONNECT :
298
- self ._connect ()
299
- elif control == MSG_DISCONNECT :
300
- self .ev_disconnect ()
301
- break
302
- elif control == MSG_SEND :
303
- self ._send_messages .put (payload )
304
- self .ev_enqueue_message ()
305
- if self .state != "disconnected" :
306
- self ._ble_node .waitForNotifications (self .timeout )
307
- else :
308
- time .sleep (0.1 )
294
+ try :
295
+ while self ._running :
296
+ if not self ._control .empty ():
297
+ control , payload = self ._control .get ()
298
+ if control == MSG_CONNECT :
299
+ self ._connect ()
300
+ elif control == MSG_DISCONNECT :
301
+ self .ev_disconnect ()
302
+ break
303
+ elif control == MSG_SEND :
304
+ self ._send_messages .put (payload )
305
+ self .ev_enqueue_message ()
306
+ if self .state != "disconnected" :
307
+ self ._ble_node .waitForNotifications (self .timeout )
308
+ else :
309
+ time .sleep (0.1 )
310
+ except Exception as e :
311
+ self ._error ("Exception occured %s" % e )
309
312
310
313
# user api functions
311
314
def disconnect (self ):
You can’t perform that action at this time.
0 commit comments