1 // Copyright 2023 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #pragma once 16 #include "pw_bluetooth_sapphire/internal/host/hci-spec/vendor_protocol.h" 17 18 namespace bt::gap { 19 20 namespace hci_android = hci_spec::vendor::android; 21 22 class AndroidVendorCapabilities final { 23 public: 24 void Initialize(const pw::bluetooth::vendor::android_hci:: 25 LEGetVendorCapabilitiesCommandCompleteEventView& c); IsInitialized()26 bool IsInitialized() const { return initialized_; } 27 28 // Number of advertisement instances supported. 29 // 30 // This parameter is deprecated in the Google feature spec v0.98 and higher in 31 // favor of the LE Extended Advertising available in the BT spec version 5.0 32 // and higher. max_simultaneous_advertisements()33 uint8_t max_simultaneous_advertisements() const { 34 return max_simultaneous_advertisement_; 35 } 36 37 // BT chip capability of resolution of private addresses. If supported by a 38 // chip, it needs enablement by the host. 39 // 40 // This parameter is deprecated in the Google feature spec v0.98 and higher in 41 // favor of the Privacy feature available in the BT spec version 4.2 and 42 // higher. supports_offloaded_rpa()43 bool supports_offloaded_rpa() const { return supports_offloaded_rpa_; } 44 45 // Storage for scan results in bytes scan_results_storage_bytes()46 uint16_t scan_results_storage_bytes() const { 47 return scan_results_storage_bytes_; 48 } 49 50 // Number of IRK entries supported in the firmware irk_list_size()51 uint8_t irk_list_size() const { return irk_list_size_; } 52 53 // Support for filtering in the controller supports_filtering()54 bool supports_filtering() const { return supports_filtering_; } 55 56 // Number of filters supported max_filters()57 uint8_t max_filters() const { return max_filters_; } 58 59 // Supports reporting of activity and energy information supports_activity_energy_info()60 bool supports_activity_energy_info() const { 61 return supports_activity_energy_info_; 62 } 63 64 // Specifies the minor version of the Google feature spec supported version_minor()65 uint8_t version_minor() const { return version_minor_; } 66 67 // Specifies the major version of the Google feature spec supported version_major()68 uint8_t version_major() const { return version_major_; } 69 70 // Total number of advertisers tracked for OnLost/OnFound purposes max_advertisers_tracked()71 uint16_t max_advertisers_tracked() const { return max_advertisers_tracked_; } 72 73 // Supports extended scan window and interval supports_extended_scan()74 bool supports_extended_scan() const { return supports_extended_scan_; } 75 76 // Supports logging of binary debug information from controller supports_debug_logging()77 bool supports_debug_logging() const { return supports_debug_logging_; } 78 79 // This parameter is deprecated in the Google feature spec v0.98 and higher in 80 // favor of the Privacy feature available in the BT spec version 4.2 and 81 // higher. supports_offloading_le_address_generation()82 bool supports_offloading_le_address_generation() const { 83 return supports_offloading_le_address_generation_; 84 } 85 86 // Get a bitmask of the codec types supported for A2DP source offload. See 87 // A2dpCodecType in 88 // pw_bluetooth_sapphire/internal/host/hci_spec/vendor_protocol.h. a2dp_source_offload_capability_mask()89 uint32_t a2dp_source_offload_capability_mask() const { 90 return a2dp_source_offload_capability_mask_; 91 } 92 93 // Supports reporting of Bluetooth Quality events supports_bluetooth_quality_report()94 bool supports_bluetooth_quality_report() const { 95 return supports_bluetooth_quality_report_; 96 } 97 98 // Get a bitmask of the codec types where dynamic audio buffering in the 99 // Bluetooth controller is supported. See A2dpCodecType in 100 // pw_bluetooth_sapphire/internal/host/hci_spec/vendor_protocol.h. supports_dynamic_audio_buffer()101 uint32_t supports_dynamic_audio_buffer() const { 102 return supports_dynamic_audio_buffer_; 103 } 104 105 private: 106 bool initialized_ = false; 107 uint8_t max_simultaneous_advertisement_ = 0; 108 bool supports_offloaded_rpa_ = false; 109 uint16_t scan_results_storage_bytes_ = 0; 110 uint8_t irk_list_size_ = 0; 111 bool supports_filtering_ = false; 112 uint8_t max_filters_ = 0; 113 bool supports_activity_energy_info_ = false; 114 uint8_t version_minor_ = 0; 115 uint8_t version_major_ = 0; 116 uint16_t max_advertisers_tracked_ = 0; 117 bool supports_extended_scan_ = false; 118 bool supports_debug_logging_ = false; 119 bool supports_offloading_le_address_generation_ = false; 120 uint32_t a2dp_source_offload_capability_mask_ = 0; 121 bool supports_bluetooth_quality_report_ = false; 122 uint32_t supports_dynamic_audio_buffer_ = 0; 123 }; 124 } // namespace bt::gap 125