17b02edb6SMatthias Ringwald /* 27b02edb6SMatthias Ringwald * Copyright (C) 2016 BlueKitchen GmbH 37b02edb6SMatthias Ringwald * 47b02edb6SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 57b02edb6SMatthias Ringwald * modification, are permitted provided that the following conditions 67b02edb6SMatthias Ringwald * are met: 77b02edb6SMatthias Ringwald * 87b02edb6SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 97b02edb6SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 107b02edb6SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 117b02edb6SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 127b02edb6SMatthias Ringwald * documentation and/or other materials provided with the distribution. 137b02edb6SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 147b02edb6SMatthias Ringwald * contributors may be used to endorse or promote products derived 157b02edb6SMatthias Ringwald * from this software without specific prior written permission. 167b02edb6SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 177b02edb6SMatthias Ringwald * personal benefit and not for any commercial purpose or for 187b02edb6SMatthias Ringwald * monetary gain. 197b02edb6SMatthias Ringwald * 207b02edb6SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 217b02edb6SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 227b02edb6SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 237b02edb6SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN 247b02edb6SMatthias Ringwald * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 257b02edb6SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 267b02edb6SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 277b02edb6SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 287b02edb6SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 297b02edb6SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 307b02edb6SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 317b02edb6SMatthias Ringwald * SUCH DAMAGE. 327b02edb6SMatthias Ringwald * 337b02edb6SMatthias Ringwald * Please inquire about commercial licensing options at 347b02edb6SMatthias Ringwald * [email protected] 357b02edb6SMatthias Ringwald * 367b02edb6SMatthias Ringwald */ 377b02edb6SMatthias Ringwald 387b02edb6SMatthias Ringwald /** 397b02edb6SMatthias Ringwald * Audio/Video Distribution Transport Protocol (A2DP) 407b02edb6SMatthias Ringwald * 417b02edb6SMatthias Ringwald * Code shared by A2DP Sink and A2DP Sourece, mainly automatic stream endpoitn configuration 427b02edb6SMatthias Ringwald */ 437b02edb6SMatthias Ringwald 447b02edb6SMatthias Ringwald #ifndef A2DP_H 457b02edb6SMatthias Ringwald #define A2DP_H 467b02edb6SMatthias Ringwald 477b02edb6SMatthias Ringwald #include <stdint.h> 486ed41ce8SMatthias Ringwald #include "btstack_defines.h" 496ce6ec61SMatthias Ringwald #include "classic/avdtp.h" 507b02edb6SMatthias Ringwald 517b02edb6SMatthias Ringwald #if defined __cplusplus 527b02edb6SMatthias Ringwald extern "C" { 537b02edb6SMatthias Ringwald #endif 547b02edb6SMatthias Ringwald 556ed41ce8SMatthias Ringwald // common 5615ff8d31SMatthias Ringwald void a2dp_init(void); 5715ff8d31SMatthias Ringwald 5815ff8d31SMatthias Ringwald void a2dp_deinit(void); 5915ff8d31SMatthias Ringwald 60302e9e52SMatthias Ringwald void a2dp_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint16_t service_class_uuid, 61302e9e52SMatthias Ringwald uint16_t supported_features, const char * service_name, const char * service_provider_name); 62302e9e52SMatthias Ringwald 6393aeaf99SMatthias Ringwald uint8_t a2dp_subevent_id_for_avdtp_subevent_id(uint8_t subevent); 649f84611fSMatthias Ringwald 656ed41ce8SMatthias Ringwald // source 666ed41ce8SMatthias Ringwald void a2dp_register_source_packet_handler(btstack_packet_handler_t callback); 676ed41ce8SMatthias Ringwald 686ed41ce8SMatthias Ringwald void a2dp_replace_subevent_id_and_emit_source(uint8_t * packet, uint16_t size, uint8_t subevent_id); 696ed41ce8SMatthias Ringwald 7093aeaf99SMatthias Ringwald // sink 7193aeaf99SMatthias Ringwald void a2dp_register_sink_packet_handler(btstack_packet_handler_t callback); 7293aeaf99SMatthias Ringwald 73*8e4dc1feSMatthias Ringwald void a2dp_replace_subevent_id_and_emit_sink(uint8_t *packet, uint16_t size, uint8_t subevent_id); 74*8e4dc1feSMatthias Ringwald 7593aeaf99SMatthias Ringwald // config process 7693aeaf99SMatthias Ringwald void a2dp_config_process_ready_for_sep_discovery(avdtp_role_t role, avdtp_connection_t *connection); 7793aeaf99SMatthias Ringwald 7893aeaf99SMatthias Ringwald void a2dp_config_process_avdtp_event_handler(avdtp_role_t role, uint8_t *packet, uint16_t size); 7993aeaf99SMatthias Ringwald 8093aeaf99SMatthias Ringwald uint8_t a2dp_config_process_config_init(avdtp_role_t role, avdtp_connection_t *connection, uint8_t local_seid, uint8_t remote_seid, 8193aeaf99SMatthias Ringwald avdtp_media_codec_type_t codec_type); 8293aeaf99SMatthias Ringwald void a2dp_config_process_set_config(avdtp_role_t role, avdtp_connection_t *connection); 8393aeaf99SMatthias Ringwald 84a6adb322SMatthias Ringwald uint8_t a2dp_config_process_set_sbc(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 85a6adb322SMatthias Ringwald const avdtp_configuration_sbc_t * configuration); 86a6adb322SMatthias Ringwald uint8_t a2dp_config_process_set_mpeg_audio(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 87a6adb322SMatthias Ringwald const avdtp_configuration_mpeg_audio_t * configuration); 88a6adb322SMatthias Ringwald uint8_t a2dp_config_process_set_mpeg_aac(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 89a6adb322SMatthias Ringwald const avdtp_configuration_mpeg_aac_t * configuration); 90a6adb322SMatthias Ringwald uint8_t a2dp_config_process_set_atrac(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 91a6adb322SMatthias Ringwald const avdtp_configuration_atrac_t * configuration); 92a6adb322SMatthias Ringwald uint8_t a2dp_config_process_set_other(avdtp_role_t role, uint16_t a2dp_cid, uint8_t local_seid, uint8_t remote_seid, 93a6adb322SMatthias Ringwald const uint8_t * media_codec_information, uint8_t media_codec_information_len); 94a6adb322SMatthias Ringwald 957b02edb6SMatthias Ringwald #if defined __cplusplus 967b02edb6SMatthias Ringwald } 977b02edb6SMatthias Ringwald #endif 987b02edb6SMatthias Ringwald 997b02edb6SMatthias Ringwald #endif // A2DP_H 100