mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-11 18:40:22 +00:00
avrcp: support SDP record without service name and/or provider
This commit is contained in:
parent
1041da4bfc
commit
141dff406a
@ -67,11 +67,6 @@ typedef struct {
|
||||
static void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
static void avrcp_start_next_sdp_query(void);
|
||||
|
||||
static const char * avrcp_default_controller_service_name = "AVRCP Controller";
|
||||
static const char * avrcp_default_controller_service_provider_name = "BlueKitchen";
|
||||
static const char * avrcp_default_target_service_name = "AVRCP Target";
|
||||
static const char * avrcp_default_target_service_provider_name = "BlueKitchen";
|
||||
|
||||
static const char * avrcp_subunit_type_name[] = {
|
||||
"MONITOR", "AUDIO", "PRINTER", "DISC", "TAPE_RECORDER_PLAYER", "TUNER",
|
||||
"CA", "CAMERA", "RESERVED", "PANEL", "BULLETIN_BOARD", "CAMERA_STORAGE",
|
||||
@ -341,27 +336,15 @@ void avrcp_create_sdp_record(bool controller, uint8_t * service, uint32_t servic
|
||||
|
||||
|
||||
// 0x0100 "Service Name"
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, 0x0100);
|
||||
if (service_name){
|
||||
if (strlen(service_name) > 0){
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, 0x0100);
|
||||
de_add_data(service, DE_STRING, (uint16_t) strlen(service_name), (uint8_t *) service_name);
|
||||
} else {
|
||||
if (controller){
|
||||
de_add_data(service, DE_STRING, (uint16_t) strlen(avrcp_default_controller_service_name), (uint8_t *) avrcp_default_controller_service_name);
|
||||
} else {
|
||||
de_add_data(service, DE_STRING, (uint16_t) strlen(avrcp_default_target_service_name), (uint8_t *) avrcp_default_target_service_name);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x0100 "Provider Name"
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, 0x0102);
|
||||
if (service_provider_name){
|
||||
if (strlen(service_provider_name) > 0){
|
||||
de_add_number(service, DE_UINT, DE_SIZE_16, 0x0102);
|
||||
de_add_data(service, DE_STRING, (uint16_t) strlen(service_provider_name), (uint8_t *) service_provider_name);
|
||||
} else {
|
||||
if (controller){
|
||||
de_add_data(service, DE_STRING, (uint16_t) strlen(avrcp_default_controller_service_provider_name), (uint8_t *) avrcp_default_controller_service_provider_name);
|
||||
} else {
|
||||
de_add_data(service, DE_STRING, (uint16_t) strlen(avrcp_default_target_service_provider_name), (uint8_t *) avrcp_default_target_service_provider_name);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x0311 "Supported Features"
|
||||
|
@ -50,6 +50,9 @@
|
||||
#include "btstack_util.h"
|
||||
#include "l2cap.h"
|
||||
|
||||
static const char * avrcp_default_controller_service_name = "AVRCP Controller";
|
||||
static const char * avrcp_default_controller_service_provider_name = "BlueKitchen";
|
||||
|
||||
// made public in avrcp_controller.h
|
||||
avrcp_context_t avrcp_controller_context;
|
||||
|
||||
@ -1354,6 +1357,12 @@ static void avrcp_controller_packet_handler(uint8_t packet_type, uint16_t channe
|
||||
}
|
||||
|
||||
void avrcp_controller_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){
|
||||
if (service_name == NULL){
|
||||
service_name = avrcp_default_controller_service_name;
|
||||
}
|
||||
if (service_provider_name == NULL){
|
||||
service_provider_name = avrcp_default_controller_service_provider_name;
|
||||
}
|
||||
avrcp_create_sdp_record(true, service, service_record_handle, avrcp_controller_supports_browsing(supported_features), supported_features, service_name, service_provider_name);
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ typedef enum {
|
||||
* @param service
|
||||
* @param service_record_handle
|
||||
* @param supported_features 16-bit bitmap, see AVRCP_FEATURE_MASK_* in avrcp.h
|
||||
* @param service_name
|
||||
* @param service_provider_name
|
||||
* @param service_name or NULL for default value. Provide "" (empty string) to skip attribute
|
||||
* @param service_provider_name or NULL for default value. Provide "" (empty string) to skip attribute
|
||||
*/
|
||||
void avrcp_controller_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
|
||||
|
@ -57,6 +57,9 @@
|
||||
static const uint8_t AVRCP_NOTIFICATION_TRACK_SELECTED[] = {0,0,0,0,0,0,0,0};
|
||||
static const uint8_t AVRCP_NOTIFICATION_TRACK_NOT_SELECTED[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
|
||||
|
||||
static const char * avrcp_default_target_service_name = "AVRCP Target";
|
||||
static const char * avrcp_default_target_service_provider_name = "BlueKitchen";
|
||||
|
||||
avrcp_context_t avrcp_target_context;
|
||||
|
||||
static uint32_t default_companies[] = {
|
||||
@ -68,6 +71,12 @@ static int avrcp_target_supports_browsing(uint16_t target_supported_features){
|
||||
}
|
||||
|
||||
void avrcp_target_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){
|
||||
if (service_name == NULL){
|
||||
service_name = avrcp_default_target_service_name;
|
||||
}
|
||||
if (service_provider_name == NULL){
|
||||
service_provider_name = avrcp_default_target_service_provider_name;
|
||||
}
|
||||
avrcp_create_sdp_record(false, service, service_record_handle, avrcp_target_supports_browsing(supported_features), supported_features, service_name, service_provider_name);
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ typedef enum {
|
||||
* @param service
|
||||
* @param service_record_handle
|
||||
* @param supported_features 16-bit bitmap, see AVRCP_FEATURE_MASK_* in avrcp.h
|
||||
* @param service_name
|
||||
* @param service_provider_name
|
||||
* @param service_name or NULL for default value. Provide "" (empty string) to skip attribute
|
||||
* @param service_provider_name or NULL for default value. Provide "" (empty string) to skip attribute
|
||||
*/
|
||||
void avrcp_target_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user