def CreateDevice(self, adapter_path, address, pair, time, _ok, err): # BlueZ 4 only! def ok(device): path = device.get_object_path() _ok(path) self.RefreshServices(path, (lambda *args: None), (lambda *args: None)) if self.Applet.Manager: adapter = Adapter(adapter_path) if pair: agent_path = "/org/blueman/agent/temp/" + address.replace( ":", "") agent = TempAgent(self.Applet.Plugins.StatusIcon, agent_path, time) adapter.create_paired_device(address, agent_path, "DisplayYesNo", error_handler=err, reply_handler=ok, timeout=120) else: adapter.create_device(address, error_handler=err, reply_handler=ok, timeout=120) else: err()
def CreateDevice(self, adapter_path, address, pair, time, _ok, err): # BlueZ 4 only! def ok(device): path = device.get_object_path() _ok(path) self.RefreshServices(path, (lambda *args: None), (lambda *args: None)) if self.Applet.Manager: adapter = Adapter(adapter_path) if pair: agent_path = "/org/blueman/agent/temp/" + address.replace(":", "") agent = TempAgent(self.Applet.Plugins.StatusIcon, agent_path, time) adapter.create_paired_device( address, agent_path, "DisplayYesNo", error_handler=err, reply_handler=ok, timeout=120 ) else: adapter.create_device(address, error_handler=err, reply_handler=ok, timeout=120) else: err()