1/* 2 * Copyright (C) 2016 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 17package com.android.bluetooth.avrcp; 18 19/************************************************************************************************* 20 * Grouped all HAL constants into a file to be consistent with the stack. 21 * Moved the constants used in Avrcp to this new file to be used across multiple files. 22 * Helps in easier modifications and future enhancements in the constants. 23 ************************************************************************************************/ 24 25/* 26 * @hide 27 */ 28final class AvrcpConstants { 29 30 /* Do not modify without upating the HAL bt_rc.h file */ 31 /** Response Error codes **/ 32 static final byte RSP_BAD_CMD = 0x00; /* Invalid command */ 33 static final byte RSP_BAD_PARAM = 0x01; /* Invalid parameter */ 34 static final byte RSP_NOT_FOUND = 0x02; /* Specified parameter is 35 * wrong or not found */ 36 static final byte RSP_INTERNAL_ERR = 0x03; /* Internal Error */ 37 static final byte RSP_NO_ERROR = 0x04; /* Operation Success */ 38 static final byte RSP_UID_CHANGED = 0x05; /* UIDs changed */ 39 static final byte RSP_RESERVED = 0x06; /* Reserved */ 40 static final byte RSP_INV_DIRN = 0x07; /* Invalid direction */ 41 static final byte RSP_INV_DIRECTORY = 0x08; /* Invalid directory */ 42 static final byte RSP_INV_ITEM = 0x09; /* Invalid Item */ 43 static final byte RSP_INV_SCOPE = 0x0a; /* Invalid scope */ 44 static final byte RSP_INV_RANGE = 0x0b; /* Invalid range */ 45 static final byte RSP_DIRECTORY = 0x0c; /* UID is a directory */ 46 static final byte RSP_MEDIA_IN_USE = 0x0d; /* Media in use */ 47 static final byte RSP_PLAY_LIST_FULL = 0x0e; /* Playing list full */ 48 static final byte RSP_SRCH_NOT_SPRTD = 0x0f; /* Search not supported */ 49 static final byte RSP_SRCH_IN_PROG = 0x10; /* Search in progress */ 50 static final byte RSP_INV_PLAYER = 0x11; /* Invalid player */ 51 static final byte RSP_PLAY_NOT_BROW = 0x12; /* Player not browsable */ 52 static final byte RSP_PLAY_NOT_ADDR = 0x13; /* Player not addressed */ 53 static final byte RSP_INV_RESULTS = 0x14; /* Invalid results */ 54 static final byte RSP_NO_AVBL_PLAY = 0x15; /* No available players */ 55 static final byte RSP_ADDR_PLAY_CHGD = 0x16; /* Addressed player changed */ 56 57 /* valid scopes for get_folder_items */ 58 static final byte BTRC_SCOPE_PLAYER_LIST = 0x00; /* Media Player List */ 59 static final byte BTRC_SCOPE_FILE_SYSTEM = 0x01; /* Virtual File System */ 60 static final byte BTRC_SCOPE_SEARCH = 0x02; /* Search */ 61 static final byte BTRC_SCOPE_NOW_PLAYING = 0x03; /* Now Playing */ 62 63 /* valid directions for change path */ 64 static final byte DIR_UP = 0x00; 65 static final byte DIR_DOWN = 0x01; 66 67 /* item type to browse */ 68 static final byte BTRC_ITEM_PLAYER = 0x01; 69 static final byte BTRC_ITEM_FOLDER = 0x02; 70 static final byte BTRC_ITEM_MEDIA = 0x03; 71 72 /* valid folder types */ 73 static final byte FOLDER_TYPE_MIXED = 0x00; 74 static final byte FOLDER_TYPE_TITLES = 0x01; 75 static final byte FOLDER_TYPE_ALBUMS = 0x02; 76 static final byte FOLDER_TYPE_ARTISTS = 0x03; 77 static final byte FOLDER_TYPE_GENRES = 0x04; 78 static final byte FOLDER_TYPE_PLAYLISTS = 0x05; 79 static final byte FOLDER_TYPE_YEARS = 0x06; 80 81 /* valid playable flags */ 82 static final byte ITEM_NOT_PLAYABLE = 0x00; 83 static final byte ITEM_PLAYABLE = 0x01; 84 85 /* valid Attribute ids for media elements */ 86 static final int ATTRID_TITLE = 0x01; 87 static final int ATTRID_ARTIST = 0x02; 88 static final int ATTRID_ALBUM = 0x03; 89 static final int ATTRID_TRACK_NUM = 0x04; 90 static final int ATTRID_NUM_TRACKS = 0x05; 91 static final int ATTRID_GENRE = 0x06; 92 static final int ATTRID_PLAY_TIME = 0x07; 93 static final int ATTRID_COVER_ART = 0x08; 94 95 /* constants to send in Track change response */ 96 static final byte[] NO_TRACK_SELECTED = { 97 (byte) 0xFF, 98 (byte) 0xFF, 99 (byte) 0xFF, 100 (byte) 0xFF, 101 (byte) 0xFF, 102 (byte) 0xFF, 103 (byte) 0xFF, 104 (byte) 0xFF 105 }; 106 static final byte[] TRACK_IS_SELECTED = { 107 (byte) 0x00, 108 (byte) 0x00, 109 (byte) 0x00, 110 (byte) 0x00, 111 (byte) 0x00, 112 (byte) 0x00, 113 (byte) 0x00, 114 (byte) 0x00 115 }; 116 117 /* UID size */ 118 static final int UID_SIZE = 8; 119 120 static final short DEFAULT_UID_COUNTER = 0x0000; 121 122 /* Bitmask size for Media Players */ 123 static final int AVRC_FEATURE_MASK_SIZE = 16; 124 125 /* Maximum attributes for media item */ 126 static final int MAX_NUM_ATTR = 8; 127 128 /* notification types for remote device */ 129 static final int NOTIFICATION_TYPE_INTERIM = 0; 130 static final int NOTIFICATION_TYPE_CHANGED = 1; 131 132 static final int TRACK_ID_SIZE = 8; 133 134 /* player feature bit mask constants */ 135 static final short AVRC_PF_PLAY_BIT_NO = 40; 136 static final short AVRC_PF_STOP_BIT_NO = 41; 137 static final short AVRC_PF_PAUSE_BIT_NO = 42; 138 static final short AVRC_PF_REWIND_BIT_NO = 44; 139 static final short AVRC_PF_FAST_FWD_BIT_NO = 45; 140 static final short AVRC_PF_FORWARD_BIT_NO = 47; 141 static final short AVRC_PF_BACKWARD_BIT_NO = 48; 142 static final short AVRC_PF_ADV_CTRL_BIT_NO = 58; 143 static final short AVRC_PF_BROWSE_BIT_NO = 59; 144 static final short AVRC_PF_ADD2NOWPLAY_BIT_NO = 61; 145 static final short AVRC_PF_UID_UNIQUE_BIT_NO = 62; 146 static final short AVRC_PF_NOW_PLAY_BIT_NO = 65; 147 static final short AVRC_PF_GET_NUM_OF_ITEMS_BIT_NO = 67; 148 149 static final byte PLAYER_TYPE_AUDIO = 1; 150 static final int PLAYER_SUBTYPE_NONE = 0; 151 152 // match up with btrc_play_status_t enum of bt_rc.h 153 static final int PLAYSTATUS_STOPPED = 0; 154 static final int PLAYSTATUS_PLAYING = 1; 155 static final int PLAYSTATUS_PAUSED = 2; 156 static final int PLAYSTATUS_FWD_SEEK = 3; 157 static final int PLAYSTATUS_REV_SEEK = 4; 158 static final int PLAYSTATUS_ERROR = 255; 159 160 static final byte NUM_ATTR_ALL = (byte) 0x00; 161 static final byte NUM_ATTR_NONE = (byte) 0xFF; 162 163 static final int KEY_STATE_PRESS = 1; 164 static final int KEY_STATE_RELEASE = 0; 165} 166