def TryToForget(self): global adapter proxy_obj = bus.get_object("org.bluez", self._Path) dev = dbus.Interface(proxy_obj, "org.bluez.Device1") self._Screen._MsgBox.SetText("Forgeting...") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() try: adapter.RemoveDevice(dev) except Exception,e: print(str(e))
def pair_error(self, error): global adapter err_msg = "" err_name = error.get_dbus_name() print(err_name) if err_name == "org.freedesktop.DBus.Error.NoReply" and self.device_obj: err_msg = "Timed out. Cancelling pairing" print(err_msg) self.device_obj.CancelPairing() elif err_name == "org.bluez.Error.AuthenticationCanceled": err_msg = "Authentication Canceled" elif err_name == "org.bluez.Error.ConnectionAttemptFailed": err_msg = "Page Timeout" elif err_name == "org.bluez.Error.AlreadyExists": err_msg = "Already Exists" try: adapter.RemoveDevice(self.device_obj) except Exception, e: print("pair_error forget err:", str(e))
def TryToForget(self): global adapter proxy_obj = bus.get_object("org.bluez", self._Path) dev = dbus.Interface(proxy_obj, "org.bluez.Device1") self._Screen._MsgBox.SetText("Forgeting") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow() try: adapter.RemoveDevice(dev) except Exception, e: err_name = e.get_dbus_name() if err_name == "org.freedesktop.DBus.Error.NoReply": self._Screen._MsgBox.SetText("DBus noreply") else: self._Screen._MsgBox.SetText("Forget failed") self._Screen._MsgBox.Draw() self._Screen.SwapAndShow()