blob: abf38b7992415ec7b1b2f3133bb92936e6437a96 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.bluetooth.avrcp;
// Types are intended match how they are defined in the BT AVRCP 1.6.2 spec
// and the 1394-TA AV\C Panel specification.
// Deviations are called out in comments.
/// Status codes for commands sent as the controller.
enum ControllerError : uint32 {
UNKOWN_FAILURE = 1;
TIMED_OUT = 2;
REMOTE_NOT_CONNECTED = 3;
COMMAND_NOT_IMPLEMENTED = 4;
COMMAND_REJECTED = 5;
COMMAND_UNEXPECTED = 6;
INVALID_ARGUMENTS = 7;
PACKET_ENCODING = 8;
PROTOCOL_ERROR = 9;
CONNECTION_ERROR = 10;
UNEXPECTED_RESPONSE = 11;
};
/// Status codes for passthrough responses received from the target.
enum TargetPassthroughError {
COMMAND_NOT_IMPLEMENTED = 1;
COMMAND_REJECTED = 2;
};
/// Status codes for AVRCP specific AV/C commands.
/// Defined in AVRCP 1.6.2 section 6.15.3, Table 6.49.
/// Style note: named exactly as they are in Table 6.49 with the "REJECTED_" prefix.
enum TargetAvcError : uint32 {
REJECTED_INVALID_COMMAND = 0x00;
REJECTED_INVALID_PARAMETER = 0x01;
REJECTED_PARAMETER_CONTENT_ERROR = 0x02;
REJECTED_INTERNAL_ERROR = 0x03;
REJECTED_UID_CHANGED = 0x05;
REJECTED_INVALID_PLAYER_ID = 0x11;
REJECTED_NO_AVAILABLE_PLAYERS = 0x15;
REJECTED_ADDRESSED_PLAYER_CHANGED = 0x16;
};
/// The `AddressedPlayerId` is a unique identifier, assigned by AVRCP, for a media player.
/// This ID is only used for AVRCP purposes, and should not be interpreted as an
/// identification created, assigned, or used by MediaSession or any other API surfaces.
///
/// Defined in AVRCP 1.6, Section 6.10.2.1.
struct AddressedPlayerId {
uint16 id;
};
/// The maximum number of Notification Event IDs that can be supported by the TG.
/// 0x0E to 0xFF are reserved for future use.
/// Defined by AVRCP 1.6.2 Appendix H.
const uint8 MAX_NOTIFICATIONS = 255;
/// Defined by AVRCP 1.6.2 section 6.7.2 (RegisterNotification) and Appendix H.
/// Style note: named exactly as they are in the specification with the "EVENT_" prefix.
enum NotificationEvent : uint8 {
PLAYBACK_STATUS_CHANGED = 0x01;
TRACK_CHANGED = 0x02;
TRACK_REACHED_END = 0x03;
TRACK_REACHED_START = 0x04;
TRACK_POS_CHANGED = 0x05;
BATT_STATUS_CHANGED = 0x06;
SYSTEM_STATUS_CHANGED = 0x07;
PLAYER_APPLICATION_SETTING_CHANGED = 0x08;
NOW_PLAYING_CONTENT_CHANGED = 0x09;
AVAILABLE_PLAYERS_CHANGED = 0x0a;
ADDRESSED_PLAYER_CHANGED = 0x0b;
UIDS_CHANGED = 0x0c;
VOLUME_CHANGED = 0x0d;
};
/// Change notifications that a controller client can register.
bits Notifications : uint32 {
// AVRCP native notifications
/// AVRCP `EVENT_PLAYBACK_STATUS_CHANGED` Notification
PLAYBACK_STATUS = 0x1;
/// AVRCP `EVENT_TRACK_CHANGED` Notification
TRACK = 0x2;
/// AVRCP `EVENT_TRACK_POS_CHANGED` Notification
TRACK_POS = 0x4;
/// AVRCP `EVENT_BATT_STATUS_CHANGED` Notification
BATT_STATUS = 0x8;
/// AVRCP `EVENT_SYSTEM_STATUS_CHANGED` Notification
SYSTEM_STATUS = 0x10;
/// AVRCP `EVENT_PLAYER_APPLICATION_SETTINGS_CHANGED` Notification
PLAYER_APPLICATION_SETTINGS = 0x20;
/// AVRCP `EVENT_ADDRESSED_PLAYER_CHANGED` Notification
ADDRESSED_PLAYER = 0x40;
/// AVRCP `EVENT_VOLUME_CHANGED` Notification
VOLUME = 0x80;
// Internal notifications
/// Internal connection change event.
CONNECTION = 0x10000;
};
/// Event data from incoming target notifications.
/// Defined by AVRCP 1.6.2 Sec 6.7.2.
table Notification {
/// `EVENT_PLAYBACK_STATUS_CHANGED` event data
1: PlaybackStatus status;
/// `EVENT_TRACK_CHANGED` event data
2: uint64 track_id;
/// `EVENT_TRACK_POS_CHANGED` event data
3: uint32 pos;
/// `EVENT_BATT_STATUS_CHANGED` event data
4: BatteryStatus battery_status;
/// `EVENT_SYSTEM_STATUS_CHANGED` event data
5: SystemStatus system_status;
/// `EVENT_PLAYER_APPLICATION_SETTINGS_CHANGED` event data
6: PlayerApplicationSettings application_settings;
/// `EVENT_ADDRESSED_PLAYER_CHANGED` event data
7: uint16 player_id;
/// `EVENT_VOLUME_CHANGED` event data
8: uint8 volume;
/// `CONNECTION_CHANGE` event data
9: bool device_connected;
};
/// Defined by AVRCP 1.6.2 section 6.7.2 (RegisterNotification).
/// Format for `EVENT_SYSTEM_STATUS_CHANGED`.
enum SystemStatus : uint8 {
POWER_ON = 0x00;
POWER_OFF = 0x01;
UNPLUGGED = 0x02;
};
/// Defined by AVRCP 1.6.2 section 6.7.2 (RegisterNotification).
/// Format for `EVENT_PLAYBACK_STATUS_CHANGED`.
enum PlaybackStatus : uint8 {
STOPPED = 0x00;
PLAYING = 0x01;
PAUSED = 0x02;
FWD_SEEK = 0x03;
REV_SEEK = 0x04;
ERROR = 0xFF;
};
/// Defined by AVRCP 1.6.2 section 6.7.2 (RegisterNotification).
/// Format for `EVENT_BATT_STATUS_CHANGED`.
/// Same encoding also defined by 6.5.8 (InformBatteryStatusOfCT).
enum BatteryStatus : uint8 {
NORMAL = 0x00;
WARNING = 0x01;
CRITICAL = 0x02;
EXTERNAL = 0x03;
FULL_CHARGE = 0x04;
RESERVED = 0x05;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum RepeatStatusMode : uint8 {
OFF = 0x01;
SINGLE_TRACK_REPEAT = 0x02;
ALL_TRACK_REPEAT = 0x03;
GROUP_REPEAT = 0x04;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum ShuffleMode : uint8 {
OFF = 0x01;
ALL_TRACK_SHUFFLE = 0x02;
GROUP_SHUFFLE = 0x03;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum ScanMode : uint8 {
OFF = 0x01;
ALL_TRACK_SCAN = 0x02;
GROUP_SCAN = 0x03;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum Equalizer : uint8 {
OFF = 0x01;
ON = 0x02;
};
/// The maximum number of custom attributes that can be used.
/// Defined by AVRCP 1.6.2 Appendix F.
const uint64 MAX_CUSTOM_ATTRIBUTES = 127;
/// The maximum number of possible values an attribute can take on.
/// Defined by AVRCP 1.6.2 Sec 6.5.2
const uint64 MAX_ATTRIBUTE_VALUES = 255;
/// The total number of attributes that can be set. The custom attributes + the 4
/// defined attributes, `PlayerApplicationSettingAttributeId`. 4 + 127 = 131.
const uint64 MAX_ATTRIBUTES = 131;
/// 0x80 - 0xFF is reserved for custom player application settings.
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum PlayerApplicationSettingAttributeId : uint8 {
EQUALIZER = 0x01;
REPEAT_STATUS_MODE = 0x02;
SHUFFLE_MODE = 0x03;
SCAN_MODE = 0x04;
};
/// The custom attribute value and its description.
struct CustomAttributeValue {
string:255 description;
uint8 value;
};
/// Specification allowed player application settings.
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
table CustomPlayerApplicationSetting {
/// The attribute id for the custom setting. Must be between 0x80-0xFF, as
/// defined in AVRCP 1.6.2 Appendix F.
1: uint8 attribute_id;
/// The string descriptor of the custom attribute.
2: string:255 attribute_name;
/// The possible values the custom attribute can take.
3: vector<CustomAttributeValue>:MAX_ATTRIBUTE_VALUES possible_values;
/// The current value that the custom setting is set to.
4: uint8 current_value;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
table PlayerApplicationSettings {
/// The equalizer status of the remote target.
1: Equalizer equalizer;
/// The repeat mode status of the remote target.
2: RepeatStatusMode repeat_status_mode;
/// The shuffle mode status of the remote target.
3: ShuffleMode shuffle_mode;
/// The scan mode status of the remote target.
4: ScanMode scan_mode;
/// Custom settings that are specification allowed.
5: vector<CustomPlayerApplicationSetting>:MAX_CUSTOM_ATTRIBUTES custom_settings;
};
/// The maximum length of an attribute value in the media attributes.
/// Defined by AVRCP 1.6.2 Sec 6.6.1.
const uint64 MAX_ATTRIBUTE_VALUE_LENGTH = 65535;
/// Defined by AVRCP 1.6.2 Appendix E (media attributes).
table MediaAttributes {
/// The title, song name, or content description.
1: string:MAX_ATTRIBUTE_VALUE_LENGTH title;
/// The artist, performer, or group.
2: string:MAX_ATTRIBUTE_VALUE_LENGTH artist_name;
/// The title of the source of media.
3: string:MAX_ATTRIBUTE_VALUE_LENGTH album_name;
/// The order number of the media on its original recording.
4: string:MAX_ATTRIBUTE_VALUE_LENGTH track_number;
/// The total number of tracks in the media.
5: string:MAX_ATTRIBUTE_VALUE_LENGTH total_number_of_tracks;
/// The category of composition of the media,
6: string:MAX_ATTRIBUTE_VALUE_LENGTH genre;
/// The length of the media in milliseconds (ms).
7: string:MAX_ATTRIBUTE_VALUE_LENGTH playing_time;
// TODO(fxbug.dev/1322): Add BIP cover art handle.
};
/// Status of currently playing media on the TG.
/// Defined by AVRCP 1.6.2 section 6.7.1, Table 6.29.
table PlayStatus {
/// The total length of the currently playing media, in milliseconds.
/// Optional, if the TG does not support song length.
1: uint32 song_length;
/// The current position of the playing media, in milliseconds elapsed.
/// Optional, if the TG does not support song position.
2: uint32 song_position;
/// The playback status of the currently playing media.
/// Mandatory, the TG must respond with a PlaybackStatus.
3: PlaybackStatus playback_status;
};
/// The maximum number of MediaPlayerItems that can be returned from a call to
/// GetMediaPlayerItems.
/// This value is arbitrary and is meant to limit the number of items that can be returned.
/// AVRCP 1.6.2, Section 6.10.4.2.2 defines the `Number of Items` parameter as a uint16.
const uint16 MAX_MEDIA_PLAYER_ITEMS = 16;
/// The Major Player Type associated with a media player.
/// Defined by AVRCP 1.6.2 section 6.10.2.1.
bits MajorPlayerType : uint8 {
AUDIO = 0x01;
VIDEO = 0x02;
BROADCASTING_AUDIO = 0x04;
BROADCASTING_VIDEO = 0x08;
// Bits 4 - 7 are reserved.
};
/// The Player Sub Type associated with a media player.
/// Defined by AVRCP 1.6.2 section 6.10.2.1.
bits PlayerSubType : uint32 {
AUDIO_BOOK = 0x01;
PODCAST = 0x02;
// Bits 2 - 31 are reserved.
};
/// Response data for the browseable items associated with a media player.
/// Defined by AVRCP 1.6.2 section 6.10.2.1.
table MediaPlayerItem {
1: uint16 player_id;
2: MajorPlayerType major_type;
3: PlayerSubType sub_type;
4: PlaybackStatus playback_status;
5: string:255 displayable_name;
};
/// Defined by AV\C Panel specification.
enum AvcPanelCommand : uint8 {
SELECT = 0x00;
UP = 0x01;
DOWN = 0x02;
LEFT = 0x03;
RIGHT = 0x04;
ROOT_MENU = 0x09;
CONTENTS_MENU = 0x0b;
FAVORITE_MENU = 0x0c;
EXIT = 0x0d;
ON_DEMAND_MENU = 0x0e;
APPS_MENU = 0x0f;
KEY_0 = 0x20;
KEY_1 = 0x21;
KEY_2 = 0x22;
KEY_3 = 0x23;
KEY_4 = 0x24;
KEY_5 = 0x25;
KEY_6 = 0x26;
KEY_7 = 0x27;
KEY_8 = 0x28;
KEY_9 = 0x29;
DOT = 0x2a;
ENTER = 0x2b;
CHANNEL_UP = 0x30;
CHANNEL_DOWN = 0x31;
CHANNEL_PREVIOUS = 0x32;
INPUT_SELECT = 0x34;
INFO = 0x35;
HELP = 0x36;
PAGE_UP = 0x37;
PAGE_DOWN = 0x38;
LOCK = 0x3a;
POWER = 0x40;
VOLUME_UP = 0x41;
VOLUME_DOWN = 0x42;
MUTE = 0x43;
PLAY = 0x44;
STOP = 0x45;
PAUSE = 0x46;
RECORD = 0x47;
REWIND = 0x48;
FAST_FORWARD = 0x49;
EJECT = 0x4a;
FORWARD = 0x4b;
BACKWARD = 0x4c;
LIST = 0x4d;
F1 = 0x71;
F2 = 0x72;
F3 = 0x73;
F4 = 0x74;
F5 = 0x75;
F6 = 0x76;
F7 = 0x77;
F8 = 0x78;
F9 = 0x79;
RED = 0x7a;
GREEN = 0x7b;
BLUE = 0x7c;
YELLOW = 0x7d;
};