mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-09-06 17:50:20 +02:00
BLESession.handle_request: Fix startNotification KeyError
The value 'startNotification' is optional for the "read" request. However, bluepy-scratch-link expects Scratch always set the value in the requests. This may cause KeyError. Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
This commit is contained in:
@@ -512,7 +512,7 @@ class BLESession(Session):
|
||||
self.lock.release()
|
||||
message = base64.standard_b64encode(b).decode('ascii')
|
||||
res['result'] = { 'message': message, 'encode': 'base64' }
|
||||
if params['startNotifications'] == True:
|
||||
if params.get('startNotifications') == True:
|
||||
logger.debug(f"start notification for {chara_id}")
|
||||
service = self.perip.getServiceByUUID(UUID(service_id))
|
||||
chas = service.getCharacteristics(forUUID=chara_id)
|
||||
|
Reference in New Issue
Block a user