def read_value(self, offset=0):
"""
Reads the value of this characteristic.
When successful, `characteristic_value_updated()` of the related device will be called,
otherwise `characteristic_read_value_failed()` is invoked.
"""
try:
return self._object.ReadValue(
{'offset': dbus.UInt16(offset, variant_level=1)},
dbus_interface='org.bluez.GattCharacteristic1')
except dbus.exceptions.DBusException as e:
error = _error_from_dbus_error(e)
self.service.device.characteristic_read_value_failed(self, error=error)
评论列表
文章目录