• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
22 /* Change this macro to use multiple RC */
23 #define BT_RC_NUM_APP 6
24 
25 /* Macros */
26 #define BTRC_MAX_ATTR_STR_LEN (1 << 16)
27 #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
31 #define BTRC_MAX_ELEM_ATTR_SIZE 8
32 #define BTRC_FEATURE_BIT_MASK_SIZE 16
33 
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 
48 /* 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 
67 /* 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
76 
77 typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
78 
79 typedef enum {
80   BTRC_CONNECTION_STATE_DISCONNECTED = 0,
81   BTRC_CONNECTION_STATE_CONNECTED
82 } btrc_connection_state_t;
83 
84 typedef enum {
85   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 
91 typedef enum {
92   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 
100 typedef 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,
107   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,
112 } btrc_event_id_t;
113 
114 typedef enum {
115   BTRC_NOTIFICATION_TYPE_INTERIM = 0,
116   BTRC_NOTIFICATION_TYPE_CHANGED = 1,
117 } btrc_notification_type_t;
118 
119 typedef 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 
126 typedef 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 
136 typedef 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 
143 typedef 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 
149 typedef 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 */
154   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 */
173 } btrc_status_t;
174 
175 typedef struct {
176   uint16_t player_id;
177   uint16_t uid_counter;
178 } btrc_addr_player_changed_t;
179 
180 typedef struct {
181   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 
186 typedef 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 
193 typedef 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 
202 typedef 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 
208 typedef 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 
216 typedef struct {
217   uint16_t type;
218   uint16_t uid_counter;
219 } btrc_uids_changed_t;
220 
221 typedef struct { uint16_t type; } btrc_now_playing_changed_t;
222 
223 typedef union {
224   btrc_play_status_t play_status;
225   btrc_uid_t track; /* queue position in NowPlaying */
226   uint32_t song_pos;
227   uint16_t uid_counter;
228   btrc_player_settings_t player_setting;
229   btrc_addr_player_changed_t addr_player_changed;
230   btrc_uids_changed_t uids_changed;
231   btrc_now_playing_changed_t now_playing_changed;
232 } btrc_register_notification_t;
233 
234 typedef struct {
235   uint8_t id; /* can be attr_id or value_id */
236   uint8_t text[BTRC_MAX_ATTR_STR_LEN];
237 } btrc_player_setting_text_t;
238 
239 typedef struct {
240   uint32_t attr_id;
241   uint8_t text[BTRC_MAX_ATTR_STR_LEN];
242 } btrc_element_attr_val_t;
243 
244 typedef struct {
245   uint16_t player_id;
246   uint8_t major_type;
247   uint32_t sub_type;
248   uint8_t play_status;
249   uint8_t features[BTRC_FEATURE_BIT_MASK_SIZE];
250   uint16_t charset_id;
251   uint8_t name[BTRC_MAX_ATTR_STR_LEN];
252 } btrc_item_player_t;
253 
254 typedef struct {
255   uint8_t uid[BTRC_UID_SIZE];
256   uint8_t type;
257   uint8_t playable;
258   uint16_t charset_id;
259   uint8_t name[BTRC_MAX_ATTR_STR_LEN];
260 } btrc_item_folder_t;
261 
262 typedef struct {
263   uint8_t uid[BTRC_UID_SIZE];
264   uint8_t type;
265   uint16_t charset_id;
266   uint8_t name[BTRC_MAX_ATTR_STR_LEN];
267   int num_attrs;
268   btrc_element_attr_val_t* p_attrs;
269 } btrc_item_media_t;
270 
271 typedef struct {
272   uint8_t item_type;
273   union {
274     btrc_item_player_t player;
275     btrc_item_folder_t folder;
276     btrc_item_media_t media;
277   };
278 } btrc_folder_items_t;
279 
280 typedef struct {
281   uint16_t str_len;
282   uint8_t p_str[BTRC_MAX_ATTR_STR_LEN];
283 } btrc_br_folder_name_t;
284 
285 /** Callback for the controller's supported feautres */
286 typedef void (*btrc_remote_features_callback)(const RawAddress& bd_addr,
287                                               btrc_remote_features_t features);
288 
289 /** Callback for play status request */
290 typedef void (*btrc_get_play_status_callback)(const RawAddress& bd_addr);
291 
292 /** Callback for list player application attributes (Shuffle, Repeat,...) */
293 typedef void (*btrc_list_player_app_attr_callback)(const RawAddress& bd_addr);
294 
295 /** Callback for list player application attributes (Shuffle, Repeat,...) */
296 typedef void (*btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
297                                                      const RawAddress& bd_addr);
298 
299 /** Callback for getting the current player application settings value
300 **  num_attr: specifies the number of attribute ids contained in p_attrs
301 */
302 typedef void (*btrc_get_player_app_value_callback)(uint8_t num_attr,
303                                                    btrc_player_attr_t* p_attrs,
304                                                    const RawAddress& bd_addr);
305 
306 /** Callback for getting the player application settings attributes' text
307 **  num_attr: specifies the number of attribute ids contained in p_attrs
308 */
309 typedef void (*btrc_get_player_app_attrs_text_callback)(
310     uint8_t num_attr, btrc_player_attr_t* p_attrs, const RawAddress& bd_addr);
311 
312 /** Callback for getting the player application settings values' text
313 **  num_attr: specifies the number of value ids contained in p_vals
314 */
315 typedef void (*btrc_get_player_app_values_text_callback)(
316     uint8_t attr_id, uint8_t num_val, uint8_t* p_vals,
317     const RawAddress& bd_addr);
318 
319 /** Callback for setting the player application settings values */
320 typedef void (*btrc_set_player_app_value_callback)(
321     btrc_player_settings_t* p_vals, const RawAddress& bd_addr);
322 
323 /** Callback to fetch the get element attributes of the current song
324 **  num_attr: specifies the number of attributes requested in p_attrs
325 */
326 typedef void (*btrc_get_element_attr_callback)(uint8_t num_attr,
327                                                btrc_media_attr_t* p_attrs,
328                                                const RawAddress& bd_addr);
329 
330 /** Callback for register notification (Play state change/track change/...)
331 **  param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
332 */
333 typedef void (*btrc_register_notification_callback)(btrc_event_id_t event_id,
334                                                     uint32_t param,
335                                                     const RawAddress& bd_addr);
336 
337 /* AVRCP 1.4 Enhancements */
338 /** Callback for volume change on CT
339 **  volume: Current volume setting on the CT (0-127)
340 */
341 typedef void (*btrc_volume_change_callback)(uint8_t volume, uint8_t ctype,
342                                             const RawAddress& bd_addr);
343 
344 /** Callback for passthrough commands */
345 typedef void (*btrc_passthrough_cmd_callback)(int id, int key_state,
346                                               const RawAddress& bd_addr);
347 
348 /** Callback for set addressed player response on TG **/
349 typedef void (*btrc_set_addressed_player_callback)(uint16_t player_id,
350                                                    const RawAddress& bd_addr);
351 
352 /** Callback for set browsed player response on TG **/
353 typedef void (*btrc_set_browsed_player_callback)(uint16_t player_id,
354                                                  const RawAddress& bd_addr);
355 
356 /** Callback for get folder items on TG
357 **  num_attr: specifies the number of attributes requested in p_attr_ids
358 */
359 typedef void (*btrc_get_folder_items_callback)(
360     uint8_t scope, uint32_t start_item, uint32_t end_item, uint8_t num_attr,
361     uint32_t* p_attr_ids, const RawAddress& bd_addr);
362 
363 /** Callback for changing browsed path on TG **/
364 typedef void (*btrc_change_path_callback)(uint8_t direction,
365                                           uint8_t* folder_uid,
366                                           const RawAddress& bd_addr);
367 
368 /** Callback to fetch the get item attributes of the media item
369 **  num_attr: specifies the number of attributes requested in p_attrs
370 */
371 typedef void (*btrc_get_item_attr_callback)(uint8_t scope, uint8_t* uid,
372                                             uint16_t uid_counter,
373                                             uint8_t num_attr,
374                                             btrc_media_attr_t* p_attrs,
375                                             const RawAddress& bd_addr);
376 
377 /** Callback for play request for the media item indicated by an identifier */
378 typedef void (*btrc_play_item_callback)(uint8_t scope, uint16_t uid_counter,
379                                         uint8_t* uid,
380                                         const RawAddress& bd_addr);
381 
382 /** Callback to fetch total number of items from a folder **/
383 typedef void (*btrc_get_total_num_of_items_callback)(uint8_t scope,
384                                                      const RawAddress& bd_addr);
385 
386 /** Callback for conducting recursive search on a current browsed path for a
387  * specified string */
388 typedef void (*btrc_search_callback)(uint16_t charset_id, uint16_t str_len,
389                                      uint8_t* p_str, const RawAddress& bd_addr);
390 
391 /** Callback to add a specified media item indicated by an identifier to now
392  * playing queue. */
393 typedef void (*btrc_add_to_now_playing_callback)(uint8_t scope, uint8_t* uid,
394                                                  uint16_t uid_counter,
395                                                  const RawAddress& bd_addr);
396 
397 /** BT-RC Target callback structure. */
398 typedef struct {
399   /** set to sizeof(BtRcCallbacks) */
400   size_t size;
401   btrc_remote_features_callback remote_features_cb;
402   btrc_get_play_status_callback get_play_status_cb;
403   btrc_list_player_app_attr_callback list_player_app_attr_cb;
404   btrc_list_player_app_values_callback list_player_app_values_cb;
405   btrc_get_player_app_value_callback get_player_app_value_cb;
406   btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb;
407   btrc_get_player_app_values_text_callback get_player_app_values_text_cb;
408   btrc_set_player_app_value_callback set_player_app_value_cb;
409   btrc_get_element_attr_callback get_element_attr_cb;
410   btrc_register_notification_callback register_notification_cb;
411   btrc_volume_change_callback volume_change_cb;
412   btrc_passthrough_cmd_callback passthrough_cmd_cb;
413   btrc_set_addressed_player_callback set_addressed_player_cb;
414   btrc_set_browsed_player_callback set_browsed_player_cb;
415   btrc_get_folder_items_callback get_folder_items_cb;
416   btrc_change_path_callback change_path_cb;
417   btrc_get_item_attr_callback get_item_attr_cb;
418   btrc_play_item_callback play_item_cb;
419   btrc_get_total_num_of_items_callback get_total_num_of_items_cb;
420   btrc_search_callback search_cb;
421   btrc_add_to_now_playing_callback add_to_now_playing_cb;
422 } btrc_callbacks_t;
423 
424 /** Represents the standard BT-RC AVRCP Target interface. */
425 typedef struct {
426   /** set to sizeof(BtRcInterface) */
427   size_t size;
428   /**
429    * Register the BtRc callbacks
430    */
431   bt_status_t (*init)(btrc_callbacks_t* callbacks);
432 
433   /** Respose to GetPlayStatus request. Contains the current
434   **  1. Play status
435   **  2. Song duration/length
436   **  3. Song position
437   */
438   bt_status_t (*get_play_status_rsp)(const RawAddress& bd_addr,
439                                      btrc_play_status_t play_status,
440                                      uint32_t song_len, uint32_t song_pos);
441 
442   /** Lists the support player application attributes (Shuffle/Repeat/...)
443   **  num_attr: Specifies the number of attributes contained in the pointer
444   *p_attrs
445   */
446   bt_status_t (*list_player_app_attr_rsp)(const RawAddress& bd_addr,
447                                           int num_attr,
448                                           btrc_player_attr_t* p_attrs);
449 
450   /** Lists the support player application attributes (Shuffle Off/On/Group)
451   **  num_val: Specifies the number of values contained in the pointer p_vals
452   */
453   bt_status_t (*list_player_app_value_rsp)(const RawAddress& bd_addr,
454                                            int num_val, uint8_t* p_vals);
455 
456   /** Returns the current application attribute values for each of the specified
457    * attr_id */
458   bt_status_t (*get_player_app_value_rsp)(const RawAddress& bd_addr,
459                                           btrc_player_settings_t* p_vals);
460 
461   /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
462   **  num_attr: Specifies the number of attributes' text contained in the
463   *pointer p_attrs
464   */
465   bt_status_t (*get_player_app_attr_text_rsp)(
466       const RawAddress& bd_addr, int num_attr,
467       btrc_player_setting_text_t* p_attrs);
468 
469   /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
470   **  num_attr: Specifies the number of attribute values' text contained in the
471   *pointer p_vals
472   */
473   bt_status_t (*get_player_app_value_text_rsp)(
474       const RawAddress& bd_addr, int num_val,
475       btrc_player_setting_text_t* p_vals);
476 
477   /** Returns the current songs' element attributes text
478    *("Title"/"Album"/"Artist")
479    **  num_attr: Specifies the number of attributes' text contained in the
480    *pointer p_attrs
481    */
482   bt_status_t (*get_element_attr_rsp)(const RawAddress& bd_addr,
483                                       uint8_t num_attr,
484                                       btrc_element_attr_val_t* p_attrs);
485 
486   /** Response to set player attribute request ("Shuffle"/"Repeat")
487   **  rsp_status: Status of setting the player attributes for the current media
488   *player
489   */
490   bt_status_t (*set_player_app_value_rsp)(const RawAddress& bd_addr,
491                                           btrc_status_t rsp_status);
492 
493   /* Response to the register notification request (Play state change/track
494    *change/...).
495    ** event_id: Refers to the event_id this notification change corresponds too
496    ** type: Response type - interim/changed
497    ** p_params: Based on the event_id, this parameter should be populated
498    */
499   bt_status_t (*register_notification_rsp)(
500       btrc_event_id_t event_id, btrc_notification_type_t type,
501       btrc_register_notification_t* p_param);
502 
503   /* AVRCP 1.4 enhancements */
504 
505   /**Send current volume setting to remote side. Support limited to
506    *SetAbsoluteVolume
507    ** This can be enhanced to support Relative Volume (AVRCP 1.0).
508    ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute
509    *volume level
510    ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
511    */
512   bt_status_t (*set_volume)(uint8_t volume);
513 
514   /* Set addressed player response from TG to CT */
515   bt_status_t (*set_addressed_player_rsp)(const RawAddress& bd_addr,
516                                           btrc_status_t rsp_status);
517 
518   /* Set browsed player response from TG to CT */
519   bt_status_t (*set_browsed_player_rsp)(const RawAddress& bd_addr,
520                                         btrc_status_t rsp_status,
521                                         uint32_t num_items, uint16_t charset_id,
522                                         uint8_t folder_depth,
523                                         btrc_br_folder_name_t* p_folders);
524 
525   /* Get folder item list response from TG to CT */
526   bt_status_t (*get_folder_items_list_rsp)(const RawAddress& bd_addr,
527                                            btrc_status_t rsp_status,
528                                            uint16_t uid_counter,
529                                            uint8_t num_items,
530                                            btrc_folder_items_t* p_items);
531 
532   /* Change path response from TG to CT */
533   bt_status_t (*change_path_rsp)(const RawAddress& bd_addr,
534                                  btrc_status_t rsp_status, uint32_t num_items);
535 
536   /** Returns the element's attributes num_attr: Specifies the number of
537    * attributes' text contained in the pointer p_attrs
538    */
539   bt_status_t (*get_item_attr_rsp)(const RawAddress& bd_addr,
540                                    btrc_status_t rsp_status, uint8_t num_attr,
541                                    btrc_element_attr_val_t* p_attrs);
542 
543   /* play media item response from TG to CT */
544   bt_status_t (*play_item_rsp)(const RawAddress& bd_addr,
545                                btrc_status_t rsp_status);
546 
547   /* get total number of items response from TG to CT*/
548   bt_status_t (*get_total_num_of_items_rsp)(const RawAddress& bd_addr,
549                                             btrc_status_t rsp_status,
550                                             uint32_t uid_counter,
551                                             uint32_t num_items);
552 
553   /* Search VFS response from TG to CT */
554   bt_status_t (*search_rsp)(const RawAddress& bd_addr, btrc_status_t rsp_status,
555                             uint32_t uid_counter, uint32_t num_items);
556 
557   /* add_to_now playing list response from TG to CT */
558   bt_status_t (*add_to_now_playing_rsp)(const RawAddress& bd_addr,
559                                         btrc_status_t rsp_status);
560 
561   /** Closes the interface. */
562   void (*cleanup)(void);
563 } btrc_interface_t;
564 
565 typedef void (*btrc_passthrough_rsp_callback)(const RawAddress& bd_addr, int id,
566                                               int key_state);
567 
568 typedef void (*btrc_groupnavigation_rsp_callback)(int id, int key_state);
569 
570 typedef void (*btrc_connection_state_callback)(bool rc_connect, bool bt_connect,
571                                                const RawAddress& bd_addr);
572 
573 typedef void (*btrc_ctrl_getrcfeatures_callback)(const RawAddress& bd_addr,
574                                                  int features);
575 
576 typedef void (*btrc_ctrl_setabsvol_cmd_callback)(const RawAddress& bd_addr,
577                                                  uint8_t abs_vol,
578                                                  uint8_t label);
579 
580 typedef void (*btrc_ctrl_registernotification_abs_vol_callback)(
581     const RawAddress& bd_addr, uint8_t label);
582 
583 typedef void (*btrc_ctrl_setplayerapplicationsetting_rsp_callback)(
584     const RawAddress& bd_addr, uint8_t accepted);
585 
586 typedef void (*btrc_ctrl_playerapplicationsetting_callback)(
587     const RawAddress& bd_addr, uint8_t num_attr,
588     btrc_player_app_attr_t* app_attrs, uint8_t num_ext_attr,
589     btrc_player_app_ext_attr_t* ext_attrs);
590 
591 typedef void (*btrc_ctrl_playerapplicationsetting_changed_callback)(
592     const RawAddress& bd_addr, const btrc_player_settings_t& vals);
593 
594 typedef void (*btrc_ctrl_track_changed_callback)(
595     const RawAddress& bd_addr, uint8_t num_attr,
596     btrc_element_attr_val_t* p_attrs);
597 
598 typedef void (*btrc_ctrl_play_position_changed_callback)(
599     const RawAddress& bd_addr, uint32_t song_len, uint32_t song_pos);
600 
601 typedef void (*btrc_ctrl_play_status_changed_callback)(
602     const RawAddress& bd_addr, btrc_play_status_t play_status);
603 
604 typedef void (*btrc_ctrl_get_folder_items_callback)(
605     const RawAddress& bd_addr, btrc_status_t status,
606     const btrc_folder_items_t* folder_items, uint8_t count);
607 
608 typedef void (*btrc_ctrl_change_path_callback)(const RawAddress& bd_addr,
609                                                uint32_t count);
610 
611 typedef void (*btrc_ctrl_set_browsed_player_callback)(const RawAddress& bd_addr,
612                                                       uint8_t num_items,
613                                                       uint8_t depth);
614 typedef void (*btrc_ctrl_set_addressed_player_callback)(
615     const RawAddress& bd_addr, uint8_t status);
616 typedef void (*btrc_ctrl_addressed_player_changed_callback)(
617     const RawAddress& bd_addr, uint16_t id);
618 typedef void (*btrc_ctrl_now_playing_contents_changed_callback)(
619     const RawAddress& bd_addr);
620 
621 /** BT-RC Controller callback structure. */
622 typedef struct {
623   /** set to sizeof(BtRcCallbacks) */
624   size_t size;
625   btrc_passthrough_rsp_callback passthrough_rsp_cb;
626   btrc_groupnavigation_rsp_callback groupnavigation_rsp_cb;
627   btrc_connection_state_callback connection_state_cb;
628   btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
629   btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
630   btrc_ctrl_playerapplicationsetting_callback playerapplicationsetting_cb;
631   btrc_ctrl_playerapplicationsetting_changed_callback
632       playerapplicationsetting_changed_cb;
633   btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
634   btrc_ctrl_registernotification_abs_vol_callback
635       registernotification_absvol_cb;
636   btrc_ctrl_track_changed_callback track_changed_cb;
637   btrc_ctrl_play_position_changed_callback play_position_changed_cb;
638   btrc_ctrl_play_status_changed_callback play_status_changed_cb;
639   btrc_ctrl_get_folder_items_callback get_folder_items_cb;
640   btrc_ctrl_change_path_callback change_folder_path_cb;
641   btrc_ctrl_set_browsed_player_callback set_browsed_player_cb;
642   btrc_ctrl_set_addressed_player_callback set_addressed_player_cb;
643   btrc_ctrl_addressed_player_changed_callback addressed_player_changed_cb;
644   btrc_ctrl_now_playing_contents_changed_callback
645       now_playing_contents_changed_cb;
646 } btrc_ctrl_callbacks_t;
647 
648 /** Represents the standard BT-RC AVRCP Controller interface. */
649 typedef struct {
650   /** set to sizeof(BtRcInterface) */
651   size_t size;
652   /**
653    * Register the BtRc callbacks
654    */
655   bt_status_t (*init)(btrc_ctrl_callbacks_t* callbacks);
656 
657   /** send pass through command to target */
658   bt_status_t (*send_pass_through_cmd)(const RawAddress& bd_addr,
659                                        uint8_t key_code, uint8_t key_state);
660 
661   /** send group navigation command to target */
662   bt_status_t (*send_group_navigation_cmd)(const RawAddress& bd_addr,
663                                            uint8_t key_code, uint8_t key_state);
664 
665   /** send command to set player applicaiton setting attributes to target */
666   bt_status_t (*set_player_app_setting_cmd)(const RawAddress& bd_addr,
667                                             uint8_t num_attrib,
668                                             uint8_t* attrib_ids,
669                                             uint8_t* attrib_vals);
670 
671   /** send command to play a particular item */
672   bt_status_t (*play_item_cmd)(const RawAddress& bd_addr, uint8_t scope,
673                                uint8_t* uid, uint16_t uid_counter);
674 
675   /** get the playback state */
676   bt_status_t (*get_playback_state_cmd)(const RawAddress& bd_addr);
677 
678   /** get the now playing list */
679   bt_status_t (*get_now_playing_list_cmd)(const RawAddress& bd_addr,
680                                           uint32_t start, uint32_t end);
681 
682   /** get the folder list */
683   bt_status_t (*get_folder_list_cmd)(const RawAddress& bd_addr, uint32_t start,
684                                      uint32_t end);
685 
686   /** get the player list */
687   bt_status_t (*get_player_list_cmd)(const RawAddress& bd_addr, uint32_t start,
688                                      uint32_t end);
689 
690   /** change the folder path */
691   bt_status_t (*change_folder_path_cmd)(const RawAddress& bd_addr,
692                                         uint8_t direction, uint8_t* uid);
693 
694   /** set browsed player */
695   bt_status_t (*set_browsed_player_cmd)(const RawAddress& bd_addr,
696                                         uint16_t player_id);
697 
698   /** set addressed player */
699   bt_status_t (*set_addressed_player_cmd)(const RawAddress& bd_addr,
700                                           uint16_t player_id);
701 
702   /** send rsp to set_abs_vol received from target */
703   bt_status_t (*set_volume_rsp)(const RawAddress& bd_addr, uint8_t abs_vol,
704                                 uint8_t label);
705 
706   /** send notificaiton rsp for abs vol to target */
707   bt_status_t (*register_abs_vol_rsp)(const RawAddress& bd_addr,
708                                       btrc_notification_type_t rsp_type,
709                                       uint8_t abs_vol, uint8_t label);
710 
711   /** Closes the interface. */
712   void (*cleanup)(void);
713 } btrc_ctrl_interface_t;
714 
715 __END_DECLS
716 
717 #endif /* ANDROID_INCLUDE_BT_RC_H */
718