xref: /btstack/src/classic/avdtp_sink.h (revision 3e3fbf3df68dce1ab27af5efcdf0ea980eb93f6c)
1 /*
2  * Copyright (C) 2016 BlueKitchen GmbH
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holders nor the names of
14  *    contributors may be used to endorse or promote products derived
15  *    from this software without specific prior written permission.
16  * 4. Any redistribution, use, or modification is done solely for
17  *    personal benefit and not for any commercial purpose or for
18  *    monetary gain.
19  *
20  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * Please inquire about commercial licensing options at
34  * [email protected]
35  *
36  */
37 
38 /*
39  * avdtp_sink.h
40  *
41  * Audio/Video Distribution Transport Protocol (AVDTP) Sink
42  *
43  * AVDTP Sink is a device that accepts streamed media data.
44  */
45 
46 #ifndef __AVDTP_SINK_H
47 #define __AVDTP_SINK_H
48 
49 #include <stdint.h>
50 #include "hci.h"
51 #include "avdtp.h"
52 
53 #if defined __cplusplus
54 extern "C" {
55 #endif
56 
57 /* API_START */
58 
59 /**
60  * @brief Set up AVDTP Sink device.
61  */
62 void avdtp_sink_init(void);
63 
64 // returns avdtp_stream_endpoint_t *
65 avdtp_stream_endpoint_t * avdtp_sink_create_stream_endpoint(avdtp_sep_type_t sep_type, avdtp_media_type_t media_type);
66 
67 void avdtp_sink_register_media_transport_category(uint8_t seid);
68 void avdtp_sink_register_reporting_category(uint8_t seid);
69 void avdtp_sink_register_delay_reporting_category(uint8_t seid);
70 void avdtp_sink_register_recovery_category(uint8_t seid, uint8_t maximum_recovery_window_size, uint8_t maximum_number_media_packets);
71 void avdtp_sink_register_header_compression_category(uint8_t seid, uint8_t back_ch, uint8_t media, uint8_t recovery);
72 void avdtp_sink_register_multiplexing_category(uint8_t seid, uint8_t fragmentation);
73 
74 void avdtp_sink_register_media_codec_category(uint8_t seid, avdtp_media_type_t media_type, avdtp_media_codec_type_t media_codec_type, uint8_t * media_codec_info, uint16_t media_codec_info_len);
75 void avdtp_sink_register_content_protection_category(uint8_t seid, uint16_t cp_type, const uint8_t * cp_type_value, uint8_t cp_type_value_len);
76 
77 /**
78  * @brief Register callback for the AVDTP Sink client.
79  * @param callback
80  */
81 void avdtp_sink_register_packet_handler(btstack_packet_handler_t callback);
82 
83 /**
84  * @brief Connect to device with a bluetooth address. (and perform configuration?)
85  * @param bd_addr
86  */
87 void avdtp_sink_connect(bd_addr_t bd_addr);
88 
89 void avdtp_sink_register_media_handler(void (*callback)(avdtp_stream_endpoint_t * stream_endpoint, uint8_t *packet, uint16_t size));
90 /**
91  * @brief Disconnect from device with connection handle.
92  * @param avdtp_cid
93  */
94 void avdtp_sink_disconnect(uint16_t avdtp_cid);
95 
96 /**
97  * @brief Discover stream endpoints
98  * @param avdtp_cid
99  */
100 void avdtp_sink_discover_stream_endpoints(uint16_t avdtp_cid);
101 
102 /**
103  * @brief Get capabilities
104  * @param avdtp_cid
105  */
106 void avdtp_sink_get_capabilities(uint16_t avdtp_cid, uint8_t acp_seid);
107 
108 /**
109  * @brief Get all capabilities
110  * @param avdtp_cid
111  */
112 void avdtp_sink_get_all_capabilities(uint16_t avdtp_cid, uint8_t acp_seid);
113 
114 /**
115  * @brief Set configuration
116  * @param avdtp_cid
117  */
118 void avdtp_sink_set_configuration(uint16_t avdtp_cid, uint8_t int_seid, uint8_t acp_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration);
119 
120 /**
121  * @brief Reconfigure stream
122  * @param avdtp_cid
123  * @param seid
124  */
125 void avdtp_sink_reconfigure(uint16_t avdtp_cid, uint8_t int_seid, uint8_t acp_seid, uint16_t configured_services_bitmap, avdtp_capabilities_t configuration);
126 
127 /**
128  * @brief Get configuration
129  * @param avdtp_cid
130  */
131 void avdtp_sink_get_configuration(uint16_t avdtp_cid, uint8_t acp_seid);
132 
133 
134 /**
135  * @brief Open stream
136  * @param avdtp_cid
137  * @param seid
138  */
139 void avdtp_sink_open_stream(uint16_t avdtp_cid, uint8_t int_seid, uint8_t acp_seid);
140 
141 
142 /**
143  * @brief Start stream
144  * @param local_seid
145  */
146 void avdtp_sink_start_stream(uint8_t local_seid);
147 
148 /**
149  * @brief Abort stream
150  * @param local_seid
151  */
152 void avdtp_sink_abort_stream(uint8_t local_seid);
153 
154 /**
155  * @brief Start stream
156  * @param local_seid
157  */
158 void avdtp_sink_stop_stream(uint8_t local_seid);
159 
160 /**
161  * @brief Suspend stream
162  * @param local_seid
163  */
164 void avdtp_sink_suspend(uint8_t local_seid);
165 
166 /* API_END */
167 
168 
169 #if defined __cplusplus
170 }
171 #endif
172 
173 #endif // __AVDTP_SINK_H