blob: 6e1109d38176322963d47fb6e788dea2a42ed06b [file] [log] [blame]
Ravi Nagarajan482ba782013-02-26 10:34:41 -08001/*
Gaurav Asatiaacbc382014-08-14 15:30:52 +05302 * Copyright (C) 2013-2014, The Linux Foundation. All rights reserved.
3 * Not a Contribution.
4 *
Ravi Nagarajan482ba782013-02-26 10:34:41 -08005 * Copyright (C) 2012 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef ANDROID_INCLUDE_BT_RC_H
21#define ANDROID_INCLUDE_BT_RC_H
22
23__BEGIN_DECLS
24
25/* 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
Ravi Nagarajanebb8c1b2013-03-22 04:18:47 -070031#define BTRC_MAX_ELEM_ATTR_SIZE 7
Ayan Ghosh6e728552014-07-25 17:11:58 +053032#define BTRC_CHARSET_UTF8 0x006A
Ravi Nagarajan482ba782013-02-26 10:34:41 -080033
34typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
35
36typedef enum {
Satya Callojife9728d2013-08-01 03:11:11 -070037 BTRC_FEAT_NONE = 0x00, /* AVRCP 1.0 */
38 BTRC_FEAT_METADATA = 0x01, /* AVRCP 1.3 */
39 BTRC_FEAT_ABSOLUTE_VOLUME = 0x02, /* Supports TG role and volume sync */
40 BTRC_FEAT_BROWSE = 0x04, /* AVRCP 1.4 and up, with Browsing support */
41} btrc_remote_features_t;
42
43typedef enum {
Ravi Nagarajan482ba782013-02-26 10:34:41 -080044 BTRC_PLAYSTATE_STOPPED = 0x00, /* Stopped */
45 BTRC_PLAYSTATE_PLAYING = 0x01, /* Playing */
46 BTRC_PLAYSTATE_PAUSED = 0x02, /* Paused */
47 BTRC_PLAYSTATE_FWD_SEEK = 0x03, /* Fwd Seek*/
48 BTRC_PLAYSTATE_REV_SEEK = 0x04, /* Rev Seek*/
49 BTRC_PLAYSTATE_ERROR = 0xFF, /* Error */
50} btrc_play_status_t;
51
52typedef enum {
53 BTRC_EVT_PLAY_STATUS_CHANGED = 0x01,
54 BTRC_EVT_TRACK_CHANGE = 0x02,
55 BTRC_EVT_TRACK_REACHED_END = 0x03,
56 BTRC_EVT_TRACK_REACHED_START = 0x04,
57 BTRC_EVT_PLAY_POS_CHANGED = 0x05,
58 BTRC_EVT_APP_SETTINGS_CHANGED = 0x08,
Ayan Ghosh6e728552014-07-25 17:11:58 +053059 BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09,
60 BTRC_EVT_AVAILABLE_PLAYERS_CHANGED = 0x0a,
61 BTRC_EVT_ADDRESSED_PLAYER_CHANGED = 0x0b,
Ravi Nagarajan482ba782013-02-26 10:34:41 -080062} btrc_event_id_t;
63
Ayan Ghosh6e728552014-07-25 17:11:58 +053064//used for Scope
65typedef enum {
66 BTRC_EVT_MEDIA_PLAYLIST = 0,
67 BTRC_EVT_MEDIA_VIRTUALFILESYST = 1,
68 BTRC_EVT_SEARCH = 2,
69 BTRC_EVT_NOWPLAYING = 3,
70 BTRC_EVT_MAX_BROWSE = 4,
71} btrc_browse_folderitem_t;
72
Ravi Nagarajan482ba782013-02-26 10:34:41 -080073typedef enum {
74 BTRC_NOTIFICATION_TYPE_INTERIM = 0,
75 BTRC_NOTIFICATION_TYPE_CHANGED = 1,
Ayan Ghosh6e728552014-07-25 17:11:58 +053076 BTRC_NOTIFICATION_TYPE_REJECT = 2,
Ravi Nagarajan482ba782013-02-26 10:34:41 -080077} btrc_notification_type_t;
78
79typedef enum {
80 BTRC_PLAYER_ATTR_EQUALIZER = 0x01,
81 BTRC_PLAYER_ATTR_REPEAT = 0x02,
82 BTRC_PLAYER_ATTR_SHUFFLE = 0x03,
83 BTRC_PLAYER_ATTR_SCAN = 0x04,
84} btrc_player_attr_t;
85
86typedef enum {
87 BTRC_MEDIA_ATTR_TITLE = 0x01,
88 BTRC_MEDIA_ATTR_ARTIST = 0x02,
89 BTRC_MEDIA_ATTR_ALBUM = 0x03,
90 BTRC_MEDIA_ATTR_TRACK_NUM = 0x04,
91 BTRC_MEDIA_ATTR_NUM_TRACKS = 0x05,
92 BTRC_MEDIA_ATTR_GENRE = 0x06,
93 BTRC_MEDIA_ATTR_PLAYING_TIME = 0x07,
94} btrc_media_attr_t;
95
96typedef enum {
97 BTRC_PLAYER_VAL_OFF_REPEAT = 0x01,
98 BTRC_PLAYER_VAL_SINGLE_REPEAT = 0x02,
99 BTRC_PLAYER_VAL_ALL_REPEAT = 0x03,
100 BTRC_PLAYER_VAL_GROUP_REPEAT = 0x04
101} btrc_player_repeat_val_t;
102
103typedef enum {
104 BTRC_PLAYER_VAL_OFF_SHUFFLE = 0x01,
105 BTRC_PLAYER_VAL_ALL_SHUFFLE = 0x02,
106 BTRC_PLAYER_VAL_GROUP_SHUFFLE = 0x03
107} btrc_player_shuffle_val_t;
108
109typedef enum {
110 BTRC_STS_BAD_CMD = 0x00, /* Invalid command */
111 BTRC_STS_BAD_PARAM = 0x01, /* Invalid parameter */
112 BTRC_STS_NOT_FOUND = 0x02, /* Specified parameter is wrong or not found */
113 BTRC_STS_INTERNAL_ERR = 0x03, /* Internal Error */
114 BTRC_STS_NO_ERROR = 0x04 /* Operation Success */
115} btrc_status_t;
116
Ayan Ghosh6e728552014-07-25 17:11:58 +0530117typedef enum {
118 BTRC_TYPE_MEDIA_PLAYER = 0x01,
119 BTRC_TYPE_FOLDER = 0x02,
120 BTRC_TYPE_MEDIA_ELEMENT = 0x03
121} btrc_folder_list_item_type_t;
122
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800123typedef struct {
124 uint8_t num_attr;
125 uint8_t attr_ids[BTRC_MAX_APP_SETTINGS];
126 uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
127} btrc_player_settings_t;
128
Ayan Ghosh6e728552014-07-25 17:11:58 +0530129typedef struct {
130 uint32_t start_item;
131 uint32_t end_item;
132 uint32_t size;
133 uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
134 uint8_t attr_count;
135}btrc_getfolderitem_t;
136
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800137typedef union
138{
139 btrc_play_status_t play_status;
140 btrc_uid_t track; /* queue position in NowPlaying */
141 uint32_t song_pos;
142 btrc_player_settings_t player_setting;
Ayan Ghosh6e728552014-07-25 17:11:58 +0530143 uint16_t player_id;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800144} btrc_register_notification_t;
145
146typedef struct {
147 uint8_t id; /* can be attr_id or value_id */
148 uint8_t text[BTRC_MAX_ATTR_STR_LEN];
149} btrc_player_setting_text_t;
150
151typedef struct {
152 uint32_t attr_id;
153 uint8_t text[BTRC_MAX_ATTR_STR_LEN];
154} btrc_element_attr_val_t;
155
Satya Callojife9728d2013-08-01 03:11:11 -0700156/** Callback for the controller's supported feautres */
157typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
158 btrc_remote_features_t features);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530159#define BTRC_FEATURE_MASK_SIZE 16
160
161typedef uint8_t btrc_feature_mask_t[BTRC_FEATURE_MASK_SIZE];
162
163typedef struct {
164 uint16_t charset_id;
165 uint16_t str_len;
166 uint8_t *p_str;
167} btrc_player_full_name_t;
168
169typedef struct
170{
171 uint32_t sub_type;
172 uint16_t player_id;
173 uint8_t major_type;
174 uint8_t play_status;
175 btrc_feature_mask_t features; /* Supported feature bit mask*/
176 btrc_player_full_name_t name; /* The player name, name length and character set id.*/
177} btrc_folder_list_item_player_t;
178
179typedef struct
180{
181 uint64_t uid;
182 uint8_t type;
183 uint8_t playable;
184 btrc_player_full_name_t name;
185} btrc_folder_list_item_folder_t;
186
187typedef struct
188{
189 uint32_t attr_id;
190 btrc_player_full_name_t name;
191} btrc_attr_entry_t;
192
193typedef struct
194{
195 uint64_t uid;
196 uint8_t type;
197 uint8_t attr_count;
198 btrc_player_full_name_t name;
199 btrc_attr_entry_t* p_attr_list;
200} btrc_folder_list_item_media_t;
201
202typedef struct {
203 uint16_t str_len;
204 uint8_t *p_str;
205} btrc_name_t;
206
207/* SetBrowsedPlayer */
208typedef struct
209{
210 uint32_t num_items;
211 uint16_t uid_counter;
212 uint16_t charset_id;
213 uint8_t status;
214 uint8_t folder_depth;
215 btrc_name_t *p_folders;
216} btrc_set_browsed_player_rsp_t;
217
218typedef struct
219{
220 uint8_t item_type;
221 union
222 {
223 btrc_folder_list_item_player_t player;
224 btrc_folder_list_item_folder_t folder;
225 btrc_folder_list_item_media_t media;
226 } u;
227} btrc_folder_list_item_t;
228
229/* GetFolderItems */
230typedef struct
231{
232 uint16_t uid_counter;
233 uint16_t item_count;
234 uint8_t status;
235 btrc_folder_list_item_t *p_item_list;
236} btrc_folder_list_entries_t;
Satya Callojife9728d2013-08-01 03:11:11 -0700237
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800238/** Callback for play status request */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530239typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800240
241/** Callback for list player application attributes (Shuffle, Repeat,...) */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530242typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800243
244/** Callback for list player application attributes (Shuffle, Repeat,...) */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530245typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id,
246 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800247
248/** Callback for getting the current player application settings value
249** num_attr: specifies the number of attribute ids contained in p_attrs
250*/
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530251typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs,
252 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800253
254/** Callback for getting the player application settings attributes' text
255** num_attr: specifies the number of attribute ids contained in p_attrs
256*/
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530257typedef void (* btrc_get_player_app_attrs_text_callback) (uint8_t num_attr,
258 btrc_player_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800259
260/** Callback for getting the player application settings values' text
261** num_attr: specifies the number of value ids contained in p_vals
262*/
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530263typedef void (* btrc_get_player_app_values_text_callback) (uint8_t attr_id,
264 uint8_t num_val, uint8_t *p_vals, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800265
266/** Callback for setting the player application settings values */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530267typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals,
268 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800269
270/** Callback to fetch the get element attributes of the current song
271** num_attr: specifies the number of attributes requested in p_attrs
272*/
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530273typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs,
274 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800275
276/** Callback for register notification (Play state change/track change/...)
277** param: Is only valid if event_id is BTRC_EVT_PLAY_POS_CHANGED
278*/
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530279typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param,
280 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800281
Satya Callojife9728d2013-08-01 03:11:11 -0700282/* AVRCP 1.4 Enhancements */
283/** Callback for volume change on CT
284** volume: Current volume setting on the CT (0-127)
285*/
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530286typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr);
Satya Callojife9728d2013-08-01 03:11:11 -0700287
John Dub9844812013-07-23 17:15:34 -0700288/** Callback for passthrough commands */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530289typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr);
John Dub9844812013-07-23 17:15:34 -0700290
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700291/** BT-RC Target callback structure. */
Ayan Ghosh6e728552014-07-25 17:11:58 +0530292
293typedef void (* btrc_get_folder_items_callback) (btrc_browse_folderitem_t id,
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530294 btrc_getfolderitem_t *param, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530295
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530296typedef void (* btrc_set_addressed_player_callback) (uint32_t player_id, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530297
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530298typedef void (* btrc_set_browsed_player_callback) (uint32_t player_id, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530299
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530300typedef void (* btrc_change_path_callback) (uint8_t direction, uint64_t uid, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530301
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530302typedef void (* btrc_play_item_callback) (uint8_t scope, uint64_t uid, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530303
304typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint64_t uid,
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530305 uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr);
306
307typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530308
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800309typedef struct {
310 /** set to sizeof(BtRcCallbacks) */
311 size_t size;
Satya Callojife9728d2013-08-01 03:11:11 -0700312 btrc_remote_features_callback remote_features_cb;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800313 btrc_get_play_status_callback get_play_status_cb;
314 btrc_list_player_app_attr_callback list_player_app_attr_cb;
315 btrc_list_player_app_values_callback list_player_app_values_cb;
316 btrc_get_player_app_value_callback get_player_app_value_cb;
317 btrc_get_player_app_attrs_text_callback get_player_app_attrs_text_cb;
318 btrc_get_player_app_values_text_callback get_player_app_values_text_cb;
319 btrc_set_player_app_value_callback set_player_app_value_cb;
320 btrc_get_element_attr_callback get_element_attr_cb;
321 btrc_register_notification_callback register_notification_cb;
Satya Callojife9728d2013-08-01 03:11:11 -0700322 btrc_volume_change_callback volume_change_cb;
John Dub9844812013-07-23 17:15:34 -0700323 btrc_passthrough_cmd_callback passthrough_cmd_cb;
Ayan Ghosh6e728552014-07-25 17:11:58 +0530324 btrc_get_folder_items_callback get_folderitems_cb;
325 btrc_set_addressed_player_callback set_addrplayer_cb;
326 btrc_set_browsed_player_callback set_browsed_player_cb;
327 btrc_change_path_callback change_path_cb;
328 btrc_play_item_callback play_item_cb;
329 btrc_get_item_attr_callback get_item_attr_cb;
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530330 btrc_connection_state_callback connection_state_cb;
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800331} btrc_callbacks_t;
332
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700333/** Represents the standard BT-RC AVRCP Target interface. */
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800334typedef struct {
335
336 /** set to sizeof(BtRcInterface) */
337 size_t size;
338 /**
339 * Register the BtRc callbacks
340 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530341 bt_status_t (*init)( btrc_callbacks_t* callbacks , int max_avrcp_connections);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800342
343 /** Respose to GetPlayStatus request. Contains the current
344 ** 1. Play status
345 ** 2. Song duration/length
346 ** 3. Song position
347 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530348 bt_status_t (*get_play_status_rsp)( btrc_play_status_t play_status, uint32_t song_len,
349 uint32_t song_pos, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800350
351 /** Lists the support player application attributes (Shuffle/Repeat/...)
352 ** num_attr: Specifies the number of attributes contained in the pointer p_attrs
353 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530354 bt_status_t (*list_player_app_attr_rsp)( uint8_t num_attr, btrc_player_attr_t *p_attrs,
355 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800356
357 /** Lists the support player application attributes (Shuffle Off/On/Group)
358 ** num_val: Specifies the number of values contained in the pointer p_vals
359 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530360 bt_status_t (*list_player_app_value_rsp)( uint8_t num_val, uint8_t *p_vals,
361 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800362
363 /** Returns the current application attribute values for each of the specified attr_id */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530364 bt_status_t (*get_player_app_value_rsp)( btrc_player_settings_t *p_vals,
365 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800366
367 /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
368 ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
369 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530370 bt_status_t (*get_player_app_attr_text_rsp)( int num_attr, btrc_player_setting_text_t *p_attrs,
371 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800372
373 /** Returns the application attributes text ("Shuffle"/"Repeat"/...)
374 ** num_attr: Specifies the number of attribute values' text contained in the pointer p_vals
375 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530376 bt_status_t (*get_player_app_value_text_rsp)( int num_val, btrc_player_setting_text_t *p_vals,
377 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800378
379 /** Returns the current songs' element attributes text ("Title"/"Album"/"Artist")
380 ** num_attr: Specifies the number of attributes' text contained in the pointer p_attrs
381 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530382 bt_status_t (*get_element_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs,
383 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800384
385 /** Response to set player attribute request ("Shuffle"/"Repeat")
386 ** rsp_status: Status of setting the player attributes for the current media player
387 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530388 bt_status_t (*set_player_app_value_rsp)(btrc_status_t rsp_status, bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800389
390 /* Response to the register notification request (Play state change/track change/...).
391 ** event_id: Refers to the event_id this notification change corresponds too
392 ** type: Response type - interim/changed
393 ** p_params: Based on the event_id, this parameter should be populated
394 */
395 bt_status_t (*register_notification_rsp)(btrc_event_id_t event_id,
396 btrc_notification_type_t type,
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530397 btrc_register_notification_t *p_param,
398 bt_bdaddr_t *bd_addr);
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800399
Satya Callojife9728d2013-08-01 03:11:11 -0700400 /* AVRCP 1.4 enhancements */
401
402 /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
403 ** This can be enhanced to support Relative Volume (AVRCP 1.0).
404 ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
405 ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
406 */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530407 bt_status_t (*set_volume)(uint8_t volume, bt_bdaddr_t *bd_addr);
408 bt_status_t (*get_folder_items_rsp) (btrc_folder_list_entries_t *p_param, bt_bdaddr_t *bd_addr);
Ayan Ghosh6e728552014-07-25 17:11:58 +0530409
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530410 bt_status_t (*set_addressed_player_rsp) (btrc_status_t status_code, bt_bdaddr_t *bd_addr);
411 bt_status_t (*set_browsed_player_rsp) (btrc_set_browsed_player_rsp_t *p_param,
412 bt_bdaddr_t *bd_addr);
413 bt_status_t (*change_path_rsp) (uint8_t status_code, uint32_t item_count,
414 bt_bdaddr_t *bd_addr);
415 bt_status_t (*play_item_rsp) (uint8_t status_code, bt_bdaddr_t *bd_addr);
416 bt_status_t (*get_item_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs,
417 bt_bdaddr_t *bd_addr);
418 bt_status_t (*is_device_active_in_handoff) (bt_bdaddr_t *bd_addr);
Satya Callojife9728d2013-08-01 03:11:11 -0700419
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800420 /** Closes the interface. */
421 void (*cleanup)( void );
422} btrc_interface_t;
423
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700424
425typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state);
426
AnubhavGupta6f8ab202015-04-08 19:38:14 +0530427typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
428
429typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
430
431typedef void (* btrc_ctrl_getcapability_rsp_callback) (bt_bdaddr_t *bd_addr, int cap_id,
432 uint32_t* supported_values, int num_supported, uint8_t rsp_type);
433
434typedef void (* btrc_ctrl_listplayerappsettingattrib_rsp_callback) (bt_bdaddr_t *bd_addr,
435 uint8_t* supported_attribs, int num_attrib, uint8_t rsp_type);
436
437typedef void (* btrc_ctrl_listplayerappsettingvalue_rsp_callback) (bt_bdaddr_t *bd_addr,
438 uint8_t* supported_val, uint8_t num_supported, uint8_t rsp_type);
439
440typedef void (* btrc_ctrl_currentplayerappsetting_rsp_callback) (bt_bdaddr_t *bd_addr,uint8_t* supported_ids,
441 uint8_t* supported_val, uint8_t num_attrib, uint8_t rsp_type);
442
443typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,uint8_t rsp_type);
444
445typedef void (* btrc_ctrl_notification_rsp_callback) (bt_bdaddr_t *bd_addr, uint8_t rsp_type,
446 int rsp_len, uint8_t* notification_rsp);
447
448typedef void (* btrc_ctrl_getelementattrib_rsp_callback) (bt_bdaddr_t *bd_addr, uint8_t num_attributes,
449 int rsp_len, uint8_t* attrib_rsp, uint8_t rsp_type);
450
451typedef void (* btrc_ctrl_getplaystatus_rsp_callback) (bt_bdaddr_t *bd_addr, int param_len, uint8_t* play_status_rsp
452 ,uint8_t rsp_type);
453
454typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol);
455
456typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr);
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700457/** BT-RC Controller callback structure. */
458typedef struct {
459 /** set to sizeof(BtRcCallbacks) */
460 size_t size;
AnubhavGupta6f8ab202015-04-08 19:38:14 +0530461 btrc_passthrough_rsp_callback passthrough_rsp_cb;
462 btrc_connection_state_callback connection_state_cb;
463 btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
464 btrc_ctrl_getcapability_rsp_callback getcap_rsp_cb;
465 btrc_ctrl_listplayerappsettingattrib_rsp_callback listplayerappsettingattrib_rsp_cb;
466 btrc_ctrl_listplayerappsettingvalue_rsp_callback listplayerappsettingvalue_rsp_cb;
467 btrc_ctrl_currentplayerappsetting_rsp_callback currentplayerappsetting_rsp_cb;
468 btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
469 btrc_ctrl_notification_rsp_callback notification_rsp_cb;
470 btrc_ctrl_getelementattrib_rsp_callback getelementattrib_rsp_cb;
471 btrc_ctrl_getplaystatus_rsp_callback getplaystatus_rsp_cb;
472 btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
473 btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700474} btrc_ctrl_callbacks_t;
475
476/** Represents the standard BT-RC AVRCP Controller interface. */
477typedef struct {
478
479 /** set to sizeof(BtRcInterface) */
480 size_t size;
481 /**
482 * Register the BtRc callbacks
483 */
484 bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
485
486 /** send pass through command to target */
Gaurav Asatiaacbc382014-08-14 15:30:52 +0530487 bt_status_t (*send_pass_through_cmd) ( bt_bdaddr_t *bd_addr, uint8_t key_code,
488 uint8_t key_state );
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700489
AnubhavGupta6f8ab202015-04-08 19:38:14 +0530490 /** send get_cap command to target */
491 bt_status_t (*getcapabilities_cmd) (uint8_t cap_id);
492
493 /** send command to get supported player application settings to target */
494 bt_status_t (*list_player_app_setting_attrib_cmd) (void);
495
496 /** send command to get supported values of player application settings for a
497 * particular attribute to target */
498 bt_status_t (*list_player_app_setting_value_cmd) (uint8_t attrib_id);
499
500 /** send command to get current player attributes to target */
501 bt_status_t (*get_player_app_setting_cmd) (uint8_t num_attrib, uint8_t* attrib_ids);
502
503 /** send command to set player applicaiton setting attributes to target */
504 bt_status_t (*set_player_app_setting_cmd) (uint8_t num_attrib, uint8_t* attrib_ids, uint8_t* attrib_vals);
505
506 /** send command to register for supported notificaiton events to target */
507 bt_status_t (*register_notification_cmd) (uint8_t event_id, uint32_t event_value);
508
509 /** send command to get element attribute to target */
510 bt_status_t (*get_element_attribute_cmd) (uint8_t num_attribute, uint32_t attribute_id);
511
512 /** send command to get play status to target */
513 bt_status_t (*get_play_status_cmd) (void);
514
515 /** send rsp to set_abs_vol received from target */
516 bt_status_t (*send_abs_vol_rsp) (uint8_t abs_vol);
517
518 /** send notificaiton rsp for abs vol to target */
519 bt_status_t (*send_register_abs_vol_rsp) (uint8_t rsp_type, uint8_t abs_vol);
520
Mike Lockwood7da4cb82014-06-02 16:20:51 -0700521 /** Closes the interface. */
522 void (*cleanup)( void );
523} btrc_ctrl_interface_t;
524
Ravi Nagarajan482ba782013-02-26 10:34:41 -0800525__END_DECLS
526
Satya Callojife9728d2013-08-01 03:11:11 -0700527#endif /* ANDROID_INCLUDE_BT_RC_H */