mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 02:42:33 +00:00
a2dp_source: move a2dp_source_streaming_emit_connection_failed into a2dp
This commit is contained in:
parent
6ed41ce813
commit
6ce6ec6136
@ -35,6 +35,17 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "a2dp.h"
|
||||
#include "l2cap.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "classic/avdtp_source.h"
|
||||
#include "classic/a2dp_source.h"
|
||||
#include "btstack_event.h"
|
||||
#include "bluetooth_sdp.h"
|
||||
#include "bluetooth_psm.h"
|
||||
|
||||
#define BTSTACK_FILE__ "a2dp.c"
|
||||
|
||||
#include <stddef.h>
|
||||
@ -69,3 +80,18 @@ void a2dp_emit_source_stream_event(uint16_t cid, uint8_t local_seid, uint8_t sub
|
||||
a2dp_emit_stream_event(a2dp_source_callback, cid, local_seid, subevent_id);
|
||||
}
|
||||
|
||||
void a2dp_emit_source_streaming_connection_failed(avdtp_connection_t *connection, uint8_t status) {
|
||||
uint8_t event[14];
|
||||
int pos = 0;
|
||||
event[pos++] = HCI_EVENT_A2DP_META;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = A2DP_SUBEVENT_STREAM_ESTABLISHED;
|
||||
little_endian_store_16(event, pos, connection->avdtp_cid);
|
||||
pos += 2;
|
||||
reverse_bd_addr(connection->remote_addr, &event[pos]);
|
||||
pos += 6;
|
||||
event[pos++] = 0;
|
||||
event[pos++] = 0;
|
||||
event[pos++] = status;
|
||||
a2dp_emit_source(event, sizeof(event));
|
||||
}
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "btstack_defines.h"
|
||||
#include "classic/avdtp.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
@ -65,6 +66,8 @@ void a2dp_replace_subevent_id_and_emit_source(uint8_t * packet, uint16_t size, u
|
||||
|
||||
void a2dp_emit_source_stream_event(uint16_t cid, uint8_t local_seid, uint8_t subevent_id);
|
||||
|
||||
void a2dp_emit_source_streaming_connection_failed(avdtp_connection_t *connection, uint8_t status);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/sdp_util.h"
|
||||
#include "l2cap.h"
|
||||
#include "a2dp.h"
|
||||
|
||||
#define AVDTP_MAX_SEP_NUM 10
|
||||
#define A2DP_SET_CONFIG_DELAY_MS 200
|
||||
@ -83,22 +84,6 @@ static bool a2dp_source_set_config_timer_active;
|
||||
static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
|
||||
static void a2dp_discover_seps_with_next_waiting_connection(void);
|
||||
|
||||
static void a2dp_source_streaming_emit_connection_failed(avdtp_connection_t *connection, uint8_t status) {
|
||||
uint8_t event[14];
|
||||
int pos = 0;
|
||||
event[pos++] = HCI_EVENT_A2DP_META;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = A2DP_SUBEVENT_STREAM_ESTABLISHED;
|
||||
little_endian_store_16(event, pos, connection->avdtp_cid);
|
||||
pos += 2;
|
||||
reverse_bd_addr(connection->remote_addr, &event[pos]);
|
||||
pos += 6;
|
||||
event[pos++] = 0;
|
||||
event[pos++] = 0;
|
||||
event[pos++] = status;
|
||||
a2dp_emit_source(event, sizeof(event));
|
||||
}
|
||||
|
||||
void a2dp_source_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t supported_features, const char * service_name, const char * service_provider_name){
|
||||
uint8_t* attribute;
|
||||
de_create_sequence(service);
|
||||
@ -406,7 +391,8 @@ static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t ch
|
||||
connection->a2dp_source_outgoing_active = false;
|
||||
connection = avdtp_get_connection_for_avdtp_cid(cid);
|
||||
btstack_assert(connection != NULL);
|
||||
a2dp_source_streaming_emit_connection_failed(connection, ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND);
|
||||
a2dp_emit_source_streaming_connection_failed(connection,
|
||||
ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND);
|
||||
}
|
||||
|
||||
// continue
|
||||
@ -550,7 +536,8 @@ static void a2dp_source_packet_handler_internal(uint8_t packet_type, uint16_t ch
|
||||
connection->a2dp_source_outgoing_active = false;
|
||||
connection = avdtp_get_connection_for_avdtp_cid(cid);
|
||||
btstack_assert(connection != NULL);
|
||||
a2dp_source_streaming_emit_connection_failed(connection, ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND);
|
||||
a2dp_emit_source_streaming_connection_failed(connection,
|
||||
ERROR_CODE_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND);
|
||||
}
|
||||
connection->a2dp_source_state = A2DP_CONNECTED;
|
||||
a2dp_source_sep_discovery_cid = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user