blob: 9050ee8c36566d4ccb6256745e7aee8d85ea815f [file]
# Copyright 2026 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
import("$dir_pigweed/third_party/emboss/emboss.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_thread/backend.gni")
import("$dir_pw_unit_test/test.gni")
config("public_include_path") {
include_dirs = [ "public" ]
visibility = [ ":*" ]
}
# LINT.IfChange
_rfcomm_public = [
"public/pw_bluetooth_proxy/rfcomm/internal/rfcomm_channel_internal.h",
"public/pw_bluetooth_proxy/rfcomm/rfcomm_channel_manager_interface.h",
"public/pw_bluetooth_proxy/rfcomm/rfcomm_common.h",
"public/pw_bluetooth_proxy/rfcomm/rfcomm_config.h",
"public/pw_bluetooth_proxy/rfcomm/rfcomm_manager.h",
]
# LINT.ThenChange(BUILD.bazel, CMakeLists.txt)
# LINT.IfChange
_rfcomm_public_deps = [
"$dir_pw_bluetooth:emboss_rfcomm_frames",
"$dir_pw_containers:dynamic_map",
dir_pw_allocator,
dir_pw_checksum,
dir_pw_multibuf,
]
_rfcomm_deps = [
"$dir_pw_assert:check",
"$dir_pw_bluetooth:emboss_util",
"$dir_pw_span:cast",
]
_rfcomm_sources = [
"rfcomm_channel.cc",
"rfcomm_channel_internal.cc",
"rfcomm_manager.cc",
]
# LINT.ThenChange(Android.bp, rfcomm.bzl, CMakeLists.txt)
pw_source_set("rfcomm") {
# LINT.IfChange
public = _rfcomm_public
public_configs = [ ":public_include_path" ]
public_deps = [ dir_pw_bluetooth_proxy ] + _rfcomm_public_deps
deps = _rfcomm_deps
sources = _rfcomm_sources
# LINT.ThenChange(Android.bp, BUILD.bazel, CMakeLists.txt)
}
pw_source_set("rfcomm_sync") {
public = _rfcomm_public
public_configs = [ ":public_include_path" ]
public_deps = [ "$dir_pw_bluetooth_proxy:pw_bluetooth_proxy_sync" ] +
_rfcomm_public_deps
deps = _rfcomm_deps
sources = _rfcomm_sources
}
pw_source_set("rfcomm_async") {
public = _rfcomm_public
public_configs = [ ":public_include_path" ]
public_deps = [ "$dir_pw_bluetooth_proxy:pw_bluetooth_proxy_async" ] +
_rfcomm_public_deps
deps = _rfcomm_deps
sources = _rfcomm_sources
visibility = [ ":*" ]
}
# Tests
# LINT.IfChange
_rfcomm_test_sources = [
"rfcomm_channel_internal_test.cc",
"rfcomm_manager_test.cc",
]
_rfcomm_test_deps = [
"$dir_pw_allocator:libc_allocator",
"$dir_pw_allocator:testing",
"$dir_pw_multibuf:simple_allocator",
]
# LINT.ThenChange(rfcomm.bzl, CMakeLists.txt)
pw_test("rfcomm_test_sync") {
enable_if =
dir_pw_third_party_emboss != "" && pw_thread_THREAD_BACKEND != "" &&
pw_thread_TEST_THREAD_CONTEXT_BACKEND != ""
# LINT.IfChange
sources = _rfcomm_test_sources
deps = _rfcomm_test_deps + [ ":rfcomm_sync" ]
# LINT.ThenChange(BUILD.bazel, CMakeLists.txt)
}
pw_test("rfcomm_test_async") {
enable_if =
dir_pw_third_party_emboss != "" && pw_thread_THREAD_BACKEND != "" &&
pw_thread_TEST_THREAD_CONTEXT_BACKEND != ""
sources = _rfcomm_test_sources
deps = _rfcomm_test_deps + [ ":rfcomm_async" ]
}
pw_test_group("tests") {
tests = [
":rfcomm_test_sync",
":rfcomm_test_async",
]
}