mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-29 12:32:54 +00:00
avrcp: pass AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID and AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID events to client
This commit is contained in:
parent
4795fc1ab4
commit
4f5eb79778
@ -2413,13 +2413,60 @@ typedef uint8_t sm_key_t[16];
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE 0x24
|
||||
|
||||
/**
|
||||
* @format 1214
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param playback_position_ms
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED 0x25
|
||||
|
||||
/*
|
||||
* @format 12111
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param status
|
||||
* @param event_id
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID 0x26
|
||||
/*
|
||||
* @format 1211
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param status
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID_DONE 0x27
|
||||
|
||||
/*
|
||||
* @format 12113
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param status
|
||||
* @param company_id
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID 0x28
|
||||
/*
|
||||
* @format 1211
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param status
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID_DONE 0x29
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @format 1B2
|
||||
* @param subevent_code
|
||||
* @param bd_addr
|
||||
* @param browsing_cid
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION 0x25
|
||||
#define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION 0x30
|
||||
|
||||
/**
|
||||
* @format 11B2
|
||||
@ -2428,14 +2475,14 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param bd_addr
|
||||
* @param browsing_cid
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED 0x26
|
||||
#define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED 0x31
|
||||
|
||||
/**
|
||||
* @format 12
|
||||
* @param subevent_code
|
||||
* @param browsing_cid
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED 0x27
|
||||
#define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED 0x32
|
||||
|
||||
/**
|
||||
* @format 12211
|
||||
@ -2445,7 +2492,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param browsing_status
|
||||
* @param bluetooth_status
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_BROWSING_DONE 0x28
|
||||
#define AVRCP_SUBEVENT_BROWSING_DONE 0x33
|
||||
|
||||
/**
|
||||
* @format 1214
|
||||
@ -2454,7 +2501,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param scope
|
||||
* @param attr_bitmap
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS 0x29
|
||||
#define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS 0x34
|
||||
|
||||
/**
|
||||
* @format 121
|
||||
@ -2462,16 +2509,9 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param browsing_cid
|
||||
* @param scope
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS 0x2A
|
||||
#define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS 0x35
|
||||
|
||||
|
||||
/**
|
||||
* @format 1214
|
||||
* @param subevent_code
|
||||
* @param avrcp_cid
|
||||
* @param command_type
|
||||
* @param playback_position_ms
|
||||
*/
|
||||
#define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED 0x2B
|
||||
|
||||
|
||||
/**
|
||||
|
@ -6724,6 +6724,164 @@ static inline uint8_t avrcp_subevent_now_playing_info_done_get_status(const uint
|
||||
return event[6];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED
|
||||
* @param event packet
|
||||
* @return avrcp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_notification_playback_pos_changed_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_notification_playback_pos_changed_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field playback_position_ms from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED
|
||||
* @param event packet
|
||||
* @return playback_position_ms
|
||||
* @note: btstack_type 4
|
||||
*/
|
||||
static inline uint32_t avrcp_subevent_notification_playback_pos_changed_get_playback_position_ms(const uint8_t * event){
|
||||
return little_endian_read_32(event, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field avrcp_cid from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID
|
||||
* @param event packet
|
||||
* @return avrcp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_get_capability_event_id_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_event_id_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field status from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID
|
||||
* @param event packet
|
||||
* @return status
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_event_id_get_status(const uint8_t * event){
|
||||
return event[6];
|
||||
}
|
||||
/**
|
||||
* @brief Get field event_id from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID
|
||||
* @param event packet
|
||||
* @return event_id
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_event_id_get_event_id(const uint8_t * event){
|
||||
return event[7];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field avrcp_cid from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID_DONE
|
||||
* @param event packet
|
||||
* @return avrcp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_get_capability_event_id_done_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID_DONE
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_event_id_done_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field status from event AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID_DONE
|
||||
* @param event packet
|
||||
* @return status
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_event_id_done_get_status(const uint8_t * event){
|
||||
return event[6];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field avrcp_cid from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID
|
||||
* @param event packet
|
||||
* @return avrcp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_get_capability_company_id_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_company_id_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field status from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID
|
||||
* @param event packet
|
||||
* @return status
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_company_id_get_status(const uint8_t * event){
|
||||
return event[6];
|
||||
}
|
||||
/**
|
||||
* @brief Get field company_id from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID
|
||||
* @param event packet
|
||||
* @return company_id
|
||||
* @note: btstack_type 3
|
||||
*/
|
||||
static inline uint32_t avrcp_subevent_get_capability_company_id_get_company_id(const uint8_t * event){
|
||||
return little_endian_read_24(event, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field avrcp_cid from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID_DONE
|
||||
* @param event packet
|
||||
* @return avrcp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_get_capability_company_id_done_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID_DONE
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_company_id_done_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field status from event AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID_DONE
|
||||
* @param event packet
|
||||
* @return status
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_get_capability_company_id_done_get_status(const uint8_t * event){
|
||||
return event[6];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field bd_addr from event AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION
|
||||
* @param event packet
|
||||
@ -6865,34 +7023,6 @@ static inline uint8_t avrcp_subevent_browsing_get_total_num_items_get_scope(cons
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED
|
||||
* @param event packet
|
||||
* @return avrcp_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t avrcp_subevent_notification_playback_pos_changed_get_avrcp_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED
|
||||
* @param event packet
|
||||
* @return command_type
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avrcp_subevent_notification_playback_pos_changed_get_command_type(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
/**
|
||||
* @brief Get field playback_position_ms from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED
|
||||
* @param event packet
|
||||
* @return playback_position_ms
|
||||
* @note: btstack_type 4
|
||||
*/
|
||||
static inline uint32_t avrcp_subevent_notification_playback_pos_changed_get_playback_position_ms(const uint8_t * event){
|
||||
return little_endian_read_32(event, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field goep_cid from event GOEP_SUBEVENT_CONNECTION_OPENED
|
||||
* @param event packet
|
||||
|
@ -572,19 +572,68 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
|
||||
avrcp_capability_id_t capability_id = (avrcp_capability_id_t) packet[pos++];
|
||||
uint8_t capability_count = packet[pos++];
|
||||
int i;
|
||||
|
||||
switch (capability_id){
|
||||
int offset = 0;
|
||||
uint8_t event[10];
|
||||
|
||||
case AVRCP_CAPABILITY_ID_COMPANY:
|
||||
for (i = 0; i < capability_count; i++){
|
||||
uint32_t company_id = big_endian_read_24(packet, pos);
|
||||
pos += 3;
|
||||
log_info(" 0x%06" PRIx32 ", ", company_id);
|
||||
|
||||
offset = 0;
|
||||
event[offset++] = HCI_EVENT_AVRCP_META;
|
||||
event[offset++] = sizeof(event) - 2;
|
||||
event[offset++] = AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID;
|
||||
little_endian_store_16(event, offset, connection->avrcp_cid);
|
||||
offset += 2;
|
||||
event[offset++] = ctype;
|
||||
event[offset++] = 0;
|
||||
little_endian_store_24(event, offset, company_id);
|
||||
offset += 3;
|
||||
(*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, offset);
|
||||
break;
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
event[offset++] = HCI_EVENT_AVRCP_META;
|
||||
event[offset++] = sizeof(event) - 2;
|
||||
event[offset++] = AVRCP_SUBEVENT_GET_CAPABILITY_COMPANY_ID_DONE;
|
||||
little_endian_store_16(event, offset, connection->avrcp_cid);
|
||||
offset += 2;
|
||||
event[offset++] = ctype;
|
||||
event[offset++] = 0;
|
||||
(*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, offset);
|
||||
break;
|
||||
|
||||
case AVRCP_CAPABILITY_ID_EVENT:
|
||||
for (i = 0; i < capability_count; i++){
|
||||
uint8_t event_id = packet[pos++];
|
||||
log_info(" 0x%02x %s", event_id, avrcp_event2str(event_id));
|
||||
|
||||
offset = 0;
|
||||
event[offset++] = HCI_EVENT_AVRCP_META;
|
||||
event[offset++] = sizeof(event) - 2;
|
||||
event[offset++] = AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID;
|
||||
little_endian_store_16(event, offset, connection->avrcp_cid);
|
||||
offset += 2;
|
||||
event[offset++] = ctype;
|
||||
event[offset++] = 0;
|
||||
event[offset++] = event_id;
|
||||
(*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, offset);
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
event[offset++] = HCI_EVENT_AVRCP_META;
|
||||
event[offset++] = sizeof(event) - 2;
|
||||
event[offset++] = AVRCP_SUBEVENT_GET_CAPABILITY_EVENT_ID_DONE;
|
||||
little_endian_store_16(event, offset, connection->avrcp_cid);
|
||||
offset += 2;
|
||||
event[offset++] = ctype;
|
||||
event[offset++] = 0;
|
||||
(*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user