mirror of https://github.com/labapart/gattlib
gattlib-py/device: Add support to unregister GATT notification
parent
59820e2cad
commit
20f2d5facf
|
@ -222,6 +222,9 @@ class Device:
|
|||
|
||||
self._gatt_characteristic_callbacks[gatt_characteristic.short_uuid] = { 'callback': callback, 'user_data': user_data }
|
||||
|
||||
def _notification_remove_gatt_characteristic_callback(self, gatt_characteristic):
|
||||
self._gatt_characteristic_callbacks[gatt_characteristic.short_uuid] = None
|
||||
|
||||
def __str__(self):
|
||||
name = self._name
|
||||
if name:
|
||||
|
|
|
@ -115,6 +115,9 @@ class GattCharacteristic():
|
|||
def register_notification(self, callback, user_data=None):
|
||||
self._device._notification_add_gatt_characteristic_callback(self, callback, user_data)
|
||||
|
||||
def unregister_notification(self):
|
||||
self._device._notification_remove_gatt_characteristic_callback(self)
|
||||
|
||||
def notification_start(self):
|
||||
ret = gattlib_notification_start(self.connection, self._gattlib_characteristic.uuid)
|
||||
handle_return(ret)
|
||||
|
|
Loading…
Reference in New Issue