xref: /btstack/src/classic/avrcp_browsing_controller.h (revision 954cc391b7ff237c6d9460ea14cf8b96b1fbd1e4)
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_browsing_controller.h
40  *
41  * Audio/Video Remote Control Profile Browsing
42  *
43  */
44 
45 #ifndef __AVRCP_BROWSING_CONTROLLER_H
46 #define __AVRCP_BROWSING_CONTROLLER_H
47 
48 #include <stdint.h>
49 #include "avrcp.h"
50 
51 #if defined __cplusplus
52 extern "C" {
53 #endif
54 
55 
56 /* API_START */
57 
58 typedef enum {
59 	AVRCP_BROWSING_MEDIA_PLAYER_ITEM = 0x01,
60 	AVRCP_BROWSING_FOLDER_ITEM,
61 	AVRCP_BROWSING_MEDIA_ELEMENT_ITEM
62 } avrcp_browsing_item_type_t;
63 
64 typedef enum {
65 	AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_AUDIO = 1,
66 	AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_VIDEO = 2,
67 	AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_BROADCASTING_AUDIO = 4,
68 	AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_BROADCASTING_VIDEO = 8
69 } avrcp_browsing_media_player_major_type_t;
70 
71 typedef enum {
72 	AVRCP_BROWSING_MEDIA_PLAYER_SUBTYPE_AUDIO_BOOK = 1,
73 	AVRCP_BROWSING_MEDIA_PLAYER_SUBTYPE_POADCAST   = 2
74 } avrcp_browsing_media_player_subtype_t;
75 
76 typedef enum {
77 	AVRCP_BROWSING_MEDIA_PLAYER_STATUS_STOPPED = 0,
78 	AVRCP_BROWSING_MEDIA_PLAYER_STATUS_PLAYING,
79 	AVRCP_BROWSING_MEDIA_PLAYER_STATUS_PAUSED,
80 	AVRCP_BROWSING_MEDIA_PLAYER_STATUS_FWD_SEEK,
81 	AVRCP_BROWSING_MEDIA_PLAYER_STATUS_REV_SEEK,
82 	AVRCP_BROWSING_MEDIA_PLAYER_STATUS_ERROR = 0xFF
83 } avrcp_browsing_media_player_status_t;
84 
85 typedef enum {
86 	AVRCP_BROWSING_FOLDER_TYPE_MIXED = 0x00,
87 	AVRCP_BROWSING_FOLDER_TYPE_TITLES,
88 	AVRCP_BROWSING_FOLDER_TYPE_ALBUMS,
89 	AVRCP_BROWSING_FOLDER_TYPE_ARTISTS,
90 	AVRCP_BROWSING_FOLDER_TYPE_GENRES,
91 	AVRCP_BROWSING_FOLDER_TYPE_PLAYLISTS,
92 	AVRCP_BROWSING_FOLDER_TYPE_YEARS
93 } avrcp_browsing_folder_type_t;
94 
95 typedef enum {
96 	AVRCP_BROWSING_MEDIA_TYPE_AUDIO = 0x00,
97 	AVRCP_BROWSING_MEDIA_TYPE_VIDEO
98 } avrcp_browsing_media_type_t;
99 
100 /**
101  * @brief Set up AVRCP Browsing Controller device.
102  */
103 void avrcp_browsing_controller_init(void);
104 
105 /**
106  * @brief Register callback for the AVRCP Browsing Controller client.
107  * @param callback
108  */
109 // void avrcp_browsing_controller_register_packet_handler(btstack_packet_handler_t callback);
110 
111 /**
112  * @brief Connect to device with a Bluetooth address.
113  * @param bd_addr
114  * @param ertm_buffer
115  * @param ertm_buffer_size
116  * @param ertm_config
117  * @param avrcp_browsing_cid
118  * @returns status
119  */
120 uint8_t avrcp_browsing_controller_connect(bd_addr_t bd_addr, uint8_t * ertm_buffer, uint32_t size, l2cap_ertm_config_t * ertm_config, uint16_t * avrcp_browsing_cid);
121 
122 /**
123  * @brief Disconnect from AVRCP target
124  * @param avrcp_browsing_cid
125  * @returns status
126  */
127 uint8_t avrcp_browsing_controller_disconnect(uint16_t avrcp_browsing_cid);
128 
129 /**
130  * @brief Retrieve a listing of the contents of a folder.
131  * @param avrcp_browsing_cid
132  * @param scope    0-player list, 1-virtual file system, 2-search, 3-now playing
133  * @param start_item
134  * @param end_item
135  * @param attribute_count
136  * @param attribute_list
137  **/
138 uint8_t avrcp_browsing_controller_get_folder_items(uint16_t avrcp_browsing_cid, uint8_t scope, uint32_t start_item, uint32_t end_item, uint8_t attribute_count, uint8_t * attribute_list);
139 
140 /**
141  * @brief Retrieve a player list.
142  * @param avrcp_browsing_cid
143  **/
144 uint8_t avrcp_browsing_controller_get_player_list(uint16_t avrcp_browsing_cid);
145 
146 /* API_END */
147 
148 #if defined __cplusplus
149 }
150 #endif
151 
152 #endif // __AVRCP_BROWSING_CONTROLLER_H