a2dp_source.c (67673f1cc201341f9ffbfc67d22aa84e26381efe) | a2dp_source.c (34b22aac0913b061ca6c0da686fd034f9e188df1) |
---|---|
1 2/* 3 * Copyright (C) 2016 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 185 unchanged lines hidden (view full) --- 194 uint16_t cid; 195 bd_addr_t address; 196 197 if (packet_type != HCI_EVENT_PACKET) return; 198 if (hci_event_packet_get_type(packet) != HCI_EVENT_AVDTP_META) return; 199 200 switch (packet[2]){ 201 case AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED: | 1 2/* 3 * Copyright (C) 2016 BlueKitchen GmbH 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 185 unchanged lines hidden (view full) --- 194 uint16_t cid; 195 bd_addr_t address; 196 197 if (packet_type != HCI_EVENT_PACKET) return; 198 if (hci_event_packet_get_type(packet) != HCI_EVENT_AVDTP_META) return; 199 200 switch (packet[2]){ 201 case AVDTP_SUBEVENT_SIGNALING_CONNECTION_ESTABLISHED: |
202 // TODO cmp bt addr | |
203 avdtp_subevent_signaling_connection_established_get_bd_addr(packet, address); 204 if (memcmp(address, &sc.remote_addr, 6) != 0) break; 205 206 cid = avdtp_subevent_signaling_connection_established_get_avdtp_cid(packet); 207 status = avdtp_subevent_signaling_connection_established_get_status(packet); 208 if (status != 0){ 209 log_info("AVDTP_SUBEVENT_SIGNALING_CONNECTION failed status %d ---", status); 210 a2dp_streaming_emit_connection_established(a2dp_source_context.a2dp_callback, cid, 0, 0, status); --- 192 unchanged lines hidden (view full) --- 403 signal_identifier = avdtp_subevent_signaling_reject_get_signal_identifier(packet); 404 log_info("Rejected %d", signal_identifier); 405 break; 406 case AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT: 407 app_state = A2DP_IDLE; 408 signal_identifier = avdtp_subevent_signaling_general_reject_get_signal_identifier(packet); 409 log_info("Rejected %d", signal_identifier); 410 break; | 202 avdtp_subevent_signaling_connection_established_get_bd_addr(packet, address); 203 if (memcmp(address, &sc.remote_addr, 6) != 0) break; 204 205 cid = avdtp_subevent_signaling_connection_established_get_avdtp_cid(packet); 206 status = avdtp_subevent_signaling_connection_established_get_status(packet); 207 if (status != 0){ 208 log_info("AVDTP_SUBEVENT_SIGNALING_CONNECTION failed status %d ---", status); 209 a2dp_streaming_emit_connection_established(a2dp_source_context.a2dp_callback, cid, 0, 0, status); --- 192 unchanged lines hidden (view full) --- 402 signal_identifier = avdtp_subevent_signaling_reject_get_signal_identifier(packet); 403 log_info("Rejected %d", signal_identifier); 404 break; 405 case AVDTP_SUBEVENT_SIGNALING_GENERAL_REJECT: 406 app_state = A2DP_IDLE; 407 signal_identifier = avdtp_subevent_signaling_general_reject_get_signal_identifier(packet); 408 log_info("Rejected %d", signal_identifier); 409 break; |
410 case AVDTP_SUBEVENT_STREAMING_CONNECTION_RELEASED:{ 411 uint8_t event[6]; 412 int pos = 0; 413 event[pos++] = HCI_EVENT_AVDTP_META; 414 event[pos++] = sizeof(event) - 2; 415 event[pos++] = A2DP_SUBEVENT_STREAM_RELEASED; 416 little_endian_store_16(event, pos, avdtp_subevent_streaming_connection_released_get_avdtp_cid(packet)); 417 pos += 2; 418 event[pos++] = avdtp_subevent_streaming_connection_released_get_local_seid(packet); 419 (*a2dp_source_context.a2dp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); 420 break; 421 } 422 case AVDTP_SUBEVENT_SIGNALING_CONNECTION_RELEASED: 423 break; |
|
411 default: 412 app_state = A2DP_IDLE; 413 log_info("not implemented"); 414 break; 415 } 416} 417void a2dp_source_register_packet_handler(btstack_packet_handler_t callback){ 418 if (callback == NULL){ --- 147 unchanged lines hidden --- | 424 default: 425 app_state = A2DP_IDLE; 426 log_info("not implemented"); 427 break; 428 } 429} 430void a2dp_source_register_packet_handler(btstack_packet_handler_t callback){ 431 if (callback == NULL){ --- 147 unchanged lines hidden --- |