def trust(self, address):
try:
device = bluezutils.find_device(address)
except (bluezutils.BluezUtilError,
dbus.exceptions.DBusException) as error:
print_error(str(error) + "\n")
return False
try:
props = dbus.Interface(
self._bus.get_object("org.bluez", device.object_path),
"org.freedesktop.DBus.Properties")
if not props.Get("org.bluez.Device1", "Trusted"):
props.Set("org.bluez.Device1", "Trusted", dbus.Boolean(1))
except dbus.exceptions.DBusException as error:
print_error(str(error) + "\n")
return False
return True
评论列表
文章目录