// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef __ESP_AVRC_API_H__ #define __ESP_AVRC_API_H__ #include #include #include "esp_err.h" #include "esp_bt_defs.h" #ifdef __cplusplus extern "C" { #endif #define ESP_AVRC_TRANS_LABEL_MAX 15 /*!< max transaction label */ /// AVRC feature bit mask typedef enum { ESP_AVRC_FEAT_RCTG = 0x0001, /*!< remote control target */ ESP_AVRC_FEAT_RCCT = 0x0002, /*!< remote control controller */ ESP_AVRC_FEAT_VENDOR = 0x0008, /*!< remote control vendor dependent commands */ ESP_AVRC_FEAT_BROWSE = 0x0010, /*!< use browsing channel */ ESP_AVRC_FEAT_META_DATA = 0x0040, /*!< remote control metadata transfer command/response */ ESP_AVRC_FEAT_ADV_CTRL = 0x0200, /*!< remote control advanced control commmand/response */ } esp_avrc_features_t; /// AVRC supported features flag retrieved in SDP record typedef enum { ESP_AVRC_FEAT_FLAG_CAT1 = 0x0001, /*!< category 1 */ ESP_AVRC_FEAT_FLAG_CAT2 = 0x0002, /*!< category 2 */ ESP_AVRC_FEAT_FLAG_CAT3 = 0x0004, /*!< category 3 */ ESP_AVRC_FEAT_FLAG_CAT4 = 0x0008, /*!< category 4 */ ESP_AVRC_FEAT_FLAG_BROWSING = 0x0040, /*!< browsing */ ESP_AVRC_FEAT_FLAG_COVER_ART_GET_IMAGE_PROP = 0x0080, /*!< Cover Art GetImageProperties */ ESP_AVRC_FEAT_FLAG_COVER_ART_GET_IMAGE = 0x0100, /*!< Cover Art GetImage */ ESP_AVRC_FEAT_FLAG_COVER_ART_GET_LINKED_THUMBNAIL = 0x0200, /*!< Cover Art GetLinkedThumbnail */ } esp_avrc_feature_flag_t; /// AVRC passthrough command code typedef enum { ESP_AVRC_PT_CMD_SELECT = 0x00, /*!< select */ ESP_AVRC_PT_CMD_UP = 0x01, /*!< up */ ESP_AVRC_PT_CMD_DOWN = 0x02, /*!< down */ ESP_AVRC_PT_CMD_LEFT = 0x03, /*!< left */ ESP_AVRC_PT_CMD_RIGHT = 0x04, /*!< right */ ESP_AVRC_PT_CMD_RIGHT_UP = 0x05, /*!< right-up */ ESP_AVRC_PT_CMD_RIGHT_DOWN = 0x06, /*!< right-down */ ESP_AVRC_PT_CMD_LEFT_UP = 0x07, /*!< left-up */ ESP_AVRC_PT_CMD_LEFT_DOWN = 0x08, /*!< left-down */ ESP_AVRC_PT_CMD_ROOT_MENU = 0x09, /*!< root menu */ ESP_AVRC_PT_CMD_SETUP_MENU = 0x0A, /*!< setup menu */ ESP_AVRC_PT_CMD_CONT_MENU = 0x0B, /*!< contents menu */ ESP_AVRC_PT_CMD_FAV_MENU = 0x0C, /*!< favorite menu */ ESP_AVRC_PT_CMD_EXIT = 0x0D, /*!< exit */ ESP_AVRC_PT_CMD_0 = 0x20, /*!< 0 */ ESP_AVRC_PT_CMD_1 = 0x21, /*!< 1 */ ESP_AVRC_PT_CMD_2 = 0x22, /*!< 2 */ ESP_AVRC_PT_CMD_3 = 0x23, /*!< 3 */ ESP_AVRC_PT_CMD_4 = 0x24, /*!< 4 */ ESP_AVRC_PT_CMD_5 = 0x25, /*!< 5 */ ESP_AVRC_PT_CMD_6 = 0x26, /*!< 6 */ ESP_AVRC_PT_CMD_7 = 0x27, /*!< 7 */ ESP_AVRC_PT_CMD_8 = 0x28, /*!< 8 */ ESP_AVRC_PT_CMD_9 = 0x29, /*!< 9 */ ESP_AVRC_PT_CMD_DOT = 0x2A, /*!< dot */ ESP_AVRC_PT_CMD_ENTER = 0x2B, /*!< enter */ ESP_AVRC_PT_CMD_CLEAR = 0x2C, /*!< clear */ ESP_AVRC_PT_CMD_CHAN_UP = 0x30, /*!< channel up */ ESP_AVRC_PT_CMD_CHAN_DOWN = 0x31, /*!< channel down */ ESP_AVRC_PT_CMD_PREV_CHAN = 0x32, /*!< previous channel */ ESP_AVRC_PT_CMD_SOUND_SEL = 0x33, /*!< sound select */ ESP_AVRC_PT_CMD_INPUT_SEL = 0x34, /*!< input select */ ESP_AVRC_PT_CMD_DISP_INFO = 0x35, /*!< display information */ ESP_AVRC_PT_CMD_HELP = 0x36, /*!< help */ ESP_AVRC_PT_CMD_PAGE_UP = 0x37, /*!< page up */ ESP_AVRC_PT_CMD_PAGE_DOWN = 0x38, /*!< page down */ ESP_AVRC_PT_CMD_POWER = 0x40, /*!< power */ ESP_AVRC_PT_CMD_VOL_UP = 0x41, /*!< volume up */ ESP_AVRC_PT_CMD_VOL_DOWN = 0x42, /*!< volume down */ ESP_AVRC_PT_CMD_MUTE = 0x43, /*!< mute */ ESP_AVRC_PT_CMD_PLAY = 0x44, /*!< play */ ESP_AVRC_PT_CMD_STOP = 0x45, /*!< stop */ ESP_AVRC_PT_CMD_PAUSE = 0x46, /*!< pause */ ESP_AVRC_PT_CMD_RECORD = 0x47, /*!< record */ ESP_AVRC_PT_CMD_REWIND = 0x48, /*!< rewind */ ESP_AVRC_PT_CMD_FAST_FORWARD = 0x49, /*!< fast forward */ ESP_AVRC_PT_CMD_EJECT = 0x4A, /*!< eject */ ESP_AVRC_PT_CMD_FORWARD = 0x4B, /*!< forward */ ESP_AVRC_PT_CMD_BACKWARD = 0x4C, /*!< backward */ ESP_AVRC_PT_CMD_ANGLE = 0x50, /*!< angle */ ESP_AVRC_PT_CMD_SUBPICT = 0x51, /*!< subpicture */ ESP_AVRC_PT_CMD_F1 = 0x71, /*!< F1 */ ESP_AVRC_PT_CMD_F2 = 0x72, /*!< F2 */ ESP_AVRC_PT_CMD_F3 = 0x73, /*!< F3 */ ESP_AVRC_PT_CMD_F4 = 0x74, /*!< F4 */ ESP_AVRC_PT_CMD_F5 = 0x75, /*!< F5 */ ESP_AVRC_PT_CMD_VENDOR = 0x7E, /*!< vendor unique */ } esp_avrc_pt_cmd_t; /// AVRC passthrough command filter typedef enum { ESP_AVRC_PSTH_FILTER_ALLOWED_CMD = 0, /*!< all of the PASSTHROUGH commands that can possibly be used, immuateble */ ESP_AVRC_PSTH_FILTER_SUPPORTED_CMD = 1, /*!< PASSTHROUGH commands selectively supported according to the current configuration */ ESP_AVRC_PSTH_FILTER_SUPPORT_MAX, } esp_avrc_psth_filter_t; /// AVRC passthrough command bit mask typedef struct { uint16_t bits[8]; /*!< bit mask representation of PASSTHROUGH commands */ } esp_avrc_psth_bit_mask_t; typedef enum { ESP_AVRC_BIT_MASK_OP_TEST = 0, /*!< operation code to test a specific bit */ ESP_AVRC_BIT_MASK_OP_SET = 1, /*!< operation code to set a specific bit */ ESP_AVRC_BIT_MASK_OP_CLEAR = 2, /*!< operation code to clear a specific bit */ } esp_avrc_bit_mask_op_t; /// AVRC passthrough command state typedef enum { ESP_AVRC_PT_CMD_STATE_PRESSED = 0, /*!< key pressed */ ESP_AVRC_PT_CMD_STATE_RELEASED = 1 /*!< key released */ } esp_avrc_pt_cmd_state_t; /// AVRC Controller callback events typedef enum { ESP_AVRC_CT_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */ ESP_AVRC_CT_PASSTHROUGH_RSP_EVT = 1, /*!< passthrough response event */ ESP_AVRC_CT_METADATA_RSP_EVT = 2, /*!< metadata response event */ ESP_AVRC_CT_PLAY_STATUS_RSP_EVT = 3, /*!< play status response event */ ESP_AVRC_CT_CHANGE_NOTIFY_EVT = 4, /*!< notification event */ ESP_AVRC_CT_REMOTE_FEATURES_EVT = 5, /*!< feature of remote device indication event */ ESP_AVRC_CT_GET_RN_CAPABILITIES_RSP_EVT = 6, /*!< supported notification events capability of peer device */ ESP_AVRC_CT_SET_ABSOLUTE_VOLUME_RSP_EVT = 7, /*!< set absolute volume response event */ } esp_avrc_ct_cb_event_t; /// AVRC Target callback events typedef enum { ESP_AVRC_TG_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */ ESP_AVRC_TG_REMOTE_FEATURES_EVT = 1, /*!< feature of remote device indication event */ ESP_AVRC_TG_PASSTHROUGH_CMD_EVT = 2, /*!< passthrough command event */ ESP_AVRC_TG_SET_ABSOLUTE_VOLUME_CMD_EVT = 3, /*!< set absolute volume command from remote device */ ESP_AVRC_TG_REGISTER_NOTIFICATION_EVT = 4, /*!< register notification event */ } esp_avrc_tg_cb_event_t; /// AVRC metadata attribute mask typedef enum { ESP_AVRC_MD_ATTR_TITLE = 0x1, /*!< title of the playing track */ ESP_AVRC_MD_ATTR_ARTIST = 0x2, /*!< track artist */ ESP_AVRC_MD_ATTR_ALBUM = 0x4, /*!< album name */ ESP_AVRC_MD_ATTR_TRACK_NUM = 0x8, /*!< track position on the album */ ESP_AVRC_MD_ATTR_NUM_TRACKS = 0x10, /*!< number of tracks on the album */ ESP_AVRC_MD_ATTR_GENRE = 0x20, /*!< track genre */ ESP_AVRC_MD_ATTR_PLAYING_TIME = 0x40 /*!< total album playing time in miliseconds */ } esp_avrc_md_attr_mask_t; /// AVRC event notification ids typedef enum { ESP_AVRC_RN_PLAY_STATUS_CHANGE = 0x01, /*!< track status change, eg. from playing to paused */ ESP_AVRC_RN_TRACK_CHANGE = 0x02, /*!< new track is loaded */ ESP_AVRC_RN_TRACK_REACHED_END = 0x03, /*!< current track reached end */ ESP_AVRC_RN_TRACK_REACHED_START = 0x04, /*!< current track reached start position */ ESP_AVRC_RN_PLAY_POS_CHANGED = 0x05, /*!< track playing position changed */ ESP_AVRC_RN_BATTERY_STATUS_CHANGE = 0x06, /*!< battery status changed */ ESP_AVRC_RN_SYSTEM_STATUS_CHANGE = 0x07, /*!< system status changed */ ESP_AVRC_RN_APP_SETTING_CHANGE = 0x08, /*!< application settings changed */ ESP_AVRC_RN_NOW_PLAYING_CHANGE = 0x09, /*!< now playing content changed */ ESP_AVRC_RN_AVAILABLE_PLAYERS_CHANGE = 0x0a, /*!< available players changed */ ESP_AVRC_RN_ADDRESSED_PLAYER_CHANGE = 0x0b, /*!< the addressed player changed */ ESP_AVRC_RN_UIDS_CHANGE = 0x0c, /*!< UIDs changed */ ESP_AVRC_RN_VOLUME_CHANGE = 0x0d, /*!< volume changed locally on TG */ ESP_AVRC_RN_MAX_EVT } esp_avrc_rn_event_ids_t; /// AVRC target notification event notification capability typedef enum { ESP_AVRC_RN_CAP_ALLOWED_EVT = 0, /*!< all of the notification events that can possibly be supported, immutable */ ESP_AVRC_RN_CAP_SUPPORTED_EVT = 1, /*!< notification events selectively supported according to the current configuration */ ESP_AVRC_RN_CAP_MAX, } esp_avrc_rn_evt_cap_t; /// AVRC target notification event capability bit mask typedef struct { uint16_t bits; /*!< bit mask representation of PASSTHROUGH commands */ } esp_avrc_rn_evt_cap_mask_t; /// AVRC notification response type typedef enum { ESP_AVRC_RN_RSP_INTERIM = 13, /*!< initial response to RegisterNotification, should be sent T_mtp(1000ms) from receiving the command */ ESP_AVRC_RN_RSP_CHANGED = 15, /*!< final response to RegisterNotification command */ } esp_avrc_rn_rsp_t; /// AVRC player setting ids typedef enum { ESP_AVRC_PS_EQUALIZER = 0x01, /*!< equalizer, on or off */ ESP_AVRC_PS_REPEAT_MODE = 0x02, /*!< repeat mode */ ESP_AVRC_PS_SHUFFLE_MODE = 0x03, /*!< shuffle mode */ ESP_AVRC_PS_SCAN_MODE = 0x04, /*!< scan mode on or off */ ESP_AVRC_PS_MAX_ATTR } esp_avrc_ps_attr_ids_t; /// AVRC equalizer modes typedef enum { ESP_AVRC_PS_EQUALIZER_OFF = 0x1, /*!< equalizer OFF */ ESP_AVRC_PS_EQUALIZER_ON = 0x2 /*!< equalizer ON */ } esp_avrc_ps_eq_value_ids_t; /// AVRC repeat modes typedef enum { ESP_AVRC_PS_REPEAT_OFF = 0x1, /*!< repeat mode off */ ESP_AVRC_PS_REPEAT_SINGLE = 0x2, /*!< single track repeat */ ESP_AVRC_PS_REPEAT_GROUP = 0x3 /*!< group repeat */ } esp_avrc_ps_rpt_value_ids_t; /// AVRC shuffle modes typedef enum { ESP_AVRC_PS_SHUFFLE_OFF = 0x1, /*