sender update

This commit is contained in:
Lucas Oskorep
2020-02-11 16:53:35 -06:00
parent f1d9c04a3e
commit d58229f0a1
+6 -6
View File
@@ -346,7 +346,7 @@ class Wand(object):
print("Subscribing to button notification") print("Subscribing to button notification")
self._button_subscribed = True self._button_subscribed = True
await self._dev.start_notify(IO.USER_BUTTON_CHAR.value, self._on_button) await self._dev.start_notify(IO.USER_BUTTON_CHAR.value, self.handle_notification)
# with self._lock: # with self._lock:
# if not hasattr(self, "_button_handle"): # if not hasattr(self, "_button_handle"):
# handle = self._io_service.getCharacteristics(IO.USER_BUTTON_CHAR.value)[0] # handle = self._io_service.getCharacteristics(IO.USER_BUTTON_CHAR.value)[0]
@@ -591,18 +591,18 @@ class Wand(object):
pass pass
def handleNotification(self, cHandle, data): def handle_notification(self, sender, data):
"""Handle notifications subscribed to """Handle notifications subscribed to
Arguments: Arguments:
cHandle {int} -- Handle of notification cHandle {int} -- Handle of notification
data {bytes} -- Data from device data {bytes} -- Data from device
""" """
if cHandle == SENSOR.QUATERNIONS_CHAR.value: if sender == SENSOR.QUATERNIONS_CHAR.value:
self._on_position(data) self._on_position(data)
elif cHandle == IO.USER_BUTTON_CHAR.value: elif sender == IO.USER_BUTTON_CHAR.value:
self._on_button(data) self._on_button(data)
elif cHandle == SENSOR.TEMP_CHAR.value: elif sender == SENSOR.TEMP_CHAR.value:
self._on_temperature(data) self._on_temperature(data)
elif cHandle == IO.BATTERY_CHAR.value: elif sender == IO.BATTERY_CHAR.value:
self._on_battery(data) self._on_battery(data)