diff options
-rw-r--r-- | include/hardware/bt_rc.h | 139 |
1 files changed, 137 insertions, 2 deletions
diff --git a/include/hardware/bt_rc.h b/include/hardware/bt_rc.h index c565c48..20fe3bf 100644 --- a/include/hardware/bt_rc.h +++ b/include/hardware/bt_rc.h @@ -26,6 +26,7 @@ __BEGIN_DECLS #define BTRC_MAX_FOLDER_DEPTH 4 #define BTRC_MAX_APP_ATTR_SIZE 16 #define BTRC_MAX_ELEM_ATTR_SIZE 7 +#define BTRC_CHARSET_UTF8 0x006A typedef uint8_t btrc_uid_t[BTRC_UID_SIZE]; @@ -52,11 +53,24 @@ typedef enum { BTRC_EVT_TRACK_REACHED_START = 0x04, BTRC_EVT_PLAY_POS_CHANGED = 0x05, BTRC_EVT_APP_SETTINGS_CHANGED = 0x08, + BTRC_EVT_NOW_PLAYING_CONTENT_CHANGED = 0x09, + BTRC_EVT_AVAILABLE_PLAYERS_CHANGED = 0x0a, + BTRC_EVT_ADDRESSED_PLAYER_CHANGED = 0x0b, } btrc_event_id_t; +//used for Scope +typedef enum { + BTRC_EVT_MEDIA_PLAYLIST = 0, + BTRC_EVT_MEDIA_VIRTUALFILESYST = 1, + BTRC_EVT_SEARCH = 2, + BTRC_EVT_NOWPLAYING = 3, + BTRC_EVT_MAX_BROWSE = 4, +} btrc_browse_folderitem_t; + typedef enum { BTRC_NOTIFICATION_TYPE_INTERIM = 0, BTRC_NOTIFICATION_TYPE_CHANGED = 1, + BTRC_NOTIFICATION_TYPE_REJECT = 2, } btrc_notification_type_t; typedef enum { @@ -97,18 +111,33 @@ typedef enum { BTRC_STS_NO_ERROR = 0x04 /* Operation Success */ } btrc_status_t; +typedef enum { + BTRC_TYPE_MEDIA_PLAYER = 0x01, + BTRC_TYPE_FOLDER = 0x02, + BTRC_TYPE_MEDIA_ELEMENT = 0x03 +} btrc_folder_list_item_type_t; + typedef struct { uint8_t num_attr; uint8_t attr_ids[BTRC_MAX_APP_SETTINGS]; uint8_t attr_values[BTRC_MAX_APP_SETTINGS]; } btrc_player_settings_t; +typedef struct { + uint32_t start_item; + uint32_t end_item; + uint32_t size; + uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE]; + uint8_t attr_count; +}btrc_getfolderitem_t; + typedef union { btrc_play_status_t play_status; btrc_uid_t track; /* queue position in NowPlaying */ uint32_t song_pos; btrc_player_settings_t player_setting; + uint16_t player_id; } btrc_register_notification_t; typedef struct { @@ -124,6 +153,84 @@ typedef struct { /** Callback for the controller's supported feautres */ typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr, btrc_remote_features_t features); +#define BTRC_FEATURE_MASK_SIZE 16 + +typedef uint8_t btrc_feature_mask_t[BTRC_FEATURE_MASK_SIZE]; + +typedef struct { + uint16_t charset_id; + uint16_t str_len; + uint8_t *p_str; +} btrc_player_full_name_t; + +typedef struct +{ + uint32_t sub_type; + uint16_t player_id; + uint8_t major_type; + uint8_t play_status; + btrc_feature_mask_t features; /* Supported feature bit mask*/ + btrc_player_full_name_t name; /* The player name, name length and character set id.*/ +} btrc_folder_list_item_player_t; + +typedef struct +{ + uint64_t uid; + uint8_t type; + uint8_t playable; + btrc_player_full_name_t name; +} btrc_folder_list_item_folder_t; + +typedef struct +{ + uint32_t attr_id; + btrc_player_full_name_t name; +} btrc_attr_entry_t; + +typedef struct +{ + uint64_t uid; + uint8_t type; + uint8_t attr_count; + btrc_player_full_name_t name; + btrc_attr_entry_t* p_attr_list; +} btrc_folder_list_item_media_t; + +typedef struct { + uint16_t str_len; + uint8_t *p_str; +} btrc_name_t; + +/* SetBrowsedPlayer */ +typedef struct +{ + uint32_t num_items; + uint16_t uid_counter; + uint16_t charset_id; + uint8_t status; + uint8_t folder_depth; + btrc_name_t *p_folders; +} btrc_set_browsed_player_rsp_t; + +typedef struct +{ + uint8_t item_type; + union + { + btrc_folder_list_item_player_t player; + btrc_folder_list_item_folder_t folder; + btrc_folder_list_item_media_t media; + } u; +} btrc_folder_list_item_t; + +/* GetFolderItems */ +typedef struct +{ + uint16_t uid_counter; + uint16_t item_count; + uint8_t status; + btrc_folder_list_item_t *p_item_list; +} btrc_folder_list_entries_t; /** Callback for play status request */ typedef void (* btrc_get_play_status_callback)(); @@ -172,6 +279,21 @@ typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype); typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state); /** BT-RC Target callback structure. */ + +typedef void (* btrc_get_folder_items_callback) (btrc_browse_folderitem_t id, + btrc_getfolderitem_t *param); + +typedef void (* btrc_set_addressed_player_callback) (uint32_t player_id); + +typedef void (* btrc_set_browsed_player_callback) (uint32_t player_id); + +typedef void (* btrc_change_path_callback) (uint8_t direction, uint64_t uid); + +typedef void (* btrc_play_item_callback) (uint8_t scope, uint64_t uid); + +typedef void (* btrc_get_item_attr_callback) (uint8_t scope, uint64_t uid, + uint8_t num_attr, btrc_media_attr_t *p_attrs); + typedef struct { /** set to sizeof(BtRcCallbacks) */ size_t size; @@ -187,6 +309,12 @@ typedef struct { btrc_register_notification_callback register_notification_cb; btrc_volume_change_callback volume_change_cb; btrc_passthrough_cmd_callback passthrough_cmd_cb; + btrc_get_folder_items_callback get_folderitems_cb; + btrc_set_addressed_player_callback set_addrplayer_cb; + btrc_set_browsed_player_callback set_browsed_player_cb; + btrc_change_path_callback change_path_cb; + btrc_play_item_callback play_item_cb; + btrc_get_item_attr_callback get_item_attr_cb; } btrc_callbacks_t; /** Represents the standard BT-RC AVRCP Target interface. */ @@ -209,12 +337,12 @@ typedef struct { /** Lists the support player application attributes (Shuffle/Repeat/...) ** num_attr: Specifies the number of attributes contained in the pointer p_attrs */ - bt_status_t (*list_player_app_attr_rsp)( int num_attr, btrc_player_attr_t *p_attrs); + bt_status_t (*list_player_app_attr_rsp)( uint8_t num_attr, btrc_player_attr_t *p_attrs); /** Lists the support player application attributes (Shuffle Off/On/Group) ** num_val: Specifies the number of values contained in the pointer p_vals */ - bt_status_t (*list_player_app_value_rsp)( int num_val, uint8_t *p_vals); + bt_status_t (*list_player_app_value_rsp)( uint8_t num_val, uint8_t *p_vals); /** Returns the current application attribute values for each of the specified attr_id */ bt_status_t (*get_player_app_value_rsp)( btrc_player_settings_t *p_vals); @@ -256,6 +384,13 @@ typedef struct { ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set */ bt_status_t (*set_volume)(uint8_t volume); + bt_status_t (*get_folder_items_rsp) (btrc_folder_list_entries_t *p_param); + + bt_status_t (*set_addressed_player_rsp) (btrc_status_t status_code); + bt_status_t (*set_browsed_player_rsp) (btrc_set_browsed_player_rsp_t *p_param); + bt_status_t (*change_path_rsp) (uint8_t status_code, uint32_t item_count); + bt_status_t (*play_item_rsp) (uint8_t status_code); + bt_status_t (*get_item_attr_rsp)( uint8_t num_attr, btrc_element_attr_val_t *p_attrs); /** Closes the interface. */ void (*cleanup)( void ); |