avdtp: use capital case for defines, remove unused context from test files

This commit is contained in:
Milanka Ringwald 2020-07-20 14:41:37 +02:00
parent 23edb87eff
commit 03883c7743
6 changed files with 20 additions and 23 deletions

View File

@ -260,7 +260,7 @@ static int a2dp_and_avrcp_setup(void){
sdp_init();
// setup AVDTP sink
memset(sdp_avdtp_sink_service_buffer, 0, sizeof(sdp_avdtp_sink_service_buffer));
a2dp_sink_create_sdp_record(sdp_avdtp_sink_service_buffer, 0x10001, AVDTP_SINK_SF_Headphone, NULL, NULL);
a2dp_sink_create_sdp_record(sdp_avdtp_sink_service_buffer, 0x10001, AVDTP_SINK_SF_HEADPHONE, NULL, NULL);
sdp_register_service(sdp_avdtp_sink_service_buffer);
// setup AVRCP Controller

View File

@ -304,7 +304,7 @@ static int a2dp_source_and_avrcp_services_init(void){
// Create A2DP Source service record and register it with SDP.
memset(sdp_a2dp_source_service_buffer, 0, sizeof(sdp_a2dp_source_service_buffer));
a2dp_source_create_sdp_record(sdp_a2dp_source_service_buffer, 0x10001, AVDTP_SOURCE_SF_Player, NULL, NULL);
a2dp_source_create_sdp_record(sdp_a2dp_source_service_buffer, 0x10001, AVDTP_SOURCE_SF_PLAYER, NULL, NULL);
sdp_register_service(sdp_a2dp_source_service_buffer);
// Create AVRCP target service record and register it with SDP.

View File

@ -63,15 +63,15 @@ extern "C" {
#define AVDTP_MAX_CONTENT_PROTECTION_TYPE_VALUE_LEN 10
// Supported Features
#define AVDTP_SOURCE_SF_Player 0x0001
#define AVDTP_SOURCE_SF_Microphone 0x0002
#define AVDTP_SOURCE_SF_Tuner 0x0004
#define AVDTP_SOURCE_SF_Mixer 0x0008
#define AVDTP_SOURCE_SF_PLAYER 0x0001
#define AVDTP_SOURCE_SF_MICROPHONE 0x0002
#define AVDTP_SOURCE_SF_TUNER 0x0004
#define AVDTP_SOURCE_SF_MIXER 0x0008
#define AVDTP_SINK_SF_Headphone 0x0001
#define AVDTP_SINK_SF_Speaker 0x0002
#define AVDTP_SINK_SF_Recorder 0x0004
#define AVDTP_SINK_SF_Amplifier 0x0008
#define AVDTP_SINK_SF_HEADPHONE 0x0001
#define AVDTP_SINK_SF_SPEAKER 0x0002
#define AVDTP_SINK_SF_RECORDER 0x0004
#define AVDTP_SINK_SF_AMPLIFIER 0x0008
// ACP to INT, Signal Response Header Error Codes
#define BAD_HEADER_FORMAT 0x01

View File

@ -148,7 +148,6 @@ static uint8_t remote_seid;
static uint16_t remote_configuration_bitmap;
static avdtp_capabilities_t remote_configuration;
static avdtp_context_t a2dp_sink_context;
static btstack_packet_callback_registration_t hci_event_callback_registration;
#if defined(HAVE_PORTAUDIO) || defined(STORE_SBC_TO_WAV_FILE)
@ -718,7 +717,7 @@ int btstack_main(int argc, const char * argv[]){
l2cap_init();
// Initialize AVDTP Sink
avdtp_sink_init(&a2dp_sink_context);
avdtp_sink_init();
avdtp_sink_register_packet_handler(&packet_handler);
avdtp_stream_endpoint_t * local_stream_endpoint = avdtp_sink_create_stream_endpoint(AVDTP_SINK, AVDTP_AUDIO);
@ -734,7 +733,7 @@ int btstack_main(int argc, const char * argv[]){
// Initialize SDP
sdp_init();
memset(sdp_avdtp_sink_service_buffer, 0, sizeof(sdp_avdtp_sink_service_buffer));
a2dp_sink_create_sdp_record(sdp_avdtp_sink_service_buffer, 0x10001, 1, NULL, NULL);
a2dp_sink_create_sdp_record(sdp_avdtp_sink_service_buffer, 0x10001, AVDTP_SINK_SF_HEADPHONE, NULL, NULL);
sdp_register_service(sdp_avdtp_sink_service_buffer);
// printf("BTstack AVDTP Sink, supported features 0x%04x\n", );
gap_set_local_name("BTstack AVDTP Sink PTS 00:00:00:00:00:00");

View File

@ -130,7 +130,7 @@ static avdtp_stream_endpoint_context_t sc;
static uint16_t remote_configuration_bitmap;
static avdtp_capabilities_t remote_configuration;
static avdtp_context_t a2dp_source_context;
// static avdtp_context_t a2dp_source_context;
static btstack_sbc_encoder_state_t sbc_encoder_state;
static uint8_t is_cmd_triggered_localy = 0;
@ -144,7 +144,7 @@ static int a2dp_sample_rate(void){
return sc.sampling_frequency;
}
#if 0
static void a2dp_source_setup_media_header(uint8_t * media_packet, int size, int *offset, uint8_t marker, uint16_t sequence_number){
if (size < AVDTP_MEDIA_PAYLOAD_HEADER_SIZE){
log_error("small outgoing buffer");
@ -188,6 +188,7 @@ static void a2dp_source_copy_media_payload(uint8_t * media_packet, int size, int
*offset = pos;
}
#endif
static void a2dp_demo_send_media_packet(void){
int num_bytes_in_frame = btstack_sbc_encoder_sbc_buffer_length();
@ -265,7 +266,7 @@ static void avdtp_audio_timeout_handler(btstack_timer_source_t * timer){
context->sbc_ready_to_send = 1;
// a2dp_source_stream_endpoint_request_can_send_now(context->local_seid);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(context->local_seid, &a2dp_source_context);
avdtp_stream_endpoint_t * stream_endpoint = avdtp_get_stream_endpoint_for_seid(context->local_seid);
if (!stream_endpoint) {
printf("no stream_endpoint for seid %d\n", context->local_seid);
return;
@ -748,7 +749,7 @@ int btstack_main(int argc, const char * argv[]){
l2cap_init();
// Initialize AVDTP Sink
avdtp_source_init(&a2dp_source_context);
avdtp_source_init();
avdtp_source_register_packet_handler(&packet_handler);
sc.local_stream_endpoint = a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, (uint8_t *) media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), (uint8_t*) media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration));
@ -760,7 +761,7 @@ int btstack_main(int argc, const char * argv[]){
// Initialize SDP
sdp_init();
memset(sdp_avdtp_source_service_buffer, 0, sizeof(sdp_avdtp_source_service_buffer));
a2dp_source_create_sdp_record(sdp_avdtp_source_service_buffer, 0x10002, 1, NULL, NULL);
a2dp_source_create_sdp_record(sdp_avdtp_source_service_buffer, 0x10002, AVDTP_SOURCE_SF_PLAYER, NULL, NULL);
sdp_register_service(sdp_avdtp_source_service_buffer);
gap_set_local_name("BTstack AVDTP Source PTS 00:00:00:00:00:00");

View File

@ -153,13 +153,10 @@ static uint8_t sdp_avrcp_target_service_buffer[200];
static uint16_t avdtp_cid = 0;
static avdtp_sep_t sep;
static avdtp_stream_endpoint_t * local_stream_endpoint;
static avdtp_context_t a2dp_sink_context;
static uint8_t avrcp_value[100];
static uint16_t browsing_uid_counter = 0;
static avrcp_browsing_state_t browsing_state = AVRCP_BROWSING_STATE_IDLE;
static avdtp_context_t a2dp_source_context;
static bool auto_avrcp_browsing = false;
static bool auto_avrcp_regular = false;
@ -1803,7 +1800,7 @@ int btstack_main(int argc, const char * argv[]){
l2cap_init();
// Initialize AVDTP Sink
avdtp_sink_init(&a2dp_sink_context);
avdtp_sink_init();
avdtp_sink_register_packet_handler(&avdtp_sink_connection_establishment_packet_handler);
local_stream_endpoint = avdtp_sink_create_stream_endpoint(AVDTP_SINK, AVDTP_AUDIO);
@ -1816,7 +1813,7 @@ int btstack_main(int argc, const char * argv[]){
avdtp_sink_register_media_transport_category(local_stream_endpoint->sep.seid);
avdtp_sink_register_media_codec_category(local_stream_endpoint->sep.seid, AVDTP_AUDIO, AVDTP_CODEC_SBC, media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities));
avdtp_source_init(&a2dp_source_context);
avdtp_source_init();
avdtp_source_register_packet_handler(&avdtp_source_connection_establishment_packet_handler);
a2dp_source_create_stream_endpoint(AVDTP_AUDIO, AVDTP_CODEC_SBC, (uint8_t *) media_sbc_codec_capabilities, sizeof(media_sbc_codec_capabilities), (uint8_t*) media_sbc_codec_configuration, sizeof(media_sbc_codec_configuration));