示例#1
0
    def capability(self):

    

        """capability(self)

        

        Returns a capability object from the server, or the server's response

        if the operation was unsuccessful.

        """

        

        response = self.get(header_list=[headers.Type("x-obex/capability")])

        if not isinstance(response, responses.Success):

            return response

        header, data = response

        return data
示例#2
0
    def listdir(self, name=""):
        """listdir(self, name = "")
        
        Requests information about the contents of the directory with the
        specified name relative to the current directory for the session.
        Returns a tuple containing the server's response and the associated
        data.
        
        If successful, the directory contents are returned in the form of
        an XML document as described by the x-obex/folder-listing MIME type.
        
        If the name is omitted or an empty string is supplied, the contents
        of the current directory are typically listed by the server.
        """

        return self.get(
            name, header_list=[headers.Type("x-obex/folder-listing", False)])
示例#3
0
    def mobex_cmd(self, typ, name=None, extra_headers=()):

        header_list = [

            headers.Type(typ),

        ]

        if name is not None:

            header_list.append(headers.Name(name))

        header_list += extra_headers

        

        max_length = self.remote_info.max_packet_length

        request = requests.Put_Final()

        

        return self._send_headers(request, header_list, max_length)