コード例 #1
0
ファイル: DBusService.py プロジェクト: worldofpeace/blueman
    def _disconnect_service(self, object_path, uuid, port, ok, err):
        if uuid == '00000000-0000-0000-0000-000000000000':
            device = Device(object_path)
            device.disconnect(reply_handler=ok, error_handler=err)
        else:

            def cb(_inst, ret):
                if ret:
                    raise StopException

            service = get_service(Device(object_path), uuid)

            if service.group == 'serial' and 'NMDUNSupport' in self.parent.Plugins.get_loaded(
            ):
                self.parent.Plugins.run_ex("service_disconnect_handler", cb,
                                           service, ok, err)
            elif service.group == 'serial' and 'PPPSupport' in self.parent.Plugins.get_loaded(
            ):
                service.disconnect(port, reply_handler=ok, error_handler=err)

                self.parent.Plugins.run("on_rfcomm_disconnect", port)

                logging.info("Disconnecting rfcomm device")
            else:
                if not self.parent.Plugins.run_ex("service_disconnect_handler",
                                                  cb, service, ok, err):
                    service.disconnect(reply_handler=ok, error_handler=err)
コード例 #2
0
ファイル: DBusService.py プロジェクト: Vinigas/blueman
    def _disconnect_service(
        self, object_path: str, uuid: str, port: int, ok: Callable[[], None],
        err: Callable[
            [Union[BluezDBusException, NMConnectionError, GLib.Error,
                   str]], None]
    ) -> None:
        if uuid == '00000000-0000-0000-0000-000000000000':
            device = Device(obj_path=object_path)
            device.disconnect(reply_handler=ok, error_handler=err)
        else:

            def cb(_inst, ret):
                if ret:
                    raise StopException

            service = get_service(Device(obj_path=object_path), uuid)
            assert service is not None

            if isinstance(
                    service, SerialService
            ) and 'NMDUNSupport' in self.parent.Plugins.get_loaded():
                self.parent.Plugins.run_ex("service_disconnect_handler", cb,
                                           service, ok, err)
            elif isinstance(
                    service, SerialService
            ) and 'PPPSupport' in self.parent.Plugins.get_loaded():
                service.disconnect(port, reply_handler=ok, error_handler=err)

                self.parent.Plugins.run("on_rfcomm_disconnect", port)

                logging.info("Disconnecting rfcomm device")
            else:
                if not self.parent.Plugins.run_ex("service_disconnect_handler", cb, service, ok, err) \
                        and isinstance(service, NetworkService):
                    service.disconnect(reply_handler=ok, error_handler=err)
コード例 #3
0
ファイル: DBusService.py プロジェクト: wtuemura/blueman
    def _disconnect_service(
        self, object_path: str, uuid: str, port: int, ok: Callable[[], None],
        err: Callable[
            [Union[BluezDBusException, "NMConnectionError", GLib.Error,
                   str]], None]
    ) -> None:
        if uuid == '00000000-0000-0000-0000-000000000000':
            device = Device(obj_path=object_path)
            device.disconnect(reply_handler=ok, error_handler=err)
        else:
            service = get_service(Device(obj_path=object_path), uuid)
            assert service is not None

            if any(
                    plugin.service_disconnect_handler(service, ok, err)
                    for plugin in self.parent.Plugins.get_loaded_plugins(
                        ServiceConnectHandler)):
                pass
            elif isinstance(service, SerialService):
                service.disconnect(port, reply_handler=ok, error_handler=err)

                for plugin in self.parent.Plugins.get_loaded_plugins(
                        RFCOMMConnectedListener):
                    plugin.on_rfcomm_disconnect(port)

                logging.info("Disconnecting rfcomm device")
            elif isinstance(service, NetworkService):
                service.disconnect(reply_handler=ok, error_handler=err)
コード例 #4
0
ファイル: DBusService.py プロジェクト: cschramm/blueman
    def disconnect_service(self, object_path, uuid, port, ok, err):
        if uuid == '00000000-0000-0000-0000-000000000000':
            device = Device(object_path)
            device.disconnect(reply_handler=ok, error_handler=err)
        else:
            service = get_service(Device(object_path), uuid)

            if service.group == 'serial':
                service.disconnect(port)

                self.Applet.Plugins.Run("on_rfcomm_disconnect", port)

                logging.info("Disonnecting rfcomm device")
            else:

                def cb(_inst, ret):
                    if ret:
                        raise StopException

                if not self.Applet.Plugins.RunEx("service_disconnect_handler", cb, service, ok, err):
                    service.disconnect(reply_handler=ok, error_handler=err)
コード例 #5
0
    def disconnect_service(self, object_path, uuid, port, ok, err):
        if uuid == '00000000-0000-0000-0000-000000000000':
            device = Device(object_path)
            device.disconnect(reply_handler=ok, error_handler=err)
        else:
            service = get_service(Device(object_path), uuid)

            if service.group == 'serial':
                service.disconnect(port)

                self.Applet.Plugins.Run("on_rfcomm_disconnect", port)

                logging.info("Disonnecting rfcomm device")
            else:

                def cb(_inst, ret):
                    if ret:
                        raise StopException

                if not self.Applet.Plugins.RunEx("service_disconnect_handler", cb, service, ok, err):
                    service.disconnect(reply_handler=ok, error_handler=err)