Merge tizen_next codes into tizen branch
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / hardware / bt_rc.h
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 1
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 {
222     uint16_t type;
223 } btrc_now_playing_changed_t;
224
225 typedef union
226 {
227     btrc_play_status_t play_status;
228     btrc_uid_t track; /* queue position in NowPlaying */
229     uint32_t song_pos;
230     uint16_t uid_counter;
231     btrc_player_settings_t player_setting;
232     btrc_addr_player_changed_t addr_player_changed;
233     btrc_uids_changed_t uids_changed;
234     btrc_now_playing_changed_t now_playing_changed;
235 } btrc_register_notification_t;
236
237 typedef 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
242 typedef struct {
243     uint32_t attr_id;
244     uint8_t text[BTRC_MAX_ATTR_STR_LEN];
245 } btrc_element_attr_val_t;
246
247 typedef struct {
248     uint16_t  player_id;
249     uint8_t   major_type;
250     uint32_t  sub_type;
251     uint8_t   play_status;
252     uint8_t   features[BTRC_FEATURE_BIT_MASK_SIZE];
253     uint16_t  charset_id;
254     uint8_t   name[BTRC_MAX_ATTR_STR_LEN];
255 } btrc_item_player_t;
256
257 typedef 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
265 typedef 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
274 typedef 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
284 typedef struct {
285     uint16_t  str_len;
286     uint8_t   p_str[BTRC_MAX_ATTR_STR_LEN];
287 } btrc_br_folder_name_t;
288
289 #ifdef TIZEN_BT_HAL
290 /** Callback for the target connection state */
291 typedef void (* btrc_tg_connection_state_callback) (bt_bdaddr_t *bd_addr, btrc_connection_state_t state);
292 #endif
293
294 /** Callback for the controller's supported feautres */
295 typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
296                                                       btrc_remote_features_t features);
297
298 /** Callback for play status request */
299 typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
300
301 /** Callback for list player application attributes (Shuffle, Repeat,...) */
302 typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
303
304 /** Callback for list player application attributes (Shuffle, Repeat,...) */
305 typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
306     bt_bdaddr_t *bd_addr);
307
308 /** Callback for getting the current player application settings value
309 **  num_attr: specifies the number of attribute ids contained in p_attrs
310 */
311 typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr,
312     btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
313
314 /** Callback for getting the player application settings attributes' text
315 **  num_attr: specifies the number of attribute ids contained in p_attrs
316 */
317 typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
318     btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
319
320 /** Callback for getting the player application settings values' text
321 **  num_attr: specifies the number of value ids contained in p_vals
322 */
323 typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val,
324     uint8_t *p_vals, bt_bdaddr_t *bd_addr);
325
326 /** Callback for setting the player application settings values */
327 typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
328     bt_bdaddr_t *bd_addr);
329
330 /** Callback to fetch the get element attributes of the current song
331 **  num_attr: specifies the number of attributes requested in p_attrs
332 */
333 typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
334     bt_bdaddr_t *bd_addr);
335
336 /** Callback for register notification (Play state change/track change/...)
337 **  param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
338 */
339 typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
340     bt_bdaddr_t *bd_addr);
341
342 /* AVRCP 1.4 Enhancements */
343 /** Callback for volume change on CT
344 **  volume: Current volume setting on the CT (0-127)
345 */
346 typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
347
348 /** Callback for passthrough commands */
349 typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
350
351 /** Callback for set addressed player response on TG **/
352 typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
353
354 /** Callback for set browsed player response on TG **/
355 typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
356
357 /** Callback for get folder items on TG
358 **  num_attr: specifies the number of attributes requested in p_attr_ids
359 */
360 typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
361               uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *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, bt_bdaddr_t *bd_addr);
366
367 /** Callback to fetch the get item attributes of the media item
368 **  num_attr: specifies the number of attributes requested in p_attrs
369 */
370 typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
371                 uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
372
373 /** Callback for play request for the media item indicated by an identifier */
374 typedef void (* btrc_play_item_callback) (uint8_t scope,
375                 uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
376
377 /** Callback to fetch total number of items from a folder **/
378 typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
379
380 /** Callback for conducting recursive search on a current browsed path for a specified string */
381 typedef void (* btrc_search_callback) (uint16_t charset_id,
382                 uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
383
384 /** Callback to add a specified media item indicated by an identifier to now playing queue. */
385 typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
386                 uint8_t* uid, uint16_t  uid_counter, bt_bdaddr_t *bd_addr);
387
388 /** BT-RC Target callback structure. */
389 typedef struct {
390     /** set to sizeof(BtRcCallbacks) */
391     size_t      size;
392 #ifdef TIZEN_BT_HAL
393     btrc_tg_connection_state_callback           connection_state_cb;
394 #endif
395     btrc_remote_features_callback               remote_features_cb;
396     btrc_get_play_status_callback               get_play_status_cb;
397     btrc_list_player_app_attr_callback          list_player_app_attr_cb;
398     btrc_list_player_app_values_callback        list_player_app_values_cb;
399     btrc_get_player_app_value_callback          get_player_app_value_cb;
400     btrc_get_player_app_attrs_text_callback     get_player_app_attrs_text_cb;
401     btrc_get_player_app_values_text_callback    get_player_app_values_text_cb;
402     btrc_set_player_app_value_callback          set_player_app_value_cb;
403     btrc_get_element_attr_callback              get_element_attr_cb;
404     btrc_register_notification_callback         register_notification_cb;
405     btrc_volume_change_callback                 volume_change_cb;
406     btrc_passthrough_cmd_callback               passthrough_cmd_cb;
407     btrc_set_addressed_player_callback          set_addressed_player_cb;
408     btrc_set_browsed_player_callback            set_browsed_player_cb;
409     btrc_get_folder_items_callback              get_folder_items_cb;
410     btrc_change_path_callback                   change_path_cb;
411     btrc_get_item_attr_callback                 get_item_attr_cb;
412     btrc_play_item_callback                     play_item_cb;
413     btrc_get_total_num_of_items_callback        get_total_num_of_items_cb;
414     btrc_search_callback                        search_cb;
415     btrc_add_to_now_playing_callback            add_to_now_playing_cb;
416 } btrc_callbacks_t;
417
418 /** Represents the standard BT-RC AVRCP Target interface. */
419 typedef struct {
420
421     /** set to sizeof(BtRcInterface) */
422     size_t          size;
423     /**
424      * Register the BtRc callbacks
425      */
426     bt_status_t (*init)( btrc_callbacks_t* callbacks );
427
428 #ifdef TIZEN_BT_HAL
429     /** connect to AVRCP controller device */
430     bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
431
432     /** dis-connect from AVRCP controller device */
433     bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
434 #endif
435
436     /** Respose to GetPlayStatus request. Contains the current
437     **  1. Play status
438     **  2. Song duration/length
439     **  3. Song position
440     */
441     bt_status_t (*get_play_status_rsp)( bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
442         uint32_t song_len, uint32_t song_pos);
443
444     /** Lists the support player application attributes (Shuffle/Repeat/...)
445     **  num_attr: Specifies the number of attributes contained in the pointer p_attrs
446     */
447     bt_status_t (*list_player_app_attr_rsp)( bt_bdaddr_t *bd_addr, 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)( bt_bdaddr_t *bd_addr, int num_val, uint8_t *p_vals);
454
455     /** Returns the current application attribute values for each of the specified attr_id */
456     bt_status_t (*get_player_app_value_rsp)( bt_bdaddr_t *bd_addr, btrc_player_settings_t *p_vals);
457
458     /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
459     **  num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
460     */
461     bt_status_t (*get_player_app_attr_text_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
462         btrc_player_setting_text_t *p_attrs);
463
464     /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
465     **  num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
466     */
467     bt_status_t (*get_player_app_value_text_rsp)( bt_bdaddr_t *bd_addr, int num_val,
468         btrc_player_setting_text_t *p_vals);
469
470     /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
471     **  num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
472     */
473     bt_status_t (*get_element_attr_rsp)( bt_bdaddr_t *bd_addr, uint8_t num_attr,
474         btrc_element_attr_val_t *p_attrs);
475
476     /** Response to set player attribute request ("Shuffle"/"Repeat")
477     **  rsp_status: Status of setting the player attributes for the current media player
478     */
479     bt_status_t (*set_player_app_value_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
480
481     /* Response to the register notification request (Play state change/track change/...).
482     ** event_id: Refers to the event_id this notification change corresponds too
483     ** type: Response type - interim/changed
484     ** p_params: Based on the event_id, this parameter should be populated
485     */
486     bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
487                                              btrc_notification_type_t type,
488                                              btrc_register_notification_t *p_param);
489
490     /* AVRCP 1.4 enhancements */
491
492     /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
493     ** This can be enhanced to support Relative Volume (AVRCP 1.0).
494     ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
495     ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
496     */
497     bt_status_t (*set_volume)(uint8_t volume);
498
499     /* Set addressed player response from TG to CT */
500     bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
501
502     /* Set browsed player response from TG to CT */
503     bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
504         uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
505         btrc_br_folder_name_t *p_folders);
506
507     /* Get folder item list response from TG to CT */
508      bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
509         uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
510
511     /* Change path response from TG to CT */
512     bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
513         uint32_t num_items);
514
515     /** Returns the element's attributes num_attr: Specifies the number of attributes' text
516      * contained in the pointer p_attrs
517      */
518     bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
519         uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
520
521     /* play media item response from TG to CT */
522     bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
523
524     /* get total number of items response from TG to CT*/
525     bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
526         uint32_t uid_counter, uint32_t num_items);
527
528     /* Search VFS response from TG to CT */
529     bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
530         uint32_t num_items);
531
532     /* add_to_now playing list response from TG to CT */
533     bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
534
535     /** Closes the interface. */
536     void  (*cleanup)( void );
537 } btrc_interface_t;
538
539 typedef void (* btrc_passthrough_rsp_callback) (bt_bdaddr_t *bd_addr, int id, int key_state);
540
541 typedef void (* btrc_groupnavigation_rsp_callback) (int id, int key_state);
542
543 typedef void (* btrc_connection_state_callback) (
544     bool rc_connect, bool bt_connect, bt_bdaddr_t *bd_addr);
545
546 typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
547
548 typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
549
550 typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
551
552 typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
553                                                                           uint8_t accepted);
554
555 typedef void (* btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
556                                                                  uint8_t num_attr,
557                                                                  btrc_player_app_attr_t *app_attrs,
558                                                                  uint8_t num_ext_attr,
559                                                                  btrc_player_app_ext_attr_t *ext_attrs);
560
561 typedef void (* btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
562                                                                           btrc_player_settings_t *p_vals);
563
564 typedef void (* btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
565                                                      btrc_element_attr_val_t *p_attrs);
566
567 typedef void (* btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
568                                                               uint32_t song_len, uint32_t song_pos);
569
570 typedef void (* btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
571                                                             btrc_play_status_t play_status);
572
573 typedef void (* btrc_ctrl_get_folder_items_callback )(bt_bdaddr_t *bd_addr,
574                                                             btrc_status_t status,
575                                                             const btrc_folder_items_t *folder_items,
576                                                             uint8_t count);
577
578 typedef void (* btrc_ctrl_change_path_callback)(bt_bdaddr_t *bd_addr, uint8_t count);
579
580 typedef void (* btrc_ctrl_set_browsed_player_callback )(
581     bt_bdaddr_t *bd_addr, uint8_t num_items, uint8_t depth);
582 typedef void (* btrc_ctrl_set_addressed_player_callback)(bt_bdaddr_t *bd_addr, uint8_t status);
583 /** BT-RC Controller callback structure. */
584 typedef struct {
585     /** set to sizeof(BtRcCallbacks) */
586     size_t      size;
587     btrc_passthrough_rsp_callback                               passthrough_rsp_cb;
588     btrc_groupnavigation_rsp_callback                           groupnavigation_rsp_cb;
589     btrc_connection_state_callback                              connection_state_cb;
590     btrc_ctrl_getrcfeatures_callback                            getrcfeatures_cb;
591     btrc_ctrl_setplayerapplicationsetting_rsp_callback          setplayerappsetting_rsp_cb;
592     btrc_ctrl_playerapplicationsetting_callback                 playerapplicationsetting_cb;
593     btrc_ctrl_playerapplicationsetting_changed_callback         playerapplicationsetting_changed_cb;
594     btrc_ctrl_setabsvol_cmd_callback                            setabsvol_cmd_cb;
595     btrc_ctrl_registernotification_abs_vol_callback             registernotification_absvol_cb;
596     btrc_ctrl_track_changed_callback                            track_changed_cb;
597     btrc_ctrl_play_position_changed_callback                    play_position_changed_cb;
598     btrc_ctrl_play_status_changed_callback                      play_status_changed_cb;
599     btrc_ctrl_get_folder_items_callback                         get_folder_items_cb;
600     btrc_ctrl_change_path_callback                              change_folder_path_cb;
601     btrc_ctrl_set_browsed_player_callback                       set_browsed_player_cb;
602     btrc_ctrl_set_addressed_player_callback                     set_addressed_player_cb;
603 } btrc_ctrl_callbacks_t;
604
605 /** Represents the standard BT-RC AVRCP Controller interface. */
606 typedef struct {
607
608         /** set to sizeof(BtRcInterface) */
609         size_t          size;
610         /**
611          * Register the BtRc callbacks
612          */
613         bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
614 #ifdef TIZEN_BT_HAL
615         /** connect to headset */
616         bt_status_t (*connect)( bt_bdaddr_t *bd_addr );
617
618         /** dis-connect from headset */
619         bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr );
620 #endif
621         /** send pass through command to target */
622         bt_status_t (*send_pass_through_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
623                         uint8_t key_state );
624         /** send group navigation command to target */
625         bt_status_t (*send_group_navigation_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
626                         uint8_t key_state );
627
628         /** send command to set player applicaiton setting attributes to target */
629         bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
630                         uint8_t* attrib_ids, uint8_t* attrib_vals);
631
632         /** send command to play a particular item */
633         bt_status_t (*play_item_cmd) (
634                         bt_bdaddr_t *bd_addr, uint8_t scope, uint8_t *uid, uint16_t uid_counter);
635
636         /** get the playback state */
637         bt_status_t (*get_playback_state_cmd) (bt_bdaddr_t *bd_addr);
638
639         /** get the now playing list */
640         bt_status_t (*get_now_playing_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
641
642         /** get the folder list */
643         bt_status_t (*get_folder_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
644
645         /** get the folder list */
646         bt_status_t (*get_player_list_cmd) (bt_bdaddr_t *bd_addr, uint8_t start, uint8_t items);
647
648         /** get the folder list */
649         bt_status_t (*change_folder_path_cmd) (bt_bdaddr_t *bd_addr, uint8_t direction, uint8_t * uid);
650
651         /** set browsed player */
652         bt_status_t (*set_browsed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
653
654         /** set addressed player */
655         bt_status_t (*set_addressed_player_cmd) (bt_bdaddr_t *bd_addr, uint16_t player_id);
656
657         /** send rsp to set_abs_vol received from target */
658         bt_status_t (*set_volume_rsp) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
659
660         /** send notificaiton rsp for abs vol to target */
661         bt_status_t (*register_abs_vol_rsp) (bt_bdaddr_t *bd_addr, btrc_notification_type_t rsp_type,
662                         uint8_t abs_vol, uint8_t label);
663
664         /** Closes the interface. */
665         void  (*cleanup)( void );
666 } btrc_ctrl_interface_t;
667
668 __END_DECLS
669
670 #endif /* ANDROID_INCLUDE_BT_RC_H */