mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-20 00:40:04 +00:00
avrcp browing: move get avrcp connection back into avrcp.c
This commit is contained in:
parent
eb7aab40eb
commit
03a72c8ed0
@ -333,6 +333,42 @@ avrcp_connection_t * get_avrcp_connection_for_avrcp_cid_for_role(avrcp_role_t ro
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
avrcp_connection_t * get_avrcp_connection_for_browsing_cid_for_role(avrcp_role_t role, uint16_t browsing_cid){
|
||||||
|
btstack_linked_list_iterator_t it;
|
||||||
|
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &connections);
|
||||||
|
while (btstack_linked_list_iterator_has_next(&it)){
|
||||||
|
avrcp_connection_t * connection = (avrcp_connection_t *)btstack_linked_list_iterator_next(&it);
|
||||||
|
if (connection->role != role) continue;
|
||||||
|
if (connection->avrcp_browsing_cid != browsing_cid) continue;
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
avrcp_connection_t * get_avrcp_connection_for_browsing_l2cap_cid_for_role(avrcp_role_t role, uint16_t browsing_l2cap_cid){
|
||||||
|
btstack_linked_list_iterator_t it;
|
||||||
|
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &connections);
|
||||||
|
while (btstack_linked_list_iterator_has_next(&it)){
|
||||||
|
avrcp_connection_t * connection = (avrcp_connection_t *)btstack_linked_list_iterator_next(&it);
|
||||||
|
if (connection->role != role) continue;
|
||||||
|
if (connection->browsing_connection && (connection->browsing_connection->l2cap_browsing_cid != browsing_l2cap_cid)) continue;
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
avrcp_browsing_connection_t * get_avrcp_browsing_connection_for_l2cap_cid_for_role(avrcp_role_t role, uint16_t l2cap_cid){
|
||||||
|
btstack_linked_list_iterator_t it;
|
||||||
|
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &connections);
|
||||||
|
while (btstack_linked_list_iterator_has_next(&it)){
|
||||||
|
avrcp_connection_t * connection = (avrcp_connection_t *)btstack_linked_list_iterator_next(&it);
|
||||||
|
if (connection->role != role) continue;
|
||||||
|
if (connection->browsing_connection && (connection->browsing_connection->l2cap_browsing_cid != l2cap_cid)) continue;
|
||||||
|
return connection->browsing_connection;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid){
|
void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid){
|
||||||
connection->wait_to_send = true;
|
connection->wait_to_send = true;
|
||||||
l2cap_request_can_send_now_event(l2cap_cid);
|
l2cap_request_can_send_now_event(l2cap_cid);
|
||||||
|
@ -586,6 +586,9 @@ avrcp_browsing_connection_t * get_avrcp_browsing_connection_for_l2cap_cid_for_ro
|
|||||||
void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid);
|
void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid);
|
||||||
uint16_t avrcp_get_next_cid(avrcp_role_t role);
|
uint16_t avrcp_get_next_cid(avrcp_role_t role);
|
||||||
|
|
||||||
|
avrcp_connection_t * get_avrcp_connection_for_browsing_cid_for_role(avrcp_role_t role, uint16_t browsing_cid);
|
||||||
|
avrcp_connection_t * get_avrcp_connection_for_browsing_l2cap_cid_for_role(avrcp_role_t role, uint16_t browsing_l2cap_cid);
|
||||||
|
avrcp_browsing_connection_t * get_avrcp_browsing_connection_for_l2cap_cid_for_role(avrcp_role_t role, uint16_t l2cap_cid);
|
||||||
// SDP query
|
// SDP query
|
||||||
void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||||
|
|
||||||
|
@ -54,48 +54,11 @@ static void avrcp_browsing_packet_handler(uint8_t packet_type, uint16_t channel,
|
|||||||
|
|
||||||
static btstack_packet_handler_t avrcp_browsing_callback;
|
static btstack_packet_handler_t avrcp_browsing_callback;
|
||||||
|
|
||||||
static btstack_linked_list_t connections;
|
|
||||||
|
|
||||||
static bool l2cap_browsing_service_registered = false;
|
static bool l2cap_browsing_service_registered = false;
|
||||||
static btstack_packet_handler_t avrcp_browsing_controller_packet_handler;
|
static btstack_packet_handler_t avrcp_browsing_controller_packet_handler;
|
||||||
static btstack_packet_handler_t avrcp_browsing_target_packet_handler;
|
static btstack_packet_handler_t avrcp_browsing_target_packet_handler;
|
||||||
|
|
||||||
|
|
||||||
avrcp_connection_t * get_avrcp_connection_for_browsing_cid_for_role(avrcp_role_t role, uint16_t browsing_cid){
|
|
||||||
btstack_linked_list_iterator_t it;
|
|
||||||
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &connections);
|
|
||||||
while (btstack_linked_list_iterator_has_next(&it)){
|
|
||||||
avrcp_connection_t * connection = (avrcp_connection_t *)btstack_linked_list_iterator_next(&it);
|
|
||||||
if (connection->role != role) continue;
|
|
||||||
if (connection->avrcp_browsing_cid != browsing_cid) continue;
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
avrcp_connection_t * get_avrcp_connection_for_browsing_l2cap_cid_for_role(avrcp_role_t role, uint16_t browsing_l2cap_cid){
|
|
||||||
btstack_linked_list_iterator_t it;
|
|
||||||
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &connections);
|
|
||||||
while (btstack_linked_list_iterator_has_next(&it)){
|
|
||||||
avrcp_connection_t * connection = (avrcp_connection_t *)btstack_linked_list_iterator_next(&it);
|
|
||||||
if (connection->role != role) continue;
|
|
||||||
if (connection->browsing_connection && (connection->browsing_connection->l2cap_browsing_cid != browsing_l2cap_cid)) continue;
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
avrcp_browsing_connection_t * get_avrcp_browsing_connection_for_l2cap_cid_for_role(avrcp_role_t role, uint16_t l2cap_cid){
|
|
||||||
btstack_linked_list_iterator_t it;
|
|
||||||
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &connections);
|
|
||||||
while (btstack_linked_list_iterator_has_next(&it)){
|
|
||||||
avrcp_connection_t * connection = (avrcp_connection_t *)btstack_linked_list_iterator_next(&it);
|
|
||||||
if (connection->role != role) continue;
|
|
||||||
if (connection->browsing_connection && (connection->browsing_connection->l2cap_browsing_cid != l2cap_cid)) continue;
|
|
||||||
return connection->browsing_connection;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void avrcp_browsing_request_can_send_now(avrcp_browsing_connection_t * connection, uint16_t l2cap_cid){
|
void avrcp_browsing_request_can_send_now(avrcp_browsing_connection_t * connection, uint16_t l2cap_cid){
|
||||||
connection->wait_to_send = true;
|
connection->wait_to_send = true;
|
||||||
|
@ -55,10 +55,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
avrcp_connection_t * get_avrcp_connection_for_browsing_cid_for_role(avrcp_role_t role, uint16_t browsing_cid);
|
|
||||||
avrcp_connection_t * get_avrcp_connection_for_browsing_l2cap_cid_for_role(avrcp_role_t role, uint16_t browsing_l2cap_cid);
|
|
||||||
avrcp_browsing_connection_t * get_avrcp_browsing_connection_for_l2cap_cid_for_role(avrcp_role_t role, uint16_t l2cap_cid);
|
|
||||||
|
|
||||||
void avrcp_browsing_register_controller_packet_handler(btstack_packet_handler_t callback);
|
void avrcp_browsing_register_controller_packet_handler(btstack_packet_handler_t callback);
|
||||||
void avrcp_browsing_register_target_packet_handler(btstack_packet_handler_t callback);
|
void avrcp_browsing_register_target_packet_handler(btstack_packet_handler_t callback);
|
||||||
void avrcp_browsing_request_can_send_now(avrcp_browsing_connection_t * connection, uint16_t l2cap_cid);
|
void avrcp_browsing_request_can_send_now(avrcp_browsing_connection_t * connection, uint16_t l2cap_cid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user