xref: /btstack/src/classic/avrcp_browsing_controller.h (revision ceed67ffe68ea5103bbc5647a2e000ed0e08b747)
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 BLUEKITCHEN
24  * GMBH 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  * @title AVRCP Browsing Controller
40  *
41  */
42 
43 #ifndef AVRCP_BROWSING_CONTROLLER_H
44 #define AVRCP_BROWSING_CONTROLLER_H
45 
46 #include <stdint.h>
47 #include "classic/avrcp.h"
48 
49 #if defined __cplusplus
50 extern "C" {
51 #endif
52 
53 
54 /* API_START */
55 
56 /**
57  * @brief Set up AVRCP Browsing Controller device.
58  */
59 void avrcp_browsing_controller_init(void);
60 
61 /**
62  * @brief Register callback for the AVRCP Browsing Controller client.
63  * @param callback
64  */
65 void avrcp_browsing_controller_register_packet_handler(btstack_packet_handler_t callback);
66 
67 /**
68  * @brief Retrieve a list of media players.
69  * @param avrcp_browsing_cid
70  * @param start_item
71  * @param end_item
72  * @param attr_bitmap Use AVRCP_MEDIA_ATTR_ALL for all, and AVRCP_MEDIA_ATTR_NONE for none. Otherwise, see avrcp_media_attribute_id_t for the bitmap position of attrs.
73  **/
74 uint8_t avrcp_browsing_controller_get_media_players(uint16_t avrcp_browsing_cid, uint32_t start_item, uint32_t end_item, uint32_t attr_bitmap);
75 
76 /**
77  * @brief Retrieve a list of folders and media items of the browsed player.
78  * @param avrcp_browsing_cid
79  * @param start_item
80  * @param end_item
81  * @param attr_bitmap Use AVRCP_MEDIA_ATTR_ALL for all, and AVRCP_MEDIA_ATTR_NONE for none. Otherwise, see avrcp_media_attribute_id_t for the bitmap position of attrs.
82  **/
83 uint8_t avrcp_browsing_controller_browse_file_system(uint16_t avrcp_browsing_cid, uint32_t start_item, uint32_t end_item, uint32_t attr_bitmap);
84 
85 /**
86  * @brief Retrieve a list of media items of the browsed player.
87  * @param avrcp_browsing_cid
88  * @param start_item
89  * @param end_item
90  * @param attr_bitmap Use AVRCP_MEDIA_ATTR_ALL for all, and AVRCP_MEDIA_ATTR_NONE for none. Otherwise, see avrcp_media_attribute_id_t for the bitmap position of attrs.
91  **/
92 uint8_t avrcp_browsing_controller_browse_media(uint16_t avrcp_browsing_cid, uint32_t start_item, uint32_t end_item, uint32_t attr_bitmap);
93 
94 /**
95  * @brief Retrieve a list of folders and media items of the addressed player.
96  * @param avrcp_browsing_cid
97  * @param start_item
98  * @param end_item
99  * @param attr_bitmap Use AVRCP_MEDIA_ATTR_ALL for all, and AVRCP_MEDIA_ATTR_NONE for none. Otherwise, see avrcp_media_attribute_id_t for the bitmap position of attrs.
100  **/
101 uint8_t avrcp_browsing_controller_browse_now_playing_list(uint16_t avrcp_browsing_cid, uint32_t start_item, uint32_t end_item, uint32_t attr_bitmap);
102 
103 /**
104  * @brief Set browsed player. Calling this command is required prior to browsing the player's file system. Some players may support browsing only when set as the Addressed Player.
105  * @param avrcp_browsing_cid
106  * @param browsed_player_id
107  */
108 uint8_t avrcp_browsing_controller_set_browsed_player(uint16_t avrcp_browsing_cid, uint16_t browsed_player_id);
109 
110 /**
111  * @brief Get total num attributes
112  * @param avrcp_browsing_cid
113  * @param scope
114  */
115 uint8_t avrcp_browsing_controller_get_total_nr_items_for_scope(uint16_t avrcp_browsing_cid, avrcp_browsing_scope_t scope);
116 
117 /**
118  * @brief Navigate one level up or down in thhe virtual filesystem. Requires that s browsed player is set.
119  * @param avrcp_browsing_cid
120  * @param direction     0-folder up, 1-folder down
121  * @param folder_uid    8 bytes long
122  **/
123 uint8_t avrcp_browsing_controller_change_path(uint16_t avrcp_browsing_cid, uint8_t direction, uint8_t * folder_uid);
124 uint8_t avrcp_browsing_controller_go_up_one_level(uint16_t avrcp_browsing_cid);
125 uint8_t avrcp_browsing_controller_go_down_one_level(uint16_t avrcp_browsing_cid, uint8_t * folder_uid);
126 
127 
128 /**
129  * @brief Retrives metadata information (title, artist, album, ...) about a media element with given uid.
130  * @param avrcp_browsing_cid
131  * @param uid 			 media element uid
132  * @param uid_counter    Used to detect change to the media database on target device. A TG device that supports the UID Counter shall update the value of the counter on each change to the media database.
133  * @param attr_bitmap    0x00000000 - retrieve all, chek avrcp_media_attribute_id_t in avrcp.h for detailed bit position description.
134  * @param scope          check avrcp_browsing_scope_t in avrcp.h
135  **/
136 uint8_t avrcp_browsing_controller_get_item_attributes_for_scope(uint16_t avrcp_browsing_cid, uint8_t * uid, uint16_t uid_counter, uint32_t attr_bitmap, avrcp_browsing_scope_t scope);
137 
138 /**
139  * @brief Searches are performed from the current folder in the Browsed Players virtual filesystem. The search applies to the current folder and all folders below that.
140  * @param avrcp_browsing_cid
141  * @param search_str_len
142  * @param search_str
143  * @return status
144  **/
145 uint8_t avrcp_browsing_controller_search(uint16_t avrcp_browsing_cid, uint16_t search_str_len, char * search_str);
146 
147 /**
148  * @brief De-Init AVRCP Browsing Controller
149  */
150 void avrcp_browsing_controller_deinit(void);
151 
152 /* API_END */
153 
154 #if defined __cplusplus
155 }
156 #endif
157 
158 #endif // AVRCP_BROWSING_CONTROLLER_H
159