mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-31 18:33:00 +00:00
avrcp_controller: add command type field to custom response event, report abort continuation response
This commit is contained in:
parent
cf9d61af7a
commit
9611f44c90
@ -2949,9 +2949,10 @@ typedef uint8_t sm_key_t[16];
|
||||
#define AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID_DONE 0x27
|
||||
|
||||
/**
|
||||
* @format 121LV
|
||||
* @format 1211LV
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param pdu_id
|
||||
* @param params_len
|
||||
* @param params
|
||||
|
@ -9195,6 +9195,15 @@ static inline uint8_t avrcp_subevent_get_capability_company_id_done_get_status(c
|
||||
static inline uint16_t avrcp_subevent_custom_command_response_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_CUSTOM_COMMAND_RESPONSE
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_custom_command_response_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field pdu_id from event AVRCP_SUBEVENT_CUSTOM_COMMAND_RESPONSE
|
||||
* @param event packet
|
||||
@ -9202,7 +9211,7 @@ static inline uint16_t avrcp_subevent_custom_command_response_get_avrcp_cid(cons
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_custom_command_response_get_pdu_id(const uint8_t * event){
|
||||
return event[5];
|
||||
return event[6];
|
||||
}
|
||||
/**
|
||||
* @brief Get field params_len from event AVRCP_SUBEVENT_CUSTOM_COMMAND_RESPONSE
|
||||
@ -9211,7 +9220,7 @@ static inline uint8_t avrcp_subevent_custom_command_response_get_pdu_id(const ui
|
||||
* @note: btstack_type L
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_custom_command_response_get_params_len(const uint8_t * event){
|
||||
return little_endian_read_16(event, 6);
|
||||
return little_endian_read_16(event, 7);
|
||||
}
|
||||
/**
|
||||
* @brief Get field params from event AVRCP_SUBEVENT_CUSTOM_COMMAND_RESPONSE
|
||||
@ -9220,7 +9229,7 @@ static inline uint16_t avrcp_subevent_custom_command_response_get_params_len(con
|
||||
* @note: btstack_type V
|
||||
*/
|
||||
static inline const uint8_t * avrcp_subevent_custom_command_response_get_params(const uint8_t * event){
|
||||
return &event[8];
|
||||
return &event[9];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,8 @@ static void avrcp_controller_prepare_custom_command_response(avrcp_connection_t
|
||||
in_place_buffer[pos++] = AVRCP_SUBEVENT_CUSTOM_COMMAND_RESPONSE;
|
||||
little_endian_store_16(in_place_buffer, pos, connection->avrcp_cid);
|
||||
pos += 2;
|
||||
in_place_buffer[pos++] = connection->pdu_id;
|
||||
in_place_buffer[pos++] = (uint8_t)connection->command_type;
|
||||
in_place_buffer[pos++] = (uint8_t)connection->pdu_id;
|
||||
little_endian_store_16(in_place_buffer, pos, response_len);
|
||||
pos += 2;
|
||||
in_place_buffer[1] = pos + response_len - 2;
|
||||
@ -1166,12 +1167,21 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
|
||||
}
|
||||
default:
|
||||
// custom command response comes here
|
||||
if (pdu_id == connection->pdu_id) {
|
||||
uint8_t *in_place_buffer = packet + pos - 8;
|
||||
avrcp_controller_prepare_custom_command_response(connection, param_length,
|
||||
in_place_buffer);
|
||||
(*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, in_place_buffer,
|
||||
param_length + 8);
|
||||
switch (pdu_id){
|
||||
case AVRCP_PDU_ID_REQUEST_ABORT_CONTINUING_RESPONSE:
|
||||
avrcp_controller_emit_now_playing_info_event_done(avrcp_controller_context.avrcp_callback, connection->avrcp_cid, ctype, 0);
|
||||
break;
|
||||
default:
|
||||
if (pdu_id != connection->pdu_id) {
|
||||
break;
|
||||
}
|
||||
uint8_t *in_place_buffer = packet + pos - 9;
|
||||
avrcp_controller_prepare_custom_command_response(connection, param_length,
|
||||
in_place_buffer);
|
||||
(*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, in_place_buffer,
|
||||
param_length + 9);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user