avrcp: new field button_pressed in AVRCP_SUBEVENT_OPERATION

This commit is contained in:
Matthias Ringwald 2021-03-19 10:06:41 +01:00
parent 0ee74f3d64
commit 319131f8bc
4 changed files with 23 additions and 8 deletions

View File

@ -21,7 +21,8 @@ hci_transport: add parity field and pass on to `btstack_uart_t` in h4 and h5
GATT Client: Battery Service Client
GATT Client: Device Information Service Client
GATT Client: Scan Parameters Service Client
GAP: add gap_set_page_scan_activity and gap_set_page_scan_type
GAP: add `gap_set_page_scan_activity` and `gap_set_page_scan_type`
AVRCP: new field `button_pressed` in `AVRCP_SUBEVENT_OPERATION`
### Fixed
HCI: handle start inquiry failure

View File

@ -2596,10 +2596,11 @@ typedef uint8_t sm_key_t[16];
#define AVRCP_SUBEVENT_PLAY_STATUS_QUERY 0x1B
/**
* @format 12111
* @format 121111
* @param subevent_code
* @param avrcp_cid
* @param operation_id
* @param button_pressed
* @param operands_length
* @param operand
*/

View File

@ -7770,6 +7770,15 @@ static inline uint16_t avrcp_subevent_operation_get_avrcp_cid(const uint8_t * ev
static inline uint8_t avrcp_subevent_operation_get_operation_id(const uint8_t * event){
return event[5];
}
/**
* @brief Get field button_pressed from event AVRCP_SUBEVENT_OPERATION
* @param event packet
* @return button_pressed
* @note: btstack_type 1
*/
static inline uint8_t avrcp_subevent_operation_get_button_pressed(const uint8_t * event){
return event[6];
}
/**
* @brief Get field operands_length from event AVRCP_SUBEVENT_OPERATION
* @param event packet
@ -7777,7 +7786,7 @@ static inline uint8_t avrcp_subevent_operation_get_operation_id(const uint8_t *
* @note: btstack_type 1
*/
static inline uint8_t avrcp_subevent_operation_get_operands_length(const uint8_t * event){
return event[6];
return event[7];
}
/**
* @brief Get field operand from event AVRCP_SUBEVENT_OPERATION
@ -7786,7 +7795,7 @@ static inline uint8_t avrcp_subevent_operation_get_operands_length(const uint8_t
* @note: btstack_type 1
*/
static inline uint8_t avrcp_subevent_operation_get_operand(const uint8_t * event){
return event[7];
return event[8];
}
/**

View File

@ -59,17 +59,20 @@ void avrcp_target_create_sdp_record(uint8_t * service, uint32_t service_record_h
avrcp_create_sdp_record(0, service, service_record_handle, avrcp_target_supports_browsing(supported_features), supported_features, service_name, service_provider_name);
}
static void avrcp_target_emit_operation(btstack_packet_handler_t callback, uint16_t avrcp_cid, avrcp_operation_id_t operation_id, uint8_t operands_length, uint8_t operand){
static void
avrcp_target_emit_operation(btstack_packet_handler_t callback, uint16_t avrcp_cid, avrcp_operation_id_t operation_id,
bool button_pressed, uint8_t operands_length, uint8_t operand) {
btstack_assert(callback != NULL);
uint8_t event[8];
uint8_t event[9];
int pos = 0;
event[pos++] = HCI_EVENT_AVRCP_META;
event[pos++] = sizeof(event) - 2;
event[pos++] = AVRCP_SUBEVENT_OPERATION;
little_endian_store_16(event, pos, avrcp_cid);
pos += 2;
event[pos++] = operation_id;
event[pos++] = operation_id;
event[pos++] = button_pressed ? 1 : 0;
event[pos++] = operands_length;
event[pos++] = operand;
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
@ -830,7 +833,8 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
case AVRCP_OPERATION_ID_RIGHT:
case AVRCP_OPERATION_ID_ROOT_MENU:
avrcp_target_operation_accepted(connection->avrcp_cid, (avrcp_operation_id_t) packet[6], packet[7], operand);
avrcp_target_emit_operation(avrcp_target_context.avrcp_callback, connection->avrcp_cid, operation_id, packet[7], operand);
avrcp_target_emit_operation(avrcp_target_context.avrcp_callback, connection->avrcp_cid,
operation_id, true, packet[7], operand);
break;
case AVRCP_OPERATION_ID_UNDEFINED:
avrcp_target_operation_not_implemented(connection->avrcp_cid, (avrcp_operation_id_t) packet[6], packet[7], operand);