def __enter__(self):
self._log.debug("Choosing the first available Bluetooth adapter and "
"starting device discovery.")
self._log.debug("The discovery filter is set to Bluetooth LE only.")
try:
self.adapter = find_adapter()
self.adapter.SetDiscoveryFilter({"Transport": pydbus.Variant("s", "le")})
self.adapter.StartDiscovery()
except GLib.Error as ex:
self._log.exception("Is the bluetooth controller powered on? "
"Use `bluetoothctl`, `power on` otherwise.")
raise ex
return self
评论列表
文章目录