Simplify the dependency in mediums

PiperOrigin-RevId: 736346209
This commit is contained in:
Guogang Li
2025-03-12 19:27:47 -07:00
committed by Copybara-Service
parent e59e94655a
commit 5eab533260
8 changed files with 85 additions and 12 deletions
+42 -3
View File
@@ -13,13 +13,48 @@
# limitations under the License.
licenses(["notice"])
cc_library(
name = "types",
hdrs = [
"pcp.h",
"webrtc_state.h",
],
visibility = [
"//connections:__subpackages__",
"//sharing:__subpackages__",
],
)
cc_library(
name = "ble_advertisement",
srcs = [
"ble_advertisement.cc",
],
hdrs = [
"ble_advertisement.h",
],
visibility = [
"//connections:__subpackages__",
"//sharing:__subpackages__",
],
deps = [
":types",
"//internal/platform:base",
"//internal/platform:types",
"//internal/platform:util",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
],
)
cc_library(
name = "internal",
srcs = [
"base_bwu_handler.cc",
"base_endpoint_channel.cc",
"base_pcp_handler.cc",
"ble_advertisement.cc",
"ble_endpoint_channel.cc",
"ble_v2_endpoint_channel.cc",
"bluetooth_bwu_handler.cc",
@@ -59,7 +94,6 @@ cc_library(
"base_bwu_handler.h",
"base_endpoint_channel.h",
"base_pcp_handler.h",
"ble_advertisement.h",
"ble_endpoint_channel.h",
"ble_v2_endpoint_channel.h",
"bluetooth_bwu_handler.h",
@@ -83,7 +117,6 @@ cc_library(
"p2p_point_to_point_pcp_handler.h",
"p2p_star_pcp_handler.h",
"payload_manager.h",
"pcp.h",
"pcp_handler.h",
"pcp_manager.h",
"reconnect_manager.h",
@@ -114,6 +147,8 @@ cc_library(
"//sharing:__subpackages__",
],
deps = [
":ble_advertisement",
":types",
"//connections:core_types",
"//connections/implementation/analytics",
"//connections/implementation/flags:connections_flags",
@@ -255,8 +290,10 @@ cc_test(
],
shard_count = 8,
deps = [
":ble_advertisement",
":internal",
":internal_test",
":types",
"//connections:core_types",
"//connections/implementation/analytics",
"//connections/implementation/flags:connections_flags",
@@ -288,7 +325,9 @@ cc_test(
"wifi_lan_service_info_test.cc",
],
deps = [
":ble_advertisement",
":internal",
":types",
"//internal/platform:base",
"//internal/platform/implementation/g3", # build_cleaner: keep
"@com_github_protobuf_matchers//protobuf-matchers",
@@ -42,6 +42,7 @@
#include "connections/implementation/mediums/webrtc_peer_id.h"
#include "connections/implementation/pcp.h"
#include "connections/implementation/pcp_handler.h"
#include "connections/implementation/webrtc_state.h"
#include "connections/listeners.h"
#include "connections/medium_selector.h"
#include "connections/out_of_band_connection_metadata.h"
@@ -71,13 +72,6 @@
namespace nearby {
namespace connections {
// Represents the WebRtc state that mediums are connectable or not.
enum class WebRtcState {
kUndefined = 0,
kConnectable = 1,
kUnconnectable = 2,
};
// Annotations for methods that need to run on PCP handler thread.
// Use only in BasePcpHandler and derived classes.
#define RUN_ON_PCP_HANDLER_THREAD() \
@@ -21,8 +21,8 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "connections/implementation/base_pcp_handler.h"
#include "connections/implementation/pcp.h"
#include "connections/implementation/webrtc_state.h"
#include "internal/platform/bluetooth_utils.h"
#include "internal/platform/byte_array.h"
#include "internal/platform/logging.h"
@@ -19,8 +19,8 @@
#include "absl/status/statusor.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_format.h"
#include "connections/implementation/base_pcp_handler.h"
#include "connections/implementation/pcp.h"
#include "connections/implementation/webrtc_state.h"
#include "internal/platform/bluetooth_utils.h"
#include "internal/platform/byte_array.h"
+2
View File
@@ -48,6 +48,7 @@ cc_library(
":utils",
":webrtc_utils",
"//connections:core_types",
"//connections/implementation:types",
"//connections/implementation/flags:connections_flags",
"//connections/implementation/mediums/ble_v2",
"//connections/implementation/mediums/ble_v2:ble_advertisement_header",
@@ -124,6 +125,7 @@ cc_library(
copts = ["-DNO_WEBRTC"],
visibility = [
"//connections/implementation:__pkg__",
"//connections/implementation/mediums/advertisements:__pkg__",
"//connections/implementation/mediums/ble_v2:__subpackages__",
"//connections/implementation/mediums/multiplex:__pkg__",
"//internal/platform/implementation/windows:__pkg__",
@@ -36,6 +36,7 @@ cc_library(
hdrs = ["dct_advertisement.h"],
deps = [
":common",
"//connections/implementation/mediums:utils",
"//internal/crypto_cros",
"//internal/platform:base",
"//internal/platform:logging",
@@ -77,9 +77,13 @@ cc_library(
deps = [
":ble_advertisement_header",
":bloom_filter",
"//connections/implementation:ble_advertisement",
"//connections/implementation:types",
"//connections/implementation/flags:connections_flags",
"//connections/implementation/mediums:lost_entity_tracker",
"//connections/implementation/mediums:utils",
"//connections/implementation/mediums/advertisements:dct_advertisement",
"//connections/implementation/mediums/advertisements:util",
"//internal/flags:nearby_flags",
"//internal/platform:base",
"//internal/platform:comm",
@@ -118,8 +122,10 @@ cc_test(
":ble_advertisement_header",
":ble_v2",
":bloom_filter",
"//connections/implementation:types",
"//connections/implementation/flags:connections_flags",
"//connections/implementation/mediums:utils",
"//connections/implementation/mediums/advertisements:dct_advertisement",
"//internal/flags:nearby_flags",
"//internal/platform:base",
"//internal/platform:comm",
+31
View File
@@ -0,0 +1,31 @@
// Copyright 2025 Google LLC
//
// 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.
#ifndef THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_WEBRTC_STATE_H_
#define THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_WEBRTC_STATE_H_
namespace nearby {
namespace connections {
// Represents the WebRtc state that mediums are connectable or not.
enum class WebRtcState {
kUndefined = 0,
kConnectable = 1,
kUnconnectable = 2,
};
} // namespace connections
} // namespace nearby
#endif // THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_WEBRTC_STATE_H_