blob: bb91bac567c98b00757fe2af3f8a240e1528a86c [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;
/// Bitmask of features supported by the vendor.
type BtVendorFeatures = flexible bits : uint32 {
SET_ACL_PRIORITY_COMMAND = 0x1;
ANDROID_VENDOR_EXTENSIONS = 0x2;
// Bits 2-31 reserved.
};
type BtVendorAclPriority = flexible enum : uint8 {
NORMAL = 1;
HIGH = 2;
};
type BtVendorAclDirection = flexible enum : uint8 {
SOURCE = 1;
SINK = 2;
};
type BtVendorSetAclPriorityParams = struct {
connection_handle uint16;
priority BtVendorAclPriority;
/// The direction data should be prioritized in. May not be supported by all
/// vendors. Ignored when priority is normal.
direction BtVendorAclDirection;
};
type BtVendorCommand = flexible union {
1: set_acl_priority BtVendorSetAclPriorityParams;
};
/// The BtVendor protocol may be implemented by vendor drivers to support feature interrogation
/// and vendor command encoding.
open protocol Vendor {
/// Returns bitmask of the features the vendor supports.
flexible GetFeatures() -> (struct {
features BtVendorFeatures;
});
/// Encodes the vendor HCI command `command` using `params` and returns the encoded command as
/// a buffer. `params` must contain the parameter struct for the specified command, as
/// documented in `BtVendorCommand`.
/// Returns an error status if the command is not supported or the paramaters are invalid.
flexible EncodeCommand(struct {
command BtVendorCommand;
}) -> (struct {
@buffer
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;
};