blob: 62ea9174dc1ee5f1ce488e6798a79a59e4636e3b [file] [log] [blame]
// Copyright 2023 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.hardware.bluetooth;
using zx;
/// The maximum buffer length an encoded command might require.
/// Update when adding new commands that might require a larger buffer.
const BT_VENDOR_MAX_COMMAND_BUFFER_LEN uint16 = 16;
/// Indicates support for Android Vendor Extensions
/// If empty, Android HCI Extensions are supported but the version is unspecified.
/// The version should be detected using the LE Get Vendor Capabilities Command.
type AndroidVendorSupport = table {
1: major_version uint8;
2: minor_version uint8;
};
/// Table of features supported by the vendor.
type VendorFeatures = table {
/// Supports the SetAclPriority command
/// If missing, the command is not supported.
1: acl_priority_command bool;
/// Supports Android Vendor Extensions
/// If missing, Android Vendor Extensions are not supported.
2: android_vendor_extensions AndroidVendorSupport;
};
type VendorAclPriority = flexible enum : uint8 {
NORMAL = 1;
HIGH = 2;
};
type VendorAclDirection = flexible enum : uint8 {
SOURCE = 1;
SINK = 2;
};
type VendorSetAclPriorityParams = table {
/// The ACL connection handle which is requested to be prioritized.
1: connection_handle uint16;
2: priority VendorAclPriority;
/// The direction data should be prioritized in. May not be supported by all
/// vendors. Ignored when priority is normal.
3: direction VendorAclDirection;
};
type VendorCommand = flexible union {
1: set_acl_priority VendorSetAclPriorityParams;
};
/// The BtVendor protocol may be implemented by vendor drivers to support feature interrogation
/// and vendor command encoding.
open protocol Vendor {
/// Transmits the Vendor Features supported by this controller.
/// Shall be sent after the protocol is opened.
flexible -> OnFeatures(VendorFeatures);
/// Encode the vendor HCI command and return the encoded command.
/// See `VendorCommand` for possible commands and parameters.
/// Returns an error status if the command is not supported or paramaters cannot be encoded.
flexible EncodeCommand(VendorCommand) -> (struct {
encoded vector<uint8>:BT_VENDOR_MAX_COMMAND_BUFFER_LEN;
}) error zx.Status;
/// Open the HCI protocol to the controller. This call may block until the
/// controller has been initialized.
/// Returns ALREADY_BOUND if another client has already connected.
flexible OpenHci() -> (resource struct {
channel client_end:Hci;
}) error zx.Status;
};