blob: 2dc8a3b18514b9308bbbc1b8588fdfec0ee1cf66 [file] [log] [blame]
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/components.gni")
import("//build/config.gni")
import("//build/dist/resource.gni")
import("//build/rust/rustc_binary.gni")
import("//src/sys/core/build/core_shard.gni")
rustc_binary("bin") {
edition = "2021"
name = "bt_hfp_audio_gateway"
with_unit_tests = true
deps = [
":hfp_profile_config",
"//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth_rust",
"//sdk/fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr_rust",
"//sdk/fidl/fuchsia.bluetooth.hfp:fuchsia.bluetooth.hfp_rust",
"//sdk/fidl/fuchsia.bluetooth.hfp.test:fuchsia.bluetooth.hfp.test_rust",
"//sdk/fidl/fuchsia.bluetooth.internal.a2dp:fuchsia.bluetooth.internal.a2dp_rust",
"//sdk/fidl/fuchsia.hardware.audio:fuchsia.hardware.audio_rust",
"//sdk/fidl/fuchsia.media:fuchsia.media_rust",
"//src/connectivity/bluetooth/lib/async-helpers",
"//src/connectivity/bluetooth/lib/battery-client",
"//src/connectivity/bluetooth/lib/bt-a2dp",
"//src/connectivity/bluetooth/lib/bt-hfp",
"//src/connectivity/bluetooth/lib/bt-rfcomm",
"//src/connectivity/bluetooth/lib/fuchsia-audio-codec",
"//src/connectivity/bluetooth/lib/fuchsia-audio-dai",
"//src/connectivity/bluetooth/lib/fuchsia-audio-device",
"//src/connectivity/bluetooth/lib/fuchsia-bluetooth",
"//src/connectivity/bluetooth/lib/profile-client",
"//src/connectivity/bluetooth/lib/vigil",
"//src/connectivity/lib/at-commands",
"//src/lib/async-utils",
"//src/lib/diagnostics/inspect/contrib/rust",
"//src/lib/diagnostics/inspect/derive",
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-sync",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:bitflags",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
test_deps = [
"//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth_rust",
"//sdk/fidl/fuchsia.power.battery:fuchsia.power.battery_rust",
"//src/connectivity/bluetooth/lib/async-helpers:async-test-helpers",
"//src/connectivity/bluetooth/testing/test-battery-manager",
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//src/lib/test_util",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:proptest",
]
sources = [
"src/a2dp.rs",
"src/audio.rs",
"src/audio/dai.rs",
"src/audio/inband.rs",
"src/config.rs",
"src/error.rs",
"src/features.rs",
"src/fidl_service.rs",
"src/hfp.rs",
"src/inspect.rs",
"src/main.rs",
"src/peer.rs",
"src/peer/calls.rs",
"src/peer/calls/pending.rs",
"src/peer/gain_control.rs",
"src/peer/indicators.rs",
"src/peer/procedure.rs",
"src/peer/procedure/answer.rs",
"src/peer/procedure/call_line_ident_notifications.rs",
"src/peer/procedure/call_waiting_notifications.rs",
"src/peer/procedure/codec_connection_setup.rs",
"src/peer/procedure/codec_support.rs",
"src/peer/procedure/dtmf.rs",
"src/peer/procedure/extended_errors.rs",
"src/peer/procedure/hang_up.rs",
"src/peer/procedure/hf_indicator_status.rs",
"src/peer/procedure/hold.rs",
"src/peer/procedure/indicator_status.rs",
"src/peer/procedure/indicators_activation.rs",
"src/peer/procedure/initiate_call.rs",
"src/peer/procedure/nrec.rs",
"src/peer/procedure/phone_status.rs",
"src/peer/procedure/query_current_calls.rs",
"src/peer/procedure/query_operator_selection.rs",
"src/peer/procedure/ring.rs",
"src/peer/procedure/slc_initialization.rs",
"src/peer/procedure/subscriber_number_information.rs",
"src/peer/procedure/transfer_hf_indicator.rs",
"src/peer/procedure/volume_control.rs",
"src/peer/procedure/volume_synchronization.rs",
"src/peer/ringer.rs",
"src/peer/sco_state.rs",
"src/peer/service_level_connection.rs",
"src/peer/slc_request.rs",
"src/peer/task.rs",
"src/peer/update.rs",
"src/profile.rs",
"src/sco_connector.rs",
"src/service_definitions.rs",
]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_component_manifest("manifest") {
component_name = "bt-hfp-audio-gateway"
manifest = "meta/bt-hfp-audio-gateway.cml"
}
fuchsia_structured_config_rust_lib("hfp_profile_config") {
cm_label = ":manifest"
}
# LINT.IfChange
fuchsia_structured_config_values("default_config_values") {
cm_label = ":manifest"
values = {
reject_incoming_voice_call = false
three_way_calling = false
in_band_ringtone = false
echo_canceling_and_noise_reduction = false
voice_recognition = false
attach_phone_number_to_voice_tag = false
respond_and_hold = false
enhanced_call_controls = false
wide_band_speech = true
enhanced_voice_recognition = false
enhanced_voice_recognition_with_text = false
controller_encoding_cvsd = true
controller_encoding_msbc = true
}
}
# LINT.ThenChange(//src/connectivity/bluetooth/profiles/tests/bt-hfp-audio-gateway-integration-tests/src/main.rs)
fuchsia_component("component") {
cm_label = ":manifest"
deps = [ ":bin" ]
}
fuchsia_package("bt-hfp-audio-gateway-default") {
deps = [
":component",
":default_config_values",
]
}
# The core realm shard to be used by product integrators.
# This shard should be included in configurations in which HFP-AG support is desired.
core_shard("bt-hfp-audio-gateway-core-shard") {
shard_file = "meta/bt-hfp-audio-gateway.core_shard.cml"
}
group("bt-hfp-audio-gateway") {
deps = [ ":bt-hfp-audio-gateway-default" ]
}
fuchsia_test_component("test-component") {
manifest = "meta/bt-hfp-audio-gateway-tests.cml"
deps = [ ":bin_test" ]
test_type = "system"
}
fuchsia_test_package("bt-hfp-audio-gateway-tests") {
test_components = [ ":test-component" ]
deps = [
":default_config_values",
# The component mock for the `fuchsia.bluetooth.internal.a2dp.Controller` capability.
"//src/connectivity/bluetooth/testing/mock-a2dp-controller:mock-a2dp-controller",
]
subpackages = [ "//src/media/codec:codec_factory_test" ]
}
rustc_test("bt_hfp_a2dp_controller_bin") {
edition = "2021"
output_name = "bt_hfp_a2dp_controller_tests"
features = [ "test_a2dp_controller" ]
source_root = "src/a2dp.rs"
deps = [
"//sdk/fidl/fuchsia.bluetooth.internal.a2dp:fuchsia.bluetooth.internal.a2dp_rust",
"//src/connectivity/bluetooth/lib/fuchsia-bluetooth",
"//src/lib/async-utils",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:tracing",
]
sources = [ "src/a2dp.rs" ]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_unittest_package("bt-hfp-a2dp-controller-tests") {
deps = [ ":bt_hfp_a2dp_controller_bin" ]
}
group("tests") {
testonly = true
deps = [
":bt-hfp-a2dp-controller-tests",
":bt-hfp-audio-gateway-tests",
]
}