xref: /btstack/src/classic/pbap_client.h (revision c1bc0b8eb5939645f99930167b211d7cbc6b7aff)
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
23f1b34e8dSMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24f1b34e8dSMatthias Ringwald  * RINGWALD 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 
38f1b34e8dSMatthias Ringwald #ifndef __GOEP_CLIENT_H
39f1b34e8dSMatthias Ringwald 
40f1b34e8dSMatthias Ringwald #if defined __cplusplus
41f1b34e8dSMatthias Ringwald extern "C" {
42f1b34e8dSMatthias Ringwald #endif
43f1b34e8dSMatthias Ringwald 
44f1b34e8dSMatthias Ringwald #include "btstack_config.h"
45f1b34e8dSMatthias Ringwald #include <stdint.h>
46f1b34e8dSMatthias Ringwald 
47f1b34e8dSMatthias Ringwald /* API_START */
48f1b34e8dSMatthias Ringwald 
49f1b34e8dSMatthias Ringwald /**
50f1b34e8dSMatthias Ringwald  * Setup PhoneBook Access Client
51f1b34e8dSMatthias Ringwald  */
52f1b34e8dSMatthias Ringwald void pbap_client_init(void);
53f1b34e8dSMatthias Ringwald 
54f1b34e8dSMatthias Ringwald /**
55f1b34e8dSMatthias Ringwald  * @brief Create PBAP connection to a Phone Book Server (PSE) server on a remote deivce.
56f1b34e8dSMatthias Ringwald  * @param handler
57f1b34e8dSMatthias Ringwald  * @param addr
58f1b34e8dSMatthias Ringwald  * @param out_cid to use for further commands
59f1b34e8dSMatthias Ringwald  * @result status
60f1b34e8dSMatthias Ringwald */
61f1b34e8dSMatthias Ringwald uint8_t pbap_connect(btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid);
62f1b34e8dSMatthias Ringwald 
63f1b34e8dSMatthias Ringwald /**
64*c1bc0b8eSMatthias Ringwald  * @brief Provide password for OBEX Authentication after receiving PBAP_SUBEVENT_AUTHENTICATION_REQUEST
65*c1bc0b8eSMatthias Ringwald  * @param pbap_cid
66*c1bc0b8eSMatthias Ringwald  * @param password (null terminated string) - not copied, needs to stay valid until connection completed
67*c1bc0b8eSMatthias Ringwald */
68*c1bc0b8eSMatthias Ringwald uint8_t pbap_authentication_password(uint16_t pbap_cid, const char * password);
69*c1bc0b8eSMatthias Ringwald 
70*c1bc0b8eSMatthias Ringwald /**
71f1b34e8dSMatthias Ringwald  * @brief Disconnects PBAP connection with given identifier.
72f1b34e8dSMatthias Ringwald  * @param pbap_cid
73f1b34e8dSMatthias Ringwald  * @return status
74f1b34e8dSMatthias Ringwald  */
75f1b34e8dSMatthias Ringwald uint8_t pbap_disconnect(uint16_t pbap_cid);
76f1b34e8dSMatthias Ringwald 
77f1b34e8dSMatthias Ringwald /**
78f1b34e8dSMatthias Ringwald  * @brief Set current folder on PSE
79f1b34e8dSMatthias Ringwald  * @param pbap_cid
80f1b34e8dSMatthias Ringwald  * @param path - note: path is not copied
81f1b34e8dSMatthias Ringwald  * @return status
82f1b34e8dSMatthias Ringwald  */
83f1b34e8dSMatthias Ringwald uint8_t pbap_set_phonebook(uint16_t pbap_cid, const char * path);
84f1b34e8dSMatthias Ringwald 
85f1b34e8dSMatthias Ringwald /**
863a7447a3SMatthias Ringwald  * @brief Get size of phone book from PSE
873a7447a3SMatthias Ringwald  * @param pbap_cid
883a7447a3SMatthias Ringwald  * @return status
893a7447a3SMatthias Ringwald  */
903a7447a3SMatthias Ringwald uint8_t pbap_get_phonebook_size(uint16_t pbap_cid);
913a7447a3SMatthias Ringwald 
923a7447a3SMatthias Ringwald /**
93f1b34e8dSMatthias Ringwald  * @brief Pull phone book from PSE
94f1b34e8dSMatthias Ringwald  * @param pbap_cid
95f1b34e8dSMatthias Ringwald  * @return status
96f1b34e8dSMatthias Ringwald  */
97f1b34e8dSMatthias Ringwald  uint8_t pbap_pull_phonebook(uint16_t pbap_cid);
98f1b34e8dSMatthias Ringwald 
99f1b34e8dSMatthias Ringwald /* API_END */
100f1b34e8dSMatthias Ringwald 
101f1b34e8dSMatthias Ringwald #if defined __cplusplus
102f1b34e8dSMatthias Ringwald }
103f1b34e8dSMatthias Ringwald #endif
104f1b34e8dSMatthias Ringwald #endif
105