blob: b74c1bcbf41504168cbec3b1cc0fa6e80b44ebbb [file] [log] [blame]
// Copyright 2020 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.bredr;
using fuchsia.hardware.audio;
using zx;
enum ScoErrorCode {
FAILURE = 1;
CANCELLED = 2;
INVALID_ARGUMENTS = 3;
};
/// Codec parameter sets defined in the Hands-Free Profile specification (v1.8, section 5.7).
enum HfpParameterSet : uint8 {
MSBC_T1 = 1;
MSBC_T2 = 2;
CVSD_S1 = 3;
CVSD_S2 = 4;
CVSD_S3 = 5;
CVSD_S4 = 6;
CVSD_D0 = 7;
CVSD_D1 = 8;
};
/// The coding format used for synchronous connection data.
enum CodingFormat : uint8 {
MULAW = 1;
ALAW = 2;
CVSD = 3;
TRANSPARENT = 4;
LINEAR_PCM = 5;
MSBC = 6;
};
/// Indicates the audio transport that should be used for the data on a synchronous
/// connection.
enum DataPath : uint8 {
/// The HCI transport.
HOST = 1;
/// Transport audio data directly between the controller and the audio hardware.
// TODO(fxbug.dev/62161): Document how offloading is configured.
OFFLOAD = 2;
/// The audio test mode transport. See Core Spec v5.2, Vol 4, Part E, Section 7.6.2 for details.
TEST = 3;
};
table ScoConnectionParameters {
/// Set of SCO parameters from the Hands-Free Profile specification.
/// Required.
1: HfpParameterSet parameter_set;
/// The over-the-air coding format used for transmitted and received data.
/// Required.
2: CodingFormat air_coding_format;
/// Frame size produced by the codec in the context of over-the-air coding.
/// Required.
3: uint16 air_frame_size;
/// Host-controller data rate in bytes/second.
/// Required.
4: uint32 io_bandwidth;
/// The coding format used over the transport.
/// Required.
5: CodingFormat io_coding_format;
/// The number of bits in each sample/frame of data.
/// Required.
6: uint16 io_frame_size;
/// The data format over the transport for linear samples.
/// Ignored for non-linear coding formats.
/// Optional.
/// SIGNED indicates 2’s complement sign encoding.
/// FLOAT is not supported.
7: fuchsia.hardware.audio.SampleFormat io_pcm_data_format;
/// For linear samples, indicates how many bit positions the MSB of the sample is away
/// from the MSB of the data.
/// Ignored for non-linear coding formats.
/// Optional.
/// Default: 0.
8: uint8 io_pcm_sample_payload_msb_position;
/// The data transport.
/// Required.
9: DataPath path;
};
resource table ScoConnection {
/// Socket for transmitting/receiving data over the synchronous connection.
/// Closing the socket will close the connection.
/// If audio is offloaded, data written to the socket will be dropped and reads will fail.
1: zx.handle:SOCKET socket;
};
/// Represents an active synchronous connection request by a profile.
/// Either `Connected()` or `Error()` will be called and then server will close the protocol.
protocol ScoConnectionReceiver {
/// Called upon successful connection establishment.
Connected(ScoConnection connection);
/// Called when connection establishment fails or is cancelled by the host.
Error(ScoErrorCode error);
};