def _find_adapter(self):
"""
Tries to find a bluetooth adapter with the required functions.
:return: path to an adapter or None
"""
required_interfaces = [GATT_MANAGER_IFACE, LE_ADVERTISING_MANAGER_IFACE]
object_manager = dbus.Interface(self.bus.get_object(BLUEZ_SERVICE_NAME, '/'), DBUS_OM_IFACE)
objects = object_manager.GetManagedObjects()
for object_path, properties in objects.items():
missing_interfaces = [i for i in required_interfaces if i not in properties.keys()]
if missing_interfaces:
continue
return object_path.rsplit('/', 1)[1]
return None
评论列表
文章目录