mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-09-04 16:50:11 +02:00
BLESession: Override unknown handle with known handle
Unknown handle "13" was recorded in debug log for the Git Hub issue #26. As a debug trial, replace the unknown handle with the known handle. Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
This commit is contained in:
@@ -424,8 +424,13 @@ class BLESession(Session):
|
||||
def handleNotification(self, handle, data):
|
||||
logger.debug(f"BLE notification: {handle} {data}")
|
||||
if handle not in self.handles:
|
||||
logger.error(f"Notification with unknown {handle}")
|
||||
return
|
||||
logger.error(f"Notification with unknown handle: {handle}")
|
||||
keys = list(self.handles.keys())
|
||||
if keys and len(keys) == 1:
|
||||
logger.debug(f"Debug: override {handle} with {keys[0]}")
|
||||
handle = keys[0]
|
||||
else:
|
||||
return
|
||||
params = self.handles[handle].copy()
|
||||
params['message'] = base64.standard_b64encode(data).decode('ascii')
|
||||
self.session.notify('characteristicDidChange', params)
|
||||
|
Reference in New Issue
Block a user