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_unit_test:pw_cc_test.bzl", "pw_cc_test") 19 20package( 21 default_visibility = ["//visibility:public"], 22 features = ["-layering_check"], 23) 24 25licenses(["notice"]) 26 27cc_library( 28 name = "pw_bluetooth_proxy", 29 30 # LINT.IfChange 31 srcs = [ 32 "acl_data_channel.cc", 33 "basic_l2cap_channel.cc", 34 "gatt_notify_channel.cc", 35 "h4_storage.cc", 36 "l2cap_aclu_signaling_channel.cc", 37 "l2cap_channel.cc", 38 "l2cap_channel_manager.cc", 39 "l2cap_coc.cc", 40 "l2cap_leu_signaling_channel.cc", 41 "l2cap_signaling_channel.cc", 42 "l2cap_status_tracker.cc", 43 "multibuf_writer.cc", 44 "proxy_host.cc", 45 "rfcomm_channel.cc", 46 "rfcomm_fcs.cc", 47 ], 48 # LINT.ThenChange(Android.bp, BUILD.gn, CMakeLists.txt) 49 50 # LINT.IfChange 51 hdrs = [ 52 "public/pw_bluetooth_proxy/basic_l2cap_channel.h", 53 "public/pw_bluetooth_proxy/gatt_notify_channel.h", 54 "public/pw_bluetooth_proxy/h4_packet.h", 55 "public/pw_bluetooth_proxy/internal/acl_data_channel.h", 56 "public/pw_bluetooth_proxy/internal/gatt_notify_channel_internal.h", 57 "public/pw_bluetooth_proxy/internal/h4_storage.h", 58 "public/pw_bluetooth_proxy/internal/hci_transport.h", 59 "public/pw_bluetooth_proxy/internal/l2cap_aclu_signaling_channel.h", 60 "public/pw_bluetooth_proxy/internal/l2cap_channel.h", 61 "public/pw_bluetooth_proxy/internal/l2cap_channel_manager.h", 62 "public/pw_bluetooth_proxy/internal/l2cap_coc_internal.h", 63 "public/pw_bluetooth_proxy/internal/l2cap_leu_signaling_channel.h", 64 "public/pw_bluetooth_proxy/internal/l2cap_signaling_channel.h", 65 "public/pw_bluetooth_proxy/internal/l2cap_status_tracker.h", 66 "public/pw_bluetooth_proxy/internal/logical_transport.h", 67 "public/pw_bluetooth_proxy/internal/multibuf_writer.h", 68 "public/pw_bluetooth_proxy/internal/rfcomm_fcs.h", 69 "public/pw_bluetooth_proxy/l2cap_channel_common.h", 70 "public/pw_bluetooth_proxy/l2cap_coc.h", 71 "public/pw_bluetooth_proxy/l2cap_status_delegate.h", 72 "public/pw_bluetooth_proxy/proxy_host.h", 73 "public/pw_bluetooth_proxy/rfcomm_channel.h", 74 ], 75 # LINT.ThenChange(BUILD.gn, CMakeLists.txt) 76 implementation_deps = ["//pw_containers:algorithm"], 77 strip_include_prefix = "public", 78 79 # LINT.IfChange 80 deps = [ 81 "//pw_allocator:best_fit", 82 "//pw_allocator:synchronized_allocator", 83 "//pw_assert:check", 84 "//pw_bluetooth:emboss_att", 85 "//pw_bluetooth:emboss_hci_commands", 86 "//pw_bluetooth:emboss_hci_common", 87 "//pw_bluetooth:emboss_hci_data", 88 "//pw_bluetooth:emboss_hci_events", 89 "//pw_bluetooth:emboss_hci_h4", 90 "//pw_bluetooth:emboss_l2cap_frames", 91 "//pw_bluetooth:emboss_rfcomm_frames", 92 "//pw_bluetooth:emboss_util", 93 "//pw_containers:flat_map", 94 "//pw_containers:inline_queue", 95 "//pw_containers:vector", 96 "//pw_function", 97 "//pw_log", 98 "//pw_multibuf", 99 "//pw_multibuf:simple_allocator", 100 "//pw_result", 101 "//pw_span", 102 "//pw_span:cast", 103 "//pw_status", 104 "//pw_sync:lock_annotations", 105 "//pw_sync:mutex", 106 ], 107 # LINT.ThenChange(Android.bp, BUILD.gn, CMakeLists.txt) 108) 109 110cc_library( 111 name = "test_utils", 112 testonly = True, 113 114 # LINT.IfChange 115 srcs = ["test_utils.cc"], 116 hdrs = ["pw_bluetooth_proxy_private/test_utils.h"], 117 deps = [ 118 ":pw_bluetooth_proxy", 119 "//pw_assert:check", 120 "//pw_bluetooth:emboss_att", 121 "//pw_bluetooth:emboss_hci_commands", 122 "//pw_bluetooth:emboss_hci_common", 123 "//pw_bluetooth:emboss_hci_events", 124 "//pw_bluetooth:emboss_hci_h4", 125 "//pw_bluetooth:emboss_util", 126 "//pw_containers:flat_map", 127 "//pw_multibuf:testing", 128 "//pw_unit_test", 129 ], 130 # LINT.ThenChange(BUILD.gn, CMakeLists.txt) 131) 132 133pw_cc_test( 134 name = "pw_bluetooth_proxy_test", 135 136 # LINT.IfChange 137 srcs = [ 138 "gatt_notify_test.cc", 139 "h4_packet_test.cc", 140 "l2cap_coc_test.cc", 141 "multibuf_writer_test.cc", 142 "proxy_host_test.cc", 143 "rfcomm_fcs_test.cc", 144 "rfcomm_test.cc", 145 "utils_test.cc", 146 ], 147 deps = [ 148 ":pw_bluetooth_proxy", 149 ":test_utils", 150 "//pw_assert:check", 151 "//pw_bluetooth:emboss_att", 152 "//pw_bluetooth:emboss_hci_commands", 153 "//pw_bluetooth:emboss_hci_common", 154 "//pw_bluetooth:emboss_hci_events", 155 "//pw_bluetooth:emboss_hci_h4", 156 "//pw_bluetooth:emboss_util", 157 "//pw_containers:flat_map", 158 "//pw_multibuf", 159 ], 160 # LINT.ThenChange(BUILD.gn, CMakeLists.txt) 161) 162 163filegroup( 164 name = "doxygen", 165 srcs = [ 166 "public/pw_bluetooth_proxy/h4_packet.h", 167 "public/pw_bluetooth_proxy/proxy_host.h", 168 ], 169) 170 171sphinx_docs_library( 172 name = "docs", 173 srcs = [ 174 "docs.rst", 175 "proxy_host_test.cc", 176 ], 177 prefix = "pw_bluetooth_proxy/", 178 target_compatible_with = incompatible_with_mcu(), 179) 180