mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 21:41:13 +00:00
pbap_client: provide single l2cap ertm buffer in pbap_connect
This commit is contained in:
parent
0806590a60
commit
dff8de67db
@ -1103,6 +1103,29 @@ uint8_t pbap_client_connect(pbap_client_t * client, l2cap_ertm_config_t *l2cap_e
|
||||
uint8_t pbap_connect(btstack_packet_handler_t handler, bd_addr_t addr, uint16_t * out_cid){
|
||||
static pbap_client_t pbap_client_singleton;
|
||||
|
||||
l2cap_ertm_config_t *l2cap_ertm_config = NULL;
|
||||
uint8_t *l2cap_ertm_buffer = NULL;
|
||||
uint16_t l2cap_ertm_buffer_size = 0;
|
||||
|
||||
#ifdef ENABLE_GOEP_L2CAP
|
||||
// singleton instance
|
||||
static uint8_t pbap_client_singleton_ertm_buffer[1000];
|
||||
static l2cap_ertm_config_t pbap_client_singleton_ertm_config = {
|
||||
1, // ertm mandatory
|
||||
2, // max transmit, some tests require > 1
|
||||
2000,
|
||||
12000,
|
||||
512, // l2cap ertm mtu
|
||||
2,
|
||||
2,
|
||||
1, // 16-bit FCS
|
||||
};
|
||||
|
||||
l2cap_ertm_config = &pbap_client_singleton_ertm_config;
|
||||
l2cap_ertm_buffer = pbap_client_singleton_ertm_buffer;
|
||||
l2cap_ertm_buffer_size = sizeof(pbap_client_singleton_ertm_buffer);
|
||||
#endif
|
||||
|
||||
if (pbap_client_singleton_used && pbap_client_singleton.state != PBAP_CLIENT_INIT){
|
||||
return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
}
|
||||
@ -1110,7 +1133,7 @@ uint8_t pbap_connect(btstack_packet_handler_t handler, bd_addr_t addr, uint16_t
|
||||
pbap_client_singleton_used = true;
|
||||
|
||||
memset(&pbap_client_singleton, 0, sizeof(pbap_client_t));
|
||||
return pbap_client_connect(&pbap_client_singleton, handler, addr, out_cid);
|
||||
return pbap_client_connect(&pbap_client_singleton, l2cap_ertm_config, l2cap_ertm_buffer, l2cap_ertm_buffer_size, handler, addr, out_cid);
|
||||
}
|
||||
|
||||
uint8_t pbap_disconnect(uint16_t pbap_cid){
|
||||
|
@ -200,7 +200,7 @@ uint8_t pbap_client_connect(pbap_client_t * client, l2cap_ertm_config_t *l2cap_e
|
||||
* 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.
|
||||
* This function uses a single pbap_client_t and l2cap ertm buffer instance and can only be used for a single connection.
|
||||
* Fur multiple parallel connections, use pbap_client_connect.
|
||||
*
|
||||
* @param handler
|
||||
|
Loading…
x
Reference in New Issue
Block a user