Пример #1
0
 def testCreateInvalidType(self):
     try:
         protocol.create("InvalidType",
                         protocol.MSG_TARGET_SYSTEM,
                         protocol.MSG_NAME_GET, parameter=True)
     except protocol.UnsupportedMessageError, err:
         pass
Пример #2
0
 def testCreateInvalidName(self):
     try:
         protocol.create(protocol.MSG_TYPE_REQUEST,
                         protocol.MSG_TARGET_SYSTEM,
                         "InvalidName", parameter=True)
     except protocol.UnsupportedMessageError, err:
         pass
Пример #3
0
 def testCreateInvalidTarget(self):
     try:
         protocol.create(protocol.MSG_TYPE_REQUEST,
                         "InvalidTarget",
                         protocol.MSG_NAME_GET, parameter=True)
     except protocol.UnsupportedMessageError, err:
         pass
Пример #4
0
 def testCreateInvalidTarget(self):
     try:
         protocol.create(protocol.MSG_TYPE_REQUEST,
                         "InvalidTarget",
                         protocol.MSG_NAME_GET,
                         parameter=True)
     except protocol.UnsupportedMessageError, err:
         pass
Пример #5
0
 def testCreateInvalidName(self):
     try:
         protocol.create(protocol.MSG_TYPE_REQUEST,
                         protocol.MSG_TARGET_SYSTEM,
                         "InvalidName",
                         parameter=True)
     except protocol.UnsupportedMessageError, err:
         pass
Пример #6
0
 def testCreateInvalidType(self):
     try:
         protocol.create("InvalidType",
                         protocol.MSG_TARGET_SYSTEM,
                         protocol.MSG_NAME_GET,
                         parameter=True)
     except protocol.UnsupportedMessageError, err:
         pass
Пример #7
0
 def testCreateInvalidParameter(self):
     try:
         protocol.create(protocol.MSG_TYPE_REQUEST,
                         protocol.MSG_TARGET_SYSTEM,
                         protocol.MSG_NAME_GET, parameter=True)
     except protocol.UnsupportedMessageError:
         pass
     except:
         self.failIf(True)
     else:
         self.failIf(True)
Пример #8
0
 def testCreateInvalidParameter(self):
     try:
         protocol.create(protocol.MSG_TYPE_REQUEST,
                         protocol.MSG_TARGET_SYSTEM,
                         protocol.MSG_NAME_GET,
                         parameter=True)
     except protocol.UnsupportedMessageError:
         pass
     except:
         self.failIf(True)
     else:
         self.failIf(True)
Пример #9
0
    def __init__(self, conf=None):
        '''
        Initializes daemon by starting and configuring a server.

        :param conf: A path to a daemon configuration file
        :type conf: string
        '''
        if conf is not None:
            if os.path.isfile(conf):
                config.update('daemon', conf)
            else:
                log.warning("Configuration file %s does not exist."
                            " Skipped" % conf)
        port = config.getInt('daemon', 'connection', 'port')
        ip = config.get('daemon', 'connection', 'address')
        if ip is None:
            log.warning("No attribute IP in daemon configuration file. "
                        "Using default value %s" % DEFAULT_IP)
            config.set('daemon', 'connection', 'address', DEFAULT_IP)
            ip = DEFAULT_IP
        if port is None:
            log.warning("No attribute port in daemon configuration file. "
                        "Using default value %d" % DEFAULT_PORT)
            config.set('daemon', 'connection', 'port', DEFAULT_PORT)
            port = DEFAULT_PORT
        server.Server.__init__(self, (ip, port))
        info = protocol.create(protocol.MSG_TYPE_RESPONSE,
                               protocol.MSG_TARGET_SYSTEM,
                               protocol.MSG_NAME_INFO,
                               version=config.VERSION,
                               locale=(locale.getdefaultlocale()[0] or ''),
                               extensions=protocol.getExtensions(),
                               status=True)
        self._infoData = info.marshal()
Пример #10
0
 def testPutSysResponse(self):
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_PUT, status=False)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     self.failUnlessEqual(res.status, False)
Пример #11
0
 def testExecA11yResponse(self):
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, status=False)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     self.failUnlessEqual(res.status, False)
Пример #12
0
 def testPutSysResponse(self):
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_PUT,
                           status=False)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     self.failUnlessEqual(res.status, False)
Пример #13
0
 def testExecA11yResponse(self):
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC,
                           status=False)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     self.failUnlessEqual(res.status, False)
Пример #14
0
 def testGetSysResponse(self):
     params = {"data": u"TestData", "status": True}
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_GET, **params)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     for name in params:
         self.failUnlessEqual(getattr(res, name), params[name])
Пример #15
0
 def testExecActionA11yRequest(self):
     params = {"path": Path(0, 1, 2, 3), "action": u"TestAction"}
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #16
0
 def testExecSysRequest(self):
     params = {"command": u"TestCommand", "wait": True}
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #17
0
 def testPutSysRequest(self):
     params = {"path": u"TestPath", "data": u"TestData"}
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_PUT, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #18
0
 def testSearchA11yResponse(self):
     accessible = Accessible(Path(0, 1, 2, 3))
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_SEARCH,
                           accessible=accessible, status=True)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     self.failUnlessEqual(res.accessible.path, accessible.path)
     self.failUnlessEqual(res.status, True)
Пример #19
0
class DeviceDaemon(server.Server):
    _info = protocol.create(protocol.MSG_TYPE_RESPONSE,
                            protocol.MSG_TARGET_SYSTEM,
                            protocol.MSG_NAME_INFO,
                            version=config.VERSION,
                            locale='',
                            extensions=(),
                            status=True).marshal()

    def handle_accept(self):
        handler = server.Server.handle_accept(self)
        handler.push(''.join([self._info, handler.get_terminator()]))
Пример #20
0
 def testGetSysRequest(self):
     params = {
         "path": u"TestPath"
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_GET, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #21
0
 def testSearchA11yResponse(self):
     accessible = Accessible(Path(0, 1, 2, 3))
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_SEARCH,
                           accessible=accessible,
                           status=True)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     self.failUnlessEqual(res.accessible.path, accessible.path)
     self.failUnlessEqual(res.status, True)
Пример #22
0
 def testGetSysResponse(self):
     params = {
         "data": u"TestData",
         "status": True
     }
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_GET, **params)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     for name in params:
         self.failUnlessEqual(getattr(res, name), params[name])
Пример #23
0
 def testExecSysRequest(self):
     params = {
         "command": u"TestCommand",
         "wait": True
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #24
0
 def testExecActionA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "action": u"TestAction"
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #25
0
 def testExecKeyboardA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "keycode": 123,
         "modifiers": (234, 345, 456)
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #26
0
 def testGetA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "depth": 3,
         "include": (u"name", u"role", u"count", u"text")
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_GET, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #27
0
 def testExecKeyboardA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "keycode": 123,
         "modifiers": (234, 345, 456)
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #28
0
 def testGetA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "depth": 3,
         "include": (u"name", u"role", u"count", u"text")
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_GET, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #29
0
 def testInfoSysResponse(self):
     params = {
         "version": u"TestVersion",
         "locale": u"TestLocale",
         "extensions": (u"TestExtension1", u"TestExtension2"),
         "status": True
     }
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_INFO, **params)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     for name in params:
         self.failUnlessEqual(getattr(res, name), params[name])
Пример #30
0
 def testInfoSysResponse(self):
     params = {
         "version": u"TestVersion",
         "locale": u"TestLocale",
         "extensions": (u"TestExtension1", u"TestExtension2"),
         "status": True
     }
     res = protocol.create(protocol.MSG_TYPE_RESPONSE,
                           protocol.MSG_TARGET_SYSTEM,
                           protocol.MSG_NAME_INFO, **params)
     self.failUnless(isinstance(res, message.Response))
     cls = type(res)
     res = protocol.parse(res.marshal())
     self.failUnless(isinstance(res, cls))
     for name in params:
         self.failUnlessEqual(getattr(res, name), params[name])
Пример #31
0
 def testExecMouseA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "button": u"TestButton",
         "event": u"TestEvent",
         "coordinates": (1024, 800)
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #32
0
 def testExecMouseA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "button": u"TestButton",
         "event": u"TestEvent",
         "coordinates": (1024, 800)
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_EXEC, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #33
0
 def testSearchA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "method": protocol.MHD_SEARCH_SIMPLE,
         "predicates": {
             "name": u"TestName",
             "role": u"TestRole",
             "count": 3,
             "text": u"TestText"
         }
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_SEARCH, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #34
0
 def testSearchA11yRequest(self):
     params = {
         "path": Path(0, 1, 2, 3),
         "method": protocol.MHD_SEARCH_SIMPLE,
         "predicates": {
                         "name": u"TestName",
                         "role": u"TestRole",
                         "count": 3,
                         "text": u"TestText"
         }
     }
     req = protocol.create(protocol.MSG_TYPE_REQUEST,
                           protocol.MSG_TARGET_ACCESSIBILITY,
                           protocol.MSG_NAME_SEARCH, **params)
     self.failUnless(isinstance(req, message.Request))
     cls = type(req)
     req = protocol.parse(req.marshal())
     self.failUnless(isinstance(req, cls))
     for name in params:
         self.failUnlessEqual(getattr(req, name), params[name])
Пример #35
0
    def request(self, target, name, params):
        '''
        Sends the given request of the specified parameters concerning
        the given accessible path.

        :param target: A name of the request target
        :type target: string
        :param name: A name of the request function
        :type name: string
        :param params: A dictionary with the request parameters
        :type params: dictionary
        :return: Id of the sent request
        :rtype: integer
        '''
        if not self.isConnected():
            raise ConnectionError("Device is not connected")
        request = protocol.create(protocol.MSG_TYPE_REQUEST, target, name,
                                  **params)
        self.client.request(request)
        return request.id
Пример #36
0
    def request(self, target, name, params):
        '''
        Sends the given request of the specified parameters concerning
        the given accessible path.

        :param target: A name of the request target
        :type target: string
        :param name: A name of the request function
        :type name: string
        :param params: A dictionary with the request parameters
        :type params: dictionary
        :return: Id of the sent request
        :rtype: integer
        '''
        if not self.isConnected():
            raise ConnectionError("Device is not connected")
        request = protocol.create(protocol.MSG_TYPE_REQUEST,
                                  target, name, **params)
        self.client.request(request) 
        return request.id
Пример #37
0
 def __call__(self, request):
     '''
     Processes the given request.
     '''
     log.debug(locals())
     extras = {"status": False}
     if request.target == protocol.MSG_TARGET_ACCESSIBILITY:
         if request.name == protocol.MSG_NAME_GET:
             params = {}
             for param in request.include:
                 params[str(param)] = True
             status, accessible = accessibilityGet(self, request.path,
                                                   request.depth, **params)
             extras = {"status": status, "accessible": accessible}
         elif request.name == protocol.MSG_NAME_SEARCH:
             status, accessible = accessibilitySearch(
                 self, request.path, request.method, **request.predicates)
             extras = {"status": status, "accessible": accessible}
         elif request.name == protocol.MSG_NAME_PUT:
             if hasattr(request, 'text'):
                 status = accessibilityPutText(self, request.path,
                                               request.text)
             elif hasattr(request, 'value'):
                 status = accessibilityPutValue(self, request.path,
                                                request.value)
             else:
                 raise protocol.UnsupportedMessageError(
                     request.type, request.target, request.name,
                     *request.getParams())
             extras = {"status": status}
         elif request.name == protocol.MSG_NAME_EXEC:
             if hasattr(request, 'action'):
                 status = accessibilityExecAction(self, request.path,
                                                  request.action)
             elif (hasattr(request, 'keycode')
                   and hasattr(request, 'modifiers')):
                 status = accessibilityExecKeyboard(self, request.path,
                                                    request.keycode,
                                                    request.modifiers)
             elif (hasattr(request, 'event') and hasattr(request, 'button')
                   and hasattr(request, 'coordinates')):
                 status = accessibilityExecMouse(self, request.path,
                                                 request.event,
                                                 request.button,
                                                 request.coordinates)
             else:
                 raise protocol.UnsupportedMessageError(
                     request.type, request.target, request.name,
                     *request.getParams())
             extras = {"status": status}
         else:
             raise protocol.UnsupportedMessageError(request.type,
                                                    request.target,
                                                    request.name,
                                                    *request.getParams())
     elif request.target == protocol.MSG_TARGET_SYSTEM:
         if request.name == protocol.MSG_NAME_GET:
             status, data = systemGet(self, request.path)
             extras = {"status": status, "data": data}
         elif request.name == protocol.MSG_NAME_PUT:
             status = systemPut(self, request.path, request.data)
             extras = {"status": status}
         elif request.name == protocol.MSG_NAME_EXEC:
             status, stdout, stderr = systemExec(self, request.command,
                                                 request.wait)
             extras = {"status": status, "stdout": stdout, "stderr": stderr}
         else:
             raise protocol.UnsupportedMessageError(request.type,
                                                    request.target,
                                                    request.name,
                                                    *request.getParams())
     elif request.target == protocol.MSG_TARGET_EXTENSION:
         params = {}
         for name in request.getParams():
             params[name] = getattr(request, name)
         try:
             ext = protocol.getExtension(request.name)
         except:
             protocol.UnsupportedMessageError(request.type, request.target,
                                              request.name,
                                              *request.getParams())
         status, extras = ext.response(**params)
         extras["status"] = status
     else:
         raise protocol.UnsupportedMessageError(request.type,
                                                request.target,
                                                request.name,
                                                *request.getParams())
     return protocol.create(protocol.MSG_TYPE_RESPONSE, request.target,
                            request.name, **extras)
Пример #38
0
                    "status": False,
                    "data": ''
                }
            elif request.name == protocol.MSG_NAME_PUT:
                extras = {
                    "status": False
                }
            elif request.name == protocol.MSG_NAME_EXEC:
                extras = {
                    "status": False,
                    "stdout": '',
                    "stderr": ''
                }
        if extras:
            response = protocol.create(protocol.MSG_TYPE_RESPONSE,
                                       request.target, request.name,
                                       **extras)
        else:
            response = protocol.DefaultResponse(request.target,
                                                request.name,
                                                status=False)
        response.id = request.id
        self.messages.put(response)

    def response(self, id, timeout=None):
        '''
        Subsequent calls of this method return queued responses of the given ID
        in order of reception.

        :param id: ID of the response to get
        :type id: integer
Пример #39
0
            elif request.name == protocol.MSG_NAME_SEARCH:
                acc = getAccessible(request.path)
                # TODO: Currently not used
            elif request.name == protocol.MSG_NAME_PUT:
                extras = {"status": False}
            elif request.name == protocol.MSG_NAME_EXEC:
                extras = {"status": False}
        elif request.target == protocol.MSG_TARGET_SYSTEM:
            if request.name == protocol.MSG_NAME_GET:
                extras = {"status": False, "data": ''}
            elif request.name == protocol.MSG_NAME_PUT:
                extras = {"status": False}
            elif request.name == protocol.MSG_NAME_EXEC:
                extras = {"status": False, "stdout": '', "stderr": ''}
        if extras:
            response = protocol.create(protocol.MSG_TYPE_RESPONSE,
                                       request.target, request.name, **extras)
        else:
            response = protocol.DefaultResponse(request.target,
                                                request.name,
                                                status=False)
        response.id = request.id
        self.messages.put(response)

    def response(self, id, timeout=None):
        '''
        Subsequent calls of this method return queued responses of the given ID
        in order of reception.

        :param id: ID of the response to get
        :type id: integer
        :return: A fist response from the message queue
Пример #40
0
 def __call__(self, request):
     '''
     Processes the given request.
     '''
     log.debug(locals())
     extras = {
         "status": False
     }
     if request.target == protocol.MSG_TARGET_ACCESSIBILITY:
         if request.name == protocol.MSG_NAME_GET:
             params = {}
             for param in request.include:
                 params[str(param)] = True
             status, accessible = accessibilityGet(self, request.path,
                                                   request.depth,
                                                   **params)
             extras = {
                 "status": status,
                 "accessible": accessible
             }
         elif request.name == protocol.MSG_NAME_SEARCH:
             status, accessible = accessibilitySearch(self, request.path,
                                                      request.method,
                                                      **request.predicates)
             extras = {
                 "status": status,
                 "accessible": accessible
             }
         elif request.name == protocol.MSG_NAME_PUT:
             if hasattr(request, 'text'):
                 status = accessibilityPutText(self, request.path,
                                               request.text)
             elif hasattr(request, 'value'):
                 status = accessibilityPutValue(self, request.path,
                                                request.value)
             else:
                 raise protocol.UnsupportedMessageError(request.type,
                                                     request.target,
                                                     request.name,
                                                     *request.getParams())
             extras = {
                 "status": status
             }
         elif request.name == protocol.MSG_NAME_EXEC:
             if hasattr(request, 'action'):
                 status = accessibilityExecAction(self, request.path,
                                                  request.action)
             elif (hasattr(request, 'keycode') and
                   hasattr(request, 'modifiers')):
                 status = accessibilityExecKeyboard(self, request.path,
                                                    request.keycode,
                                                    request.modifiers)
             elif (hasattr(request, 'event') and
                   hasattr(request, 'button') and
                   hasattr(request, 'coordinates')):
                 status = accessibilityExecMouse(self, request.path,
                                                 request.event,
                                                 request.button,
                                                 request.coordinates)
             else:
                 raise protocol.UnsupportedMessageError(request.type,
                                                     request.target,
                                                     request.name,
                                                     *request.getParams())
             extras = {
                 "status": status
             }
         else:
             raise protocol.UnsupportedMessageError(request.type,
                                                    request.target,
                                                    request.name,
                                                    *request.getParams())
     elif request.target == protocol.MSG_TARGET_SYSTEM:
         if request.name == protocol.MSG_NAME_GET:
             status, data = systemGet(self, request.path)
             extras = {
                 "status": status,
                 "data": data
             }
         elif request.name == protocol.MSG_NAME_PUT:
             status = systemPut(self, request.path, request.data)
             extras = {
                 "status": status
             }
         elif request.name == protocol.MSG_NAME_EXEC:
             status, stdout, stderr = systemExec(self, request.command,
                                                 request.wait)
             extras = {
                 "status": status,
                 "stdout": stdout,
                 "stderr": stderr
             }
         else:
             raise protocol.UnsupportedMessageError(request.type,
                                                    request.target,
                                                    request.name,
                                                    *request.getParams())
     elif request.target == protocol.MSG_TARGET_EXTENSION:
         params = {}
         for name in request.getParams():
             params[name] = getattr(request, name)
         try:
             ext = protocol.getExtension(request.name)
         except:
             protocol.UnsupportedMessageError(request.type,
                                              request.target,
                                              request.name,
                                              *request.getParams())
         status, extras = ext.response(**params)
         extras["status"] = status
     else:
         raise protocol.UnsupportedMessageError(request.type,
                                                request.target,
                                                request.name,
                                                *request.getParams())
     return protocol.create(protocol.MSG_TYPE_RESPONSE, request.target,
                            request.name, **extras)