[bt][fidl] AVRCP Service FIDL
Initial FIDL service interfaces for the Bluetooth AVRCP profile
implementation.
BT-684
Test: fx build
Change-Id: I9c18cc6f418b25f9f9025d2a4636ea47c775dbc4
diff --git a/sdk/fidl/fuchsia.bluetooth.avrcp/BUILD.gn b/sdk/fidl/fuchsia.bluetooth.avrcp/BUILD.gn
new file mode 100644
index 0000000..144620c
--- /dev/null
+++ b/sdk/fidl/fuchsia.bluetooth.avrcp/BUILD.gn
@@ -0,0 +1,16 @@
+# 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.
+
+import("//build/fidl/fidl.gni")
+
+fidl("fuchsia.bluetooth.avrcp") {
+ sources = [
+ "profile.fidl",
+ "test.fidl",
+ "types.fidl",
+ ]
+ public_deps = [
+ "//sdk/fidl/fuchsia.bluetooth",
+ ]
+}
diff --git a/sdk/fidl/fuchsia.bluetooth.avrcp/profile.fidl b/sdk/fidl/fuchsia.bluetooth.avrcp/profile.fidl
new file mode 100644
index 0000000..8ea56ef
--- /dev/null
+++ b/sdk/fidl/fuchsia.bluetooth.avrcp/profile.fidl
@@ -0,0 +1,68 @@
+// 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;
+
+using fuchsia.bluetooth;
+
+[Discoverable]
+interface Avrcp {
+ /// Returns a client to a remote target (TG) service at the address specified by |device_id|.
+ /// TODO (BT-305): change device_id to int.
+ GetControllerForTarget(string device_id, request<Controller> client) -> (fuchsia.bluetooth.Status status);
+};
+
+/// Client wrapper for local controller (CT) -> remote target (TG) AVCTP connections between devices.
+/// A client is high level construct and does not represent a connection with a device.
+/// Connections are internally managed and may be shared by multiple clients.
+/// The actual connection may be opened on-demand after any command here is called.
+interface Controller {
+ /// Returns the remote PlayerApplicationSettings.
+ GetPlayerApplicationSettings() -> (fuchsia.bluetooth.Status status, PlayerApplicationSettings settings);
+
+ /// Returns the currently playing media attributes.
+ /// May send either the GetElementAttributes or GetItemAttributes command depending on what
+ /// is supported.
+ GetMediaAttributes() -> (fuchsia.bluetooth.Status status, MediaAttributes attributes);
+
+ /// Sets the absolute volume on the device. Values can range from 0x00 to 0x7F
+ /// (with 100% volume being 0x7F). This is in addition to the relative volume change
+ /// commands that can be sent over AV\C. You will get a volume changed notification event
+ /// as part of successfully sending this.
+ SetAbsoluteVolume(uint8 volume) -> (fuchsia.bluetooth.Status status);
+
+ /// Infrom target of the controller's battery level.
+ InformBatteryStatus(BatteryStatus battery_status) -> (fuchsia.bluetooth.Status status);
+
+ /// Register for the notification specified by |event|.
+ /// Some events may not be supported depending on TG AVRCP version.
+ RegisterNotification(TargetEvent event) -> (fuchsia.bluetooth.Status status);
+
+ /// Incoming AV\C NOTIFY. EVENT_PLAYBACK_STATUS_CHANGED
+ -> PlaybackStatusChanged(PlaybackStatus status);
+ /// Incoming AV\C NOTIFY. EVENT_TRACK_CHANGED
+ -> TrackChanged(uint64 track_id);
+ /// Incoming AV\C NOTIFY. EVENT_TRACK_REACHED_END
+ -> TrackReachedEnd();
+ /// Incoming AV\C NOTIFY. EVENT_TRACK_REACHED_START
+ -> TrackReachedStart();
+ /// Incoming AV\C NOTIFY. EVENT_TRACK_POS_CHANGED
+ -> TrackPosChanged(uint32 pos);
+ /// Incoming AV\C NOTIFY. EVENT_BATT_STATUS_CHANGED
+ -> BattStatusChanged(BatteryStatus battery_status);
+ /// Incoming AV\C NOTIFY. EVENT_SYSTEM_STATUS_CHANGED
+ -> SystemStatusChanged(SystemStatus system_status);
+ /// Incoming AV\C NOTIFY. EVENT_PLAYER_APPLICATION_SETTINGS_CHANGED
+ -> PlayerApplicationSettingsChanged(PlayerApplicationSettings application_settings);
+ /// Incoming AV\C NOTIFY. EVENT_ADDRESSED_PLAYER_CHANGED
+ -> AddressedPlayerChanged(uint16 player_id);
+ /// Incoming AV\C NOTIFY. EVENT_VOLUME_CHANGED
+ -> VolumeChanged(uint8 volume);
+
+ /// Changes the addressed |player_id| on the target when multiple are supported.
+ SetAddressedPlayer(uint16 player_id) -> (fuchsia.bluetooth.Status status);
+
+ /// Send an AV\C passthrough key command. Sends both a key down and key up event.
+ SendCommand(AvcPanelCommand command) -> (fuchsia.bluetooth.Status status);
+};
diff --git a/sdk/fidl/fuchsia.bluetooth.avrcp/test.fidl b/sdk/fidl/fuchsia.bluetooth.avrcp/test.fidl
new file mode 100644
index 0000000..5fbe460
--- /dev/null
+++ b/sdk/fidl/fuchsia.bluetooth.avrcp/test.fidl
@@ -0,0 +1,57 @@
+// 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;
+
+using fuchsia.bluetooth;
+
+[Discoverable]
+interface AvrcpTest {
+ /// Sets an implementation of target handler that will vend delegates for each incoming
+ /// remote TG -> local CT connections to handle the commands being sent by the remote TG.
+ /// If no target handler is set, a default handler will be used internally that will
+ /// dispatch to the MediaSession service. This should only be used for debug and testing.
+ RegisterIncomingTargetHandler(TargetHandler handler);
+
+ /// Returns a test client to a remote target service at the address specified by |device_id|.
+ /// This client is to be used in conjunction the non test client from the primary Avrcp service.
+ /// The test client provides additional methods not exposed by normal client to be used
+ /// for debugging and testing purposes.
+ /// TODO (BT-305): change device_id to int.
+ GetTestControllerForTarget(string device_id, request<TestController> test_controller) -> (fuchsia.bluetooth.Status status);
+};
+
+/// An implementation of this interface is registered with the AvrcpTest service to handle
+/// incoming connections.
+interface TargetHandler {
+ /// Called when an incoming target is connected. |delegate| should be fulfilled with an
+ /// interface that will be used to handle commands from the connected Controller.
+ /// TODO (BT-305): change device_id to int.
+ ControllerConnected(string device_id, request<TargetDelegate> delegate);
+};
+
+/// Returned by an implementer of the TargetHandler interface.
+/// Handles incoming connection commands by a remote CT device.
+interface TargetDelegate {
+ /// Called after Panel key down and up events.
+ OnCommand(AvcPanelCommand command) -> (fuchsia.bluetooth.Status status);
+};
+
+/// Provides methods not exposed in `Controller` that are strictly for testing and debug.
+interface TestController {
+ /// Returns whether there is an underlying connection open with the remote device currently.
+ IsConnected() -> (bool connected);
+
+ /// Queries the target and returns what events are supported for notification.
+ /// Sends GetCapabilties(0x03 (EVENTS_SUPPORTED)) command for all events supported by
+ /// the negoitated version of AVRCP.
+ GetEventsSupported() -> (fuchsia.bluetooth.Status status, vector<TargetEvent> events_supported);
+
+ /// Explicitly connect to the remote device.
+ Connect();
+
+ /// Explicitly disconnect the L2CAP channel to the remote.
+ /// Be warned that other clients may be sharing this L2CAP connection.
+ Disconnect();
+};
diff --git a/sdk/fidl/fuchsia.bluetooth.avrcp/types.fidl b/sdk/fidl/fuchsia.bluetooth.avrcp/types.fidl
new file mode 100644
index 0000000..3a1bc62
--- /dev/null
+++ b/sdk/fidl/fuchsia.bluetooth.avrcp/types.fidl
@@ -0,0 +1,180 @@
+// 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;
+
+using fuchsia.bluetooth;
+
+// Types are intented 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.
+
+/// Defined by AVRCP 1.6.2 section 6.7.2 (RegisterNotification) and Appendix H.
+enum TargetEvent : uint8 {
+ /// EVENT_PLAYBACK_STATUS_CHANGED
+ PlaybackStatusChanged = 0x01;
+ /// EVENT_TRACK_CHANGED
+ TrackChanged = 0x02;
+ /// EVENT_TRACK_REACHED_END
+ TrackReachedEnd = 0x03;
+ /// EVENT_TRACK_REACHED_START
+ TrackReachedStart = 0x04;
+ /// EVENT_TRACK_POS_CHANGED
+ TrackPosChanged = 0x05;
+ /// EVENT_BATT_STATUS_CHANGED
+ BattStatusChanged = 0x06;
+ /// EVENT_SYSTEM_STATUS_CHANGED
+ SystemStatusChanged = 0x07;
+ /// EVENT_PLAYER_APPLICATION_SETTINGS_CHANGED
+ PlayerApplicationSettingsChanged = 0x08;
+ /// EVENT_NOW_PLAYING_CONTENT_CHANGED
+ NowPlayingContentChanged = 0x09;
+ /// EVENT_AVAILABLE_PLAYERS_CHANGED
+ AvailablePlayersChanged = 0x0a;
+ /// EVENT_ADDRESSED_PLAYER_CHANGED
+ AddressedPlayerChanged = 0x0b;
+ /// EVENT_UIDS_CHANGED
+ UidsChanged = 0x0c;
+ /// EVENT_VOLUME_CHANGED
+ VolumeChanged = 0x0d;
+};
+
+/// Defined by AVRCP 1.6.2 section 6.7.2 (RegisterNotification).
+/// Format for EVENT_SYSTEM_STATUS_CHANGED.
+enum SystemStatus : uint8 {
+ PowerOn = 0x00;
+ PowerOff = 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;
+ FwdSeek = 0x03;
+ RevSeek = 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;
+ FullCharge = 0x04;
+ Reserved = 0x05;
+};
+
+/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
+enum RepeatStatusMode : uint8 {
+ Off = 0x01;
+ SingleTrackRepeat = 0x02;
+ AllTrackRepeat = 0x03;
+ GroupRepeat = 0x04;
+ Reserved = 0xFF;
+};
+
+/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
+enum ShuffleMode : uint8 {
+ Off = 0x01;
+ AllTracksShuffle = 0x02;
+ GroupShuffle = 0x03;
+ Reserved = 0xFF;
+};
+
+/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
+enum ScanMode : uint8 {
+ Off = 0x01;
+ AllTracksScan = 0x02;
+ GroupScan = 0x03;
+ Reserved = 0xFF;
+};
+
+/// Defined by AVRCP 1.6.2 Appendix F (player application settings).
+struct PlayerApplicationSettings {
+ bool equalizer;
+ RepeatStatusMode repeat_status_mode;
+ ShuffleMode shuffle_mode;
+ ScanMode scan_mode;
+};
+
+/// 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.
+};
+
+/// 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;
+};