1f1b34e8dSMatthias Ringwald /* 2f1b34e8dSMatthias Ringwald * Copyright (C) 2014 BlueKitchen GmbH 3f1b34e8dSMatthias Ringwald * 4f1b34e8dSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 5f1b34e8dSMatthias Ringwald * modification, are permitted provided that the following conditions 6f1b34e8dSMatthias Ringwald * are met: 7f1b34e8dSMatthias Ringwald * 8f1b34e8dSMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 9f1b34e8dSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 10f1b34e8dSMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 11f1b34e8dSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 12f1b34e8dSMatthias Ringwald * documentation and/or other materials provided with the distribution. 13f1b34e8dSMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 14f1b34e8dSMatthias Ringwald * contributors may be used to endorse or promote products derived 15f1b34e8dSMatthias Ringwald * from this software without specific prior written permission. 16f1b34e8dSMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 17f1b34e8dSMatthias Ringwald * personal benefit and not for any commercial purpose or for 18f1b34e8dSMatthias Ringwald * monetary gain. 19f1b34e8dSMatthias Ringwald * 20f1b34e8dSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21f1b34e8dSMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22f1b34e8dSMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 232fca4dadSMilanka Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 242fca4dadSMilanka Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25f1b34e8dSMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26f1b34e8dSMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27f1b34e8dSMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28f1b34e8dSMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29f1b34e8dSMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30f1b34e8dSMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31f1b34e8dSMatthias Ringwald * SUCH DAMAGE. 32f1b34e8dSMatthias Ringwald * 33f1b34e8dSMatthias Ringwald * Please inquire about commercial licensing options at 34f1b34e8dSMatthias Ringwald * [email protected] 35f1b34e8dSMatthias Ringwald * 36f1b34e8dSMatthias Ringwald */ 37f1b34e8dSMatthias Ringwald 38fe5a6c4eSMilanka Ringwald /** 39fe5a6c4eSMilanka Ringwald * @title PBAP Client 40fe5a6c4eSMilanka Ringwald * 41fe5a6c4eSMilanka Ringwald */ 42fe5a6c4eSMilanka Ringwald 4380e33422SMatthias Ringwald #ifndef PBAP_CLIENT_H 4480e33422SMatthias Ringwald #define PBAP_CLIENT_H 45f1b34e8dSMatthias Ringwald 46f1b34e8dSMatthias Ringwald #if defined __cplusplus 47f1b34e8dSMatthias Ringwald extern "C" { 48f1b34e8dSMatthias Ringwald #endif 49f1b34e8dSMatthias Ringwald 50f1b34e8dSMatthias Ringwald #include "btstack_config.h" 510e7551b0SMatthias Ringwald #include "yxml.h" 52f1b34e8dSMatthias Ringwald #include <stdint.h> 53f1b34e8dSMatthias Ringwald 5483f1bca0SMatthias Ringwald // max len of phone number used for lookup in pbap_lookup_by_number 5583f1bca0SMatthias Ringwald #define PBAP_MAX_PHONE_NUMBER_LEN 32 5683f1bca0SMatthias Ringwald 5783f1bca0SMatthias Ringwald // max len of name reported in PBAP_SUBEVENT_CARD_RESULT 5883f1bca0SMatthias Ringwald #define PBAP_MAX_NAME_LEN 32 5983f1bca0SMatthias Ringwald // max len of vcard handle reported in PBAP_SUBEVENT_CARD_RESULT 6083f1bca0SMatthias Ringwald #define PBAP_MAX_HANDLE_LEN 16 6183f1bca0SMatthias Ringwald 620e7551b0SMatthias Ringwald 630e7551b0SMatthias Ringwald typedef enum { 640e7551b0SMatthias Ringwald PBAP_CLIENT_INIT = 0, 650e7551b0SMatthias Ringwald PBAP_CLIENT_W4_GOEP_CONNECTION, 660e7551b0SMatthias Ringwald PBAP_CLIENT_W2_SEND_CONNECT_REQUEST, 670e7551b0SMatthias Ringwald PBAP_CLIENT_W4_CONNECT_RESPONSE, 680e7551b0SMatthias Ringwald PBAP_CLIENT_W4_USER_AUTHENTICATION, 690e7551b0SMatthias Ringwald PBAP_CLIENT_W2_SEND_AUTHENTICATED_CONNECT, 700e7551b0SMatthias Ringwald PBAP_CLIENT_CONNECTED, 710e7551b0SMatthias Ringwald // 720e7551b0SMatthias Ringwald PBAP_CLIENT_W2_SEND_DISCONNECT_REQUEST, 730e7551b0SMatthias Ringwald PBAP_CLIENT_W4_DISCONNECT_RESPONSE, 740e7551b0SMatthias Ringwald // 750e7551b0SMatthias Ringwald PBAP_CLIENT_W2_PULL_PHONEBOOK, 760e7551b0SMatthias Ringwald PBAP_CLIENT_W4_PHONEBOOK, 770e7551b0SMatthias Ringwald PBAP_CLIENT_W2_SET_PATH_ROOT, 780e7551b0SMatthias Ringwald PBAP_CLIENT_W4_SET_PATH_ROOT_COMPLETE, 790e7551b0SMatthias Ringwald PBAP_CLIENT_W2_SET_PATH_ELEMENT, 800e7551b0SMatthias Ringwald PBAP_CLIENT_W4_SET_PATH_ELEMENT_COMPLETE, 810e7551b0SMatthias Ringwald PBAP_CLIENT_W2_GET_PHONEBOOK_SIZE, 820e7551b0SMatthias Ringwald PBAP_CLIENT_W4_GET_PHONEBOOK_SIZE_COMPLETE, 830e7551b0SMatthias Ringwald // - pull vacard liast 840e7551b0SMatthias Ringwald PBAP_CLIENT_W2_GET_CARD_LIST, 850e7551b0SMatthias Ringwald PBAP_CLIENT_W4_GET_CARD_LIST_COMPLETE, 860e7551b0SMatthias Ringwald // - pull vcard entry 870e7551b0SMatthias Ringwald PBAP_CLIENT_W2_GET_CARD_ENTRY, 880e7551b0SMatthias Ringwald PBAP_CLIENT_W4_GET_CARD_ENTRY_COMPLETE, 890e7551b0SMatthias Ringwald // abort operation 900e7551b0SMatthias Ringwald PBAP_CLIENT_W4_ABORT_COMPLETE, 910e7551b0SMatthias Ringwald 920e7551b0SMatthias Ringwald } pbap_client_state_t; 930e7551b0SMatthias Ringwald 940e7551b0SMatthias Ringwald typedef enum { 950e7551b0SMatthias Ringwald PBAP_CLIENT_PHONEBOOK_SIZE_PARSER_STATE_W4_TYPE = 0, 960e7551b0SMatthias Ringwald PBAP_CLIENT_PHONEBOOK_SIZE_PARSER_STATE_W4_LEN, 970e7551b0SMatthias Ringwald PBAP_CLIENT_PHONEBOOK_SIZE_PARSER_STATE_W4_VALUE, 980e7551b0SMatthias Ringwald PBAP_CLIENT_PHONEBOOK_SIZE_PARSER_STATE_INVALID, 990e7551b0SMatthias Ringwald } pbap_client_phonebook_size_parser_state_t; 1000e7551b0SMatthias Ringwald 1010e7551b0SMatthias Ringwald typedef struct { 1020e7551b0SMatthias Ringwald // parsing 1030e7551b0SMatthias Ringwald pbap_client_phonebook_size_parser_state_t state; 1040e7551b0SMatthias Ringwald uint8_t type; 1050e7551b0SMatthias Ringwald uint8_t len; 1060e7551b0SMatthias Ringwald uint8_t pos; 1070e7551b0SMatthias Ringwald // data 1080e7551b0SMatthias Ringwald bool have_size; 1090e7551b0SMatthias Ringwald uint8_t size_buffer[2]; 1100e7551b0SMatthias Ringwald } pbap_client_phonebook_size_parser_t; 1110e7551b0SMatthias Ringwald 1120e7551b0SMatthias Ringwald typedef struct pbap_client { 113fe072f38SMatthias Ringwald // pbap client linked list 114fe072f38SMatthias Ringwald btstack_linked_item_t item; 115fe072f38SMatthias Ringwald 116fe072f38SMatthias Ringwald // goep client linked list 1170e7551b0SMatthias Ringwald goep_client_t goep_client; 1180e7551b0SMatthias Ringwald 119fe072f38SMatthias Ringwald pbap_client_state_t state; 1200e7551b0SMatthias Ringwald bd_addr_t bd_addr; 1210e7551b0SMatthias Ringwald hci_con_handle_t con_handle; 1220e7551b0SMatthias Ringwald uint16_t goep_cid; 1230e7551b0SMatthias Ringwald btstack_packet_handler_t client_handler; 1240e7551b0SMatthias Ringwald int request_number; 1250e7551b0SMatthias Ringwald const char * current_folder; 1260e7551b0SMatthias Ringwald const char * phone_number; 1270e7551b0SMatthias Ringwald const char * phonebook_path; 1280e7551b0SMatthias Ringwald const char * vcard_name; 1290e7551b0SMatthias Ringwald uint16_t set_path_offset; 1300e7551b0SMatthias Ringwald /* vcard selector / operator */ 1310e7551b0SMatthias Ringwald uint32_t vcard_selector; 1320e7551b0SMatthias Ringwald uint8_t vcard_selector_operator; 1330e7551b0SMatthias Ringwald uint8_t vcard_selector_supported; 1340e7551b0SMatthias Ringwald /* property selector */ 1350e7551b0SMatthias Ringwald uint32_t property_selector; 1360e7551b0SMatthias Ringwald uint16_t list_start_offset; 1370e7551b0SMatthias Ringwald uint16_t max_list_count; 1380e7551b0SMatthias Ringwald /* abort */ 1390e7551b0SMatthias Ringwald uint8_t abort_operation; 1400e7551b0SMatthias Ringwald /* obex parser */ 1410e7551b0SMatthias Ringwald bool obex_parser_waiting_for_response; 1420e7551b0SMatthias Ringwald obex_parser_t obex_parser; 1430e7551b0SMatthias Ringwald uint8_t obex_header_buffer[4]; 1440e7551b0SMatthias Ringwald /* authentication */ 1450e7551b0SMatthias Ringwald obex_auth_parser_t obex_auth_parser; 1460e7551b0SMatthias Ringwald const char * authentication_password; 1470e7551b0SMatthias Ringwald /* xml parser */ 1480e7551b0SMatthias Ringwald yxml_t xml_parser; 1490e7551b0SMatthias Ringwald uint8_t xml_buffer[50]; 1500e7551b0SMatthias Ringwald /* vcard listing parser */ 1510e7551b0SMatthias Ringwald bool parser_card_found; 1520e7551b0SMatthias Ringwald bool parser_name_found; 1530e7551b0SMatthias Ringwald bool parser_handle_found; 1540e7551b0SMatthias Ringwald char parser_name[PBAP_MAX_NAME_LEN]; 1550e7551b0SMatthias Ringwald char parser_handle[PBAP_MAX_HANDLE_LEN]; 1560e7551b0SMatthias Ringwald /* phonebook size */ 1570e7551b0SMatthias Ringwald pbap_client_phonebook_size_parser_t phonebook_size_parser; 1580e7551b0SMatthias Ringwald /* flow control mode */ 1590e7551b0SMatthias Ringwald uint8_t flow_control_enabled; 1600e7551b0SMatthias Ringwald uint8_t flow_next_triggered; 1610e7551b0SMatthias Ringwald bool flow_wait_for_user; 1620e7551b0SMatthias Ringwald /* srm */ 1630e7551b0SMatthias Ringwald obex_srm_t obex_srm; 1640e7551b0SMatthias Ringwald obex_srm_state_t srm_state; 1650e7551b0SMatthias Ringwald } pbap_client_t; 1660e7551b0SMatthias Ringwald 167f1b34e8dSMatthias Ringwald /* API_START */ 168f1b34e8dSMatthias Ringwald 169f1b34e8dSMatthias Ringwald /** 170f1b34e8dSMatthias Ringwald * Setup PhoneBook Access Client 171f1b34e8dSMatthias Ringwald */ 172f1b34e8dSMatthias Ringwald void pbap_client_init(void); 173f1b34e8dSMatthias Ringwald 174f1b34e8dSMatthias Ringwald /** 1751c7aea60SMilanka Ringwald * @brief Create PBAP connection to a Phone Book Server (PSE) server on a remote device. 1761c7aea60SMilanka Ringwald * If the server requires authentication, a PBAP_SUBEVENT_AUTHENTICATION_REQUEST is emitted, which 1771c7aea60SMilanka Ringwald * can be answered with pbap_authentication_password(..). 1781c7aea60SMilanka Ringwald * The status of PBAP connection establishment is reported via PBAP_SUBEVENT_CONNECTION_OPENED event, 1791c7aea60SMilanka Ringwald * i.e. on success status field is set to ERROR_CODE_SUCCESS. 1801c7aea60SMilanka Ringwald * 181*f3185e85SMatthias Ringwald * This function allows for multiple parallel connections. 182*f3185e85SMatthias Ringwald * 183*f3185e85SMatthias Ringwald * @param client storage for connection state. Must stay valid until connection closes 184*f3185e85SMatthias Ringwald * @param handler 185*f3185e85SMatthias Ringwald * @param addr 186*f3185e85SMatthias Ringwald * @param out_cid to use for further commands 187*f3185e85SMatthias Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_MEMORY_ALLOC_FAILED if PBAP or GOEP connection already exists. 188*f3185e85SMatthias Ringwald */ 189*f3185e85SMatthias Ringwald 190*f3185e85SMatthias Ringwald uint8_t pbap_client_connect(pbap_client_t * client, btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid); 191*f3185e85SMatthias Ringwald 192*f3185e85SMatthias Ringwald /** 193*f3185e85SMatthias Ringwald * @brief Create PBAP connection to a Phone Book Server (PSE) server on a remote device. 194*f3185e85SMatthias Ringwald * If the server requires authentication, a PBAP_SUBEVENT_AUTHENTICATION_REQUEST is emitted, which 195*f3185e85SMatthias Ringwald * can be answered with pbap_authentication_password(..). 196*f3185e85SMatthias Ringwald * The status of PBAP connection establishment is reported via PBAP_SUBEVENT_CONNECTION_OPENED event, 197*f3185e85SMatthias Ringwald * i.e. on success status field is set to ERROR_CODE_SUCCESS. 198*f3185e85SMatthias Ringwald * 199*f3185e85SMatthias Ringwald * This function uses a single pbap_client_t instance and can only be used for a single connection. 200*f3185e85SMatthias Ringwald * Fur multiple parallel connections, use pbap_client_connect. 201*f3185e85SMatthias Ringwald * 202f1b34e8dSMatthias Ringwald * @param handler 203f1b34e8dSMatthias Ringwald * @param addr 204f1b34e8dSMatthias Ringwald * @param out_cid to use for further commands 2051c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_MEMORY_ALLOC_FAILED if PBAP or GOEP connection already exists. 206f1b34e8dSMatthias Ringwald */ 207f1b34e8dSMatthias Ringwald uint8_t pbap_connect(btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid); 208f1b34e8dSMatthias Ringwald 209f1b34e8dSMatthias Ringwald /** 2101c7aea60SMilanka Ringwald * @brief Provide password for OBEX Authentication after receiving PBAP_SUBEVENT_AUTHENTICATION_REQUEST. 2111c7aea60SMilanka Ringwald * The status of PBAP connection establishment is reported via PBAP_SUBEVENT_CONNECTION_OPENED event, 2121c7aea60SMilanka Ringwald * i.e. on success status field is set to ERROR_CODE_SUCCESS. 2131c7aea60SMilanka Ringwald * 214c1bc0b8eSMatthias Ringwald * @param pbap_cid 215c1bc0b8eSMatthias Ringwald * @param password (null terminated string) - not copied, needs to stay valid until connection completed 2161c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 217c1bc0b8eSMatthias Ringwald */ 218c1bc0b8eSMatthias Ringwald uint8_t pbap_authentication_password(uint16_t pbap_cid, const char * password); 219c1bc0b8eSMatthias Ringwald 220c1bc0b8eSMatthias Ringwald /** 221f1b34e8dSMatthias Ringwald * @brief Disconnects PBAP connection with given identifier. 2221c7aea60SMilanka Ringwald * Event PBAP_SUBEVENT_CONNECTION_CLOSED indicates that PBAP connection is closed. 2231c7aea60SMilanka Ringwald * 224f1b34e8dSMatthias Ringwald * @param pbap_cid 2251c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 226f1b34e8dSMatthias Ringwald */ 227f1b34e8dSMatthias Ringwald uint8_t pbap_disconnect(uint16_t pbap_cid); 228f1b34e8dSMatthias Ringwald 229f1b34e8dSMatthias Ringwald /** 2301c7aea60SMilanka Ringwald * @brief Set current folder on PSE. The status is reported via PBAP_SUBEVENT_OPERATION_COMPLETED event. 2311c7aea60SMilanka Ringwald * 232f1b34e8dSMatthias Ringwald * @param pbap_cid 233f1b34e8dSMatthias Ringwald * @param path - note: path is not copied 2341c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 235f1b34e8dSMatthias Ringwald */ 236f1b34e8dSMatthias Ringwald uint8_t pbap_set_phonebook(uint16_t pbap_cid, const char * path); 237f1b34e8dSMatthias Ringwald 238f1b34e8dSMatthias Ringwald /** 2391c7aea60SMilanka Ringwald * @brief Set vCard Selector for get/pull phonebook. No event is emitted. 2401c7aea60SMilanka Ringwald * 2413127f224SMatthias Ringwald * @param pbap_cid 2423127f224SMatthias Ringwald * @param vcard_selector - combination of PBAP_PROPERTY_MASK_* properties 2431c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 2443127f224SMatthias Ringwald */ 2453127f224SMatthias Ringwald uint8_t pbap_set_vcard_selector(uint16_t pbap_cid, uint32_t vcard_selector); 2463127f224SMatthias Ringwald 2473127f224SMatthias Ringwald /** 2481c7aea60SMilanka Ringwald * @brief Set vCard Selector for get/pull phonebook. No event is emitted. 2491c7aea60SMilanka Ringwald * 2503127f224SMatthias Ringwald * @param pbap_cid 2513127f224SMatthias Ringwald * @param vcard_selector_operator - PBAP_VCARD_SELECTOR_OPERATOR_OR (default) or PBAP_VCARD_SELECTOR_OPERATOR_AND 2521c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 2533127f224SMatthias Ringwald */ 2543127f224SMatthias Ringwald uint8_t pbap_set_vcard_selector_operator(uint16_t pbap_cid, int vcard_selector_operator); 2553127f224SMatthias Ringwald 2563127f224SMatthias Ringwald /** 257e9b4d967SMatthias Ringwald * @brief Set Property Selector. No event is emitted. 258e9b4d967SMatthias Ringwald * @param pbap_cid 259e9b4d967SMatthias Ringwald * @param property_selector - combination of PBAP_PROPERTY_MASK_* properties 260e9b4d967SMatthias Ringwald * @return 261e9b4d967SMatthias Ringwald */ 262e9b4d967SMatthias Ringwald uint8_t pbap_set_property_selector(uint16_t pbap_cid, uint32_t property_selector); 263e9b4d967SMatthias Ringwald 264e9b4d967SMatthias Ringwald /** 26504f86d08SMatthias Ringwald * @brief Set number of items returned by pull phonebook. 26604f86d08SMatthias Ringwald * @param pbap_cid 26704f86d08SMatthias Ringwald * @param max_list_count 26804f86d08SMatthias Ringwald * @return 26904f86d08SMatthias Ringwald */ 27004f86d08SMatthias Ringwald uint8_t pbap_set_max_list_count(uint16_t pbap_cid, uint16_t max_list_count); 27104f86d08SMatthias Ringwald 27204f86d08SMatthias Ringwald /** 27304f86d08SMatthias Ringwald * @bbrief Set start offset for pull phonebook 27404f86d08SMatthias Ringwald * @param pbap_cid 27504f86d08SMatthias Ringwald * @param list_start_offset 27604f86d08SMatthias Ringwald * @return 27704f86d08SMatthias Ringwald */ 27804f86d08SMatthias Ringwald uint8_t pbap_set_list_start_offset(uint16_t pbap_cid, uint16_t list_start_offset); 27904f86d08SMatthias Ringwald 28004f86d08SMatthias Ringwald /** 2811c7aea60SMilanka Ringwald * @brief Get size of phone book from PSE. The result is reported via PBAP_SUBEVENT_PHONEBOOK_SIZE event. 2821c7aea60SMilanka Ringwald * 2833a7447a3SMatthias Ringwald * @param pbap_cid 2848c94c044SMatthias Ringwald * @param path - note: path is not copied, common path 'telecom/pb.vcf' 2851c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 2863a7447a3SMatthias Ringwald */ 2878c94c044SMatthias Ringwald uint8_t pbap_get_phonebook_size(uint16_t pbap_cid, const char * path); 2883a7447a3SMatthias Ringwald 2893a7447a3SMatthias Ringwald /** 2901c7aea60SMilanka Ringwald * @brief Pull phone book from PSE. The result is reported via registered packet handler (see pbap_connect function), 2911c7aea60SMilanka Ringwald * with packet type set to PBAP_DATA_PACKET. Event PBAP_SUBEVENT_OPERATION_COMPLETED marks the end of the phone book. 2921c7aea60SMilanka Ringwald * 293f1b34e8dSMatthias Ringwald * @param pbap_cid 2948c94c044SMatthias Ringwald * @param path - note: path is not copied, common path 'telecom/pb.vcf' 2951c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 296f1b34e8dSMatthias Ringwald */ 2978c94c044SMatthias Ringwald uint8_t pbap_pull_phonebook(uint16_t pbap_cid, const char * path); 298e03b79abSMatthias Ringwald 299e03b79abSMatthias Ringwald /** 3001c7aea60SMilanka Ringwald * @brief Pull vCard listing. vCard data is emitted via PBAP_SUBEVENT_CARD_RESULT event. 3011c7aea60SMilanka Ringwald * Event PBAP_SUBEVENT_OPERATION_COMPLETED marks the end of vCard listing. 3021c7aea60SMilanka Ringwald * 3034687d289SMatthias Ringwald * @param pbap_cid 3044687d289SMatthias Ringwald * @param path 3051c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 3064687d289SMatthias Ringwald */ 3074687d289SMatthias Ringwald uint8_t pbap_pull_vcard_listing(uint16_t pbap_cid, const char * path); 3084687d289SMatthias Ringwald 3094687d289SMatthias Ringwald /** 3101c7aea60SMilanka Ringwald * @brief Pull vCard entry. The result is reported via callback (see pbap_connect function), 3111c7aea60SMilanka Ringwald * with packet type set to PBAP_DATA_PACKET. 3121c7aea60SMilanka Ringwald * Event PBAP_SUBEVENT_OPERATION_COMPLETED marks the end of the vCard entry. 3131c7aea60SMilanka Ringwald * 31416ad3745SMatthias Ringwald * @param pbap_cid 31516ad3745SMatthias Ringwald * @param path 3161c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 31716ad3745SMatthias Ringwald */ 31816ad3745SMatthias Ringwald uint8_t pbap_pull_vcard_entry(uint16_t pbap_cid, const char * path); 31916ad3745SMatthias Ringwald 32016ad3745SMatthias Ringwald /** 3211c7aea60SMilanka Ringwald * @brief Lookup contact(s) by phone number. vCard data is emitted via PBAP_SUBEVENT_CARD_RESULT event. 3221c7aea60SMilanka Ringwald * Event PBAP_SUBEVENT_OPERATION_COMPLETED marks the end of the lookup. 3231c7aea60SMilanka Ringwald * 324e03b79abSMatthias Ringwald * @param pbap_cid 325e03b79abSMatthias Ringwald * @param phone_number 3261c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 327e03b79abSMatthias Ringwald */ 328e03b79abSMatthias Ringwald uint8_t pbap_lookup_by_number(uint16_t pbap_cid, const char * phone_number); 329f1b34e8dSMatthias Ringwald 330d4436ef5SMatthias Ringwald /** 3311c7aea60SMilanka Ringwald * @brief Abort current operation. No event is emitted. 3321c7aea60SMilanka Ringwald * 3339eb7827dSMatthias Ringwald * @param pbap_cid 3341c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 3359eb7827dSMatthias Ringwald */ 3369eb7827dSMatthias Ringwald uint8_t pbap_abort(uint16_t pbap_cid); 3379eb7827dSMatthias Ringwald 3389eb7827dSMatthias Ringwald 3399eb7827dSMatthias Ringwald /** 3401c7aea60SMilanka Ringwald * @brief Set flow control mode - default is off. No event is emitted. 341d4436ef5SMatthias Ringwald * @note When enabled, pbap_next_packet needs to be called after a packet was processed to receive the next one 3421c7aea60SMilanka Ringwald * 3438854a89dSMatthias Ringwald * @param pbap_cid 3441c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 345d4436ef5SMatthias Ringwald */ 3468854a89dSMatthias Ringwald uint8_t pbap_set_flow_control_mode(uint16_t pbap_cid, int enable); 347d4436ef5SMatthias Ringwald 348d4436ef5SMatthias Ringwald /** 3491c7aea60SMilanka Ringwald * @brief Trigger next packet from PSE when Flow Control Mode is enabled. 350d4436ef5SMatthias Ringwald * @param pbap_cid 3511c7aea60SMilanka Ringwald * @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_BUSY if in a wrong state. 352d4436ef5SMatthias Ringwald */ 353d4436ef5SMatthias Ringwald uint8_t pbap_next_packet(uint16_t pbap_cid); 354d4436ef5SMatthias Ringwald 3551d0ae3baSMatthias Ringwald /** 3561d0ae3baSMatthias Ringwald * @brief De-Init PBAP Client 3571d0ae3baSMatthias Ringwald */ 3581d0ae3baSMatthias Ringwald void pbap_client_deinit(void); 359d4436ef5SMatthias Ringwald 360f1b34e8dSMatthias Ringwald /* API_END */ 361f1b34e8dSMatthias Ringwald 362f1b34e8dSMatthias Ringwald #if defined __cplusplus 363f1b34e8dSMatthias Ringwald } 364f1b34e8dSMatthias Ringwald #endif 365f1b34e8dSMatthias Ringwald #endif 366