mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
Merge branch 'develop' of https://github.com/bluekitchen/btstack into develop
This commit is contained in:
commit
d402ff8276
@ -1208,6 +1208,31 @@ typedef uint8_t sm_key_t[16];
|
||||
|
||||
/** AVDTP Subevent */
|
||||
|
||||
/**
|
||||
* @format 1H1
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param signal_identifier
|
||||
* @param status 0 == OK
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_ACCEPT 0x01
|
||||
|
||||
/**
|
||||
* @format 1H1
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param signal_identifier
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_REJECT 0x02
|
||||
|
||||
/**
|
||||
* @format 1H1
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param signal_identifier
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT 0x03
|
||||
|
||||
/**
|
||||
* @format 1HB1
|
||||
* @param subevent_code
|
||||
@ -1215,13 +1240,13 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param bd_addr
|
||||
* @param status 0 == OK
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED 0x01
|
||||
#define AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED 0x04
|
||||
|
||||
/**
|
||||
* @format 1
|
||||
* @param subevent_code
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED 0x02
|
||||
#define AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED 0x05
|
||||
|
||||
/**
|
||||
* @format 1H1111
|
||||
@ -1232,15 +1257,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param media_type 0-audio, 1-video, 2-multimedia
|
||||
* @param sep_type 0-source, 1-sink
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_SEP_FOUND 0x03
|
||||
|
||||
/**
|
||||
* @format 1H1
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param status 0 == OK
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_DONE 0x04
|
||||
#define AVDTP_SUBEVENT_SIGNALING_SEP_FOUND 0x06
|
||||
|
||||
/**
|
||||
* @format 1H11111111
|
||||
@ -1255,7 +1272,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param min_bitpool_value
|
||||
* @param max_bitpool_value
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY 0x05
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY 0x07
|
||||
|
||||
/**
|
||||
* @format 1H122
|
||||
@ -1266,7 +1283,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param media_codec_information_len
|
||||
* @param media_codec_information
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY 0x06
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY 0x08
|
||||
|
||||
/**
|
||||
* @format 1H1121111111
|
||||
@ -1283,7 +1300,7 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param min_bitpool_value
|
||||
* @param max_bitpool_value
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION 0x07
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CONFIGURATION 0x09
|
||||
|
||||
/**
|
||||
* @format 1H1122
|
||||
@ -1295,5 +1312,5 @@ typedef uint8_t sm_key_t[16];
|
||||
* @param media_codec_information_len
|
||||
* @param media_codec_information
|
||||
*/
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION 0x08
|
||||
#define AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CONFIGURATION 0x0A
|
||||
#endif
|
||||
|
@ -3792,6 +3792,63 @@ static inline hci_con_handle_t ancs_subevent_client_disconnected_get_handle(cons
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event AVDTP_SUBEVENT_SIGNALING_ACCEPT
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @note: btstack_type H
|
||||
*/
|
||||
static inline hci_con_handle_t avdtp_subevent_signaling_accept_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field signal_identifier from event AVDTP_SUBEVENT_SIGNALING_ACCEPT
|
||||
* @param event packet
|
||||
* @return signal_identifier
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avdtp_subevent_signaling_accept_get_signal_identifier(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event AVDTP_SUBEVENT_SIGNALING_REJECT
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @note: btstack_type H
|
||||
*/
|
||||
static inline hci_con_handle_t avdtp_subevent_signaling_reject_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field signal_identifier from event AVDTP_SUBEVENT_SIGNALING_REJECT
|
||||
* @param event packet
|
||||
* @return signal_identifier
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avdtp_subevent_signaling_reject_get_signal_identifier(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @note: btstack_type H
|
||||
*/
|
||||
static inline hci_con_handle_t avdtp_subevent_signaling_general_reject_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field signal_identifier from event AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT
|
||||
* @param event packet
|
||||
* @return signal_identifier
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avdtp_subevent_signaling_general_reject_get_signal_identifier(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED
|
||||
* @param event packet
|
||||
@ -3867,25 +3924,6 @@ static inline uint8_t avdtp_subevent_signaling_sep_found_get_sep_type(const uint
|
||||
return event[8];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event AVDTP_SUBEVENT_SIGNALING_DONE
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @note: btstack_type H
|
||||
*/
|
||||
static inline hci_con_handle_t avdtp_subevent_signaling_done_get_con_handle(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
/**
|
||||
* @brief Get field status from event AVDTP_SUBEVENT_SIGNALING_DONE
|
||||
* @param event packet
|
||||
* @return status
|
||||
* @note: btstack_type 1
|
||||
*/
|
||||
static inline uint8_t avdtp_subevent_signaling_done_get_status(const uint8_t * event){
|
||||
return event[5];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_SBC_CAPABILITY
|
||||
* @param event packet
|
||||
|
@ -366,8 +366,8 @@ typedef enum {
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_ALL_CAPABILITIES,
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_ALL_CAPABILITIES,
|
||||
// TODO move to initiator code
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CAPABILITIES,
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SET_CAPABILITIES,
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CONFIGURATION,
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SET_CONFIGURATION,
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_GET_CONFIGURATION,
|
||||
AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_GET_CONFIGURATION,
|
||||
|
||||
|
@ -230,7 +230,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t * connection, uint8_t
|
||||
stream_endpoint->remote_sep_index = i;
|
||||
}
|
||||
}
|
||||
printf(" ACP .. seid %d, index %d, in use %d\n", sep.seid, stream_endpoint->remote_sep_index, stream_endpoint->remote_seps[stream_endpoint->remote_sep_index].in_use );
|
||||
printf(" ACP .. seid %d, index %d\n", sep.seid, stream_endpoint->remote_sep_index);
|
||||
|
||||
if (stream_endpoint->remote_sep_index != 0xFF){
|
||||
if (stream_endpoint->remote_seps[stream_endpoint->remote_sep_index].in_use){
|
||||
@ -269,7 +269,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t * connection, uint8_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
avdtp_signaling_emit_accept(avdtp_sink_callback, connection->con_handle, connection->signaling_packet.signal_identifier, 0);
|
||||
break;
|
||||
}
|
||||
case AVDTP_SI_RECONFIGURE:{
|
||||
@ -319,7 +319,7 @@ void avdtp_acceptor_stream_config_subsm(avdtp_connection_t * connection, uint8_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
avdtp_signaling_emit_accept(avdtp_sink_callback, connection->con_handle, connection->signaling_packet.signal_identifier, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ void avdtp_acceptor_stream_config_subsm_run(avdtp_connection_t * connection){
|
||||
printf(" ACP: NOT IMPLEMENTED\n");
|
||||
sent = 0;
|
||||
}
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, status);
|
||||
avdtp_signaling_emit_accept(avdtp_sink_callback, connection->con_handle, connection->signaling_packet.signal_identifier, status);
|
||||
|
||||
// check fragmentation
|
||||
if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){
|
||||
|
@ -47,22 +47,27 @@
|
||||
#include "avdtp_util.h"
|
||||
#include "avdtp_initiator.h"
|
||||
|
||||
// static int avdtp_initiator_send_get_all_capabilities_cmd(uint16_t cid, uint8_t transaction_label, uint8_t sep_id){
|
||||
// uint8_t command[3];
|
||||
// command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_CMD_MSG);
|
||||
// command[1] = AVDTP_SI_GET_ALL_CAPABILITIES;
|
||||
// command[2] = sep_id << 2;
|
||||
// return l2cap_send(cid, command, sizeof(command));
|
||||
// }
|
||||
|
||||
// static int avdtp_initiator_send_get_capabilities_cmd(uint16_t cid, uint8_t transaction_label, uint8_t sep_id){
|
||||
// uint8_t command[3];
|
||||
// command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_CMD_MSG);
|
||||
// command[1] = AVDTP_SI_GET_CAPABILITIES;
|
||||
// command[2] = sep_id << 2;
|
||||
// return l2cap_send(cid, command, sizeof(command));
|
||||
// }
|
||||
|
||||
static avdtp_stream_endpoint_t * get_avdtp_stream_endpoint_associated_with_acp_seid(uint16_t acp_seid){
|
||||
btstack_linked_list_iterator_t it;
|
||||
btstack_linked_list_iterator_init(&it, (btstack_linked_list_t *) &stream_endpoints);
|
||||
while (btstack_linked_list_iterator_has_next(&it)){
|
||||
avdtp_stream_endpoint_t * stream_endpoint = (avdtp_stream_endpoint_t *)btstack_linked_list_iterator_next(&it);
|
||||
if (stream_endpoint->remote_sep_index >= 0 && stream_endpoint->remote_sep_index < MAX_NUM_SEPS){
|
||||
if (stream_endpoint->remote_seps[stream_endpoint->remote_sep_index].seid == acp_seid){
|
||||
return stream_endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
// int i;
|
||||
// for (i=0; i<stream_endpoint->remote_seps_num; i++){
|
||||
// if (stream_endpoint->remote_seps[i].seid == acp_seid){
|
||||
// return stream_endpoint;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int avdtp_initiator_send_signaling_cmd(uint16_t cid, avdtp_signal_identifier_t identifier, uint8_t transaction_label){
|
||||
uint8_t command[2];
|
||||
command[0] = avdtp_header(transaction_label, AVDTP_SINGLE_PACKET, AVDTP_CMD_MSG);
|
||||
@ -80,6 +85,8 @@ static int avdtp_initiator_send_signaling_cmd_with_seid(uint16_t cid, avdtp_sign
|
||||
|
||||
void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_t *packet, uint16_t size, int offset){
|
||||
avdtp_stream_endpoint_t * stream_endpoint = NULL;
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
int status = 0;
|
||||
|
||||
switch (connection->signaling_packet.message_type){
|
||||
case AVDTP_RESPONSE_ACCEPT_MSG:
|
||||
@ -90,12 +97,14 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
printf("AVDTP_SI_DISCOVER\n");
|
||||
if (connection->signaling_packet.transaction_label != connection->initiator_transaction_label){
|
||||
printf(" unexpected transaction label, got %d, expected %d\n", connection->signaling_packet.transaction_label, connection->initiator_transaction_label);
|
||||
return;
|
||||
status = BAD_HEADER_FORMAT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (size == 3){
|
||||
printf(" ERROR code %02x\n", packet[offset]);
|
||||
return;
|
||||
status = packet[offset];
|
||||
break;
|
||||
}
|
||||
|
||||
avdtp_sep_t sep;
|
||||
@ -105,17 +114,16 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
offset++;
|
||||
if (sep.seid < 0x01 || sep.seid > 0x3E){
|
||||
printf(" invalid sep id\n");
|
||||
return;
|
||||
status = BAD_ACP_SEID;
|
||||
break;
|
||||
}
|
||||
sep.in_use = (packet[i] >> 1) & 0x01;
|
||||
sep.media_type = (avdtp_media_type_t)(packet[i+1] >> 4);
|
||||
sep.type = (avdtp_sep_type_t)((packet[i+1] >> 3) & 0x01);
|
||||
avdtp_signaling_emit_sep(avdtp_sink_callback, connection->con_handle, sep);
|
||||
}
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
connection->initiator_transaction_label++;
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
case AVDTP_SI_GET_CAPABILITIES:
|
||||
@ -137,37 +145,16 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
break;
|
||||
}
|
||||
}
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
case AVDTP_SI_GET_CONFIGURATION:{
|
||||
printf("AVDTP_SI_GET_CONFIGURATION 0\n");
|
||||
printf("AVDTP_SI_GET_CONFIGURATION\n");
|
||||
avdtp_sep_t sep;
|
||||
sep.seid = connection->query_seid;
|
||||
sep.configured_service_categories = avdtp_unpack_service_capabilities(connection, &sep.configuration, packet+offset, size-offset);
|
||||
sep.in_use = 1;
|
||||
|
||||
printf(" INT .. seid %d, configured services 0%02x\n", sep.seid, sep.configured_service_categories);
|
||||
// find or add sep
|
||||
// int i = 0;
|
||||
// int remote_sep_index = 0xFF;
|
||||
// for (i=0; i < stream_endpoint->remote_seps_num; i++){
|
||||
// if (stream_endpoint->remote_seps[i].seid == sep.seid){
|
||||
// remote_sep_index = i;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (remote_sep_index != 0xFF){
|
||||
// stream_endpoint->remote_seps[remote_sep_index] = sep;
|
||||
// printf(" INT: update seid %d \n", stream_endpoint->remote_seps[remote_sep_index].seid);
|
||||
// } else {
|
||||
// // add new
|
||||
// stream_endpoint->remote_seps_num++;
|
||||
// stream_endpoint->remote_seps[stream_endpoint->remote_seps_num] = sep;
|
||||
// printf(" INT: add seid %d\n", stream_endpoint->remote_seps[stream_endpoint->remote_seps_num].seid);
|
||||
// }
|
||||
|
||||
if (get_bit16(sep.configured_service_categories, AVDTP_MEDIA_CODEC)){
|
||||
printf(" AVDTP_SI_GET_CONFIGURATION 1 %d\n", sep.capabilities.media_codec.media_codec_type);
|
||||
@ -179,24 +166,15 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
avdtp_signaling_emit_media_codec_other_configuration(avdtp_sink_callback, connection->con_handle, sep.capabilities.media_codec);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
printf(" AVDTP_SI_GET_CONFIGURATION 2\n");
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
case AVDTP_SI_SET_CONFIGURATION:{
|
||||
printf("AVDTP_SI_SET_CONFIGURATION\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->int_seid);
|
||||
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
avdtp_sep_t sep;
|
||||
sep.seid = connection->query_seid;
|
||||
sep.configured_service_categories = connection->remote_capabilities_bitmap;
|
||||
@ -225,26 +203,17 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
printf(" INT: add seid %d, to %p\n", stream_endpoint->remote_seps[stream_endpoint->remote_sep_index].seid, stream_endpoint);
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CONFIGURED;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
case AVDTP_SI_RECONFIGURE:
|
||||
printf("AVDTP_SI_RECONFIGURE\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->int_seid);
|
||||
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
avdtp_sep_t sep;
|
||||
sep.seid = connection->query_seid;
|
||||
sep.configured_service_categories = avdtp_unpack_service_capabilities(connection, &sep.configuration, connection->signaling_packet.command+4, connection->signaling_packet.size-4);
|
||||
sep.in_use = 1;
|
||||
|
||||
// find or add sep
|
||||
// find or sep
|
||||
int i;
|
||||
stream_endpoint->remote_sep_index = 0xFF;
|
||||
for (i=0; i < stream_endpoint->remote_seps_num; i++){
|
||||
@ -258,116 +227,76 @@ void avdtp_initiator_stream_config_subsm(avdtp_connection_t * connection, uint8_
|
||||
stream_endpoint->remote_seps[stream_endpoint->remote_sep_index] = sep;
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CONFIGURED;
|
||||
printf(" INT: update seid %d, to %p\n", stream_endpoint->remote_seps[stream_endpoint->remote_sep_index].seid, stream_endpoint);
|
||||
} else {
|
||||
// add error
|
||||
}
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
|
||||
case AVDTP_SI_SUSPEND:
|
||||
printf("AVDTP_SI_SUSPEND\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
|
||||
case AVDTP_SI_START:
|
||||
printf("AVDTP_SI_START\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_STREAMING;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case AVDTP_SI_OPEN:
|
||||
printf("AVDTP_SI_OPEN\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->query_seid);
|
||||
stream_endpoint = get_avdtp_stream_endpoint_associated_with_acp_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
|
||||
break;
|
||||
case AVDTP_SI_START:
|
||||
printf("AVDTP_SI_START\n");
|
||||
stream_endpoint = get_avdtp_stream_endpoint_associated_with_acp_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_STREAMING;
|
||||
break;
|
||||
case AVDTP_SI_SUSPEND:
|
||||
printf("AVDTP_SI_SUSPEND\n");
|
||||
stream_endpoint = get_avdtp_stream_endpoint_associated_with_acp_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED;
|
||||
break;
|
||||
case AVDTP_SI_CLOSE:
|
||||
printf("AVDTP_SI_CLOSE\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->query_seid);
|
||||
stream_endpoint = get_avdtp_stream_endpoint_associated_with_acp_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_CLOSING;
|
||||
break;
|
||||
case AVDTP_SI_ABORT:
|
||||
printf("AVDTP_SI_ABORT\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
stream_endpoint = get_avdtp_stream_endpoint_for_seid(connection->query_seid);
|
||||
stream_endpoint = get_avdtp_stream_endpoint_associated_with_acp_seid(connection->query_seid);
|
||||
if (!stream_endpoint) {
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
status = 1;
|
||||
break;
|
||||
}
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_OPENED;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 0);
|
||||
return;
|
||||
|
||||
stream_endpoint->state = AVDTP_STREAM_ENDPOINT_ABORTING;
|
||||
break;
|
||||
default:
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 1);
|
||||
status = 1;
|
||||
printf(" AVDTP_RESPONSE_ACCEPT_MSG, signal %d not implemented\n", connection->signaling_packet.signal_identifier);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AVDTP_RESPONSE_REJECT_MSG:
|
||||
printf(" AVDTP_RESPONSE_REJECT_MSG signal %d\n", connection->signaling_packet.signal_identifier);
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 1);
|
||||
avdtp_signaling_emit_reject(avdtp_sink_callback, connection->con_handle, connection->signaling_packet.signal_identifier);
|
||||
return;
|
||||
case AVDTP_GENERAL_REJECT_MSG:
|
||||
printf(" AVDTP_GENERAL_REJECT_MSG signal %d\n", connection->signaling_packet.signal_identifier);
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE;
|
||||
avdtp_signaling_emit_done(avdtp_sink_callback, connection->con_handle, 1);
|
||||
avdtp_signaling_emit_general_reject(avdtp_sink_callback, connection->con_handle, connection->signaling_packet.signal_identifier);
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
avdtp_signaling_emit_accept(avdtp_sink_callback, connection->con_handle, connection->signaling_packet.signal_identifier, status);
|
||||
}
|
||||
|
||||
void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection){
|
||||
int sent = 1;
|
||||
|
||||
switch (connection->initiator_connection_state){
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_STREAMING_STOPED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STOPED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STOPED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_CLOSE, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_STREAMING_ABORTED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_ABORTED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_ABORTED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_ABORT, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_STREAMING_STARTED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STARTED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STARTED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_START, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_MEDIA_CONNECTED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_MEDIA_CONNECTED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_MEDIA_CONNECTED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_OPEN, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_DISCOVER_SEPS:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SEPS_DISCOVERED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SEPS_DISCOVERED;
|
||||
@ -388,8 +317,8 @@ void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection){
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_GET_CONFIGURATION;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_GET_CONFIGURATION, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CAPABILITIES:{
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CAPABILITIES bitmap %02x\n", connection->remote_capabilities_bitmap);
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CONFIGURATION:{
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CONFIGURATION bitmap %02x\n", connection->remote_capabilities_bitmap);
|
||||
// printf_hexdump( connection->remote_capabilities.media_codec.media_codec_information, connection->remote_capabilities.media_codec.media_codec_information_len);
|
||||
connection->signaling_packet.acp_seid = connection->query_seid;
|
||||
connection->signaling_packet.int_seid = connection->int_seid;
|
||||
@ -400,17 +329,12 @@ void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection){
|
||||
uint8_t * out_buffer = l2cap_get_outgoing_buffer();
|
||||
uint16_t pos = avdtp_signaling_create_fragment(connection->l2cap_signaling_cid, &connection->signaling_packet, out_buffer);
|
||||
if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SET_CAPABILITIES;
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SET_CONFIGURATION;
|
||||
printf(" INT: fragmented\n");
|
||||
}
|
||||
l2cap_send_prepared(connection->l2cap_signaling_cid, pos);
|
||||
break;
|
||||
}
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SUSPEND_STREAM_WITH_SEID:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SUSPEND_STREAM_WITH_SEID\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SUSPEND_STREAM_WITH_SEID;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_SUSPEND, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_RECONFIGURE_STREAM_WITH_SEID:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_RECONFIGURE_STREAM_WITH_SEID\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_RECONFIGURE_STREAM_WITH_SEID;
|
||||
@ -429,8 +353,33 @@ void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection){
|
||||
}
|
||||
l2cap_send_prepared(connection->l2cap_signaling_cid, pos);
|
||||
break;
|
||||
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_MEDIA_CONNECTED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_MEDIA_CONNECTED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_MEDIA_CONNECTED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_OPEN, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SUSPEND_STREAM_WITH_SEID:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SUSPEND_STREAM_WITH_SEID\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_SUSPEND_STREAM_WITH_SEID;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_SUSPEND, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_STREAMING_STARTED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STARTED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STARTED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_START, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_STREAMING_STOPED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STOPED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_STOPED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_CLOSE, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
case AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_L2CAP_FOR_STREAMING_ABORTED:
|
||||
printf(" INT: AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_ABORTED\n");
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W4_L2CAP_FOR_STREAMING_ABORTED;
|
||||
avdtp_initiator_send_signaling_cmd_with_seid(connection->l2cap_signaling_cid, AVDTP_SI_ABORT, connection->initiator_transaction_label, connection->query_seid);
|
||||
break;
|
||||
default:
|
||||
sent = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -438,29 +387,4 @@ void avdtp_initiator_stream_config_subsm_run(avdtp_connection_t * connection){
|
||||
if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){
|
||||
avdtp_sink_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
|
||||
if (sent) return;
|
||||
|
||||
avdtp_stream_endpoint_t * stream_endpoint = NULL;
|
||||
if (!stream_endpoint) return;
|
||||
switch (stream_endpoint->initiator_config_state){
|
||||
// case AVDTP_INITIATOR_W2_GET_CAPABILITIES:
|
||||
// printf(" INT: AVDTP_INITIATOR_W2_GET_CAPABILITIES INT: AVDTP_INITIATOR_W4_CAPABILITIES\n");
|
||||
// stream_endpoint->initiator_config_state = AVDTP_INITIATOR_W4_CAPABILITIES;
|
||||
// avdtp_initiator_send_get_capabilities_cmd(connection->l2cap_signaling_cid, connection->initiator_transaction_label, connection->query_seid);
|
||||
// break;
|
||||
// case AVDTP_INITIATOR_W2_GET_ALL_CAPABILITIES:
|
||||
// printf(" INT: AVDTP_INITIATOR_W2_GET_ALL_CAPABILITIES INT: AVDTP_INITIATOR_W4_ALL_CAPABILITIES\n");
|
||||
// stream_endpoint->initiator_config_state = AVDTP_INITIATOR_W4_ALL_CAPABILITIES;
|
||||
// avdtp_initiator_send_get_all_capabilities_cmd(connection->l2cap_signaling_cid, connection->initiator_transaction_label, connection->query_seid);
|
||||
// break;
|
||||
default:
|
||||
sent = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// check fragmentation
|
||||
if (connection->signaling_packet.packet_type != AVDTP_SINGLE_PACKET && connection->signaling_packet.packet_type != AVDTP_END_PACKET){
|
||||
avdtp_sink_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
}
|
||||
|
@ -845,7 +845,13 @@ void avdtp_sink_set_configuration(uint16_t con_handle, uint8_t acp_seid, uint8_t
|
||||
}
|
||||
if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) return;
|
||||
if (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE) return;
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CAPABILITIES;
|
||||
|
||||
avdtp_stream_endpoint_t * stream_endpoint = get_avdtp_stream_endpoint_for_seid(int_seid);
|
||||
if (!stream_endpoint) {
|
||||
printf("avdtp_sink_set_configuration: no initiator stream endpoint for seid %d\n", int_seid);
|
||||
return;
|
||||
}
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SET_CONFIGURATION;
|
||||
connection->initiator_transaction_label++;
|
||||
connection->query_seid = acp_seid;
|
||||
connection->int_seid = int_seid;
|
||||
@ -864,6 +870,7 @@ void avdtp_sink_suspend(uint16_t con_handle, uint8_t seid){
|
||||
if (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE) return;
|
||||
avdtp_stream_endpoint_t * stream_endpoint = get_avdtp_stream_endpoint_for_seid(seid);
|
||||
if (!stream_endpoint) return;
|
||||
|
||||
connection->initiator_transaction_label++;
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_SUSPEND_STREAM_WITH_SEID;
|
||||
connection->query_seid = seid;
|
||||
@ -877,13 +884,15 @@ void avdtp_sink_reconfigure(uint16_t con_handle, uint8_t seid){
|
||||
printf("avdtp_sink_reconfigure: no connection for handle 0x%02x found\n", con_handle);
|
||||
return;
|
||||
}
|
||||
//TODO: if opened only app capabilities, enable reconfigure for not opened
|
||||
if (connection->state != AVDTP_SIGNALING_CONNECTION_OPENED) return;
|
||||
if (connection->initiator_connection_state != AVDTP_SIGNALING_CONNECTION_INITIATOR_IDLE) return;
|
||||
avdtp_stream_endpoint_t * stream_endpoint = get_avdtp_stream_endpoint_for_seid(seid);
|
||||
if (!stream_endpoint) return;
|
||||
connection->initiator_transaction_label++;
|
||||
connection->initiator_connection_state = AVDTP_SIGNALING_CONNECTION_INITIATOR_W2_RECONFIGURE_STREAM_WITH_SEID;
|
||||
connection->query_seid = seid;
|
||||
|
||||
//TODO: check if it is registered in remote_seps
|
||||
connection->query_seid = seid;
|
||||
avdtp_sink_request_can_send_now_initiator(connection, connection->l2cap_signaling_cid);
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
case AVDTP_SUBEVENT_SIGNALING_MEDIA_CODEC_OTHER_CAPABILITY:
|
||||
printf(" received non SBC codec. not implemented\n");
|
||||
break;
|
||||
case AVDTP_SUBEVENT_SIGNALING_DONE:
|
||||
case AVDTP_SUBEVENT_SIGNALING_ACCEPT:
|
||||
app_state = AVDTP_APPLICATION_IDLE;
|
||||
break;
|
||||
default:
|
||||
@ -525,8 +525,8 @@ static void show_usage(void){
|
||||
}
|
||||
|
||||
static const uint8_t media_sbc_codec_info[] = {
|
||||
(AVDTP_SBC_44100 << 4) | AVDTP_SBC_STEREO,
|
||||
(AVDTP_SBC_BLOCK_LENGTH_16 << 4) | (AVDTP_SBC_SUBBANDS_8 << 2) | AVDTP_SBC_ALLOCATION_METHOD_LOUDNESS,
|
||||
0xFF,//(AVDTP_SBC_44100 << 4) | AVDTP_SBC_STEREO,
|
||||
0xFF,//(AVDTP_SBC_BLOCK_LENGTH_16 << 4) | (AVDTP_SBC_SUBBANDS_8 << 2) | AVDTP_SBC_ALLOCATION_METHOD_LOUDNESS,
|
||||
2, 53
|
||||
};
|
||||
|
||||
|
@ -416,16 +416,43 @@ void avdtp_signaling_emit_sep(btstack_packet_handler_t callback, uint16_t con_ha
|
||||
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
void avdtp_signaling_emit_done(btstack_packet_handler_t callback, uint16_t con_handle, uint8_t status){
|
||||
void avdtp_signaling_emit_accept(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_signal_identifier_t identifier, uint8_t status){
|
||||
if (!callback) return;
|
||||
uint8_t event[7];
|
||||
int pos = 0;
|
||||
event[pos++] = HCI_EVENT_AVDTP_META;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = AVDTP_SUBEVENT_SIGNALING_ACCEPT;
|
||||
little_endian_store_16(event, pos, con_handle);
|
||||
pos += 2;
|
||||
event[pos++] = identifier;
|
||||
event[pos++] = status;
|
||||
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
void avdtp_signaling_emit_reject(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_signal_identifier_t identifier){
|
||||
if (!callback) return;
|
||||
uint8_t event[6];
|
||||
int pos = 0;
|
||||
event[pos++] = HCI_EVENT_AVDTP_META;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = AVDTP_SUBEVENT_SIGNALING_DONE;
|
||||
event[pos++] = AVDTP_SUBEVENT_SIGNALING_REJECT;
|
||||
little_endian_store_16(event, pos, con_handle);
|
||||
pos += 2;
|
||||
event[pos++] = status;
|
||||
event[pos++] = identifier;
|
||||
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
void avdtp_signaling_emit_general_reject(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_signal_identifier_t identifier){
|
||||
if (!callback) return;
|
||||
uint8_t event[6];
|
||||
int pos = 0;
|
||||
event[pos++] = HCI_EVENT_AVDTP_META;
|
||||
event[pos++] = sizeof(event) - 2;
|
||||
event[pos++] = AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT;
|
||||
little_endian_store_16(event, pos, con_handle);
|
||||
pos += 2;
|
||||
event[pos++] = identifier;
|
||||
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -463,7 +490,11 @@ void avdtp_signaling_emit_media_codec_other_capability(btstack_packet_handler_t
|
||||
pos += 2;
|
||||
little_endian_store_16(event, pos, media_codec.media_codec_information_len);
|
||||
pos += 2;
|
||||
memcpy(event+pos, media_codec.media_codec_information, media_codec.media_codec_information_len);
|
||||
if (media_codec.media_codec_information_len < 100){
|
||||
memcpy(event+pos, media_codec.media_codec_information, media_codec.media_codec_information_len);
|
||||
} else {
|
||||
memcpy(event+pos, media_codec.media_codec_information, 100);
|
||||
}
|
||||
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
@ -571,8 +602,12 @@ static inline void avdtp_signaling_emit_media_codec_other(btstack_packet_handler
|
||||
pos += 2;
|
||||
little_endian_store_16(event, pos, media_codec.media_codec_information_len);
|
||||
pos += 2;
|
||||
memcpy(event+pos, media_codec.media_codec_information, media_codec.media_codec_information_len);
|
||||
|
||||
if (media_codec.media_codec_information_len < 100){
|
||||
memcpy(event+pos, media_codec.media_codec_information, media_codec.media_codec_information_len);
|
||||
} else {
|
||||
memcpy(event+pos, media_codec.media_codec_information, 100);
|
||||
}
|
||||
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,10 @@ int avdtp_signaling_create_fragment(uint16_t cid, avdtp_signaling_packet_t * sig
|
||||
|
||||
void avdtp_signaling_emit_connection_established(btstack_packet_handler_t callback, uint16_t con_handle, bd_addr_t addr, uint8_t status);
|
||||
void avdtp_signaling_emit_sep(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_sep_t sep);
|
||||
void avdtp_signaling_emit_done(btstack_packet_handler_t callback, uint16_t con_handle, uint8_t status);
|
||||
void avdtp_signaling_emit_accept(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_signal_identifier_t identifier, uint8_t status);
|
||||
void avdtp_signaling_emit_general_reject(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_signal_identifier_t identifier);
|
||||
void avdtp_signaling_emit_reject(btstack_packet_handler_t callback, uint16_t con_handle, avdtp_signal_identifier_t identifier);
|
||||
|
||||
|
||||
void avdtp_signaling_emit_media_codec_sbc_capability(btstack_packet_handler_t callback, uint16_t con_handle, adtvp_media_codec_capabilities_t media_codec);
|
||||
void avdtp_signaling_emit_media_codec_other_capability(btstack_packet_handler_t callback, uint16_t con_handle, adtvp_media_codec_capabilities_t media_codec);
|
||||
|
Loading…
x
Reference in New Issue
Block a user