blob: e36ce7caec558e065c490becf4c90281572c5f86 [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;
};
/// 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 TargetEvent : 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_SETTINGS_CHANGED = 0x08;
NOW_PLAYING_CONTENT_CHANGED = 0x09;
AVAILABLE_PLAYERS_CHANGED = 0x0a;
ADDRESSED_PLAYER_CHANGED = 0x0b;
UIDS_CHANGED = 0x0c;
VOLUME_CHANGED = 0x0d;
};
/// 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;
RESERVED = 0xFF;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum ShuffleMode : uint8 {
OFF = 0x01;
ALL_TRACK_SHUFFLE = 0x02;
GROUP_SHUFFLE = 0x03;
RESERVED = 0xFF;
};
/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
enum ScanMode : uint8 {
OFF = 0x01;
ALL_TRACK_SCAN = 0x02;
GROUP_SCAN = 0x03;
RESERVED = 0xFF;
};
/// 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;
};
/// Defined by AVRCP 1.6.2 Appendix E (media attributes).
struct MediaAttributes {
string title;
string artist_name;
string album_name;
string track_number;
string total_number_of_tracks;
string genre;
string playing_time;
// TODO(BT-729): 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;
};
/// 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;
};