xref: /btstack/src/classic/avrcp.h (revision 6973c35a87cc7f398c429d8942b18d0a401e28a3)
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  * avrcp.h
40  *
41  * Audio/Video Remote Control Profile
42  *
43  */
44 
45 #ifndef __AVRCP_H
46 #define __AVRCP_H
47 
48 #include <stdint.h>
49 #include "btstack_run_loop.h"
50 #include "btstack_linked_list.h"
51 
52 #if defined __cplusplus
53 extern "C" {
54 #endif
55 
56 #define BT_SIG_COMPANY_ID 0x001958
57 #define AVRCP_MEDIA_ATTR_COUNT 7
58 #define AVRCP_MAX_ATTRIBUTTE_SIZE 100
59 #define AVRCP_ATTRIBUTE_HEADER_LEN  8
60 
61 typedef enum {
62     AVRCP_STATUS_INVALID_COMMAND = 0,           // sent if TG received a PDU that it did not understand.
63     AVRCP_STATUS_INVALID_PARAMETER,             // Sent if the TG received a PDU with a parameter ID that it did not understand, or, if there is only one parameter ID in the PDU.
64     AVRCP_STATUS_SPECIFIED_PARAMETER_NOT_FOUND, // sent if the parameter ID is understood, but content is wrong or corrupted.
65     AVRCP_STATUS_INTERNAL_ERROR,                // sent if there are error conditions not covered by a more specific error code.
66     AVRCP_STATUS_SUCCESS,                       // sent if the operation was successful.
67     AVRCP_STATUS_UID_CHANGED,                   // sent if the UIDs on the device have changed.
68     AVRCP_STATUS_RESERVED_6,
69     AVRCP_STATUS_INVALID_DIRECTION,             // The Direction parameter is invalid. Valid for command: Change Path
70     AVRCP_STATUS_NOT_A_DIRECTORY,               // The UID provided does not refer to a folder item. Valid for command: Change Path
71     AVRCP_STATUS_DOES_NOT_EXIST,                // The UID provided does not refer to any currently valid. Valid for command: Change Path, PlayItem, AddToNowPlaying, GetItemAttributes
72     AVRCP_STATUS_INVALID_SCOPE,                 // The scope parameter is invalid. Valid for command: GetFolderItems, PlayItem, AddToNowPlayer, GetItemAttributes,
73     AVRCP_STATUS_RANGE_OUT_OF_BOUNDS,           // The start of range provided is not valid. Valid for command: GetFolderItems
74     AVRCP_STATUS_UID_IS_A_DIRECTORY,            // The UID provided refers to a directory, which cannot be handled by this media player. Valid for command: PlayItem, AddToNowPlaying
75     AVRCP_STATUS_MEDIA_IN_USE,                  // The media is not able to be used for this operation at this time. Valid for command: PlayItem, AddToNowPlaying
76     AVRCP_STATUS_NOW_PLAYING_LIST_FULL,         // No more items can be added to the Now Playing List. Valid for command: AddToNowPlaying
77     AVRCP_STATUS_SEARCH_NOT_SUPPORTED,          // The Browsed Media Player does not support search. Valid for command: Search
78     AVRCP_STATUS_SEARCH_IN_PROGRESS,            // A search operation is already in progress. Valid for command: Search
79     AVRCP_STATUS_INVALID_PLAYER_ID,             // The specified Player Id does not refer to a valid player. Valid for command: SetAddressedPlayer, SetBrowsedPlayer
80     AVRCP_STATUS_PLAYER_NOT_BROWSABLE,          // The Player Id supplied refers to a Media Player which does not support browsing. Valid for command: SetBrowsedPlayer
81     AVRCP_STATUS_PLAYER_NOT_ADDRESSED,          // The Player Id supplied refers to a player which is not currently addressed, and the command is not able to be performed if the player is not set as addressed. Valid for command: Search SetBrowsedPlayer
82     AVRCP_STATUS_NO_VALID_SEARCH_RESULTS,       // The Search result list does not contain valid entries, e.g. after being invalidated due to change of browsed player. Valid for command: GetFolderItems
83     AVRCP_STATUS_NO_AVAILABLE_PLAYERS,
84     AVRCP_STATUS_ADDRESSED_PLAYER_CHANGED,       // Valid for command: Register Notification
85     AVRCP_STATUS_RESERVED                       // 0x17 - 0xFF
86 } avrcp_status_code_t;
87 
88 typedef enum {
89     AVRCP_SINGLE_PACKET= 0,
90     AVRCP_START_PACKET    ,
91     AVRCP_CONTINUE_PACKET ,
92     AVRCP_END_PACKET
93 } avrcp_packet_type_t;
94 
95 typedef enum {
96     AVRCP_COMMAND_FRAME = 0,
97     AVRCP_RESPONSE_FRAME
98 } avrcp_frame_type_t;
99 
100 
101 typedef enum {
102     AVRCP_CAPABILITY_ID_COMPANY = 0x02,
103     AVRCP_CAPABILITY_ID_EVENT = 0x03
104 } avrcp_capability_id_t;
105 
106 typedef enum {
107     AVRCP_MEDIA_ATTR_ALL = 0,
108     AVRCP_MEDIA_ATTR_TITLE,
109     AVRCP_MEDIA_ATTR_ARTIST,
110     AVRCP_MEDIA_ATTR_ALBUM,
111     AVRCP_MEDIA_ATTR_TRACK,
112     AVRCP_MEDIA_ATTR_TOTAL_TRACKS,
113     AVRCP_MEDIA_ATTR_GENRE,
114     AVRCP_MEDIA_ATTR_SONG_LENGTH_MS,
115     AVRCP_MEDIA_ATTR_NONE = 0xFFFFFFFF
116 } avrcp_media_attribute_id_t;
117 
118 typedef enum {
119     AVRCP_PDU_ID_GET_CAPABILITIES = 0x10,
120     AVRCP_PDU_ID_GetCurrentPlayerApplicationSettingValue = 0x13,
121     AVRCP_PDU_ID_SetPlayerApplicationSettingValue = 0x14,
122     AVRCP_PDU_ID_GET_ELEMENT_ATTRIBUTES = 0x20,
123     AVRCP_PDU_ID_GET_PLAY_STATUS = 0x30,
124     AVRCP_PDU_ID_REGISTER_NOTIFICATION = 0x31,
125     AVRCP_PDU_ID_REQUEST_CONTINUING_RESPONSE = 0x40,
126     AVRCP_PDU_ID_REQUEST_ABORT_CONTINUING_RESPONSE = 0x41,
127     AVRCP_PDU_ID_SET_ABSOLUTE_VOLUME = 0x50,
128     AVRCP_PDU_ID_SET_ADDRESSED_PLAYER = 0x60,
129     AVRCP_PDU_ID_SET_BROWSED_PLAYER = 0x70,
130     AVRCP_PDU_ID_GET_FOLDER_ITEMS = 0x71,
131     AVRCP_PDU_ID_CHANGE_PATH = 0x72,
132     AVRCP_PDU_ID_UNDEFINED = 0xFF
133 } avrcp_pdu_id_t;
134 
135 typedef enum {
136     AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED = 0x01,            // Change in playback status of the current track.
137     AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED = 0x02,                      // Change of current track
138     AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END = 0x03,                  // Reached end of a track
139     AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START = 0x04,                // Reached start of a track
140     AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED = 0x05,               // Change in playback position. Returned after the specified playback notification change notification interval
141     AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED = 0x06,                // Change in battery status
142     AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED = 0x07,              // Change in system status
143     AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED = 0x08, // Change in player application setting
144     AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED = 0x09,        // The content of the Now Playing list has changed, see 6.9.5.
145     AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED = 0x0a,          // The available players have changed, see 6.9.4.
146     AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b,           // The Addressed Player has been changed, see 6.9.2.
147     AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED = 0x0c,                       // The UIDs have changed, see 6.10.3.3.
148     AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED = 0x0d                      // The volume has been changed locally on the TG, see 6.13.3.
149 } avrcp_notification_event_id_t;
150 
151 // control command response: accepted, rejected, interim
152 // status  command response: not implemented, rejected, in transition, stable
153 // notify  command response: not implemented, rejected, changed
154 
155 typedef enum {
156     AVRCP_CTYPE_CONTROL = 0,
157     AVRCP_CTYPE_STATUS,
158     AVRCP_CTYPE_SPECIFIC_INQUIRY,
159     AVRCP_CTYPE_NOTIFY,
160     AVRCP_CTYPE_GENERAL_INQUIRY,
161     AVRCP_CTYPE_RESERVED5,
162     AVRCP_CTYPE_RESERVED6,
163     AVRCP_CTYPE_RESERVED7,
164     AVRCP_CTYPE_RESPONSE_NOT_IMPLEMENTED = 8,
165     AVRCP_CTYPE_RESPONSE_ACCEPTED,
166     AVRCP_CTYPE_RESPONSE_REJECTED,
167     AVRCP_CTYPE_RESPONSE_IN_TRANSITION, // target state is in transition. A subsequent STATUS command, may result in the return of a STABLE status
168     AVRCP_CTYPE_RESPONSE_IMPLEMENTED_STABLE,
169     AVRCP_CTYPE_RESPONSE_CHANGED_STABLE,
170     AVRCP_CTYPE_RESPONSE_RESERVED,
171     AVRCP_CTYPE_RESPONSE_INTERIM            // target is unable to respond with either ACCEPTED or REJECTED within 100 millisecond
172 } avrcp_command_type_t;
173 
174 typedef enum {
175     AVRCP_SUBUNIT_TYPE_MONITOR = 0,
176     AVRCP_SUBUNIT_TYPE_AUDIO = 1,
177     AVRCP_SUBUNIT_TYPE_PRINTER,
178     AVRCP_SUBUNIT_TYPE_DISC,
179     AVRCP_SUBUNIT_TYPE_TAPE_RECORDER_PLAYER,
180     AVRCP_SUBUNIT_TYPE_TUNER,
181     AVRCP_SUBUNIT_TYPE_CA,
182     AVRCP_SUBUNIT_TYPE_CAMERA,
183     AVRCP_SUBUNIT_TYPE_RESERVED,
184     AVRCP_SUBUNIT_TYPE_PANEL = 9,
185     AVRCP_SUBUNIT_TYPE_BULLETIN_BOARD,
186     AVRCP_SUBUNIT_TYPE_CAMERA_STORAGE,
187     AVRCP_SUBUNIT_TYPE_VENDOR_UNIQUE = 0x1C,
188     AVRCP_SUBUNIT_TYPE_RESERVED_FOR_ALL_SUBUNIT_TYPES,
189     AVRCP_SUBUNIT_TYPE_EXTENDED_TO_NEXT_BYTE, // The unit_type field may take value 1E16, which means that the field is extended to the following byte. In that case, an additional byte for extended_unit_type will be added immediately following operand[1].
190                                               // Further extension is possible when the value of extended_unit_type is FF16, in which case another byte will be added.
191     AVRCP_SUBUNIT_TYPE_UNIT = 0x1F
192 } avrcp_subunit_type_t;
193 
194 typedef enum {
195     AVRCP_SUBUNIT_ID = 0,
196     AVRCP_SUBUNIT_ID_IGNORE = 7
197 } avrcp_subunit_id_t;
198 
199 typedef enum {
200     AVRCP_CMD_OPCODE_VENDOR_DEPENDENT = 0x00,
201     // AVRCP_CMD_OPCODE_RESERVE = 0x01,
202     AVRCP_CMD_OPCODE_UNIT_INFO = 0x30,
203     AVRCP_CMD_OPCODE_SUBUNIT_INFO = 0x31,
204     AVRCP_CMD_OPCODE_PASS_THROUGH = 0x7C,
205     // AVRCP_CMD_OPCODE_VERSION = 0xB0,
206     // AVRCP_CMD_OPCODE_POWER = 0xB2,
207     AVRCP_CMD_OPCODE_UNDEFINED = 0xFF
208 } avrcp_command_opcode_t;
209 
210 typedef enum {
211     AVRCP_OPERATION_ID_SKIP = 0x3C,
212     AVRCP_OPERATION_ID_VOLUME_UP = 0x41,
213     AVRCP_OPERATION_ID_VOLUME_DOWN = 0x42,
214     AVRCP_OPERATION_ID_MUTE = 0x43,
215 
216     AVRCP_OPERATION_ID_PLAY = 0x44,
217     AVRCP_OPERATION_ID_STOP = 0x45,
218     AVRCP_OPERATION_ID_PAUSE = 0x46,
219     AVRCP_OPERATION_ID_REWIND = 0x48,
220     AVRCP_OPERATION_ID_FAST_FORWARD = 0x49,
221     AVRCP_OPERATION_ID_FORWARD = 0x4B,
222     AVRCP_OPERATION_ID_BACKWARD = 0x4C,
223     AVRCP_OPERATION_ID_UNDEFINED = 0xFF
224 } avrcp_operation_id_t;
225 
226 typedef enum{
227     AVRCP_PLAYBACK_STATUS_STOPPED = 0x00,
228     AVRCP_PLAYBACK_STATUS_PLAYING,
229     AVRCP_PLAYBACK_STATUS_PAUSED,
230     AVRCP_PLAYBACK_STATUS_FWD_SEEK,
231     AVRCP_PLAYBACK_STATUS_REV_SEEK,
232     AVRCP_PLAYBACK_STATUS_ERROR = 0xFF
233 } avrcp_playback_status_t;
234 
235 typedef enum{
236     AVRCP_BATTERY_STATUS_NORMAL = 0x00, // Battery operation is in normal state
237     AVRCP_BATTERY_STATUS_WARNING,       // unable to operate soon. Is provided when the battery level is going down.
238     AVRCP_BATTERY_STATUS_CRITICAL,      // can not operate any more. Is provided when the battery level is going down.
239     AVRCP_BATTERY_STATUS_EXTERNAL,      // Plugged to external power supply
240     AVRCP_BATTERY_STATUS_FULL_CHARGE    // when the device is completely charged from the external power supply
241 } avrcp_battery_status_t;
242 
243 
244 typedef enum {
245     AVCTP_CONNECTION_IDLE,
246     AVCTP_CONNECTION_W4_SDP_QUERY_COMPLETE,
247     AVCTP_CONNECTION_W4_ERTM_CONFIGURATION,
248     AVCTP_CONNECTION_W4_L2CAP_CONNECTED,
249     AVCTP_CONNECTION_OPENED,
250     AVCTP_W2_SEND_PRESS_COMMAND,
251     AVCTP_W2_SEND_RELEASE_COMMAND,
252     AVCTP_W4_STOP,
253     AVCTP_W2_SEND_COMMAND,
254     AVCTP_W2_SEND_RESPONSE,
255     AVCTP_W2_RECEIVE_PRESS_RESPONSE,
256     AVCTP_W2_RECEIVE_RESPONSE
257 } avctp_connection_state_t;
258 
259 typedef struct {
260     uint16_t len;
261     uint8_t  * value;
262 } avrcp_now_playing_info_item_t;
263 
264 typedef struct {
265     uint8_t track_id[8];
266     uint16_t track_nr;
267     char * title;
268     char * artist;
269     char * album;
270     char * genre;
271     uint32_t song_length_ms;
272     uint32_t song_position_ms;
273 } avrcp_track_t;
274 
275 typedef enum {
276     AVRCP_PARSER_IDLE = 0,
277     AVRCP_PARSER_GET_ATTRIBUTE_HEADER,       // 8 bytes
278     AVRCP_PARSER_GET_ATTRIBUTE_VALUE,
279     AVRCP_PARSER_IGNORE_ATTRIBUTE_VALUE
280 } avrcp_parser_state_t;
281 
282 // BROWSING
283 typedef struct {
284     uint16_t l2cap_browsing_cid;
285 
286     avctp_connection_state_t state;
287     uint8_t  wait_to_send;
288     uint8_t  transaction_label;
289     // used for AVCTP fragmentation
290     uint8_t  num_packets;
291     uint16_t bytes_to_send;
292 
293     uint8_t *ertm_buffer;
294     uint32_t ertm_buffer_size;
295     l2cap_ertm_config_t ertm_config;
296 
297     // players
298     uint8_t  set_addressed_player_id;
299     uint8_t  set_browsed_player_id;
300 
301     uint16_t addressed_player_id;
302     uint16_t browsed_player_id;
303     uint16_t browsed_player_uid_counter;
304 
305     // get folder item
306     uint8_t  get_folder_item;
307     uint8_t  scope;
308     uint32_t start_item;
309     uint32_t end_item;
310     uint32_t attr_bitmap;
311 
312     // change_path
313     uint8_t  change_path;
314     uint8_t  direction;
315     uint16_t uid_counter;
316     uint8_t  folder_uid[8];
317 } avrcp_browsing_connection_t;
318 // BROWSING END
319 
320 typedef struct {
321     btstack_linked_item_t    item;
322     bd_addr_t remote_addr;
323     uint16_t l2cap_signaling_cid;
324     uint16_t avrcp_cid;
325 
326     uint16_t avrcp_browsing_cid;
327     uint16_t browsing_l2cap_psm;
328     uint16_t browsing_version;
329 
330     avrcp_browsing_connection_t * browsing_connection;
331 
332     avctp_connection_state_t state;
333     uint8_t wait_to_send;
334 
335     // command
336     uint8_t transaction_label;
337     avrcp_command_opcode_t command_opcode;
338     avrcp_command_type_t command_type;
339     avrcp_subunit_type_t subunit_type;
340     avrcp_subunit_id_t   subunit_id;
341     avrcp_packet_type_t  packet_type;
342 
343     uint8_t cmd_operands[20];
344     uint8_t cmd_operands_length;
345     btstack_timer_source_t press_and_hold_cmd_timer;
346     uint8_t  continuous_fast_forward_cmd;
347     uint16_t notifications_enabled;
348     uint16_t notifications_to_register;
349     uint16_t notifications_to_deregister;
350 
351     avrcp_subunit_type_t unit_type;
352     uint32_t company_id;
353     avrcp_subunit_type_t subunit_info_type;
354     const uint8_t * subunit_info_data;
355     uint16_t subunit_info_data_size;
356 
357     avrcp_now_playing_info_item_t now_playing_info[AVRCP_MEDIA_ATTR_COUNT];
358     uint8_t  track_id[8];
359     uint32_t song_length_ms;
360     uint32_t song_position_ms;
361     int total_tracks;
362     int track_nr;
363     uint8_t track_selected;
364     uint8_t track_changed;
365 
366     avrcp_playback_status_t playback_status;
367     uint8_t playback_status_changed;
368 
369     uint8_t playing_content_changed;
370 
371     avrcp_battery_status_t battery_status;
372     uint8_t battery_status_changed;
373     uint8_t volume_percentage;
374     uint8_t volume_percentage_changed;
375     uint8_t now_playing_info_response;
376     uint8_t now_playing_info_attr_bitmap;
377     uint8_t abort_continue_response;
378 
379     // used for fragmentation
380     avrcp_media_attribute_id_t next_attr_id;
381 
382     avrcp_parser_state_t parser_state;
383     uint8_t  parser_attribute_header[AVRCP_ATTRIBUTE_HEADER_LEN];
384     uint8_t  parser_attribute_header_pos;
385 
386     uint16_t list_size;
387     uint16_t list_offset;
388     uint8_t  attribute_value[AVRCP_MAX_ATTRIBUTTE_SIZE];
389     uint16_t attribute_value_len;
390     uint16_t attribute_value_offset;
391 
392     uint32_t attribute_id;
393 
394     uint8_t  num_attributes;
395     uint8_t  num_parsed_attributes;
396 } avrcp_connection_t;
397 
398 typedef enum {
399     AVRCP_SHUFFLE_MODE_INVALID,
400     AVRCP_SHUFFLE_MODE_OFF,
401     AVRCP_SHUFFLE_MODE_ALL_TRACKS,
402     AVRCP_SHUFFLE_MODE_GROUP
403 } avrcp_shuffle_mode_t;
404 
405 typedef enum {
406     AVRCP_REPEAT_MODE_INVALID,
407     AVRCP_REPEAT_MODE_OFF,
408     AVRCP_REPEAT_MODE_SINGLE_TRACK,
409     AVRCP_REPEAT_MODE_ALL_TRACKS,
410     AVRCP_REPEAT_MODE_GROUP
411 } avrcp_repeat_mode_t;
412 
413 typedef enum{
414     AVRCP_CONTROLLER = 0,
415     AVRCP_TARGET
416 } avrcp_role_t;
417 
418 typedef enum {
419     RFC2978_CHARSET_MIB_UTF8 = 106
420 } rfc2978_charset_mib_enumid_t;
421 
422 typedef struct {
423     avrcp_role_t role;
424     btstack_linked_list_t connections;
425     btstack_packet_handler_t avrcp_callback;
426     btstack_packet_handler_t packet_handler;
427 
428     btstack_packet_handler_t browsing_avrcp_callback;
429     btstack_packet_handler_t browsing_packet_handler;
430 
431     // SDP query
432     uint8_t parse_sdp_record;
433     uint32_t record_id;
434     uint16_t avrcp_cid;
435     uint16_t avrcp_l2cap_psm;
436     uint16_t avrcp_version;
437 } avrcp_context_t;
438 
439 
440 const char * avrcp_subunit2str(uint16_t index);
441 const char * avrcp_event2str(uint16_t index);
442 const char * avrcp_operation2str(uint8_t index);
443 const char * avrcp_attribute2str(uint8_t index);
444 const char * avrcp_play_status2str(uint8_t index);
445 const char * avrcp_ctype2str(uint8_t index);
446 const char * avrcp_repeat2str(uint8_t index);
447 const char * avrcp_shuffle2str(uint8_t index);
448 
449 void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, avrcp_context_t * context);
450 
451 void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
452 uint8_t avrcp_connect(bd_addr_t bd_addr, avrcp_context_t * context, uint16_t * avrcp_cid);
453 void avrcp_emit_connection_established(btstack_packet_handler_t callback, uint16_t avrcp_cid, bd_addr_t addr, uint8_t status);
454 void avrcp_emit_connection_closed(btstack_packet_handler_t callback, uint16_t avrcp_cid);
455 
456 uint8_t avrcp_cmd_opcode(uint8_t *packet, uint16_t size);
457 avrcp_connection_t * get_avrcp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avrcp_context_t * context);
458 avrcp_connection_t * get_avrcp_connection_for_avrcp_cid(uint16_t avrcp_cid, avrcp_context_t * context);
459 avrcp_connection_t * get_avrcp_connection_for_bd_addr(bd_addr_t addr, avrcp_context_t * context);
460 void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid);
461 uint16_t avrcp_get_next_cid(void);
462 
463 // SDP query
464 void avrcp_handle_sdp_client_query_result(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
465 
466 #if defined __cplusplus
467 }
468 #endif
469 
470 #endif // __AVRCP_H