Ejemplo n.º 1
0
    def pull_vcard_listing(self,
                           name,
                           order=0,
                           search_value=None,
                           search_attribute="N",
                           max_list_count=65535,
                           list_startoffset=0):
        """Retrieves phonebook listing object from current folder"""
        logger.info("Requesting pull_vcard_listing with parameters %s",
                    str(locals()))
        data = {
            "Order": headers.Order(order),
            "MaxListCount": headers.MaxListCount(max_list_count),
            "ListStartOffset": headers.ListStartOffset(list_startoffset)
        }
        if search_value is not None and search_attribute is not None:
            data.update({
                "SearchValue":
                headers.SearchValue(search_value),
                "SearchAttribute":
                headers.SearchAttribute(search_attribute),
            })
        application_parameters = headers.App_Parameters(data, encoded=False)
        header_list = [headers.Type("x-bt/vcard-listing")]
        if application_parameters.data:
            header_list.append(application_parameters)

        response = self.get(name, header_list)
        if not isinstance(response, tuple) and isinstance(
                response, responses.FailureResponse):
            logger.error(
                "pull_vcard_listing failed for pbobject '%s'. reason = %s",
                name, response)
            return
        return response
Ejemplo n.º 2
0
    def pull_phonebook(self,
                       name,
                       filter_=0,
                       format_=0,
                       max_list_count=65535,
                       list_startoffset=0):
        """Retrieves entire phonebook object from current folder"""
        logger.info(
            "Requesting pull_phonebook for pbobject '%s' with appl parameters %s",
            name, str(locals()))
        data = {
            "Filter": headers.Filter(filter_),
            "Format": headers.Format(format_),
            "MaxListCount": headers.MaxListCount(max_list_count),
            "ListStartOffset": headers.ListStartOffset(list_startoffset)
        }
        application_parameters = headers.App_Parameters(data, encoded=False)
        header_list = [headers.Type("x-bt/phonebook")]
        if application_parameters.data:
            header_list.append(application_parameters)

        response = self.get(name, header_list)
        if not isinstance(response, tuple) and isinstance(
                response, responses.FailureResponse):
            logger.error(
                "pull_phonebook failed for pbobject '%s'. reason = %s", name,
                response)
            return
        return response
Ejemplo n.º 3
0
    def pull_vcard_entry(self, name, filter_=0, format_=0):
        """Retrieves specific vcard from pbap server"""
        logger.info(
            "Requesting pull_vcard_entry for pbobject with parameters %s",
            str(locals()))
        data = {
            "Filter": headers.Filter(filter_),
            "Format": headers.Format(format_)
        }

        application_parameters = headers.App_Parameters(data, encoded=False)
        header_list = [headers.Type("x-bt/vcard")]
        if application_parameters.data:
            header_list.append(application_parameters)

        response = self.get(name, header_list)
        if not isinstance(response, tuple) and isinstance(
                response, responses.FailureResponse):
            logger.error(
                "pull_vcard_entry failed for pbobject '%s'. reason = %s", name,
                response)
            return
        return response