diff --git a/src/classic/avrcp_browsing_controller.c b/src/classic/avrcp_browsing_controller.c index fe094841c..d27235324 100644 --- a/src/classic/avrcp_browsing_controller.c +++ b/src/classic/avrcp_browsing_controller.c @@ -48,22 +48,9 @@ #define PSM_AVCTP_BROWSING 0x001b -static uint16_t avrcp_browsing_cid_counter = 0; - static void avrcp_browser_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, avrcp_context_t * context); static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); -static uint16_t avrcp_browsing_get_next_cid(avrcp_role_t role){ - do { - if (avrcp_browsing_cid_counter == 0xffff) { - avrcp_browsing_cid_counter = 1; - } else { - avrcp_browsing_cid_counter++; - } - } while (get_avrcp_connection_for_browsing_l2cap_cid(role, avrcp_browsing_cid_counter) != NULL) ; - return avrcp_browsing_cid_counter; -} - static void avrcp_emit_browsing_connection_established(btstack_packet_handler_t callback, uint16_t browsing_cid, bd_addr_t addr, uint8_t status){ if (!callback) return; uint8_t event[12]; @@ -109,7 +96,7 @@ static avrcp_browsing_connection_t * avrcp_browsing_create_connection(avrcp_conn avrcp_browsing_connection_t * connection = btstack_memory_avrcp_browsing_connection_get(); connection->state = AVCTP_CONNECTION_IDLE; connection->transaction_label = 0xFF; - avrcp_connection->avrcp_browsing_cid = avrcp_browsing_get_next_cid(avrcp_connection->role); + avrcp_connection->avrcp_browsing_cid = avrcp_get_next_cid(avrcp_connection->role); avrcp_connection->browsing_connection = connection; return connection; } diff --git a/src/classic/avrcp_browsing_target.c b/src/classic/avrcp_browsing_target.c index 389301fbc..b44a319b6 100644 --- a/src/classic/avrcp_browsing_target.c +++ b/src/classic/avrcp_browsing_target.c @@ -167,7 +167,7 @@ static avrcp_browsing_connection_t * avrcp_browsing_create_connection(avrcp_conn avrcp_browsing_connection_t * connection = btstack_memory_avrcp_browsing_connection_get(); connection->state = AVCTP_CONNECTION_IDLE; connection->transaction_label = 0xFF; - avrcp_connection->avrcp_browsing_cid = avrcp_get_next_cid(); + avrcp_connection->avrcp_browsing_cid = avrcp_get_next_cid(avrcp_connection->role); avrcp_connection->browsing_connection = connection; return connection; }