mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 07:36:10 -04:00
Patch recent cls from nearby_connections;
Sync github to replace nearby_connections with nearby. PiperOrigin-RevId: 411609608
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ cc_library(
|
||||
copts = ["-DCORE_ADAPTER_DLL"],
|
||||
visibility = [
|
||||
"//platform/impl/ios:__subpackages__",
|
||||
"//third_party/nearby_connections/windows:__subpackages__",
|
||||
"//third_party/nearby/windows:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":core_types",
|
||||
|
||||
@@ -87,8 +87,8 @@ cc_library(
|
||||
copts = ["-DCORE_ADAPTER_DLL"],
|
||||
defines = ["NO_WEBRTC"],
|
||||
visibility = [
|
||||
"//third_party/nearby_connections/cpp/core:__pkg__",
|
||||
"//third_party/nearby_connections/cpp/core/internal/fuzzers:__pkg__",
|
||||
"//third_party/nearby/cpp/core:__pkg__",
|
||||
"//third_party/nearby/cpp/core/internal/fuzzers:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
":message_lite",
|
||||
@@ -101,20 +101,20 @@ cc_library(
|
||||
"//third_party/absl/strings",
|
||||
"//third_party/absl/time",
|
||||
"//third_party/absl/types:span",
|
||||
"//third_party/nearby_connections/cpp/analytics",
|
||||
"//third_party/nearby_connections/cpp/core:core_types",
|
||||
"//third_party/nearby_connections/cpp/core/internal/mediums",
|
||||
"//third_party/nearby_connections/cpp/core/internal/mediums:utils",
|
||||
"//third_party/nearby_connections/cpp/platform/api:comm",
|
||||
"//third_party/nearby_connections/cpp/platform/base",
|
||||
"//third_party/nearby_connections/cpp/platform/base:cancellation_flag",
|
||||
"//third_party/nearby_connections/cpp/platform/base:error_code_recorder",
|
||||
"//third_party/nearby_connections/cpp/platform/base:util",
|
||||
"//third_party/nearby_connections/cpp/platform/public:comm",
|
||||
"//third_party/nearby_connections/cpp/platform/public:logging",
|
||||
"//third_party/nearby_connections/cpp/platform/public:types",
|
||||
"//third_party/nearby_connections/proto:connections_enums_portable_proto",
|
||||
"//third_party/nearby_connections/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/nearby/cpp/analytics",
|
||||
"//third_party/nearby/cpp/core:core_types",
|
||||
"//third_party/nearby/cpp/core/internal/mediums",
|
||||
"//third_party/nearby/cpp/core/internal/mediums:utils",
|
||||
"//third_party/nearby/cpp/platform/api:comm",
|
||||
"//third_party/nearby/cpp/platform/base",
|
||||
"//third_party/nearby/cpp/platform/base:cancellation_flag",
|
||||
"//third_party/nearby/cpp/platform/base:error_code_recorder",
|
||||
"//third_party/nearby/cpp/platform/base:util",
|
||||
"//third_party/nearby/cpp/platform/public:comm",
|
||||
"//third_party/nearby/cpp/platform/public:logging",
|
||||
"//third_party/nearby/cpp/platform/public:types",
|
||||
"//third_party/nearby/proto:connections_enums_portable_proto",
|
||||
"//third_party/nearby/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/ukey2",
|
||||
],
|
||||
)
|
||||
@@ -126,7 +126,7 @@ cc_library(
|
||||
],
|
||||
compatible_with = ["//buildenv/target:non_prod"],
|
||||
visibility = [
|
||||
"//third_party/nearby_connections/cpp/core:__subpackages__",
|
||||
"//third_party/nearby/cpp/core:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
"//net/proto2/public:proto2_lite",
|
||||
@@ -148,17 +148,17 @@ cc_library(
|
||||
],
|
||||
defines = ["NO_WEBRTC"],
|
||||
visibility = [
|
||||
"//third_party/nearby_connections/cpp/core:__subpackages__",
|
||||
"//third_party/nearby/cpp/core:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":internal",
|
||||
"//testing/base/public:gunit_for_library_testonly",
|
||||
"//third_party/absl/functional:bind_front",
|
||||
"//third_party/absl/strings",
|
||||
"//third_party/nearby_connections/cpp/core:core_types",
|
||||
"//third_party/nearby_connections/cpp/platform/base",
|
||||
"//third_party/nearby_connections/cpp/platform/base:test_util",
|
||||
"//third_party/nearby_connections/cpp/platform/public:types",
|
||||
"//third_party/nearby/cpp/core:core_types",
|
||||
"//third_party/nearby/cpp/platform/base",
|
||||
"//third_party/nearby/cpp/platform/base:test_util",
|
||||
"//third_party/nearby/cpp/platform/public:types",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -199,18 +199,18 @@ cc_test(
|
||||
"//third_party/absl/synchronization",
|
||||
"//third_party/absl/time",
|
||||
"//third_party/absl/types:span",
|
||||
"//third_party/nearby_connections/cpp/analytics",
|
||||
"//third_party/nearby_connections/cpp/core:core_types",
|
||||
"//third_party/nearby_connections/cpp/core/internal/mediums",
|
||||
"//third_party/nearby_connections/cpp/core/internal/mediums:utils",
|
||||
"//third_party/nearby_connections/cpp/platform/base",
|
||||
"//third_party/nearby_connections/cpp/platform/base:test_util",
|
||||
"//third_party/nearby_connections/cpp/platform/impl/g3", # build_cleaner: keep
|
||||
"//third_party/nearby_connections/cpp/platform/public:comm",
|
||||
"//third_party/nearby_connections/cpp/platform/public:logging",
|
||||
"//third_party/nearby_connections/cpp/platform/public:types",
|
||||
"//third_party/nearby_connections/proto:connections_enums_portable_proto",
|
||||
"//third_party/nearby_connections/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/nearby/cpp/analytics",
|
||||
"//third_party/nearby/cpp/core:core_types",
|
||||
"//third_party/nearby/cpp/core/internal/mediums",
|
||||
"//third_party/nearby/cpp/core/internal/mediums:utils",
|
||||
"//third_party/nearby/cpp/platform/base",
|
||||
"//third_party/nearby/cpp/platform/base:test_util",
|
||||
"//third_party/nearby/cpp/platform/impl/g3", # build_cleaner: keep
|
||||
"//third_party/nearby/cpp/platform/public:comm",
|
||||
"//third_party/nearby/cpp/platform/public:logging",
|
||||
"//third_party/nearby/cpp/platform/public:types",
|
||||
"//third_party/nearby/proto:connections_enums_portable_proto",
|
||||
"//third_party/nearby/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/ukey2",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ cc_library(
|
||||
compatible_with = ["//buildenv/target:non_prod"],
|
||||
defines = ["NO_WEBRTC"],
|
||||
visibility = [
|
||||
"//third_party/nearby_connections/cpp/core/internal:__subpackages__",
|
||||
"//third_party/nearby/cpp/core/internal:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
":utils",
|
||||
@@ -50,15 +50,15 @@ cc_library(
|
||||
"//third_party/absl/strings",
|
||||
"//third_party/absl/strings:str_format",
|
||||
"//third_party/absl/time",
|
||||
"//third_party/nearby_connections/cpp/core:core_types",
|
||||
"//third_party/nearby_connections/cpp/core/internal/mediums/ble_v2",
|
||||
"//third_party/nearby_connections/cpp/platform/base",
|
||||
"//third_party/nearby_connections/cpp/platform/base:cancellation_flag",
|
||||
"//third_party/nearby_connections/cpp/platform/public:comm",
|
||||
"//third_party/nearby_connections/cpp/platform/public:logging",
|
||||
"//third_party/nearby_connections/cpp/platform/public:types",
|
||||
"//third_party/nearby_connections/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/nearby_connections/proto/mediums:web_rtc_signaling_frames_cc_proto",
|
||||
"//third_party/nearby/cpp/core:core_types",
|
||||
"//third_party/nearby/cpp/core/internal/mediums/ble_v2",
|
||||
"//third_party/nearby/cpp/platform/base",
|
||||
"//third_party/nearby/cpp/platform/base:cancellation_flag",
|
||||
"//third_party/nearby/cpp/platform/public:comm",
|
||||
"//third_party/nearby/cpp/platform/public:logging",
|
||||
"//third_party/nearby/cpp/platform/public:types",
|
||||
"//third_party/nearby/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/nearby/proto/mediums:web_rtc_signaling_frames_cc_proto",
|
||||
"//third_party/smhasher:libmurmur3",
|
||||
],
|
||||
)
|
||||
@@ -77,14 +77,14 @@ cc_library(
|
||||
compatible_with = ["//buildenv/target:non_prod"],
|
||||
defines = ["NO_WEBRTC"],
|
||||
visibility = [
|
||||
"//third_party/nearby_connections/cpp/core/internal:__pkg__",
|
||||
"//third_party/nearby_connections/cpp/core/internal/mediums:__pkg__",
|
||||
"//third_party/nearby/cpp/core/internal:__pkg__",
|
||||
"//third_party/nearby/cpp/core/internal/mediums:__pkg__",
|
||||
],
|
||||
deps = [
|
||||
"//third_party/absl/strings",
|
||||
"//third_party/nearby_connections/cpp/platform/base",
|
||||
"//third_party/nearby_connections/cpp/platform/public:types",
|
||||
"//third_party/nearby_connections/proto/connections:offline_wire_formats_portable_proto",
|
||||
"//third_party/nearby/cpp/platform/base",
|
||||
"//third_party/nearby/cpp/platform/public:types",
|
||||
"//third_party/nearby/proto/connections:offline_wire_formats_portable_proto",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -109,10 +109,10 @@ cc_test(
|
||||
"//testing/base/public:gunit_main",
|
||||
"//third_party/absl/strings",
|
||||
"//third_party/absl/time",
|
||||
"//third_party/nearby_connections/cpp/platform/base",
|
||||
"//third_party/nearby_connections/cpp/platform/base:test_util",
|
||||
"//third_party/nearby_connections/cpp/platform/impl/g3", # build_cleaner: keep
|
||||
"//third_party/nearby_connections/cpp/platform/public:comm",
|
||||
"//third_party/nearby_connections/cpp/platform/public:types",
|
||||
"//third_party/nearby/cpp/platform/base",
|
||||
"//third_party/nearby/cpp/platform/base:test_util",
|
||||
"//third_party/nearby/cpp/platform/impl/g3", # build_cleaner: keep
|
||||
"//third_party/nearby/cpp/platform/public:comm",
|
||||
"//third_party/nearby/cpp/platform/public:types",
|
||||
],
|
||||
)
|
||||
|
||||
+78
-78
@@ -1,78 +1,78 @@
|
||||
// Copyright 2020 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 CORE_MEDIUM_SELECTOR_H_
|
||||
#define CORE_MEDIUM_SELECTOR_H_
|
||||
|
||||
#include "proto/connections_enums.pb.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace connections {
|
||||
|
||||
using Medium = location::nearby::proto::connections::Medium;
|
||||
|
||||
// Generic type: allows definition of a feature T for every Medium.
|
||||
template <typename T>
|
||||
struct MediumSelector {
|
||||
T bluetooth;
|
||||
T ble;
|
||||
T web_rtc;
|
||||
T wifi_lan;
|
||||
|
||||
constexpr MediumSelector() = default;
|
||||
constexpr MediumSelector(const MediumSelector&) = default;
|
||||
constexpr MediumSelector& operator=(const MediumSelector&) = default;
|
||||
constexpr bool Any(T value) const {
|
||||
return bluetooth == value || ble == value || web_rtc == value ||
|
||||
wifi_lan == value;
|
||||
}
|
||||
|
||||
constexpr bool All(T value) const {
|
||||
return bluetooth == value && ble == value && web_rtc == value &&
|
||||
wifi_lan == value;
|
||||
}
|
||||
|
||||
constexpr int Count(T value) const {
|
||||
int count = 0;
|
||||
if (bluetooth == value) count++;
|
||||
if (ble == value) count++;
|
||||
if (wifi_lan == value) count++;
|
||||
if (web_rtc == value) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
constexpr MediumSelector& SetAll(T value) {
|
||||
bluetooth = value;
|
||||
ble = value;
|
||||
web_rtc = value;
|
||||
wifi_lan = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<Medium> GetMediums(T value) const {
|
||||
std::vector<Medium> mediums;
|
||||
// Mediums are sorted in order of decreasing preference.
|
||||
if (wifi_lan == value) mediums.push_back(Medium::WIFI_LAN);
|
||||
if (web_rtc == value) mediums.push_back(Medium::WEB_RTC);
|
||||
if (bluetooth == value) mediums.push_back(Medium::BLUETOOTH);
|
||||
if (ble == value) mediums.push_back(Medium::BLE);
|
||||
return mediums;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace connections
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // CORE_MEDIUM_SELECTOR_H_
|
||||
// Copyright 2020 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 CORE_MEDIUM_SELECTOR_H_
|
||||
#define CORE_MEDIUM_SELECTOR_H_
|
||||
|
||||
#include "proto/connections_enums.pb.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace connections {
|
||||
|
||||
using Medium = location::nearby::proto::connections::Medium;
|
||||
|
||||
// Generic type: allows definition of a feature T for every Medium.
|
||||
template <typename T>
|
||||
struct MediumSelector {
|
||||
T bluetooth;
|
||||
T ble;
|
||||
T web_rtc;
|
||||
T wifi_lan;
|
||||
|
||||
constexpr MediumSelector() = default;
|
||||
constexpr MediumSelector(const MediumSelector&) = default;
|
||||
constexpr MediumSelector& operator=(const MediumSelector&) = default;
|
||||
constexpr bool Any(T value) const {
|
||||
return bluetooth == value || ble == value || web_rtc == value ||
|
||||
wifi_lan == value;
|
||||
}
|
||||
|
||||
constexpr bool All(T value) const {
|
||||
return bluetooth == value && ble == value && web_rtc == value &&
|
||||
wifi_lan == value;
|
||||
}
|
||||
|
||||
constexpr int Count(T value) const {
|
||||
int count = 0;
|
||||
if (bluetooth == value) count++;
|
||||
if (ble == value) count++;
|
||||
if (wifi_lan == value) count++;
|
||||
if (web_rtc == value) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
constexpr MediumSelector& SetAll(T value) {
|
||||
bluetooth = value;
|
||||
ble = value;
|
||||
web_rtc = value;
|
||||
wifi_lan = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<Medium> GetMediums(T value) const {
|
||||
std::vector<Medium> mediums;
|
||||
// Mediums are sorted in order of decreasing preference.
|
||||
if (wifi_lan == value) mediums.push_back(Medium::WIFI_LAN);
|
||||
if (web_rtc == value) mediums.push_back(Medium::WEB_RTC);
|
||||
if (bluetooth == value) mediums.push_back(Medium::BLUETOOTH);
|
||||
if (ble == value) mediums.push_back(Medium::BLE);
|
||||
return mediums;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace connections
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // CORE_MEDIUM_SELECTOR_H_
|
||||
|
||||
Reference in New Issue
Block a user