• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
17
18package(
19    default_visibility = ["//visibility:public"],
20    features = ["-layering_check"],
21)
22
23cc_library(
24    name = "hci",
25    srcs = [
26        "acl_connection.cc",
27        "advertising_handle_map.cc",
28        "android_extended_low_energy_advertiser.cc",
29        "bredr_connection.cc",
30        "bredr_connection_request.cc",
31        "connection.cc",
32        "discovery_filter.cc",
33        "extended_low_energy_advertiser.cc",
34        "extended_low_energy_scanner.cc",
35        "legacy_low_energy_advertiser.cc",
36        "legacy_low_energy_scanner.cc",
37        "low_energy_advertiser.cc",
38        "low_energy_connection.cc",
39        "low_energy_connector.cc",
40        "low_energy_scanner.cc",
41        "sco_connection.cc",
42        "sequential_command_runner.cc",
43    ],
44    hdrs = [
45        "public/pw_bluetooth_sapphire/internal/host/hci/acl_connection.h",
46        "public/pw_bluetooth_sapphire/internal/host/hci/advertising_handle_map.h",
47        "public/pw_bluetooth_sapphire/internal/host/hci/advertising_report_parser.h",
48        "public/pw_bluetooth_sapphire/internal/host/hci/android_extended_low_energy_advertiser.h",
49        "public/pw_bluetooth_sapphire/internal/host/hci/bredr_connection.h",
50        "public/pw_bluetooth_sapphire/internal/host/hci/bredr_connection_request.h",
51        "public/pw_bluetooth_sapphire/internal/host/hci/connection.h",
52        "public/pw_bluetooth_sapphire/internal/host/hci/discovery_filter.h",
53        "public/pw_bluetooth_sapphire/internal/host/hci/extended_low_energy_advertiser.h",
54        "public/pw_bluetooth_sapphire/internal/host/hci/extended_low_energy_scanner.h",
55        "public/pw_bluetooth_sapphire/internal/host/hci/legacy_low_energy_advertiser.h",
56        "public/pw_bluetooth_sapphire/internal/host/hci/legacy_low_energy_scanner.h",
57        "public/pw_bluetooth_sapphire/internal/host/hci/local_address_delegate.h",
58        "public/pw_bluetooth_sapphire/internal/host/hci/low_energy_advertiser.h",
59        "public/pw_bluetooth_sapphire/internal/host/hci/low_energy_connection.h",
60        "public/pw_bluetooth_sapphire/internal/host/hci/low_energy_connector.h",
61        "public/pw_bluetooth_sapphire/internal/host/hci/low_energy_scanner.h",
62        "public/pw_bluetooth_sapphire/internal/host/hci/sco_connection.h",
63        "public/pw_bluetooth_sapphire/internal/host/hci/sequential_command_runner.h",
64    ],
65    implementation_deps = [
66        "//pw_async:heap_dispatcher",
67        "//pw_bluetooth:emboss_hci",
68        "//pw_preprocessor",
69    ],
70    strip_include_prefix = "public",
71    tags = ["noclangtidy"],
72    deps = [
73        "//pw_bluetooth_sapphire/host/common",
74        "//pw_bluetooth_sapphire/host/hci-spec",
75        "//pw_bluetooth_sapphire/host/transport",
76        "//third_party/fuchsia:fit",
77    ],
78)
79
80cc_library(
81    name = "testing",
82    srcs = [
83        "fake_bredr_connection.cc",
84        "fake_local_address_delegate.cc",
85        "fake_low_energy_connection.cc",
86        "fake_sco_connection.cc",
87    ],
88    hdrs = [
89        "public/pw_bluetooth_sapphire/internal/host/hci/fake_bredr_connection.h",
90        "public/pw_bluetooth_sapphire/internal/host/hci/fake_local_address_delegate.h",
91        "public/pw_bluetooth_sapphire/internal/host/hci/fake_low_energy_connection.h",
92        "public/pw_bluetooth_sapphire/internal/host/hci/fake_sco_connection.h",
93    ],
94    strip_include_prefix = "public",
95    tags = ["noclangtidy"],
96    deps = [
97        ":hci",
98        "//pw_async:heap_dispatcher",
99        "//pw_bluetooth_sapphire/host/common",
100    ],
101)
102
103pw_cc_test(
104    name = "hci_test",
105    srcs = [
106        "advertising_handle_map_test.cc",
107        "connection_test.cc",
108        "discovery_filter_test.cc",
109        "extended_low_energy_advertiser_test.cc",
110        "extended_low_energy_scanner_test.cc",
111        "legacy_low_energy_advertiser_test.cc",
112        "legacy_low_energy_scanner_test.cc",
113        "low_energy_advertiser_test.cc",
114        "low_energy_connector_test.cc",
115        "low_energy_multiple_advertising_test.cc",
116        "low_energy_scanner_test.cc",
117        "sequential_command_runner_test.cc",
118    ],
119    # TODO: https://pwbug.dev/393957973 - Fix this test.
120    tags = ["noubsan"],
121    test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main",
122    deps = [
123        ":hci",
124        ":testing",
125        "//pw_bluetooth:emboss_hci_test",
126        "//pw_bluetooth_sapphire/host/testing",
127        "//pw_bluetooth_sapphire/host/testing:fake_controller",
128        "//pw_bluetooth_sapphire/host/testing:gtest_helpers",
129        "//pw_bluetooth_sapphire/host/testing:mock_controller",
130        "//pw_bluetooth_sapphire/host/testing:test_helpers",
131        "//pw_bluetooth_sapphire/host/transport:testing",
132    ],
133)
134