1# Copyright 2024 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 15load("@rules_cc//cc:cc_library.bzl", "cc_library") 16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 17load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 18load("//pw_fuzzer:fuzzer.bzl", "pw_cc_fuzz_test") 19load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 20 21package( 22 default_visibility = ["//visibility:public"], 23 features = ["-layering_check"], 24) 25 26cc_library( 27 name = "definitions", 28 srcs = [ 29 "gap.cc", 30 ], 31 hdrs = [ 32 "public/pw_bluetooth_sapphire/internal/host/gap/gap.h", 33 "public/pw_bluetooth_sapphire/internal/host/gap/pairing_delegate.h", 34 ], 35 strip_include_prefix = "public", 36 tags = ["noclangtidy"], 37 deps = [ 38 "//pw_bluetooth_sapphire/host/common", 39 "//pw_bluetooth_sapphire/host/sm:definitions", 40 "//third_party/fuchsia:fit", 41 ], 42) 43 44cc_library( 45 name = "peer", 46 srcs = [ 47 "peer.cc", 48 "peer_metrics.cc", 49 ], 50 hdrs = [ 51 "public/pw_bluetooth_sapphire/internal/host/gap/peer.h", 52 "public/pw_bluetooth_sapphire/internal/host/gap/peer_metrics.h", 53 ], 54 strip_include_prefix = "public", 55 tags = ["noclangtidy"], 56 deps = [ 57 ":definitions", 58 "//pw_bluetooth_sapphire/host/common", 59 "//pw_bluetooth_sapphire/host/gatt:persisted_data", 60 "//pw_bluetooth_sapphire/host/hci-spec", 61 "//pw_bluetooth_sapphire/host/sm:definitions", 62 "//pw_bluetooth_sapphire/lib/cpp-string", 63 "//pw_bytes", 64 "//pw_string:utf_codecs", 65 ], 66) 67 68cc_library( 69 name = "gap", 70 srcs = [ 71 "adapter.cc", 72 "android_vendor_capabilities.cc", 73 "bredr_connection.cc", 74 "bredr_connection_manager.cc", 75 "bredr_connection_request.cc", 76 "bredr_discovery_manager.cc", 77 "bredr_interrogator.cc", 78 "generic_access_client.cc", 79 "identity_resolving_list.cc", 80 "legacy_pairing_state.cc", 81 "low_energy_address_manager.cc", 82 "low_energy_advertising_manager.cc", 83 "low_energy_connection.cc", 84 "low_energy_connection_handle.cc", 85 "low_energy_connection_manager.cc", 86 "low_energy_connection_request.cc", 87 "low_energy_connector.cc", 88 "low_energy_discovery_manager.cc", 89 "low_energy_interrogator.cc", 90 "pairing_state_manager.cc", 91 "peer_cache.cc", 92 "secure_simple_pairing_state.cc", 93 "types.cc", 94 ], 95 hdrs = [ 96 "public/pw_bluetooth_sapphire/internal/host/gap/adapter.h", 97 "public/pw_bluetooth_sapphire/internal/host/gap/adapter_state.h", 98 "public/pw_bluetooth_sapphire/internal/host/gap/android_vendor_capabilities.h", 99 "public/pw_bluetooth_sapphire/internal/host/gap/bonding_data.h", 100 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_connection.h", 101 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_connection_manager.h", 102 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_connection_request.h", 103 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_discovery_manager.h", 104 "public/pw_bluetooth_sapphire/internal/host/gap/bredr_interrogator.h", 105 "public/pw_bluetooth_sapphire/internal/host/gap/event_masks.h", 106 "public/pw_bluetooth_sapphire/internal/host/gap/generic_access_client.h", 107 "public/pw_bluetooth_sapphire/internal/host/gap/identity_resolving_list.h", 108 "public/pw_bluetooth_sapphire/internal/host/gap/legacy_pairing_state.h", 109 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_address_manager.h", 110 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_advertising_manager.h", 111 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection.h", 112 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection_handle.h", 113 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection_manager.h", 114 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connection_request.h", 115 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_connector.h", 116 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_discovery_manager.h", 117 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_interrogator.h", 118 "public/pw_bluetooth_sapphire/internal/host/gap/low_energy_state.h", 119 "public/pw_bluetooth_sapphire/internal/host/gap/pairing_state_manager.h", 120 "public/pw_bluetooth_sapphire/internal/host/gap/peer_cache.h", 121 "public/pw_bluetooth_sapphire/internal/host/gap/secure_simple_pairing_state.h", 122 "public/pw_bluetooth_sapphire/internal/host/gap/types.h", 123 ], 124 implementation_deps = [ 125 "//pw_string:utf_codecs", 126 ], 127 strip_include_prefix = "public", 128 tags = ["noclangtidy"], 129 deps = [ 130 ":definitions", 131 ":peer", 132 "//pw_async:heap_dispatcher", 133 "//pw_bluetooth_sapphire/host/common", 134 "//pw_bluetooth_sapphire/host/gatt", 135 "//pw_bluetooth_sapphire/host/hci", 136 "//pw_bluetooth_sapphire/host/iso", 137 "//pw_bluetooth_sapphire/host/l2cap", 138 "//pw_bluetooth_sapphire/host/sco", 139 "//pw_bluetooth_sapphire/host/sdp", 140 "//pw_bluetooth_sapphire/host/sm", 141 "//pw_bluetooth_sapphire/host/transport", 142 "//third_party/fuchsia:fit", 143 ], 144) 145 146cc_library( 147 name = "testing", 148 testonly = True, 149 srcs = [ 150 "fake_adapter.cc", 151 "fake_pairing_delegate.cc", 152 ], 153 hdrs = [ 154 "public/pw_bluetooth_sapphire/internal/host/gap/fake_adapter.h", 155 "public/pw_bluetooth_sapphire/internal/host/gap/fake_pairing_delegate.h", 156 ], 157 implementation_deps = [ 158 "//pw_unit_test:pw_unit_test.facade", 159 ], 160 strip_include_prefix = "public", 161 deps = [ 162 ":definitions", 163 ":gap", 164 "//pw_bluetooth_sapphire/host/common", 165 "//pw_bluetooth_sapphire/host/hci:testing", 166 "//pw_bluetooth_sapphire/host/l2cap", 167 "//pw_bluetooth_sapphire/host/l2cap:testing", 168 ], 169) 170 171pw_cc_test( 172 name = "gap_test", 173 srcs = [ 174 "adapter_test.cc", 175 "android_vendor_capabilities_test.cc", 176 "bredr_connection_manager_test.cc", 177 "bredr_connection_request_test.cc", 178 "bredr_discovery_manager_test.cc", 179 "bredr_interrogator_test.cc", 180 "fake_pairing_delegate_test.cc", 181 "identity_resolving_list_test.cc", 182 "legacy_pairing_state_test.cc", 183 "low_energy_address_manager_test.cc", 184 "low_energy_advertising_manager_test.cc", 185 "low_energy_connection_manager_test.cc", 186 "low_energy_discovery_manager_test.cc", 187 "low_energy_interrogator_test.cc", 188 "peer_cache_test.cc", 189 "peer_test.cc", 190 "secure_simple_pairing_state_test.cc", 191 "types_test.cc", 192 ], 193 # TODO: https://pwbug.dev/393957973 - Fix this test. 194 tags = [ 195 "noasan", 196 "noubsan", 197 ], 198 test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main", 199 deps = [ 200 ":gap", 201 ":testing", 202 "//pw_bluetooth_sapphire/host/common", 203 "//pw_bluetooth_sapphire/host/gatt:testing", 204 "//pw_bluetooth_sapphire/host/hci:testing", 205 "//pw_bluetooth_sapphire/host/l2cap:testing", 206 "//pw_bluetooth_sapphire/host/sm", 207 "//pw_bluetooth_sapphire/host/sm:testing", 208 "//pw_bluetooth_sapphire/host/testing", 209 "//pw_bluetooth_sapphire/host/testing:fake_controller", 210 "//pw_bluetooth_sapphire/host/testing:mock_controller", 211 "//pw_bluetooth_sapphire/host/testing:test_helpers", 212 "//pw_bluetooth_sapphire/host/transport:testing", 213 ], 214) 215 216pw_cc_fuzz_test( 217 name = "peer_cache_fuzzer", 218 srcs = ["peer_cache_fuzztest.cc"], 219 deps = [ 220 ":gap", 221 "//pw_async:fake_dispatcher", 222 "//pw_bluetooth_sapphire/host/testing:fuzzing", 223 "//pw_random:fuzzer_generator", 224 ], 225) 226 227sphinx_docs_library( 228 name = "docs", 229 srcs = [ 230 "docs.rst", 231 ], 232 target_compatible_with = incompatible_with_mcu(), 233) 234