| // 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.hardware.bt.vendor; |
| |
| 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 = strict enum : uint32 { |
| SET_ACL_PRIORITY_COMMAND = 0x1; |
| ANDROID_VENDOR_EXTENSIONS = 0x2; |
| // Bits 2-31 reserved. |
| }; |
| |
| type BtVendorAclPriority = strict enum : uint8 { |
| NORMAL = 0; |
| HIGH = 1; |
| }; |
| |
| type BtVendorAclDirection = strict enum : uint8 { |
| SOURCE = 0; |
| SINK = 1; |
| }; |
| |
| 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 BtVendorParams = strict union { |
| 1: set_acl_priority BtVendorSetAclPriorityParams; |
| }; |
| |
| type BtVendorCommand = strict enum { |
| /// Marks a connection as normal or high priority. |
| /// Parameters: `BtVendorSetAclPriorityParams` |
| SET_ACL_PRIORITY = 0; |
| }; |
| |
| /// The BtVendor protocol may be implemented by vendor drivers to support feature interrogation |
| /// and vendor command encoding. |
| @transport("Banjo") |
| @banjo_layout("ddk-protocol") |
| protocol BtVendor { |
| /// Returns bitmask of the features the vendor supports. |
| 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. |
| EncodeCommand(struct { |
| command BtVendorCommand; |
| params BtVendorParams; |
| }) -> (struct { |
| status zx.status; |
| @buffer |
| encoded vector<uint8>:BT_VENDOR_MAX_COMMAND_BUFFER_LEN; |
| }); |
| }; |