Home | History | Annotate | Download | only in avrcp
      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 
     17 package 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  */
     28 final 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 = {(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
     97             (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
     98     static final byte[] TRACK_IS_SELECTED = {(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
     99             (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00};
    100 
    101     /* UID size */
    102     static final int UID_SIZE = 8;
    103 
    104     static final short DEFAULT_UID_COUNTER = 0x0000;
    105 
    106     /* Bitmask size for Media Players */
    107     static final int AVRC_FEATURE_MASK_SIZE = 16;
    108 
    109     /* Maximum attributes for media item */
    110     static final int MAX_NUM_ATTR = 8;
    111 
    112     /* notification types for remote device */
    113     static final int NOTIFICATION_TYPE_INTERIM = 0;
    114     static final int NOTIFICATION_TYPE_CHANGED = 1;
    115 
    116     static final int TRACK_ID_SIZE = 8;
    117 
    118     /* player feature bit mask constants */
    119     static final short AVRC_PF_PLAY_BIT_NO = 40;
    120     static final short AVRC_PF_STOP_BIT_NO = 41;
    121     static final short AVRC_PF_PAUSE_BIT_NO = 42;
    122     static final short AVRC_PF_REWIND_BIT_NO = 44;
    123     static final short AVRC_PF_FAST_FWD_BIT_NO = 45;
    124     static final short AVRC_PF_FORWARD_BIT_NO = 47;
    125     static final short AVRC_PF_BACKWARD_BIT_NO = 48;
    126     static final short AVRC_PF_ADV_CTRL_BIT_NO = 58;
    127     static final short AVRC_PF_BROWSE_BIT_NO = 59;
    128     static final short AVRC_PF_ADD2NOWPLAY_BIT_NO = 61;
    129     static final short AVRC_PF_UID_UNIQUE_BIT_NO = 62;
    130     static final short AVRC_PF_NOW_PLAY_BIT_NO = 65;
    131     static final short AVRC_PF_GET_NUM_OF_ITEMS_BIT_NO = 67;
    132 
    133     static final byte PLAYER_TYPE_AUDIO = 1;
    134     static final int PLAYER_SUBTYPE_NONE = 0;
    135 
    136     // match up with btrc_play_status_t enum of bt_rc.h
    137     static final int PLAYSTATUS_STOPPED = 0;
    138     static final int PLAYSTATUS_PLAYING = 1;
    139     static final int PLAYSTATUS_PAUSED = 2;
    140     static final int PLAYSTATUS_FWD_SEEK = 3;
    141     static final int PLAYSTATUS_REV_SEEK = 4;
    142     static final int PLAYSTATUS_ERROR = 255;
    143 
    144     static final byte NUM_ATTR_ALL = (byte)0x00;
    145     static final byte NUM_ATTR_NONE = (byte)0xFF;
    146 
    147     static final int KEY_STATE_PRESS = 1;
    148     static final int KEY_STATE_RELEASE = 0;
    149 }
    150