mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 08:37:22 +00:00
avrcp: remove NULL check on browsing connection as it is guaranteed
This commit is contained in:
parent
c3f996e681
commit
085892ca0d
@ -548,13 +548,6 @@ uint8_t avrcp_browsing_decline_incoming_connection(uint16_t avrcp_browsing_cid){
|
||||
if (!connection_target){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
if (!connection_controller->browsing_connection){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (!connection_target->browsing_connection){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
if (connection_controller->browsing_connection->state != AVCTP_CONNECTION_W4_ERTM_CONFIGURATION){
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
@ -576,13 +569,6 @@ uint8_t avrcp_browsing_disconnect(uint16_t avrcp_browsing_cid){
|
||||
if (!connection_target){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
if (!connection_controller->browsing_connection){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (!connection_target->browsing_connection){
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
l2cap_disconnect(connection_controller->browsing_connection->l2cap_browsing_cid);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
|
@ -536,8 +536,6 @@ uint8_t avrcp_browsing_controller_get_item_attributes_for_scope(uint16_t avrcp_b
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
btstack_assert(connection != NULL);
|
||||
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
log_error("avrcp_browsing_controller_get_item_attributes: connection in wrong state %d, expected %d.", connection->state, AVCTP_CONNECTION_OPENED);
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
@ -634,8 +632,6 @@ uint8_t avrcp_browsing_controller_change_path(uint16_t avrcp_browsing_cid, uint8
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
btstack_assert(connection != NULL);
|
||||
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
log_error("avrcp_browsing_controller_change_path: connection in wrong state.");
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
@ -668,8 +664,6 @@ uint8_t avrcp_browsing_controller_search(uint16_t avrcp_browsing_cid, uint16_t s
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
btstack_assert(connection != NULL);
|
||||
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
log_error("avrcp_browsing_controller_change_path: connection in wrong state.");
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
|
@ -396,10 +396,6 @@ uint8_t avrcp_browsing_target_send_get_folder_items_response(uint16_t avrcp_brow
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
@ -472,10 +468,6 @@ uint8_t avrcp_browsing_target_send_change_path_response(uint16_t avrcp_browsing_
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
@ -508,10 +500,6 @@ uint8_t avrcp_browsing_target_send_get_item_attributes_response(uint16_t avrcp_b
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
@ -558,11 +546,6 @@ uint8_t avrcp_browsing_target_send_accept_set_browsed_player(uint16_t avrcp_brow
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED) {
|
||||
log_info("Browsing connection wrong state.");
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
@ -605,11 +588,6 @@ uint8_t avrcp_browsing_target_send_reject_set_browsed_player(uint16_t avrcp_brow
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED) {
|
||||
log_info("Browsing connection wrong state.");
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
@ -617,6 +595,8 @@ uint8_t avrcp_browsing_target_send_reject_set_browsed_player(uint16_t avrcp_brow
|
||||
|
||||
int pos = 0;
|
||||
connection->cmd_operands[pos++] = AVRCP_PDU_ID_SET_BROWSED_PLAYER;
|
||||
|
||||
// When not accepted, status is the only field present in the response. AVRCP 6.9.3
|
||||
big_endian_store_16(connection->cmd_operands, pos, 1);
|
||||
pos += 2;
|
||||
connection->cmd_operands[pos++] = status;
|
||||
@ -635,11 +615,6 @@ uint8_t avrcp_browsing_target_send_get_total_num_items_response(uint16_t avrcp_b
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED) {
|
||||
log_info("Browsing connection wrong state.");
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
@ -669,10 +644,6 @@ uint8_t avrcp_browsing_target_send_search_response(uint16_t avrcp_browsing_cid,
|
||||
}
|
||||
|
||||
avrcp_browsing_connection_t * connection = avrcp_connection->browsing_connection;
|
||||
if (!connection){
|
||||
log_info("Could not find a browsing connection.");
|
||||
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
}
|
||||
if (connection->state != AVCTP_CONNECTION_OPENED){
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user