Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 1 | /* |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 2 | * Copyright (C) 2013-2014, The Linux Foundation. All rights reserved. |
| 3 | * Not a Contribution. |
| 4 | * |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 5 | * 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 Nagarajan | ebb8c1b | 2013-03-22 04:18:47 -0700 | [diff] [blame] | 31 | #define BTRC_MAX_ELEM_ATTR_SIZE 7 |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 32 | #define BTRC_CHARSET_UTF8 0x006A |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 33 | |
| 34 | typedef uint8_t btrc_uid_t[BTRC_UID_SIZE]; |
| 35 | |
| 36 | typedef enum { |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 37 | 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 | |
| 43 | typedef enum { |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 44 | 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 | |
| 52 | typedef 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 Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 59 | BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09, |
| 60 | BTRC_EVT_AVAILABLE_PLAYERS_CHANGED = 0x0a, |
| 61 | BTRC_EVT_ADDRESSED_PLAYER_CHANGED = 0x0b, |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 62 | } btrc_event_id_t; |
| 63 | |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 64 | //used for Scope |
| 65 | typedef 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 73 | typedef enum { |
| 74 | BTRC_NOTIFICATION_TYPE_INTERIM = 0, |
| 75 | BTRC_NOTIFICATION_TYPE_CHANGED = 1, |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 76 | BTRC_NOTIFICATION_TYPE_REJECT = 2, |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 77 | } btrc_notification_type_t; |
| 78 | |
| 79 | typedef 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 | |
| 86 | typedef 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 | |
| 96 | typedef 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 | |
| 103 | typedef 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 | |
| 109 | typedef 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 Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 117 | typedef 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 123 | typedef 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 Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 129 | typedef 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 137 | typedef 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 Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 143 | uint16_t player_id; |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 144 | } btrc_register_notification_t; |
| 145 | |
| 146 | typedef 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 | |
| 151 | typedef struct { |
| 152 | uint32_t attr_id; |
| 153 | uint8_t text[BTRC_MAX_ATTR_STR_LEN]; |
| 154 | } btrc_element_attr_val_t; |
| 155 | |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 156 | /** Callback for the controller's supported feautres */ |
| 157 | typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr, |
| 158 | btrc_remote_features_t features); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 159 | #define BTRC_FEATURE_MASK_SIZE 16 |
| 160 | |
| 161 | typedef uint8_t btrc_feature_mask_t[BTRC_FEATURE_MASK_SIZE]; |
| 162 | |
| 163 | typedef struct { |
| 164 | uint16_t charset_id; |
| 165 | uint16_t str_len; |
| 166 | uint8_t *p_str; |
| 167 | } btrc_player_full_name_t; |
| 168 | |
| 169 | typedef 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 | |
| 179 | typedef 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 | |
| 187 | typedef struct |
| 188 | { |
| 189 | uint32_t attr_id; |
| 190 | btrc_player_full_name_t name; |
| 191 | } btrc_attr_entry_t; |
| 192 | |
| 193 | typedef 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 | |
| 202 | typedef struct { |
| 203 | uint16_t str_len; |
| 204 | uint8_t *p_str; |
| 205 | } btrc_name_t; |
| 206 | |
| 207 | /* SetBrowsedPlayer */ |
| 208 | typedef 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 | |
| 218 | typedef 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 */ |
| 230 | typedef 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 Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 237 | |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 238 | /** Callback for play status request */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 239 | typedef void (* btrc_get_play_status_callback)(bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 240 | |
| 241 | /** Callback for list player application attributes (Shuffle, Repeat,...) */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 242 | typedef void (* btrc_list_player_app_attr_callback)(bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 243 | |
| 244 | /** Callback for list player application attributes (Shuffle, Repeat,...) */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 245 | typedef void (* btrc_list_player_app_values_callback)(btrc_player_attr_t attr_id, |
| 246 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 247 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 251 | typedef void (* btrc_get_player_app_value_callback) (uint8_t num_attr, btrc_player_attr_t *p_attrs, |
| 252 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 253 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 257 | typedef 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 259 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 263 | typedef 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 265 | |
| 266 | /** Callback for setting the player application settings values */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 267 | typedef void (* btrc_set_player_app_value_callback) (btrc_player_settings_t *p_vals, |
| 268 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 269 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 273 | typedef void (* btrc_get_element_attr_callback) (uint8_t num_attr, btrc_media_attr_t *p_attrs, |
| 274 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 275 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 279 | typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param, |
| 280 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 281 | |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 282 | /* AVRCP 1.4 Enhancements */ |
| 283 | /** Callback for volume change on CT |
| 284 | ** volume: Current volume setting on the CT (0-127) |
| 285 | */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 286 | typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype, bt_bdaddr_t *bd_addr); |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 287 | |
John Du | b984481 | 2013-07-23 17:15:34 -0700 | [diff] [blame] | 288 | /** Callback for passthrough commands */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 289 | typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state, bt_bdaddr_t *bd_addr); |
John Du | b984481 | 2013-07-23 17:15:34 -0700 | [diff] [blame] | 290 | |
Mike Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 291 | /** BT-RC Target callback structure. */ |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 292 | |
| 293 | typedef void (* btrc_get_folder_items_callback) (btrc_browse_folderitem_t id, |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 294 | btrc_getfolderitem_t *param, bt_bdaddr_t *bd_addr); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 295 | |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 296 | typedef void (* btrc_set_addressed_player_callback) (uint32_t player_id, bt_bdaddr_t *bd_addr); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 297 | |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 298 | typedef void (* btrc_set_browsed_player_callback) (uint32_t player_id, bt_bdaddr_t *bd_addr); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 299 | |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 300 | typedef void (* btrc_change_path_callback) (uint8_t direction, uint64_t uid, bt_bdaddr_t *bd_addr); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 301 | |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 302 | typedef void (* btrc_play_item_callback) (uint8_t scope, uint64_t uid, bt_bdaddr_t *bd_addr); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 303 | |
| 304 | typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint64_t uid, |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 305 | uint8_t num_attr, btrc_media_attr_t *p_attrs, bt_bdaddr_t *bd_addr); |
| 306 | |
| 307 | typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr); |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 308 | |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 309 | typedef struct { |
| 310 | /** set to sizeof(BtRcCallbacks) */ |
| 311 | size_t size; |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 312 | btrc_remote_features_callback remote_features_cb; |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 313 | 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 Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 322 | btrc_volume_change_callback volume_change_cb; |
John Du | b984481 | 2013-07-23 17:15:34 -0700 | [diff] [blame] | 323 | btrc_passthrough_cmd_callback passthrough_cmd_cb; |
Ayan Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 324 | 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 330 | btrc_connection_state_callback connection_state_cb; |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 331 | } btrc_callbacks_t; |
| 332 | |
Mike Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 333 | /** Represents the standard BT-RC AVRCP Target interface. */ |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 334 | typedef struct { |
| 335 | |
| 336 | /** set to sizeof(BtRcInterface) */ |
| 337 | size_t size; |
| 338 | /** |
| 339 | * Register the BtRc callbacks |
| 340 | */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 341 | bt_status_t (*init)( btrc_callbacks_t* callbacks , int max_avrcp_connections); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 342 | |
| 343 | /** Respose to GetPlayStatus request. Contains the current |
| 344 | ** 1. Play status |
| 345 | ** 2. Song duration/length |
| 346 | ** 3. Song position |
| 347 | */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 348 | 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 350 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 354 | 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 356 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 360 | bt_status_t (*list_player_app_value_rsp)( uint8_t num_val, uint8_t *p_vals, |
| 361 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 362 | |
| 363 | /** Returns the current application attribute values for each of the specified attr_id */ |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 364 | bt_status_t (*get_player_app_value_rsp)( btrc_player_settings_t *p_vals, |
| 365 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 366 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 370 | 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 372 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 376 | 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 378 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 382 | 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 Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 384 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 388 | bt_status_t (*set_player_app_value_rsp)(btrc_status_t rsp_status, bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 389 | |
| 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 397 | btrc_register_notification_t *p_param, |
| 398 | bt_bdaddr_t *bd_addr); |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 399 | |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 400 | /* 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 407 | 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 Ghosh | 6e72855 | 2014-07-25 17:11:58 +0530 | [diff] [blame] | 409 | |
Gaurav Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 410 | 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 Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 419 | |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 420 | /** Closes the interface. */ |
| 421 | void (*cleanup)( void ); |
| 422 | } btrc_interface_t; |
| 423 | |
Mike Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 424 | |
| 425 | typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state); |
| 426 | |
AnubhavGupta | 6f8ab20 | 2015-04-08 19:38:14 +0530 | [diff] [blame] | 427 | typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr); |
| 428 | |
| 429 | typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features); |
| 430 | |
| 431 | typedef 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 | |
| 434 | typedef void (* btrc_ctrl_listplayerappsettingattrib_rsp_callback) (bt_bdaddr_t *bd_addr, |
| 435 | uint8_t* supported_attribs, int num_attrib, uint8_t rsp_type); |
| 436 | |
| 437 | typedef 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 | |
| 440 | typedef 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 | |
| 443 | typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,uint8_t rsp_type); |
| 444 | |
| 445 | typedef void (* btrc_ctrl_notification_rsp_callback) (bt_bdaddr_t *bd_addr, uint8_t rsp_type, |
| 446 | int rsp_len, uint8_t* notification_rsp); |
| 447 | |
| 448 | typedef 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 | |
| 451 | typedef 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 | |
| 454 | typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol); |
| 455 | |
| 456 | typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr); |
Mike Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 457 | /** BT-RC Controller callback structure. */ |
| 458 | typedef struct { |
| 459 | /** set to sizeof(BtRcCallbacks) */ |
| 460 | size_t size; |
AnubhavGupta | 6f8ab20 | 2015-04-08 19:38:14 +0530 | [diff] [blame] | 461 | 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 Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 474 | } btrc_ctrl_callbacks_t; |
| 475 | |
| 476 | /** Represents the standard BT-RC AVRCP Controller interface. */ |
| 477 | typedef 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 Asati | aacbc38 | 2014-08-14 15:30:52 +0530 | [diff] [blame] | 487 | bt_status_t (*send_pass_through_cmd) ( bt_bdaddr_t *bd_addr, uint8_t key_code, |
| 488 | uint8_t key_state ); |
Mike Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 489 | |
AnubhavGupta | 6f8ab20 | 2015-04-08 19:38:14 +0530 | [diff] [blame] | 490 | /** 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 Lockwood | 7da4cb8 | 2014-06-02 16:20:51 -0700 | [diff] [blame] | 521 | /** Closes the interface. */ |
| 522 | void (*cleanup)( void ); |
| 523 | } btrc_ctrl_interface_t; |
| 524 | |
Ravi Nagarajan | 482ba78 | 2013-02-26 10:34:41 -0800 | [diff] [blame] | 525 | __END_DECLS |
| 526 | |
Satya Calloji | fe9728d | 2013-08-01 03:11:11 -0700 | [diff] [blame] | 527 | #endif /* ANDROID_INCLUDE_BT_RC_H */ |