mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 06:39:53 +00:00
avdtp: add avdtp_get_signaling_packet_type
This commit is contained in:
parent
025463b22e
commit
c1c40ea129
@ -362,14 +362,18 @@ avdtp_stream_endpoint_t * avdtp_create_stream_endpoint(avdtp_sep_type_t sep_type
|
||||
return stream_endpoint;
|
||||
}
|
||||
|
||||
|
||||
static void handle_l2cap_data_packet_for_signaling_connection(avdtp_connection_t * connection, uint8_t *packet, uint16_t size, avdtp_context_t * context){
|
||||
int offset = avdtp_read_signaling_header(&connection->signaling_packet, packet, size);
|
||||
switch (connection->signaling_packet.message_type){
|
||||
if (size < 2) return;
|
||||
|
||||
uint16_t offset;
|
||||
avdtp_message_type_t message_type = avdtp_get_signaling_packet_type(packet);
|
||||
switch (message_type){
|
||||
case AVDTP_CMD_MSG:
|
||||
offset = avdtp_read_signaling_header(&connection->signaling_packet, packet, size);
|
||||
avdtp_acceptor_stream_config_subsm(connection, packet, size, offset, context);
|
||||
break;
|
||||
default:
|
||||
offset = avdtp_read_signaling_header(&connection->signaling_packet, packet, size);
|
||||
avdtp_initiator_stream_config_subsm(connection, packet, size, offset, context);
|
||||
break;
|
||||
}
|
||||
|
@ -213,6 +213,10 @@ uint16_t store_bit16(uint16_t bitmap, int position, uint8_t value){
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
avdtp_message_type_t avdtp_get_signaling_packet_type(uint8_t * packet){
|
||||
return (avdtp_message_type_t) (packet[0] & 0x03);
|
||||
}
|
||||
|
||||
int avdtp_read_signaling_header(avdtp_signaling_packet_t * signaling_header, uint8_t * packet, uint16_t size){
|
||||
int pos = 0;
|
||||
if (size < 2) return pos;
|
||||
|
@ -65,6 +65,8 @@ static inline uint8_t avdtp_header(uint8_t tr_label, avdtp_packet_type_t packet_
|
||||
return (tr_label<<4) | ((uint8_t)packet_type<<2) | (uint8_t)msg_type;
|
||||
}
|
||||
|
||||
avdtp_message_type_t avdtp_get_signaling_packet_type(uint8_t * packet);
|
||||
|
||||
int avdtp_read_signaling_header(avdtp_signaling_packet_t * signaling_header, uint8_t * packet, uint16_t size);
|
||||
|
||||
uint16_t store_bit16(uint16_t bitmap, int position, uint8_t value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user