blob: 6f800cac519611425f422c96c49f858d8f722ece [file] [log] [blame]
Ravi Nagarajan482ba782013-02-26 10:34:41 -08001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_INCLUDE_BT_RC_H
18#define ANDROID_INCLUDE_BT_RC_H
19
20__BEGIN_DECLS
21
Avish Shahf20c24e2016-04-27 21:43:14 +053022/* Change this macro to use multiple RC */
23#define BT_RC_NUM_APP 1
24
Ravi Nagarajan482ba782013-02-26 10:34:41 -080025/* Macros */
Sanket Agarwalf9327762016-07-11 12:08:33 -070026#define BTRC_MAX_ATTR_STR_LEN (1 << 16)
Ravi Nagarajan482ba782013-02-26 10:34:41 -080027#define BTRC_UID_SIZE 8
28#define BTRC_MAX_APP_SETTINGS 8
29#define BTRC_MAX_FOLDER_DEPTH 4
30#define BTRC_MAX_APP_ATTR_SIZE 16
Avish Shahf20c24e2016-04-27 21:43:14 +053031#define BTRC_MAX_ELEM_ATTR_SIZE 8
Sanket Agarwalf9327762016-07-11 12:08:33 -070032#define BTRC_FEATURE_BIT_MASK_SIZE 16
Avish Shahf20c24e2016-04-27 21:43:14 +053033
34/* Macros for valid scopes in get_folder_items */
35#define BTRC_SCOPE_PLAYER_LIST 0x00 /* Media Player List */
36#define BTRC_SCOPE_FILE_SYSTEM 0x01 /* Virtual File System */
37#define BTRC_SCOPE_SEARCH 0x02 /* Search */
38#define BTRC_SCOPE_NOW_PLAYING 0x03 /* Now Playing */
39
40/* Macros for supported character encoding */
41#define BTRC_CHARSET_ID_UTF8 0x006A
42
43/* Macros for item types */
44#define BTRC_ITEM_PLAYER 0x01 /* Media Player */
45#define BTRC_ITEM_FOLDER 0x02 /* Folder */
46#define BTRC_ITEM_MEDIA 0x03 /* Media File */
47
Sanket Agarwalf9327762016-07-11 12:08:33 -070048/* Macros for media attribute IDs */
49#define BTRC_MEDIA_ATTR_ID_INVALID -1
50#define BTRC_MEDIA_ATTR_ID_TITLE 0x00000001
51#define BTRC_MEDIA_ATTR_ID_ARTIST 0x00000002
52#define BTRC_MEDIA_ATTR_ID_ALBUM 0x00000003
53#define BTRC_MEDIA_ATTR_ID_TRACK_NUM 0x00000004
54#define BTRC_MEDIA_ATTR_ID_NUM_TRACKS 0x00000005
55#define BTRC_MEDIA_ATTR_ID_GENRE 0x00000006
56#define BTRC_MEDIA_ATTR_ID_PLAYING_TIME 0x00000007 /* in miliseconds */
57
58/* Macros for folder types */
59#define BTRC_FOLDER_TYPE_MIXED 0x00
60#define BTRC_FOLDER_TYPE_TITLES 0x01
61#define BTRC_FOLDER_TYPE_ALBUMS 0x02
62#define BTRC_FOLDER_TYPE_ARTISTS 0x03
63#define BTRC_FOLDER_TYPE_GENRES 0x04
64#define BTRC_FOLDER_TYPE_PLAYLISTS 0x05
65#define BTRC_FOLDER_TYPE_YEARS 0x06
66
Avish Shahf20c24e2016-04-27 21:43:14 +053067/* Macros for media types */
68#define BTRC_MEDIA_TYPE_AUDIO 0x00 /* audio */
69#define BTRC_MEDIA_TYPE_VIDEO 0x01 /* video */
70
71/* Macros for num attributes */
72#define BTRC_NUM_ATTR_NONE 0xFF /* No attributes required */
73#define BTRC_NUM_ATTR_ALL 0X00 /* All attributes required */
74
75#define BTRC_HANDLE_NONE 0xFF
Ravi Nagarajan482ba782013-02-26 10:34:41 -080076
77typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
78
79typedef enum {
Avish Shahf20c24e2016-04-27 21:43:14 +053080 BTRC_CONNECTION_STATE_DISCONNECTED = 0,
81 BTRC_CONNECTION_STATE_CONNECTED
82} btrc_connection_state_t;
83
84typedef enum {
Satya Callojife9728d2013-08-01 03:11:11 -070085 BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
86 BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
87 BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
88 BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
89} btrc_remote_features_t;
90
91typedef enum {
Ravi Nagarajan482ba782013-02-26 10:34:41 -080092 BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */
93 BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */
94 BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */
95 BTRC_PLAYSTATE_FWD_SEEK = 0x03, /* Fwd Seek*/
96 BTRC_PLAYSTATE_REV_SEEK = 0x04, /* Rev Seek*/
97 BTRC_PLAYSTATE_ERROR = 0xFF, /* Error */
98} btrc_play_status_t;
99
100typedef enum {
101 BTRC_EVT_PLAY_STATUS_CHANGED = 0x01,
102 BTRC_EVT_TRACK_CHANGE = 0x02,
103 BTRC_EVT_TRACK_REACHED_END = 0x03,
104 BTRC_EVT_TRACK_REACHED_START = 0x04,
105 BTRC_EVT_PLAY_POS_CHANGED = 0x05,
106 BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
Avish Shahf20c24e2016-04-27 21:43:14 +0530107 BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
108 BTRC_EVT_AVAL_PLAYER_CHANGE = 0x0a,
109 BTRC_EVT_ADDR_PLAYER_CHANGE = 0x0b,
110 BTRC_EVT_UIDS_CHANGED = 0x0c,
111 BTRC_EVT_VOL_CHANGED = 0x0d,
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800112} btrc_event_id_t;
113
114typedef enum {
115 BTRC_NOTIFICATION_TYPE_INTERIM = 0,
116 BTRC_NOTIFICATION_TYPE_CHANGED = 1,
117} btrc_notification_type_t;
118
119typedef enum {
120 BTRC_PLAYER_ATTR_EQUALIZER = 0x01,
121 BTRC_PLAYER_ATTR_REPEAT = 0x02,
122 BTRC_PLAYER_ATTR_SHUFFLE = 0x03,
123 BTRC_PLAYER_ATTR_SCAN = 0x04,
124} btrc_player_attr_t;
125
126typedef enum {
127 BTRC_MEDIA_ATTR_TITLE = 0x01,
128 BTRC_MEDIA_ATTR_ARTIST = 0x02,
129 BTRC_MEDIA_ATTR_ALBUM = 0x03,
130 BTRC_MEDIA_ATTR_TRACK_NUM = 0x04,
131 BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05,
132 BTRC_MEDIA_ATTR_GENRE = 0x06,
133 BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07,
134} btrc_media_attr_t;
135
136typedef enum {
137 BTRC_PLAYER_VAL_OFF_REPEAT = 0x01,
138 BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02,
139 BTRC_PLAYER_VAL_ALL_REPEAT = 0x03,
140 BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04
141} btrc_player_repeat_val_t;
142
143typedef enum {
144 BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01,
145 BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02,
146 BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03
147} btrc_player_shuffle_val_t;
148
149typedef enum {
150 BTRC_STS_BAD_CMD = 0x00, /* Invalid command */
151 BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */
152 BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */
153 BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */
Avish Shahf20c24e2016-04-27 21:43:14 +0530154 BTRC_STS_NO_ERROR = 0x04, /* Operation Success */
155 BTRC_STS_UID_CHANGED = 0x05, /* UIDs changed */
156 BTRC_STS_RESERVED = 0x06, /* Reserved */
157 BTRC_STS_INV_DIRN = 0x07, /* Invalid direction */
158 BTRC_STS_INV_DIRECTORY = 0x08, /* Invalid directory */
159 BTRC_STS_INV_ITEM = 0x09, /* Invalid Item */
160 BTRC_STS_INV_SCOPE = 0x0a, /* Invalid scope */
161 BTRC_STS_INV_RANGE = 0x0b, /* Invalid range */
162 BTRC_STS_DIRECTORY = 0x0c, /* UID is a directory */
163 BTRC_STS_MEDIA_IN_USE = 0x0d, /* Media in use */
164 BTRC_STS_PLAY_LIST_FULL = 0x0e, /* Playing list full */
165 BTRC_STS_SRCH_NOT_SPRTD = 0x0f, /* Search not supported */
166 BTRC_STS_SRCH_IN_PROG = 0x10, /* Search in progress */
167 BTRC_STS_INV_PLAYER = 0x11, /* Invalid player */
168 BTRC_STS_PLAY_NOT_BROW = 0x12, /* Player not browsable */
169 BTRC_STS_PLAY_NOT_ADDR = 0x13, /* Player not addressed */
170 BTRC_STS_INV_RESULTS = 0x14, /* Invalid results */
171 BTRC_STS_NO_AVBL_PLAY = 0x15, /* No available players */
172 BTRC_STS_ADDR_PLAY_CHGD = 0x16, /* Addressed player changed */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800173} btrc_status_t;
174
175typedef struct {
Avish Shahf20c24e2016-04-27 21:43:14 +0530176 uint16_t player_id;
177 uint16_t uid_counter;
178} btrc_addr_player_changed_t;
179
180typedef struct {
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800181 uint8_t num_attr;
182 uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
183 uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
184} btrc_player_settings_t;
185
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530186typedef struct {
187 uint8_t val;
188 uint16_t charset_id;
189 uint16_t str_len;
190 uint8_t *p_str;
191} btrc_player_app_ext_attr_val_t;
192
193typedef struct {
194 uint8_t attr_id;
195 uint16_t charset_id;
196 uint16_t str_len;
197 uint8_t *p_str;
198 uint8_t num_val;
199 btrc_player_app_ext_attr_val_t ext_attr_val[BTRC_MAX_APP_ATTR_SIZE];
200} btrc_player_app_ext_attr_t;
201
202typedef struct {
203 uint8_t attr_id;
204 uint8_t num_val;
205 uint8_t attr_val[BTRC_MAX_APP_ATTR_SIZE];
206} btrc_player_app_attr_t;
207
208typedef struct {
209 uint32_t start_item;
210 uint32_t end_item;
211 uint32_t size;
212 uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
213 uint8_t attr_count;
214} btrc_getfolderitem_t;
215
Avish Shahf20c24e2016-04-27 21:43:14 +0530216typedef struct {
217 uint16_t type;
218 uint16_t uid_counter;
219} btrc_uids_changed_t;
220
221typedef struct {
222 uint16_t type;
223} btrc_now_playing_changed_t;
224
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800225typedef union
226{
227 btrc_play_status_t play_status;
228 btrc_uid_t track; /* queue position in NowPlaying */
229 uint32_t song_pos;
Avish Shahf20c24e2016-04-27 21:43:14 +0530230 uint16_t uid_counter;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800231 btrc_player_settings_t player_setting;
Avish Shahf20c24e2016-04-27 21:43:14 +0530232 btrc_addr_player_changed_t addr_player_changed;
233 btrc_uids_changed_t uids_changed;
234 btrc_now_playing_changed_t now_playing_changed;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800235} btrc_register_notification_t;
236
237typedef struct {
238 uint8_t id; /* can be attr_id or value_id */
239 uint8_t text[BTRC_MAX_ATTR_STR_LEN];
240} btrc_player_setting_text_t;
241
242typedef struct {
243 uint32_t attr_id;
244 uint8_t text[BTRC_MAX_ATTR_STR_LEN];
245} btrc_element_attr_val_t;
246
Avish Shahf20c24e2016-04-27 21:43:14 +0530247typedef struct {
248 uint16_t player_id;
249 uint8_t major_type;
250 uint32_t sub_type;
251 uint8_t play_status;
Sanket Agarwalf9327762016-07-11 12:08:33 -0700252 uint8_t features[BTRC_FEATURE_BIT_MASK_SIZE];
Avish Shahf20c24e2016-04-27 21:43:14 +0530253 uint16_t charset_id;
254 uint8_t name[BTRC_MAX_ATTR_STR_LEN];
255} btrc_item_player_t;
256
257typedef struct {
258 uint8_t uid[BTRC_UID_SIZE];
259 uint8_t type;
260 uint8_t playable;
261 uint16_t charset_id;
262 uint8_t name[BTRC_MAX_ATTR_STR_LEN];
263} btrc_item_folder_t;
264
265typedef struct {
266 uint8_t uid[BTRC_UID_SIZE];
267 uint8_t type;
268 uint16_t charset_id;
269 uint8_t name[BTRC_MAX_ATTR_STR_LEN];
270 int num_attrs;
271 btrc_element_attr_val_t* p_attrs;
272} btrc_item_media_t;
273
274typedef struct {
275 uint8_t item_type;
276 union
277 {
278 btrc_item_player_t player;
279 btrc_item_folder_t folder;
280 btrc_item_media_t media;
281 };
282} btrc_folder_items_t;
283
284typedef struct {
285 uint16_t str_len;
286 uint8_t p_str[BTRC_MAX_ATTR_STR_LEN];
287} btrc_br_folder_name_t;
288
Satya Callojife9728d2013-08-01 03:11:11 -0700289/** Callback for the controller's supported feautres */
290typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
291 btrc_remote_features_t features);
292
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800293/** Callback for play status request */
Avish Shahf20c24e2016-04-27 21:43:14 +0530294typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800295
296/** Callback for list player application attributes (Shuffle, Repeat,...) */
Avish Shahf20c24e2016-04-27 21:43:14 +0530297typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800298
299/** Callback for list player application attributes (Shuffle, Repeat,...) */
Avish Shahf20c24e2016-04-27 21:43:14 +0530300typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
301 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800302
303/** Callback for getting the current player application settings value
304** num_attr: specifies the number of attribute ids contained in p_attrs
305*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530306typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr,
307 btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800308
309/** Callback for getting the player application settings attributes' text
310** num_attr: specifies the number of attribute ids contained in p_attrs
311*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530312typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
313 btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800314
315/** Callback for getting the player application settings values' text
316** num_attr: specifies the number of value ids contained in p_vals
317*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530318typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val,
319 uint8_t *p_vals, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800320
321/** Callback for setting the player application settings values */
Avish Shahf20c24e2016-04-27 21:43:14 +0530322typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
323 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800324
325/** Callback to fetch the get element attributes of the current song
326** num_attr: specifies the number of attributes requested in p_attrs
327*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530328typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
329 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800330
331/** Callback for register notification (Play state change/track change/...)
332** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
333*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530334typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
335 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800336
Satya Callojife9728d2013-08-01 03:11:11 -0700337/* AVRCP 1.4 Enhancements */
338/** Callback for volume change on CT
339** volume: Current volume setting on the CT (0-127)
340*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530341typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
Satya Callojife9728d2013-08-01 03:11:11 -0700342
John Dub9844812013-07-23 17:15:34 -0700343/** Callback for passthrough commands */
Avish Shahf20c24e2016-04-27 21:43:14 +0530344typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
345
346/** Callback for set addressed player response on TG **/
347typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
348
349/** Callback for set browsed player response on TG **/
350typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
351
352/** Callback for get folder items on TG
353** num_attr: specifies the number of attributes requested in p_attr_ids
354*/
355typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
356 uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
357
358/** Callback for changing browsed path on TG **/
359typedef void (* btrc_change_path_callback) (uint8_t direction,
360 uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
361
362/** Callback to fetch the get item attributes of the media item
363** num_attr: specifies the number of attributes requested in p_attrs
364*/
365typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
366 uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
367
368/** Callback for play request for the media item indicated by an identifier */
369typedef void (* btrc_play_item_callback) (uint8_t scope,
370 uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
371
372/** Callback to fetch total number of items from a folder **/
373typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
374
375/** Callback for conducting recursive search on a current browsed path for a specified string */
376typedef void (* btrc_search_callback) (uint16_t charset_id,
377 uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
378
379/** Callback to add a specified media item indicated by an identifier to now playing queue. */
380typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
381 uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
John Dub9844812013-07-23 17:15:34 -0700382
Sanket Agarwalf9327762016-07-11 12:08:33 -0700383/** Callback for set addressed player response on TG **/
384typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
385
386/** Callback for set browsed player response on TG **/
387typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
388
389/** Callback for get folder items on TG
390** num_attr: specifies the number of attributes requested in p_attr_ids
391*/
392typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
393 uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
394
395/** Callback for changing browsed path on TG **/
396typedef void (* btrc_change_path_callback) (uint8_t direction,
397 uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
398
399/** Callback to fetch the get item attributes of the media item
400** num_attr: specifies the number of attributes requested in p_attrs
401*/
402typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
403 uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
404
405/** Callback for play request for the media item indicated by an identifier */
406typedef void (* btrc_play_item_callback) (uint8_t scope,
407 uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
408
409/** Callback to fetch total number of items from a folder **/
410typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
411
412/** Callback for conducting recursive search on a current browsed path for a specified string */
413typedef void (* btrc_search_callback) (uint16_t charset_id,
414 uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
415
416/** Callback to add a specified media item indicated by an identifier to now playing queue. */
417typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
418 uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
419
Sanket Agarwalf65a26b2016-07-11 12:08:33 -0700420/** Callback for set addressed player response on TG **/
421typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
422
423/** Callback for set browsed player response on TG **/
424typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
425
426/** Callback for get folder items on TG
427** num_attr: specifies the number of attributes requested in p_attr_ids
428*/
429typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
430 uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
431
432/** Callback for changing browsed path on TG **/
433typedef void (* btrc_change_path_callback) (uint8_t direction,
434 uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
435
436/** Callback to fetch the get item attributes of the media item
437** num_attr: specifies the number of attributes requested in p_attrs
438*/
439typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
440 uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
441
442/** Callback for play request for the media item indicated by an identifier */
443typedef void (* btrc_play_item_callback) (uint8_t scope,
444 uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
445
446/** Callback to fetch total number of items from a folder **/
447typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
448
449/** Callback for conducting recursive search on a current browsed path for a specified string */
450typedef void (* btrc_search_callback) (uint16_t charset_id,
451 uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
452
453/** Callback to add a specified media item indicated by an identifier to now playing queue. */
454typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
455 uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
456
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700457/** BT-RC Target callback structure. */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800458typedef struct {
459 /** set to sizeof(BtRcCallbacks) */
460 size_t size;
Satya Callojife9728d2013-08-01 03:11:11 -0700461 btrc_remote_features_callback remote_features_cb;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800462 btrc_get_play_status_callback get_play_status_cb;
463 btrc_list_player_app_attr_callback list_player_app_attr_cb;
464 btrc_list_player_app_values_callback list_player_app_values_cb;
465 btrc_get_player_app_value_callback get_player_app_value_cb;
466 btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb;
467 btrc_get_player_app_values_text_callback get_player_app_values_text_cb;
468 btrc_set_player_app_value_callback set_player_app_value_cb;
469 btrc_get_element_attr_callback get_element_attr_cb;
470 btrc_register_notification_callback register_notification_cb;
Satya Callojife9728d2013-08-01 03:11:11 -0700471 btrc_volume_change_callback volume_change_cb;
John Dub9844812013-07-23 17:15:34 -0700472 btrc_passthrough_cmd_callback passthrough_cmd_cb;
Avish Shahf20c24e2016-04-27 21:43:14 +0530473 btrc_set_addressed_player_callback set_addressed_player_cb;
474 btrc_set_browsed_player_callback set_browsed_player_cb;
475 btrc_get_folder_items_callback get_folder_items_cb;
476 btrc_change_path_callback change_path_cb;
477 btrc_get_item_attr_callback get_item_attr_cb;
478 btrc_play_item_callback play_item_cb;
479 btrc_get_total_num_of_items_callback get_total_num_of_items_cb;
480 btrc_search_callback search_cb;
481 btrc_add_to_now_playing_callback add_to_now_playing_cb;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800482} btrc_callbacks_t;
483
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700484/** Represents the standard BT-RC AVRCP Target interface. */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800485typedef struct {
486
487 /** set to sizeof(BtRcInterface) */
488 size_t size;
489 /**
490 * Register the BtRc callbacks
491 */
492 bt_status_t (*init)( btrc_callbacks_t* callbacks );
493
494 /** Respose to GetPlayStatus request. Contains the current
495 ** 1. Play status
496 ** 2. Song duration/length
497 ** 3. Song position
498 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530499 bt_status_t (*get_play_status_rsp)( bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
500 uint32_t song_len, uint32_t song_pos);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800501
502 /** Lists the support player application attributes (Shuffle/Repeat/...)
503 ** num_attr: Specifies the number of attributes contained in the pointer p_attrs
504 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530505 bt_status_t (*list_player_app_attr_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
506 btrc_player_attr_t *p_attrs);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800507
508 /** Lists the support player application attributes (Shuffle Off/On/Group)
509 ** num_val: Specifies the number of values contained in the pointer p_vals
510 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530511 bt_status_t (*list_player_app_value_rsp)( bt_bdaddr_t *bd_addr, int num_val, uint8_t *p_vals);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800512
513 /** Returns the current application attribute values for each of the specified attr_id */
Avish Shahf20c24e2016-04-27 21:43:14 +0530514 bt_status_t (*get_player_app_value_rsp)( bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800515
516 /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
517 ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
518 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530519 bt_status_t (*get_player_app_attr_text_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
520 btrc_player_setting_text_t *p_attrs);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800521
522 /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
523 ** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
524 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530525 bt_status_t (*get_player_app_value_text_rsp)( bt_bdaddr_t *bd_addr, int num_val,
526 btrc_player_setting_text_t *p_vals);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800527
528 /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
529 ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
530 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530531 bt_status_t (*get_element_attr_rsp)( bt_bdaddr_t *bd_addr, uint8_t num_attr,
532 btrc_element_attr_val_t *p_attrs);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800533
534 /** Response to set player attribute request ("Shuffle"/"Repeat")
535 ** rsp_status: Status of setting the player attributes for the current media player
536 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530537 bt_status_t (*set_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800538
539 /* Response to the register notification request (Play state change/track change/...).
540 ** event_id: Refers to the event_id this notification change corresponds too
541 ** type: Response type - interim/changed
542 ** p_params: Based on the event_id, this parameter should be populated
543 */
544 bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
545 btrc_notification_type_t type,
546 btrc_register_notification_t *p_param);
547
Satya Callojife9728d2013-08-01 03:11:11 -0700548 /* AVRCP 1.4 enhancements */
549
550 /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
551 ** This can be enhanced to support Relative Volume (AVRCP 1.0).
552 ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
553 ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
554 */
555 bt_status_t (*set_volume)(uint8_t volume);
556
Avish Shahf20c24e2016-04-27 21:43:14 +0530557 /* Set addressed player response from TG to CT */
558 bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
559
560 /* Set browsed player response from TG to CT */
561 bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
562 uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
563 btrc_br_folder_name_t *p_folders);
564
565 /* Get folder item list response from TG to CT */
566 bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
567 uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
568
569 /* Change path response from TG to CT */
570 bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
571 uint32_t num_items);
572
573 /** Returns the element's attributes num_attr: Specifies the number of attributes' text
574 * contained in the pointer p_attrs
575 */
576 bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
577 uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
578
579 /* play media item response from TG to CT */
580 bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
581
582 /* get total number of items response from TG to CT*/
583 bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
584 uint32_t uid_counter, uint32_t num_items);
585
586 /* Search VFS response from TG to CT */
587 bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
588 uint32_t num_items);
589
590 /* add_to_now playing list response from TG to CT */
591 bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
592
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800593 /** Closes the interface. */
594 void (*cleanup)( void );
595} btrc_interface_t;
596
Sanket Agarwalf9327762016-07-11 12:08:33 -0700597typedef void (* btrc_passthrough_rsp_callback) (bt_bdaddr_t *bd_addr, int id, int key_state);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700598
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530599typedef void (* btrc_groupnavigation_rsp_callback) (int id, int key_state);
600
Sanket Agarwalf9327762016-07-11 12:08:33 -0700601typedef void (* btrc_connection_state_callback) (
602 bool rc_connect, bool bt_connect, bt_bdaddr_t *bd_addr);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700603
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530604typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
605
606typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
607
608typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
609
610typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
611 uint8_t accepted);
612
613typedef void (* btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
614 uint8_t num_attr,
615 btrc_player_app_attr_t *app_attrs,
616 uint8_t num_ext_attr,
617 btrc_player_app_ext_attr_t *ext_attrs);
618
619typedef void (* btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
620 btrc_player_settings_t *p_vals);
621
622typedef void (* btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
623 btrc_element_attr_val_t *p_attrs);
624
625typedef void (* btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
626 uint32_t song_len, uint32_t song_pos);
627
628typedef void (* btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
629 btrc_play_status_t play_status);
630
Sanket Agarwalf9327762016-07-11 12:08:33 -0700631typedef void (* btrc_ctrl_get_folder_items_callback )(bt_bdaddr_t *bd_addr,
Sanket Agarwalf65a26b2016-07-11 12:08:33 -0700632 btrc_status_t status,
Sanket Agarwalf9327762016-07-11 12:08:33 -0700633 const btrc_folder_items_t *folder_items,
634 uint8_t count);
635
636typedef void (* btrc_ctrl_change_path_callback)(bt_bdaddr_t *bd_addr, uint8_t count);
637
638typedef void (* btrc_ctrl_set_browsed_player_callback )(
639 bt_bdaddr_t *bd_addr, uint8_t num_items, uint8_t depth);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700640/** BT-RC Controller callback structure. */
641typedef struct {
642 /** set to sizeof(BtRcCallbacks) */
643 size_t size;
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530644 btrc_passthrough_rsp_callback passthrough_rsp_cb;
645 btrc_groupnavigation_rsp_callback groupnavigation_rsp_cb;
646 btrc_connection_state_callback connection_state_cb;
647 btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
648 btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
649 btrc_ctrl_playerapplicationsetting_callback playerapplicationsetting_cb;
650 btrc_ctrl_playerapplicationsetting_changed_callback playerapplicationsetting_changed_cb;
651 btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
652 btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
653 btrc_ctrl_track_changed_callback track_changed_cb;
654 btrc_ctrl_play_position_changed_callback play_position_changed_cb;
655 btrc_ctrl_play_status_changed_callback play_status_changed_cb;
Sanket Agarwalf9327762016-07-11 12:08:33 -0700656 btrc_ctrl_get_folder_items_callback get_folder_items_cb;
657 btrc_ctrl_change_path_callback change_folder_path_cb;
658 btrc_ctrl_set_browsed_player_callback set_browsed_player_cb;
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700659} btrc_ctrl_callbacks_t;
660
661/** Represents the standard BT-RC AVRCP Controller interface. */
662typedef struct {
663
664 /** set to sizeof(BtRcInterface) */
665 size_t size;
666 /**
667 * Register the BtRc callbacks
668 */
669 bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
670
671 /** send pass through command to target */
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530672 bt_status_t (*send_pass_through_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
673 uint8_t key_state );
674
675 /** send group navigation command to target */
676 bt_status_t (*send_group_navigation_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
677 uint8_t key_state );
678
679 /** send command to set player applicaiton setting attributes to target */
680 bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
681 uint8_t* attrib_ids, uint8_t* attrib_vals);
682
Sanket Agarwalf9327762016-07-11 12:08:33 -0700683 /** send command to play a particular item */
684 bt_status_t (*play_item_cmd) (
685 bt_bdaddr_t *bd_addr, uint8_t scope, uint8_t *uid, uint16_t uid_counter);
686
687 /** get the now playing list */
688 bt_status_t (*get_now_playing_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
689
690 /** get the folder list */
691 bt_status_t (*get_folder_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
692
693 /** get the folder list */
694 bt_status_t (*get_player_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
695
696 /** get the folder list */
697 bt_status_t (*change_folder_path_cmd) (bt_bdaddr_t *bd_addr, uint8_t direction, uint8_t * uid);
698
699 /** set browsed player */
700 bt_status_t (*set_browsed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
701
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530702 /** send rsp to set_abs_vol received from target */
703 bt_status_t (*set_volume_rsp) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
704
705 /** send notificaiton rsp for abs vol to target */
706 bt_status_t (*register_abs_vol_rsp) (bt_bdaddr_t *bd_addr, btrc_notification_type_t rsp_type,
707 uint8_t abs_vol, uint8_t label);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700708
709 /** Closes the interface. */
710 void (*cleanup)( void );
711} btrc_ctrl_interface_t;
712
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800713__END_DECLS
714
Satya Callojife9728d2013-08-01 03:11:11 -0700715#endif /* ANDROID_INCLUDE_BT_RC_H */