blob: 4a1a56f55da14f44dec6263ee931dda299badc0c [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 */
26#define BTRC_MAX_ATTR_STR_LEN 255
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
Avish Shahf20c24e2016-04-27 21:43:14 +053031#define BTRC_MAX_ELEM_ATTR_SIZE 8
32#define BTRC_FEATURE_MASK_SIZE 16
33
34
35/* Macros for valid scopes in get_folder_items */
36#define BTRC_SCOPE_PLAYER_LIST 0x00 /* Media Player List */
37#define BTRC_SCOPE_FILE_SYSTEM 0x01 /* Virtual File System */
38#define BTRC_SCOPE_SEARCH 0x02 /* Search */
39#define BTRC_SCOPE_NOW_PLAYING 0x03 /* Now Playing */
40
41/* Macros for supported character encoding */
42#define BTRC_CHARSET_ID_UTF8 0x006A
43
44/* Macros for item types */
45#define BTRC_ITEM_PLAYER 0x01 /* Media Player */
46#define BTRC_ITEM_FOLDER 0x02 /* Folder */
47#define BTRC_ITEM_MEDIA 0x03 /* Media File */
48
49/* Macros for media types */
50#define BTRC_MEDIA_TYPE_AUDIO 0x00 /* audio */
51#define BTRC_MEDIA_TYPE_VIDEO 0x01 /* video */
52
53/* Macros for num attributes */
54#define BTRC_NUM_ATTR_NONE 0xFF /* No attributes required */
55#define BTRC_NUM_ATTR_ALL 0X00 /* All attributes required */
56
57#define BTRC_HANDLE_NONE 0xFF
Ravi Nagarajan482ba782013-02-26 10:34:41 -080058
59typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
60
61typedef enum {
Avish Shahf20c24e2016-04-27 21:43:14 +053062 BTRC_CONNECTION_STATE_DISCONNECTED = 0,
63 BTRC_CONNECTION_STATE_CONNECTED
64} btrc_connection_state_t;
65
66typedef enum {
Satya Callojife9728d2013-08-01 03:11:11 -070067 BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
68 BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
69 BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
70 BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
71} btrc_remote_features_t;
72
73typedef enum {
Ravi Nagarajan482ba782013-02-26 10:34:41 -080074 BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */
75 BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */
76 BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */
77 BTRC_PLAYSTATE_FWD_SEEK = 0x03, /* Fwd Seek*/
78 BTRC_PLAYSTATE_REV_SEEK = 0x04, /* Rev Seek*/
79 BTRC_PLAYSTATE_ERROR = 0xFF, /* Error */
80} btrc_play_status_t;
81
82typedef enum {
83 BTRC_EVT_PLAY_STATUS_CHANGED = 0x01,
84 BTRC_EVT_TRACK_CHANGE = 0x02,
85 BTRC_EVT_TRACK_REACHED_END = 0x03,
86 BTRC_EVT_TRACK_REACHED_START = 0x04,
87 BTRC_EVT_PLAY_POS_CHANGED = 0x05,
88 BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
Avish Shahf20c24e2016-04-27 21:43:14 +053089 BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
90 BTRC_EVT_AVAL_PLAYER_CHANGE = 0x0a,
91 BTRC_EVT_ADDR_PLAYER_CHANGE = 0x0b,
92 BTRC_EVT_UIDS_CHANGED = 0x0c,
93 BTRC_EVT_VOL_CHANGED = 0x0d,
Ravi Nagarajan482ba782013-02-26 10:34:41 -080094} btrc_event_id_t;
95
96typedef enum {
97 BTRC_NOTIFICATION_TYPE_INTERIM = 0,
98 BTRC_NOTIFICATION_TYPE_CHANGED = 1,
99} btrc_notification_type_t;
100
101typedef enum {
102 BTRC_PLAYER_ATTR_EQUALIZER = 0x01,
103 BTRC_PLAYER_ATTR_REPEAT = 0x02,
104 BTRC_PLAYER_ATTR_SHUFFLE = 0x03,
105 BTRC_PLAYER_ATTR_SCAN = 0x04,
106} btrc_player_attr_t;
107
108typedef enum {
109 BTRC_MEDIA_ATTR_TITLE = 0x01,
110 BTRC_MEDIA_ATTR_ARTIST = 0x02,
111 BTRC_MEDIA_ATTR_ALBUM = 0x03,
112 BTRC_MEDIA_ATTR_TRACK_NUM = 0x04,
113 BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05,
114 BTRC_MEDIA_ATTR_GENRE = 0x06,
115 BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07,
116} btrc_media_attr_t;
117
118typedef enum {
119 BTRC_PLAYER_VAL_OFF_REPEAT = 0x01,
120 BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02,
121 BTRC_PLAYER_VAL_ALL_REPEAT = 0x03,
122 BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04
123} btrc_player_repeat_val_t;
124
125typedef enum {
126 BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01,
127 BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02,
128 BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03
129} btrc_player_shuffle_val_t;
130
131typedef enum {
132 BTRC_STS_BAD_CMD = 0x00, /* Invalid command */
133 BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */
134 BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */
135 BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */
Avish Shahf20c24e2016-04-27 21:43:14 +0530136 BTRC_STS_NO_ERROR = 0x04, /* Operation Success */
137 BTRC_STS_UID_CHANGED = 0x05, /* UIDs changed */
138 BTRC_STS_RESERVED = 0x06, /* Reserved */
139 BTRC_STS_INV_DIRN = 0x07, /* Invalid direction */
140 BTRC_STS_INV_DIRECTORY = 0x08, /* Invalid directory */
141 BTRC_STS_INV_ITEM = 0x09, /* Invalid Item */
142 BTRC_STS_INV_SCOPE = 0x0a, /* Invalid scope */
143 BTRC_STS_INV_RANGE = 0x0b, /* Invalid range */
144 BTRC_STS_DIRECTORY = 0x0c, /* UID is a directory */
145 BTRC_STS_MEDIA_IN_USE = 0x0d, /* Media in use */
146 BTRC_STS_PLAY_LIST_FULL = 0x0e, /* Playing list full */
147 BTRC_STS_SRCH_NOT_SPRTD = 0x0f, /* Search not supported */
148 BTRC_STS_SRCH_IN_PROG = 0x10, /* Search in progress */
149 BTRC_STS_INV_PLAYER = 0x11, /* Invalid player */
150 BTRC_STS_PLAY_NOT_BROW = 0x12, /* Player not browsable */
151 BTRC_STS_PLAY_NOT_ADDR = 0x13, /* Player not addressed */
152 BTRC_STS_INV_RESULTS = 0x14, /* Invalid results */
153 BTRC_STS_NO_AVBL_PLAY = 0x15, /* No available players */
154 BTRC_STS_ADDR_PLAY_CHGD = 0x16, /* Addressed player changed */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800155} btrc_status_t;
156
157typedef struct {
Avish Shahf20c24e2016-04-27 21:43:14 +0530158 uint16_t player_id;
159 uint16_t uid_counter;
160} btrc_addr_player_changed_t;
161
162typedef struct {
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800163 uint8_t num_attr;
164 uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
165 uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
166} btrc_player_settings_t;
167
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530168typedef struct {
169 uint8_t val;
170 uint16_t charset_id;
171 uint16_t str_len;
172 uint8_t *p_str;
173} btrc_player_app_ext_attr_val_t;
174
175typedef struct {
176 uint8_t attr_id;
177 uint16_t charset_id;
178 uint16_t str_len;
179 uint8_t *p_str;
180 uint8_t num_val;
181 btrc_player_app_ext_attr_val_t ext_attr_val[BTRC_MAX_APP_ATTR_SIZE];
182} btrc_player_app_ext_attr_t;
183
184typedef struct {
185 uint8_t attr_id;
186 uint8_t num_val;
187 uint8_t attr_val[BTRC_MAX_APP_ATTR_SIZE];
188} btrc_player_app_attr_t;
189
190typedef struct {
191 uint32_t start_item;
192 uint32_t end_item;
193 uint32_t size;
194 uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
195 uint8_t attr_count;
196} btrc_getfolderitem_t;
197
Avish Shahf20c24e2016-04-27 21:43:14 +0530198typedef struct {
199 uint16_t type;
200 uint16_t uid_counter;
201} btrc_uids_changed_t;
202
203typedef struct {
204 uint16_t type;
205} btrc_now_playing_changed_t;
206
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800207typedef union
208{
209 btrc_play_status_t play_status;
210 btrc_uid_t track; /* queue position in NowPlaying */
211 uint32_t song_pos;
Avish Shahf20c24e2016-04-27 21:43:14 +0530212 uint16_t uid_counter;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800213 btrc_player_settings_t player_setting;
Avish Shahf20c24e2016-04-27 21:43:14 +0530214 btrc_addr_player_changed_t addr_player_changed;
215 btrc_uids_changed_t uids_changed;
216 btrc_now_playing_changed_t now_playing_changed;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800217} btrc_register_notification_t;
218
219typedef struct {
220 uint8_t id; /* can be attr_id or value_id */
221 uint8_t text[BTRC_MAX_ATTR_STR_LEN];
222} btrc_player_setting_text_t;
223
224typedef struct {
225 uint32_t attr_id;
226 uint8_t text[BTRC_MAX_ATTR_STR_LEN];
227} btrc_element_attr_val_t;
228
Avish Shahf20c24e2016-04-27 21:43:14 +0530229typedef struct {
230 uint16_t player_id;
231 uint8_t major_type;
232 uint32_t sub_type;
233 uint8_t play_status;
234 uint8_t features[BTRC_FEATURE_MASK_SIZE];
235 uint16_t charset_id;
236 uint8_t name[BTRC_MAX_ATTR_STR_LEN];
237} btrc_item_player_t;
238
239typedef struct {
240 uint8_t uid[BTRC_UID_SIZE];
241 uint8_t type;
242 uint8_t playable;
243 uint16_t charset_id;
244 uint8_t name[BTRC_MAX_ATTR_STR_LEN];
245} btrc_item_folder_t;
246
247typedef struct {
248 uint8_t uid[BTRC_UID_SIZE];
249 uint8_t type;
250 uint16_t charset_id;
251 uint8_t name[BTRC_MAX_ATTR_STR_LEN];
252 int num_attrs;
253 btrc_element_attr_val_t* p_attrs;
254} btrc_item_media_t;
255
256typedef struct {
257 uint8_t item_type;
258 union
259 {
260 btrc_item_player_t player;
261 btrc_item_folder_t folder;
262 btrc_item_media_t media;
263 };
264} btrc_folder_items_t;
265
266typedef struct {
267 uint16_t str_len;
268 uint8_t p_str[BTRC_MAX_ATTR_STR_LEN];
269} btrc_br_folder_name_t;
270
Satya Callojife9728d2013-08-01 03:11:11 -0700271/** Callback for the controller's supported feautres */
272typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
273 btrc_remote_features_t features);
274
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800275/** Callback for play status request */
Avish Shahf20c24e2016-04-27 21:43:14 +0530276typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800277
278/** Callback for list player application attributes (Shuffle, Repeat,...) */
Avish Shahf20c24e2016-04-27 21:43:14 +0530279typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800280
281/** Callback for list player application attributes (Shuffle, Repeat,...) */
Avish Shahf20c24e2016-04-27 21:43:14 +0530282typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
283 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800284
285/** Callback for getting the current player application settings value
286** num_attr: specifies the number of attribute ids contained in p_attrs
287*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530288typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr,
289 btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800290
291/** Callback for getting the player application settings attributes' text
292** num_attr: specifies the number of attribute ids contained in p_attrs
293*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530294typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
295 btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800296
297/** Callback for getting the player application settings values' text
298** num_attr: specifies the number of value ids contained in p_vals
299*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530300typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id, uint8_t num_val,
301 uint8_t *p_vals, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800302
303/** Callback for setting the player application settings values */
Avish Shahf20c24e2016-04-27 21:43:14 +0530304typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
305 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800306
307/** Callback to fetch the get element attributes of the current song
308** num_attr: specifies the number of attributes requested in p_attrs
309*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530310typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
311 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800312
313/** Callback for register notification (Play state change/track change/...)
314** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
315*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530316typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
317 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800318
Satya Callojife9728d2013-08-01 03:11:11 -0700319/* AVRCP 1.4 Enhancements */
320/** Callback for volume change on CT
321** volume: Current volume setting on the CT (0-127)
322*/
Avish Shahf20c24e2016-04-27 21:43:14 +0530323typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
Satya Callojife9728d2013-08-01 03:11:11 -0700324
John Dub9844812013-07-23 17:15:34 -0700325/** Callback for passthrough commands */
Avish Shahf20c24e2016-04-27 21:43:14 +0530326typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
327
328/** Callback for set addressed player response on TG **/
329typedef void (* btrc_set_addressed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
330
331/** Callback for set browsed player response on TG **/
332typedef void (* btrc_set_browsed_player_callback) (uint16_t player_id, bt_bdaddr_t *bd_addr);
333
334/** Callback for get folder items on TG
335** num_attr: specifies the number of attributes requested in p_attr_ids
336*/
337typedef void (* btrc_get_folder_items_callback) (uint8_t scope, uint32_t start_item,
338 uint32_t end_item, uint8_t num_attr, uint32_t *p_attr_ids, bt_bdaddr_t *bd_addr);
339
340/** Callback for changing browsed path on TG **/
341typedef void (* btrc_change_path_callback) (uint8_t direction,
342 uint8_t* folder_uid, bt_bdaddr_t *bd_addr);
343
344/** Callback to fetch the get item attributes of the media item
345** num_attr: specifies the number of attributes requested in p_attrs
346*/
347typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint8_t* uid, uint16_t uid_counter,
348 uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
349
350/** Callback for play request for the media item indicated by an identifier */
351typedef void (* btrc_play_item_callback) (uint8_t scope,
352 uint16_t uid_counter, uint8_t* uid, bt_bdaddr_t *bd_addr);
353
354/** Callback to fetch total number of items from a folder **/
355typedef void (* btrc_get_total_num_of_items_callback) (uint8_t scope, bt_bdaddr_t *bd_addr);
356
357/** Callback for conducting recursive search on a current browsed path for a specified string */
358typedef void (* btrc_search_callback) (uint16_t charset_id,
359 uint16_t str_len, uint8_t* p_str, bt_bdaddr_t *bd_addr);
360
361/** Callback to add a specified media item indicated by an identifier to now playing queue. */
362typedef void (* btrc_add_to_now_playing_callback) (uint8_t scope,
363 uint8_t* uid, uint16_t uid_counter, bt_bdaddr_t *bd_addr);
John Dub9844812013-07-23 17:15:34 -0700364
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700365/** BT-RC Target callback structure. */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800366typedef struct {
367 /** set to sizeof(BtRcCallbacks) */
368 size_t size;
Satya Callojife9728d2013-08-01 03:11:11 -0700369 btrc_remote_features_callback remote_features_cb;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800370 btrc_get_play_status_callback get_play_status_cb;
371 btrc_list_player_app_attr_callback list_player_app_attr_cb;
372 btrc_list_player_app_values_callback list_player_app_values_cb;
373 btrc_get_player_app_value_callback get_player_app_value_cb;
374 btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb;
375 btrc_get_player_app_values_text_callback get_player_app_values_text_cb;
376 btrc_set_player_app_value_callback set_player_app_value_cb;
377 btrc_get_element_attr_callback get_element_attr_cb;
378 btrc_register_notification_callback register_notification_cb;
Satya Callojife9728d2013-08-01 03:11:11 -0700379 btrc_volume_change_callback volume_change_cb;
John Dub9844812013-07-23 17:15:34 -0700380 btrc_passthrough_cmd_callback passthrough_cmd_cb;
Avish Shahf20c24e2016-04-27 21:43:14 +0530381 btrc_set_addressed_player_callback set_addressed_player_cb;
382 btrc_set_browsed_player_callback set_browsed_player_cb;
383 btrc_get_folder_items_callback get_folder_items_cb;
384 btrc_change_path_callback change_path_cb;
385 btrc_get_item_attr_callback get_item_attr_cb;
386 btrc_play_item_callback play_item_cb;
387 btrc_get_total_num_of_items_callback get_total_num_of_items_cb;
388 btrc_search_callback search_cb;
389 btrc_add_to_now_playing_callback add_to_now_playing_cb;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800390} btrc_callbacks_t;
391
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700392/** Represents the standard BT-RC AVRCP Target interface. */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800393typedef struct {
394
395 /** set to sizeof(BtRcInterface) */
396 size_t size;
397 /**
398 * Register the BtRc callbacks
399 */
400 bt_status_t (*init)( btrc_callbacks_t* callbacks );
401
402 /** Respose to GetPlayStatus request. Contains the current
403 ** 1. Play status
404 ** 2. Song duration/length
405 ** 3. Song position
406 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530407 bt_status_t (*get_play_status_rsp)( bt_bdaddr_t *bd_addr, btrc_play_status_t play_status,
408 uint32_t song_len, uint32_t song_pos);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800409
410 /** Lists the support player application attributes (Shuffle/Repeat/...)
411 ** num_attr: Specifies the number of attributes contained in the pointer p_attrs
412 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530413 bt_status_t (*list_player_app_attr_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
414 btrc_player_attr_t *p_attrs);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800415
416 /** Lists the support player application attributes (Shuffle Off/On/Group)
417 ** num_val: Specifies the number of values contained in the pointer p_vals
418 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530419 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 -0800420
421 /** Returns the current application attribute values for each of the specified attr_id */
Avish Shahf20c24e2016-04-27 21:43:14 +0530422 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 -0800423
424 /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
425 ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
426 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530427 bt_status_t (*get_player_app_attr_text_rsp)( bt_bdaddr_t *bd_addr, int num_attr,
428 btrc_player_setting_text_t *p_attrs);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800429
430 /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
431 ** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
432 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530433 bt_status_t (*get_player_app_value_text_rsp)( bt_bdaddr_t *bd_addr, int num_val,
434 btrc_player_setting_text_t *p_vals);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800435
436 /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
437 ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
438 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530439 bt_status_t (*get_element_attr_rsp)( bt_bdaddr_t *bd_addr, uint8_t num_attr,
440 btrc_element_attr_val_t *p_attrs);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800441
442 /** Response to set player attribute request ("Shuffle"/"Repeat")
443 ** rsp_status: Status of setting the player attributes for the current media player
444 */
Avish Shahf20c24e2016-04-27 21:43:14 +0530445 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 -0800446
447 /* Response to the register notification request (Play state change/track change/...).
448 ** event_id: Refers to the event_id this notification change corresponds too
449 ** type: Response type - interim/changed
450 ** p_params: Based on the event_id, this parameter should be populated
451 */
452 bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
453 btrc_notification_type_t type,
454 btrc_register_notification_t *p_param);
455
Satya Callojife9728d2013-08-01 03:11:11 -0700456 /* AVRCP 1.4 enhancements */
457
458 /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
459 ** This can be enhanced to support Relative Volume (AVRCP 1.0).
460 ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
461 ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
462 */
463 bt_status_t (*set_volume)(uint8_t volume);
464
Avish Shahf20c24e2016-04-27 21:43:14 +0530465 /* Set addressed player response from TG to CT */
466 bt_status_t (*set_addressed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
467
468 /* Set browsed player response from TG to CT */
469 bt_status_t (*set_browsed_player_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
470 uint32_t num_items, uint16_t charset_id, uint8_t folder_depth,
471 btrc_br_folder_name_t *p_folders);
472
473 /* Get folder item list response from TG to CT */
474 bt_status_t (*get_folder_items_list_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
475 uint16_t uid_counter, uint8_t num_items, btrc_folder_items_t *p_items);
476
477 /* Change path response from TG to CT */
478 bt_status_t (*change_path_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
479 uint32_t num_items);
480
481 /** Returns the element's attributes num_attr: Specifies the number of attributes' text
482 * contained in the pointer p_attrs
483 */
484 bt_status_t (*get_item_attr_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
485 uint8_t num_attr, btrc_element_attr_val_t *p_attrs);
486
487 /* play media item response from TG to CT */
488 bt_status_t (*play_item_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
489
490 /* get total number of items response from TG to CT*/
491 bt_status_t (*get_total_num_of_items_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status,
492 uint32_t uid_counter, uint32_t num_items);
493
494 /* Search VFS response from TG to CT */
495 bt_status_t (*search_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status, uint32_t uid_counter,
496 uint32_t num_items);
497
498 /* add_to_now playing list response from TG to CT */
499 bt_status_t (*add_to_now_playing_rsp)(bt_bdaddr_t *bd_addr, btrc_status_t rsp_status);
500
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800501 /** Closes the interface. */
502 void (*cleanup)( void );
503} btrc_interface_t;
504
Avish Shahf20c24e2016-04-27 21:43:14 +0530505typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700506
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530507typedef void (* btrc_groupnavigation_rsp_callback) (int id, int key_state);
508
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700509typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
510
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530511typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
512
513typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
514
515typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
516
517typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
518 uint8_t accepted);
519
520typedef void (* btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
521 uint8_t num_attr,
522 btrc_player_app_attr_t *app_attrs,
523 uint8_t num_ext_attr,
524 btrc_player_app_ext_attr_t *ext_attrs);
525
526typedef void (* btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
527 btrc_player_settings_t *p_vals);
528
529typedef void (* btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
530 btrc_element_attr_val_t *p_attrs);
531
532typedef void (* btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
533 uint32_t song_len, uint32_t song_pos);
534
535typedef void (* btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
536 btrc_play_status_t play_status);
537
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700538/** BT-RC Controller callback structure. */
539typedef struct {
540 /** set to sizeof(BtRcCallbacks) */
541 size_t size;
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530542 btrc_passthrough_rsp_callback passthrough_rsp_cb;
543 btrc_groupnavigation_rsp_callback groupnavigation_rsp_cb;
544 btrc_connection_state_callback connection_state_cb;
545 btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
546 btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
547 btrc_ctrl_playerapplicationsetting_callback playerapplicationsetting_cb;
548 btrc_ctrl_playerapplicationsetting_changed_callback playerapplicationsetting_changed_cb;
549 btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
550 btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
551 btrc_ctrl_track_changed_callback track_changed_cb;
552 btrc_ctrl_play_position_changed_callback play_position_changed_cb;
553 btrc_ctrl_play_status_changed_callback play_status_changed_cb;
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700554} btrc_ctrl_callbacks_t;
555
556/** Represents the standard BT-RC AVRCP Controller interface. */
557typedef struct {
558
559 /** set to sizeof(BtRcInterface) */
560 size_t size;
561 /**
562 * Register the BtRc callbacks
563 */
564 bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
565
566 /** send pass through command to target */
AnubhavGuptaa5b557a2015-09-18 14:34:02 +0530567 bt_status_t (*send_pass_through_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
568 uint8_t key_state );
569
570 /** send group navigation command to target */
571 bt_status_t (*send_group_navigation_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
572 uint8_t key_state );
573
574 /** send command to set player applicaiton setting attributes to target */
575 bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
576 uint8_t* attrib_ids, uint8_t* attrib_vals);
577
578 /** send rsp to set_abs_vol received from target */
579 bt_status_t (*set_volume_rsp) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
580
581 /** send notificaiton rsp for abs vol to target */
582 bt_status_t (*register_abs_vol_rsp) (bt_bdaddr_t *bd_addr, btrc_notification_type_t rsp_type,
583 uint8_t abs_vol, uint8_t label);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700584
585 /** Closes the interface. */
586 void (*cleanup)( void );
587} btrc_ctrl_interface_t;
588
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800589__END_DECLS
590
Satya Callojife9728d2013-08-01 03:11:11 -0700591#endif /* ANDROID_INCLUDE_BT_RC_H */