pbap_client: support multiple parallel connections

This commit is contained in:
Matthias Ringwald 2024-07-18 10:56:54 +02:00
parent 96ba8cb10d
commit f3185e85ee
3 changed files with 24 additions and 2 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- PBAP Client: allow to set start offset and max list count for pull phonebook operation
- PBAP Client: support multiple parallel connections
### Fixed
- RFCOMM: shut down multiplexer after closing last channel instead of multiplexer idle timer

View File

@ -1080,7 +1080,7 @@ void pbap_client_init(void){
void pbap_client_deinit(void){
}
static uint8_t pbap_client_connect(pbap_client_t * client, btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid) {
uint8_t pbap_client_connect(pbap_client_t * client, btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid) {
client->state = PBAP_CLIENT_W4_GOEP_CONNECTION;
client->client_handler = handler;
client->vcard_selector = 0;

View File

@ -178,6 +178,27 @@ void pbap_client_init(void);
* The status of PBAP connection establishment is reported via PBAP_SUBEVENT_CONNECTION_OPENED event,
* i.e. on success status field is set to ERROR_CODE_SUCCESS.
*
* This function allows for multiple parallel connections.
*
* @param client storage for connection state. Must stay valid until connection closes
* @param handler
* @param addr
* @param out_cid to use for further commands
* @return status ERROR_CODE_SUCCESS on success, otherwise BTSTACK_MEMORY_ALLOC_FAILED if PBAP or GOEP connection already exists.
*/
uint8_t pbap_client_connect(pbap_client_t * client, btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid);
/**
* @brief Create PBAP connection to a Phone Book Server (PSE) server on a remote device.
* If the server requires authentication, a PBAP_SUBEVENT_AUTHENTICATION_REQUEST is emitted, which
* can be answered with pbap_authentication_password(..).
* The status of PBAP connection establishment is reported via PBAP_SUBEVENT_CONNECTION_OPENED event,
* i.e. on success status field is set to ERROR_CODE_SUCCESS.
*
* This function uses a single pbap_client_t instance and can only be used for a single connection.
* Fur multiple parallel connections, use pbap_client_connect.
*
* @param handler
* @param addr
* @param out_cid to use for further commands