mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-14 18:40:59 +00:00
avrcp target: remove unused vars, fix set absolute volume; on invalid param, send the current volume
This commit is contained in:
parent
e72b716b71
commit
0a2feef458
@ -634,8 +634,8 @@ static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16
|
||||
// printf("AVRCP_PDU_ID_SET_ADDRESSED_PLAYER \n");
|
||||
break;
|
||||
case AVRCP_PDU_ID_GET_TOTAL_NUMBER_OF_ITEMS:{
|
||||
uint32_t num_items = big_endian_read_32(packet, pos);
|
||||
pos += 4;
|
||||
// uint32_t num_items = big_endian_read_32(packet, pos);
|
||||
// pos += 4;
|
||||
// printf("TODO: send event, uid_counter %d, num_items %d\n", browsing_connection->uid_counter, num_items);
|
||||
break;
|
||||
}
|
||||
@ -686,7 +686,7 @@ static void avrcp_browsing_controller_packet_handler(uint8_t packet_type, uint16
|
||||
case AVRCP_PDU_ID_SEARCH:{
|
||||
browsing_connection->uid_counter = big_endian_read_16(packet, pos);
|
||||
pos += 2;
|
||||
uint32_t num_items = big_endian_read_32(packet, pos);
|
||||
// uint32_t num_items = big_endian_read_32(packet, pos);
|
||||
// printf("TODO: send as event, search found %d items\n", num_items);
|
||||
break;
|
||||
}
|
||||
|
@ -370,7 +370,8 @@ static uint8_t avrcp_target_response_not_implemented(avrcp_connection_t * connec
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t avrcp_target_response_vendor_dependent_interim(avrcp_connection_t * connection, avrcp_subunit_type_t subunit_type, avrcp_subunit_id_t subunit_id, avrcp_command_opcode_t opcode, avrcp_pdu_id_t pdu_id, uint8_t event_id, const uint8_t * value, uint16_t value_len){
|
||||
static uint8_t avrcp_target_response_vendor_dependent_interim(avrcp_connection_t * connection, avrcp_subunit_type_t subunit_type, avrcp_subunit_id_t subunit_id,
|
||||
avrcp_command_opcode_t opcode, avrcp_pdu_id_t pdu_id, uint8_t event_id, const uint8_t * value, uint16_t value_len){
|
||||
connection->command_type = AVRCP_CTYPE_RESPONSE_INTERIM;
|
||||
connection->subunit_type = subunit_type;
|
||||
connection->subunit_id = subunit_id;
|
||||
@ -400,7 +401,7 @@ static uint8_t avrcp_target_response_addressed_player_changed_interim(avrcp_conn
|
||||
connection->subunit_type = subunit_type;
|
||||
connection->subunit_id = subunit_id;
|
||||
connection->command_opcode = opcode;
|
||||
// printf("avrcp_target_response_addressed_player_changed_interim \n");
|
||||
|
||||
// company id is 3 bytes long
|
||||
int pos = connection->cmd_operands_length;
|
||||
connection->cmd_operands[pos++] = pdu_id;
|
||||
@ -962,21 +963,16 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
|
||||
break;
|
||||
}
|
||||
case AVRCP_PDU_ID_SET_ABSOLUTE_VOLUME: {
|
||||
uint16_t param_length = big_endian_read_16(pdu,2);
|
||||
if (param_length != 1){
|
||||
if (length != 1){
|
||||
avrcp_target_response_reject(connection, subunit_type, subunit_id, opcode, pdu_id, AVRCP_STATUS_INVALID_COMMAND);
|
||||
// printf("param_length is %d != 1 \n", param_length);
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t absolute_volume = pdu[4];
|
||||
if (absolute_volume > 0x7F){
|
||||
avrcp_target_response_reject(connection, subunit_type, subunit_id, opcode, pdu_id, AVRCP_STATUS_INVALID_COMMAND);
|
||||
// printf("absolute_volume %d > 127 \n", absolute_volume);
|
||||
break;
|
||||
}
|
||||
if (absolute_volume < 0x80){
|
||||
connection->volume_percentage = absolute_volume;
|
||||
avrcp_target_response_accept(connection, subunit_type, subunit_id, opcode, pdu_id, absolute_volume);
|
||||
}
|
||||
avrcp_target_response_accept(connection, subunit_type, subunit_id, opcode, pdu_id, connection->volume_percentage);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user