diff --git a/.bazelrc b/.bazelrc index 0785f8ff..7d2abee6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,4 @@ -build --action_env=BAZEL_CXXOPTS=-std=c++17 +build --action_env=BAZEL_CXXOPTS=-"std=c++20" # Definition of --config=memcheck -build:memcheck --strip=never --test_timeout=3600 \ No newline at end of file +build:memcheck --strip=never --test_timeout=3600 +common --enable_bzlmod diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index ae4ce310..5f9008a9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,3 +1,17 @@ +# Copyright 2023 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. + name: 🐛 Bug Report description: Report a reproducible bug or regression. labels: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index a8017f86..b6c4fd19 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,3 +1,17 @@ +# Copyright 2023 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. + name: 🪄 Feature Request description: Request a new feature or enhancement. labels: diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 25d7556e..b5c643b4 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -1,3 +1,17 @@ +# Copyright 2022 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. + name: Validate on: [push, pull_request] @@ -31,12 +45,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: recursive - name: Build Connections - run: CC=clang CXX=clang++ bazel build --check_visibility=false //connections:core --spawn_strategy=standalone + run: CC=clang-15 CXX=clang-15++ bazel build --copt='-DGITHUB_BUILD' //connections:core - name: Build Presence - run: CC=clang CXX=clang++ bazel build --check_visibility=false //presence --spawn_strategy=standalone + run: CC=clang-15 CXX=clang-15++ bazel build --copt='-DGITHUB_BUILD' //presence + - name: Build Sharing + run: CC=clang-15 CXX=clang-15++ bazel build --verbose_failures --copt='-DGITHUB_BUILD' //sharing:nearby_sharing_service //sharing/certificates //sharing/contacts //sharing/local_device_data //sharing/proto/... //sharing/internal/public:nearby_context //sharing/common:all //sharing/scheduling //sharing/fast_initiation:nearby_fast_initiation //sharing/analytics build-rust-linux: name: Build Rust on Linux @@ -63,4 +77,4 @@ jobs: run: cargo test --manifest-path fastpair/rust/bluetooth/Cargo.toml - name: Build Fast Pair run: cargo test --manifest-path fastpair/rust/demo/rust/Cargo.toml - \ No newline at end of file + diff --git a/.gitignore b/.gitignore index 2761ddd3..a614f9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -54,8 +54,5 @@ Carthage/Build # Rust Cargo.lock -# Bazel Build Directories +# Bazel bazel-* - -# Clang LSP compilation database -compile_commands.json diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..dc8b4b09 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,99 @@ +bazel_dep(name = "platforms", version = "0.0.8") +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "rules_rust", version = "0.42.1") +bazel_dep(name = "bazel_skylib", version = "1.5.0") + +bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "com_google_absl") +bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf") +bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest") +bazel_dep(name = "boringssl", version = "0.0.0-20240126-22d349c") + +git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +git_repository( + name = "beto-core", + remote = "https://beto-core.googlesource.com/beto-core", + commit = "415bd032561d078720642d52e28fd3bc9d5155d4", +) + +rust = use_extension("@rules_rust//rust:extensions.bzl", "rust") +rust.toolchain( + edition = "2021", + versions = ["1.77.1"], +) +use_repo(rust, "rust_toolchains") +register_toolchains("@rust_toolchains//:all") + +crate = use_extension( + "@rules_rust//crate_universe:extension.bzl", + "crate", +) +crate.from_cargo( + name = "crate_index", + cargo_lockfile = "@beto-core//:bazel_placeholder/Cargo.lock", + manifests = [ + "@beto-core//:bazel_placeholder/Cargo.toml", + ], +) +use_repo(crate, "crate_index") + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "com_google_ukey2", + strip_prefix = "ukey2-master", + urls = ["https://github.com/google/ukey2/archive/master.zip"], +) + +http_archive( + name = "aappleby_smhasher", + strip_prefix = "smhasher-master", + build_file_content = """ +package(default_visibility = ["//visibility:public"]) +cc_library( + name = "libmurmur3", + srcs = ["src/MurmurHash3.cpp"], + hdrs = ["src/MurmurHash3.h"], + copts = ["-Wno-implicit-fallthrough"], + licenses = ["unencumbered"], # MurmurHash is explicity public-domain +)""", + urls = ["https://github.com/aappleby/smhasher/archive/master.zip"], +) + +http_archive( + name = "nlohmann_json", + strip_prefix = "json-3.10.5", + build_file_content = """ +cc_library( + name = "json", + hdrs = glob([ + "include/nlohmann/**/*.hpp", + ]), + includes = ["include"], + visibility = ["//visibility:public"], + alwayslink = True, +)""", + urls = [ + "https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz", + ], +) + +# ---------------------------------------------- +# Nisaba: Script processing library from Google: +# ---------------------------------------------- +# We depend on some of core C++ libraries from Nisaba and use the fresh code +# from the HEAD. See +# https://github.com/google-research/nisaba +http_archive( + name = "com_google_nisaba", + url = "https://github.com/google-research/nisaba/archive/refs/heads/main.zip", + strip_prefix = "nisaba-main", +) + +# ------------------------------------------------------------------------- +# Protocol buffer matches (should be part of gmock and gtest, but not yet): +# https://github.com/inazarenko/protobuf-matchers +http_archive( + name = "com_github_protobuf_matchers", + urls = ["https://github.com/inazarenko/protobuf-matchers/archive/refs/heads/master.zip"], + strip_prefix = "protobuf-matchers-master", +) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock new file mode 100644 index 00000000..228449a1 --- /dev/null +++ b/MODULE.bazel.lock @@ -0,0 +1,14755 @@ +{ + "lockFileVersion": 6, + "moduleFileHash": "6ee596d1b929d2864ef645de1fa24095a73d7e7ac6f37557f720d96fee1d0238", + "flags": { + "cmdRegistries": [ + "https://bcr.bazel.build/" + ], + "cmdModuleOverrides": {}, + "allowedYankedVersions": [], + "envVarAllowedYankedVersions": "", + "ignoreDevDependency": false, + "directDependenciesMode": "WARNING", + "compatibilityMode": "ERROR" + }, + "localOverrideHashes": { + "bazel_tools": "1ae69322ac3823527337acf02016e8ee95813d8d356f47060255b8956fa642f0" + }, + "moduleDepGraph": { + "": { + "name": "", + "version": "", + "key": "", + "repoName": "", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "@rust_toolchains//:all" + ], + "extensionUsages": [ + { + "extensionBzlFile": "//:MODULE.bazel", + "extensionName": "_repo_rules", + "usingModule": "", + "location": { + "file": "@@//:MODULE.bazel", + "line": 0, + "column": 0 + }, + "imports": { + "beto-core": "beto-core", + "com_google_ukey2": "com_google_ukey2", + "aappleby_smhasher": "aappleby_smhasher", + "nlohmann_json": "nlohmann_json", + "com_google_nisaba": "com_google_nisaba", + "com_github_protobuf_matchers": "com_github_protobuf_matchers" + }, + "devImports": [], + "tags": [ + { + "tagName": "@bazel_tools//tools/build_defs/repo:git.bzl%git_repository", + "attributeValues": { + "remote": "https://beto-core.googlesource.com/beto-core", + "commit": "415bd032561d078720642d52e28fd3bc9d5155d4", + "name": "beto-core" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 12, + "column": 15 + } + }, + { + "tagName": "@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributeValues": { + "strip_prefix": "ukey2-master", + "urls": [ + "https://github.com/google/ukey2/archive/master.zip" + ], + "name": "com_google_ukey2" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 41, + "column": 13 + } + }, + { + "tagName": "@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributeValues": { + "strip_prefix": "smhasher-master", + "build_file_content": "\npackage(default_visibility = [\"//visibility:public\"])\ncc_library(\n name = \"libmurmur3\",\n srcs = [\"src/MurmurHash3.cpp\"],\n hdrs = [\"src/MurmurHash3.h\"],\n copts = [\"-Wno-implicit-fallthrough\"],\n licenses = [\"unencumbered\"], # MurmurHash is explicity public-domain\n)", + "urls": [ + "https://github.com/aappleby/smhasher/archive/master.zip" + ], + "name": "aappleby_smhasher" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 47, + "column": 13 + } + }, + { + "tagName": "@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributeValues": { + "strip_prefix": "json-3.10.5", + "build_file_content": "\ncc_library(\n name = \"json\",\n hdrs = glob([\n \"include/nlohmann/**/*.hpp\",\n ]),\n includes = [\"include\"],\n visibility = [\"//visibility:public\"],\n alwayslink = True,\n)", + "urls": [ + "https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz" + ], + "name": "nlohmann_json" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 62, + "column": 13 + } + }, + { + "tagName": "@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributeValues": { + "url": "https://github.com/google-research/nisaba/archive/refs/heads/main.zip", + "strip_prefix": "nisaba-main", + "name": "com_google_nisaba" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 86, + "column": 13 + } + }, + { + "tagName": "@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributeValues": { + "urls": [ + "https://github.com/inazarenko/protobuf-matchers/archive/refs/heads/master.zip" + ], + "strip_prefix": "protobuf-matchers-master", + "name": "com_github_protobuf_matchers" + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 95, + "column": 13 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_rust//rust:extensions.bzl", + "extensionName": "rust", + "usingModule": "", + "location": { + "file": "@@//:MODULE.bazel", + "line": 18, + "column": 21 + }, + "imports": { + "rust_toolchains": "rust_toolchains" + }, + "devImports": [], + "tags": [ + { + "tagName": "toolchain", + "attributeValues": { + "edition": "2021", + "versions": [ + "1.77.1" + ] + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 19, + "column": 15 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_rust//crate_universe:extension.bzl", + "extensionName": "crate", + "usingModule": "", + "location": { + "file": "@@//:MODULE.bazel", + "line": 26, + "column": 22 + }, + "imports": { + "crate_index": "crate_index" + }, + "devImports": [], + "tags": [ + { + "tagName": "from_cargo", + "attributeValues": { + "name": "crate_index", + "cargo_lockfile": "@beto-core//:bazel_placeholder/Cargo.lock", + "manifests": [ + "@beto-core//:bazel_placeholder/Cargo.toml" + ] + }, + "devDependency": false, + "location": { + "file": "@@//:MODULE.bazel", + "line": 30, + "column": 17 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "rules_rust": "rules_rust@0.42.1", + "bazel_skylib": "bazel_skylib@1.5.0", + "com_google_absl": "abseil-cpp@20240116.1", + "com_google_protobuf": "protobuf@21.7", + "com_google_googletest": "googletest@1.14.0.bcr.1", + "boringssl": "boringssl@0.0.0-20240126-22d349c", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + } + }, + "platforms@0.0.8": { + "name": "platforms", + "version": "0.0.8", + "key": "platforms@0.0.8", + "repoName": "platforms", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "rules_license": "rules_license@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/platforms/releases/download/0.0.8/platforms-0.0.8.tar.gz" + ], + "integrity": "sha256-gVBAZgU4ns7LbaB8vLUJ1WN6OrmiS8abEQFTE2fYnXQ=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "rules_cc@0.0.9": { + "name": "rules_cc", + "version": "0.0.9", + "key": "rules_cc@0.0.9", + "repoName": "rules_cc", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "@local_config_cc_toolchains//:all" + ], + "extensionUsages": [ + { + "extensionBzlFile": "@bazel_tools//tools/cpp:cc_configure.bzl", + "extensionName": "cc_configure_extension", + "usingModule": "rules_cc@0.0.9", + "location": { + "file": "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel", + "line": 9, + "column": 29 + }, + "imports": { + "local_config_cc_toolchains": "local_config_cc_toolchains" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz" + ], + "integrity": "sha256-IDeHW5pEVtzkp50RKorohbvEqtlo5lh9ym5k86CQDN8=", + "strip_prefix": "rules_cc-0.0.9", + "remote_patches": { + "https://bcr.bazel.build/modules/rules_cc/0.0.9/patches/module_dot_bazel_version.patch": "sha256-mM+qzOI0SgAdaJBlWOSMwMPKpaA9b7R37Hj/tp5bb4g=" + }, + "remote_patch_strip": 0 + } + } + }, + "rules_rust@0.42.1": { + "name": "rules_rust", + "version": "0.42.1", + "key": "rules_rust@0.42.1", + "repoName": "rules_rust", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "@rust_toolchains//:all" + ], + "extensionUsages": [ + { + "extensionBzlFile": "@rules_rust//rust/private:extensions.bzl", + "extensionName": "i", + "usingModule": "rules_rust@0.42.1", + "location": { + "file": "https://bcr.bazel.build/modules/rules_rust/0.42.1/MODULE.bazel", + "line": 54, + "column": 30 + }, + "imports": { + "bazelci_rules": "bazelci_rules", + "cargo_bazel.buildifier-darwin-amd64": "cargo_bazel.buildifier-darwin-amd64", + "cargo_bazel.buildifier-darwin-arm64": "cargo_bazel.buildifier-darwin-arm64", + "cargo_bazel.buildifier-linux-amd64": "cargo_bazel.buildifier-linux-amd64", + "cargo_bazel.buildifier-linux-arm64": "cargo_bazel.buildifier-linux-arm64", + "cargo_bazel.buildifier-windows-amd64.exe": "cargo_bazel.buildifier-windows-amd64.exe", + "com_google_googleapis": "com_google_googleapis", + "cui": "cui", + "cui__anyhow-1.0.75": "cui__anyhow-1.0.75", + "cui__camino-1.1.6": "cui__camino-1.1.6", + "cui__cargo-lock-9.0.0": "cui__cargo-lock-9.0.0", + "cui__cargo-platform-0.1.4": "cui__cargo-platform-0.1.4", + "cui__cargo_metadata-0.18.1": "cui__cargo_metadata-0.18.1", + "cui__cargo_toml-0.19.2": "cui__cargo_toml-0.19.2", + "cui__cfg-expr-0.15.5": "cui__cfg-expr-0.15.5", + "cui__clap-4.3.11": "cui__clap-4.3.11", + "cui__crates-index-2.2.0": "cui__crates-index-2.2.0", + "cui__hex-0.4.3": "cui__hex-0.4.3", + "cui__indoc-2.0.4": "cui__indoc-2.0.4", + "cui__itertools-0.12.0": "cui__itertools-0.12.0", + "cui__maplit-1.0.2": "cui__maplit-1.0.2", + "cui__normpath-1.1.1": "cui__normpath-1.1.1", + "cui__pathdiff-0.2.1": "cui__pathdiff-0.2.1", + "cui__regex-1.10.2": "cui__regex-1.10.2", + "cui__semver-1.0.20": "cui__semver-1.0.20", + "cui__serde-1.0.190": "cui__serde-1.0.190", + "cui__serde_json-1.0.108": "cui__serde_json-1.0.108", + "cui__serde_starlark-0.1.14": "cui__serde_starlark-0.1.14", + "cui__sha2-0.10.8": "cui__sha2-0.10.8", + "cui__spdx-0.10.3": "cui__spdx-0.10.3", + "cui__spectral-0.6.0": "cui__spectral-0.6.0", + "cui__tempfile-3.8.1": "cui__tempfile-3.8.1", + "cui__tera-1.19.1": "cui__tera-1.19.1", + "cui__textwrap-0.16.0": "cui__textwrap-0.16.0", + "cui__toml-0.8.10": "cui__toml-0.8.10", + "cui__tracing-0.1.40": "cui__tracing-0.1.40", + "cui__tracing-subscriber-0.3.17": "cui__tracing-subscriber-0.3.17", + "generated_inputs_in_external_repo": "generated_inputs_in_external_repo", + "libc": "libc", + "llvm-raw": "llvm-raw", + "rrra__anyhow-1.0.71": "rrra__anyhow-1.0.71", + "rrra__clap-4.3.11": "rrra__clap-4.3.11", + "rrra__env_logger-0.10.0": "rrra__env_logger-0.10.0", + "rrra__itertools-0.11.0": "rrra__itertools-0.11.0", + "rrra__log-0.4.19": "rrra__log-0.4.19", + "rrra__serde-1.0.171": "rrra__serde-1.0.171", + "rrra__serde_json-1.0.102": "rrra__serde_json-1.0.102", + "rules_rust_bindgen__bindgen-0.69.1": "rules_rust_bindgen__bindgen-0.69.1", + "rules_rust_bindgen__bindgen-cli-0.69.1": "rules_rust_bindgen__bindgen-cli-0.69.1", + "rules_rust_bindgen__clang-sys-1.6.1": "rules_rust_bindgen__clang-sys-1.6.1", + "rules_rust_bindgen__clap-4.3.3": "rules_rust_bindgen__clap-4.3.3", + "rules_rust_bindgen__clap_complete-4.3.1": "rules_rust_bindgen__clap_complete-4.3.1", + "rules_rust_bindgen__env_logger-0.10.0": "rules_rust_bindgen__env_logger-0.10.0", + "rules_rust_prost": "rules_rust_prost", + "rules_rust_prost__h2-0.3.19": "rules_rust_prost__h2-0.3.19", + "rules_rust_prost__heck": "rules_rust_prost__heck", + "rules_rust_prost__prost-0.11.9": "rules_rust_prost__prost-0.11.9", + "rules_rust_prost__prost-types-0.11.9": "rules_rust_prost__prost-types-0.11.9", + "rules_rust_prost__protoc-gen-prost-0.2.2": "rules_rust_prost__protoc-gen-prost-0.2.2", + "rules_rust_prost__protoc-gen-tonic-0.2.2": "rules_rust_prost__protoc-gen-tonic-0.2.2", + "rules_rust_prost__tokio-1.28.2": "rules_rust_prost__tokio-1.28.2", + "rules_rust_prost__tokio-stream-0.1.14": "rules_rust_prost__tokio-stream-0.1.14", + "rules_rust_prost__tonic-0.9.2": "rules_rust_prost__tonic-0.9.2", + "rules_rust_proto__grpc-0.6.2": "rules_rust_proto__grpc-0.6.2", + "rules_rust_proto__grpc-compiler-0.6.2": "rules_rust_proto__grpc-compiler-0.6.2", + "rules_rust_proto__log-0.4.17": "rules_rust_proto__log-0.4.17", + "rules_rust_proto__protobuf-2.8.2": "rules_rust_proto__protobuf-2.8.2", + "rules_rust_proto__protobuf-codegen-2.8.2": "rules_rust_proto__protobuf-codegen-2.8.2", + "rules_rust_proto__tls-api-0.1.22": "rules_rust_proto__tls-api-0.1.22", + "rules_rust_proto__tls-api-stub-0.1.22": "rules_rust_proto__tls-api-stub-0.1.22", + "rules_rust_test_load_arbitrary_tool": "rules_rust_test_load_arbitrary_tool", + "rules_rust_tinyjson": "rules_rust_tinyjson", + "rules_rust_toolchain_test_target_json": "rules_rust_toolchain_test_target_json", + "rules_rust_wasm_bindgen__anyhow-1.0.71": "rules_rust_wasm_bindgen__anyhow-1.0.71", + "rules_rust_wasm_bindgen__assert_cmd-1.0.8": "rules_rust_wasm_bindgen__assert_cmd-1.0.8", + "rules_rust_wasm_bindgen__diff-0.1.13": "rules_rust_wasm_bindgen__diff-0.1.13", + "rules_rust_wasm_bindgen__docopt-1.1.1": "rules_rust_wasm_bindgen__docopt-1.1.1", + "rules_rust_wasm_bindgen__env_logger-0.8.4": "rules_rust_wasm_bindgen__env_logger-0.8.4", + "rules_rust_wasm_bindgen__log-0.4.19": "rules_rust_wasm_bindgen__log-0.4.19", + "rules_rust_wasm_bindgen__predicates-1.0.8": "rules_rust_wasm_bindgen__predicates-1.0.8", + "rules_rust_wasm_bindgen__rayon-1.7.0": "rules_rust_wasm_bindgen__rayon-1.7.0", + "rules_rust_wasm_bindgen__rouille-3.6.2": "rules_rust_wasm_bindgen__rouille-3.6.2", + "rules_rust_wasm_bindgen__serde-1.0.171": "rules_rust_wasm_bindgen__serde-1.0.171", + "rules_rust_wasm_bindgen__serde_derive-1.0.171": "rules_rust_wasm_bindgen__serde_derive-1.0.171", + "rules_rust_wasm_bindgen__serde_json-1.0.102": "rules_rust_wasm_bindgen__serde_json-1.0.102", + "rules_rust_wasm_bindgen__tempfile-3.6.0": "rules_rust_wasm_bindgen__tempfile-3.6.0", + "rules_rust_wasm_bindgen__ureq-2.8.0": "rules_rust_wasm_bindgen__ureq-2.8.0", + "rules_rust_wasm_bindgen__walrus-0.20.3": "rules_rust_wasm_bindgen__walrus-0.20.3", + "rules_rust_wasm_bindgen__wasm-bindgen-0.2.91": "rules_rust_wasm_bindgen__wasm-bindgen-0.2.91", + "rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.91": "rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.91", + "rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.91": "rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.91", + "rules_rust_wasm_bindgen__wasmparser-0.102.0": "rules_rust_wasm_bindgen__wasmparser-0.102.0", + "rules_rust_wasm_bindgen__wasmprinter-0.2.60": "rules_rust_wasm_bindgen__wasmprinter-0.2.60", + "rules_rust_wasm_bindgen_cli": "rules_rust_wasm_bindgen_cli" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_rust//rust:extensions.bzl", + "extensionName": "rust", + "usingModule": "rules_rust@0.42.1", + "location": { + "file": "https://bcr.bazel.build/modules/rules_rust/0.42.1/MODULE.bazel", + "line": 153, + "column": 21 + }, + "imports": { + "rust_toolchains": "rust_toolchains" + }, + "devImports": [], + "tags": [ + { + "tagName": "toolchain", + "attributeValues": { + "edition": "2021" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/rules_rust/0.42.1/MODULE.bazel", + "line": 154, + "column": 15 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_rust//rust:extensions.bzl", + "extensionName": "rust_host_tools", + "usingModule": "rules_rust@0.42.1", + "location": { + "file": "https://bcr.bazel.build/modules/rules_rust/0.42.1/MODULE.bazel", + "line": 176, + "column": 32 + }, + "imports": { + "rust_host_tools": "rust_host_tools" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_rust//crate_universe/private/module_extensions:cargo_bazel_bootstrap.bzl", + "extensionName": "cargo_bazel_bootstrap", + "usingModule": "rules_rust@0.42.1", + "location": { + "file": "https://bcr.bazel.build/modules/rules_rust/0.42.1/MODULE.bazel", + "line": 179, + "column": 38 + }, + "imports": { + "cargo_bazel_bootstrap": "cargo_bazel_bootstrap" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_features": "bazel_features@1.9.1", + "bazel_skylib": "bazel_skylib@1.5.0", + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "rules_license": "rules_license@0.0.8", + "rules_proto": "rules_proto@5.3.0-21.7", + "build_bazel_apple_support": "apple_support@1.13.0", + "com_google_protobuf": "protobuf@21.7", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_rust/releases/download/0.42.1/rules_rust-v0.42.1.tar.gz" + ], + "integrity": "sha256-JLN47ZcAbx9wEr5Jiib4HduZATGLiDgK7oUi/fvotzU=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "bazel_skylib@1.5.0": { + "name": "bazel_skylib", + "version": "1.5.0", + "key": "bazel_skylib@1.5.0", + "repoName": "bazel_skylib", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "//toolchains/unittest:cmd_toolchain", + "//toolchains/unittest:bash_toolchain" + ], + "extensionUsages": [], + "deps": { + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz" + ], + "integrity": "sha256-zVWgYudjuTSZIfD124w5MyiNyLpPdt2UFqrGis7jy5Q=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "abseil-cpp@20240116.1": { + "name": "abseil-cpp", + "version": "20240116.1", + "key": "abseil-cpp@20240116.1", + "repoName": "abseil-cpp", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "com_google_googletest": "googletest@1.14.0.bcr.1", + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/abseil/abseil-cpp/releases/download/20240116.1/abseil-cpp-20240116.1.tar.gz" + ], + "integrity": "sha256-PHQyBN94NmrS6vI21mMdg/a8ko0XBd0AALhy5Ttz3Go=", + "strip_prefix": "abseil-cpp-20240116.1", + "remote_patches": { + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/patches/module_dot_bazel.patch": "sha256-H6J0U5xTQRVVGFkTsBioOCeWetuCfpavigN8YvpQkIQ=" + }, + "remote_patch_strip": 0 + } + } + }, + "protobuf@21.7": { + "name": "protobuf", + "version": "21.7", + "key": "protobuf@21.7", + "repoName": "protobuf", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@rules_jvm_external//:extensions.bzl", + "extensionName": "maven", + "usingModule": "protobuf@21.7", + "location": { + "file": "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel", + "line": 22, + "column": 22 + }, + "imports": { + "maven": "maven" + }, + "devImports": [], + "tags": [ + { + "tagName": "install", + "attributeValues": { + "name": "maven", + "artifacts": [ + "com.google.code.findbugs:jsr305:3.0.2", + "com.google.code.gson:gson:2.8.9", + "com.google.errorprone:error_prone_annotations:2.3.2", + "com.google.j2objc:j2objc-annotations:1.3", + "com.google.guava:guava:31.1-jre", + "com.google.guava:guava-testlib:31.1-jre", + "com.google.truth:truth:1.1.2", + "junit:junit:4.13.2", + "org.mockito:mockito-core:4.3.1" + ] + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel", + "line": 24, + "column": 14 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "rules_python": "rules_python@0.25.0", + "rules_cc": "rules_cc@0.0.9", + "rules_proto": "rules_proto@5.3.0-21.7", + "rules_java": "rules_java@7.4.0", + "rules_pkg": "rules_pkg@0.7.0", + "com_google_abseil": "abseil-cpp@20240116.1", + "zlib": "zlib@1.3", + "upb": "upb@0.0.0-20220923-a547704", + "rules_jvm_external": "rules_jvm_external@4.4.2", + "com_google_googletest": "googletest@1.14.0.bcr.1", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protobuf-all-21.7.zip" + ], + "integrity": "sha256-VJOiH17T/FAuZv7GuUScBqVRztYwAvpIkDxA36jeeko=", + "strip_prefix": "protobuf-21.7", + "remote_patches": { + "https://bcr.bazel.build/modules/protobuf/21.7/patches/add_module_dot_bazel.patch": "sha256-q3V2+eq0v2XF0z8z+V+QF4cynD6JvHI1y3kI/+rzl5s=", + "https://bcr.bazel.build/modules/protobuf/21.7/patches/add_module_dot_bazel_for_examples.patch": "sha256-O7YP6s3lo/1opUiO0jqXYORNHdZ/2q3hjz1QGy8QdIU=", + "https://bcr.bazel.build/modules/protobuf/21.7/patches/relative_repo_names.patch": "sha256-RK9RjW8T5UJNG7flIrnFiNE9vKwWB+8uWWtJqXYT0w4=", + "https://bcr.bazel.build/modules/protobuf/21.7/patches/add_missing_files.patch": "sha256-Hyne4DG2u5bXcWHNxNMirA2QFAe/2Cl8oMm1XJdkQIY=" + }, + "remote_patch_strip": 1 + } + } + }, + "googletest@1.14.0.bcr.1": { + "name": "googletest", + "version": "1.14.0.bcr.1", + "key": "googletest@1.14.0.bcr.1", + "repoName": "googletest", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "com_google_absl": "abseil-cpp@20240116.1", + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "com_googlesource_code_re2": "re2@2023-09-01", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz" + ], + "integrity": "sha256-itWYxzrXluDYKAsILOvYKmMNc+c808cAV5OKZQG7pdc=", + "strip_prefix": "googletest-1.14.0", + "remote_patches": { + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/patches/module_dot_bazel.patch": "sha256-jijctisPYOzP4X4cl0K7neRh/kqJB+yODNHf8V8heCE=" + }, + "remote_patch_strip": 0 + } + } + }, + "boringssl@0.0.0-20240126-22d349c": { + "name": "boringssl", + "version": "0.0.0-20240126-22d349c", + "key": "boringssl@0.0.0-20240126-22d349c", + "repoName": "boringssl", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "rules_cc": "rules_cc@0.0.9", + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/google/boringssl/archive/22d349c4596e81425ec88f82fab47063a9a2bac6.tar.gz" + ], + "integrity": "sha256-rMEdcuN6QX90hSzHXUCE7HEhcnwBvR6bVSUjHJsDwnc=", + "strip_prefix": "boringssl-22d349c4596e81425ec88f82fab47063a9a2bac6", + "remote_patches": { + "https://bcr.bazel.build/modules/boringssl/0.0.0-20240126-22d349c/patches/module_dot_bazel.patch": "sha256-vLc6oUB/XI3PtPUx1z0U5e+l6BEuz3IeRW7wR8Omp14=" + }, + "remote_patch_strip": 0 + } + } + }, + "bazel_tools@_": { + "name": "bazel_tools", + "version": "", + "key": "bazel_tools@_", + "repoName": "bazel_tools", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "@local_config_cc_toolchains//:all", + "@local_config_sh//:local_sh_toolchain" + ], + "extensionUsages": [ + { + "extensionBzlFile": "@bazel_tools//tools/cpp:cc_configure.bzl", + "extensionName": "cc_configure_extension", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 18, + "column": 29 + }, + "imports": { + "local_config_cc": "local_config_cc", + "local_config_cc_toolchains": "local_config_cc_toolchains" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@bazel_tools//tools/osx:xcode_configure.bzl", + "extensionName": "xcode_configure_extension", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 22, + "column": 32 + }, + "imports": { + "local_config_xcode": "local_config_xcode" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_java//java:extensions.bzl", + "extensionName": "toolchains", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 25, + "column": 32 + }, + "imports": { + "local_jdk": "local_jdk", + "remote_java_tools": "remote_java_tools", + "remote_java_tools_linux": "remote_java_tools_linux", + "remote_java_tools_windows": "remote_java_tools_windows", + "remote_java_tools_darwin_x86_64": "remote_java_tools_darwin_x86_64", + "remote_java_tools_darwin_arm64": "remote_java_tools_darwin_arm64" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@bazel_tools//tools/sh:sh_configure.bzl", + "extensionName": "sh_configure_extension", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 36, + "column": 39 + }, + "imports": { + "local_config_sh": "local_config_sh" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@bazel_tools//tools/test:extensions.bzl", + "extensionName": "remote_coverage_tools_extension", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 40, + "column": 48 + }, + "imports": { + "remote_coverage_tools": "remote_coverage_tools" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@bazel_tools//tools/android:android_extensions.bzl", + "extensionName": "remote_android_tools_extensions", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 43, + "column": 42 + }, + "imports": { + "android_gmaven_r8": "android_gmaven_r8", + "android_tools": "android_tools" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@buildozer//:buildozer_binary.bzl", + "extensionName": "buildozer_binary", + "usingModule": "bazel_tools@_", + "location": { + "file": "@@bazel_tools//:MODULE.bazel", + "line": 47, + "column": 33 + }, + "imports": { + "buildozer_binary": "buildozer_binary" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "rules_cc": "rules_cc@0.0.9", + "rules_java": "rules_java@7.4.0", + "rules_license": "rules_license@0.0.8", + "rules_proto": "rules_proto@5.3.0-21.7", + "rules_python": "rules_python@0.25.0", + "buildozer": "buildozer@6.4.0.2", + "platforms": "platforms@0.0.8", + "com_google_protobuf": "protobuf@21.7", + "zlib": "zlib@1.3", + "build_bazel_apple_support": "apple_support@1.13.0", + "local_config_platform": "local_config_platform@_" + } + }, + "local_config_platform@_": { + "name": "local_config_platform", + "version": "", + "key": "local_config_platform@_", + "repoName": "local_config_platform", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_" + } + }, + "rules_license@0.0.8": { + "name": "rules_license", + "version": "0.0.8", + "key": "rules_license@0.0.8", + "repoName": "rules_license", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_license/releases/download/0.0.8/rules_license-0.0.8.tar.gz" + ], + "integrity": "sha256-JBsG8wl/0Yb/RogyFQ1swUIkfcQqMqrvtW0AmYlf0ik=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "bazel_features@1.9.1": { + "name": "bazel_features", + "version": "1.9.1", + "key": "bazel_features@1.9.1", + "repoName": "bazel_features", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@bazel_features//private:extensions.bzl", + "extensionName": "version_extension", + "usingModule": "bazel_features@1.9.1", + "location": { + "file": "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel", + "line": 15, + "column": 24 + }, + "imports": { + "bazel_features_globals": "bazel_features_globals", + "bazel_features_version": "bazel_features_version" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazel-contrib/bazel_features/releases/download/v1.9.1/bazel_features-v1.9.1.tar.gz" + ], + "integrity": "sha256-13h9oomn+0lzUiEa0gDsn2mIIqngdXpJdv2fcT/zcrM=", + "strip_prefix": "bazel_features-1.9.1", + "remote_patches": { + "https://bcr.bazel.build/modules/bazel_features/1.9.1/patches/module_dot_bazel_version.patch": "sha256-a2ofwS5r2Qq+WxzVa7sLbRXhfT3JoYxSlUVQH/nL454=" + }, + "remote_patch_strip": 1 + } + } + }, + "rules_proto@5.3.0-21.7": { + "name": "rules_proto", + "version": "5.3.0-21.7", + "key": "rules_proto@5.3.0-21.7", + "repoName": "rules_proto", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "com_google_protobuf": "protobuf@21.7", + "rules_cc": "rules_cc@0.0.9", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz" + ], + "integrity": "sha256-3D+yBqLLNEG0heseQjFlsjEjWh6psDG0Qzz3vB+kYN0=", + "strip_prefix": "rules_proto-5.3.0-21.7", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "apple_support@1.13.0": { + "name": "apple_support", + "version": "1.13.0", + "key": "apple_support@1.13.0", + "repoName": "build_bazel_apple_support", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "@local_config_apple_cc_toolchains//:all" + ], + "extensionUsages": [ + { + "extensionBzlFile": "@build_bazel_apple_support//crosstool:setup.bzl", + "extensionName": "apple_cc_configure_extension", + "usingModule": "apple_support@1.13.0", + "location": { + "file": "https://bcr.bazel.build/modules/apple_support/1.13.0/MODULE.bazel", + "line": 19, + "column": 35 + }, + "imports": { + "local_config_apple_cc": "local_config_apple_cc", + "local_config_apple_cc_toolchains": "local_config_apple_cc_toolchains" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/apple_support/releases/download/1.13.0/apple_support.1.13.0.tar.gz" + ], + "integrity": "sha256-HEAx5ytFagSNgXf1mlWBgIwHWF+p4lXG9f77h1KvfkA=", + "strip_prefix": "", + "remote_patches": { + "https://bcr.bazel.build/modules/apple_support/1.13.0/patches/module_dot_bazel_version.patch": "sha256-OqLgfAMNy6ZUF/WaVkNXzB/KcCYLlHLspYNk67mcASA=" + }, + "remote_patch_strip": 1 + } + } + }, + "rules_python@0.25.0": { + "name": "rules_python", + "version": "0.25.0", + "key": "rules_python@0.25.0", + "repoName": "rules_python", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "@pythons_hub//:all" + ], + "extensionUsages": [ + { + "extensionBzlFile": "@rules_python//python/extensions/private:internal_deps.bzl", + "extensionName": "internal_deps", + "usingModule": "rules_python@0.25.0", + "location": { + "file": "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel", + "line": 14, + "column": 30 + }, + "imports": { + "pypi__build": "pypi__build", + "pypi__click": "pypi__click", + "pypi__colorama": "pypi__colorama", + "pypi__importlib_metadata": "pypi__importlib_metadata", + "pypi__installer": "pypi__installer", + "pypi__more_itertools": "pypi__more_itertools", + "pypi__packaging": "pypi__packaging", + "pypi__pep517": "pypi__pep517", + "pypi__pip": "pypi__pip", + "pypi__pip_tools": "pypi__pip_tools", + "pypi__setuptools": "pypi__setuptools", + "pypi__tomli": "pypi__tomli", + "pypi__wheel": "pypi__wheel", + "pypi__zipp": "pypi__zipp" + }, + "devImports": [], + "tags": [ + { + "tagName": "install", + "attributeValues": {}, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel", + "line": 15, + "column": 22 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_python//python/extensions:python.bzl", + "extensionName": "python", + "usingModule": "rules_python@0.25.0", + "location": { + "file": "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel", + "line": 38, + "column": 23 + }, + "imports": { + "pythons_hub": "pythons_hub" + }, + "devImports": [], + "tags": [ + { + "tagName": "toolchain", + "attributeValues": { + "is_default": true, + "python_version": "3.11" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel", + "line": 44, + "column": 17 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "platforms": "platforms@0.0.8", + "bazel_skylib": "bazel_skylib@1.5.0", + "rules_proto": "rules_proto@5.3.0-21.7", + "com_google_protobuf": "protobuf@21.7", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz" + ], + "integrity": "sha256-WGjnMQeo6F2PMjgG5gytcoPzSzIWPqb/ECDPJ6vvYDY=", + "strip_prefix": "rules_python-0.25.0", + "remote_patches": { + "https://bcr.bazel.build/modules/rules_python/0.25.0/patches/module_dot_bazel_version.patch": "sha256-6c8MrjTxYoqUpI8Y1QlmPps5p+N2RaZ5V+iXOrSHkwI=" + }, + "remote_patch_strip": 0 + } + } + }, + "rules_java@7.4.0": { + "name": "rules_java", + "version": "7.4.0", + "key": "rules_java@7.4.0", + "repoName": "rules_java", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [ + "//toolchains:all", + "@local_jdk//:runtime_toolchain_definition", + "@local_jdk//:bootstrap_runtime_toolchain_definition", + "@remotejdk11_linux_toolchain_config_repo//:all", + "@remotejdk11_linux_aarch64_toolchain_config_repo//:all", + "@remotejdk11_linux_ppc64le_toolchain_config_repo//:all", + "@remotejdk11_linux_s390x_toolchain_config_repo//:all", + "@remotejdk11_macos_toolchain_config_repo//:all", + "@remotejdk11_macos_aarch64_toolchain_config_repo//:all", + "@remotejdk11_win_toolchain_config_repo//:all", + "@remotejdk11_win_arm64_toolchain_config_repo//:all", + "@remotejdk17_linux_toolchain_config_repo//:all", + "@remotejdk17_linux_aarch64_toolchain_config_repo//:all", + "@remotejdk17_linux_ppc64le_toolchain_config_repo//:all", + "@remotejdk17_linux_s390x_toolchain_config_repo//:all", + "@remotejdk17_macos_toolchain_config_repo//:all", + "@remotejdk17_macos_aarch64_toolchain_config_repo//:all", + "@remotejdk17_win_toolchain_config_repo//:all", + "@remotejdk17_win_arm64_toolchain_config_repo//:all", + "@remotejdk21_linux_toolchain_config_repo//:all", + "@remotejdk21_linux_aarch64_toolchain_config_repo//:all", + "@remotejdk21_macos_toolchain_config_repo//:all", + "@remotejdk21_macos_aarch64_toolchain_config_repo//:all", + "@remotejdk21_win_toolchain_config_repo//:all" + ], + "extensionUsages": [ + { + "extensionBzlFile": "@rules_java//java:extensions.bzl", + "extensionName": "toolchains", + "usingModule": "rules_java@7.4.0", + "location": { + "file": "https://bcr.bazel.build/modules/rules_java/7.4.0/MODULE.bazel", + "line": 19, + "column": 27 + }, + "imports": { + "remote_java_tools": "remote_java_tools", + "remote_java_tools_linux": "remote_java_tools_linux", + "remote_java_tools_windows": "remote_java_tools_windows", + "remote_java_tools_darwin_x86_64": "remote_java_tools_darwin_x86_64", + "remote_java_tools_darwin_arm64": "remote_java_tools_darwin_arm64", + "local_jdk": "local_jdk", + "remotejdk11_linux_toolchain_config_repo": "remotejdk11_linux_toolchain_config_repo", + "remotejdk11_linux_aarch64_toolchain_config_repo": "remotejdk11_linux_aarch64_toolchain_config_repo", + "remotejdk11_linux_ppc64le_toolchain_config_repo": "remotejdk11_linux_ppc64le_toolchain_config_repo", + "remotejdk11_linux_s390x_toolchain_config_repo": "remotejdk11_linux_s390x_toolchain_config_repo", + "remotejdk11_macos_toolchain_config_repo": "remotejdk11_macos_toolchain_config_repo", + "remotejdk11_macos_aarch64_toolchain_config_repo": "remotejdk11_macos_aarch64_toolchain_config_repo", + "remotejdk11_win_toolchain_config_repo": "remotejdk11_win_toolchain_config_repo", + "remotejdk11_win_arm64_toolchain_config_repo": "remotejdk11_win_arm64_toolchain_config_repo", + "remotejdk17_linux_toolchain_config_repo": "remotejdk17_linux_toolchain_config_repo", + "remotejdk17_linux_aarch64_toolchain_config_repo": "remotejdk17_linux_aarch64_toolchain_config_repo", + "remotejdk17_linux_ppc64le_toolchain_config_repo": "remotejdk17_linux_ppc64le_toolchain_config_repo", + "remotejdk17_linux_s390x_toolchain_config_repo": "remotejdk17_linux_s390x_toolchain_config_repo", + "remotejdk17_macos_toolchain_config_repo": "remotejdk17_macos_toolchain_config_repo", + "remotejdk17_macos_aarch64_toolchain_config_repo": "remotejdk17_macos_aarch64_toolchain_config_repo", + "remotejdk17_win_toolchain_config_repo": "remotejdk17_win_toolchain_config_repo", + "remotejdk17_win_arm64_toolchain_config_repo": "remotejdk17_win_arm64_toolchain_config_repo", + "remotejdk21_linux_toolchain_config_repo": "remotejdk21_linux_toolchain_config_repo", + "remotejdk21_linux_aarch64_toolchain_config_repo": "remotejdk21_linux_aarch64_toolchain_config_repo", + "remotejdk21_macos_toolchain_config_repo": "remotejdk21_macos_toolchain_config_repo", + "remotejdk21_macos_aarch64_toolchain_config_repo": "remotejdk21_macos_aarch64_toolchain_config_repo", + "remotejdk21_win_toolchain_config_repo": "remotejdk21_win_toolchain_config_repo" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "bazel_skylib": "bazel_skylib@1.5.0", + "rules_proto": "rules_proto@5.3.0-21.7", + "rules_license": "rules_license@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_java/releases/download/7.4.0/rules_java-7.4.0.tar.gz" + ], + "integrity": "sha256-l27wi0nJKXQfIBeQ5Z44B8cq2B9CjIvJU82+/1/tFes=", + "strip_prefix": "", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "rules_pkg@0.7.0": { + "name": "rules_pkg", + "version": "0.7.0", + "key": "rules_pkg@0.7.0", + "repoName": "rules_pkg", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "rules_python": "rules_python@0.25.0", + "bazel_skylib": "bazel_skylib@1.5.0", + "rules_license": "rules_license@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz" + ], + "integrity": "sha256-iimOgydi7aGDBZfWT+fbWBeKqEzVkm121bdE1lWJQcI=", + "strip_prefix": "", + "remote_patches": { + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/patches/module_dot_bazel.patch": "sha256-4OaEPZwYF6iC71ZTDg6MJ7LLqX7ZA0/kK4mT+4xKqiE=" + }, + "remote_patch_strip": 0 + } + } + }, + "zlib@1.3": { + "name": "zlib", + "version": "1.3", + "key": "zlib@1.3", + "repoName": "zlib", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz" + ], + "integrity": "sha256-/wukwpIBPbwnUws6geH5qBPNOd4Byl4Pi/NVcC76WT4=", + "strip_prefix": "zlib-1.3", + "remote_patches": { + "https://bcr.bazel.build/modules/zlib/1.3/patches/add_build_file.patch": "sha256-Ei+FYaaOo7A3jTKunMEodTI0Uw5NXQyZEcboMC8JskY=", + "https://bcr.bazel.build/modules/zlib/1.3/patches/module_dot_bazel.patch": "sha256-fPWLM+2xaF/kuy+kZc1YTfW6hNjrkG400Ho7gckuyJk=" + }, + "remote_patch_strip": 0 + } + } + }, + "upb@0.0.0-20220923-a547704": { + "name": "upb", + "version": "0.0.0-20220923-a547704", + "key": "upb@0.0.0-20220923-a547704", + "repoName": "upb", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "rules_proto": "rules_proto@5.3.0-21.7", + "com_google_protobuf": "protobuf@21.7", + "com_google_absl": "abseil-cpp@20240116.1", + "platforms": "platforms@0.0.8", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/protocolbuffers/upb/archive/a5477045acaa34586420942098f5fecd3570f577.tar.gz" + ], + "integrity": "sha256-z39x6v+QskwaKLSWRan/A6mmwecTQpHOcJActj5zZLU=", + "strip_prefix": "upb-a5477045acaa34586420942098f5fecd3570f577", + "remote_patches": { + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/patches/module_dot_bazel.patch": "sha256-wH4mNS6ZYy+8uC0HoAft/c7SDsq2Kxf+J8dUakXhaB0=" + }, + "remote_patch_strip": 0 + } + } + }, + "rules_jvm_external@4.4.2": { + "name": "rules_jvm_external", + "version": "4.4.2", + "key": "rules_jvm_external@4.4.2", + "repoName": "rules_jvm_external", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@rules_jvm_external//:non-module-deps.bzl", + "extensionName": "non_module_deps", + "usingModule": "rules_jvm_external@4.4.2", + "location": { + "file": "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel", + "line": 9, + "column": 32 + }, + "imports": { + "io_bazel_rules_kotlin": "io_bazel_rules_kotlin" + }, + "devImports": [], + "tags": [], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + }, + { + "extensionBzlFile": "@rules_jvm_external//:extensions.bzl", + "extensionName": "maven", + "usingModule": "rules_jvm_external@4.4.2", + "location": { + "file": "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel", + "line": 16, + "column": 22 + }, + "imports": { + "rules_jvm_external_deps": "rules_jvm_external_deps" + }, + "devImports": [], + "tags": [ + { + "tagName": "install", + "attributeValues": { + "name": "rules_jvm_external_deps", + "artifacts": [ + "com.google.cloud:google-cloud-core:1.93.10", + "com.google.cloud:google-cloud-storage:1.113.4", + "com.google.code.gson:gson:2.9.0", + "org.apache.maven:maven-artifact:3.8.6", + "software.amazon.awssdk:s3:2.17.183" + ], + "lock_file": "@rules_jvm_external//:rules_jvm_external_deps_install.json" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel", + "line": 18, + "column": 14 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "io_bazel_stardoc": "stardoc@0.5.1", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/4.4.2.zip" + ], + "integrity": "sha256-c1YC9QgT6y6pPKP15DsZWb2AshO4NqB6YqKddXZwt3s=", + "strip_prefix": "rules_jvm_external-4.4.2", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + }, + "re2@2023-09-01": { + "name": "re2", + "version": "2023-09-01", + "key": "re2@2023-09-01", + "repoName": "re2", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@pybind11_bazel//:python_configure.bzl", + "extensionName": "extension", + "usingModule": "re2@2023-09-01", + "location": { + "file": "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel", + "line": 22, + "column": 33 + }, + "imports": { + "local_config_python": "local_config_python", + "pybind11": "pybind11" + }, + "devImports": [], + "tags": [ + { + "tagName": "toolchain", + "attributeValues": { + "python_version": "3" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel", + "line": 23, + "column": 27 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "com_google_absl": "abseil-cpp@20240116.1", + "rules_python": "rules_python@0.25.0", + "pybind11_bazel": "pybind11_bazel@2.11.1", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/google/re2/releases/download/2023-09-01/re2-2023-09-01.zip" + ], + "integrity": "sha256-IkuDUdxGM7EBLb2EdWTgYKRr5goioUY9S1uZP9S/Wcw=", + "strip_prefix": "re2-2023-09-01", + "remote_patches": { + "https://bcr.bazel.build/modules/re2/2023-09-01/patches/module_dot_bazel.patch": "sha256-MUQkRNgPJ0lbYqOXoBu2m2vLH7IuKEbK/VWTw7WWrnA=" + }, + "remote_patch_strip": 0 + } + } + }, + "buildozer@6.4.0.2": { + "name": "buildozer", + "version": "6.4.0.2", + "key": "buildozer@6.4.0.2", + "repoName": "buildozer", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [ + { + "extensionBzlFile": "@buildozer//:buildozer_binary.bzl", + "extensionName": "buildozer_binary", + "usingModule": "buildozer@6.4.0.2", + "location": { + "file": "https://bcr.bazel.build/modules/buildozer/6.4.0.2/MODULE.bazel", + "line": 7, + "column": 33 + }, + "imports": { + "buildozer_binary": "buildozer_binary" + }, + "devImports": [], + "tags": [ + { + "tagName": "buildozer", + "attributeValues": { + "sha256": { + "darwin-amd64": "d29e347ecd6b5673d72cb1a8de05bf1b06178dd229ff5eb67fad5100c840cc8e", + "darwin-arm64": "9b9e71bdbec5e7223871e913b65d12f6d8fa026684daf991f00e52ed36a6978d", + "linux-amd64": "8dfd6345da4e9042daa738d7fdf34f699c5dfce4632f7207956fceedd8494119", + "linux-arm64": "6559558fded658c8fa7432a9d011f7c4dcbac6b738feae73d2d5c352e5f605fa", + "windows-amd64": "e7f05bf847f7c3689dd28926460ce6e1097ae97380ac8e6ae7147b7b706ba19b" + }, + "version": "6.4.0" + }, + "devDependency": false, + "location": { + "file": "https://bcr.bazel.build/modules/buildozer/6.4.0.2/MODULE.bazel", + "line": 8, + "column": 27 + } + } + ], + "hasDevUseExtension": false, + "hasNonDevUseExtension": true + } + ], + "deps": { + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/fmeum/buildozer/releases/download/v6.4.0.2/buildozer-v6.4.0.2.tar.gz" + ], + "integrity": "sha256-k7tFKQMR2AygxpmZfH0yEPnQmF3efFgD9rBPkj+Yz/8=", + "strip_prefix": "buildozer-6.4.0.2", + "remote_patches": { + "https://bcr.bazel.build/modules/buildozer/6.4.0.2/patches/module_dot_bazel_version.patch": "sha256-gKANF2HMilj7bWmuXs4lbBIAAansuWC4IhWGB/CerjU=" + }, + "remote_patch_strip": 1 + } + } + }, + "stardoc@0.5.1": { + "name": "stardoc", + "version": "0.5.1", + "key": "stardoc@0.5.1", + "repoName": "stardoc", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "bazel_skylib": "bazel_skylib@1.5.0", + "rules_java": "rules_java@7.4.0", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/stardoc/releases/download/0.5.1/stardoc-0.5.1.tar.gz" + ], + "integrity": "sha256-qoFNrgrEALurLoiB+ZFcb0fElmS/CHxAmhX5BDjSwj4=", + "strip_prefix": "", + "remote_patches": { + "https://bcr.bazel.build/modules/stardoc/0.5.1/patches/module_dot_bazel.patch": "sha256-UAULCuTpJE7SG0YrR9XLjMfxMRmbP+za3uW9ONZ5rjI=" + }, + "remote_patch_strip": 0 + } + } + }, + "pybind11_bazel@2.11.1": { + "name": "pybind11_bazel", + "version": "2.11.1", + "key": "pybind11_bazel@2.11.1", + "repoName": "pybind11_bazel", + "executionPlatformsToRegister": [], + "toolchainsToRegister": [], + "extensionUsages": [], + "deps": { + "platforms": "platforms@0.0.8", + "rules_cc": "rules_cc@0.0.9", + "bazel_tools": "bazel_tools@_", + "local_config_platform": "local_config_platform@_" + }, + "repoSpec": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/pybind/pybind11_bazel/releases/download/v2.11.1/pybind11_bazel-2.11.1.zip" + ], + "integrity": "sha256-LEZsmzzKeFK0fgeFADEomE/PDV1hoaLkxazu/ZNawiA=", + "strip_prefix": "pybind11_bazel-2.11.1", + "remote_patches": {}, + "remote_patch_strip": 0 + } + } + } + }, + "moduleExtensions": { + "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { + "general": { + "bzlTransitiveDigest": "TMkUP4/N3ZORvZrcDg9FxSoW9r/7+uDVH/SI2biRyJg=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_config_apple_cc": { + "bzlFile": "@@apple_support~//crosstool:setup.bzl", + "ruleClassName": "_apple_cc_autoconf", + "attributes": {} + }, + "local_config_apple_cc_toolchains": { + "bzlFile": "@@apple_support~//crosstool:setup.bzl", + "ruleClassName": "_apple_cc_autoconf_toolchains", + "attributes": {} + } + }, + "recordedRepoMappingEntries": [ + [ + "apple_support~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@bazel_features~//private:extensions.bzl%version_extension": { + "general": { + "bzlTransitiveDigest": "3FcE0iMy2yYKEbEO19f72k9dzcpRUXHH+igow5yVy8g=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "bazel_features_version": { + "bzlFile": "@@bazel_features~//private:version_repo.bzl", + "ruleClassName": "version_repo", + "attributes": {} + }, + "bazel_features_globals": { + "bzlFile": "@@bazel_features~//private:globals_repo.bzl", + "ruleClassName": "globals_repo", + "attributes": { + "globals": { + "RunEnvironmentInfo": "5.3.0", + "DefaultInfo": "0.0.1", + "__TestingOnly_NeverAvailable": "1000000000.0.0" + } + } + } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_features~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { + "general": { + "bzlTransitiveDigest": "PHpT2yqMGms2U4L3E/aZ+WcQalmZWm+ILdP3yiLsDhA=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_config_cc": { + "bzlFile": "@@bazel_tools//tools/cpp:cc_configure.bzl", + "ruleClassName": "cc_autoconf", + "attributes": {} + }, + "local_config_cc_toolchains": { + "bzlFile": "@@bazel_tools//tools/cpp:cc_configure.bzl", + "ruleClassName": "cc_autoconf_toolchains", + "attributes": {} + } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_tools", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { + "general": { + "bzlTransitiveDigest": "Qh2bWTU6QW6wkrd87qrU4YeY+SG37Nvw3A0PR4Y0L2Y=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_config_xcode": { + "bzlFile": "@@bazel_tools//tools/osx:xcode_configure.bzl", + "ruleClassName": "xcode_autoconf", + "attributes": { + "xcode_locator": "@bazel_tools//tools/osx:xcode_locator.m", + "remote_xcode": "" + } + } + }, + "recordedRepoMappingEntries": [] + } + }, + "@@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { + "general": { + "bzlTransitiveDigest": "hp4NgmNjEg5+xgvzfh6L83bt9/aiiWETuNpwNuF1MSU=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_config_sh": { + "bzlFile": "@@bazel_tools//tools/sh:sh_configure.bzl", + "ruleClassName": "sh_config", + "attributes": {} + } + }, + "recordedRepoMappingEntries": [] + } + }, + "@@rules_java~//java:extensions.bzl%toolchains": { + "general": { + "bzlTransitiveDigest": "tJHbmWnq7m+9eUBnUdv7jZziQ26FmcGL9C5/hU3Q9UQ=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "remotejdk21_linux_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux//:jdk\",\n)\n" + } + }, + "remotejdk17_linux_s390x_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_s390x//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_s390x//:jdk\",\n)\n" + } + }, + "remotejdk17_macos_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos//:jdk\",\n)\n" + } + }, + "remotejdk21_macos_aarch64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos_aarch64//:jdk\",\n)\n" + } + }, + "remotejdk17_linux_aarch64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_aarch64//:jdk\",\n)\n" + } + }, + "remotejdk21_macos_aarch64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", + "sha256": "e8260516de8b60661422a725f1df2c36ef888f6fb35393566b00e7325db3d04e", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-macosx_aarch64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz" + ] + } + }, + "remotejdk17_linux_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux//:jdk\",\n)\n" + } + }, + "remotejdk17_macos_aarch64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "314b04568ec0ae9b36ba03c9cbd42adc9e1265f74678923b19297d66eb84dcca", + "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64.tar.gz" + ] + } + }, + "remote_java_tools_windows": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fe2f88169696d6c6fc6e90ba61bb46be7d0ae3693cbafdf336041bf56679e8d1", + "urls": [ + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_windows-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_windows-v13.4.zip" + ] + } + }, + "remotejdk11_win": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "43408193ce2fa0862819495b5ae8541085b95660153f2adcf91a52d3a1710e83", + "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-win_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-win_x64.zip", + "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-win_x64.zip" + ] + } + }, + "remotejdk11_win_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win//:jdk\",\n)\n" + } + }, + "remotejdk11_linux_aarch64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "54174439f2b3fddd11f1048c397fe7bb45d4c9d66d452d6889b013d04d21c4de", + "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-linux_aarch64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_aarch64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_aarch64.tar.gz" + ] + } + }, + "remotejdk17_linux": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "b9482f2304a1a68a614dfacddcf29569a72f0fac32e6c74f83dc1b9a157b8340", + "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-linux_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_x64.tar.gz" + ] + } + }, + "remotejdk11_linux_s390x_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_s390x//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:s390x\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_s390x//:jdk\",\n)\n" + } + }, + "remotejdk11_linux_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux//:jdk\",\n)\n" + } + }, + "remotejdk11_macos": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "bcaab11cfe586fae7583c6d9d311c64384354fb2638eb9a012eca4c3f1a1d9fd", + "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-macosx_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_x64.tar.gz" + ] + } + }, + "remotejdk11_win_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "b8a28e6e767d90acf793ea6f5bed0bb595ba0ba5ebdf8b99f395266161e53ec2", + "strip_prefix": "jdk-11.0.13+8", + "urls": [ + "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-aarch64.zip" + ] + } + }, + "remotejdk17_macos": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "640453e8afe8ffe0fb4dceb4535fb50db9c283c64665eebb0ba68b19e65f4b1f", + "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-macosx_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_x64.tar.gz" + ] + } + }, + "remotejdk21_macos": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", + "sha256": "3ad8fe288eb57d975c2786ae453a036aa46e47ab2ac3d81538ebae2a54d3c025", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-macosx_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz" + ] + } + }, + "remotejdk21_macos_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_macos//:jdk\",\n)\n" + } + }, + "remotejdk17_macos_aarch64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_macos_aarch64//:jdk\",\n)\n" + } + }, + "remotejdk17_win": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "192f2afca57701de6ec496234f7e45d971bf623ff66b8ee4a5c81582054e5637", + "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-win_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_x64.zip", + "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_x64.zip" + ] + } + }, + "remotejdk11_macos_aarch64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos_aarch64//:jdk\",\n)\n" + } + }, + "remotejdk11_linux_ppc64le_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_ppc64le//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_ppc64le//:jdk\",\n)\n" + } + }, + "remotejdk21_linux": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", + "sha256": "5ad730fbee6bb49bfff10bf39e84392e728d89103d3474a7e5def0fd134b300a", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-linux_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz" + ] + } + }, + "remote_java_tools_linux": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ba10f09a138cf185d04cbc807d67a3da42ab13d618c5d1ce20d776e199c33a39", + "urls": [ + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_linux-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_linux-v13.4.zip" + ] + } + }, + "remotejdk21_win": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", + "sha256": "f7cc15ca17295e69c907402dfe8db240db446e75d3b150da7bf67243cded93de", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-win_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip", + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip" + ] + } + }, + "remotejdk21_linux_aarch64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 21,\n)\n", + "sha256": "ce7df1af5d44a9f455617c4b8891443fbe3e4b269c777d8b82ed66f77167cfe0", + "strip_prefix": "zulu21.32.17-ca-jdk21.0.2-linux_aarch64", + "urls": [ + "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz" + ] + } + }, + "remotejdk11_linux_aarch64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_linux_aarch64//:jdk\",\n)\n" + } + }, + "remotejdk11_linux_s390x": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "a58fc0361966af0a5d5a31a2d8a208e3c9bb0f54f345596fd80b99ea9a39788b", + "strip_prefix": "jdk-11.0.15+10", + "urls": [ + "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", + "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz" + ] + } + }, + "remotejdk17_linux_aarch64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "6531cef61e416d5a7b691555c8cf2bdff689201b8a001ff45ab6740062b44313", + "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64.tar.gz" + ] + } + }, + "remotejdk17_win_arm64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win_arm64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win_arm64//:jdk\",\n)\n" + } + }, + "remotejdk11_linux": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "a34b404f87a08a61148b38e1416d837189e1df7a040d949e743633daf4695a3c", + "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-linux_x64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_x64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_x64.tar.gz" + ] + } + }, + "remotejdk11_macos_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:macos\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_macos//:jdk\",\n)\n" + } + }, + "remotejdk17_linux_ppc64le_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_ppc64le//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:ppc\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_linux_ppc64le//:jdk\",\n)\n" + } + }, + "remotejdk17_win_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "6802c99eae0d788e21f52d03cab2e2b3bf42bc334ca03cbf19f71eb70ee19f85", + "strip_prefix": "zulu17.44.53-ca-jdk17.0.8.1-win_aarch64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_aarch64.zip", + "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_aarch64.zip" + ] + } + }, + "remote_java_tools_darwin_arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "076a7e198ad077f8c7d997986ef5102427fae6bbfce7a7852d2e080ed8767528", + "urls": [ + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_darwin_arm64-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_darwin_arm64-v13.4.zip" + ] + } + }, + "remotejdk17_linux_ppc64le": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "00a4c07603d0218cd678461b5b3b7e25b3253102da4022d31fc35907f21a2efd", + "strip_prefix": "jdk-17.0.8.1+1", + "urls": [ + "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz", + "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz" + ] + } + }, + "remotejdk21_linux_aarch64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux_aarch64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:linux\", \"@platforms//cpu:aarch64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_linux_aarch64//:jdk\",\n)\n" + } + }, + "remotejdk11_win_arm64_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_11\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"11\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win_arm64//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:arm64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk11_win_arm64//:jdk\",\n)\n" + } + }, + "local_jdk": { + "bzlFile": "@@rules_java~//toolchains:local_java_repository.bzl", + "ruleClassName": "_local_java_repository_rule", + "attributes": { + "java_home": "", + "version": "", + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = {RUNTIME_VERSION},\n)\n" + } + }, + "remote_java_tools_darwin_x86_64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4523aec4d09c587091a2dae6f5c9bc6922c220f3b6030e5aba9c8f015913cc65", + "urls": [ + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools_darwin_x86_64-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools_darwin_x86_64-v13.4.zip" + ] + } + }, + "remote_java_tools": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e025fd260ac39b47c111f5212d64ec0d00d85dec16e49368aae82fc626a940cf", + "urls": [ + "https://mirror.bazel.build/bazel_java_tools/releases/java/v13.4/java_tools-v13.4.zip", + "https://github.com/bazelbuild/java_tools/releases/download/java_v13.4/java_tools-v13.4.zip" + ] + } + }, + "remotejdk17_linux_s390x": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 17,\n)\n", + "sha256": "ffacba69c6843d7ca70d572489d6cc7ab7ae52c60f0852cedf4cf0d248b6fc37", + "strip_prefix": "jdk-17.0.8.1+1", + "urls": [ + "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz", + "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz" + ] + } + }, + "remotejdk17_win_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_17\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"17\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk17_win//:jdk\",\n)\n" + } + }, + "remotejdk11_linux_ppc64le": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "a8fba686f6eb8ae1d1a9566821dbd5a85a1108b96ad857fdbac5c1e4649fc56f", + "strip_prefix": "jdk-11.0.15+10", + "urls": [ + "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", + "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz" + ] + } + }, + "remotejdk11_macos_aarch64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_java//java:defs.bzl\", \"java_runtime\")\n\npackage(default_visibility = [\"//visibility:public\"])\n\nexports_files([\"WORKSPACE\", \"BUILD.bazel\"])\n\nfilegroup(\n name = \"jre\",\n srcs = glob(\n [\n \"jre/bin/**\",\n \"jre/lib/**\",\n ],\n allow_empty = True,\n # In some configurations, Java browser plugin is considered harmful and\n # common antivirus software blocks access to npjp2.dll interfering with Bazel,\n # so do not include it in JRE on Windows.\n exclude = [\"jre/bin/plugin2/**\"],\n ),\n)\n\nfilegroup(\n name = \"jdk-bin\",\n srcs = glob(\n [\"bin/**\"],\n # The JDK on Windows sometimes contains a directory called\n # \"%systemroot%\", which is not a valid label.\n exclude = [\"**/*%*/**\"],\n ),\n)\n\n# This folder holds security policies.\nfilegroup(\n name = \"jdk-conf\",\n srcs = glob(\n [\"conf/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-include\",\n srcs = glob(\n [\"include/**\"],\n allow_empty = True,\n ),\n)\n\nfilegroup(\n name = \"jdk-lib\",\n srcs = glob(\n [\"lib/**\", \"release\"],\n allow_empty = True,\n exclude = [\n \"lib/missioncontrol/**\",\n \"lib/visualvm/**\",\n ],\n ),\n)\n\njava_runtime(\n name = \"jdk\",\n srcs = [\n \":jdk-bin\",\n \":jdk-conf\",\n \":jdk-include\",\n \":jdk-lib\",\n \":jre\",\n ],\n # Provide the 'java` binary explicitly so that the correct path is used by\n # Bazel even when the host platform differs from the execution platform.\n # Exactly one of the two globs will be empty depending on the host platform.\n # When --incompatible_disallow_empty_glob is enabled, each individual empty\n # glob will fail without allow_empty = True, even if the overall result is\n # non-empty.\n java = glob([\"bin/java.exe\", \"bin/java\"], allow_empty = True)[0],\n version = 11,\n)\n", + "sha256": "7632bc29f8a4b7d492b93f3bc75a7b61630894db85d136456035ab2a24d38885", + "strip_prefix": "zulu11.66.15-ca-jdk11.0.20-macosx_aarch64", + "urls": [ + "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_aarch64.tar.gz", + "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_aarch64.tar.gz" + ] + } + }, + "remotejdk21_win_toolchain_config_repo": { + "bzlFile": "@@rules_java~//toolchains:remote_java_repository.bzl", + "ruleClassName": "_toolchain_config", + "attributes": { + "build_file": "\nconfig_setting(\n name = \"prefix_version_setting\",\n values = {\"java_runtime_version\": \"remotejdk_21\"},\n visibility = [\"//visibility:private\"],\n)\nconfig_setting(\n name = \"version_setting\",\n values = {\"java_runtime_version\": \"21\"},\n visibility = [\"//visibility:private\"],\n)\nalias(\n name = \"version_or_prefix_version_setting\",\n actual = select({\n \":version_setting\": \":version_setting\",\n \"//conditions:default\": \":prefix_version_setting\",\n }),\n visibility = [\"//visibility:private\"],\n)\ntoolchain(\n name = \"toolchain\",\n target_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\ntoolchain(\n name = \"bootstrap_runtime_toolchain\",\n # These constraints are not required for correctness, but prevent fetches of remote JDK for\n # different architectures. As every Java compilation toolchain depends on a bootstrap runtime in\n # the same configuration, this constraint will not result in toolchain resolution failures.\n exec_compatible_with = [\"@platforms//os:windows\", \"@platforms//cpu:x86_64\"],\n target_settings = [\":version_or_prefix_version_setting\"],\n toolchain_type = \"@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type\",\n toolchain = \"@remotejdk21_win//:jdk\",\n)\n" + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_java~", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_java~", + "remote_java_tools", + "rules_java~~toolchains~remote_java_tools" + ] + ] + } + }, + "@@rules_python~//python/extensions:python.bzl%python": { + "general": { + "bzlTransitiveDigest": "o0WIKfdQRSZd/9+sY+LDTrUuYozMBFuYsL85uwJYKk8=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "python_3_11_s390x-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "e477f0749161f9aa7887964f089d9460a539f6b4a8fdab5166f898210e1a87a4", + "patches": [], + "platform": "s390x-unknown-linux-gnu", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-s390x-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-s390x-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "toolchain_aliases", + "attributes": { + "python_version": "3.11.4", + "user_repository_name": "python_3_11" + } + }, + "python_3_11_aarch64-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "2e84fc53f4e90e11963281c5c871f593abcb24fc796a50337fa516be99af02fb", + "patches": [], + "platform": "aarch64-unknown-linux-gnu", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-aarch64-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-aarch64-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_aarch64-apple-darwin": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "cb6d2948384a857321f2aa40fa67744cd9676a330f08b6dad7070bda0b6120a4", + "patches": [], + "platform": "aarch64-apple-darwin", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-aarch64-apple-darwin-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-aarch64-apple-darwin-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_ppc64le-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "df7b92ed9cec96b3bb658fb586be947722ecd8e420fb23cee13d2e90abcfcf25", + "patches": [], + "platform": "ppc64le-unknown-linux-gnu", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-ppc64le-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-ppc64le-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_x86_64-apple-darwin": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "47e1557d93a42585972772e82661047ca5f608293158acb2778dccf120eabb00", + "patches": [], + "platform": "x86_64-apple-darwin", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-x86_64-apple-darwin-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-x86_64-apple-darwin-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "pythons_hub": { + "bzlFile": "@@rules_python~//python/extensions/private:pythons_hub.bzl", + "ruleClassName": "hub_repo", + "attributes": { + "default_python_version": "3.11", + "toolchain_prefixes": [ + "_0000_python_3_11_" + ], + "toolchain_python_versions": [ + "3.11" + ], + "toolchain_set_python_version_constraints": [ + "False" + ], + "toolchain_user_repository_names": [ + "python_3_11" + ] + } + }, + "python_versions": { + "bzlFile": "@@rules_python~//python/private:toolchains_repo.bzl", + "ruleClassName": "multi_toolchain_aliases", + "attributes": { + "python_versions": { + "3.11": "python_3_11" + } + } + }, + "python_3_11_x86_64-pc-windows-msvc": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "878614c03ea38538ae2f758e36c85d2c0eb1eaaca86cd400ff8c76693ee0b3e1", + "patches": [], + "platform": "x86_64-pc-windows-msvc", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-x86_64-pc-windows-msvc-shared-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-x86_64-pc-windows-msvc-shared-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + }, + "python_3_11_x86_64-unknown-linux-gnu": { + "bzlFile": "@@rules_python~//python:repositories.bzl", + "ruleClassName": "python_repository", + "attributes": { + "sha256": "e26247302bc8e9083a43ce9e8dd94905b40d464745b1603041f7bc9a93c65d05", + "patches": [], + "platform": "x86_64-unknown-linux-gnu", + "python_version": "3.11.4", + "release_filename": "20230726/cpython-3.11.4+20230726-x86_64-unknown-linux-gnu-install_only.tar.gz", + "urls": [ + "https://github.com/indygreg/python-build-standalone/releases/download/20230726/cpython-3.11.4+20230726-x86_64-unknown-linux-gnu-install_only.tar.gz" + ], + "distutils_content": "", + "strip_prefix": "python", + "coverage_tool": "", + "ignore_root_user_error": false + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~", + "bazel_tools", + "bazel_tools" + ] + ] + } + }, + "@@rules_rust~//rust:extensions.bzl%rust": { + "general": { + "bzlTransitiveDigest": "SK5LDBC3NXoGJpZ7+I1UKZnqpkmBucyJltLo0L9X66w=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "rust_windows_x86_64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-pc-windows-msvc", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_darwin_aarch64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-apple-darwin", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_darwin_x86_64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-apple-darwin", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-unknown-freebsd", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_freebsd_x86_64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_freebsd_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-unknown-linux-gnu", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "aarch64-unknown-linux-gnu", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_linux_aarch64__aarch64-unknown-linux-gnu__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "target_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ] + } + }, + "rust_windows_x86_64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_windows_x86_64__x86_64-pc-windows-msvc__stable//:toolchain", + "@rust_windows_x86_64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_windows_x86_64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rust_linux_aarch64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_linux_aarch64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rust_windows_aarch64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-pc-windows-msvc", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "target_compatible_with": [] + } + }, + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__aarch64-apple-darwin_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "target_compatible_with": [] + } + }, + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-unknown-linux-gnu", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "x86_64-unknown-linux-gnu", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-pc-windows-msvc", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "aarch64-pc-windows-msvc", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_windows_aarch64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_windows_aarch64__aarch64-pc-windows-msvc__stable//:toolchain", + "@rust_windows_aarch64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_windows_aarch64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rust_linux_x86_64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_linux_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-pc-windows-msvc", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "x86_64-pc-windows-msvc", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "x86_64-unknown-freebsd" + } + }, + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-unknown-freebsd", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "x86_64-unknown-freebsd", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_darwin_x86_64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_darwin_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rust_darwin_aarch64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_darwin_aarch64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rust_darwin_aarch64__aarch64-apple-darwin__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_darwin_aarch64__aarch64-apple-darwin__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "target_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ] + } + }, + "rust_analyzer_1.77.1_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_analyzer_toolchain_tools_repository", + "attributes": { + "version": "1.77.1", + "iso_date": "", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_windows_x86_64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_windows_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rust_darwin_x86_64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_darwin_x86_64__x86_64-apple-darwin__stable//:toolchain", + "@rust_darwin_x86_64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_darwin_x86_64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rust_windows_aarch64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_windows_aarch64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rust_darwin_x86_64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-apple-darwin", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "x86_64-pc-windows-msvc" + } + }, + "rust_darwin_aarch64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-apple-darwin", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_windows_x86_64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-pc-windows-msvc", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_linux_aarch64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_linux_aarch64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rust_darwin_aarch64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_darwin_aarch64__aarch64-apple-darwin__stable//:toolchain", + "@rust_darwin_aarch64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_darwin_aarch64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "aarch64-apple-darwin" + } + }, + "rust_analyzer_1.77.1": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_analyzer_1.77.1_tools//:rust_analyzer_toolchain", + "toolchain_type": "@rules_rust//rust/rust_analyzer:toolchain_type", + "exec_compatible_with": [], + "target_compatible_with": [] + } + }, + "rust_darwin_x86_64__x86_64-apple-darwin__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_darwin_x86_64__x86_64-apple-darwin__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "target_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ] + } + }, + "rust_linux_x86_64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-unknown-linux-gnu", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_freebsd_x86_64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-unknown-freebsd", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_darwin_x86_64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_darwin_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_freebsd_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rust_freebsd_x86_64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_freebsd_x86_64__x86_64-unknown-freebsd__stable//:toolchain", + "@rust_freebsd_x86_64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_freebsd_x86_64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rust_linux_x86_64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-unknown-linux-gnu", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_windows_x86_64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_windows_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "target_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ] + } + }, + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "target_compatible_with": [] + } + }, + "rust_linux_x86_64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_linux_x86_64__x86_64-unknown-linux-gnu__stable//:toolchain", + "@rust_linux_x86_64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_linux_x86_64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "target_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ] + } + }, + "rust_linux_x86_64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_linux_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rust_windows_aarch64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-pc-windows-msvc", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_darwin_aarch64__aarch64-apple-darwin__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-apple-darwin", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "aarch64-apple-darwin", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_linux_aarch64__wasm32-wasi__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-unknown-linux-gnu", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-wasi", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "target_compatible_with": [] + } + }, + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "aarch64-unknown-linux-gnu" + } + }, + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__x86_64-apple-darwin_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "target_compatible_with": [] + } + }, + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "aarch64-pc-windows-msvc" + } + }, + "rust_windows_aarch64__wasm32-unknown-unknown__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_windows_aarch64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ] + } + }, + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "x86_64-apple-darwin" + } + }, + "rust_linux_aarch64": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_set_repository", + "attributes": { + "toolchains": [ + "@rust_linux_aarch64__aarch64-unknown-linux-gnu__stable//:toolchain", + "@rust_linux_aarch64__wasm32-unknown-unknown__stable//:toolchain", + "@rust_linux_aarch64__wasm32-wasi__stable//:toolchain" + ] + } + }, + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "target_compatible_with": [] + } + }, + "rust_darwin_aarch64__wasm32-wasi__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_darwin_aarch64__wasm32-wasi__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "target_compatible_with": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ] + } + }, + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc_tools//:rustfmt_toolchain", + "toolchain_type": "@rules_rust//rust/rustfmt:toolchain_type", + "target_settings": [], + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "target_compatible_with": [] + } + }, + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rustfmt_toolchain_tools_repository", + "attributes": { + "version": "nightly", + "iso_date": "2024-04-09", + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {}, + "exec_triple": "x86_64-unknown-linux-gnu" + } + }, + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_windows_aarch64__aarch64-pc-windows-msvc__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "target_compatible_with": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ] + } + }, + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "toolchain_repository_proxy", + "attributes": { + "toolchain": "@rust_freebsd_x86_64__x86_64-unknown-freebsd__stable_tools//:rust_toolchain", + "target_settings": [ + "@rules_rust//rust/toolchain/channel:stable" + ], + "toolchain_type": "@rules_rust//rust:toolchain", + "exec_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "target_compatible_with": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ] + } + }, + "rust_toolchains": { + "bzlFile": "@@rules_rust~//rust/private:repository_utils.bzl", + "ruleClassName": "toolchain_repository_hub", + "attributes": { + "toolchain_names": [ + "rust_analyzer_1.77.1", + "rust_darwin_aarch64__aarch64-apple-darwin__stable", + "rust_darwin_aarch64__wasm32-unknown-unknown__stable", + "rust_darwin_aarch64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin", + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable", + "rust_windows_aarch64__wasm32-unknown-unknown__stable", + "rust_windows_aarch64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc", + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable", + "rust_linux_aarch64__wasm32-unknown-unknown__stable", + "rust_linux_aarch64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu", + "rust_darwin_x86_64__x86_64-apple-darwin__stable", + "rust_darwin_x86_64__wasm32-unknown-unknown__stable", + "rust_darwin_x86_64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin", + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable", + "rust_windows_x86_64__wasm32-unknown-unknown__stable", + "rust_windows_x86_64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc", + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable", + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable", + "rust_freebsd_x86_64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd", + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable", + "rust_linux_x86_64__wasm32-unknown-unknown__stable", + "rust_linux_x86_64__wasm32-wasi__stable", + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu" + ], + "toolchain_labels": { + "rust_analyzer_1.77.1": "@rust_analyzer_1.77.1_tools//:rust_analyzer_toolchain", + "rust_darwin_aarch64__aarch64-apple-darwin__stable": "@rust_darwin_aarch64__aarch64-apple-darwin__stable_tools//:rust_toolchain", + "rust_darwin_aarch64__wasm32-unknown-unknown__stable": "@rust_darwin_aarch64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_darwin_aarch64__wasm32-wasi__stable": "@rust_darwin_aarch64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin": "@rustfmt_nightly-2024-04-09__aarch64-apple-darwin_tools//:rustfmt_toolchain", + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable": "@rust_windows_aarch64__aarch64-pc-windows-msvc__stable_tools//:rust_toolchain", + "rust_windows_aarch64__wasm32-unknown-unknown__stable": "@rust_windows_aarch64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_windows_aarch64__wasm32-wasi__stable": "@rust_windows_aarch64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc": "@rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc_tools//:rustfmt_toolchain", + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable": "@rust_linux_aarch64__aarch64-unknown-linux-gnu__stable_tools//:rust_toolchain", + "rust_linux_aarch64__wasm32-unknown-unknown__stable": "@rust_linux_aarch64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_linux_aarch64__wasm32-wasi__stable": "@rust_linux_aarch64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu": "@rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu_tools//:rustfmt_toolchain", + "rust_darwin_x86_64__x86_64-apple-darwin__stable": "@rust_darwin_x86_64__x86_64-apple-darwin__stable_tools//:rust_toolchain", + "rust_darwin_x86_64__wasm32-unknown-unknown__stable": "@rust_darwin_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_darwin_x86_64__wasm32-wasi__stable": "@rust_darwin_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin": "@rustfmt_nightly-2024-04-09__x86_64-apple-darwin_tools//:rustfmt_toolchain", + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable": "@rust_windows_x86_64__x86_64-pc-windows-msvc__stable_tools//:rust_toolchain", + "rust_windows_x86_64__wasm32-unknown-unknown__stable": "@rust_windows_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_windows_x86_64__wasm32-wasi__stable": "@rust_windows_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc": "@rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc_tools//:rustfmt_toolchain", + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable": "@rust_freebsd_x86_64__x86_64-unknown-freebsd__stable_tools//:rust_toolchain", + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable": "@rust_freebsd_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_freebsd_x86_64__wasm32-wasi__stable": "@rust_freebsd_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd": "@rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd_tools//:rustfmt_toolchain", + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable": "@rust_linux_x86_64__x86_64-unknown-linux-gnu__stable_tools//:rust_toolchain", + "rust_linux_x86_64__wasm32-unknown-unknown__stable": "@rust_linux_x86_64__wasm32-unknown-unknown__stable_tools//:rust_toolchain", + "rust_linux_x86_64__wasm32-wasi__stable": "@rust_linux_x86_64__wasm32-wasi__stable_tools//:rust_toolchain", + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu": "@rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu_tools//:rustfmt_toolchain" + }, + "toolchain_types": { + "rust_analyzer_1.77.1": "@rules_rust//rust/rust_analyzer:toolchain_type", + "rust_darwin_aarch64__aarch64-apple-darwin__stable": "@rules_rust//rust:toolchain", + "rust_darwin_aarch64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_darwin_aarch64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin": "@rules_rust//rust/rustfmt:toolchain_type", + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable": "@rules_rust//rust:toolchain", + "rust_windows_aarch64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_windows_aarch64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc": "@rules_rust//rust/rustfmt:toolchain_type", + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable": "@rules_rust//rust:toolchain", + "rust_linux_aarch64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_linux_aarch64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu": "@rules_rust//rust/rustfmt:toolchain_type", + "rust_darwin_x86_64__x86_64-apple-darwin__stable": "@rules_rust//rust:toolchain", + "rust_darwin_x86_64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_darwin_x86_64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin": "@rules_rust//rust/rustfmt:toolchain_type", + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable": "@rules_rust//rust:toolchain", + "rust_windows_x86_64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_windows_x86_64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc": "@rules_rust//rust/rustfmt:toolchain_type", + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable": "@rules_rust//rust:toolchain", + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_freebsd_x86_64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd": "@rules_rust//rust/rustfmt:toolchain_type", + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable": "@rules_rust//rust:toolchain", + "rust_linux_x86_64__wasm32-unknown-unknown__stable": "@rules_rust//rust:toolchain", + "rust_linux_x86_64__wasm32-wasi__stable": "@rules_rust//rust:toolchain", + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu": "@rules_rust//rust/rustfmt:toolchain_type" + }, + "exec_compatible_with": { + "rust_analyzer_1.77.1": [], + "rust_darwin_aarch64__aarch64-apple-darwin__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "rust_darwin_aarch64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "rust_darwin_aarch64__wasm32-wasi__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "rust_windows_aarch64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "rust_windows_aarch64__wasm32-wasi__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "rust_linux_aarch64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "rust_linux_aarch64__wasm32-wasi__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "rust_darwin_x86_64__x86_64-apple-darwin__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "rust_darwin_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "rust_darwin_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "rust_windows_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "rust_windows_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "rust_freebsd_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "rust_linux_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "rust_linux_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ] + }, + "target_compatible_with": { + "rust_analyzer_1.77.1": [], + "rust_darwin_aarch64__aarch64-apple-darwin__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:osx" + ], + "rust_darwin_aarch64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_darwin_aarch64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__aarch64-apple-darwin": [], + "rust_windows_aarch64__aarch64-pc-windows-msvc__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:windows" + ], + "rust_windows_aarch64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_windows_aarch64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__aarch64-pc-windows-msvc": [], + "rust_linux_aarch64__aarch64-unknown-linux-gnu__stable": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "rust_linux_aarch64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_linux_aarch64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__aarch64-unknown-linux-gnu": [], + "rust_darwin_x86_64__x86_64-apple-darwin__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:osx" + ], + "rust_darwin_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_darwin_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__x86_64-apple-darwin": [], + "rust_windows_x86_64__x86_64-pc-windows-msvc__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ], + "rust_windows_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_windows_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__x86_64-pc-windows-msvc": [], + "rust_freebsd_x86_64__x86_64-unknown-freebsd__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:freebsd" + ], + "rust_freebsd_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_freebsd_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__x86_64-unknown-freebsd": [], + "rust_linux_x86_64__x86_64-unknown-linux-gnu__stable": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "rust_linux_x86_64__wasm32-unknown-unknown__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:none" + ], + "rust_linux_x86_64__wasm32-wasi__stable": [ + "@platforms//cpu:wasm32", + "@platforms//os:wasi" + ], + "rustfmt_nightly-2024-04-09__x86_64-unknown-linux-gnu": [] + } + } + }, + "rust_linux_aarch64__wasm32-unknown-unknown__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "aarch64-unknown-linux-gnu", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "wasm32-unknown-unknown", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + }, + "rust_darwin_x86_64__x86_64-apple-darwin__stable_tools": { + "bzlFile": "@@rules_rust~//rust:repositories.bzl", + "ruleClassName": "rust_toolchain_tools_repository", + "attributes": { + "exec_triple": "x86_64-apple-darwin", + "allocator_library": "@rules_rust//ffi/cc/allocator_library", + "global_allocator_library": "@rules_rust//ffi/cc/global_allocator_library", + "target_triple": "x86_64-apple-darwin", + "iso_date": "", + "version": "1.77.1", + "rustfmt_version": "nightly/2024-04-09", + "edition": "2021", + "dev_components": false, + "extra_rustc_flags": [], + "extra_exec_rustc_flags": [], + "opt_level": {}, + "sha256s": {}, + "urls": [ + "https://static.rust-lang.org/dist/{}.tar.xz" + ], + "auth": {} + } + } + }, + "recordedRepoMappingEntries": [ + [ + "bazel_features~", + "bazel_features_globals", + "bazel_features~~version_extension~bazel_features_globals" + ], + [ + "bazel_features~", + "bazel_features_version", + "bazel_features~~version_extension~bazel_features_version" + ], + [ + "rules_rust~", + "bazel_features", + "bazel_features~" + ], + [ + "rules_rust~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "rules_rust~", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_rust~", + "rules_rust", + "rules_rust~" + ] + ] + } + }, + "@@rules_rust~//rust/private:extensions.bzl%i": { + "general": { + "bzlTransitiveDigest": "X2v+7Bz11W5htCVO7xqy67eK7NWv0mmFRB4EQTVUZOY=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "rules_rust_prost__tracing-0.1.37": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing/0.1.37/download" + ], + "strip_prefix": "tracing-0.1.37", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tracing-0.1.37.bazel" + } + }, + "rules_rust_wasm_bindgen__walrus-0.20.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2c03529cd0c4400a2449f640d2f27cd1b48c3065226d15e26d98e4429ab0adb7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/walrus/0.20.3/download" + ], + "strip_prefix": "walrus-0.20.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.walrus-0.20.3.bazel" + } + }, + "rules_rust_wasm_bindgen__unicode-bidi-0.3.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-bidi/0.3.13/download" + ], + "strip_prefix": "unicode-bidi-0.3.13", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.unicode-bidi-0.3.13.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_x86_64_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnu/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnu-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_x86_64_gnu-0.48.0.bazel" + } + }, + "cui__rustix-0.37.23": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustix/0.37.23/download" + ], + "strip_prefix": "rustix-0.37.23", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rustix-0.37.23.bazel" + } + }, + "cui__fuchsia-cprng-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fuchsia-cprng/0.1.1/download" + ], + "strip_prefix": "fuchsia-cprng-0.1.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.fuchsia-cprng-0.1.1.bazel" + } + }, + "cui__url-2.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/url/2.4.0/download" + ], + "strip_prefix": "url-2.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.url-2.4.0.bazel" + } + }, + "cui__ryu-1.0.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ryu/1.0.14/download" + ], + "strip_prefix": "ryu-1.0.14", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.ryu-1.0.14.bazel" + } + }, + "rules_rust_prost__protoc-gen-prost-0.2.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "patch_args": [ + "-p1" + ], + "patches": [ + "@@rules_rust~//proto/prost/private/3rdparty/patches:protoc-gen-prost.patch" + ], + "sha256": "a81e3a9bb429fec47008b209896f0b9ab99fbcbc1c3733b385d43fbfd64dd2ca", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/protoc-gen-prost/0.2.2/download" + ], + "strip_prefix": "protoc-gen-prost-0.2.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.protoc-gen-prost-0.2.2.bazel" + } + }, + "rules_rust_bindgen__cfg-if-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-if/1.0.0/download" + ], + "strip_prefix": "cfg-if-1.0.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.cfg-if-1.0.0.bazel" + } + }, + "rules_rust_prost__protoc-gen-tonic-0.2.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "725a07a704f9cf7a956b302c21d81b5516ed5ee6cfbbf827edb69beeaae6cc30", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/protoc-gen-tonic/0.2.2/download" + ], + "strip_prefix": "protoc-gen-tonic-0.2.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.protoc-gen-tonic-0.2.2.bazel" + } + }, + "cui__iana-time-zone-haiku-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/iana-time-zone-haiku/0.1.2/download" + ], + "strip_prefix": "iana-time-zone-haiku-0.1.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.iana-time-zone-haiku-0.1.2.bazel" + } + }, + "cui__windows_x86_64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_x86_64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_prost__percent-encoding-2.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/percent-encoding/2.3.0/download" + ], + "strip_prefix": "percent-encoding-2.3.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.percent-encoding-2.3.0.bazel" + } + }, + "cui__fastrand-2.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fastrand/2.0.1/download" + ], + "strip_prefix": "fastrand-2.0.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.fastrand-2.0.1.bazel" + } + }, + "cui__flate2-1.0.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/flate2/1.0.28/download" + ], + "strip_prefix": "flate2-1.0.28", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.flate2-1.0.28.bazel" + } + }, + "rules_rust_prost__cc-1.0.79": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cc/1.0.79/download" + ], + "strip_prefix": "cc-1.0.79", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.cc-1.0.79.bazel" + } + }, + "rrra__winapi-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.3.9/download" + ], + "strip_prefix": "winapi-0.3.9", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.winapi-0.3.9.bazel" + } + }, + "cui__windows-targets-0.48.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-targets/0.48.1/download" + ], + "strip_prefix": "windows-targets-0.48.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows-targets-0.48.1.bazel" + } + }, + "rules_rust_wasm_bindgen__ppv-lite86-0.2.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ppv-lite86/0.2.17/download" + ], + "strip_prefix": "ppv-lite86-0.2.17", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.ppv-lite86-0.2.17.bazel" + } + }, + "cui__smawk-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/smawk/0.3.1/download" + ], + "strip_prefix": "smawk-0.3.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.smawk-0.3.1.bazel" + } + }, + "rules_rust_wasm_bindgen__heck-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/heck/0.3.3/download" + ], + "strip_prefix": "heck-0.3.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.heck-0.3.3.bazel" + } + }, + "rules_rust_wasm_bindgen__unicode-ident-1.0.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-ident/1.0.10/download" + ], + "strip_prefix": "unicode-ident-1.0.10", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.unicode-ident-1.0.10.bazel" + } + }, + "cui__clap_derive-4.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_derive/4.3.2/download" + ], + "strip_prefix": "clap_derive-4.3.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.clap_derive-4.3.2.bazel" + } + }, + "cui__libm-0.2.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libm/0.2.7/download" + ], + "strip_prefix": "libm-0.2.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.libm-0.2.7.bazel" + } + }, + "cui__deranged-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/deranged/0.3.9/download" + ], + "strip_prefix": "deranged-0.3.9", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.deranged-0.3.9.bazel" + } + }, + "cui__gix-negotiate-0.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6f1697bf9911c6d1b8d709b9e6ef718cb5ea5821a1b7991520125a8134448004", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-negotiate/0.8.0/download" + ], + "strip_prefix": "gix-negotiate-0.8.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-negotiate-0.8.0.bazel" + } + }, + "rules_rust_proto__autocfg-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/autocfg/1.1.0/download" + ], + "strip_prefix": "autocfg-1.1.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.autocfg-1.1.0.bazel" + } + }, + "cui__io-lifetimes-1.0.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/io-lifetimes/1.0.11/download" + ], + "strip_prefix": "io-lifetimes-1.0.11", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.io-lifetimes-1.0.11.bazel" + } + }, + "rules_rust_proto__cfg-if-0.1.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-if/0.1.10/download" + ], + "strip_prefix": "cfg-if-0.1.10", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.cfg-if-0.1.10.bazel" + } + }, + "rules_rust_prost__proc-macro2-1.0.60": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/proc-macro2/1.0.60/download" + ], + "strip_prefix": "proc-macro2-1.0.60", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.proc-macro2-1.0.60.bazel" + } + }, + "rules_rust_bindgen__clap_complete-4.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7f6b5c519bab3ea61843a7923d074b04245624bb84a64a8c150f5deb014e388b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_complete/4.3.1/download" + ], + "strip_prefix": "clap_complete-4.3.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.clap_complete-4.3.1.bazel" + } + }, + "rules_rust_wasm_bindgen__time-core-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/time-core/0.1.1/download" + ], + "strip_prefix": "time-core-0.1.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.time-core-0.1.1.bazel" + } + }, + "cui__num-0.1.42": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num/0.1.42/download" + ], + "strip_prefix": "num-0.1.42", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-0.1.42.bazel" + } + }, + "rules_rust_wasm_bindgen__tiny_http-0.12.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tiny_http/0.12.0/download" + ], + "strip_prefix": "tiny_http-0.12.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.tiny_http-0.12.0.bazel" + } + }, + "rules_rust_bindgen__windows-sys-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-sys/0.48.0/download" + ], + "strip_prefix": "windows-sys-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows-sys-0.48.0.bazel" + } + }, + "rules_rust_bindgen__libc-0.2.146": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libc/0.2.146/download" + ], + "strip_prefix": "libc-0.2.146", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.libc-0.2.146.bazel" + } + }, + "rules_rust_wasm_bindgen__iana-time-zone-haiku-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/iana-time-zone-haiku/0.1.2/download" + ], + "strip_prefix": "iana-time-zone-haiku-0.1.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.iana-time-zone-haiku-0.1.2.bazel" + } + }, + "rrra__memchr-2.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memchr/2.5.0/download" + ], + "strip_prefix": "memchr-2.5.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.memchr-2.5.0.bazel" + } + }, + "cui__getrandom-0.2.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/getrandom/0.2.10/download" + ], + "strip_prefix": "getrandom-0.2.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.getrandom-0.2.10.bazel" + } + }, + "rules_rust_prost__bitflags-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/1.3.2/download" + ], + "strip_prefix": "bitflags-1.3.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.bitflags-1.3.2.bazel" + } + }, + "cui__sha1_smol-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/sha1_smol/1.0.0/download" + ], + "strip_prefix": "sha1_smol-1.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.sha1_smol-1.0.0.bazel" + } + }, + "cargo_bazel.buildifier-darwin-amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildifier-darwin-amd64" + ], + "sha256": "2cb0a54683633ef6de4e0491072e22e66ac9c6389051432b76200deeeeaf93fb", + "downloaded_file_path": "buildifier.exe", + "executable": true + } + }, + "rules_rust_proto__iovec-0.1.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/iovec/0.1.4/download" + ], + "strip_prefix": "iovec-0.1.4", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.iovec-0.1.4.bazel" + } + }, + "rules_rust_proto__byteorder-1.4.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/byteorder/1.4.3/download" + ], + "strip_prefix": "byteorder-1.4.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.byteorder-1.4.3.bazel" + } + }, + "cui__chrono-0.4.26": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/chrono/0.4.26/download" + ], + "strip_prefix": "chrono-0.4.26", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.chrono-0.4.26.bazel" + } + }, + "rules_rust_proto__redox_syscall-0.1.57": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/redox_syscall/0.1.57/download" + ], + "strip_prefix": "redox_syscall-0.1.57", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.redox_syscall-0.1.57.bazel" + } + }, + "rules_rust_bindgen__proc-macro2-1.0.60": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/proc-macro2/1.0.60/download" + ], + "strip_prefix": "proc-macro2-1.0.60", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.proc-macro2-1.0.60.bazel" + } + }, + "rrra__windows_i686_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_msvc/0.48.0/download" + ], + "strip_prefix": "windows_i686_msvc-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_i686_msvc-0.48.0.bazel" + } + }, + "cui__overload-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/overload/0.1.1/download" + ], + "strip_prefix": "overload-0.1.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.overload-0.1.1.bazel" + } + }, + "rules_rust_bindgen__clap_derive-4.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_derive/4.3.2/download" + ], + "strip_prefix": "clap_derive-4.3.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.clap_derive-4.3.2.bazel" + } + }, + "cui__anstream-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstream/0.3.2/download" + ], + "strip_prefix": "anstream-0.3.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.anstream-0.3.2.bazel" + } + }, + "cui__bitflags-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/1.3.2/download" + ], + "strip_prefix": "bitflags-1.3.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.bitflags-1.3.2.bazel" + } + }, + "rules_rust_prost__smallvec-1.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/smallvec/1.10.0/download" + ], + "strip_prefix": "smallvec-1.10.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.smallvec-1.10.0.bazel" + } + }, + "rules_rust_prost__windows_x86_64_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnu/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnu-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_x86_64_gnu-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__atty-0.2.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/atty/0.2.14/download" + ], + "strip_prefix": "atty-0.2.14", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.atty-0.2.14.bazel" + } + }, + "cui__walkdir-2.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/walkdir/2.3.3/download" + ], + "strip_prefix": "walkdir-2.3.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.walkdir-2.3.3.bazel" + } + }, + "rrra__aho-corasick-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/aho-corasick/1.0.2/download" + ], + "strip_prefix": "aho-corasick-1.0.2", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.aho-corasick-1.0.2.bazel" + } + }, + "rules_rust_wasm_bindgen__rustls-0.21.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustls/0.21.8/download" + ], + "strip_prefix": "rustls-0.21.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rustls-0.21.8.bazel" + } + }, + "cui__gix-refspec-0.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0895cb7b1e70f3c3bd4550c329e9f5caf2975f97fcd4238e05754e72208ef61e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-refspec/0.18.0/download" + ], + "strip_prefix": "gix-refspec-0.18.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-refspec-0.18.0.bazel" + } + }, + "cui__semver-1.0.20": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/semver/1.0.20/download" + ], + "strip_prefix": "semver-1.0.20", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.semver-1.0.20.bazel" + } + }, + "rules_rust_proto__num_cpus-1.15.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num_cpus/1.15.0/download" + ], + "strip_prefix": "num_cpus-1.15.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.num_cpus-1.15.0.bazel" + } + }, + "rules_rust_bindgen__humantime-2.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/humantime/2.1.0/download" + ], + "strip_prefix": "humantime-2.1.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.humantime-2.1.0.bazel" + } + }, + "rules_rust_bindgen__bitflags-2.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/2.4.1/download" + ], + "strip_prefix": "bitflags-2.4.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.bitflags-2.4.1.bazel" + } + }, + "rrra__regex-syntax-0.7.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-syntax/0.7.4/download" + ], + "strip_prefix": "regex-syntax-0.7.4", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.regex-syntax-0.7.4.bazel" + } + }, + "rules_rust_prost__autocfg-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/autocfg/1.1.0/download" + ], + "strip_prefix": "autocfg-1.1.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.autocfg-1.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__sct-0.7.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/sct/0.7.1/download" + ], + "strip_prefix": "sct-0.7.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.sct-0.7.1.bazel" + } + }, + "rrra__winapi-util-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-util/0.1.5/download" + ], + "strip_prefix": "winapi-util-0.1.5", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.winapi-util-0.1.5.bazel" + } + }, + "rules_rust_wasm_bindgen__strsim-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/strsim/0.10.0/download" + ], + "strip_prefix": "strsim-0.10.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.strsim-0.10.0.bazel" + } + }, + "rules_rust_wasm_bindgen__untrusted-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/untrusted/0.9.0/download" + ], + "strip_prefix": "untrusted-0.9.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.untrusted-0.9.0.bazel" + } + }, + "rules_rust_proto__slab-0.4.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/slab/0.4.7/download" + ], + "strip_prefix": "slab-0.4.7", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.slab-0.4.7.bazel" + } + }, + "rules_rust_wasm_bindgen__crossbeam-epoch-0.9.15": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-epoch/0.9.15/download" + ], + "strip_prefix": "crossbeam-epoch-0.9.15", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.crossbeam-epoch-0.9.15.bazel" + } + }, + "rrra__termcolor-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/termcolor/1.2.0/download" + ], + "strip_prefix": "termcolor-1.2.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.termcolor-1.2.0.bazel" + } + }, + "rules_rust_wasm_bindgen__errno-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno/0.3.1/download" + ], + "strip_prefix": "errno-0.3.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.errno-0.3.1.bazel" + } + }, + "rules_rust_bindgen__unicode-width-0.1.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-width/0.1.10/download" + ], + "strip_prefix": "unicode-width-0.1.10", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.unicode-width-0.1.10.bazel" + } + }, + "rules_rust_proto__crossbeam-queue-0.2.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-queue/0.2.3/download" + ], + "strip_prefix": "crossbeam-queue-0.2.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.crossbeam-queue-0.2.3.bazel" + } + }, + "rules_rust_wasm_bindgen__crossbeam-deque-0.8.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-deque/0.8.3/download" + ], + "strip_prefix": "crossbeam-deque-0.8.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.crossbeam-deque-0.8.3.bazel" + } + }, + "rules_rust_wasm_bindgen__wasi-0.11.0-wasi-snapshot-preview1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasi/0.11.0+wasi-snapshot-preview1/download" + ], + "strip_prefix": "wasi-0.11.0+wasi-snapshot-preview1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel" + } + }, + "rrra__colorchoice-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/colorchoice/1.0.0/download" + ], + "strip_prefix": "colorchoice-1.0.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.colorchoice-1.0.0.bazel" + } + }, + "rules_rust_wasm_bindgen__regex-1.9.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex/1.9.1/download" + ], + "strip_prefix": "regex-1.9.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.regex-1.9.1.bazel" + } + }, + "rrra__windows_x86_64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_x86_64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_prost__slab-0.4.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/slab/0.4.8/download" + ], + "strip_prefix": "slab-0.4.8", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.slab-0.4.8.bazel" + } + }, + "rrra__clap-4.3.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap/4.3.11/download" + ], + "strip_prefix": "clap-4.3.11", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.clap-4.3.11.bazel" + } + }, + "cui__adler-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/adler/1.0.2/download" + ], + "strip_prefix": "adler-1.0.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.adler-1.0.2.bazel" + } + }, + "cross_x86_64-apple-darwin": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-apple-darwin.tar.gz" + ], + "sha256": "589da89453291dc26f0b10b521cdadb98376d495645b210574bd9ca4ec8cfa2c", + "build_file_content": "exports_files(glob([\"**\"]), visibility = [\"//visibility:public\"])" + } + }, + "rules_rust_prost__rustix-0.37.20": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustix/0.37.20/download" + ], + "strip_prefix": "rustix-0.37.20", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.rustix-0.37.20.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-macro-support-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-macro-support/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-macro-support-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-macro-support-0.2.91.bazel" + } + }, + "rules_rust_prost__fnv-1.0.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fnv/1.0.7/download" + ], + "strip_prefix": "fnv-1.0.7", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.fnv-1.0.7.bazel" + } + }, + "cui__windows_i686_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_msvc/0.48.0/download" + ], + "strip_prefix": "windows_i686_msvc-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_i686_msvc-0.48.0.bazel" + } + }, + "cui__jwalk-0.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2735847566356cd2179a2a38264839308f7079fa96e6bd5a42d740460e003c56", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/jwalk/0.8.1/download" + ], + "strip_prefix": "jwalk-0.8.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.jwalk-0.8.1.bazel" + } + }, + "rules_rust_prost__getrandom-0.2.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/getrandom/0.2.10/download" + ], + "strip_prefix": "getrandom-0.2.10", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.getrandom-0.2.10.bazel" + } + }, + "rules_rust_wasm_bindgen__redox_syscall-0.2.16": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/redox_syscall/0.2.16/download" + ], + "strip_prefix": "redox_syscall-0.2.16", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.redox_syscall-0.2.16.bazel" + } + }, + "rules_rust_prost__httpdate-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/httpdate/1.0.2/download" + ], + "strip_prefix": "httpdate-1.0.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.httpdate-1.0.2.bazel" + } + }, + "cargo_bazel.buildifier-darwin-arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildifier-darwin-arm64" + ], + "sha256": "4da23315f0dccabf878c8227fddbccf35545b23b3cb6225bfcf3107689cc4364", + "downloaded_file_path": "buildifier.exe", + "executable": true + } + }, + "cui__cargo_toml-0.19.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cargo_toml/0.19.2/download" + ], + "strip_prefix": "cargo_toml-0.19.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cargo_toml-0.19.2.bazel" + } + }, + "rules_rust_prost__num_cpus-1.15.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num_cpus/1.15.0/download" + ], + "strip_prefix": "num_cpus-1.15.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.num_cpus-1.15.0.bazel" + } + }, + "rules_rust_bindgen__lazycell-1.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lazycell/1.3.0/download" + ], + "strip_prefix": "lazycell-1.3.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.lazycell-1.3.0.bazel" + } + }, + "cui__tracing-subscriber-0.3.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing-subscriber/0.3.17/download" + ], + "strip_prefix": "tracing-subscriber-0.3.17", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tracing-subscriber-0.3.17.bazel" + } + }, + "rules_rust_prost__bytes-1.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bytes/1.4.0/download" + ], + "strip_prefix": "bytes-1.4.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.bytes-1.4.0.bazel" + } + }, + "rules_rust_wasm_bindgen__mime_guess-2.0.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/mime_guess/2.0.4/download" + ], + "strip_prefix": "mime_guess-2.0.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.mime_guess-2.0.4.bazel" + } + }, + "rules_rust_proto__protobuf-codegen-2.8.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3d74b9cbbf2ac9a7169c85a3714ec16c51ee9ec7cfd511549527e9a7df720795", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/protobuf-codegen/2.8.2/download" + ], + "strip_prefix": "protobuf-codegen-2.8.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.protobuf-codegen-2.8.2.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-encoder-0.29.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-encoder/0.29.0/download" + ], + "strip_prefix": "wasm-encoder-0.29.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-encoder-0.29.0.bazel" + } + }, + "cui__regex-syntax-0.8.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-syntax/0.8.2/download" + ], + "strip_prefix": "regex-syntax-0.8.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.regex-syntax-0.8.2.bazel" + } + }, + "rules_rust_bindgen__clap_lex-0.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_lex/0.5.0/download" + ], + "strip_prefix": "clap_lex-0.5.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.clap_lex-0.5.0.bazel" + } + }, + "rules_rust_prost__http-body-0.4.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/http-body/0.4.5/download" + ], + "strip_prefix": "http-body-0.4.5", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.http-body-0.4.5.bazel" + } + }, + "rules_rust_bindgen__utf8parse-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/utf8parse/0.2.1/download" + ], + "strip_prefix": "utf8parse-0.2.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.utf8parse-0.2.1.bazel" + } + }, + "rules_rust_proto__lazy_static-1.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lazy_static/1.4.0/download" + ], + "strip_prefix": "lazy_static-1.4.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.lazy_static-1.4.0.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_x86_64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_x86_64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_prost__fixedbitset-0.4.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fixedbitset/0.4.2/download" + ], + "strip_prefix": "fixedbitset-0.4.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.fixedbitset-0.4.2.bazel" + } + }, + "rrra__winapi-i686-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-i686-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-i686-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel" + } + }, + "rules_rust_prost__regex-1.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex/1.8.4/download" + ], + "strip_prefix": "regex-1.8.4", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.regex-1.8.4.bazel" + } + }, + "cui__winapi-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.3.9/download" + ], + "strip_prefix": "winapi-0.3.9", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.winapi-0.3.9.bazel" + } + }, + "cui__syn-2.0.32": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/2.0.32/download" + ], + "strip_prefix": "syn-2.0.32", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.syn-2.0.32.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-externref-xform-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "12b6ac5fca1d0992d2328147488169ea166bfe899c88f8ad06cf583f4c492fcf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-externref-xform/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-externref-xform-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-externref-xform-0.2.91.bazel" + } + }, + "rules_rust_prost__rustversion-1.0.12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustversion/1.0.12/download" + ], + "strip_prefix": "rustversion-1.0.12", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.rustversion-1.0.12.bazel" + } + }, + "rules_rust_prost__tokio-macros-2.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-macros/2.1.0/download" + ], + "strip_prefix": "tokio-macros-2.1.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tokio-macros-2.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__wasmprinter-0.2.60": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b76cb909fe3d9b0de58cee1f4072247e680ff5cc1558ccad2790a9de14a23993", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasmprinter/0.2.60/download" + ], + "strip_prefix": "wasmprinter-0.2.60", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasmprinter-0.2.60.bazel" + } + }, + "rules_rust_proto__scoped-tls-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/scoped-tls/0.1.2/download" + ], + "strip_prefix": "scoped-tls-0.1.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.scoped-tls-0.1.2.bazel" + } + }, + "cui__gix-macros-0.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9d8acb5ee668d55f0f2d19a320a3f9ef67a6999ad483e11135abcc2464ed18b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-macros/0.1.0/download" + ], + "strip_prefix": "gix-macros-0.1.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-macros-0.1.0.bazel" + } + }, + "rrra__ryu-1.0.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ryu/1.0.14/download" + ], + "strip_prefix": "ryu-1.0.14", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.ryu-1.0.14.bazel" + } + }, + "rrra__serde-1.0.171": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde/1.0.171/download" + ], + "strip_prefix": "serde-1.0.171", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.serde-1.0.171.bazel" + } + }, + "rules_rust_prost__lock_api-0.4.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lock_api/0.4.10/download" + ], + "strip_prefix": "lock_api-0.4.10", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.lock_api-0.4.10.bazel" + } + }, + "rules_rust_bindgen__glob-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/glob/0.3.1/download" + ], + "strip_prefix": "glob-0.3.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.glob-0.3.1.bazel" + } + }, + "rules_rust_prost__itertools-0.10.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itertools/0.10.5/download" + ], + "strip_prefix": "itertools-0.10.5", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.itertools-0.10.5.bazel" + } + }, + "cui__redox_syscall-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/redox_syscall/0.4.1/download" + ], + "strip_prefix": "redox_syscall-0.4.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.redox_syscall-0.4.1.bazel" + } + }, + "rules_rust_wasm_bindgen__id-arena-2.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/id-arena/2.2.1/download" + ], + "strip_prefix": "id-arena-2.2.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.id-arena-2.2.1.bazel" + } + }, + "cui__normpath-1.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/normpath/1.1.1/download" + ], + "strip_prefix": "normpath-1.1.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.normpath-1.1.1.bazel" + } + }, + "rules_rust_bindgen__lazy_static-1.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lazy_static/1.4.0/download" + ], + "strip_prefix": "lazy_static-1.4.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.lazy_static-1.4.0.bazel" + } + }, + "rules_rust_prost__axum-0.6.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/axum/0.6.18/download" + ], + "strip_prefix": "axum-0.6.18", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.axum-0.6.18.bazel" + } + }, + "rules_rust_prost__parking_lot-0.12.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parking_lot/0.12.1/download" + ], + "strip_prefix": "parking_lot-0.12.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.parking_lot-0.12.1.bazel" + } + }, + "cui__cargo-platform-0.1.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cargo-platform/0.1.4/download" + ], + "strip_prefix": "cargo-platform-0.1.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cargo-platform-0.1.4.bazel" + } + }, + "cui__slug-0.1.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/slug/0.1.4/download" + ], + "strip_prefix": "slug-0.1.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.slug-0.1.4.bazel" + } + }, + "rules_rust_prost__errno-dragonfly-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno-dragonfly/0.1.2/download" + ], + "strip_prefix": "errno-dragonfly-0.1.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.errno-dragonfly-0.1.2.bazel" + } + }, + "cui__gix-url-0.24.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6125ecf46e8c68bf7202da6cad239831daebf0247ffbab30210d72f3856e420f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-url/0.24.0/download" + ], + "strip_prefix": "gix-url-0.24.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-url-0.24.0.bazel" + } + }, + "rules_rust_wasm_bindgen__percent-encoding-2.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/percent-encoding/2.3.0/download" + ], + "strip_prefix": "percent-encoding-2.3.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.percent-encoding-2.3.0.bazel" + } + }, + "cui__clap_builder-4.3.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_builder/4.3.11/download" + ], + "strip_prefix": "clap_builder-4.3.11", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.clap_builder-4.3.11.bazel" + } + }, + "cui__tracing-core-0.1.32": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing-core/0.1.32/download" + ], + "strip_prefix": "tracing-core-0.1.32", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tracing-core-0.1.32.bazel" + } + }, + "rules_rust_proto__fuchsia-zircon-sys-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fuchsia-zircon-sys/0.3.3/download" + ], + "strip_prefix": "fuchsia-zircon-sys-0.3.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.fuchsia-zircon-sys-0.3.3.bazel" + } + }, + "rules_rust_proto__safemem-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/safemem/0.3.3/download" + ], + "strip_prefix": "safemem-0.3.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.safemem-0.3.3.bazel" + } + }, + "cui__windows_x86_64_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnu/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnu-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_x86_64_gnu-0.48.0.bazel" + } + }, + "cui__gix-actor-0.27.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "08c60e982c5290897122d4e2622447f014a2dadd5a18cb73d50bb91b31645e27", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-actor/0.27.0/download" + ], + "strip_prefix": "gix-actor-0.27.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-actor-0.27.0.bazel" + } + }, + "cui__unic-ucd-version-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unic-ucd-version/0.9.0/download" + ], + "strip_prefix": "unic-ucd-version-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unic-ucd-version-0.9.0.bazel" + } + }, + "com_google_googleapis": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/googleapis/googleapis/archive/18becb1d1426feb7399db144d7beeb3284f1ccb0.zip" + ], + "strip_prefix": "googleapis-18becb1d1426feb7399db144d7beeb3284f1ccb0", + "sha256": "b8c487191eb942361af905e40172644eab490190e717c3d09bf83e87f3994fff" + } + }, + "cui__either-1.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/either/1.9.0/download" + ], + "strip_prefix": "either-1.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.either-1.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__gimli-0.26.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gimli/0.26.2/download" + ], + "strip_prefix": "gimli-0.26.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.gimli-0.26.2.bazel" + } + }, + "cui__parking_lot-0.12.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parking_lot/0.12.1/download" + ], + "strip_prefix": "parking_lot-0.12.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.parking_lot-0.12.1.bazel" + } + }, + "cui__globwalk-0.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/globwalk/0.8.1/download" + ], + "strip_prefix": "globwalk-0.8.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.globwalk-0.8.1.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-wasm-interpreter-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "682940195a701dbf887f20017418b8cac916a37b3f91ededec33226619e973c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-wasm-interpreter/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-wasm-interpreter-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-wasm-interpreter-0.2.91.bazel" + } + }, + "rules_rust_wasm_bindgen__ring-0.17.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ring/0.17.5/download" + ], + "strip_prefix": "ring-0.17.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.ring-0.17.5.bazel" + } + }, + "rules_rust_prost__memchr-2.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memchr/2.5.0/download" + ], + "strip_prefix": "memchr-2.5.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.memchr-2.5.0.bazel" + } + }, + "cui__crates-index-2.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "33bc10579ea08741ae173928194b6c42c90b295d51ddd0d18238eaf15502ac87", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crates-index/2.2.0/download" + ], + "strip_prefix": "crates-index-2.2.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crates-index-2.2.0.bazel" + } + }, + "rules_rust_proto__winapi-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.3.9/download" + ], + "strip_prefix": "winapi-0.3.9", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.winapi-0.3.9.bazel" + } + }, + "rules_rust_wasm_bindgen__crossbeam-channel-0.5.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-channel/0.5.8/download" + ], + "strip_prefix": "crossbeam-channel-0.5.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.crossbeam-channel-0.5.8.bazel" + } + }, + "rules_rust_wasm_bindgen__windows-sys-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-sys/0.48.0/download" + ], + "strip_prefix": "windows-sys-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows-sys-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__flate2-1.0.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/flate2/1.0.28/download" + ], + "strip_prefix": "flate2-1.0.28", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.flate2-1.0.28.bazel" + } + }, + "rules_rust_proto__semver-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/semver/0.9.0/download" + ], + "strip_prefix": "semver-0.9.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.semver-0.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__scopeguard-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/scopeguard/1.1.0/download" + ], + "strip_prefix": "scopeguard-1.1.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.scopeguard-1.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__fastrand-1.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fastrand/1.9.0/download" + ], + "strip_prefix": "fastrand-1.9.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.fastrand-1.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__num_threads-0.1.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num_threads/0.1.6/download" + ], + "strip_prefix": "num_threads-0.1.6", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.num_threads-0.1.6.bazel" + } + }, + "cui__rayon-core-1.12.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rayon-core/1.12.0/download" + ], + "strip_prefix": "rayon-core-1.12.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rayon-core-1.12.0.bazel" + } + }, + "rules_rust_wasm_bindgen__lazy_static-1.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lazy_static/1.4.0/download" + ], + "strip_prefix": "lazy_static-1.4.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.lazy_static-1.4.0.bazel" + } + }, + "cui__thread_local-1.1.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/thread_local/1.1.4/download" + ], + "strip_prefix": "thread_local-1.1.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.thread_local-1.1.4.bazel" + } + }, + "rules_rust_wasm_bindgen__threadpool-1.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/threadpool/1.8.1/download" + ], + "strip_prefix": "threadpool-1.8.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.threadpool-1.8.1.bazel" + } + }, + "cui__linux-raw-sys-0.4.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/linux-raw-sys/0.4.10/download" + ], + "strip_prefix": "linux-raw-sys-0.4.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.linux-raw-sys-0.4.10.bazel" + } + }, + "rules_rust_bindgen__anstyle-wincon-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-wincon/1.0.1/download" + ], + "strip_prefix": "anstyle-wincon-1.0.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.anstyle-wincon-1.0.1.bazel" + } + }, + "rrra__windows_x86_64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_msvc-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_x86_64_msvc-0.48.0.bazel" + } + }, + "cui__rand_core-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_core/0.3.1/download" + ], + "strip_prefix": "rand_core-0.3.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rand_core-0.3.1.bazel" + } + }, + "cui__rayon-1.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rayon/1.8.0/download" + ], + "strip_prefix": "rayon-1.8.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rayon-1.8.0.bazel" + } + }, + "cui__tempfile-3.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tempfile/3.8.1/download" + ], + "strip_prefix": "tempfile-3.8.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tempfile-3.8.1.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_aarch64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_msvc-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_aarch64_msvc-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__multipart-0.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/multipart/0.18.0/download" + ], + "strip_prefix": "multipart-0.18.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.multipart-0.18.0.bazel" + } + }, + "rules_rust_wasm_bindgen__android_system_properties-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/android_system_properties/0.1.5/download" + ], + "strip_prefix": "android_system_properties-0.1.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.android_system_properties-0.1.5.bazel" + } + }, + "cui__gix-ref-0.37.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "22e6b749660b613641769edc1954132eb8071a13c32224891686091bef078de4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-ref/0.37.0/download" + ], + "strip_prefix": "gix-ref-0.37.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-ref-0.37.0.bazel" + } + }, + "cui__rand-0.8.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand/0.8.5/download" + ], + "strip_prefix": "rand-0.8.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rand-0.8.5.bazel" + } + }, + "cui__num-integer-0.1.45": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-integer/0.1.45/download" + ], + "strip_prefix": "num-integer-0.1.45", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-integer-0.1.45.bazel" + } + }, + "rules_rust_bindgen__anstyle-query-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-query/1.0.0/download" + ], + "strip_prefix": "anstyle-query-1.0.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.anstyle-query-1.0.0.bazel" + } + }, + "rules_rust_wasm_bindgen__hermit-abi-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.3.2/download" + ], + "strip_prefix": "hermit-abi-0.3.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.hermit-abi-0.3.2.bazel" + } + }, + "rules_rust_wasm_bindgen__getrandom-0.2.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/getrandom/0.2.10/download" + ], + "strip_prefix": "getrandom-0.2.10", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.getrandom-0.2.10.bazel" + } + }, + "rules_rust_proto__smallvec-0.6.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/smallvec/0.6.14/download" + ], + "strip_prefix": "smallvec-0.6.14", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.smallvec-0.6.14.bazel" + } + }, + "rules_rust_prost__httparse-1.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/httparse/1.8.0/download" + ], + "strip_prefix": "httparse-1.8.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.httparse-1.8.0.bazel" + } + }, + "rules_rust_bindgen__shlex-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/shlex/1.1.0/download" + ], + "strip_prefix": "shlex-1.1.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.shlex-1.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__predicates-1.0.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f49cfaf7fdaa3bfacc6fa3e7054e65148878354a5cfddcf661df4c851f8021df", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/predicates/1.0.8/download" + ], + "strip_prefix": "predicates-1.0.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.predicates-1.0.8.bazel" + } + }, + "rules_rust_proto__scopeguard-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/scopeguard/1.1.0/download" + ], + "strip_prefix": "scopeguard-1.1.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.scopeguard-1.1.0.bazel" + } + }, + "rrra__windows-targets-0.48.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-targets/0.48.1/download" + ], + "strip_prefix": "windows-targets-0.48.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows-targets-0.48.1.bazel" + } + }, + "rules_rust_wasm_bindgen__serde_json-1.0.102": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_json/1.0.102/download" + ], + "strip_prefix": "serde_json-1.0.102", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.serde_json-1.0.102.bazel" + } + }, + "rrra__clap_builder-4.3.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_builder/4.3.11/download" + ], + "strip_prefix": "clap_builder-4.3.11", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.clap_builder-4.3.11.bazel" + } + }, + "rules_rust_prost__windows-sys-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-sys/0.48.0/download" + ], + "strip_prefix": "windows-sys-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows-sys-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_i686_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_gnu/0.48.0/download" + ], + "strip_prefix": "windows_i686_gnu-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_i686_gnu-0.48.0.bazel" + } + }, + "cui__gix-lock-10.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "47fc96fa8b6b6d33555021907c81eb3b27635daecf6e630630bdad44f8feaa95", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-lock/10.0.0/download" + ], + "strip_prefix": "gix-lock-10.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-lock-10.0.0.bazel" + } + }, + "rules_rust_prost__indexmap-1.9.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/indexmap/1.9.3/download" + ], + "strip_prefix": "indexmap-1.9.3", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.indexmap-1.9.3.bazel" + } + }, + "cui__num-iter-0.1.43": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-iter/0.1.43/download" + ], + "strip_prefix": "num-iter-0.1.43", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-iter-0.1.43.bazel" + } + }, + "rules_rust_wasm_bindgen__ryu-1.0.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ryu/1.0.14/download" + ], + "strip_prefix": "ryu-1.0.14", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.ryu-1.0.14.bazel" + } + }, + "rules_rust_prost__lazy_static-1.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lazy_static/1.4.0/download" + ], + "strip_prefix": "lazy_static-1.4.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.lazy_static-1.4.0.bazel" + } + }, + "rules_rust_prost__multimap-0.8.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/multimap/0.8.3/download" + ], + "strip_prefix": "multimap-0.8.3", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.multimap-0.8.3.bazel" + } + }, + "rules_rust_wasm_bindgen__difference-2.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/difference/2.0.0/download" + ], + "strip_prefix": "difference-2.0.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.difference-2.0.0.bazel" + } + }, + "rules_rust_wasm_bindgen__unicode-segmentation-1.10.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-segmentation/1.10.1/download" + ], + "strip_prefix": "unicode-segmentation-1.10.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.unicode-segmentation-1.10.1.bazel" + } + }, + "rules_rust_wasm_bindgen__proc-macro2-1.0.64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/proc-macro2/1.0.64/download" + ], + "strip_prefix": "proc-macro2-1.0.64", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.proc-macro2-1.0.64.bazel" + } + }, + "rrra__cc-1.0.79": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cc/1.0.79/download" + ], + "strip_prefix": "cc-1.0.79", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.cc-1.0.79.bazel" + } + }, + "rules_rust_wasm_bindgen__rustls-webpki-0.101.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustls-webpki/0.101.7/download" + ], + "strip_prefix": "rustls-webpki-0.101.7", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rustls-webpki-0.101.7.bazel" + } + }, + "rules_rust_prost": { + "bzlFile": "@@rules_rust~//crate_universe/private:crates_vendor.bzl", + "ruleClassName": "crates_vendor_remote_repository", + "attributes": { + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.bazel", + "defs_module": "@@rules_rust~//proto/prost/private/3rdparty/crates:defs.bzl" + } + }, + "rules_rust_bindgen__quote-1.0.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/quote/1.0.28/download" + ], + "strip_prefix": "quote-1.0.28", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.quote-1.0.28.bazel" + } + }, + "cui__anstyle-query-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-query/1.0.0/download" + ], + "strip_prefix": "anstyle-query-1.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.anstyle-query-1.0.0.bazel" + } + }, + "cui__bumpalo-3.13.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bumpalo/3.13.0/download" + ], + "strip_prefix": "bumpalo-3.13.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.bumpalo-3.13.0.bazel" + } + }, + "rules_rust_prost__cfg-if-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-if/1.0.0/download" + ], + "strip_prefix": "cfg-if-1.0.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.cfg-if-1.0.0.bazel" + } + }, + "rules_rust_bindgen__anstyle-parse-0.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-parse/0.2.0/download" + ], + "strip_prefix": "anstyle-parse-0.2.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.anstyle-parse-0.2.0.bazel" + } + }, + "rules_rust_bindgen__bindgen-0.69.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bindgen/0.69.1/download" + ], + "strip_prefix": "bindgen-0.69.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.bindgen-0.69.1.bazel" + } + }, + "cui__num-complex-0.1.43": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-complex/0.1.43/download" + ], + "strip_prefix": "num-complex-0.1.43", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-complex-0.1.43.bazel" + } + }, + "rules_rust_prost__pin-project-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pin-project/1.1.0/download" + ], + "strip_prefix": "pin-project-1.1.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.pin-project-1.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__quote-1.0.29": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/quote/1.0.29/download" + ], + "strip_prefix": "quote-1.0.29", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.quote-1.0.29.bazel" + } + }, + "cui__parse-zoneinfo-0.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parse-zoneinfo/0.3.0/download" + ], + "strip_prefix": "parse-zoneinfo-0.3.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.parse-zoneinfo-0.3.0.bazel" + } + }, + "cui__unicode-bidi-0.3.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-bidi/0.3.13/download" + ], + "strip_prefix": "unicode-bidi-0.3.13", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unicode-bidi-0.3.13.bazel" + } + }, + "cui__gix-traverse-0.33.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "22ef04ab3643acba289b5cedd25d6f53c0430770b1d689d1d654511e6fb81ba0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-traverse/0.33.0/download" + ], + "strip_prefix": "gix-traverse-0.33.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-traverse-0.33.0.bazel" + } + }, + "rules_rust_wasm_bindgen__stable_deref_trait-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/stable_deref_trait/1.2.0/download" + ], + "strip_prefix": "stable_deref_trait-1.2.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.stable_deref_trait-1.2.0.bazel" + } + }, + "rules_rust_proto__ws2_32-sys-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ws2_32-sys/0.2.1/download" + ], + "strip_prefix": "ws2_32-sys-0.2.1", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.ws2_32-sys-0.2.1.bazel" + } + }, + "cui__miniz_oxide-0.7.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/miniz_oxide/0.7.1/download" + ], + "strip_prefix": "miniz_oxide-0.7.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.miniz_oxide-0.7.1.bazel" + } + }, + "rules_rust_bindgen__io-lifetimes-1.0.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/io-lifetimes/1.0.11/download" + ], + "strip_prefix": "io-lifetimes-1.0.11", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.io-lifetimes-1.0.11.bazel" + } + }, + "cui__unic-char-range-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unic-char-range/0.9.0/download" + ], + "strip_prefix": "unic-char-range-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unic-char-range-0.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__leb128-0.2.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/leb128/0.2.5/download" + ], + "strip_prefix": "leb128-0.2.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.leb128-0.2.5.bazel" + } + }, + "rules_rust_wasm_bindgen__predicates-core-1.0.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/predicates-core/1.0.6/download" + ], + "strip_prefix": "predicates-core-1.0.6", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.predicates-core-1.0.6.bazel" + } + }, + "cui__windows_aarch64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_msvc-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_aarch64_msvc-0.48.0.bazel" + } + }, + "cui__anstyle-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle/1.0.1/download" + ], + "strip_prefix": "anstyle-1.0.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.anstyle-1.0.1.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-0.2.91.bazel" + } + }, + "rules_rust_prost__winapi-i686-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-i686-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-i686-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel" + } + }, + "cui__regex-automata-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-automata/0.3.3/download" + ], + "strip_prefix": "regex-automata-0.3.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.regex-automata-0.3.3.bazel" + } + }, + "rrra__windows_aarch64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_msvc-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_aarch64_msvc-0.48.0.bazel" + } + }, + "rules_rust_prost__which-4.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/which/4.4.0/download" + ], + "strip_prefix": "which-4.4.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.which-4.4.0.bazel" + } + }, + "rrra__anstyle-wincon-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-wincon/1.0.1/download" + ], + "strip_prefix": "anstyle-wincon-1.0.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.anstyle-wincon-1.0.1.bazel" + } + }, + "rules_rust_wasm_bindgen__adler-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/adler/1.0.2/download" + ], + "strip_prefix": "adler-1.0.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.adler-1.0.2.bazel" + } + }, + "rules_rust_wasm_bindgen__log-0.4.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.4.19/download" + ], + "strip_prefix": "log-0.4.19", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.log-0.4.19.bazel" + } + }, + "rules_rust_bindgen__heck-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/heck/0.4.1/download" + ], + "strip_prefix": "heck-0.4.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.heck-0.4.1.bazel" + } + }, + "cui__digest-0.10.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/digest/0.10.7/download" + ], + "strip_prefix": "digest-0.10.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.digest-0.10.7.bazel" + } + }, + "cui__equivalent-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/equivalent/1.0.1/download" + ], + "strip_prefix": "equivalent-1.0.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.equivalent-1.0.1.bazel" + } + }, + "cui": { + "bzlFile": "@@rules_rust~//crate_universe/private:crates_vendor.bzl", + "ruleClassName": "crates_vendor_remote_repository", + "attributes": { + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.bazel", + "defs_module": "@@rules_rust~//crate_universe/3rdparty/crates:defs.bzl" + } + }, + "rules_rust_wasm_bindgen__memchr-2.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memchr/2.5.0/download" + ], + "strip_prefix": "memchr-2.5.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.memchr-2.5.0.bazel" + } + }, + "rrra__once_cell-1.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/once_cell/1.18.0/download" + ], + "strip_prefix": "once_cell-1.18.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.once_cell-1.18.0.bazel" + } + }, + "rules_rust_proto__tokio-tls-api-0.1.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "68d0e040d5b1f4cfca70ec4f371229886a5de5bb554d272a4a8da73004a7b2c9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-tls-api/0.1.22/download" + ], + "strip_prefix": "tokio-tls-api-0.1.22", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-tls-api-0.1.22.bazel" + } + }, + "rules_rust_bindgen__is-terminal-0.4.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/is-terminal/0.4.7/download" + ], + "strip_prefix": "is-terminal-0.4.7", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.is-terminal-0.4.7.bazel" + } + }, + "cui__autocfg-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/autocfg/1.1.0/download" + ], + "strip_prefix": "autocfg-1.1.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.autocfg-1.1.0.bazel" + } + }, + "rules_rust_prost__tokio-util-0.7.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-util/0.7.8/download" + ], + "strip_prefix": "tokio-util-0.7.8", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tokio-util-0.7.8.bazel" + } + }, + "rules_rust_prost__tokio-io-timeout-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-io-timeout/1.2.0/download" + ], + "strip_prefix": "tokio-io-timeout-1.2.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tokio-io-timeout-1.2.0.bazel" + } + }, + "cui__num-traits-0.2.15": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-traits/0.2.15/download" + ], + "strip_prefix": "num-traits-0.2.15", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-traits-0.2.15.bazel" + } + }, + "rules_rust_proto__winapi-build-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-build/0.1.1/download" + ], + "strip_prefix": "winapi-build-0.1.1", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.winapi-build-0.1.1.bazel" + } + }, + "rules_rust_wasm_bindgen__base64-0.13.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/base64/0.13.1/download" + ], + "strip_prefix": "base64-0.13.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.base64-0.13.1.bazel" + } + }, + "rules_rust_proto__parking_lot-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parking_lot/0.9.0/download" + ], + "strip_prefix": "parking_lot-0.9.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.parking_lot-0.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__humantime-2.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/humantime/2.1.0/download" + ], + "strip_prefix": "humantime-2.1.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.humantime-2.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__rand_chacha-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_chacha/0.3.1/download" + ], + "strip_prefix": "rand_chacha-0.3.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rand_chacha-0.3.1.bazel" + } + }, + "cui__strsim-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/strsim/0.10.0/download" + ], + "strip_prefix": "strsim-0.10.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.strsim-0.10.0.bazel" + } + }, + "rules_rust_prost__windows_aarch64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_aarch64_gnullvm-0.48.0.bazel" + } + }, + "cui__cfg-if-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-if/1.0.0/download" + ], + "strip_prefix": "cfg-if-1.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cfg-if-1.0.0.bazel" + } + }, + "cui__errno-dragonfly-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno-dragonfly/0.1.2/download" + ], + "strip_prefix": "errno-dragonfly-0.1.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.errno-dragonfly-0.1.2.bazel" + } + }, + "rules_rust_bindgen__regex-syntax-0.7.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-syntax/0.7.2/download" + ], + "strip_prefix": "regex-syntax-0.7.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.regex-syntax-0.7.2.bazel" + } + }, + "cui__proc-macro2-1.0.64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/proc-macro2/1.0.64/download" + ], + "strip_prefix": "proc-macro2-1.0.64", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.proc-macro2-1.0.64.bazel" + } + }, + "cui__gix-prompt-0.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c9a913769516f5e9d937afac206fb76428e3d7238e538845842887fda584678", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-prompt/0.7.0/download" + ], + "strip_prefix": "gix-prompt-0.7.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-prompt-0.7.0.bazel" + } + }, + "cui__thiserror-impl-1.0.50": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/thiserror-impl/1.0.50/download" + ], + "strip_prefix": "thiserror-impl-1.0.50", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.thiserror-impl-1.0.50.bazel" + } + }, + "rules_rust_prost__either-1.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/either/1.8.1/download" + ], + "strip_prefix": "either-1.8.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.either-1.8.1.bazel" + } + }, + "rules_rust_bindgen__bindgen-cli-0.69.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "integrity": "sha256-iFZe4JEQqZ54KZiX+/7VA7mqAwZThu6MGBl/yvIotQE=", + "type": "tar.gz", + "urls": [ + "https://crates.io/api/v1/crates/bindgen-cli/0.69.1/download" + ], + "strip_prefix": "bindgen-cli-0.69.1", + "build_file": "@@rules_rust~//bindgen/3rdparty:BUILD.bindgen-cli.bazel" + } + }, + "cui__thiserror-1.0.50": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/thiserror/1.0.50/download" + ], + "strip_prefix": "thiserror-1.0.50", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.thiserror-1.0.50.bazel" + } + }, + "rules_rust_proto__mio-uds-0.6.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/mio-uds/0.6.8/download" + ], + "strip_prefix": "mio-uds-0.6.8", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.mio-uds-0.6.8.bazel" + } + }, + "rules_rust_proto__tokio-fs-0.1.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-fs/0.1.7/download" + ], + "strip_prefix": "tokio-fs-0.1.7", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-fs-0.1.7.bazel" + } + }, + "rules_rust_bindgen__linux-raw-sys-0.3.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/linux-raw-sys/0.3.8/download" + ], + "strip_prefix": "linux-raw-sys-0.3.8", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.linux-raw-sys-0.3.8.bazel" + } + }, + "rules_rust_wasm_bindgen__regex-automata-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-automata/0.3.3/download" + ], + "strip_prefix": "regex-automata-0.3.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.regex-automata-0.3.3.bazel" + } + }, + "cui__typenum-1.16.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/typenum/1.16.0/download" + ], + "strip_prefix": "typenum-1.16.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.typenum-1.16.0.bazel" + } + }, + "rules_rust_wasm_bindgen__rand-0.8.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand/0.8.5/download" + ], + "strip_prefix": "rand-0.8.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rand-0.8.5.bazel" + } + }, + "cui__errno-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno/0.3.1/download" + ], + "strip_prefix": "errno-0.3.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.errno-0.3.1.bazel" + } + }, + "cui__num-rational-0.1.42": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-rational/0.1.42/download" + ], + "strip_prefix": "num-rational-0.1.42", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-rational-0.1.42.bazel" + } + }, + "rules_rust_wasm_bindgen__difflib-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/difflib/0.4.0/download" + ], + "strip_prefix": "difflib-0.4.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.difflib-0.4.0.bazel" + } + }, + "cui__sha2-0.10.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/sha2/0.10.8/download" + ], + "strip_prefix": "sha2-0.10.8", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.sha2-0.10.8.bazel" + } + }, + "cui__clru-0.6.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clru/0.6.1/download" + ], + "strip_prefix": "clru-0.6.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.clru-0.6.1.bazel" + } + }, + "cui__rand-0.4.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand/0.4.6/download" + ], + "strip_prefix": "rand-0.4.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rand-0.4.6.bazel" + } + }, + "rrra__io-lifetimes-1.0.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/io-lifetimes/1.0.11/download" + ], + "strip_prefix": "io-lifetimes-1.0.11", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.io-lifetimes-1.0.11.bazel" + } + }, + "cui__phf_shared-0.11.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/phf_shared/0.11.2/download" + ], + "strip_prefix": "phf_shared-0.11.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.phf_shared-0.11.2.bazel" + } + }, + "rrra__bitflags-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/1.3.2/download" + ], + "strip_prefix": "bitflags-1.3.2", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.bitflags-1.3.2.bazel" + } + }, + "rules_rust_prost__redox_syscall-0.3.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/redox_syscall/0.3.5/download" + ], + "strip_prefix": "redox_syscall-0.3.5", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.redox_syscall-0.3.5.bazel" + } + }, + "cui__gix-packetline-blocking-0.16.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7d8395f7501c84d6a1fe902035fdfd8cd86d89e2dd6be0200ec1a72fd3c92d39", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-packetline-blocking/0.16.6/download" + ], + "strip_prefix": "gix-packetline-blocking-0.16.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-packetline-blocking-0.16.6.bazel" + } + }, + "rules_rust_proto__fnv-1.0.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fnv/1.0.7/download" + ], + "strip_prefix": "fnv-1.0.7", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.fnv-1.0.7.bazel" + } + }, + "cui__windows_aarch64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_aarch64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_prost__tracing-core-0.1.31": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing-core/0.1.31/download" + ], + "strip_prefix": "tracing-core-0.1.31", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tracing-core-0.1.31.bazel" + } + }, + "rrra__env_logger-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/env_logger/0.10.0/download" + ], + "strip_prefix": "env_logger-0.10.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.env_logger-0.10.0.bazel" + } + }, + "rules_rust_wasm_bindgen__aho-corasick-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/aho-corasick/1.0.2/download" + ], + "strip_prefix": "aho-corasick-1.0.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.aho-corasick-1.0.2.bazel" + } + }, + "cui__time-0.3.30": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/time/0.3.30/download" + ], + "strip_prefix": "time-0.3.30", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.time-0.3.30.bazel" + } + }, + "rules_rust_proto__grpc-0.6.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2aaf1d741fe6f3413f1f9f71b99f5e4e26776d563475a8a53ce53a73a8534c1d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/grpc/0.6.2/download" + ], + "strip_prefix": "grpc-0.6.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.grpc-0.6.2.bazel" + } + }, + "rules_rust_bindgen__unicode-ident-1.0.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-ident/1.0.9/download" + ], + "strip_prefix": "unicode-ident-1.0.9", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.unicode-ident-1.0.9.bazel" + } + }, + "rules_rust_prost__log-0.4.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.4.19/download" + ], + "strip_prefix": "log-0.4.19", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.log-0.4.19.bazel" + } + }, + "cui__ucd-trie-0.1.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ucd-trie/0.1.6/download" + ], + "strip_prefix": "ucd-trie-0.1.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.ucd-trie-0.1.6.bazel" + } + }, + "cui__gix-pack-0.43.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7536203a45b31e1bc5694bbf90ba8da1b736c77040dd6a520db369f371eb1ab3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-pack/0.43.0/download" + ], + "strip_prefix": "gix-pack-0.43.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-pack-0.43.0.bazel" + } + }, + "rules_rust_prost__prettyplease-0.1.25": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/prettyplease/0.1.25/download" + ], + "strip_prefix": "prettyplease-0.1.25", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.prettyplease-0.1.25.bazel" + } + }, + "cui__toml-0.7.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/toml/0.7.6/download" + ], + "strip_prefix": "toml-0.7.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.toml-0.7.6.bazel" + } + }, + "rules_rust_prost__tempfile-3.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tempfile/3.6.0/download" + ], + "strip_prefix": "tempfile-3.6.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tempfile-3.6.0.bazel" + } + }, + "rules_rust_prost__tokio-stream-0.1.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-stream/0.1.14/download" + ], + "strip_prefix": "tokio-stream-0.1.14", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tokio-stream-0.1.14.bazel" + } + }, + "cui__unic-ucd-segment-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unic-ucd-segment/0.9.0/download" + ], + "strip_prefix": "unic-ucd-segment-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unic-ucd-segment-0.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__android-tzdata-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/android-tzdata/0.1.1/download" + ], + "strip_prefix": "android-tzdata-0.1.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.android-tzdata-0.1.1.bazel" + } + }, + "generated_inputs_in_external_repo": { + "bzlFile": "@@rules_rust~//test/generated_inputs:external_repo.bzl", + "ruleClassName": "_generated_inputs_in_external_repo", + "attributes": {} + }, + "cui__gix-submodule-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dd0150e82e9282d3f2ab2dd57a22f9f6c3447b9d9856e5321ac92d38e3e0e2b7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-submodule/0.4.0/download" + ], + "strip_prefix": "gix-submodule-0.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-submodule-0.4.0.bazel" + } + }, + "cui__serde_spanned-0.6.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_spanned/0.6.5/download" + ], + "strip_prefix": "serde_spanned-0.6.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.serde_spanned-0.6.5.bazel" + } + }, + "rules_rust_proto__kernel32-sys-0.2.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/kernel32-sys/0.2.2/download" + ], + "strip_prefix": "kernel32-sys-0.2.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.kernel32-sys-0.2.2.bazel" + } + }, + "rules_rust_prost__mime-0.3.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/mime/0.3.17/download" + ], + "strip_prefix": "mime-0.3.17", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.mime-0.3.17.bazel" + } + }, + "cui__gix-quote-0.4.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "475c86a97dd0127ba4465fbb239abac9ea10e68301470c9791a6dd5351cdc905", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-quote/0.4.7/download" + ], + "strip_prefix": "gix-quote-0.4.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-quote-0.4.7.bazel" + } + }, + "rrra__linux-raw-sys-0.3.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/linux-raw-sys/0.3.8/download" + ], + "strip_prefix": "linux-raw-sys-0.3.8", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.linux-raw-sys-0.3.8.bazel" + } + }, + "cui__memmap2-0.7.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memmap2/0.7.1/download" + ], + "strip_prefix": "memmap2-0.7.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.memmap2-0.7.1.bazel" + } + }, + "rules_rust_proto__tokio-reactor-0.1.12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-reactor/0.1.12/download" + ], + "strip_prefix": "tokio-reactor-0.1.12", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-reactor-0.1.12.bazel" + } + }, + "rules_rust_wasm_bindgen__equivalent-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/equivalent/1.0.1/download" + ], + "strip_prefix": "equivalent-1.0.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.equivalent-1.0.1.bazel" + } + }, + "rules_rust_wasm_bindgen__fallible-iterator-0.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fallible-iterator/0.2.0/download" + ], + "strip_prefix": "fallible-iterator-0.2.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.fallible-iterator-0.2.0.bazel" + } + }, + "cui__pest_derive-2.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pest_derive/2.7.0/download" + ], + "strip_prefix": "pest_derive-2.7.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.pest_derive-2.7.0.bazel" + } + }, + "rules_rust_prost__once_cell-1.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/once_cell/1.18.0/download" + ], + "strip_prefix": "once_cell-1.18.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.once_cell-1.18.0.bazel" + } + }, + "rules_rust_proto__fuchsia-zircon-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fuchsia-zircon/0.3.3/download" + ], + "strip_prefix": "fuchsia-zircon-0.3.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.fuchsia-zircon-0.3.3.bazel" + } + }, + "cui__hermit-abi-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.3.2/download" + ], + "strip_prefix": "hermit-abi-0.3.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.hermit-abi-0.3.2.bazel" + } + }, + "rules_rust_wasm_bindgen__regex-syntax-0.7.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-syntax/0.7.4/download" + ], + "strip_prefix": "regex-syntax-0.7.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.regex-syntax-0.7.4.bazel" + } + }, + "rules_rust_bindgen__errno-dragonfly-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno-dragonfly/0.1.2/download" + ], + "strip_prefix": "errno-dragonfly-0.1.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.errno-dragonfly-0.1.2.bazel" + } + }, + "rules_rust_wasm_bindgen__miniz_oxide-0.7.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/miniz_oxide/0.7.1/download" + ], + "strip_prefix": "miniz_oxide-0.7.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.miniz_oxide-0.7.1.bazel" + } + }, + "rules_rust_bindgen__windows_x86_64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_x86_64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_bindgen__syn-2.0.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/2.0.18/download" + ], + "strip_prefix": "syn-2.0.18", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.syn-2.0.18.bazel" + } + }, + "rules_rust_proto__tokio-io-0.1.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-io/0.1.13/download" + ], + "strip_prefix": "tokio-io-0.1.13", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-io-0.1.13.bazel" + } + }, + "cui__gix-utils-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b85d89dc728613e26e0ed952a19583744e7f5240fcd4aa30d6c824ffd8b52f0f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-utils/0.1.5/download" + ], + "strip_prefix": "gix-utils-0.1.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-utils-0.1.5.bazel" + } + }, + "rules_rust_wasm_bindgen__unicase-2.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicase/2.6.0/download" + ], + "strip_prefix": "unicase-2.6.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.unicase-2.6.0.bazel" + } + }, + "rules_rust_bindgen__cc-1.0.79": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cc/1.0.79/download" + ], + "strip_prefix": "cc-1.0.79", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.cc-1.0.79.bazel" + } + }, + "rrra__unicode-ident-1.0.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-ident/1.0.10/download" + ], + "strip_prefix": "unicode-ident-1.0.10", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.unicode-ident-1.0.10.bazel" + } + }, + "rules_rust_proto__crossbeam-epoch-0.8.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-epoch/0.8.2/download" + ], + "strip_prefix": "crossbeam-epoch-0.8.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.crossbeam-epoch-0.8.2.bazel" + } + }, + "cui__clap_lex-0.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_lex/0.5.0/download" + ], + "strip_prefix": "clap_lex-0.5.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.clap_lex-0.5.0.bazel" + } + }, + "cui__indexmap-2.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/indexmap/2.1.0/download" + ], + "strip_prefix": "indexmap-2.1.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.indexmap-2.1.0.bazel" + } + }, + "cui__hex-0.4.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hex/0.4.3/download" + ], + "strip_prefix": "hex-0.4.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.hex-0.4.3.bazel" + } + }, + "rules_rust_prost__quote-1.0.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/quote/1.0.28/download" + ], + "strip_prefix": "quote-1.0.28", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.quote-1.0.28.bazel" + } + }, + "rules_rust_wasm_bindgen__windows-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows/0.48.0/download" + ], + "strip_prefix": "windows-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows-0.48.0.bazel" + } + }, + "rules_rust_proto__bitflags-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/1.3.2/download" + ], + "strip_prefix": "bitflags-1.3.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.bitflags-1.3.2.bazel" + } + }, + "rules_rust_wasm_bindgen__unicode-normalization-0.1.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-normalization/0.1.22/download" + ], + "strip_prefix": "unicode-normalization-0.1.22", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.unicode-normalization-0.1.22.bazel" + } + }, + "cargo_bazel.buildifier-linux-arm64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildifier-linux-arm64" + ], + "sha256": "c657c628fca72b7e0446f1a542231722a10ba4321597bd6f6249a5da6060b6ff", + "downloaded_file_path": "buildifier.exe", + "executable": true + } + }, + "rules_rust_wasm_bindgen__anyhow-1.0.71": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anyhow/1.0.71/download" + ], + "strip_prefix": "anyhow-1.0.71", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.anyhow-1.0.71.bazel" + } + }, + "rules_rust_bindgen__memchr-2.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memchr/2.5.0/download" + ], + "strip_prefix": "memchr-2.5.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.memchr-2.5.0.bazel" + } + }, + "rules_rust_prost__parking_lot_core-0.9.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parking_lot_core/0.9.8/download" + ], + "strip_prefix": "parking_lot_core-0.9.8", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.parking_lot_core-0.9.8.bazel" + } + }, + "rules_rust_proto__bytes-0.4.12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bytes/0.4.12/download" + ], + "strip_prefix": "bytes-0.4.12", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.bytes-0.4.12.bazel" + } + }, + "cui__iana-time-zone-0.1.57": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/iana-time-zone/0.1.57/download" + ], + "strip_prefix": "iana-time-zone-0.1.57", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.iana-time-zone-0.1.57.bazel" + } + }, + "cui__toml_edit-0.19.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5f8751d9c1b03c6500c387e96f81f815a4f8e72d142d2d4a9ffa6fedd51ddee7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/toml_edit/0.19.13/download" + ], + "strip_prefix": "toml_edit-0.19.13", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.toml_edit-0.19.13.bazel" + } + }, + "rules_rust_prost__matchit-0.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/matchit/0.7.0/download" + ], + "strip_prefix": "matchit-0.7.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.matchit-0.7.0.bazel" + } + }, + "cui__gix-chunk-0.4.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5b42ea64420f7994000130328f3c7a2038f639120518870436d31b8bde704493", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-chunk/0.4.4/download" + ], + "strip_prefix": "gix-chunk-0.4.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-chunk-0.4.4.bazel" + } + }, + "rules_rust_prost__sync_wrapper-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/sync_wrapper/0.1.2/download" + ], + "strip_prefix": "sync_wrapper-0.1.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.sync_wrapper-0.1.2.bazel" + } + }, + "cui__idna-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/idna/0.4.0/download" + ], + "strip_prefix": "idna-0.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.idna-0.4.0.bazel" + } + }, + "cui__wasm-bindgen-macro-support-0.2.87": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-macro-support/0.2.87/download" + ], + "strip_prefix": "wasm-bindgen-macro-support-0.2.87", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.wasm-bindgen-macro-support-0.2.87.bazel" + } + }, + "rules_rust_wasm_bindgen__errno-dragonfly-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno-dragonfly/0.1.2/download" + ], + "strip_prefix": "errno-dragonfly-0.1.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.errno-dragonfly-0.1.2.bazel" + } + }, + "rules_rust_prost__hyper-timeout-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hyper-timeout/0.4.1/download" + ], + "strip_prefix": "hyper-timeout-0.4.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.hyper-timeout-0.4.1.bazel" + } + }, + "rules_rust_bindgen__rustc-hash-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustc-hash/1.1.0/download" + ], + "strip_prefix": "rustc-hash-1.1.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.rustc-hash-1.1.0.bazel" + } + }, + "rules_rust_prost__http-0.2.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/http/0.2.9/download" + ], + "strip_prefix": "http-0.2.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.http-0.2.9.bazel" + } + }, + "cui__crossbeam-epoch-0.9.15": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-epoch/0.9.15/download" + ], + "strip_prefix": "crossbeam-epoch-0.9.15", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crossbeam-epoch-0.9.15.bazel" + } + }, + "cui__gix-config-value-0.14.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ea7505b97f4d8e7933e29735a568ba2f86d8de466669d9f0e8321384f9972f47", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-config-value/0.14.0/download" + ], + "strip_prefix": "gix-config-value-0.14.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-config-value-0.14.0.bazel" + } + }, + "rules_rust_wasm_bindgen__chrono-0.4.26": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/chrono/0.4.26/download" + ], + "strip_prefix": "chrono-0.4.26", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.chrono-0.4.26.bazel" + } + }, + "cui__same-file-1.0.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/same-file/1.0.6/download" + ], + "strip_prefix": "same-file-1.0.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.same-file-1.0.6.bazel" + } + }, + "cui__linux-raw-sys-0.3.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/linux-raw-sys/0.3.8/download" + ], + "strip_prefix": "linux-raw-sys-0.3.8", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.linux-raw-sys-0.3.8.bazel" + } + }, + "rules_rust_bindgen__termcolor-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/termcolor/1.2.0/download" + ], + "strip_prefix": "termcolor-1.2.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.termcolor-1.2.0.bazel" + } + }, + "rules_rust_wasm_bindgen__rand_core-0.6.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_core/0.6.4/download" + ], + "strip_prefix": "rand_core-0.6.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rand_core-0.6.4.bazel" + } + }, + "cui__crossbeam-channel-0.5.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-channel/0.5.8/download" + ], + "strip_prefix": "crossbeam-channel-0.5.8", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crossbeam-channel-0.5.8.bazel" + } + }, + "cui__cc-1.0.79": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cc/1.0.79/download" + ], + "strip_prefix": "cc-1.0.79", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cc-1.0.79.bazel" + } + }, + "rules_rust_prost__rand-0.8.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand/0.8.5/download" + ], + "strip_prefix": "rand-0.8.5", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.rand-0.8.5.bazel" + } + }, + "cui__gix-validate-0.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e05cab2b03a45b866156e052aa38619f4ece4adcb2f79978bfc249bc3b21b8c5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-validate/0.8.0/download" + ], + "strip_prefix": "gix-validate-0.8.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-validate-0.8.0.bazel" + } + }, + "rules_rust_prost__anyhow-1.0.71": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anyhow/1.0.71/download" + ], + "strip_prefix": "anyhow-1.0.71", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.anyhow-1.0.71.bazel" + } + }, + "cui__is-terminal-0.4.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/is-terminal/0.4.7/download" + ], + "strip_prefix": "is-terminal-0.4.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.is-terminal-0.4.7.bazel" + } + }, + "cui__unicode-width-0.1.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-width/0.1.10/download" + ], + "strip_prefix": "unicode-width-0.1.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unicode-width-0.1.10.bazel" + } + }, + "rrra__humantime-2.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/humantime/2.1.0/download" + ], + "strip_prefix": "humantime-2.1.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.humantime-2.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__libc-0.2.150": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libc/0.2.150/download" + ], + "strip_prefix": "libc-0.2.150", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.libc-0.2.150.bazel" + } + }, + "rules_rust_bindgen__env_logger-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/env_logger/0.10.0/download" + ], + "strip_prefix": "env_logger-0.10.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.env_logger-0.10.0.bazel" + } + }, + "cui__toml-0.8.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/toml/0.8.10/download" + ], + "strip_prefix": "toml-0.8.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.toml-0.8.10.bazel" + } + }, + "rules_rust_prost__tracing-attributes-0.1.26": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing-attributes/0.1.26/download" + ], + "strip_prefix": "tracing-attributes-0.1.26", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tracing-attributes-0.1.26.bazel" + } + }, + "rules_rust_prost__instant-0.1.12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/instant/0.1.12/download" + ], + "strip_prefix": "instant-0.1.12", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.instant-0.1.12.bazel" + } + }, + "rules_rust_wasm_bindgen__indexmap-2.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/indexmap/2.0.0/download" + ], + "strip_prefix": "indexmap-2.0.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.indexmap-2.0.0.bazel" + } + }, + "cui__windows_i686_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_gnu/0.48.0/download" + ], + "strip_prefix": "windows_i686_gnu-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_i686_gnu-0.48.0.bazel" + } + }, + "rrra__proc-macro2-1.0.64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/proc-macro2/1.0.64/download" + ], + "strip_prefix": "proc-macro2-1.0.64", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.proc-macro2-1.0.64.bazel" + } + }, + "rules_rust_wasm_bindgen__predicates-tree-1.0.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/predicates-tree/1.0.9/download" + ], + "strip_prefix": "predicates-tree-1.0.9", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.predicates-tree-1.0.9.bazel" + } + }, + "rrra__errno-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno/0.3.1/download" + ], + "strip_prefix": "errno-0.3.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.errno-0.3.1.bazel" + } + }, + "cui__num_threads-0.1.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num_threads/0.1.6/download" + ], + "strip_prefix": "num_threads-0.1.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num_threads-0.1.6.bazel" + } + }, + "cui__arc-swap-1.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/arc-swap/1.6.0/download" + ], + "strip_prefix": "arc-swap-1.6.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.arc-swap-1.6.0.bazel" + } + }, + "rules_rust_proto__tokio-uds-0.2.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-uds/0.2.7/download" + ], + "strip_prefix": "tokio-uds-0.2.7", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-uds-0.2.7.bazel" + } + }, + "rules_rust_wasm_bindgen__webpki-roots-0.25.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/webpki-roots/0.25.2/download" + ], + "strip_prefix": "webpki-roots-0.25.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.webpki-roots-0.25.2.bazel" + } + }, + "cui__gix-features-0.35.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9b9ff423ae4983f762659040d13dd7a5defbd54b6a04ac3cc7347741cec828cd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-features/0.35.0/download" + ], + "strip_prefix": "gix-features-0.35.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-features-0.35.0.bazel" + } + }, + "cui__lock_api-0.4.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lock_api/0.4.11/download" + ], + "strip_prefix": "lock_api-0.4.11", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.lock_api-0.4.11.bazel" + } + }, + "cui__android-tzdata-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/android-tzdata/0.1.1/download" + ], + "strip_prefix": "android-tzdata-0.1.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.android-tzdata-0.1.1.bazel" + } + }, + "rules_rust_wasm_bindgen__winapi-i686-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-i686-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-i686-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel" + } + }, + "rules_rust_prost__futures-task-0.3.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-task/0.3.28/download" + ], + "strip_prefix": "futures-task-0.3.28", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.futures-task-0.3.28.bazel" + } + }, + "cui__serde-1.0.190": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde/1.0.190/download" + ], + "strip_prefix": "serde-1.0.190", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.serde-1.0.190.bazel" + } + }, + "rules_rust_wasm_bindgen__ascii-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ascii/1.1.0/download" + ], + "strip_prefix": "ascii-1.1.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.ascii-1.1.0.bazel" + } + }, + "rules_rust_prost__prost-types-0.11.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/prost-types/0.11.9/download" + ], + "strip_prefix": "prost-types-0.11.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.prost-types-0.11.9.bazel" + } + }, + "rules_rust_wasm_bindgen__bstr-0.2.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bstr/0.2.17/download" + ], + "strip_prefix": "bstr-0.2.17", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.bstr-0.2.17.bazel" + } + }, + "rules_rust_proto__rustc_version-0.2.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustc_version/0.2.3/download" + ], + "strip_prefix": "rustc_version-0.2.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.rustc_version-0.2.3.bazel" + } + }, + "cui__aho-corasick-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/aho-corasick/1.0.2/download" + ], + "strip_prefix": "aho-corasick-1.0.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.aho-corasick-1.0.2.bazel" + } + }, + "rules_rust_wasm_bindgen__tinyvec-1.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tinyvec/1.6.0/download" + ], + "strip_prefix": "tinyvec-1.6.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.tinyvec-1.6.0.bazel" + } + }, + "rules_rust_bindgen__windows_x86_64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_msvc-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_x86_64_msvc-0.48.0.bazel" + } + }, + "rules_rust_proto__winapi-x86_64-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-x86_64-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel" + } + }, + "cui__winnow-0.5.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winnow/0.5.18/download" + ], + "strip_prefix": "winnow-0.5.18", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.winnow-0.5.18.bazel" + } + }, + "rules_rust_wasm_bindgen__crossbeam-utils-0.8.16": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-utils/0.8.16/download" + ], + "strip_prefix": "crossbeam-utils-0.8.16", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.crossbeam-utils-0.8.16.bazel" + } + }, + "cui__memchr-2.6.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memchr/2.6.4/download" + ], + "strip_prefix": "memchr-2.6.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.memchr-2.6.4.bazel" + } + }, + "rrra__serde_derive-1.0.171": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_derive/1.0.171/download" + ], + "strip_prefix": "serde_derive-1.0.171", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.serde_derive-1.0.171.bazel" + } + }, + "cui__bitflags-2.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/2.4.1/download" + ], + "strip_prefix": "bitflags-2.4.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.bitflags-2.4.1.bazel" + } + }, + "rrra__windows_aarch64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_aarch64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_prost__pin-project-lite-0.2.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pin-project-lite/0.2.9/download" + ], + "strip_prefix": "pin-project-lite-0.2.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.pin-project-lite-0.2.9.bazel" + } + }, + "rules_rust_proto__void-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/void/1.0.2/download" + ], + "strip_prefix": "void-1.0.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.void-1.0.2.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "806a045c4ec4ef7c3ad86dc27bcb641b84d9eeb3846200f56d7ab0885241d654", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-cli-support/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-cli-support-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-cli-support-0.2.91.bazel" + } + }, + "rules_rust_prost__regex-syntax-0.7.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-syntax/0.7.2/download" + ], + "strip_prefix": "regex-syntax-0.7.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.regex-syntax-0.7.2.bazel" + } + }, + "cui__pest_generator-2.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pest_generator/2.7.0/download" + ], + "strip_prefix": "pest_generator-2.7.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.pest_generator-2.7.0.bazel" + } + }, + "cui__chrono-tz-0.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e23185c0e21df6ed832a12e2bda87c7d1def6842881fb634a8511ced741b0d76", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/chrono-tz/0.8.4/download" + ], + "strip_prefix": "chrono-tz-0.8.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.chrono-tz-0.8.4.bazel" + } + }, + "cross_x86_64-pc-windows-msvc": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-pc-windows-msvc.tar.gz" + ], + "sha256": "3af59ff5a2229f92b54df937c50a9a88c96dffc8ac3dde520a38fdf046d656c4", + "build_file_content": "exports_files(glob([\"**\"]), visibility = [\"//visibility:public\"])" + } + }, + "rules_rust_prost__heck": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8", + "type": "tar.gz", + "urls": [ + "https://crates.io/api/v1/crates/heck/0.4.1/download" + ], + "strip_prefix": "heck-0.4.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.heck-0.4.1.bazel" + } + }, + "rules_rust_prost__prost-build-0.11.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/prost-build/0.11.9/download" + ], + "strip_prefix": "prost-build-0.11.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.prost-build-0.11.9.bazel" + } + }, + "cui__gix-discover-0.25.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "69507643d75a0ea9a402fcf73ced517d2b95cc95385904ac09d03e0b952fde33", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-discover/0.25.0/download" + ], + "strip_prefix": "gix-discover-0.25.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-discover-0.25.0.bazel" + } + }, + "rules_rust_proto__libc-0.2.139": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libc/0.2.139/download" + ], + "strip_prefix": "libc-0.2.139", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.libc-0.2.139.bazel" + } + }, + "cui__unic-common-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unic-common/0.9.0/download" + ], + "strip_prefix": "unic-common-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unic-common-0.9.0.bazel" + } + }, + "rules_rust_prost__tower-0.4.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tower/0.4.13/download" + ], + "strip_prefix": "tower-0.4.13", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tower-0.4.13.bazel" + } + }, + "rules_rust_wasm_bindgen__bitflags-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/1.3.2/download" + ], + "strip_prefix": "bitflags-1.3.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.bitflags-1.3.2.bazel" + } + }, + "cui__utf8parse-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/utf8parse/0.2.1/download" + ], + "strip_prefix": "utf8parse-0.2.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.utf8parse-0.2.1.bazel" + } + }, + "rules_rust_tinyjson": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9ab95735ea2c8fd51154d01e39cf13912a78071c2d89abc49a7ef102a7dd725a", + "url": "https://crates.io/api/v1/crates/tinyjson/2.5.1/download", + "strip_prefix": "tinyjson-2.5.1", + "type": "tar.gz", + "build_file": "@@rules_rust~//util/process_wrapper:BUILD.tinyjson.bazel" + } + }, + "rules_rust_wasm_bindgen__bumpalo-3.13.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bumpalo/3.13.0/download" + ], + "strip_prefix": "bumpalo-3.13.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.bumpalo-3.13.0.bazel" + } + }, + "cui__pin-project-lite-0.2.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pin-project-lite/0.2.13/download" + ], + "strip_prefix": "pin-project-lite-0.2.13", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.pin-project-lite-0.2.13.bazel" + } + }, + "cui__generic-array-0.14.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/generic-array/0.14.7/download" + ], + "strip_prefix": "generic-array-0.14.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.generic-array-0.14.7.bazel" + } + }, + "cross_x86_64-unknown-linux-gnu": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/rust-embedded/cross/releases/download/v0.2.1/cross-v0.2.1-x86_64-unknown-linux-gnu.tar.gz" + ], + "sha256": "06dcce3248488e95fbb368d14bef17fa8e77461d5055fbd5193538574820f413", + "build_file_content": "exports_files(glob([\"**\"]), visibility = [\"//visibility:public\"])" + } + }, + "rules_rust_proto__tokio-codec-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-codec/0.1.2/download" + ], + "strip_prefix": "tokio-codec-0.1.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-codec-0.1.2.bazel" + } + }, + "rules_rust_wasm_bindgen__ureq-2.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ureq/2.8.0/download" + ], + "strip_prefix": "ureq-2.8.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.ureq-2.8.0.bazel" + } + }, + "cui__parking_lot_core-0.9.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parking_lot_core/0.9.9/download" + ], + "strip_prefix": "parking_lot_core-0.9.9", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.parking_lot_core-0.9.9.bazel" + } + }, + "cui__core-foundation-sys-0.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/core-foundation-sys/0.8.4/download" + ], + "strip_prefix": "core-foundation-sys-0.8.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.core-foundation-sys-0.8.4.bazel" + } + }, + "rrra__quote-1.0.29": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/quote/1.0.29/download" + ], + "strip_prefix": "quote-1.0.29", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.quote-1.0.29.bazel" + } + }, + "rules_rust_proto__protobuf-2.8.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "patch_args": [ + "-p1" + ], + "patches": [ + "@@rules_rust~//proto/protobuf/3rdparty/patches:protobuf-2.8.2.patch" + ], + "sha256": "70731852eec72c56d11226c8a5f96ad5058a3dab73647ca5f7ee351e464f2571", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/protobuf/2.8.2/download" + ], + "strip_prefix": "protobuf-2.8.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.protobuf-2.8.2.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-shared/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-shared-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-shared-0.2.91.bazel" + } + }, + "rules_rust_wasm_bindgen__httpdate-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/httpdate/1.0.2/download" + ], + "strip_prefix": "httpdate-1.0.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.httpdate-1.0.2.bazel" + } + }, + "cui__gix-object-0.37.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1e7e19616c67967374137bae83e950e9b518a9ea8a605069bd6716ada357fd6f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-object/0.37.0/download" + ], + "strip_prefix": "gix-object-0.37.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-object-0.37.0.bazel" + } + }, + "cui__crossbeam-queue-0.3.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-queue/0.3.8/download" + ], + "strip_prefix": "crossbeam-queue-0.3.8", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crossbeam-queue-0.3.8.bazel" + } + }, + "rules_rust_wasm_bindgen__iana-time-zone-0.1.57": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/iana-time-zone/0.1.57/download" + ], + "strip_prefix": "iana-time-zone-0.1.57", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.iana-time-zone-0.1.57.bazel" + } + }, + "rules_rust_bindgen__winapi-x86_64-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-x86_64-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel" + } + }, + "cui__deunicode-0.4.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/deunicode/0.4.3/download" + ], + "strip_prefix": "deunicode-0.4.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.deunicode-0.4.3.bazel" + } + }, + "cui__wasm-bindgen-macro-0.2.87": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-macro/0.2.87/download" + ], + "strip_prefix": "wasm-bindgen-macro-0.2.87", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.wasm-bindgen-macro-0.2.87.bazel" + } + }, + "rules_rust_prost__pin-utils-0.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pin-utils/0.1.0/download" + ], + "strip_prefix": "pin-utils-0.1.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.pin-utils-0.1.0.bazel" + } + }, + "cui__gix-hashtable-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "409268480841ad008e81c17ca5a293393fbf9f2b6c2f85b8ab9de1f0c5176a16", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-hashtable/0.4.0/download" + ], + "strip_prefix": "gix-hashtable-0.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-hashtable-0.4.0.bazel" + } + }, + "rules_rust_bindgen__errno-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno/0.3.1/download" + ], + "strip_prefix": "errno-0.3.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.errno-0.3.1.bazel" + } + }, + "cui__fnv-1.0.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fnv/1.0.7/download" + ], + "strip_prefix": "fnv-1.0.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.fnv-1.0.7.bazel" + } + }, + "cui__js-sys-0.3.64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/js-sys/0.3.64/download" + ], + "strip_prefix": "js-sys-0.3.64", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.js-sys-0.3.64.bazel" + } + }, + "rules_rust_toolchain_test_target_json": { + "bzlFile": "@@rules_rust~//test/unit/toolchain:toolchain_test_utils.bzl", + "ruleClassName": "rules_rust_toolchain_test_target_json_repository", + "attributes": { + "target_json": "@@rules_rust~//test/unit/toolchain:toolchain-test-triple.json" + } + }, + "rules_rust_bindgen__once_cell-1.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/once_cell/1.18.0/download" + ], + "strip_prefix": "once_cell-1.18.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.once_cell-1.18.0.bazel" + } + }, + "rules_rust_prost__prost-0.11.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/prost/0.11.9/download" + ], + "strip_prefix": "prost-0.11.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.prost-0.11.9.bazel" + } + }, + "rules_rust_proto__slab-0.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/slab/0.3.0/download" + ], + "strip_prefix": "slab-0.3.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.slab-0.3.0.bazel" + } + }, + "rules_rust_prost__rand_core-0.6.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_core/0.6.4/download" + ], + "strip_prefix": "rand_core-0.6.4", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.rand_core-0.6.4.bazel" + } + }, + "rules_rust_bindgen__bitflags-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bitflags/1.3.2/download" + ], + "strip_prefix": "bitflags-1.3.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.bitflags-1.3.2.bazel" + } + }, + "cui__wasi-0.11.0-wasi-snapshot-preview1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasi/0.11.0+wasi-snapshot-preview1/download" + ], + "strip_prefix": "wasi-0.11.0+wasi-snapshot-preview1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel" + } + }, + "rules_rust_bindgen__windows_i686_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_gnu/0.48.0/download" + ], + "strip_prefix": "windows_i686_gnu-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_i686_gnu-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__alloc-no-stdlib-2.0.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/alloc-no-stdlib/2.0.4/download" + ], + "strip_prefix": "alloc-no-stdlib-2.0.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.alloc-no-stdlib-2.0.4.bazel" + } + }, + "rules_rust_wasm_bindgen__env_logger-0.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/env_logger/0.8.4/download" + ], + "strip_prefix": "env_logger-0.8.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.env_logger-0.8.4.bazel" + } + }, + "cui__smol_str-0.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/smol_str/0.2.0/download" + ], + "strip_prefix": "smol_str-0.2.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.smol_str-0.2.0.bazel" + } + }, + "cui__memoffset-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memoffset/0.9.0/download" + ], + "strip_prefix": "memoffset-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.memoffset-0.9.0.bazel" + } + }, + "cui__log-0.4.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.4.19/download" + ], + "strip_prefix": "log-0.4.19", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.log-0.4.19.bazel" + } + }, + "cui__wasm-bindgen-backend-0.2.87": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-backend/0.2.87/download" + ], + "strip_prefix": "wasm-bindgen-backend-0.2.87", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.wasm-bindgen-backend-0.2.87.bazel" + } + }, + "cui__pest-2.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pest/2.7.0/download" + ], + "strip_prefix": "pest-2.7.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.pest-2.7.0.bazel" + } + }, + "rules_rust_wasm_bindgen__docopt-1.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7f3f119846c823f9eafcf953a8f6ffb6ed69bf6240883261a7f13b634579a51f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/docopt/1.1.1/download" + ], + "strip_prefix": "docopt-1.1.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.docopt-1.1.1.bazel" + } + }, + "rules_rust_wasm_bindgen__rustc-demangle-0.1.23": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustc-demangle/0.1.23/download" + ], + "strip_prefix": "rustc-demangle-0.1.23", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rustc-demangle-0.1.23.bazel" + } + }, + "rules_rust_prost__rand_chacha-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_chacha/0.3.1/download" + ], + "strip_prefix": "rand_chacha-0.3.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.rand_chacha-0.3.1.bazel" + } + }, + "cui__syn-1.0.109": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/1.0.109/download" + ], + "strip_prefix": "syn-1.0.109", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.syn-1.0.109.bazel" + } + }, + "cui__pathdiff-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pathdiff/0.2.1/download" + ], + "strip_prefix": "pathdiff-0.2.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.pathdiff-0.2.1.bazel" + } + }, + "cargo_bazel.buildifier-linux-amd64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildifier-linux-amd64" + ], + "sha256": "3ed7358c7c6a1ca216dc566e9054fd0b97a1482cb0b7e61092be887d42615c5d", + "downloaded_file_path": "buildifier.exe", + "executable": true + } + }, + "rules_rust_wasm_bindgen__either-1.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/either/1.8.1/download" + ], + "strip_prefix": "either-1.8.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.either-1.8.1.bazel" + } + }, + "rules_rust_prost__windows_aarch64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_msvc-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_aarch64_msvc-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__crc32fast-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crc32fast/1.3.2/download" + ], + "strip_prefix": "crc32fast-1.3.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.crc32fast-1.3.2.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-backend-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-backend/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-backend-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-backend-0.2.91.bazel" + } + }, + "cui__encoding_rs-0.8.33": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/encoding_rs/0.8.33/download" + ], + "strip_prefix": "encoding_rs-0.8.33", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.encoding_rs-0.8.33.bazel" + } + }, + "rules_rust_prost__windows_i686_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_msvc/0.48.0/download" + ], + "strip_prefix": "windows_i686_msvc-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_i686_msvc-0.48.0.bazel" + } + }, + "rules_rust_proto__hermit-abi-0.2.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.2.6/download" + ], + "strip_prefix": "hermit-abi-0.2.6", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.hermit-abi-0.2.6.bazel" + } + }, + "rules_rust_prost__want-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/want/0.3.1/download" + ], + "strip_prefix": "want-0.3.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.want-0.3.1.bazel" + } + }, + "cui__gix-glob-0.13.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a9d76e85f11251dcf751d2c5e918a14f562db5be6f727fd24775245653e9b19d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-glob/0.13.0/download" + ], + "strip_prefix": "gix-glob-0.13.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-glob-0.13.0.bazel" + } + }, + "rules_rust_proto__tokio-timer-0.2.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-timer/0.2.13/download" + ], + "strip_prefix": "tokio-timer-0.2.13", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-timer-0.2.13.bazel" + } + }, + "cui__itoa-1.0.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itoa/1.0.8/download" + ], + "strip_prefix": "itoa-1.0.8", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.itoa-1.0.8.bazel" + } + }, + "rules_rust_proto__cloudabi-0.0.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cloudabi/0.0.3/download" + ], + "strip_prefix": "cloudabi-0.0.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.cloudabi-0.0.3.bazel" + } + }, + "cui__serde_json-1.0.108": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_json/1.0.108/download" + ], + "strip_prefix": "serde_json-1.0.108", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.serde_json-1.0.108.bazel" + } + }, + "rules_rust_bindgen__log-0.4.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.4.19/download" + ], + "strip_prefix": "log-0.4.19", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.log-0.4.19.bazel" + } + }, + "rules_rust_wasm_bindgen__termcolor-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/termcolor/1.2.0/download" + ], + "strip_prefix": "termcolor-1.2.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.termcolor-1.2.0.bazel" + } + }, + "rules_rust_wasm_bindgen__hermit-abi-0.1.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.1.19/download" + ], + "strip_prefix": "hermit-abi-0.1.19", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.hermit-abi-0.1.19.bazel" + } + }, + "cui__bstr-1.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/bstr/1.6.0/download" + ], + "strip_prefix": "bstr-1.6.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.bstr-1.6.0.bazel" + } + }, + "cui__gix-diff-0.36.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "788ddb152c388206e81f36bcbb574e7ed7827c27d8fa62227b34edc333d8928c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-diff/0.36.0/download" + ], + "strip_prefix": "gix-diff-0.36.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-diff-0.36.0.bazel" + } + }, + "cui__gix-index-0.25.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f54d63a9d13c13088f41f5a3accbec284e492ac8f4f707fcc307c139622e17b7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-index/0.25.0/download" + ], + "strip_prefix": "gix-index-0.25.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-index-0.25.0.bazel" + } + }, + "rules_rust_prost__windows_i686_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_gnu/0.48.0/download" + ], + "strip_prefix": "windows_i686_gnu-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_i686_gnu-0.48.0.bazel" + } + }, + "rules_rust_proto__lock_api-0.3.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lock_api/0.3.4/download" + ], + "strip_prefix": "lock_api-0.3.4", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.lock_api-0.3.4.bazel" + } + }, + "cui__filetime-0.2.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/filetime/0.2.22/download" + ], + "strip_prefix": "filetime-0.2.22", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.filetime-0.2.22.bazel" + } + }, + "cui__tracing-log-0.1.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing-log/0.1.4/download" + ], + "strip_prefix": "tracing-log-0.1.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tracing-log-0.1.4.bazel" + } + }, + "cui__rustix-0.38.21": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustix/0.38.21/download" + ], + "strip_prefix": "rustix-0.38.21", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rustix-0.38.21.bazel" + } + }, + "cui__indoc-2.0.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/indoc/2.0.4/download" + ], + "strip_prefix": "indoc-2.0.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.indoc-2.0.4.bazel" + } + }, + "cui__unicode-bom-2.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "98e90c70c9f0d4d1ee6d0a7d04aa06cb9bbd53d8cfbdd62a0269a7c2eb640552", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-bom/2.0.2/download" + ], + "strip_prefix": "unicode-bom-2.0.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unicode-bom-2.0.2.bazel" + } + }, + "cui__smallvec-1.11.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/smallvec/1.11.0/download" + ], + "strip_prefix": "smallvec-1.11.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.smallvec-1.11.0.bazel" + } + }, + "rules_rust_wasm_bindgen__redox_syscall-0.3.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/redox_syscall/0.3.5/download" + ], + "strip_prefix": "redox_syscall-0.3.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.redox_syscall-0.3.5.bazel" + } + }, + "cui__ignore-0.4.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ignore/0.4.18/download" + ], + "strip_prefix": "ignore-0.4.18", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.ignore-0.4.18.bazel" + } + }, + "cui__textwrap-0.16.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/textwrap/0.16.0/download" + ], + "strip_prefix": "textwrap-0.16.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.textwrap-0.16.0.bazel" + } + }, + "rules_rust_bindgen__winapi-i686-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-i686-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-i686-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-wasm-conventions-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4e6b653f6820409609bda0f176e6949302307af7a7b9479cd4d4b1bdc31eb9cd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-wasm-conventions/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-wasm-conventions-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-wasm-conventions-0.2.91.bazel" + } + }, + "cui__valuable-0.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/valuable/0.1.0/download" + ], + "strip_prefix": "valuable-0.1.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.valuable-0.1.0.bazel" + } + }, + "rules_rust_wasm_bindgen__form_urlencoded-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/form_urlencoded/1.2.0/download" + ], + "strip_prefix": "form_urlencoded-1.2.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.form_urlencoded-1.2.0.bazel" + } + }, + "rules_rust_proto__cfg-if-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-if/1.0.0/download" + ], + "strip_prefix": "cfg-if-1.0.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.cfg-if-1.0.0.bazel" + } + }, + "rules_rust_proto__tokio-core-0.1.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-core/0.1.18/download" + ], + "strip_prefix": "tokio-core-0.1.18", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-core-0.1.18.bazel" + } + }, + "rules_rust_prost__prost-derive-0.11.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/prost-derive/0.11.9/download" + ], + "strip_prefix": "prost-derive-0.11.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.prost-derive-0.11.9.bazel" + } + }, + "cui__wasm-bindgen-shared-0.2.87": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-shared/0.2.87/download" + ], + "strip_prefix": "wasm-bindgen-shared-0.2.87", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.wasm-bindgen-shared-0.2.87.bazel" + } + }, + "rules_rust_proto__crossbeam-utils-0.7.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-utils/0.7.2/download" + ], + "strip_prefix": "crossbeam-utils-0.7.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.crossbeam-utils-0.7.2.bazel" + } + }, + "cui__spectral-0.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ae3c15181f4b14e52eeaac3efaeec4d2764716ce9c86da0c934c3e318649c5ba", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/spectral/0.6.0/download" + ], + "strip_prefix": "spectral-0.6.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.spectral-0.6.0.bazel" + } + }, + "rules_rust_wasm_bindgen__float-cmp-0.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/float-cmp/0.8.0/download" + ], + "strip_prefix": "float-cmp-0.8.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.float-cmp-0.8.0.bazel" + } + }, + "cui__gix-tempfile-10.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5ae0978f3e11dc57290ee75ac2477c815bca1ce2fa7ed5dc5f16db067410ac4d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-tempfile/10.0.0/download" + ], + "strip_prefix": "gix-tempfile-10.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-tempfile-10.0.0.bazel" + } + }, + "rules_rust_prost__tower-layer-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tower-layer/0.3.2/download" + ], + "strip_prefix": "tower-layer-0.3.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tower-layer-0.3.2.bazel" + } + }, + "cui__cfg-expr-0.15.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-expr/0.15.5/download" + ], + "strip_prefix": "cfg-expr-0.15.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cfg-expr-0.15.5.bazel" + } + }, + "cui__prodash-26.2.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "794b5bf8e2d19b53dcdcec3e4bba628e20f5b6062503ba89281fa7037dd7bbcf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/prodash/26.2.2/download" + ], + "strip_prefix": "prodash-26.2.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.prodash-26.2.2.bazel" + } + }, + "cui__winapi-i686-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-i686-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-i686-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel" + } + }, + "cui__gix-0.54.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ad6d32e74454459690d57d18ea4ebec1629936e6b130b51d12cb4a81630ac953", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix/0.54.1/download" + ], + "strip_prefix": "gix-0.54.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-0.54.1.bazel" + } + }, + "cui__gix-command-0.2.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3c576cfbf577f72c097b5f88aedea502cd62952bdc1fb3adcab4531d5525a4c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-command/0.2.10/download" + ], + "strip_prefix": "gix-command-0.2.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-command-0.2.10.bazel" + } + }, + "rules_rust_wasm_bindgen__tinyvec_macros-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tinyvec_macros/0.1.1/download" + ], + "strip_prefix": "tinyvec_macros-0.1.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.tinyvec_macros-0.1.1.bazel" + } + }, + "cui__gix-odb-0.53.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8d6a392c6ba3a2f133cdc63120e9bc7aec81eef763db372c817de31febfe64bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-odb/0.53.0/download" + ], + "strip_prefix": "gix-odb-0.53.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-odb-0.53.0.bazel" + } + }, + "rules_rust_bindgen__rustix-0.37.20": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustix/0.37.20/download" + ], + "strip_prefix": "rustix-0.37.20", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.rustix-0.37.20.bazel" + } + }, + "rules_rust_bindgen__windows_i686_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_msvc/0.48.0/download" + ], + "strip_prefix": "windows_i686_msvc-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_i686_msvc-0.48.0.bazel" + } + }, + "rules_rust_bindgen__clap_builder-4.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_builder/4.3.3/download" + ], + "strip_prefix": "clap_builder-4.3.3", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.clap_builder-4.3.3.bazel" + } + }, + "rules_rust_wasm_bindgen_cli": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "80b674e1bda34888e132276ba600676cea158bdcd289bb7da5c25885f1a3a535", + "urls": [ + "https://crates.io/api/v1/crates/wasm-bindgen-cli/0.2.91/download" + ], + "type": "tar.gz", + "strip_prefix": "wasm-bindgen-cli-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty:BUILD.wasm-bindgen-cli.bazel", + "patch_args": [ + "-p1" + ], + "patches": [ + "@@rules_rust~//wasm_bindgen/3rdparty/patches:resolver.patch" + ] + } + }, + "rules_rust_proto__tokio-threadpool-0.1.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-threadpool/0.1.18/download" + ], + "strip_prefix": "tokio-threadpool-0.1.18", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-threadpool-0.1.18.bazel" + } + }, + "rules_rust_bindgen__annotate-snippets-0.9.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c3b9d411ecbaf79885c6df4d75fff75858d5995ff25385657a28af47e82f9c36", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/annotate-snippets/0.9.1/download" + ], + "strip_prefix": "annotate-snippets-0.9.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.annotate-snippets-0.9.1.bazel" + } + }, + "rules_rust_wasm_bindgen__httparse-1.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/httparse/1.8.0/download" + ], + "strip_prefix": "httparse-1.8.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.httparse-1.8.0.bazel" + } + }, + "cui__powerfmt-0.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/powerfmt/0.2.0/download" + ], + "strip_prefix": "powerfmt-0.2.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.powerfmt-0.2.0.bazel" + } + }, + "rrra__strsim-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/strsim/0.10.0/download" + ], + "strip_prefix": "strsim-0.10.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.strsim-0.10.0.bazel" + } + }, + "rules_rust_prost__tonic-0.9.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tonic/0.9.2/download" + ], + "strip_prefix": "tonic-0.9.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tonic-0.9.2.bazel" + } + }, + "rules_rust_prost__async-trait-0.1.68": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/async-trait/0.1.68/download" + ], + "strip_prefix": "async-trait-0.1.68", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.async-trait-0.1.68.bazel" + } + }, + "rules_rust_wasm_bindgen__brotli-decompressor-2.5.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4e2e4afe60d7dd600fdd3de8d0f08c2b7ec039712e3b6137ff98b7004e82de4f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/brotli-decompressor/2.5.1/download" + ], + "strip_prefix": "brotli-decompressor-2.5.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.brotli-decompressor-2.5.1.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_x86_64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_msvc-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_x86_64_msvc-0.48.0.bazel" + } + }, + "cui__unicode-normalization-0.1.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-normalization/0.1.22/download" + ], + "strip_prefix": "unicode-normalization-0.1.22", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unicode-normalization-0.1.22.bazel" + } + }, + "rules_rust_prost__windows_x86_64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_msvc-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_x86_64_msvc-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__idna-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/idna/0.4.0/download" + ], + "strip_prefix": "idna-0.4.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.idna-0.4.0.bazel" + } + }, + "rrra__regex-1.9.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex/1.9.1/download" + ], + "strip_prefix": "regex-1.9.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.regex-1.9.1.bazel" + } + }, + "cui__anstyle-parse-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-parse/0.2.1/download" + ], + "strip_prefix": "anstyle-parse-0.2.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.anstyle-parse-0.2.1.bazel" + } + }, + "rules_rust_wasm_bindgen__wait-timeout-0.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wait-timeout/0.2.0/download" + ], + "strip_prefix": "wait-timeout-0.2.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wait-timeout-0.2.0.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_aarch64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_aarch64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__quick-error-1.2.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/quick-error/1.2.3/download" + ], + "strip_prefix": "quick-error-1.2.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.quick-error-1.2.3.bazel" + } + }, + "rules_rust_bindgen__winapi-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.3.9/download" + ], + "strip_prefix": "winapi-0.3.9", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.winapi-0.3.9.bazel" + } + }, + "rules_rust_wasm_bindgen__core-foundation-sys-0.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/core-foundation-sys/0.8.4/download" + ], + "strip_prefix": "core-foundation-sys-0.8.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.core-foundation-sys-0.8.4.bazel" + } + }, + "rules_rust_prost__futures-core-0.3.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-core/0.3.28/download" + ], + "strip_prefix": "futures-core-0.3.28", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.futures-core-0.3.28.bazel" + } + }, + "rrra__winapi-x86_64-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-x86_64-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel" + } + }, + "rrra__anstyle-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle/1.0.1/download" + ], + "strip_prefix": "anstyle-1.0.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.anstyle-1.0.1.bazel" + } + }, + "cui__dunce-1.0.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/dunce/1.0.4/download" + ], + "strip_prefix": "dunce-1.0.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.dunce-1.0.4.bazel" + } + }, + "cui__phf_generator-0.11.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/phf_generator/0.11.2/download" + ], + "strip_prefix": "phf_generator-0.11.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.phf_generator-0.11.2.bazel" + } + }, + "rules_rust_prost__fastrand-1.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/fastrand/1.9.0/download" + ], + "strip_prefix": "fastrand-1.9.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.fastrand-1.9.0.bazel" + } + }, + "rules_rust_bindgen__windows_x86_64_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnu/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnu-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_x86_64_gnu-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__memoffset-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memoffset/0.9.0/download" + ], + "strip_prefix": "memoffset-0.9.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.memoffset-0.9.0.bazel" + } + }, + "rules_rust_bindgen__windows-targets-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-targets/0.48.0/download" + ], + "strip_prefix": "windows-targets-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows-targets-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__twoway-0.1.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/twoway/0.1.8/download" + ], + "strip_prefix": "twoway-0.1.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.twoway-0.1.8.bazel" + } + }, + "rules_rust_wasm_bindgen__linux-raw-sys-0.3.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/linux-raw-sys/0.3.8/download" + ], + "strip_prefix": "linux-raw-sys-0.3.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.linux-raw-sys-0.3.8.bazel" + } + }, + "cui__quote-1.0.29": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/quote/1.0.29/download" + ], + "strip_prefix": "quote-1.0.29", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.quote-1.0.29.bazel" + } + }, + "rules_rust_wasm_bindgen__safemem-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/safemem/0.3.3/download" + ], + "strip_prefix": "safemem-0.3.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.safemem-0.3.3.bazel" + } + }, + "rules_rust_wasm_bindgen__assert_cmd-1.0.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/assert_cmd/1.0.8/download" + ], + "strip_prefix": "assert_cmd-1.0.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.assert_cmd-1.0.8.bazel" + } + }, + "cui__serde_starlark-0.1.14": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "29675b116dd4c7ab4012e00e71f6dee9ed8c731108468b4434779c6b9eec7957", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_starlark/0.1.14/download" + ], + "strip_prefix": "serde_starlark-0.1.14", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.serde_starlark-0.1.14.bazel" + } + }, + "cui__ppv-lite86-0.2.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ppv-lite86/0.2.17/download" + ], + "strip_prefix": "ppv-lite86-0.2.17", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.ppv-lite86-0.2.17.bazel" + } + }, + "cui__rand_core-0.6.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_core/0.6.4/download" + ], + "strip_prefix": "rand_core-0.6.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rand_core-0.6.4.bazel" + } + }, + "rules_rust_prost__wasi-0.11.0-wasi-snapshot-preview1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasi/0.11.0+wasi-snapshot-preview1/download" + ], + "strip_prefix": "wasi-0.11.0+wasi-snapshot-preview1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.wasi-0.11.0+wasi-snapshot-preview1.bazel" + } + }, + "rules_rust_wasm_bindgen__rustix-0.37.23": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustix/0.37.23/download" + ], + "strip_prefix": "rustix-0.37.23", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rustix-0.37.23.bazel" + } + }, + "rrra__clap_lex-0.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_lex/0.5.0/download" + ], + "strip_prefix": "clap_lex-0.5.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.clap_lex-0.5.0.bazel" + } + }, + "rules_rust_prost__base64-0.21.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/base64/0.21.2/download" + ], + "strip_prefix": "base64-0.21.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.base64-0.21.2.bazel" + } + }, + "rules_rust_proto__log-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.3.9/download" + ], + "strip_prefix": "log-0.3.9", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.log-0.3.9.bazel" + } + }, + "rules_rust_wasm_bindgen__windows_i686_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_msvc/0.48.0/download" + ], + "strip_prefix": "windows_i686_msvc-0.48.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows_i686_msvc-0.48.0.bazel" + } + }, + "cui__home-0.5.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/home/0.5.5/download" + ], + "strip_prefix": "home-0.5.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.home-0.5.5.bazel" + } + }, + "rules_rust_proto__memoffset-0.5.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/memoffset/0.5.6/download" + ], + "strip_prefix": "memoffset-0.5.6", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.memoffset-0.5.6.bazel" + } + }, + "cui__gix-attributes-0.19.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2451665e70709ba4753b623ef97511ee98c4a73816b2c5b5df25678d607ed820", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-attributes/0.19.0/download" + ], + "strip_prefix": "gix-attributes-0.19.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-attributes-0.19.0.bazel" + } + }, + "rules_rust_bindgen__clap-4.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap/4.3.3/download" + ], + "strip_prefix": "clap-4.3.3", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.clap-4.3.3.bazel" + } + }, + "rules_rust_prost__hyper-0.14.26": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hyper/0.14.26/download" + ], + "strip_prefix": "hyper-0.14.26", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.hyper-0.14.26.bazel" + } + }, + "rules_rust_wasm_bindgen__predicates-2.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/predicates/2.1.5/download" + ], + "strip_prefix": "predicates-2.1.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.predicates-2.1.5.bazel" + } + }, + "cui__windows_x86_64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_msvc-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows_x86_64_msvc-0.48.0.bazel" + } + }, + "cui__redox_syscall-0.3.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/redox_syscall/0.3.5/download" + ], + "strip_prefix": "redox_syscall-0.3.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.redox_syscall-0.3.5.bazel" + } + }, + "rules_rust_wasm_bindgen__indexmap-1.9.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/indexmap/1.9.3/download" + ], + "strip_prefix": "indexmap-1.9.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.indexmap-1.9.3.bazel" + } + }, + "rules_rust_wasm_bindgen__once_cell-1.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/once_cell/1.18.0/download" + ], + "strip_prefix": "once_cell-1.18.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.once_cell-1.18.0.bazel" + } + }, + "rules_rust_wasm_bindgen__termtree-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/termtree/0.4.1/download" + ], + "strip_prefix": "termtree-0.4.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.termtree-0.4.1.bazel" + } + }, + "rules_rust_bindgen__anstream-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstream/0.3.2/download" + ], + "strip_prefix": "anstream-0.3.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.anstream-0.3.2.bazel" + } + }, + "cui__gix-protocol-0.40.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "cc7b700dc20cc9be8a5130a1fd7e10c34117ffa7068431c8c24d963f0a2e0c9b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-protocol/0.40.0/download" + ], + "strip_prefix": "gix-protocol-0.40.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-protocol-0.40.0.bazel" + } + }, + "bazelci_rules": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e", + "strip_prefix": "bazelci_rules-1.0.0", + "url": "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz" + } + }, + "rules_rust_wasm_bindgen__doc-comment-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/doc-comment/0.3.3/download" + ], + "strip_prefix": "doc-comment-0.3.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.doc-comment-0.3.3.bazel" + } + }, + "cui__crc32fast-1.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crc32fast/1.3.2/download" + ], + "strip_prefix": "crc32fast-1.3.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crc32fast-1.3.2.bazel" + } + }, + "rules_rust_bindgen__aho-corasick-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/aho-corasick/1.0.2/download" + ], + "strip_prefix": "aho-corasick-1.0.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.aho-corasick-1.0.2.bazel" + } + }, + "rules_rust_wasm_bindgen__walrus-macro-0.19.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/walrus-macro/0.19.0/download" + ], + "strip_prefix": "walrus-macro-0.19.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.walrus-macro-0.19.0.bazel" + } + }, + "cui__rdrand-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rdrand/0.4.0/download" + ], + "strip_prefix": "rdrand-0.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rdrand-0.4.0.bazel" + } + }, + "cui__cpufeatures-0.2.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cpufeatures/0.2.9/download" + ], + "strip_prefix": "cpufeatures-0.2.9", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cpufeatures-0.2.9.bazel" + } + }, + "rules_rust_prost__mio-0.8.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/mio/0.8.8/download" + ], + "strip_prefix": "mio-0.8.8", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.mio-0.8.8.bazel" + } + }, + "rules_rust_proto__base64-0.9.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/base64/0.9.3/download" + ], + "strip_prefix": "base64-0.9.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.base64-0.9.3.bazel" + } + }, + "cui__rustc-serialize-0.3.25": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fe834bc780604f4674073badbad26d7219cadfb4a2275802db12cbae17498401", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustc-serialize/0.3.25/download" + ], + "strip_prefix": "rustc-serialize-0.3.25", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rustc-serialize-0.3.25.bazel" + } + }, + "rrra__anyhow-1.0.71": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anyhow/1.0.71/download" + ], + "strip_prefix": "anyhow-1.0.71", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.anyhow-1.0.71.bazel" + } + }, + "cui__gix-path-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6a1d370115171e3ae03c5c6d4f7d096f2981a40ddccb98dfd704c773530ba73b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-path/0.10.0/download" + ], + "strip_prefix": "gix-path-0.10.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-path-0.10.0.bazel" + } + }, + "rules_rust_bindgen__hermit-abi-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.3.1/download" + ], + "strip_prefix": "hermit-abi-0.3.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.hermit-abi-0.3.1.bazel" + } + }, + "rules_rust_wasm_bindgen__cc-1.0.83": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cc/1.0.83/download" + ], + "strip_prefix": "cc-1.0.83", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.cc-1.0.83.bazel" + } + }, + "rrra__utf8parse-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/utf8parse/0.2.1/download" + ], + "strip_prefix": "utf8parse-0.2.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.utf8parse-0.2.1.bazel" + } + }, + "rules_rust_proto__futures-cpupool-0.1.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-cpupool/0.1.8/download" + ], + "strip_prefix": "futures-cpupool-0.1.8", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.futures-cpupool-0.1.8.bazel" + } + }, + "cargo_bazel.buildifier-windows-amd64.exe": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_file", + "attributes": { + "urls": [ + "https://github.com/bazelbuild/buildtools/releases/download/5.0.1/buildifier-windows-amd64.exe" + ], + "sha256": "45e13b2951e4c611d346dacdaf0aafaa484045a3e7300fbc5dd01a896a688177", + "downloaded_file_path": "buildifier.exe", + "executable": true + } + }, + "cui__regex-1.10.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex/1.10.2/download" + ], + "strip_prefix": "regex-1.10.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.regex-1.10.2.bazel" + } + }, + "rrra__log-0.4.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.4.19/download" + ], + "strip_prefix": "log-0.4.19", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.log-0.4.19.bazel" + } + }, + "cui__cargo_metadata-0.18.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cargo_metadata/0.18.1/download" + ], + "strip_prefix": "cargo_metadata-0.18.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cargo_metadata-0.18.1.bazel" + } + }, + "cui__gix-fs-0.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "09815faba62fe9b32d918b75a554686c98e43f7d48c43a80df58eb718e5c6635", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-fs/0.7.0/download" + ], + "strip_prefix": "gix-fs-0.7.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-fs-0.7.0.bazel" + } + }, + "cui__gix-sec-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "92b9542ac025a8c02ed5d17b3fc031a111a384e859d0be3532ec4d58c40a0f28", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-sec/0.10.0/download" + ], + "strip_prefix": "gix-sec-0.10.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-sec-0.10.0.bazel" + } + }, + "cui__gix-trace-0.1.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "96b6d623a1152c3facb79067d6e2ecdae48130030cf27d6eb21109f13bd7b836", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-trace/0.1.3/download" + ], + "strip_prefix": "gix-trace-0.1.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-trace-0.1.3.bazel" + } + }, + "cui__humansize-2.1.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/humansize/2.1.3/download" + ], + "strip_prefix": "humansize-2.1.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.humansize-2.1.3.bazel" + } + }, + "rules_rust_prost__winapi-x86_64-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-x86_64-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel" + } + }, + "rules_rust_wasm_bindgen__io-lifetimes-1.0.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/io-lifetimes/1.0.11/download" + ], + "strip_prefix": "io-lifetimes-1.0.11", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.io-lifetimes-1.0.11.bazel" + } + }, + "rules_rust_prost__tower-service-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tower-service/0.3.2/download" + ], + "strip_prefix": "tower-service-0.3.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tower-service-0.3.2.bazel" + } + }, + "rules_rust_wasm_bindgen__diff-0.1.13": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/diff/0.1.13/download" + ], + "strip_prefix": "diff-0.1.13", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.diff-0.1.13.bazel" + } + }, + "cui__rand_core-0.4.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_core/0.4.2/download" + ], + "strip_prefix": "rand_core-0.4.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rand_core-0.4.2.bazel" + } + }, + "cui__phf-0.11.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/phf/0.11.2/download" + ], + "strip_prefix": "phf-0.11.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.phf-0.11.2.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-threads-xform-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "90a2e577034352f9aa9352730fcf2562c68957f2e9b9ee70ab6379510e49e2fe", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-threads-xform/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-threads-xform-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-threads-xform-0.2.91.bazel" + } + }, + "rules_rust_wasm_bindgen__winapi-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.3.9/download" + ], + "strip_prefix": "winapi-0.3.9", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.winapi-0.3.9.bazel" + } + }, + "cui__wasm-bindgen-0.2.87": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen/0.2.87/download" + ], + "strip_prefix": "wasm-bindgen-0.2.87", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.wasm-bindgen-0.2.87.bazel" + } + }, + "rules_rust_wasm_bindgen__wasmparser-0.102.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasmparser/0.102.0/download" + ], + "strip_prefix": "wasmparser-0.102.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasmparser-0.102.0.bazel" + } + }, + "cui__winapi-x86_64-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-x86_64-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel" + } + }, + "rules_rust_proto__grpc-compiler-0.6.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "907274ce8ee7b40a0d0b0db09022ea22846a47cfb1fc8ad2c983c70001b4ffb1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/grpc-compiler/0.6.2/download" + ], + "strip_prefix": "grpc-compiler-0.6.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.grpc-compiler-0.6.2.bazel" + } + }, + "rrra__heck-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/heck/0.4.1/download" + ], + "strip_prefix": "heck-0.4.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.heck-0.4.1.bazel" + } + }, + "rules_rust_prost__hermit-abi-0.2.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.2.6/download" + ], + "strip_prefix": "hermit-abi-0.2.6", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.hermit-abi-0.2.6.bazel" + } + }, + "rules_rust_wasm_bindgen__autocfg-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/autocfg/1.1.0/download" + ], + "strip_prefix": "autocfg-1.1.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.autocfg-1.1.0.bazel" + } + }, + "cui__version_check-0.9.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/version_check/0.9.4/download" + ], + "strip_prefix": "version_check-0.9.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.version_check-0.9.4.bazel" + } + }, + "cui__gix-date-0.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fc7df669639582dc7c02737642f76890b03b5544e141caba68a7d6b4eb551e0d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-date/0.8.0/download" + ], + "strip_prefix": "gix-date-0.8.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-date-0.8.0.bazel" + } + }, + "cui__scopeguard-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/scopeguard/1.2.0/download" + ], + "strip_prefix": "scopeguard-1.2.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.scopeguard-1.2.0.bazel" + } + }, + "rules_rust_bindgen__clang-sys-1.6.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clang-sys/1.6.1/download" + ], + "strip_prefix": "clang-sys-1.6.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.clang-sys-1.6.1.bazel" + } + }, + "rrra__anstyle-parse-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-parse/0.2.1/download" + ], + "strip_prefix": "anstyle-parse-0.2.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.anstyle-parse-0.2.1.bazel" + } + }, + "rules_rust_wasm_bindgen__num_cpus-1.16.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num_cpus/1.16.0/download" + ], + "strip_prefix": "num_cpus-1.16.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.num_cpus-1.16.0.bazel" + } + }, + "llvm-raw": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "urls": [ + "https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.6/llvm-project-14.0.6.src.tar.xz" + ], + "strip_prefix": "llvm-project-14.0.6.src", + "sha256": "8b3cfd7bc695bd6cea0f37f53f0981f34f87496e79e2529874fd03a2f9dd3a8a", + "build_file_content": "# empty", + "patch_args": [ + "-p1" + ], + "patches": [ + "@@rules_rust~//bindgen/3rdparty/patches:llvm-project.cxx17.patch", + "@@rules_rust~//bindgen/3rdparty/patches:llvm-project.incompatible_disallow_empty_glob.patch" + ] + } + }, + "cui__phf_codegen-0.11.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/phf_codegen/0.11.2/download" + ], + "strip_prefix": "phf_codegen-0.11.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.phf_codegen-0.11.2.bazel" + } + }, + "cui__winapi-util-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-util/0.1.5/download" + ], + "strip_prefix": "winapi-util-0.1.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.winapi-util-0.1.5.bazel" + } + }, + "rules_rust_proto__tokio-current-thread-0.1.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-current-thread/0.1.7/download" + ], + "strip_prefix": "tokio-current-thread-0.1.7", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-current-thread-0.1.7.bazel" + } + }, + "cui__crossbeam-deque-0.8.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-deque/0.8.3/download" + ], + "strip_prefix": "crossbeam-deque-0.8.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crossbeam-deque-0.8.3.bazel" + } + }, + "cui__android_system_properties-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/android_system_properties/0.1.5/download" + ], + "strip_prefix": "android_system_properties-0.1.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.android_system_properties-0.1.5.bazel" + } + }, + "cui__pest_meta-2.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pest_meta/2.7.0/download" + ], + "strip_prefix": "pest_meta-2.7.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.pest_meta-2.7.0.bazel" + } + }, + "cui__anstyle-wincon-1.0.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-wincon/1.0.1/download" + ], + "strip_prefix": "anstyle-wincon-1.0.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.anstyle-wincon-1.0.1.bazel" + } + }, + "rrra__anstyle-query-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle-query/1.0.0/download" + ], + "strip_prefix": "anstyle-query-1.0.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.anstyle-query-1.0.0.bazel" + } + }, + "rrra__clap_derive-4.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap_derive/4.3.2/download" + ], + "strip_prefix": "clap_derive-4.3.2", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.clap_derive-4.3.2.bazel" + } + }, + "cui__gix-hash-0.13.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1884c7b41ea0875217c1be9ce91322f90bde433e91d374d0e1276073a51ccc60", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-hash/0.13.1/download" + ], + "strip_prefix": "gix-hash-0.13.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-hash-0.13.1.bazel" + } + }, + "cui__maybe-async-0.2.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0f1b8c13cb1f814b634a96b2c725449fe7ed464a7b8781de8688be5ffbd3f305", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/maybe-async/0.2.7/download" + ], + "strip_prefix": "maybe-async-0.2.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.maybe-async-0.2.7.bazel" + } + }, + "cui__gix-filter-0.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1be40d28cd41445bb6cd52c4d847d915900e5466f7433eaee6a9e0a3d1d88b08", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-filter/0.5.0/download" + ], + "strip_prefix": "gix-filter-0.5.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-filter-0.5.0.bazel" + } + }, + "rules_rust_wasm_bindgen__mime-0.3.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/mime/0.3.17/download" + ], + "strip_prefix": "mime-0.3.17", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.mime-0.3.17.bazel" + } + }, + "rrra__rustix-0.37.23": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustix/0.37.23/download" + ], + "strip_prefix": "rustix-0.37.23", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.rustix-0.37.23.bazel" + } + }, + "rules_rust_prost__hermit-abi-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.3.1/download" + ], + "strip_prefix": "hermit-abi-0.3.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.hermit-abi-0.3.1.bazel" + } + }, + "cui__maplit-1.0.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/maplit/1.0.2/download" + ], + "strip_prefix": "maplit-1.0.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.maplit-1.0.2.bazel" + } + }, + "rrra__syn-2.0.25": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/2.0.25/download" + ], + "strip_prefix": "syn-2.0.25", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.syn-2.0.25.bazel" + } + }, + "cui__gix-worktree-0.26.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9f5e32972801bd82d56609e6fc84efc358fa1f11f25c5e83b7807ee2280f14fe", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-worktree/0.26.0/download" + ], + "strip_prefix": "gix-worktree-0.26.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-worktree-0.26.0.bazel" + } + }, + "rules_rust_wasm_bindgen__semver-1.0.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/semver/1.0.17/download" + ], + "strip_prefix": "semver-1.0.17", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.semver-1.0.17.bazel" + } + }, + "cui__once_cell-1.18.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/once_cell/1.18.0/download" + ], + "strip_prefix": "once_cell-1.18.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.once_cell-1.18.0.bazel" + } + }, + "rules_rust_wasm_bindgen__wasmparser-0.80.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "449167e2832691a1bff24cde28d2804e90e09586a448c8e76984792c44334a6b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasmparser/0.80.2/download" + ], + "strip_prefix": "wasmparser-0.80.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasmparser-0.80.2.bazel" + } + }, + "cui__heck-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/heck/0.4.1/download" + ], + "strip_prefix": "heck-0.4.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.heck-0.4.1.bazel" + } + }, + "rules_rust_wasm_bindgen__winapi-x86_64-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-x86_64-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel" + } + }, + "libc": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "build_file_content": "load(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\nrust_library(\n name = \"libc\",\n srcs = glob([\"src/**/*.rs\"]),\n edition = \"2015\",\n rustc_flags = [\n # In most cases, warnings in 3rd party crates are not interesting as\n # they're out of the control of consumers. The flag here silences\n # warnings. For more details see:\n # https://doc.rust-lang.org/rustc/lints/levels.html\n \"--cap-lints=allow\",\n ],\n visibility = [\"//visibility:public\"],\n)\n", + "sha256": "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d", + "strip_prefix": "libc-0.2.20", + "urls": [ + "https://mirror.bazel.build/github.com/rust-lang/libc/archive/0.2.20.zip", + "https://github.com/rust-lang/libc/archive/0.2.20.zip" + ] + } + }, + "rrra__either-1.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/either/1.8.1/download" + ], + "strip_prefix": "either-1.8.1", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.either-1.8.1.bazel" + } + }, + "rules_rust_bindgen__minimal-lexical-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/minimal-lexical/0.2.1/download" + ], + "strip_prefix": "minimal-lexical-0.2.1", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.minimal-lexical-0.2.1.bazel" + } + }, + "rrra__regex-automata-0.3.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-automata/0.3.3/download" + ], + "strip_prefix": "regex-automata-0.3.3", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.regex-automata-0.3.3.bazel" + } + }, + "cui__spdx-0.10.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "62bde1398b09b9f93fc2fc9b9da86e362693e999d3a54a8ac47a99a5a73f638b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/spdx/0.10.3/download" + ], + "strip_prefix": "spdx-0.10.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.spdx-0.10.3.bazel" + } + }, + "rules_rust_wasm_bindgen__normalize-line-endings-0.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/normalize-line-endings/0.3.0/download" + ], + "strip_prefix": "normalize-line-endings-0.3.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.normalize-line-endings-0.3.0.bazel" + } + }, + "rules_rust_prost__h2-0.3.19": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/h2/0.3.19/download" + ], + "strip_prefix": "h2-0.3.19", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.h2-0.3.19.bazel" + } + }, + "rules_rust_wasm_bindgen__wasmparser-0.108.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "76c956109dcb41436a39391139d9b6e2d0a5e0b158e1293ef352ec977e5e36c5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasmparser/0.108.0/download" + ], + "strip_prefix": "wasmparser-0.108.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasmparser-0.108.0.bazel" + } + }, + "rules_rust_bindgen__colorchoice-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/colorchoice/1.0.0/download" + ], + "strip_prefix": "colorchoice-1.0.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.colorchoice-1.0.0.bazel" + } + }, + "rules_rust_proto__tokio-sync-0.1.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-sync/0.1.8/download" + ], + "strip_prefix": "tokio-sync-0.1.8", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-sync-0.1.8.bazel" + } + }, + "rules_rust_bindgen__nom-7.1.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/nom/7.1.3/download" + ], + "strip_prefix": "nom-7.1.3", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.nom-7.1.3.bazel" + } + }, + "rules_rust_wasm_bindgen__hashbrown-0.12.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hashbrown/0.12.3/download" + ], + "strip_prefix": "hashbrown-0.12.3", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.hashbrown-0.12.3.bazel" + } + }, + "cui__clap-4.3.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/clap/4.3.11/download" + ], + "strip_prefix": "clap-4.3.11", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.clap-4.3.11.bazel" + } + }, + "rules_rust_bindgen__cexpr-0.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cexpr/0.6.0/download" + ], + "strip_prefix": "cexpr-0.6.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.cexpr-0.6.0.bazel" + } + }, + "cui__num-bigint-0.1.44": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e63899ad0da84ce718c14936262a41cee2c79c981fc0a0e7c7beb47d5a07e8c1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-bigint/0.1.44/download" + ], + "strip_prefix": "num-bigint-0.1.44", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.num-bigint-0.1.44.bazel" + } + }, + "cui__nu-ansi-term-0.46.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/nu-ansi-term/0.46.0/download" + ], + "strip_prefix": "nu-ansi-term-0.46.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.nu-ansi-term-0.46.0.bazel" + } + }, + "rules_rust_proto__winapi-i686-pc-windows-gnu-0.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-i686-pc-windows-gnu/0.4.0/download" + ], + "strip_prefix": "winapi-i686-pc-windows-gnu-0.4.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel" + } + }, + "cui__lazy_static-1.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/lazy_static/1.4.0/download" + ], + "strip_prefix": "lazy_static-1.4.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.lazy_static-1.4.0.bazel" + } + }, + "rules_rust_wasm_bindgen__serde_derive-1.0.171": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_derive/1.0.171/download" + ], + "strip_prefix": "serde_derive-1.0.171", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.serde_derive-1.0.171.bazel" + } + }, + "rules_rust_bindgen__anstyle-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstyle/1.0.0/download" + ], + "strip_prefix": "anstyle-1.0.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.anstyle-1.0.0.bazel" + } + }, + "cui__gix-packetline-0.16.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8a8384b1e964151aff0d5632dd9b191059d07dff358b96bd940f1b452600d7ab", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-packetline/0.16.7/download" + ], + "strip_prefix": "gix-packetline-0.16.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-packetline-0.16.7.bazel" + } + }, + "cui__time-core-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/time-core/0.1.2/download" + ], + "strip_prefix": "time-core-0.1.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.time-core-0.1.2.bazel" + } + }, + "cui__itertools-0.12.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itertools/0.12.0/download" + ], + "strip_prefix": "itertools-0.12.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.itertools-0.12.0.bazel" + } + }, + "cui__time-macros-0.2.15": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/time-macros/0.2.15/download" + ], + "strip_prefix": "time-macros-0.2.15", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.time-macros-0.2.15.bazel" + } + }, + "rules_rust_prost__try-lock-0.2.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/try-lock/0.2.4/download" + ], + "strip_prefix": "try-lock-0.2.4", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.try-lock-0.2.4.bazel" + } + }, + "cui__tera-1.19.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tera/1.19.1/download" + ], + "strip_prefix": "tera-1.19.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tera-1.19.1.bazel" + } + }, + "rules_rust_wasm_bindgen__tempfile-3.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tempfile/3.6.0/download" + ], + "strip_prefix": "tempfile-3.6.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.tempfile-3.6.0.bazel" + } + }, + "rules_rust_prost__axum-core-0.3.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/axum-core/0.3.4/download" + ], + "strip_prefix": "axum-core-0.3.4", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.axum-core-0.3.4.bazel" + } + }, + "cui__globset-0.4.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/globset/0.4.11/download" + ], + "strip_prefix": "globset-0.4.11", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.globset-0.4.11.bazel" + } + }, + "cui__colorchoice-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/colorchoice/1.0.0/download" + ], + "strip_prefix": "colorchoice-1.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.colorchoice-1.0.0.bazel" + } + }, + "rrra__windows-sys-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-sys/0.48.0/download" + ], + "strip_prefix": "windows-sys-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows-sys-0.48.0.bazel" + } + }, + "rules_rust_prost__libc-0.2.146": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libc/0.2.146/download" + ], + "strip_prefix": "libc-0.2.146", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.libc-0.2.146.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-multi-value-xform-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d1e019acde479e2f090fb7f14a51fa0077ec3a7bb12a56e0e888a82be7b5bd3f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-multi-value-xform/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-multi-value-xform-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-multi-value-xform-0.2.91.bazel" + } + }, + "rules_rust_wasm_bindgen__itertools-0.10.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itertools/0.10.5/download" + ], + "strip_prefix": "itertools-0.10.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.itertools-0.10.5.bazel" + } + }, + "cui__windows-sys-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-sys/0.48.0/download" + ], + "strip_prefix": "windows-sys-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows-sys-0.48.0.bazel" + } + }, + "rules_rust_proto__futures-0.1.31": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures/0.1.31/download" + ], + "strip_prefix": "futures-0.1.31", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.futures-0.1.31.bazel" + } + }, + "rules_rust_proto__crossbeam-deque-0.7.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-deque/0.7.4/download" + ], + "strip_prefix": "crossbeam-deque-0.7.4", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.crossbeam-deque-0.7.4.bazel" + } + }, + "rules_rust_wasm_bindgen__rayon-1.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rayon/1.7.0/download" + ], + "strip_prefix": "rayon-1.7.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rayon-1.7.0.bazel" + } + }, + "rules_rust_wasm_bindgen__spin-0.9.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/spin/0.9.8/download" + ], + "strip_prefix": "spin-0.9.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.spin-0.9.8.bazel" + } + }, + "rules_rust_proto__winapi-0.2.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.2.8/download" + ], + "strip_prefix": "winapi-0.2.8", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.winapi-0.2.8.bazel" + } + }, + "rules_rust_wasm_bindgen__num-traits-0.2.15": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/num-traits/0.2.15/download" + ], + "strip_prefix": "num-traits-0.2.15", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.num-traits-0.2.15.bazel" + } + }, + "rules_rust_prost__heck-0.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/heck/0.4.1/download" + ], + "strip_prefix": "heck-0.4.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.heck-0.4.1.bazel" + } + }, + "cui__rand_chacha-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rand_chacha/0.3.1/download" + ], + "strip_prefix": "rand_chacha-0.3.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rand_chacha-0.3.1.bazel" + } + }, + "rrra__anstream-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anstream/0.3.2/download" + ], + "strip_prefix": "anstream-0.3.2", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.anstream-0.3.2.bazel" + } + }, + "cui__cargo-lock-9.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cargo-lock/9.0.0/download" + ], + "strip_prefix": "cargo-lock-9.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.cargo-lock-9.0.0.bazel" + } + }, + "rules_rust_bindgen__winapi-util-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-util/0.1.5/download" + ], + "strip_prefix": "winapi-util-0.1.5", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.winapi-util-0.1.5.bazel" + } + }, + "rules_rust_wasm_bindgen__buf_redux-0.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/buf_redux/0.8.4/download" + ], + "strip_prefix": "buf_redux-0.8.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.buf_redux-0.8.4.bazel" + } + }, + "rules_rust_proto__tls-api-0.1.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "049c03787a0595182357fbd487577947f4351b78ce20c3668f6d49f17feb13d1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tls-api/0.1.22/download" + ], + "strip_prefix": "tls-api-0.1.22", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tls-api-0.1.22.bazel" + } + }, + "cui__faster-hex-0.8.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "239f7bfb930f820ab16a9cd95afc26f88264cf6905c960b340a615384aa3338a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/faster-hex/0.8.1/download" + ], + "strip_prefix": "faster-hex-0.8.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.faster-hex-0.8.1.bazel" + } + }, + "rules_rust_prost__hashbrown-0.12.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hashbrown/0.12.3/download" + ], + "strip_prefix": "hashbrown-0.12.3", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.hashbrown-0.12.3.bazel" + } + }, + "cui__crossbeam-0.8.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam/0.8.2/download" + ], + "strip_prefix": "crossbeam-0.8.2", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crossbeam-0.8.2.bazel" + } + }, + "rules_rust_prost__futures-channel-0.3.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-channel/0.3.28/download" + ], + "strip_prefix": "futures-channel-0.3.28", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.futures-channel-0.3.28.bazel" + } + }, + "rules_rust_prost__scopeguard-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/scopeguard/1.1.0/download" + ], + "strip_prefix": "scopeguard-1.1.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.scopeguard-1.1.0.bazel" + } + }, + "rules_rust_prost__futures-util-0.3.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-util/0.3.28/download" + ], + "strip_prefix": "futures-util-0.3.28", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.futures-util-0.3.28.bazel" + } + }, + "rules_rust_prost__serde-1.0.164": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde/1.0.164/download" + ], + "strip_prefix": "serde-1.0.164", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.serde-1.0.164.bazel" + } + }, + "cui__crossbeam-utils-0.8.16": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crossbeam-utils/0.8.16/download" + ], + "strip_prefix": "crossbeam-utils-0.8.16", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crossbeam-utils-0.8.16.bazel" + } + }, + "cui__unic-segment-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unic-segment/0.9.0/download" + ], + "strip_prefix": "unic-segment-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unic-segment-0.9.0.bazel" + } + }, + "cui__regex-automata-0.4.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-automata/0.4.3/download" + ], + "strip_prefix": "regex-automata-0.4.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.regex-automata-0.4.3.bazel" + } + }, + "rules_rust_proto__miow-0.2.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/miow/0.2.2/download" + ], + "strip_prefix": "miow-0.2.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.miow-0.2.2.bazel" + } + }, + "rules_rust_wasm_bindgen__filetime-0.2.21": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/filetime/0.2.21/download" + ], + "strip_prefix": "filetime-0.2.21", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.filetime-0.2.21.bazel" + } + }, + "rules_rust_prost__windows-targets-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-targets/0.48.0/download" + ], + "strip_prefix": "windows-targets-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows-targets-0.48.0.bazel" + } + }, + "rules_rust_prost__petgraph-0.6.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/petgraph/0.6.3/download" + ], + "strip_prefix": "petgraph-0.6.3", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.petgraph-0.6.3.bazel" + } + }, + "cui__gix-revwalk-0.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e9870c6b1032f2084567710c3b2106ac603377f8d25766b8a6b7c33e6e3ca279", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-revwalk/0.8.0/download" + ], + "strip_prefix": "gix-revwalk-0.8.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-revwalk-0.8.0.bazel" + } + }, + "rules_rust_wasm_bindgen__windows-targets-0.48.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows-targets/0.48.1/download" + ], + "strip_prefix": "windows-targets-0.48.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.windows-targets-0.48.1.bazel" + } + }, + "rules_rust_prost__syn-1.0.109": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/1.0.109/download" + ], + "strip_prefix": "syn-1.0.109", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.syn-1.0.109.bazel" + } + }, + "cui__percent-encoding-2.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/percent-encoding/2.3.0/download" + ], + "strip_prefix": "percent-encoding-2.3.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.percent-encoding-2.3.0.bazel" + } + }, + "rules_rust_wasm_bindgen__hashbrown-0.14.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hashbrown/0.14.0/download" + ], + "strip_prefix": "hashbrown-0.14.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.hashbrown-0.14.0.bazel" + } + }, + "cui__toml_datetime-0.6.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/toml_datetime/0.6.5/download" + ], + "strip_prefix": "toml_datetime-0.6.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.toml_datetime-0.6.5.bazel" + } + }, + "rules_rust_proto__log-0.4.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/log/0.4.17/download" + ], + "strip_prefix": "log-0.4.17", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.log-0.4.17.bazel" + } + }, + "cui__tinyvec-1.6.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tinyvec/1.6.0/download" + ], + "strip_prefix": "tinyvec-1.6.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tinyvec-1.6.0.bazel" + } + }, + "cui__btoi-0.4.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "9dd6407f73a9b8b6162d8a2ef999fe6afd7cc15902ebf42c5cd296addf17e0ad", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/btoi/0.4.3/download" + ], + "strip_prefix": "btoi-0.4.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.btoi-0.4.3.bazel" + } + }, + "rules_rust_prost__ppv-lite86-0.2.17": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/ppv-lite86/0.2.17/download" + ], + "strip_prefix": "ppv-lite86-0.2.17", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.ppv-lite86-0.2.17.bazel" + } + }, + "rules_rust_prost__winapi-0.3.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi/0.3.9/download" + ], + "strip_prefix": "winapi-0.3.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.winapi-0.3.9.bazel" + } + }, + "rules_rust_wasm_bindgen__winapi-util-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/winapi-util/0.1.5/download" + ], + "strip_prefix": "winapi-util-0.1.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.winapi-util-0.1.5.bazel" + } + }, + "rules_rust_proto__maybe-uninit-2.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/maybe-uninit/2.0.0/download" + ], + "strip_prefix": "maybe-uninit-2.0.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.maybe-uninit-2.0.0.bazel" + } + }, + "rules_rust_proto__tokio-tcp-0.1.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-tcp/0.1.4/download" + ], + "strip_prefix": "tokio-tcp-0.1.4", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-tcp-0.1.4.bazel" + } + }, + "rules_rust_bindgen__yansi-term-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/yansi-term/0.1.2/download" + ], + "strip_prefix": "yansi-term-0.1.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.yansi-term-0.1.2.bazel" + } + }, + "cui__toml_edit-0.22.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/toml_edit/0.22.4/download" + ], + "strip_prefix": "toml_edit-0.22.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.toml_edit-0.22.4.bazel" + } + }, + "rules_rust_bindgen__windows_aarch64_msvc-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_msvc/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_msvc-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_aarch64_msvc-0.48.0.bazel" + } + }, + "cui__block-buffer-0.10.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/block-buffer/0.10.4/download" + ], + "strip_prefix": "block-buffer-0.10.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.block-buffer-0.10.4.bazel" + } + }, + "cui__chrono-tz-build-0.2.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/chrono-tz-build/0.2.1/download" + ], + "strip_prefix": "chrono-tz-build-0.2.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.chrono-tz-build-0.2.1.bazel" + } + }, + "cui__gix-bitmap-0.2.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "0ccab4bc576844ddb51b78d81b4a42d73e6229660fa614dfc3d3999c874d1959", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-bitmap/0.2.7/download" + ], + "strip_prefix": "gix-bitmap-0.2.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-bitmap-0.2.7.bazel" + } + }, + "cui__gix-pathspec-0.3.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c3e26c9b47c51be73f98d38c84494bd5fb99334c5d6fda14ef5d036d50a9e5fd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-pathspec/0.3.0/download" + ], + "strip_prefix": "gix-pathspec-0.3.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-pathspec-0.3.0.bazel" + } + }, + "rrra__libc-0.2.147": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libc/0.2.147/download" + ], + "strip_prefix": "libc-0.2.147", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.libc-0.2.147.bazel" + } + }, + "rules_rust_wasm_bindgen__base64-0.21.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/base64/0.21.5/download" + ], + "strip_prefix": "base64-0.21.5", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.base64-0.21.5.bazel" + } + }, + "cui__tracing-attributes-0.1.27": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing-attributes/0.1.27/download" + ], + "strip_prefix": "tracing-attributes-0.1.27", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tracing-attributes-0.1.27.bazel" + } + }, + "rules_rust_test_load_arbitrary_tool": { + "bzlFile": "@@rules_rust~//test/load_arbitrary_tool:load_arbitrary_tool_test.bzl", + "ruleClassName": "_load_arbitrary_tool_test", + "attributes": {} + }, + "rules_rust_prost__tokio-1.28.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio/1.28.2/download" + ], + "strip_prefix": "tokio-1.28.2", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tokio-1.28.2.bazel" + } + }, + "rules_rust_proto__parking_lot_core-0.6.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/parking_lot_core/0.6.3/download" + ], + "strip_prefix": "parking_lot_core-0.6.3", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.parking_lot_core-0.6.3.bazel" + } + }, + "rules_rust_wasm_bindgen__chunked_transfer-1.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/chunked_transfer/1.4.1/download" + ], + "strip_prefix": "chunked_transfer-1.4.1", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.chunked_transfer-1.4.1.bazel" + } + }, + "cui__tinyvec_macros-0.1.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tinyvec_macros/0.1.1/download" + ], + "strip_prefix": "tinyvec_macros-0.1.1", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tinyvec_macros-0.1.1.bazel" + } + }, + "rules_rust_proto__semver-parser-0.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/semver-parser/0.7.0/download" + ], + "strip_prefix": "semver-parser-0.7.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.semver-parser-0.7.0.bazel" + } + }, + "rrra__windows_i686_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_i686_gnu/0.48.0/download" + ], + "strip_prefix": "windows_i686_gnu-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_i686_gnu-0.48.0.bazel" + } + }, + "rules_rust_proto__tokio-udp-0.1.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-udp/0.1.6/download" + ], + "strip_prefix": "tokio-udp-0.1.6", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-udp-0.1.6.bazel" + } + }, + "cui__unic-char-property-0.9.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unic-char-property/0.9.0/download" + ], + "strip_prefix": "unic-char-property-0.9.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unic-char-property-0.9.0.bazel" + } + }, + "rules_rust_wasm_bindgen__sha1_smol-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/sha1_smol/1.0.0/download" + ], + "strip_prefix": "sha1_smol-1.0.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.sha1_smol-1.0.0.bazel" + } + }, + "cui__siphasher-0.3.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/siphasher/0.3.10/download" + ], + "strip_prefix": "siphasher-0.3.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.siphasher-0.3.10.bazel" + } + }, + "cui__tracing-0.1.40": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tracing/0.1.40/download" + ], + "strip_prefix": "tracing-0.1.40", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.tracing-0.1.40.bazel" + } + }, + "rules_rust_wasm_bindgen__syn-2.0.25": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/2.0.25/download" + ], + "strip_prefix": "syn-2.0.25", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.syn-2.0.25.bazel" + } + }, + "rules_rust_wasm_bindgen__version_check-0.9.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/version_check/0.9.4/download" + ], + "strip_prefix": "version_check-0.9.4", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.version_check-0.9.4.bazel" + } + }, + "rrra__is-terminal-0.4.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/is-terminal/0.4.7/download" + ], + "strip_prefix": "is-terminal-0.4.7", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.is-terminal-0.4.7.bazel" + } + }, + "rrra__errno-dragonfly-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno-dragonfly/0.1.2/download" + ], + "strip_prefix": "errno-dragonfly-0.1.2", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.errno-dragonfly-0.1.2.bazel" + } + }, + "rules_rust_wasm_bindgen__instant-0.1.12": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/instant/0.1.12/download" + ], + "strip_prefix": "instant-0.1.12", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.instant-0.1.12.bazel" + } + }, + "rules_rust_wasm_bindgen__regex-automata-0.1.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex-automata/0.1.10/download" + ], + "strip_prefix": "regex-automata-0.1.10", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.regex-automata-0.1.10.bazel" + } + }, + "rrra__hermit-abi-0.3.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hermit-abi/0.3.2/download" + ], + "strip_prefix": "hermit-abi-0.3.2", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.hermit-abi-0.3.2.bazel" + } + }, + "rules_rust_bindgen__strsim-0.10.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/strsim/0.10.0/download" + ], + "strip_prefix": "strsim-0.10.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.strsim-0.10.0.bazel" + } + }, + "cui__arrayvec-0.7.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/arrayvec/0.7.4/download" + ], + "strip_prefix": "arrayvec-0.7.4", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.arrayvec-0.7.4.bazel" + } + }, + "rules_rust_prost__errno-0.3.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/errno/0.3.1/download" + ], + "strip_prefix": "errno-0.3.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.errno-0.3.1.bazel" + } + }, + "rules_rust_proto__tokio-timer-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6131e780037787ff1b3f8aad9da83bca02438b72277850dd6ad0d455e0e20efc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-timer/0.1.2/download" + ], + "strip_prefix": "tokio-timer-0.1.2", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-timer-0.1.2.bazel" + } + }, + "rules_rust_wasm_bindgen__js-sys-0.3.64": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/js-sys/0.3.64/download" + ], + "strip_prefix": "js-sys-0.3.64", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.js-sys-0.3.64.bazel" + } + }, + "rules_rust_wasm_bindgen__time-0.3.23": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/time/0.3.23/download" + ], + "strip_prefix": "time-0.3.23", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.time-0.3.23.bazel" + } + }, + "cui__gix-transport-0.37.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b9ec726e6a245e68ace59a34126a1d679de60360676612985e70b0d3b102fb4e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-transport/0.37.0/download" + ], + "strip_prefix": "gix-transport-0.37.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-transport-0.37.0.bazel" + } + }, + "rules_rust_proto__net2-0.2.38": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/net2/0.2.38/download" + ], + "strip_prefix": "net2-0.2.38", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.net2-0.2.38.bazel" + } + }, + "rules_rust_prost__pin-project-internal-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/pin-project-internal/1.1.0/download" + ], + "strip_prefix": "pin-project-internal-1.1.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.pin-project-internal-1.1.0.bazel" + } + }, + "cui__rustc-hash-1.1.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rustc-hash/1.1.0/download" + ], + "strip_prefix": "rustc-hash-1.1.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.rustc-hash-1.1.0.bazel" + } + }, + "cui__sharded-slab-0.1.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/sharded-slab/0.1.7/download" + ], + "strip_prefix": "sharded-slab-0.1.7", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.sharded-slab-0.1.7.bazel" + } + }, + "rrra__itoa-1.0.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itoa/1.0.8/download" + ], + "strip_prefix": "itoa-1.0.8", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.itoa-1.0.8.bazel" + } + }, + "cui__form_urlencoded-1.2.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/form_urlencoded/1.2.0/download" + ], + "strip_prefix": "form_urlencoded-1.2.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.form_urlencoded-1.2.0.bazel" + } + }, + "cui__gix-commitgraph-0.21.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e75a975ee22cf0a002bfe9b5d5cb3d2a88e263a8a178cd7509133cff10f4df8a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-commitgraph/0.21.0/download" + ], + "strip_prefix": "gix-commitgraph-0.21.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-commitgraph-0.21.0.bazel" + } + }, + "rrra__serde_json-1.0.102": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_json/1.0.102/download" + ], + "strip_prefix": "serde_json-1.0.102", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.serde_json-1.0.102.bazel" + } + }, + "rules_rust_prost__tonic-build-0.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tonic-build/0.8.4/download" + ], + "strip_prefix": "tonic-build-0.8.4", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.tonic-build-0.8.4.bazel" + } + }, + "rules_rust_wasm_bindgen__rouille-3.6.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3716fbf57fc1084d7a706adf4e445298d123e4a44294c4e8213caf1b85fcc921", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rouille/3.6.2/download" + ], + "strip_prefix": "rouille-3.6.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rouille-3.6.2.bazel" + } + }, + "cui__anyhow-1.0.75": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/anyhow/1.0.75/download" + ], + "strip_prefix": "anyhow-1.0.75", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.anyhow-1.0.75.bazel" + } + }, + "rules_rust_wasm_bindgen__url-2.4.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/url/2.4.0/download" + ], + "strip_prefix": "url-2.4.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.url-2.4.0.bazel" + } + }, + "cui__uluru-3.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "794a32261a1f5eb6a4462c81b59cec87b5c27d5deea7dd1ac8fc781c41d226db", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/uluru/3.0.0/download" + ], + "strip_prefix": "uluru-3.0.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.uluru-3.0.0.bazel" + } + }, + "rules_rust_wasm_bindgen__syn-1.0.109": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/1.0.109/download" + ], + "strip_prefix": "syn-1.0.109", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.syn-1.0.109.bazel" + } + }, + "rules_rust_prost__socket2-0.4.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/socket2/0.4.9/download" + ], + "strip_prefix": "socket2-0.4.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.socket2-0.4.9.bazel" + } + }, + "rules_rust_prost__futures-sink-0.3.28": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/futures-sink/0.3.28/download" + ], + "strip_prefix": "futures-sink-0.3.28", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.futures-sink-0.3.28.bazel" + } + }, + "rules_rust_prost__unicode-ident-1.0.9": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-ident/1.0.9/download" + ], + "strip_prefix": "unicode-ident-1.0.9", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.unicode-ident-1.0.9.bazel" + } + }, + "cui__libc-0.2.149": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libc/0.2.149/download" + ], + "strip_prefix": "libc-0.2.149", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.libc-0.2.149.bazel" + } + }, + "cui__unicode-linebreak-0.1.5": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-linebreak/0.1.5/download" + ], + "strip_prefix": "unicode-linebreak-0.1.5", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unicode-linebreak-0.1.5.bazel" + } + }, + "rules_rust_proto__unix_socket-0.5.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unix_socket/0.5.0/download" + ], + "strip_prefix": "unix_socket-0.5.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.unix_socket-0.5.0.bazel" + } + }, + "rrra__itertools-0.11.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itertools/0.11.0/download" + ], + "strip_prefix": "itertools-0.11.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.itertools-0.11.0.bazel" + } + }, + "rules_rust_bindgen__regex-1.8.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/regex/1.8.4/download" + ], + "strip_prefix": "regex-1.8.4", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.regex-1.8.4.bazel" + } + }, + "cui__hashbrown-0.14.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/hashbrown/0.14.3/download" + ], + "strip_prefix": "hashbrown-0.14.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.hashbrown-0.14.3.bazel" + } + }, + "cui__crypto-common-0.1.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/crypto-common/0.1.6/download" + ], + "strip_prefix": "crypto-common-0.1.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.crypto-common-0.1.6.bazel" + } + }, + "rrra__windows_x86_64_gnu-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnu/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnu-0.48.0", + "build_file": "@@rules_rust~//tools/rust_analyzer/3rdparty/crates:BUILD.windows_x86_64_gnu-0.48.0.bazel" + } + }, + "cui__byteyarn-0.2.3": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "a7534301c0ea17abb4db06d75efc7b4b0fa360fce8e175a4330d721c71c942ff", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/byteyarn/0.2.3/download" + ], + "strip_prefix": "byteyarn-0.2.3", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.byteyarn-0.2.3.bazel" + } + }, + "rules_rust_proto__tokio-executor-0.1.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-executor/0.1.10/download" + ], + "strip_prefix": "tokio-executor-0.1.10", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-executor-0.1.10.bazel" + } + }, + "rules_rust_proto__tokio-uds-0.1.7": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "65ae5d255ce739e8537221ed2942e0445f4b3b813daebac1c0050ddaaa3587f9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio-uds/0.1.7/download" + ], + "strip_prefix": "tokio-uds-0.1.7", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-uds-0.1.7.bazel" + } + }, + "rules_rust_prost__io-lifetimes-1.0.11": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/io-lifetimes/1.0.11/download" + ], + "strip_prefix": "io-lifetimes-1.0.11", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.io-lifetimes-1.0.11.bazel" + } + }, + "rules_rust_prost__itoa-1.0.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itoa/1.0.6/download" + ], + "strip_prefix": "itoa-1.0.6", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.itoa-1.0.6.bazel" + } + }, + "rules_rust_wasm_bindgen__cfg-if-1.0.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/cfg-if/1.0.0/download" + ], + "strip_prefix": "cfg-if-1.0.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.cfg-if-1.0.0.bazel" + } + }, + "rules_rust_prost__windows_x86_64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_x86_64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_x86_64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.windows_x86_64_gnullvm-0.48.0.bazel" + } + }, + "cui__gix-credentials-0.20.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "46900b884cc5af6a6c141ee741607c0c651a4e1d33614b8d888a1ba81cc0bc8a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-credentials/0.20.0/download" + ], + "strip_prefix": "gix-credentials-0.20.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-credentials-0.20.0.bazel" + } + }, + "rules_rust_proto__tokio-0.1.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tokio/0.1.22/download" + ], + "strip_prefix": "tokio-0.1.22", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tokio-0.1.22.bazel" + } + }, + "rules_rust_proto__tls-api-stub-0.1.22": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c9a0cc8c149724db9de7d73a0e1bc80b1a74f5394f08c6f301e11f9c35fa061e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/tls-api-stub/0.1.22/download" + ], + "strip_prefix": "tls-api-stub-0.1.22", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.tls-api-stub-0.1.22.bazel" + } + }, + "rules_rust_prost__syn-2.0.18": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/syn/2.0.18/download" + ], + "strip_prefix": "syn-2.0.18", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.syn-2.0.18.bazel" + } + }, + "rules_rust_prost__linux-raw-sys-0.3.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/linux-raw-sys/0.3.8/download" + ], + "strip_prefix": "linux-raw-sys-0.3.8", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.linux-raw-sys-0.3.8.bazel" + } + }, + "cui__serde_derive-1.0.190": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde_derive/1.0.190/download" + ], + "strip_prefix": "serde_derive-1.0.190", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.serde_derive-1.0.190.bazel" + } + }, + "rules_rust_wasm_bindgen__serde-1.0.171": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/serde/1.0.171/download" + ], + "strip_prefix": "serde-1.0.171", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.serde-1.0.171.bazel" + } + }, + "rules_rust_proto__httpbis-0.7.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "7689cfa896b2a71da4f16206af167542b75d242b6906313e53857972a92d5614", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/httpbis/0.7.0/download" + ], + "strip_prefix": "httpbis-0.7.0", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.httpbis-0.7.0.bazel" + } + }, + "rules_rust_wasm_bindgen__wasm-bindgen-macro-0.2.91": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/wasm-bindgen-macro/0.2.91/download" + ], + "strip_prefix": "wasm-bindgen-macro-0.2.91", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.wasm-bindgen-macro-0.2.91.bazel" + } + }, + "cui__gix-revision-0.22.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c8c4b15cf2ab7a35f5bcb3ef146187c8d36df0177e171ca061913cbaaa890e89", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-revision/0.22.0/download" + ], + "strip_prefix": "gix-revision-0.22.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-revision-0.22.0.bazel" + } + }, + "cui__camino-1.1.6": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/camino/1.1.6/download" + ], + "strip_prefix": "camino-1.1.6", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.camino-1.1.6.bazel" + } + }, + "rules_rust_prost__signal-hook-registry-1.4.1": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/signal-hook-registry/1.4.1/download" + ], + "strip_prefix": "signal-hook-registry-1.4.1", + "build_file": "@@rules_rust~//proto/prost/private/3rdparty/crates:BUILD.signal-hook-registry-1.4.1.bazel" + } + }, + "rules_rust_proto__mio-0.6.23": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/mio/0.6.23/download" + ], + "strip_prefix": "mio-0.6.23", + "build_file": "@@rules_rust~//proto/protobuf/3rdparty/crates:BUILD.mio-0.6.23.bazel" + } + }, + "cui__gix-config-0.30.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "c171514b40487d3f677ae37efc0f45ac980e3169f23c27eb30a70b47fdf88ab5", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-config/0.30.0/download" + ], + "strip_prefix": "gix-config-0.30.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-config-0.30.0.bazel" + } + }, + "cui__unicode-ident-1.0.10": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/unicode-ident/1.0.10/download" + ], + "strip_prefix": "unicode-ident-1.0.10", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.unicode-ident-1.0.10.bazel" + } + }, + "rules_rust_wasm_bindgen__itoa-1.0.8": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/itoa/1.0.8/download" + ], + "strip_prefix": "itoa-1.0.8", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.itoa-1.0.8.bazel" + } + }, + "rules_rust_bindgen__libloading-0.7.4": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/libloading/0.7.4/download" + ], + "strip_prefix": "libloading-0.7.4", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.libloading-0.7.4.bazel" + } + }, + "rules_rust_bindgen__windows_aarch64_gnullvm-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows_aarch64_gnullvm/0.48.0/download" + ], + "strip_prefix": "windows_aarch64_gnullvm-0.48.0", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.windows_aarch64_gnullvm-0.48.0.bazel" + } + }, + "rules_rust_wasm_bindgen__alloc-stdlib-0.2.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/alloc-stdlib/0.2.2/download" + ], + "strip_prefix": "alloc-stdlib-0.2.2", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.alloc-stdlib-0.2.2.bazel" + } + }, + "rules_rust_bindgen__peeking_take_while-0.1.2": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/peeking_take_while/0.1.2/download" + ], + "strip_prefix": "peeking_take_while-0.1.2", + "build_file": "@@rules_rust~//bindgen/3rdparty/crates:BUILD.peeking_take_while-0.1.2.bazel" + } + }, + "cui__gix-ignore-0.8.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "b048f443a1f6b02da4205c34d2e287e3fd45d75e8e2f06cfb216630ea9bff5e3", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/gix-ignore/0.8.0/download" + ], + "strip_prefix": "gix-ignore-0.8.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.gix-ignore-0.8.0.bazel" + } + }, + "rules_rust_wasm_bindgen__rayon-core-1.11.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/rayon-core/1.11.0/download" + ], + "strip_prefix": "rayon-core-1.11.0", + "build_file": "@@rules_rust~//wasm_bindgen/3rdparty/crates:BUILD.rayon-core-1.11.0.bazel" + } + }, + "cui__windows-0.48.0": { + "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl", + "ruleClassName": "http_archive", + "attributes": { + "sha256": "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f", + "type": "tar.gz", + "urls": [ + "https://static.crates.io/crates/windows/0.48.0/download" + ], + "strip_prefix": "windows-0.48.0", + "build_file": "@@rules_rust~//crate_universe/3rdparty/crates:BUILD.windows-0.48.0.bazel" + } + } + }, + "moduleExtensionMetadata": { + "explicitRootModuleDirectDeps": [ + "rules_rust_tinyjson", + "cui", + "cui__anyhow-1.0.75", + "cui__camino-1.1.6", + "cui__cargo-lock-9.0.0", + "cui__cargo-platform-0.1.4", + "cui__cargo_metadata-0.18.1", + "cui__cargo_toml-0.19.2", + "cui__cfg-expr-0.15.5", + "cui__clap-4.3.11", + "cui__crates-index-2.2.0", + "cui__hex-0.4.3", + "cui__indoc-2.0.4", + "cui__itertools-0.12.0", + "cui__normpath-1.1.1", + "cui__pathdiff-0.2.1", + "cui__regex-1.10.2", + "cui__semver-1.0.20", + "cui__serde-1.0.190", + "cui__serde_json-1.0.108", + "cui__serde_starlark-0.1.14", + "cui__sha2-0.10.8", + "cui__spdx-0.10.3", + "cui__tempfile-3.8.1", + "cui__tera-1.19.1", + "cui__textwrap-0.16.0", + "cui__toml-0.8.10", + "cui__tracing-0.1.40", + "cui__tracing-subscriber-0.3.17", + "cui__maplit-1.0.2", + "cui__spectral-0.6.0", + "cargo_bazel.buildifier-darwin-amd64", + "cargo_bazel.buildifier-darwin-arm64", + "cargo_bazel.buildifier-linux-amd64", + "cargo_bazel.buildifier-linux-arm64", + "cargo_bazel.buildifier-windows-amd64.exe", + "rules_rust_prost__heck", + "rules_rust_prost", + "rules_rust_prost__h2-0.3.19", + "rules_rust_prost__prost-0.11.9", + "rules_rust_prost__prost-types-0.11.9", + "rules_rust_prost__protoc-gen-prost-0.2.2", + "rules_rust_prost__protoc-gen-tonic-0.2.2", + "rules_rust_prost__tokio-1.28.2", + "rules_rust_prost__tokio-stream-0.1.14", + "rules_rust_prost__tonic-0.9.2", + "rules_rust_proto__grpc-0.6.2", + "rules_rust_proto__grpc-compiler-0.6.2", + "rules_rust_proto__log-0.4.17", + "rules_rust_proto__protobuf-2.8.2", + "rules_rust_proto__protobuf-codegen-2.8.2", + "rules_rust_proto__tls-api-0.1.22", + "rules_rust_proto__tls-api-stub-0.1.22", + "llvm-raw", + "rules_rust_bindgen__bindgen-cli-0.69.1", + "rules_rust_bindgen__bindgen-0.69.1", + "rules_rust_bindgen__clang-sys-1.6.1", + "rules_rust_bindgen__clap-4.3.3", + "rules_rust_bindgen__clap_complete-4.3.1", + "rules_rust_bindgen__env_logger-0.10.0", + "rrra__anyhow-1.0.71", + "rrra__clap-4.3.11", + "rrra__env_logger-0.10.0", + "rrra__itertools-0.11.0", + "rrra__log-0.4.19", + "rrra__serde-1.0.171", + "rrra__serde_json-1.0.102", + "rules_rust_wasm_bindgen_cli", + "rules_rust_wasm_bindgen__anyhow-1.0.71", + "rules_rust_wasm_bindgen__docopt-1.1.1", + "rules_rust_wasm_bindgen__env_logger-0.8.4", + "rules_rust_wasm_bindgen__log-0.4.19", + "rules_rust_wasm_bindgen__rouille-3.6.2", + "rules_rust_wasm_bindgen__serde-1.0.171", + "rules_rust_wasm_bindgen__serde_derive-1.0.171", + "rules_rust_wasm_bindgen__serde_json-1.0.102", + "rules_rust_wasm_bindgen__ureq-2.8.0", + "rules_rust_wasm_bindgen__walrus-0.20.3", + "rules_rust_wasm_bindgen__wasm-bindgen-0.2.91", + "rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.91", + "rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.91", + "rules_rust_wasm_bindgen__assert_cmd-1.0.8", + "rules_rust_wasm_bindgen__diff-0.1.13", + "rules_rust_wasm_bindgen__predicates-1.0.8", + "rules_rust_wasm_bindgen__rayon-1.7.0", + "rules_rust_wasm_bindgen__tempfile-3.6.0", + "rules_rust_wasm_bindgen__wasmparser-0.102.0", + "rules_rust_wasm_bindgen__wasmprinter-0.2.60", + "rules_rust_test_load_arbitrary_tool", + "generated_inputs_in_external_repo", + "libc", + "rules_rust_toolchain_test_target_json", + "com_google_googleapis", + "bazelci_rules" + ], + "explicitRootModuleDirectDevDeps": [], + "useAllRepos": "NO", + "reproducible": false + }, + "recordedRepoMappingEntries": [ + [ + "rules_rust~", + "bazel_skylib", + "bazel_skylib~" + ], + [ + "rules_rust~", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_rust~", + "cui__anyhow-1.0.75", + "rules_rust~~i~cui__anyhow-1.0.75" + ], + [ + "rules_rust~", + "cui__camino-1.1.6", + "rules_rust~~i~cui__camino-1.1.6" + ], + [ + "rules_rust~", + "cui__cargo-lock-9.0.0", + "rules_rust~~i~cui__cargo-lock-9.0.0" + ], + [ + "rules_rust~", + "cui__cargo-platform-0.1.4", + "rules_rust~~i~cui__cargo-platform-0.1.4" + ], + [ + "rules_rust~", + "cui__cargo_metadata-0.18.1", + "rules_rust~~i~cui__cargo_metadata-0.18.1" + ], + [ + "rules_rust~", + "cui__cargo_toml-0.19.2", + "rules_rust~~i~cui__cargo_toml-0.19.2" + ], + [ + "rules_rust~", + "cui__cfg-expr-0.15.5", + "rules_rust~~i~cui__cfg-expr-0.15.5" + ], + [ + "rules_rust~", + "cui__clap-4.3.11", + "rules_rust~~i~cui__clap-4.3.11" + ], + [ + "rules_rust~", + "cui__crates-index-2.2.0", + "rules_rust~~i~cui__crates-index-2.2.0" + ], + [ + "rules_rust~", + "cui__hex-0.4.3", + "rules_rust~~i~cui__hex-0.4.3" + ], + [ + "rules_rust~", + "cui__indoc-2.0.4", + "rules_rust~~i~cui__indoc-2.0.4" + ], + [ + "rules_rust~", + "cui__itertools-0.12.0", + "rules_rust~~i~cui__itertools-0.12.0" + ], + [ + "rules_rust~", + "cui__maplit-1.0.2", + "rules_rust~~i~cui__maplit-1.0.2" + ], + [ + "rules_rust~", + "cui__normpath-1.1.1", + "rules_rust~~i~cui__normpath-1.1.1" + ], + [ + "rules_rust~", + "cui__pathdiff-0.2.1", + "rules_rust~~i~cui__pathdiff-0.2.1" + ], + [ + "rules_rust~", + "cui__regex-1.10.2", + "rules_rust~~i~cui__regex-1.10.2" + ], + [ + "rules_rust~", + "cui__semver-1.0.20", + "rules_rust~~i~cui__semver-1.0.20" + ], + [ + "rules_rust~", + "cui__serde-1.0.190", + "rules_rust~~i~cui__serde-1.0.190" + ], + [ + "rules_rust~", + "cui__serde_json-1.0.108", + "rules_rust~~i~cui__serde_json-1.0.108" + ], + [ + "rules_rust~", + "cui__serde_starlark-0.1.14", + "rules_rust~~i~cui__serde_starlark-0.1.14" + ], + [ + "rules_rust~", + "cui__sha2-0.10.8", + "rules_rust~~i~cui__sha2-0.10.8" + ], + [ + "rules_rust~", + "cui__spdx-0.10.3", + "rules_rust~~i~cui__spdx-0.10.3" + ], + [ + "rules_rust~", + "cui__spectral-0.6.0", + "rules_rust~~i~cui__spectral-0.6.0" + ], + [ + "rules_rust~", + "cui__tempfile-3.8.1", + "rules_rust~~i~cui__tempfile-3.8.1" + ], + [ + "rules_rust~", + "cui__tera-1.19.1", + "rules_rust~~i~cui__tera-1.19.1" + ], + [ + "rules_rust~", + "cui__textwrap-0.16.0", + "rules_rust~~i~cui__textwrap-0.16.0" + ], + [ + "rules_rust~", + "cui__toml-0.8.10", + "rules_rust~~i~cui__toml-0.8.10" + ], + [ + "rules_rust~", + "cui__tracing-0.1.40", + "rules_rust~~i~cui__tracing-0.1.40" + ], + [ + "rules_rust~", + "cui__tracing-subscriber-0.3.17", + "rules_rust~~i~cui__tracing-subscriber-0.3.17" + ], + [ + "rules_rust~", + "rrra__anyhow-1.0.71", + "rules_rust~~i~rrra__anyhow-1.0.71" + ], + [ + "rules_rust~", + "rrra__clap-4.3.11", + "rules_rust~~i~rrra__clap-4.3.11" + ], + [ + "rules_rust~", + "rrra__env_logger-0.10.0", + "rules_rust~~i~rrra__env_logger-0.10.0" + ], + [ + "rules_rust~", + "rrra__itertools-0.11.0", + "rules_rust~~i~rrra__itertools-0.11.0" + ], + [ + "rules_rust~", + "rrra__log-0.4.19", + "rules_rust~~i~rrra__log-0.4.19" + ], + [ + "rules_rust~", + "rrra__serde-1.0.171", + "rules_rust~~i~rrra__serde-1.0.171" + ], + [ + "rules_rust~", + "rrra__serde_json-1.0.102", + "rules_rust~~i~rrra__serde_json-1.0.102" + ], + [ + "rules_rust~", + "rules_rust", + "rules_rust~" + ], + [ + "rules_rust~", + "rules_rust_bindgen__bindgen-0.69.1", + "rules_rust~~i~rules_rust_bindgen__bindgen-0.69.1" + ], + [ + "rules_rust~", + "rules_rust_bindgen__clang-sys-1.6.1", + "rules_rust~~i~rules_rust_bindgen__clang-sys-1.6.1" + ], + [ + "rules_rust~", + "rules_rust_bindgen__clap-4.3.3", + "rules_rust~~i~rules_rust_bindgen__clap-4.3.3" + ], + [ + "rules_rust~", + "rules_rust_bindgen__clap_complete-4.3.1", + "rules_rust~~i~rules_rust_bindgen__clap_complete-4.3.1" + ], + [ + "rules_rust~", + "rules_rust_bindgen__env_logger-0.10.0", + "rules_rust~~i~rules_rust_bindgen__env_logger-0.10.0" + ], + [ + "rules_rust~", + "rules_rust_prost__h2-0.3.19", + "rules_rust~~i~rules_rust_prost__h2-0.3.19" + ], + [ + "rules_rust~", + "rules_rust_prost__prost-0.11.9", + "rules_rust~~i~rules_rust_prost__prost-0.11.9" + ], + [ + "rules_rust~", + "rules_rust_prost__prost-types-0.11.9", + "rules_rust~~i~rules_rust_prost__prost-types-0.11.9" + ], + [ + "rules_rust~", + "rules_rust_prost__protoc-gen-prost-0.2.2", + "rules_rust~~i~rules_rust_prost__protoc-gen-prost-0.2.2" + ], + [ + "rules_rust~", + "rules_rust_prost__protoc-gen-tonic-0.2.2", + "rules_rust~~i~rules_rust_prost__protoc-gen-tonic-0.2.2" + ], + [ + "rules_rust~", + "rules_rust_prost__tokio-1.28.2", + "rules_rust~~i~rules_rust_prost__tokio-1.28.2" + ], + [ + "rules_rust~", + "rules_rust_prost__tokio-stream-0.1.14", + "rules_rust~~i~rules_rust_prost__tokio-stream-0.1.14" + ], + [ + "rules_rust~", + "rules_rust_prost__tonic-0.9.2", + "rules_rust~~i~rules_rust_prost__tonic-0.9.2" + ], + [ + "rules_rust~", + "rules_rust_proto__grpc-0.6.2", + "rules_rust~~i~rules_rust_proto__grpc-0.6.2" + ], + [ + "rules_rust~", + "rules_rust_proto__grpc-compiler-0.6.2", + "rules_rust~~i~rules_rust_proto__grpc-compiler-0.6.2" + ], + [ + "rules_rust~", + "rules_rust_proto__log-0.4.17", + "rules_rust~~i~rules_rust_proto__log-0.4.17" + ], + [ + "rules_rust~", + "rules_rust_proto__protobuf-2.8.2", + "rules_rust~~i~rules_rust_proto__protobuf-2.8.2" + ], + [ + "rules_rust~", + "rules_rust_proto__protobuf-codegen-2.8.2", + "rules_rust~~i~rules_rust_proto__protobuf-codegen-2.8.2" + ], + [ + "rules_rust~", + "rules_rust_proto__tls-api-0.1.22", + "rules_rust~~i~rules_rust_proto__tls-api-0.1.22" + ], + [ + "rules_rust~", + "rules_rust_proto__tls-api-stub-0.1.22", + "rules_rust~~i~rules_rust_proto__tls-api-stub-0.1.22" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__anyhow-1.0.71", + "rules_rust~~i~rules_rust_wasm_bindgen__anyhow-1.0.71" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__assert_cmd-1.0.8", + "rules_rust~~i~rules_rust_wasm_bindgen__assert_cmd-1.0.8" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__diff-0.1.13", + "rules_rust~~i~rules_rust_wasm_bindgen__diff-0.1.13" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__docopt-1.1.1", + "rules_rust~~i~rules_rust_wasm_bindgen__docopt-1.1.1" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__env_logger-0.8.4", + "rules_rust~~i~rules_rust_wasm_bindgen__env_logger-0.8.4" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__log-0.4.19", + "rules_rust~~i~rules_rust_wasm_bindgen__log-0.4.19" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__predicates-1.0.8", + "rules_rust~~i~rules_rust_wasm_bindgen__predicates-1.0.8" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__rayon-1.7.0", + "rules_rust~~i~rules_rust_wasm_bindgen__rayon-1.7.0" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__rouille-3.6.2", + "rules_rust~~i~rules_rust_wasm_bindgen__rouille-3.6.2" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__serde-1.0.171", + "rules_rust~~i~rules_rust_wasm_bindgen__serde-1.0.171" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__serde_derive-1.0.171", + "rules_rust~~i~rules_rust_wasm_bindgen__serde_derive-1.0.171" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__serde_json-1.0.102", + "rules_rust~~i~rules_rust_wasm_bindgen__serde_json-1.0.102" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__tempfile-3.6.0", + "rules_rust~~i~rules_rust_wasm_bindgen__tempfile-3.6.0" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__ureq-2.8.0", + "rules_rust~~i~rules_rust_wasm_bindgen__ureq-2.8.0" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__walrus-0.20.3", + "rules_rust~~i~rules_rust_wasm_bindgen__walrus-0.20.3" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__wasm-bindgen-0.2.91", + "rules_rust~~i~rules_rust_wasm_bindgen__wasm-bindgen-0.2.91" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.91", + "rules_rust~~i~rules_rust_wasm_bindgen__wasm-bindgen-cli-support-0.2.91" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.91", + "rules_rust~~i~rules_rust_wasm_bindgen__wasm-bindgen-shared-0.2.91" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__wasmparser-0.102.0", + "rules_rust~~i~rules_rust_wasm_bindgen__wasmparser-0.102.0" + ], + [ + "rules_rust~", + "rules_rust_wasm_bindgen__wasmprinter-0.2.60", + "rules_rust~~i~rules_rust_wasm_bindgen__wasmprinter-0.2.60" + ] + ] + } + } + } +} diff --git a/Package.resolved b/Package.resolved index 677a6086..f763a7cf 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,25 +1,23 @@ { - "object": { - "pins": [ - { - "package": "abseil", - "repositoryURL": "https://github.com/bourdakos1/abseil-cpp-SwiftPM.git", - "state": { - "branch": "cxx17", - "revision": "a7042563d167160f56e614cd1e2a32616510d9ec", - "version": null - } - }, - { - "package": "BoringSSL-GRPC", - "repositoryURL": "https://github.com/firebase/boringssl-SwiftPM.git", - "state": { - "branch": null, - "revision": "734a8247442fde37df4364c21f6a0085b6a36728", - "version": "0.7.2" - } + "pins" : [ + { + "identity" : "abseil-cpp-swiftpm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/bourdakos1/abseil-cpp-SwiftPM.git", + "state" : { + "branch" : "cxx17-test", + "revision" : "f2c56293ba0c7dc4fed62c38dfea5c5c2d632166" } - ] - }, - "version": 1 + }, + { + "identity" : "boringssl-swiftpm", + "kind" : "remoteSourceControl", + "location" : "https://github.com/firebase/boringssl-SwiftPM.git", + "state" : { + "revision" : "734a8247442fde37df4364c21f6a0085b6a36728", + "version" : "0.7.2" + } + } + ], + "version" : 2 } diff --git a/Package.swift b/Package.swift index c8dc5bfd..784d5ff2 100644 --- a/Package.swift +++ b/Package.swift @@ -1,5 +1,20 @@ -// swift-tools-version:5.5 +// swift-tools-version:5.7 // The swift-tools-version declares the minimum version of Swift required to build this package. + +// Copyright 2022 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. + import PackageDescription let package = Package( @@ -13,23 +28,22 @@ let package = Package( products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( - name: "NearbyCoreAdapter", - targets: ["NearbyCoreAdapter"] + name: "NearbyConnections", + targets: ["NearbyConnections"] ), .library( - name: "NearbyConnections", + name: "NearbyConnectionsDynamic", + type: .dynamic, targets: ["NearbyConnections"] ), ], dependencies: [ // Dependencies declare other packages that this package depends on. .package( - name: "abseil", url: "https://github.com/bourdakos1/abseil-cpp-SwiftPM.git", - branch: "cxx17" + branch: "cxx17-test" ), .package( - name: "BoringSSL-GRPC", url: "https://github.com/firebase/boringssl-SwiftPM.git", "0.7.1"..<"0.8.0" ), @@ -172,8 +186,10 @@ let package = Package( name: "ukey2", dependencies: [ "protobuf", - .product(name: "abseil", package: "abseil"), - .product(name: "openssl_grpc", package: "BoringSSL-GRPC"), + .product(name: "AbseilCXX17", package: "abseil-cpp-SwiftPM"), + .product( + name: "openssl_grpc", package: "boringssl-SwiftPM", + moduleAliases: ["NearbySSL": "openssl_grpc"]), ], path: "third_party/ukey2", exclude: [ @@ -362,7 +378,7 @@ let package = Package( "smhasher", "ukey2", "protobuf", - .product(name: "abseil", package: "abseil"), + .product(name: "AbseilCXX17", package: "abseil-cpp-SwiftPM"), ], path: ".", exclude: [ @@ -372,12 +388,14 @@ let package = Package( "connections/c", "connections/connectionsd", "connections/dart", + "connections/java", "connections/clients/ios", "connections/README.md", "connections/swift/NearbyConnections", "connections/swift/NearbyCoreAdapter/BUILD", "connections/swift/NearbyCoreAdapter/Tests", "internal/platform/implementation/g3", + "internal/platform/implementation/android", "internal/platform/implementation/apple/Tests", "internal/platform/implementation/apple/Mediums/Ble/Sockets/Tests", "internal/platform/implementation/linux", @@ -391,6 +409,7 @@ let package = Package( "connections/implementation/analytics/BUILD", "connections/implementation/flags/BUILD", "connections/implementation/mediums/ble_v2/BUILD", + "connections/implementation/mediums/multiplex/BUILD", "connections/implementation/mediums/BUILD", "connections/implementation/BUILD", "connections/implementation/fuzzers", @@ -431,8 +450,9 @@ let package = Package( "connections/implementation/payload_manager_test.cc", "connections/implementation/offline_frames_validator_test.cc", "connections/implementation/service_controller_router_test.cc", + "connections/implementation/bluetooth_bwu_test.cc", "connections/implementation/wifi_direct_bwu_test.cc", - "connections/implementation/wifi_hotspot_test.cc", + "connections/implementation/wifi_hotspot_bwu_test.cc", "connections/implementation/analytics/analytics_recorder_test.cc", "connections/implementation/analytics/throughput_recorder_test.cc", "connections/implementation/mediums/ble_v2_test.cc", @@ -443,6 +463,11 @@ let package = Package( "connections/implementation/mediums/ble_v2/ble_advertisement_header_test.cc", "connections/implementation/mediums/ble_v2/ble_utils_test.cc", "connections/implementation/mediums/ble_v2/discovered_peripheral_tracker_test.cc", + "connections/implementation/mediums/ble_v2/instant_on_lost_advertisement_test.cc", + "connections/implementation/mediums/ble_v2/instant_on_lost_manager_test.cc", + "connections/implementation/mediums/multiplex/multiplex_frames_test.cc", + "connections/implementation/mediums/multiplex/multiplex_socket_test.cc", + "connections/implementation/mediums/multiplex/multiplex_output_stream_test.cc", "connections/implementation/mediums/webrtc_peer_id_test.cc", "connections/implementation/mediums/wifi_lan_test.cc", "connections/implementation/mediums/bluetooth_classic_test.cc", @@ -462,6 +487,7 @@ let package = Package( "connections/implementation/pcp_manager_test.cc", "connections/implementation/ble_advertisement_test.cc", "connections/implementation/base_endpoint_channel_test.cc", + "connections/implementation/reconnect_manager_test.cc", "connections/v3/connections_device_test.cc", "connections/v3/connections_device_provider_test.cc", "connections/implementation/connections_authentication_transport_test.cc", @@ -469,13 +495,13 @@ let package = Package( "connections/status_test.cc", "connections/payload_test.cc", "internal/base/bluetooth_address_test.cc", + "internal/base/files_test.cc", "internal/crypto/ed25519_unittest.cc", "internal/crypto_cros/aead_unittest.cc", "internal/crypto_cros/ec_private_key_unittest.cc", "internal/crypto_cros/ec_signature_creator_unittest.cc", "internal/crypto_cros/encryptor_unittest.cc", "internal/crypto_cros/hmac_unittest.cc", - "internal/crypto_cros/random_unittest.cc", "internal/crypto_cros/rsa_private_key_unittest.cc", "internal/crypto_cros/secure_hash_unittest.cc", "internal/crypto_cros/sha2_unittest.cc", @@ -504,7 +530,6 @@ let package = Package( "internal/platform/wifi_hotspot_test.cc", "internal/platform/wifi_lan_test.cc", "internal/platform/wifi_test.cc", - "internal/platform/wifi_utils_test.cc", "internal/platform/connection_info_test.cc", "internal/platform/condition_variable_test.cc", "internal/platform/thread_check_nocompile_test.py", @@ -512,7 +537,6 @@ let package = Package( "internal/platform/bluetooth_connection_info_test.cc", "internal/platform/mutex_test.cc", "internal/platform/atomic_reference_test.cc", - "internal/platform/logging_test.cc", "internal/platform/multi_thread_executor_test.cc", "internal/platform/ble_connection_info_test.cc", "internal/platform/ble_test.cc", @@ -524,6 +548,7 @@ let package = Package( "internal/platform/implementation/apple/atomic_boolean_test.cc", "internal/platform/implementation/apple/atomic_uint32_test.cc", "internal/platform/implementation/shared/file_test.cc", + "internal/platform/implementation/wifi_utils_test.cc", "internal/platform/atomic_boolean_test.cc", "internal/platform/exception_test.cc", "internal/platform/error_code_recorder_test.cc", @@ -597,6 +622,7 @@ let package = Package( "compiled_proto", "connections/c", "connections/dart", + "connections/java", "connections/clients/ios", "connections/swift/NearbyCoreAdapter", "connections/swift/NearbyConnections/BUILD", diff --git a/WORKSPACE b/WORKSPACE index a587e5e4..1f206fec 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,192 +1,3 @@ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# Rule repository, note that it's recommended to use a pinned commit to a released version of the rules -http_archive( - name = "rules_foreign_cc", - strip_prefix = "rules_foreign_cc-0.6.0", - url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.6.0.tar.gz", -) - -load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") - -# This sets up some common toolchains for building targets. For more details, please see -# https://github.com/bazelbuild/rules_foreign_cc/tree/main/docs#rules_foreign_cc_dependencies -rules_foreign_cc_dependencies() - -_ALL_CONTENT = """\ -filegroup( - name = "all_srcs", - srcs = glob(["**"]), - visibility = ["//visibility:public"], -) -""" - -http_archive( - name = "com_google_absl", - strip_prefix = "abseil-cpp-master", - urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], -) - -# Using a protobuf javalite version that contains @com_google_protobuf_javalite//:javalite_toolchain -http_archive( - name = "com_google_protobuf_javalite", - strip_prefix = "protobuf-javalite", - urls = ["https://github.com/google/protobuf/archive/javalite.zip"], -) - -http_archive( - name = "com_google_protobuf", - strip_prefix = "protobuf-3.17.0", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.17.0.tar.gz"], -) - -http_archive( - name = "com_google_protobuf_cc", - strip_prefix = "protobuf-3.17.0", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.17.0.tar.gz"], -) - -http_archive( - name = "com_google_protobuf_java", - strip_prefix = "protobuf-3.17.0", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.17.0.tar.gz"], -) - -http_archive( - name = "com_google_glog", - sha256 = "f28359aeba12f30d73d9e4711ef356dc842886968112162bc73002645139c39c", - strip_prefix = "glog-0.4.0", - urls = ["https://github.com/google/glog/archive/v0.4.0.tar.gz"], -) - -http_archive( - name = "com_google_ukey2", - strip_prefix = "ukey2-master", - urls = ["https://github.com/google/ukey2/archive/master.zip"], -) - -http_archive( - name = "aappleby_smhasher", - strip_prefix = "smhasher-master", - build_file_content = """ -package(default_visibility = ["//visibility:public"]) -cc_library( - name = "libmurmur3", - srcs = ["src/MurmurHash3.cpp"], - hdrs = ["src/MurmurHash3.h"], - copts = ["-Wno-implicit-fallthrough"], - licenses = ["unencumbered"], # MurmurHash is explicity public-domain -)""", - urls = ["https://github.com/aappleby/smhasher/archive/master.zip"], -) - -http_archive( - name = "nlohmann_json", - strip_prefix = "json-3.10.5", - build_file_content = """ -cc_library( - name = "json", - hdrs = glob([ - "include/nlohmann/**/*.hpp", - ]), - includes = ["include"], - visibility = ["//visibility:public"], - alwayslink = True, -)""", - urls = [ - "https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.tar.gz", - ], -) - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") -# Load common dependencies. -protobuf_deps() - -http_archive( - name = "com_google_googletest", - strip_prefix = "googletest-main", - urls = ["https://github.com/google/googletest/archive/main.zip"], -) - -http_archive( - name = "com_google_webrtc", - build_file_content = """ -package(default_visibility = ["//visibility:public"]) -""", - urls = ["https://webrtc.googlesource.com/src/+archive/main.tar.gz"], -) - -# gflags needed by glog -http_archive( - name = "com_github_gflags_gflags", - strip_prefix = "gflags-2.2.2", - sha256 = "19713a36c9f32b33df59d1c79b4958434cb005b5b47dc5400a7a4b078111d9b5", - url = "https://github.com/gflags/gflags/archive/v2.2.2.zip", -) - -# ---------------------------------------------- -# Nisaba: Script processing library from Google: -# ---------------------------------------------- -# We depend on some of core C++ libraries from Nisaba and use the fresh code -# from the HEAD. See -# https://github.com/google-research/nisaba - -nisaba_version = "main" - -http_archive( - name = "com_google_nisaba", - url = "https://github.com/google-research/nisaba/archive/refs/heads/%s.zip" % nisaba_version, - strip_prefix = "nisaba-%s" % nisaba_version, -) - -load("@com_google_nisaba//bazel:workspace.bzl", "nisaba_public_repositories") - -nisaba_public_repositories() -http_archive( - name = "boringssl", - sha256 = "5d299325d1db8b2f2db3d927c7bc1f9fcbd05a3f9b5c8239fa527c09bf97f995", # Last updated 2022-10-19 - strip_prefix = "boringssl-0acfcff4be10514aacb98eb8ab27bb60136d131b", - urls = ["https://github.com/google/boringssl/archive/0acfcff4be10514aacb98eb8ab27bb60136d131b.tar.gz"], -) -# ------------------------------------------------------------------------- -# Protocol buffer matches (should be part of gmock and gtest, but not yet): -# https://github.com/inazarenko/protobuf-matchers - -http_archive( - name = "com_github_protobuf_matchers", - urls = ["https://github.com/inazarenko/protobuf-matchers/archive/refs/heads/master.zip"], - strip_prefix = "protobuf-matchers-master", -) - -http_archive( - name = "com_googlesource_code_re2", - sha256 = "26155e050b10b5969e986dab35654247a3b1b295e0532880b5a9c13c0a700ceb", - strip_prefix = "re2-2021-06-01", - urls = [ - "https://github.com/google/re2/archive/refs/tags/2021-06-01.tar.gz", - ], -) - -# bazel_pkg_config -http_archive( - name = "bazel_pkg_config", - strip_prefix = "bazel_pkg_config-master", - urls = ["https://github.com/cherrry/bazel_pkg_config/archive/master.zip"], -) - -load("@bazel_pkg_config//:pkg_config.bzl", "pkg_config") - -pkg_config( - name = "libsystemd", - pkg_name = "libsystemd", -) - -pkg_config( - name = "libcurl", - pkg_name = "libcurl", -) - -pkg_config( - name = "sdbus_cpp", - pkg_name = "sdbus-c++", -) +# ================================================ # +# All dependencies have been moved to MODULE.Bazel # +# ================================================ # diff --git a/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.cc b/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.cc index 7e041c19..905c2cb9 100644 --- a/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.cc +++ b/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.cc @@ -43,6 +43,7 @@ constexpr V1Frame::V1Frame( , authentication_result_(nullptr) , auto_resume_(nullptr) , auto_reconnect_(nullptr) + , bandwidth_upgrade_retry_(nullptr) , type_(0) {} struct V1FrameDefaultTypeInternal { @@ -67,6 +68,8 @@ constexpr ConnectionRequestFrame::ConnectionRequestFrame( , keep_alive_interval_millis_(0) , keep_alive_timeout_millis_(0) , device_type_(0) + , connection_mode_(0) + , _oneof_case_{}{} struct ConnectionRequestFrameDefaultTypeInternal { constexpr ConnectionRequestFrameDefaultTypeInternal() @@ -266,6 +269,18 @@ struct BandwidthUpgradeNegotiationFrame_UpgradePathInfoDefaultTypeInternal { }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BandwidthUpgradeNegotiationFrame_UpgradePathInfoDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_UpgradePathInfo_default_instance_; +constexpr BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : sta_frequency_(0){} +struct BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannelDefaultTypeInternal { + constexpr BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannelDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannelDefaultTypeInternal() {} + union { + BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannelDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel_default_instance_; constexpr BandwidthUpgradeNegotiationFrame_ClientIntroduction::BandwidthUpgradeNegotiationFrame_ClientIntroduction( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : endpoint_id_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) @@ -295,6 +310,7 @@ constexpr BandwidthUpgradeNegotiationFrame::BandwidthUpgradeNegotiationFrame( : upgrade_path_info_(nullptr) , client_introduction_(nullptr) , client_introduction_ack_(nullptr) + , safe_to_close_prior_channel_(nullptr) , event_type_(0) {} struct BandwidthUpgradeNegotiationFrameDefaultTypeInternal { @@ -306,6 +322,19 @@ struct BandwidthUpgradeNegotiationFrameDefaultTypeInternal { }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BandwidthUpgradeNegotiationFrameDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_default_instance_; +constexpr BandwidthUpgradeRetryFrame::BandwidthUpgradeRetryFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : supported_medium_() + , is_request_(false){} +struct BandwidthUpgradeRetryFrameDefaultTypeInternal { + constexpr BandwidthUpgradeRetryFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~BandwidthUpgradeRetryFrameDefaultTypeInternal() {} + union { + BandwidthUpgradeRetryFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT BandwidthUpgradeRetryFrameDefaultTypeInternal _BandwidthUpgradeRetryFrame_default_instance_; constexpr KeepAliveFrame::KeepAliveFrame( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : ack_(false) @@ -642,13 +671,14 @@ bool V1Frame_FrameType_IsValid(int value) { case 9: case 10: case 11: + case 12: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed V1Frame_FrameType_strings[12] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed V1Frame_FrameType_strings[13] = {}; static const char V1Frame_FrameType_names[] = "AUTHENTICATION_MESSAGE" @@ -656,6 +686,7 @@ static const char V1Frame_FrameType_names[] = "AUTO_RECONNECT" "AUTO_RESUME" "BANDWIDTH_UPGRADE_NEGOTIATION" + "BANDWIDTH_UPGRADE_RETRY" "CONNECTION_REQUEST" "CONNECTION_RESPONSE" "DISCONNECTION" @@ -670,28 +701,30 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry V1Frame_FrameType_entr { {V1Frame_FrameType_names + 43, 14}, 11 }, { {V1Frame_FrameType_names + 57, 11}, 10 }, { {V1Frame_FrameType_names + 68, 29}, 4 }, - { {V1Frame_FrameType_names + 97, 18}, 1 }, - { {V1Frame_FrameType_names + 115, 19}, 2 }, - { {V1Frame_FrameType_names + 134, 13}, 6 }, - { {V1Frame_FrameType_names + 147, 10}, 5 }, - { {V1Frame_FrameType_names + 157, 21}, 7 }, - { {V1Frame_FrameType_names + 178, 16}, 3 }, - { {V1Frame_FrameType_names + 194, 18}, 0 }, + { {V1Frame_FrameType_names + 97, 23}, 12 }, + { {V1Frame_FrameType_names + 120, 18}, 1 }, + { {V1Frame_FrameType_names + 138, 19}, 2 }, + { {V1Frame_FrameType_names + 157, 13}, 6 }, + { {V1Frame_FrameType_names + 170, 10}, 5 }, + { {V1Frame_FrameType_names + 180, 21}, 7 }, + { {V1Frame_FrameType_names + 201, 16}, 3 }, + { {V1Frame_FrameType_names + 217, 18}, 0 }, }; static const int V1Frame_FrameType_entries_by_number[] = { - 11, // 0 -> UNKNOWN_FRAME_TYPE - 5, // 1 -> CONNECTION_REQUEST - 6, // 2 -> CONNECTION_RESPONSE - 10, // 3 -> PAYLOAD_TRANSFER + 12, // 0 -> UNKNOWN_FRAME_TYPE + 6, // 1 -> CONNECTION_REQUEST + 7, // 2 -> CONNECTION_RESPONSE + 11, // 3 -> PAYLOAD_TRANSFER 4, // 4 -> BANDWIDTH_UPGRADE_NEGOTIATION - 8, // 5 -> KEEP_ALIVE - 7, // 6 -> DISCONNECTION - 9, // 7 -> PAIRED_KEY_ENCRYPTION + 9, // 5 -> KEEP_ALIVE + 8, // 6 -> DISCONNECTION + 10, // 7 -> PAIRED_KEY_ENCRYPTION 0, // 8 -> AUTHENTICATION_MESSAGE 1, // 9 -> AUTHENTICATION_RESULT 3, // 10 -> AUTO_RESUME 2, // 11 -> AUTO_RECONNECT + 5, // 12 -> BANDWIDTH_UPGRADE_RETRY }; const std::string& V1Frame_FrameType_Name( @@ -700,12 +733,12 @@ const std::string& V1Frame_FrameType_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( V1Frame_FrameType_entries, V1Frame_FrameType_entries_by_number, - 12, V1Frame_FrameType_strings); + 13, V1Frame_FrameType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( V1Frame_FrameType_entries, V1Frame_FrameType_entries_by_number, - 12, value); + 13, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : V1Frame_FrameType_strings[idx].get(); } @@ -713,7 +746,7 @@ bool V1Frame_FrameType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, V1Frame_FrameType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - V1Frame_FrameType_entries, 12, name, &int_value); + V1Frame_FrameType_entries, 13, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -732,6 +765,7 @@ constexpr V1Frame_FrameType V1Frame::AUTHENTICATION_MESSAGE; constexpr V1Frame_FrameType V1Frame::AUTHENTICATION_RESULT; constexpr V1Frame_FrameType V1Frame::AUTO_RESUME; constexpr V1Frame_FrameType V1Frame::AUTO_RECONNECT; +constexpr V1Frame_FrameType V1Frame::BANDWIDTH_UPGRADE_RETRY; constexpr V1Frame_FrameType V1Frame::FrameType_MIN; constexpr V1Frame_FrameType V1Frame::FrameType_MAX; constexpr int V1Frame::FrameType_ARRAYSIZE; @@ -750,13 +784,14 @@ bool ConnectionRequestFrame_Medium_IsValid(int value) { case 9: case 10: case 11: + case 12: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionRequestFrame_Medium_strings[12] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionRequestFrame_Medium_strings[13] = {}; static const char ConnectionRequestFrame_Medium_names[] = "BLE" @@ -767,6 +802,7 @@ static const char ConnectionRequestFrame_Medium_names[] = "UNKNOWN_MEDIUM" "USB" "WEB_RTC" + "WEB_RTC_NON_CELLULAR" "WIFI_AWARE" "WIFI_DIRECT" "WIFI_HOTSPOT" @@ -781,25 +817,27 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ConnectionRequestFrame { {ConnectionRequestFrame_Medium_names + 28, 14}, 0 }, { {ConnectionRequestFrame_Medium_names + 42, 3}, 11 }, { {ConnectionRequestFrame_Medium_names + 45, 7}, 9 }, - { {ConnectionRequestFrame_Medium_names + 52, 10}, 6 }, - { {ConnectionRequestFrame_Medium_names + 62, 11}, 8 }, - { {ConnectionRequestFrame_Medium_names + 73, 12}, 3 }, - { {ConnectionRequestFrame_Medium_names + 85, 8}, 5 }, + { {ConnectionRequestFrame_Medium_names + 52, 20}, 12 }, + { {ConnectionRequestFrame_Medium_names + 72, 10}, 6 }, + { {ConnectionRequestFrame_Medium_names + 82, 11}, 8 }, + { {ConnectionRequestFrame_Medium_names + 93, 12}, 3 }, + { {ConnectionRequestFrame_Medium_names + 105, 8}, 5 }, }; static const int ConnectionRequestFrame_Medium_entries_by_number[] = { 5, // 0 -> UNKNOWN_MEDIUM 3, // 1 -> MDNS 2, // 2 -> BLUETOOTH - 10, // 3 -> WIFI_HOTSPOT + 11, // 3 -> WIFI_HOTSPOT 0, // 4 -> BLE - 11, // 5 -> WIFI_LAN - 8, // 6 -> WIFI_AWARE + 12, // 5 -> WIFI_LAN + 9, // 6 -> WIFI_AWARE 4, // 7 -> NFC - 9, // 8 -> WIFI_DIRECT + 10, // 8 -> WIFI_DIRECT 7, // 9 -> WEB_RTC 1, // 10 -> BLE_L2CAP 6, // 11 -> USB + 8, // 12 -> WEB_RTC_NON_CELLULAR }; const std::string& ConnectionRequestFrame_Medium_Name( @@ -808,12 +846,12 @@ const std::string& ConnectionRequestFrame_Medium_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( ConnectionRequestFrame_Medium_entries, ConnectionRequestFrame_Medium_entries_by_number, - 12, ConnectionRequestFrame_Medium_strings); + 13, ConnectionRequestFrame_Medium_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( ConnectionRequestFrame_Medium_entries, ConnectionRequestFrame_Medium_entries_by_number, - 12, value); + 13, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : ConnectionRequestFrame_Medium_strings[idx].get(); } @@ -821,7 +859,7 @@ bool ConnectionRequestFrame_Medium_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionRequestFrame_Medium* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - ConnectionRequestFrame_Medium_entries, 12, name, &int_value); + ConnectionRequestFrame_Medium_entries, 13, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -840,10 +878,69 @@ constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::WIFI_DIRECT; constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::WEB_RTC; constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::BLE_L2CAP; constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::USB; +constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::WEB_RTC_NON_CELLULAR; constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::Medium_MIN; constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame::Medium_MAX; constexpr int ConnectionRequestFrame::Medium_ARRAYSIZE; #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ConnectionRequestFrame_ConnectionMode_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionRequestFrame_ConnectionMode_strings[2] = {}; + +static const char ConnectionRequestFrame_ConnectionMode_names[] = + "INSTANT" + "LEGACY"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ConnectionRequestFrame_ConnectionMode_entries[] = { + { {ConnectionRequestFrame_ConnectionMode_names + 0, 7}, 1 }, + { {ConnectionRequestFrame_ConnectionMode_names + 7, 6}, 0 }, +}; + +static const int ConnectionRequestFrame_ConnectionMode_entries_by_number[] = { + 1, // 0 -> LEGACY + 0, // 1 -> INSTANT +}; + +const std::string& ConnectionRequestFrame_ConnectionMode_Name( + ConnectionRequestFrame_ConnectionMode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ConnectionRequestFrame_ConnectionMode_entries, + ConnectionRequestFrame_ConnectionMode_entries_by_number, + 2, ConnectionRequestFrame_ConnectionMode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ConnectionRequestFrame_ConnectionMode_entries, + ConnectionRequestFrame_ConnectionMode_entries_by_number, + 2, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ConnectionRequestFrame_ConnectionMode_strings[idx].get(); +} +bool ConnectionRequestFrame_ConnectionMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionRequestFrame_ConnectionMode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ConnectionRequestFrame_ConnectionMode_entries, 2, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame::LEGACY; +constexpr ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame::INSTANT; +constexpr ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame::ConnectionMode_MIN; +constexpr ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame::ConnectionMode_MAX; +constexpr int ConnectionRequestFrame::ConnectionMode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) bool ConnectionResponseFrame_ResponseStatus_IsValid(int value) { switch (value) { case 0: @@ -1101,29 +1198,33 @@ bool PayloadTransferFrame_PacketType_IsValid(int value) { case 0: case 1: case 2: + case 3: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed PayloadTransferFrame_PacketType_strings[3] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed PayloadTransferFrame_PacketType_strings[4] = {}; static const char PayloadTransferFrame_PacketType_names[] = "CONTROL" "DATA" + "PAYLOAD_ACK" "UNKNOWN_PACKET_TYPE"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry PayloadTransferFrame_PacketType_entries[] = { { {PayloadTransferFrame_PacketType_names + 0, 7}, 2 }, { {PayloadTransferFrame_PacketType_names + 7, 4}, 1 }, - { {PayloadTransferFrame_PacketType_names + 11, 19}, 0 }, + { {PayloadTransferFrame_PacketType_names + 11, 11}, 3 }, + { {PayloadTransferFrame_PacketType_names + 22, 19}, 0 }, }; static const int PayloadTransferFrame_PacketType_entries_by_number[] = { - 2, // 0 -> UNKNOWN_PACKET_TYPE + 3, // 0 -> UNKNOWN_PACKET_TYPE 1, // 1 -> DATA 0, // 2 -> CONTROL + 2, // 3 -> PAYLOAD_ACK }; const std::string& PayloadTransferFrame_PacketType_Name( @@ -1132,12 +1233,12 @@ const std::string& PayloadTransferFrame_PacketType_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( PayloadTransferFrame_PacketType_entries, PayloadTransferFrame_PacketType_entries_by_number, - 3, PayloadTransferFrame_PacketType_strings); + 4, PayloadTransferFrame_PacketType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( PayloadTransferFrame_PacketType_entries, PayloadTransferFrame_PacketType_entries_by_number, - 3, value); + 4, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : PayloadTransferFrame_PacketType_strings[idx].get(); } @@ -1145,7 +1246,7 @@ bool PayloadTransferFrame_PacketType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, PayloadTransferFrame_PacketType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - PayloadTransferFrame_PacketType_entries, 3, name, &int_value); + PayloadTransferFrame_PacketType_entries, 4, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1155,6 +1256,7 @@ bool PayloadTransferFrame_PacketType_Parse( constexpr PayloadTransferFrame_PacketType PayloadTransferFrame::UNKNOWN_PACKET_TYPE; constexpr PayloadTransferFrame_PacketType PayloadTransferFrame::DATA; constexpr PayloadTransferFrame_PacketType PayloadTransferFrame::CONTROL; +constexpr PayloadTransferFrame_PacketType PayloadTransferFrame::PAYLOAD_ACK; constexpr PayloadTransferFrame_PacketType PayloadTransferFrame::PacketType_MIN; constexpr PayloadTransferFrame_PacketType PayloadTransferFrame::PacketType_MAX; constexpr int PayloadTransferFrame::PacketType_ARRAYSIZE; @@ -1172,13 +1274,14 @@ bool BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_IsValid(int value) case 8: case 9: case 11: + case 12: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_strings[11] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_strings[12] = {}; static const char BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names[] = "BLE" @@ -1188,6 +1291,7 @@ static const char BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names[ "UNKNOWN_MEDIUM" "USB" "WEB_RTC" + "WEB_RTC_NON_CELLULAR" "WIFI_AWARE" "WIFI_DIRECT" "WIFI_HOTSPOT" @@ -1201,24 +1305,26 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry BandwidthUpgradeNegoti { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 19, 14}, 0 }, { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 33, 3}, 11 }, { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 36, 7}, 9 }, - { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 43, 10}, 6 }, - { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 53, 11}, 8 }, - { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 64, 12}, 3 }, - { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 76, 8}, 5 }, + { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 43, 20}, 12 }, + { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 63, 10}, 6 }, + { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 73, 11}, 8 }, + { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 84, 12}, 3 }, + { {BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_names + 96, 8}, 5 }, }; static const int BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries_by_number[] = { 4, // 0 -> UNKNOWN_MEDIUM 2, // 1 -> MDNS 1, // 2 -> BLUETOOTH - 9, // 3 -> WIFI_HOTSPOT + 10, // 3 -> WIFI_HOTSPOT 0, // 4 -> BLE - 10, // 5 -> WIFI_LAN - 7, // 6 -> WIFI_AWARE + 11, // 5 -> WIFI_LAN + 8, // 6 -> WIFI_AWARE 3, // 7 -> NFC - 8, // 8 -> WIFI_DIRECT + 9, // 8 -> WIFI_DIRECT 6, // 9 -> WEB_RTC 5, // 11 -> USB + 7, // 12 -> WEB_RTC_NON_CELLULAR }; const std::string& BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Name( @@ -1227,12 +1333,12 @@ const std::string& BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries_by_number, - 11, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_strings); + 12, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries_by_number, - 11, value); + 12, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_strings[idx].get(); } @@ -1240,7 +1346,7 @@ bool BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries, 11, name, &int_value); + BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_entries, 12, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1258,6 +1364,7 @@ constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgra constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo::WIFI_DIRECT; constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo::WEB_RTC; constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo::USB; +constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo::WEB_RTC_NON_CELLULAR; constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo::Medium_MIN; constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo::Medium_MAX; constexpr int BandwidthUpgradeNegotiationFrame_UpgradePathInfo::Medium_ARRAYSIZE; @@ -1345,6 +1452,114 @@ constexpr BandwidthUpgradeNegotiationFrame_EventType BandwidthUpgradeNegotiation constexpr BandwidthUpgradeNegotiationFrame_EventType BandwidthUpgradeNegotiationFrame::EventType_MAX; constexpr int BandwidthUpgradeNegotiationFrame::EventType_ARRAYSIZE; #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool BandwidthUpgradeRetryFrame_Medium_IsValid(int value) { + switch (value) { + case 0: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed BandwidthUpgradeRetryFrame_Medium_strings[12] = {}; + +static const char BandwidthUpgradeRetryFrame_Medium_names[] = + "BLE" + "BLE_L2CAP" + "BLUETOOTH" + "NFC" + "UNKNOWN_MEDIUM" + "USB" + "WEB_RTC" + "WEB_RTC_NON_CELLULAR" + "WIFI_AWARE" + "WIFI_DIRECT" + "WIFI_HOTSPOT" + "WIFI_LAN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry BandwidthUpgradeRetryFrame_Medium_entries[] = { + { {BandwidthUpgradeRetryFrame_Medium_names + 0, 3}, 4 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 3, 9}, 10 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 12, 9}, 2 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 21, 3}, 7 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 24, 14}, 0 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 38, 3}, 11 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 41, 7}, 9 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 48, 20}, 12 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 68, 10}, 6 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 78, 11}, 8 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 89, 12}, 3 }, + { {BandwidthUpgradeRetryFrame_Medium_names + 101, 8}, 5 }, +}; + +static const int BandwidthUpgradeRetryFrame_Medium_entries_by_number[] = { + 4, // 0 -> UNKNOWN_MEDIUM + 2, // 2 -> BLUETOOTH + 10, // 3 -> WIFI_HOTSPOT + 0, // 4 -> BLE + 11, // 5 -> WIFI_LAN + 8, // 6 -> WIFI_AWARE + 3, // 7 -> NFC + 9, // 8 -> WIFI_DIRECT + 6, // 9 -> WEB_RTC + 1, // 10 -> BLE_L2CAP + 5, // 11 -> USB + 7, // 12 -> WEB_RTC_NON_CELLULAR +}; + +const std::string& BandwidthUpgradeRetryFrame_Medium_Name( + BandwidthUpgradeRetryFrame_Medium value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + BandwidthUpgradeRetryFrame_Medium_entries, + BandwidthUpgradeRetryFrame_Medium_entries_by_number, + 12, BandwidthUpgradeRetryFrame_Medium_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + BandwidthUpgradeRetryFrame_Medium_entries, + BandwidthUpgradeRetryFrame_Medium_entries_by_number, + 12, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + BandwidthUpgradeRetryFrame_Medium_strings[idx].get(); +} +bool BandwidthUpgradeRetryFrame_Medium_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, BandwidthUpgradeRetryFrame_Medium* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + BandwidthUpgradeRetryFrame_Medium_entries, 12, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::UNKNOWN_MEDIUM; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::BLUETOOTH; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::WIFI_HOTSPOT; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::BLE; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::WIFI_LAN; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::WIFI_AWARE; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::NFC; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::WIFI_DIRECT; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::WEB_RTC; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::BLE_L2CAP; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::USB; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::WEB_RTC_NON_CELLULAR; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::Medium_MIN; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::Medium_MAX; +constexpr int BandwidthUpgradeRetryFrame::Medium_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) bool AutoResumeFrame_EventType_IsValid(int value) { switch (value) { case 0: @@ -2009,7 +2224,7 @@ class V1Frame::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_type(HasBits* has_bits) { - (*has_bits)[0] |= 2048u; + (*has_bits)[0] |= 4096u; } static const ::location::nearby::connections::ConnectionRequestFrame& connection_request(const V1Frame* msg); static void set_has_connection_request(HasBits* has_bits) { @@ -2055,6 +2270,10 @@ class V1Frame::_Internal { static void set_has_auto_reconnect(HasBits* has_bits) { (*has_bits)[0] |= 1024u; } + static const ::location::nearby::connections::BandwidthUpgradeRetryFrame& bandwidth_upgrade_retry(const V1Frame* msg); + static void set_has_bandwidth_upgrade_retry(HasBits* has_bits) { + (*has_bits)[0] |= 2048u; + } }; const ::location::nearby::connections::ConnectionRequestFrame& @@ -2101,6 +2320,10 @@ const ::location::nearby::connections::AutoReconnectFrame& V1Frame::_Internal::auto_reconnect(const V1Frame* msg) { return *msg->auto_reconnect_; } +const ::location::nearby::connections::BandwidthUpgradeRetryFrame& +V1Frame::_Internal::bandwidth_upgrade_retry(const V1Frame* msg) { + return *msg->bandwidth_upgrade_retry_; +} V1Frame::V1Frame(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { @@ -2169,6 +2392,11 @@ V1Frame::V1Frame(const V1Frame& from) } else { auto_reconnect_ = nullptr; } + if (from._internal_has_bandwidth_upgrade_retry()) { + bandwidth_upgrade_retry_ = new ::location::nearby::connections::BandwidthUpgradeRetryFrame(*from.bandwidth_upgrade_retry_); + } else { + bandwidth_upgrade_retry_ = nullptr; + } type_ = from.type_; // @@protoc_insertion_point(copy_constructor:location.nearby.connections.V1Frame) } @@ -2200,6 +2428,7 @@ inline void V1Frame::SharedDtor() { if (this != internal_default_instance()) delete authentication_result_; if (this != internal_default_instance()) delete auto_resume_; if (this != internal_default_instance()) delete auto_reconnect_; + if (this != internal_default_instance()) delete bandwidth_upgrade_retry_; } void V1Frame::ArenaDtor(void* object) { @@ -2253,7 +2482,7 @@ void V1Frame::Clear() { authentication_message_->Clear(); } } - if (cached_has_bits & 0x00000700u) { + if (cached_has_bits & 0x00000f00u) { if (cached_has_bits & 0x00000100u) { GOOGLE_DCHECK(authentication_result_ != nullptr); authentication_result_->Clear(); @@ -2266,6 +2495,10 @@ void V1Frame::Clear() { GOOGLE_DCHECK(auto_reconnect_ != nullptr); auto_reconnect_->Clear(); } + if (cached_has_bits & 0x00000800u) { + GOOGLE_DCHECK(bandwidth_upgrade_retry_ != nullptr); + bandwidth_upgrade_retry_->Clear(); + } } type_ = 0; _has_bits_.Clear(); @@ -2380,6 +2613,14 @@ const char* V1Frame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::in } else goto handle_unusual; continue; + // optional .location.nearby.connections.BandwidthUpgradeRetryFrame bandwidth_upgrade_retry = 13; + case 13: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 106)) { + ptr = ctx->ParseMessage(_internal_mutable_bandwidth_upgrade_retry(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -2412,7 +2653,7 @@ uint8_t* V1Frame::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional .location.nearby.connections.V1Frame.FrameType type = 1; - if (cached_has_bits & 0x00000800u) { + if (cached_has_bits & 0x00001000u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 1, this->_internal_type(), target); @@ -2506,6 +2747,14 @@ uint8_t* V1Frame::_InternalSerialize( 12, _Internal::auto_reconnect(this), target, stream); } + // optional .location.nearby.connections.BandwidthUpgradeRetryFrame bandwidth_upgrade_retry = 13; + if (cached_has_bits & 0x00000800u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 13, _Internal::bandwidth_upgrade_retry(this), target, stream); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -2581,7 +2830,7 @@ size_t V1Frame::ByteSizeLong() const { } } - if (cached_has_bits & 0x00000f00u) { + if (cached_has_bits & 0x00001f00u) { // optional .location.nearby.connections.AuthenticationResultFrame authentication_result = 10; if (cached_has_bits & 0x00000100u) { total_size += 1 + @@ -2603,8 +2852,15 @@ size_t V1Frame::ByteSizeLong() const { *auto_reconnect_); } - // optional .location.nearby.connections.V1Frame.FrameType type = 1; + // optional .location.nearby.connections.BandwidthUpgradeRetryFrame bandwidth_upgrade_retry = 13; if (cached_has_bits & 0x00000800u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *bandwidth_upgrade_retry_); + } + + // optional .location.nearby.connections.V1Frame.FrameType type = 1; + if (cached_has_bits & 0x00001000u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); } @@ -2657,7 +2913,7 @@ void V1Frame::MergeFrom(const V1Frame& from) { _internal_mutable_authentication_message()->::location::nearby::connections::AuthenticationMessageFrame::MergeFrom(from._internal_authentication_message()); } } - if (cached_has_bits & 0x00000f00u) { + if (cached_has_bits & 0x00001f00u) { if (cached_has_bits & 0x00000100u) { _internal_mutable_authentication_result()->::location::nearby::connections::AuthenticationResultFrame::MergeFrom(from._internal_authentication_result()); } @@ -2668,6 +2924,9 @@ void V1Frame::MergeFrom(const V1Frame& from) { _internal_mutable_auto_reconnect()->::location::nearby::connections::AutoReconnectFrame::MergeFrom(from._internal_auto_reconnect()); } if (cached_has_bits & 0x00000800u) { + _internal_mutable_bandwidth_upgrade_retry()->::location::nearby::connections::BandwidthUpgradeRetryFrame::MergeFrom(from._internal_bandwidth_upgrade_retry()); + } + if (cached_has_bits & 0x00001000u) { type_ = from.type_; } _has_bits_[0] |= cached_has_bits; @@ -2741,6 +3000,9 @@ class ConnectionRequestFrame::_Internal { } static const ::location::nearby::connections::ConnectionsDevice& connections_device(const ConnectionRequestFrame* msg); static const ::location::nearby::connections::PresenceDevice& presence_device(const ConnectionRequestFrame* msg); + static void set_has_connection_mode(HasBits* has_bits) { + (*has_bits)[0] |= 1024u; + } }; const ::location::nearby::connections::MediumMetadata& @@ -2846,8 +3108,8 @@ ConnectionRequestFrame::ConnectionRequestFrame(const ConnectionRequestFrame& fro medium_metadata_ = nullptr; } ::memcpy(&nonce_, &from.nonce_, - static_cast(reinterpret_cast(&device_type_) - - reinterpret_cast(&nonce_)) + sizeof(device_type_)); + static_cast(reinterpret_cast(&connection_mode_) - + reinterpret_cast(&nonce_)) + sizeof(connection_mode_)); clear_has_Device(); switch (from.Device_case()) { case kConnectionsDevice: { @@ -2888,8 +3150,8 @@ device_info_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&medium_metadata_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&device_type_) - - reinterpret_cast(&medium_metadata_)) + sizeof(device_type_)); + 0, static_cast(reinterpret_cast(&connection_mode_) - + reinterpret_cast(&medium_metadata_)) + sizeof(connection_mode_)); clear_has_Device(); } @@ -2980,10 +3242,10 @@ void ConnectionRequestFrame::Clear() { reinterpret_cast(&keep_alive_interval_millis_) - reinterpret_cast(&nonce_)) + sizeof(keep_alive_interval_millis_)); } - if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000700u) { ::memset(&keep_alive_timeout_millis_, 0, static_cast( - reinterpret_cast(&device_type_) - - reinterpret_cast(&keep_alive_timeout_millis_)) + sizeof(device_type_)); + reinterpret_cast(&connection_mode_) - + reinterpret_cast(&keep_alive_timeout_millis_)) + sizeof(connection_mode_)); } clear_Device(); _has_bits_.Clear(); @@ -3123,6 +3385,19 @@ const char* ConnectionRequestFrame::_InternalParse(const char* ptr, ::PROTOBUF_N } else goto handle_unusual; continue; + // optional .location.nearby.connections.ConnectionRequestFrame.ConnectionMode connection_mode = 14; + case 14: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 112)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::connections::ConnectionRequestFrame_ConnectionMode_IsValid(val))) { + _internal_set_connection_mode(static_cast<::location::nearby::connections::ConnectionRequestFrame_ConnectionMode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(14, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -3240,6 +3515,13 @@ uint8_t* ConnectionRequestFrame::_InternalSerialize( } default: ; } + // optional .location.nearby.connections.ConnectionRequestFrame.ConnectionMode connection_mode = 14; + if (cached_has_bits & 0x00000400u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 14, this->_internal_connection_mode(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -3321,7 +3603,7 @@ size_t ConnectionRequestFrame::ByteSizeLong() const { } } - if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000700u) { // optional int32 keep_alive_timeout_millis = 9; if (cached_has_bits & 0x00000100u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_keep_alive_timeout_millis()); @@ -3332,6 +3614,12 @@ size_t ConnectionRequestFrame::ByteSizeLong() const { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_device_type()); } + // optional .location.nearby.connections.ConnectionRequestFrame.ConnectionMode connection_mode = 14; + if (cached_has_bits & 0x00000400u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_connection_mode()); + } + } switch (Device_case()) { // .location.nearby.connections.ConnectionsDevice connections_device = 12; @@ -3401,13 +3689,16 @@ void ConnectionRequestFrame::MergeFrom(const ConnectionRequestFrame& from) { } _has_bits_[0] |= cached_has_bits; } - if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000700u) { if (cached_has_bits & 0x00000100u) { keep_alive_timeout_millis_ = from.keep_alive_timeout_millis_; } if (cached_has_bits & 0x00000200u) { device_type_ = from.device_type_; } + if (cached_has_bits & 0x00000400u) { + connection_mode_ = from.connection_mode_; + } _has_bits_[0] |= cached_has_bits; } switch (from.Device_case()) { @@ -3470,8 +3761,8 @@ void ConnectionRequestFrame::InternalSwap(ConnectionRequestFrame* other) { &other->device_info_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(ConnectionRequestFrame, device_type_) - + sizeof(ConnectionRequestFrame::device_type_) + PROTOBUF_FIELD_OFFSET(ConnectionRequestFrame, connection_mode_) + + sizeof(ConnectionRequestFrame::connection_mode_) - PROTOBUF_FIELD_OFFSET(ConnectionRequestFrame, medium_metadata_)>( reinterpret_cast(&medium_metadata_), reinterpret_cast(&other->medium_metadata_)); @@ -7607,6 +7898,193 @@ std::string BandwidthUpgradeNegotiationFrame_UpgradePathInfo::GetTypeName() cons } +// =================================================================== + +class BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_sta_frequency(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) +} +BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + sta_frequency_ = from.sta_frequency_; + // @@protoc_insertion_point(copy_constructor:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) +} + +inline void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::SharedCtor() { +sta_frequency_ = 0; +} + +BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::~BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel() { + // @@protoc_insertion_point(destructor:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::ArenaDtor(void* object) { + BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* _this = reinterpret_cast< BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* >(object); + (void)_this; +} +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + sta_frequency_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 sta_frequency = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_sta_frequency(&has_bits); + sta_frequency_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 sta_frequency = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_sta_frequency(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + return target; +} + +size_t BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional int32 sta_frequency = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_sta_frequency()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::MergeFrom(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_sta_frequency()) { + _internal_set_sta_frequency(from._internal_sta_frequency()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::CopyFrom(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::IsInitialized() const { + return true; +} + +void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::InternalSwap(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(sta_frequency_, other->sta_frequency_); +} + +std::string BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::GetTypeName() const { + return "location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel"; +} + + // =================================================================== class BandwidthUpgradeNegotiationFrame_ClientIntroduction::_Internal { @@ -8002,7 +8480,7 @@ class BandwidthUpgradeNegotiationFrame::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_event_type(HasBits* has_bits) { - (*has_bits)[0] |= 8u; + (*has_bits)[0] |= 16u; } static const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo& upgrade_path_info(const BandwidthUpgradeNegotiationFrame* msg); static void set_has_upgrade_path_info(HasBits* has_bits) { @@ -8016,6 +8494,10 @@ class BandwidthUpgradeNegotiationFrame::_Internal { static void set_has_client_introduction_ack(HasBits* has_bits) { (*has_bits)[0] |= 4u; } + static const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& safe_to_close_prior_channel(const BandwidthUpgradeNegotiationFrame* msg); + static void set_has_safe_to_close_prior_channel(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } }; const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo& @@ -8030,6 +8512,10 @@ const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIn BandwidthUpgradeNegotiationFrame::_Internal::client_introduction_ack(const BandwidthUpgradeNegotiationFrame* msg) { return *msg->client_introduction_ack_; } +const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& +BandwidthUpgradeNegotiationFrame::_Internal::safe_to_close_prior_channel(const BandwidthUpgradeNegotiationFrame* msg) { + return *msg->safe_to_close_prior_channel_; +} BandwidthUpgradeNegotiationFrame::BandwidthUpgradeNegotiationFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { @@ -8058,6 +8544,11 @@ BandwidthUpgradeNegotiationFrame::BandwidthUpgradeNegotiationFrame(const Bandwid } else { client_introduction_ack_ = nullptr; } + if (from._internal_has_safe_to_close_prior_channel()) { + safe_to_close_prior_channel_ = new ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(*from.safe_to_close_prior_channel_); + } else { + safe_to_close_prior_channel_ = nullptr; + } event_type_ = from.event_type_; // @@protoc_insertion_point(copy_constructor:location.nearby.connections.BandwidthUpgradeNegotiationFrame) } @@ -8081,6 +8572,7 @@ inline void BandwidthUpgradeNegotiationFrame::SharedDtor() { if (this != internal_default_instance()) delete upgrade_path_info_; if (this != internal_default_instance()) delete client_introduction_; if (this != internal_default_instance()) delete client_introduction_ack_; + if (this != internal_default_instance()) delete safe_to_close_prior_channel_; } void BandwidthUpgradeNegotiationFrame::ArenaDtor(void* object) { @@ -8100,7 +8592,7 @@ void BandwidthUpgradeNegotiationFrame::Clear() { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x0000000fu) { if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(upgrade_path_info_ != nullptr); upgrade_path_info_->Clear(); @@ -8113,6 +8605,10 @@ void BandwidthUpgradeNegotiationFrame::Clear() { GOOGLE_DCHECK(client_introduction_ack_ != nullptr); client_introduction_ack_->Clear(); } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(safe_to_close_prior_channel_ != nullptr); + safe_to_close_prior_channel_->Clear(); + } } event_type_ = 0; _has_bits_.Clear(); @@ -8163,6 +8659,14 @@ const char* BandwidthUpgradeNegotiationFrame::_InternalParse(const char* ptr, :: } else goto handle_unusual; continue; + // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel safe_to_close_prior_channel = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_safe_to_close_prior_channel(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -8195,7 +8699,7 @@ uint8_t* BandwidthUpgradeNegotiationFrame::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.EventType event_type = 1; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 1, this->_internal_event_type(), target); @@ -8225,6 +8729,14 @@ uint8_t* BandwidthUpgradeNegotiationFrame::_InternalSerialize( 4, _Internal::client_introduction_ack(this), target, stream); } + // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel safe_to_close_prior_channel = 5; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 5, _Internal::safe_to_close_prior_channel(this), target, stream); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -8242,7 +8754,7 @@ size_t BandwidthUpgradeNegotiationFrame::ByteSizeLong() const { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x0000001fu) { // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.UpgradePathInfo upgrade_path_info = 2; if (cached_has_bits & 0x00000001u) { total_size += 1 + @@ -8264,8 +8776,15 @@ size_t BandwidthUpgradeNegotiationFrame::ByteSizeLong() const { *client_introduction_ack_); } - // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.EventType event_type = 1; + // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel safe_to_close_prior_channel = 5; if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *safe_to_close_prior_channel_); + } + + // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.EventType event_type = 1; + if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_event_type()); } @@ -8292,7 +8811,7 @@ void BandwidthUpgradeNegotiationFrame::MergeFrom(const BandwidthUpgradeNegotiati (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x0000001fu) { if (cached_has_bits & 0x00000001u) { _internal_mutable_upgrade_path_info()->::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo::MergeFrom(from._internal_upgrade_path_info()); } @@ -8303,6 +8822,9 @@ void BandwidthUpgradeNegotiationFrame::MergeFrom(const BandwidthUpgradeNegotiati _internal_mutable_client_introduction_ack()->::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroductionAck::MergeFrom(from._internal_client_introduction_ack()); } if (cached_has_bits & 0x00000008u) { + _internal_mutable_safe_to_close_prior_channel()->::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::MergeFrom(from._internal_safe_to_close_prior_channel()); + } + if (cached_has_bits & 0x00000010u) { event_type_ = from.event_type_; } _has_bits_[0] |= cached_has_bits; @@ -8338,6 +8860,236 @@ std::string BandwidthUpgradeNegotiationFrame::GetTypeName() const { } +// =================================================================== + +class BandwidthUpgradeRetryFrame::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_is_request(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +BandwidthUpgradeRetryFrame::BandwidthUpgradeRetryFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned), + supported_medium_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.connections.BandwidthUpgradeRetryFrame) +} +BandwidthUpgradeRetryFrame::BandwidthUpgradeRetryFrame(const BandwidthUpgradeRetryFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_), + supported_medium_(from.supported_medium_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + is_request_ = from.is_request_; + // @@protoc_insertion_point(copy_constructor:location.nearby.connections.BandwidthUpgradeRetryFrame) +} + +inline void BandwidthUpgradeRetryFrame::SharedCtor() { +is_request_ = false; +} + +BandwidthUpgradeRetryFrame::~BandwidthUpgradeRetryFrame() { + // @@protoc_insertion_point(destructor:location.nearby.connections.BandwidthUpgradeRetryFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void BandwidthUpgradeRetryFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void BandwidthUpgradeRetryFrame::ArenaDtor(void* object) { + BandwidthUpgradeRetryFrame* _this = reinterpret_cast< BandwidthUpgradeRetryFrame* >(object); + (void)_this; +} +void BandwidthUpgradeRetryFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void BandwidthUpgradeRetryFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void BandwidthUpgradeRetryFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.connections.BandwidthUpgradeRetryFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + supported_medium_.Clear(); + is_request_ = false; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* BandwidthUpgradeRetryFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .location.nearby.connections.BandwidthUpgradeRetryFrame.Medium supported_medium = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + ptr -= 1; + do { + ptr += 1; + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium_IsValid(val))) { + _internal_add_supported_medium(static_cast<::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<8>(ptr)); + } else if (static_cast(tag) == 10) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_supported_medium(), ptr, ctx, ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium_IsValid, &_internal_metadata_, 1); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_request = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_is_request(&has_bits); + is_request_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* BandwidthUpgradeRetryFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.connections.BandwidthUpgradeRetryFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .location.nearby.connections.BandwidthUpgradeRetryFrame.Medium supported_medium = 1; + for (int i = 0, n = this->_internal_supported_medium_size(); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_supported_medium(i), target); + } + + cached_has_bits = _has_bits_[0]; + // optional bool is_request = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_is_request(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.connections.BandwidthUpgradeRetryFrame) + return target; +} + +size_t BandwidthUpgradeRetryFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.connections.BandwidthUpgradeRetryFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .location.nearby.connections.BandwidthUpgradeRetryFrame.Medium supported_medium = 1; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_supported_medium_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_supported_medium(static_cast(i))); + } + total_size += (1UL * count) + data_size; + } + + // optional bool is_request = 2; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + 1; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void BandwidthUpgradeRetryFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void BandwidthUpgradeRetryFrame::MergeFrom(const BandwidthUpgradeRetryFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.connections.BandwidthUpgradeRetryFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + supported_medium_.MergeFrom(from.supported_medium_); + if (from._internal_has_is_request()) { + _internal_set_is_request(from._internal_is_request()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void BandwidthUpgradeRetryFrame::CopyFrom(const BandwidthUpgradeRetryFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.connections.BandwidthUpgradeRetryFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool BandwidthUpgradeRetryFrame::IsInitialized() const { + return true; +} + +void BandwidthUpgradeRetryFrame::InternalSwap(BandwidthUpgradeRetryFrame* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + supported_medium_.InternalSwap(&other->supported_medium_); + swap(is_request_, other->is_request_); +} + +std::string BandwidthUpgradeRetryFrame::GetTypeName() const { + return "location.nearby.connections.BandwidthUpgradeRetryFrame"; +} + + // =================================================================== class KeepAliveFrame::_Internal { @@ -13074,6 +13826,9 @@ template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeNe template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo* Arena::CreateMaybeMessage< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo >(Arena* arena) { return Arena::CreateMessageInternal< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo >(arena); } +template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* Arena::CreateMaybeMessage< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel >(arena); +} template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroduction* Arena::CreateMaybeMessage< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroduction >(Arena* arena) { return Arena::CreateMessageInternal< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroduction >(arena); } @@ -13083,6 +13838,9 @@ template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeNe template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeNegotiationFrame* Arena::CreateMaybeMessage< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame >(Arena* arena) { return Arena::CreateMessageInternal< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame >(arena); } +template<> PROTOBUF_NOINLINE ::location::nearby::connections::BandwidthUpgradeRetryFrame* Arena::CreateMaybeMessage< ::location::nearby::connections::BandwidthUpgradeRetryFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::connections::BandwidthUpgradeRetryFrame >(arena); +} template<> PROTOBUF_NOINLINE ::location::nearby::connections::KeepAliveFrame* Arena::CreateMaybeMessage< ::location::nearby::connections::KeepAliveFrame >(Arena* arena) { return Arena::CreateMessageInternal< ::location::nearby::connections::KeepAliveFrame >(arena); } diff --git a/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.h b/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.h index 22ca5e23..69ef2021 100644 --- a/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.h +++ b/compiled_proto/connections/implementation/proto/offline_wire_formats.pb.h @@ -45,7 +45,7 @@ struct TableStruct_connections_2fimplementation_2fproto_2foffline_5fwire_5fforma PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[36] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[38] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; @@ -78,6 +78,9 @@ extern BandwidthUpgradeNegotiationFrame_ClientIntroductionDefaultTypeInternal _B class BandwidthUpgradeNegotiationFrame_ClientIntroductionAck; struct BandwidthUpgradeNegotiationFrame_ClientIntroductionAckDefaultTypeInternal; extern BandwidthUpgradeNegotiationFrame_ClientIntroductionAckDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_ClientIntroductionAck_default_instance_; +class BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel; +struct BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannelDefaultTypeInternal; +extern BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannelDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel_default_instance_; class BandwidthUpgradeNegotiationFrame_UpgradePathInfo; struct BandwidthUpgradeNegotiationFrame_UpgradePathInfoDefaultTypeInternal; extern BandwidthUpgradeNegotiationFrame_UpgradePathInfoDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_UpgradePathInfo_default_instance_; @@ -99,6 +102,9 @@ extern BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiHotspotCredentialsDe class BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiLanSocket; struct BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiLanSocketDefaultTypeInternal; extern BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiLanSocketDefaultTypeInternal _BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiLanSocket_default_instance_; +class BandwidthUpgradeRetryFrame; +struct BandwidthUpgradeRetryFrameDefaultTypeInternal; +extern BandwidthUpgradeRetryFrameDefaultTypeInternal _BandwidthUpgradeRetryFrame_default_instance_; class ConnectionRequestFrame; struct ConnectionRequestFrameDefaultTypeInternal; extern ConnectionRequestFrameDefaultTypeInternal _ConnectionRequestFrame_default_instance_; @@ -174,6 +180,7 @@ template<> ::location::nearby::connections::AvailableChannels* Arena::CreateMayb template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroduction* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroduction>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroductionAck* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroductionAck>(Arena*); +template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_BluetoothCredentials* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_BluetoothCredentials>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WebRtcCredentials* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WebRtcCredentials>(Arena*); @@ -181,6 +188,7 @@ template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_Upg template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiDirectCredentials* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiDirectCredentials>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiHotspotCredentials* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiHotspotCredentials>(Arena*); template<> ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiLanSocket* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_WifiLanSocket>(Arena*); +template<> ::location::nearby::connections::BandwidthUpgradeRetryFrame* Arena::CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeRetryFrame>(Arena*); template<> ::location::nearby::connections::ConnectionRequestFrame* Arena::CreateMaybeMessage<::location::nearby::connections::ConnectionRequestFrame>(Arena*); template<> ::location::nearby::connections::ConnectionResponseFrame* Arena::CreateMaybeMessage<::location::nearby::connections::ConnectionResponseFrame>(Arena*); template<> ::location::nearby::connections::ConnectionsDevice* Arena::CreateMaybeMessage<::location::nearby::connections::ConnectionsDevice>(Arena*); @@ -238,11 +246,12 @@ enum V1Frame_FrameType : int { V1Frame_FrameType_AUTHENTICATION_MESSAGE = 8, V1Frame_FrameType_AUTHENTICATION_RESULT = 9, V1Frame_FrameType_AUTO_RESUME = 10, - V1Frame_FrameType_AUTO_RECONNECT = 11 + V1Frame_FrameType_AUTO_RECONNECT = 11, + V1Frame_FrameType_BANDWIDTH_UPGRADE_RETRY = 12 }; bool V1Frame_FrameType_IsValid(int value); constexpr V1Frame_FrameType V1Frame_FrameType_FrameType_MIN = V1Frame_FrameType_UNKNOWN_FRAME_TYPE; -constexpr V1Frame_FrameType V1Frame_FrameType_FrameType_MAX = V1Frame_FrameType_AUTO_RECONNECT; +constexpr V1Frame_FrameType V1Frame_FrameType_FrameType_MAX = V1Frame_FrameType_BANDWIDTH_UPGRADE_RETRY; constexpr int V1Frame_FrameType_FrameType_ARRAYSIZE = V1Frame_FrameType_FrameType_MAX + 1; const std::string& V1Frame_FrameType_Name(V1Frame_FrameType value); @@ -267,11 +276,12 @@ enum ConnectionRequestFrame_Medium : int { ConnectionRequestFrame_Medium_WIFI_DIRECT = 8, ConnectionRequestFrame_Medium_WEB_RTC = 9, ConnectionRequestFrame_Medium_BLE_L2CAP = 10, - ConnectionRequestFrame_Medium_USB = 11 + ConnectionRequestFrame_Medium_USB = 11, + ConnectionRequestFrame_Medium_WEB_RTC_NON_CELLULAR = 12 }; bool ConnectionRequestFrame_Medium_IsValid(int value); constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame_Medium_Medium_MIN = ConnectionRequestFrame_Medium_UNKNOWN_MEDIUM; -constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame_Medium_Medium_MAX = ConnectionRequestFrame_Medium_USB; +constexpr ConnectionRequestFrame_Medium ConnectionRequestFrame_Medium_Medium_MAX = ConnectionRequestFrame_Medium_WEB_RTC_NON_CELLULAR; constexpr int ConnectionRequestFrame_Medium_Medium_ARRAYSIZE = ConnectionRequestFrame_Medium_Medium_MAX + 1; const std::string& ConnectionRequestFrame_Medium_Name(ConnectionRequestFrame_Medium value); @@ -284,6 +294,25 @@ inline const std::string& ConnectionRequestFrame_Medium_Name(T enum_t_value) { } bool ConnectionRequestFrame_Medium_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionRequestFrame_Medium* value); +enum ConnectionRequestFrame_ConnectionMode : int { + ConnectionRequestFrame_ConnectionMode_LEGACY = 0, + ConnectionRequestFrame_ConnectionMode_INSTANT = 1 +}; +bool ConnectionRequestFrame_ConnectionMode_IsValid(int value); +constexpr ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame_ConnectionMode_ConnectionMode_MIN = ConnectionRequestFrame_ConnectionMode_LEGACY; +constexpr ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame_ConnectionMode_ConnectionMode_MAX = ConnectionRequestFrame_ConnectionMode_INSTANT; +constexpr int ConnectionRequestFrame_ConnectionMode_ConnectionMode_ARRAYSIZE = ConnectionRequestFrame_ConnectionMode_ConnectionMode_MAX + 1; + +const std::string& ConnectionRequestFrame_ConnectionMode_Name(ConnectionRequestFrame_ConnectionMode value); +template +inline const std::string& ConnectionRequestFrame_ConnectionMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConnectionRequestFrame_ConnectionMode_Name."); + return ConnectionRequestFrame_ConnectionMode_Name(static_cast(enum_t_value)); +} +bool ConnectionRequestFrame_ConnectionMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionRequestFrame_ConnectionMode* value); enum ConnectionResponseFrame_ResponseStatus : int { ConnectionResponseFrame_ResponseStatus_UNKNOWN_RESPONSE_STATUS = 0, ConnectionResponseFrame_ResponseStatus_ACCEPT = 1, @@ -347,7 +376,7 @@ enum PayloadTransferFrame_ControlMessage_EventType : int { PayloadTransferFrame_ControlMessage_EventType_UNKNOWN_EVENT_TYPE = 0, PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_ERROR = 1, PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_CANCELED = 2, - PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_RECEIVED_ACK = 3 + PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_RECEIVED_ACK PROTOBUF_DEPRECATED_ENUM = 3 }; bool PayloadTransferFrame_ControlMessage_EventType_IsValid(int value); constexpr PayloadTransferFrame_ControlMessage_EventType PayloadTransferFrame_ControlMessage_EventType_EventType_MIN = PayloadTransferFrame_ControlMessage_EventType_UNKNOWN_EVENT_TYPE; @@ -367,11 +396,12 @@ bool PayloadTransferFrame_ControlMessage_EventType_Parse( enum PayloadTransferFrame_PacketType : int { PayloadTransferFrame_PacketType_UNKNOWN_PACKET_TYPE = 0, PayloadTransferFrame_PacketType_DATA = 1, - PayloadTransferFrame_PacketType_CONTROL = 2 + PayloadTransferFrame_PacketType_CONTROL = 2, + PayloadTransferFrame_PacketType_PAYLOAD_ACK = 3 }; bool PayloadTransferFrame_PacketType_IsValid(int value); constexpr PayloadTransferFrame_PacketType PayloadTransferFrame_PacketType_PacketType_MIN = PayloadTransferFrame_PacketType_UNKNOWN_PACKET_TYPE; -constexpr PayloadTransferFrame_PacketType PayloadTransferFrame_PacketType_PacketType_MAX = PayloadTransferFrame_PacketType_CONTROL; +constexpr PayloadTransferFrame_PacketType PayloadTransferFrame_PacketType_PacketType_MAX = PayloadTransferFrame_PacketType_PAYLOAD_ACK; constexpr int PayloadTransferFrame_PacketType_PacketType_ARRAYSIZE = PayloadTransferFrame_PacketType_PacketType_MAX + 1; const std::string& PayloadTransferFrame_PacketType_Name(PayloadTransferFrame_PacketType value); @@ -395,11 +425,12 @@ enum BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium : int { BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_NFC = 7, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_WIFI_DIRECT = 8, BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_WEB_RTC = 9, - BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_USB = 11 + BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_USB = 11, + BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_WEB_RTC_NON_CELLULAR = 12 }; bool BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_IsValid(int value); constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Medium_MIN = BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_UNKNOWN_MEDIUM; -constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Medium_MAX = BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_USB; +constexpr BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Medium_MAX = BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_WEB_RTC_NON_CELLULAR; constexpr int BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Medium_ARRAYSIZE = BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Medium_MAX + 1; const std::string& BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_Name(BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium value); @@ -436,6 +467,35 @@ inline const std::string& BandwidthUpgradeNegotiationFrame_EventType_Name(T enum } bool BandwidthUpgradeNegotiationFrame_EventType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, BandwidthUpgradeNegotiationFrame_EventType* value); +enum BandwidthUpgradeRetryFrame_Medium : int { + BandwidthUpgradeRetryFrame_Medium_UNKNOWN_MEDIUM = 0, + BandwidthUpgradeRetryFrame_Medium_BLUETOOTH = 2, + BandwidthUpgradeRetryFrame_Medium_WIFI_HOTSPOT = 3, + BandwidthUpgradeRetryFrame_Medium_BLE = 4, + BandwidthUpgradeRetryFrame_Medium_WIFI_LAN = 5, + BandwidthUpgradeRetryFrame_Medium_WIFI_AWARE = 6, + BandwidthUpgradeRetryFrame_Medium_NFC = 7, + BandwidthUpgradeRetryFrame_Medium_WIFI_DIRECT = 8, + BandwidthUpgradeRetryFrame_Medium_WEB_RTC = 9, + BandwidthUpgradeRetryFrame_Medium_BLE_L2CAP = 10, + BandwidthUpgradeRetryFrame_Medium_USB = 11, + BandwidthUpgradeRetryFrame_Medium_WEB_RTC_NON_CELLULAR = 12 +}; +bool BandwidthUpgradeRetryFrame_Medium_IsValid(int value); +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame_Medium_Medium_MIN = BandwidthUpgradeRetryFrame_Medium_UNKNOWN_MEDIUM; +constexpr BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame_Medium_Medium_MAX = BandwidthUpgradeRetryFrame_Medium_WEB_RTC_NON_CELLULAR; +constexpr int BandwidthUpgradeRetryFrame_Medium_Medium_ARRAYSIZE = BandwidthUpgradeRetryFrame_Medium_Medium_MAX + 1; + +const std::string& BandwidthUpgradeRetryFrame_Medium_Name(BandwidthUpgradeRetryFrame_Medium value); +template +inline const std::string& BandwidthUpgradeRetryFrame_Medium_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function BandwidthUpgradeRetryFrame_Medium_Name."); + return BandwidthUpgradeRetryFrame_Medium_Name(static_cast(enum_t_value)); +} +bool BandwidthUpgradeRetryFrame_Medium_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, BandwidthUpgradeRetryFrame_Medium* value); enum AutoResumeFrame_EventType : int { AutoResumeFrame_EventType_UNKNOWN_AUTO_RESUME_EVENT_TYPE = 0, AutoResumeFrame_EventType_PAYLOAD_RESUME_TRANSFER_START = 1, @@ -888,6 +948,8 @@ class V1Frame final : V1Frame_FrameType_AUTO_RESUME; static constexpr FrameType AUTO_RECONNECT = V1Frame_FrameType_AUTO_RECONNECT; + static constexpr FrameType BANDWIDTH_UPGRADE_RETRY = + V1Frame_FrameType_BANDWIDTH_UPGRADE_RETRY; static inline bool FrameType_IsValid(int value) { return V1Frame_FrameType_IsValid(value); } @@ -923,6 +985,7 @@ class V1Frame final : kAuthenticationResultFieldNumber = 10, kAutoResumeFieldNumber = 11, kAutoReconnectFieldNumber = 12, + kBandwidthUpgradeRetryFieldNumber = 13, kTypeFieldNumber = 1, }; // optional .location.nearby.connections.ConnectionRequestFrame connection_request = 2; @@ -1123,6 +1186,24 @@ class V1Frame final : ::location::nearby::connections::AutoReconnectFrame* auto_reconnect); ::location::nearby::connections::AutoReconnectFrame* unsafe_arena_release_auto_reconnect(); + // optional .location.nearby.connections.BandwidthUpgradeRetryFrame bandwidth_upgrade_retry = 13; + bool has_bandwidth_upgrade_retry() const; + private: + bool _internal_has_bandwidth_upgrade_retry() const; + public: + void clear_bandwidth_upgrade_retry(); + const ::location::nearby::connections::BandwidthUpgradeRetryFrame& bandwidth_upgrade_retry() const; + PROTOBUF_NODISCARD ::location::nearby::connections::BandwidthUpgradeRetryFrame* release_bandwidth_upgrade_retry(); + ::location::nearby::connections::BandwidthUpgradeRetryFrame* mutable_bandwidth_upgrade_retry(); + void set_allocated_bandwidth_upgrade_retry(::location::nearby::connections::BandwidthUpgradeRetryFrame* bandwidth_upgrade_retry); + private: + const ::location::nearby::connections::BandwidthUpgradeRetryFrame& _internal_bandwidth_upgrade_retry() const; + ::location::nearby::connections::BandwidthUpgradeRetryFrame* _internal_mutable_bandwidth_upgrade_retry(); + public: + void unsafe_arena_set_allocated_bandwidth_upgrade_retry( + ::location::nearby::connections::BandwidthUpgradeRetryFrame* bandwidth_upgrade_retry); + ::location::nearby::connections::BandwidthUpgradeRetryFrame* unsafe_arena_release_bandwidth_upgrade_retry(); + // optional .location.nearby.connections.V1Frame.FrameType type = 1; bool has_type() const; private: @@ -1156,6 +1237,7 @@ class V1Frame final : ::location::nearby::connections::AuthenticationResultFrame* authentication_result_; ::location::nearby::connections::AutoResumeFrame* auto_resume_; ::location::nearby::connections::AutoReconnectFrame* auto_reconnect_; + ::location::nearby::connections::BandwidthUpgradeRetryFrame* bandwidth_upgrade_retry_; int type_; friend struct ::TableStruct_connections_2fimplementation_2fproto_2foffline_5fwire_5fformats_2eproto; }; @@ -1302,6 +1384,8 @@ class ConnectionRequestFrame final : ConnectionRequestFrame_Medium_BLE_L2CAP; static constexpr Medium USB = ConnectionRequestFrame_Medium_USB; + static constexpr Medium WEB_RTC_NON_CELLULAR = + ConnectionRequestFrame_Medium_WEB_RTC_NON_CELLULAR; static inline bool Medium_IsValid(int value) { return ConnectionRequestFrame_Medium_IsValid(value); } @@ -1323,6 +1407,32 @@ class ConnectionRequestFrame final : return ConnectionRequestFrame_Medium_Parse(name, value); } + typedef ConnectionRequestFrame_ConnectionMode ConnectionMode; + static constexpr ConnectionMode LEGACY = + ConnectionRequestFrame_ConnectionMode_LEGACY; + static constexpr ConnectionMode INSTANT = + ConnectionRequestFrame_ConnectionMode_INSTANT; + static inline bool ConnectionMode_IsValid(int value) { + return ConnectionRequestFrame_ConnectionMode_IsValid(value); + } + static constexpr ConnectionMode ConnectionMode_MIN = + ConnectionRequestFrame_ConnectionMode_ConnectionMode_MIN; + static constexpr ConnectionMode ConnectionMode_MAX = + ConnectionRequestFrame_ConnectionMode_ConnectionMode_MAX; + static constexpr int ConnectionMode_ARRAYSIZE = + ConnectionRequestFrame_ConnectionMode_ConnectionMode_ARRAYSIZE; + template + static inline const std::string& ConnectionMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConnectionMode_Name."); + return ConnectionRequestFrame_ConnectionMode_Name(enum_t_value); + } + static inline bool ConnectionMode_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + ConnectionMode* value) { + return ConnectionRequestFrame_ConnectionMode_Parse(name, value); + } + // accessors ------------------------------------------------------- enum : int { @@ -1337,6 +1447,7 @@ class ConnectionRequestFrame final : kKeepAliveIntervalMillisFieldNumber = 8, kKeepAliveTimeoutMillisFieldNumber = 9, kDeviceTypeFieldNumber = 10, + kConnectionModeFieldNumber = 14, kConnectionsDeviceFieldNumber = 12, kPresenceDeviceFieldNumber = 13, }; @@ -1517,6 +1628,19 @@ class ConnectionRequestFrame final : void _internal_set_device_type(int32_t value); public: + // optional .location.nearby.connections.ConnectionRequestFrame.ConnectionMode connection_mode = 14; + bool has_connection_mode() const; + private: + bool _internal_has_connection_mode() const; + public: + void clear_connection_mode(); + ::location::nearby::connections::ConnectionRequestFrame_ConnectionMode connection_mode() const; + void set_connection_mode(::location::nearby::connections::ConnectionRequestFrame_ConnectionMode value); + private: + ::location::nearby::connections::ConnectionRequestFrame_ConnectionMode _internal_connection_mode() const; + void _internal_set_connection_mode(::location::nearby::connections::ConnectionRequestFrame_ConnectionMode value); + public: + // .location.nearby.connections.ConnectionsDevice connections_device = 12; bool has_connections_device() const; private: @@ -1580,6 +1704,7 @@ class ConnectionRequestFrame final : int32_t keep_alive_interval_millis_; int32_t keep_alive_timeout_millis_; int32_t device_type_; + int connection_mode_; union DeviceUnion { constexpr DeviceUnion() : _constinit_{} {} ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; @@ -2452,7 +2577,7 @@ class PayloadTransferFrame_ControlMessage final : PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_ERROR; static constexpr EventType PAYLOAD_CANCELED = PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_CANCELED; - static constexpr EventType PAYLOAD_RECEIVED_ACK = + PROTOBUF_DEPRECATED_ENUM static constexpr EventType PAYLOAD_RECEIVED_ACK = PayloadTransferFrame_ControlMessage_EventType_PAYLOAD_RECEIVED_ACK; static inline bool EventType_IsValid(int value) { return PayloadTransferFrame_ControlMessage_EventType_IsValid(value); @@ -2643,6 +2768,8 @@ class PayloadTransferFrame final : PayloadTransferFrame_PacketType_DATA; static constexpr PacketType CONTROL = PayloadTransferFrame_PacketType_CONTROL; + static constexpr PacketType PAYLOAD_ACK = + PayloadTransferFrame_PacketType_PAYLOAD_ACK; static inline bool PacketType_IsValid(int value) { return PayloadTransferFrame_PacketType_IsValid(value); } @@ -4035,6 +4162,8 @@ class BandwidthUpgradeNegotiationFrame_UpgradePathInfo final : BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_WEB_RTC; static constexpr Medium USB = BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_USB; + static constexpr Medium WEB_RTC_NON_CELLULAR = + BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_WEB_RTC_NON_CELLULAR; static inline bool Medium_IsValid(int value) { return BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium_IsValid(value); } @@ -4238,6 +4367,148 @@ class BandwidthUpgradeNegotiationFrame_UpgradePathInfo final : }; // ------------------------------------------------------------------- +class BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) */ { + public: + inline BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel() : BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(nullptr) {} + ~BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel() override; + explicit constexpr BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from); + BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel&& from) noexcept + : BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel() { + *this = ::std::move(from); + } + + inline BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& operator=(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from) { + CopyFrom(from); + return *this; + } + inline BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& operator=(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& default_instance() { + return *internal_default_instance(); + } + static inline const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* internal_default_instance() { + return reinterpret_cast( + &_BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel_default_instance_); + } + static constexpr int kIndexInFileMessages = + 15; + + friend void swap(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& a, BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& b) { + a.Swap(&b); + } + inline void Swap(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from); + void MergeFrom(const BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel"; + } + protected: + explicit BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStaFrequencyFieldNumber = 1, + }; + // optional int32 sta_frequency = 1; + bool has_sta_frequency() const; + private: + bool _internal_has_sta_frequency() const; + public: + void clear_sta_frequency(); + int32_t sta_frequency() const; + void set_sta_frequency(int32_t value); + private: + int32_t _internal_sta_frequency() const; + void _internal_set_sta_frequency(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int32_t sta_frequency_; + friend struct ::TableStruct_connections_2fimplementation_2fproto_2foffline_5fwire_5fformats_2eproto; +}; +// ------------------------------------------------------------------- + class BandwidthUpgradeNegotiationFrame_ClientIntroduction final : public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.connections.BandwidthUpgradeNegotiationFrame.ClientIntroduction) */ { public: @@ -4284,7 +4555,7 @@ class BandwidthUpgradeNegotiationFrame_ClientIntroduction final : &_BandwidthUpgradeNegotiationFrame_ClientIntroduction_default_instance_); } static constexpr int kIndexInFileMessages = - 15; + 16; friend void swap(BandwidthUpgradeNegotiationFrame_ClientIntroduction& a, BandwidthUpgradeNegotiationFrame_ClientIntroduction& b) { a.Swap(&b); @@ -4446,7 +4717,7 @@ class BandwidthUpgradeNegotiationFrame_ClientIntroductionAck final : &_BandwidthUpgradeNegotiationFrame_ClientIntroductionAck_default_instance_); } static constexpr int kIndexInFileMessages = - 16; + 17; friend void swap(BandwidthUpgradeNegotiationFrame_ClientIntroductionAck& a, BandwidthUpgradeNegotiationFrame_ClientIntroductionAck& b) { a.Swap(&b); @@ -4570,7 +4841,7 @@ class BandwidthUpgradeNegotiationFrame final : &_BandwidthUpgradeNegotiationFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 17; + 18; friend void swap(BandwidthUpgradeNegotiationFrame& a, BandwidthUpgradeNegotiationFrame& b) { a.Swap(&b); @@ -4635,6 +4906,7 @@ class BandwidthUpgradeNegotiationFrame final : // nested types ---------------------------------------------------- typedef BandwidthUpgradeNegotiationFrame_UpgradePathInfo UpgradePathInfo; + typedef BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel SafeToClosePriorChannel; typedef BandwidthUpgradeNegotiationFrame_ClientIntroduction ClientIntroduction; typedef BandwidthUpgradeNegotiationFrame_ClientIntroductionAck ClientIntroductionAck; @@ -4680,6 +4952,7 @@ class BandwidthUpgradeNegotiationFrame final : kUpgradePathInfoFieldNumber = 2, kClientIntroductionFieldNumber = 3, kClientIntroductionAckFieldNumber = 4, + kSafeToClosePriorChannelFieldNumber = 5, kEventTypeFieldNumber = 1, }; // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.UpgradePathInfo upgrade_path_info = 2; @@ -4736,6 +5009,24 @@ class BandwidthUpgradeNegotiationFrame final : ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroductionAck* client_introduction_ack); ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroductionAck* unsafe_arena_release_client_introduction_ack(); + // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel safe_to_close_prior_channel = 5; + bool has_safe_to_close_prior_channel() const; + private: + bool _internal_has_safe_to_close_prior_channel() const; + public: + void clear_safe_to_close_prior_channel(); + const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& safe_to_close_prior_channel() const; + PROTOBUF_NODISCARD ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* release_safe_to_close_prior_channel(); + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* mutable_safe_to_close_prior_channel(); + void set_allocated_safe_to_close_prior_channel(::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* safe_to_close_prior_channel); + private: + const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& _internal_safe_to_close_prior_channel() const; + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* _internal_mutable_safe_to_close_prior_channel(); + public: + void unsafe_arena_set_allocated_safe_to_close_prior_channel( + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* safe_to_close_prior_channel); + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* unsafe_arena_release_safe_to_close_prior_channel(); + // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.EventType event_type = 1; bool has_event_type() const; private: @@ -4761,11 +5052,219 @@ class BandwidthUpgradeNegotiationFrame final : ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo* upgrade_path_info_; ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroduction* client_introduction_; ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_ClientIntroductionAck* client_introduction_ack_; + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* safe_to_close_prior_channel_; int event_type_; friend struct ::TableStruct_connections_2fimplementation_2fproto_2foffline_5fwire_5fformats_2eproto; }; // ------------------------------------------------------------------- +class BandwidthUpgradeRetryFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.connections.BandwidthUpgradeRetryFrame) */ { + public: + inline BandwidthUpgradeRetryFrame() : BandwidthUpgradeRetryFrame(nullptr) {} + ~BandwidthUpgradeRetryFrame() override; + explicit constexpr BandwidthUpgradeRetryFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + BandwidthUpgradeRetryFrame(const BandwidthUpgradeRetryFrame& from); + BandwidthUpgradeRetryFrame(BandwidthUpgradeRetryFrame&& from) noexcept + : BandwidthUpgradeRetryFrame() { + *this = ::std::move(from); + } + + inline BandwidthUpgradeRetryFrame& operator=(const BandwidthUpgradeRetryFrame& from) { + CopyFrom(from); + return *this; + } + inline BandwidthUpgradeRetryFrame& operator=(BandwidthUpgradeRetryFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const BandwidthUpgradeRetryFrame& default_instance() { + return *internal_default_instance(); + } + static inline const BandwidthUpgradeRetryFrame* internal_default_instance() { + return reinterpret_cast( + &_BandwidthUpgradeRetryFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 19; + + friend void swap(BandwidthUpgradeRetryFrame& a, BandwidthUpgradeRetryFrame& b) { + a.Swap(&b); + } + inline void Swap(BandwidthUpgradeRetryFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(BandwidthUpgradeRetryFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + BandwidthUpgradeRetryFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const BandwidthUpgradeRetryFrame& from); + void MergeFrom(const BandwidthUpgradeRetryFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(BandwidthUpgradeRetryFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.connections.BandwidthUpgradeRetryFrame"; + } + protected: + explicit BandwidthUpgradeRetryFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef BandwidthUpgradeRetryFrame_Medium Medium; + static constexpr Medium UNKNOWN_MEDIUM = + BandwidthUpgradeRetryFrame_Medium_UNKNOWN_MEDIUM; + static constexpr Medium BLUETOOTH = + BandwidthUpgradeRetryFrame_Medium_BLUETOOTH; + static constexpr Medium WIFI_HOTSPOT = + BandwidthUpgradeRetryFrame_Medium_WIFI_HOTSPOT; + static constexpr Medium BLE = + BandwidthUpgradeRetryFrame_Medium_BLE; + static constexpr Medium WIFI_LAN = + BandwidthUpgradeRetryFrame_Medium_WIFI_LAN; + static constexpr Medium WIFI_AWARE = + BandwidthUpgradeRetryFrame_Medium_WIFI_AWARE; + static constexpr Medium NFC = + BandwidthUpgradeRetryFrame_Medium_NFC; + static constexpr Medium WIFI_DIRECT = + BandwidthUpgradeRetryFrame_Medium_WIFI_DIRECT; + static constexpr Medium WEB_RTC = + BandwidthUpgradeRetryFrame_Medium_WEB_RTC; + static constexpr Medium BLE_L2CAP = + BandwidthUpgradeRetryFrame_Medium_BLE_L2CAP; + static constexpr Medium USB = + BandwidthUpgradeRetryFrame_Medium_USB; + static constexpr Medium WEB_RTC_NON_CELLULAR = + BandwidthUpgradeRetryFrame_Medium_WEB_RTC_NON_CELLULAR; + static inline bool Medium_IsValid(int value) { + return BandwidthUpgradeRetryFrame_Medium_IsValid(value); + } + static constexpr Medium Medium_MIN = + BandwidthUpgradeRetryFrame_Medium_Medium_MIN; + static constexpr Medium Medium_MAX = + BandwidthUpgradeRetryFrame_Medium_Medium_MAX; + static constexpr int Medium_ARRAYSIZE = + BandwidthUpgradeRetryFrame_Medium_Medium_ARRAYSIZE; + template + static inline const std::string& Medium_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Medium_Name."); + return BandwidthUpgradeRetryFrame_Medium_Name(enum_t_value); + } + static inline bool Medium_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Medium* value) { + return BandwidthUpgradeRetryFrame_Medium_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kSupportedMediumFieldNumber = 1, + kIsRequestFieldNumber = 2, + }; + // repeated .location.nearby.connections.BandwidthUpgradeRetryFrame.Medium supported_medium = 1; + int supported_medium_size() const; + private: + int _internal_supported_medium_size() const; + public: + void clear_supported_medium(); + private: + ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium _internal_supported_medium(int index) const; + void _internal_add_supported_medium(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_supported_medium(); + public: + ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium supported_medium(int index) const; + void set_supported_medium(int index, ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium value); + void add_supported_medium(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& supported_medium() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_supported_medium(); + + // optional bool is_request = 2; + bool has_is_request() const; + private: + bool _internal_has_is_request() const; + public: + void clear_is_request(); + bool is_request() const; + void set_is_request(bool value); + private: + bool _internal_is_request() const; + void _internal_set_is_request(bool value); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.connections.BandwidthUpgradeRetryFrame) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField supported_medium_; + bool is_request_; + friend struct ::TableStruct_connections_2fimplementation_2fproto_2foffline_5fwire_5fformats_2eproto; +}; +// ------------------------------------------------------------------- + class KeepAliveFrame final : public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.connections.KeepAliveFrame) */ { public: @@ -4812,7 +5311,7 @@ class KeepAliveFrame final : &_KeepAliveFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 18; + 20; friend void swap(KeepAliveFrame& a, KeepAliveFrame& b) { a.Swap(&b); @@ -4969,7 +5468,7 @@ class DisconnectionFrame final : &_DisconnectionFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 19; + 21; friend void swap(DisconnectionFrame& a, DisconnectionFrame& b) { a.Swap(&b); @@ -5126,7 +5625,7 @@ class PairedKeyEncryptionFrame final : &_PairedKeyEncryptionFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 20; + 22; friend void swap(PairedKeyEncryptionFrame& a, PairedKeyEncryptionFrame& b) { a.Swap(&b); @@ -5273,7 +5772,7 @@ class AuthenticationMessageFrame final : &_AuthenticationMessageFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 21; + 23; friend void swap(AuthenticationMessageFrame& a, AuthenticationMessageFrame& b) { a.Swap(&b); @@ -5420,7 +5919,7 @@ class AuthenticationResultFrame final : &_AuthenticationResultFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 22; + 24; friend void swap(AuthenticationResultFrame& a, AuthenticationResultFrame& b) { a.Swap(&b); @@ -5562,7 +6061,7 @@ class AutoResumeFrame final : &_AutoResumeFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 23; + 25; friend void swap(AutoResumeFrame& a, AutoResumeFrame& b) { a.Swap(&b); @@ -5762,7 +6261,7 @@ class AutoReconnectFrame final : &_AutoReconnectFrame_default_instance_); } static constexpr int kIndexInFileMessages = - 24; + 26; friend void swap(AutoReconnectFrame& a, AutoReconnectFrame& b) { a.Swap(&b); @@ -5952,7 +6451,7 @@ class MediumMetadata final : &_MediumMetadata_default_instance_); } static constexpr int kIndexInFileMessages = - 25; + 27; friend void swap(MediumMetadata& a, MediumMetadata& b) { a.Swap(&b); @@ -6279,7 +6778,7 @@ class AvailableChannels final : &_AvailableChannels_default_instance_); } static constexpr int kIndexInFileMessages = - 26; + 28; friend void swap(AvailableChannels& a, AvailableChannels& b) { a.Swap(&b); @@ -6430,7 +6929,7 @@ class WifiDirectCliUsableChannels final : &_WifiDirectCliUsableChannels_default_instance_); } static constexpr int kIndexInFileMessages = - 27; + 29; friend void swap(WifiDirectCliUsableChannels& a, WifiDirectCliUsableChannels& b) { a.Swap(&b); @@ -6581,7 +7080,7 @@ class WifiLanUsableChannels final : &_WifiLanUsableChannels_default_instance_); } static constexpr int kIndexInFileMessages = - 28; + 30; friend void swap(WifiLanUsableChannels& a, WifiLanUsableChannels& b) { a.Swap(&b); @@ -6732,7 +7231,7 @@ class WifiAwareUsableChannels final : &_WifiAwareUsableChannels_default_instance_); } static constexpr int kIndexInFileMessages = - 29; + 31; friend void swap(WifiAwareUsableChannels& a, WifiAwareUsableChannels& b) { a.Swap(&b); @@ -6883,7 +7382,7 @@ class WifiHotspotStaUsableChannels final : &_WifiHotspotStaUsableChannels_default_instance_); } static constexpr int kIndexInFileMessages = - 30; + 32; friend void swap(WifiHotspotStaUsableChannels& a, WifiHotspotStaUsableChannels& b) { a.Swap(&b); @@ -7034,7 +7533,7 @@ class LocationHint final : &_LocationHint_default_instance_); } static constexpr int kIndexInFileMessages = - 31; + 33; friend void swap(LocationHint& a, LocationHint& b) { a.Swap(&b); @@ -7196,7 +7695,7 @@ class LocationStandard final : &_LocationStandard_default_instance_); } static constexpr int kIndexInFileMessages = - 32; + 34; friend void swap(LocationStandard& a, LocationStandard& b) { a.Swap(&b); @@ -7348,7 +7847,7 @@ class OsInfo final : &_OsInfo_default_instance_); } static constexpr int kIndexInFileMessages = - 33; + 35; friend void swap(OsInfo& a, OsInfo& b) { a.Swap(&b); @@ -7524,7 +8023,7 @@ class ConnectionsDevice final : &_ConnectionsDevice_default_instance_); } static constexpr int kIndexInFileMessages = - 34; + 36; friend void swap(ConnectionsDevice& a, ConnectionsDevice& b) { a.Swap(&b); @@ -7726,7 +8225,7 @@ class PresenceDevice final : &_PresenceDevice_default_instance_); } static constexpr int kIndexInFileMessages = - 35; + 37; friend void swap(PresenceDevice& a, PresenceDevice& b) { a.Swap(&b); @@ -8172,7 +8671,7 @@ inline void OfflineFrame::set_allocated_v1(::location::nearby::connections::V1Fr // optional .location.nearby.connections.V1Frame.FrameType type = 1; inline bool V1Frame::_internal_has_type() const { - bool value = (_has_bits_[0] & 0x00000800u) != 0; + bool value = (_has_bits_[0] & 0x00001000u) != 0; return value; } inline bool V1Frame::has_type() const { @@ -8180,7 +8679,7 @@ inline bool V1Frame::has_type() const { } inline void V1Frame::clear_type() { type_ = 0; - _has_bits_[0] &= ~0x00000800u; + _has_bits_[0] &= ~0x00001000u; } inline ::location::nearby::connections::V1Frame_FrameType V1Frame::_internal_type() const { return static_cast< ::location::nearby::connections::V1Frame_FrameType >(type_); @@ -8191,7 +8690,7 @@ inline ::location::nearby::connections::V1Frame_FrameType V1Frame::type() const } inline void V1Frame::_internal_set_type(::location::nearby::connections::V1Frame_FrameType value) { assert(::location::nearby::connections::V1Frame_FrameType_IsValid(value)); - _has_bits_[0] |= 0x00000800u; + _has_bits_[0] |= 0x00001000u; type_ = value; } inline void V1Frame::set_type(::location::nearby::connections::V1Frame_FrameType value) { @@ -9189,6 +9688,96 @@ inline void V1Frame::set_allocated_auto_reconnect(::location::nearby::connection // @@protoc_insertion_point(field_set_allocated:location.nearby.connections.V1Frame.auto_reconnect) } +// optional .location.nearby.connections.BandwidthUpgradeRetryFrame bandwidth_upgrade_retry = 13; +inline bool V1Frame::_internal_has_bandwidth_upgrade_retry() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + PROTOBUF_ASSUME(!value || bandwidth_upgrade_retry_ != nullptr); + return value; +} +inline bool V1Frame::has_bandwidth_upgrade_retry() const { + return _internal_has_bandwidth_upgrade_retry(); +} +inline void V1Frame::clear_bandwidth_upgrade_retry() { + if (bandwidth_upgrade_retry_ != nullptr) bandwidth_upgrade_retry_->Clear(); + _has_bits_[0] &= ~0x00000800u; +} +inline const ::location::nearby::connections::BandwidthUpgradeRetryFrame& V1Frame::_internal_bandwidth_upgrade_retry() const { + const ::location::nearby::connections::BandwidthUpgradeRetryFrame* p = bandwidth_upgrade_retry_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::connections::_BandwidthUpgradeRetryFrame_default_instance_); +} +inline const ::location::nearby::connections::BandwidthUpgradeRetryFrame& V1Frame::bandwidth_upgrade_retry() const { + // @@protoc_insertion_point(field_get:location.nearby.connections.V1Frame.bandwidth_upgrade_retry) + return _internal_bandwidth_upgrade_retry(); +} +inline void V1Frame::unsafe_arena_set_allocated_bandwidth_upgrade_retry( + ::location::nearby::connections::BandwidthUpgradeRetryFrame* bandwidth_upgrade_retry) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bandwidth_upgrade_retry_); + } + bandwidth_upgrade_retry_ = bandwidth_upgrade_retry; + if (bandwidth_upgrade_retry) { + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.connections.V1Frame.bandwidth_upgrade_retry) +} +inline ::location::nearby::connections::BandwidthUpgradeRetryFrame* V1Frame::release_bandwidth_upgrade_retry() { + _has_bits_[0] &= ~0x00000800u; + ::location::nearby::connections::BandwidthUpgradeRetryFrame* temp = bandwidth_upgrade_retry_; + bandwidth_upgrade_retry_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::connections::BandwidthUpgradeRetryFrame* V1Frame::unsafe_arena_release_bandwidth_upgrade_retry() { + // @@protoc_insertion_point(field_release:location.nearby.connections.V1Frame.bandwidth_upgrade_retry) + _has_bits_[0] &= ~0x00000800u; + ::location::nearby::connections::BandwidthUpgradeRetryFrame* temp = bandwidth_upgrade_retry_; + bandwidth_upgrade_retry_ = nullptr; + return temp; +} +inline ::location::nearby::connections::BandwidthUpgradeRetryFrame* V1Frame::_internal_mutable_bandwidth_upgrade_retry() { + _has_bits_[0] |= 0x00000800u; + if (bandwidth_upgrade_retry_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeRetryFrame>(GetArenaForAllocation()); + bandwidth_upgrade_retry_ = p; + } + return bandwidth_upgrade_retry_; +} +inline ::location::nearby::connections::BandwidthUpgradeRetryFrame* V1Frame::mutable_bandwidth_upgrade_retry() { + ::location::nearby::connections::BandwidthUpgradeRetryFrame* _msg = _internal_mutable_bandwidth_upgrade_retry(); + // @@protoc_insertion_point(field_mutable:location.nearby.connections.V1Frame.bandwidth_upgrade_retry) + return _msg; +} +inline void V1Frame::set_allocated_bandwidth_upgrade_retry(::location::nearby::connections::BandwidthUpgradeRetryFrame* bandwidth_upgrade_retry) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete bandwidth_upgrade_retry_; + } + if (bandwidth_upgrade_retry) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::connections::BandwidthUpgradeRetryFrame>::GetOwningArena(bandwidth_upgrade_retry); + if (message_arena != submessage_arena) { + bandwidth_upgrade_retry = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bandwidth_upgrade_retry, submessage_arena); + } + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + bandwidth_upgrade_retry_ = bandwidth_upgrade_retry; + // @@protoc_insertion_point(field_set_allocated:location.nearby.connections.V1Frame.bandwidth_upgrade_retry) +} + // ------------------------------------------------------------------- // ConnectionRequestFrame @@ -9933,6 +10522,35 @@ inline ::location::nearby::connections::PresenceDevice* ConnectionRequestFrame:: return _msg; } +// optional .location.nearby.connections.ConnectionRequestFrame.ConnectionMode connection_mode = 14; +inline bool ConnectionRequestFrame::_internal_has_connection_mode() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool ConnectionRequestFrame::has_connection_mode() const { + return _internal_has_connection_mode(); +} +inline void ConnectionRequestFrame::clear_connection_mode() { + connection_mode_ = 0; + _has_bits_[0] &= ~0x00000400u; +} +inline ::location::nearby::connections::ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame::_internal_connection_mode() const { + return static_cast< ::location::nearby::connections::ConnectionRequestFrame_ConnectionMode >(connection_mode_); +} +inline ::location::nearby::connections::ConnectionRequestFrame_ConnectionMode ConnectionRequestFrame::connection_mode() const { + // @@protoc_insertion_point(field_get:location.nearby.connections.ConnectionRequestFrame.connection_mode) + return _internal_connection_mode(); +} +inline void ConnectionRequestFrame::_internal_set_connection_mode(::location::nearby::connections::ConnectionRequestFrame_ConnectionMode value) { + assert(::location::nearby::connections::ConnectionRequestFrame_ConnectionMode_IsValid(value)); + _has_bits_[0] |= 0x00000400u; + connection_mode_ = value; +} +inline void ConnectionRequestFrame::set_connection_mode(::location::nearby::connections::ConnectionRequestFrame_ConnectionMode value) { + _internal_set_connection_mode(value); + // @@protoc_insertion_point(field_set:location.nearby.connections.ConnectionRequestFrame.connection_mode) +} + inline bool ConnectionRequestFrame::has_Device() const { return Device_case() != DEVICE_NOT_SET; } @@ -12855,6 +13473,38 @@ inline void BandwidthUpgradeNegotiationFrame_UpgradePathInfo::set_supports_clien // ------------------------------------------------------------------- +// BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel + +// optional int32 sta_frequency = 1; +inline bool BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::_internal_has_sta_frequency() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::has_sta_frequency() const { + return _internal_has_sta_frequency(); +} +inline void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::clear_sta_frequency() { + sta_frequency_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline int32_t BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::_internal_sta_frequency() const { + return sta_frequency_; +} +inline int32_t BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::sta_frequency() const { + // @@protoc_insertion_point(field_get:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel.sta_frequency) + return _internal_sta_frequency(); +} +inline void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::_internal_set_sta_frequency(int32_t value) { + _has_bits_[0] |= 0x00000001u; + sta_frequency_ = value; +} +inline void BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel::set_sta_frequency(int32_t value) { + _internal_set_sta_frequency(value); + // @@protoc_insertion_point(field_set:location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel.sta_frequency) +} + +// ------------------------------------------------------------------- + // BandwidthUpgradeNegotiationFrame_ClientIntroduction // optional string endpoint_id = 1; @@ -12964,7 +13614,7 @@ inline void BandwidthUpgradeNegotiationFrame_ClientIntroduction::set_supports_di // optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.EventType event_type = 1; inline bool BandwidthUpgradeNegotiationFrame::_internal_has_event_type() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; return value; } inline bool BandwidthUpgradeNegotiationFrame::has_event_type() const { @@ -12972,7 +13622,7 @@ inline bool BandwidthUpgradeNegotiationFrame::has_event_type() const { } inline void BandwidthUpgradeNegotiationFrame::clear_event_type() { event_type_ = 0; - _has_bits_[0] &= ~0x00000008u; + _has_bits_[0] &= ~0x00000010u; } inline ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventType BandwidthUpgradeNegotiationFrame::_internal_event_type() const { return static_cast< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventType >(event_type_); @@ -12983,7 +13633,7 @@ inline ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventTy } inline void BandwidthUpgradeNegotiationFrame::_internal_set_event_type(::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventType value) { assert(::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventType_IsValid(value)); - _has_bits_[0] |= 0x00000008u; + _has_bits_[0] |= 0x00000010u; event_type_ = value; } inline void BandwidthUpgradeNegotiationFrame::set_event_type(::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventType value) { @@ -13261,6 +13911,173 @@ inline void BandwidthUpgradeNegotiationFrame::set_allocated_client_introduction_ // @@protoc_insertion_point(field_set_allocated:location.nearby.connections.BandwidthUpgradeNegotiationFrame.client_introduction_ack) } +// optional .location.nearby.connections.BandwidthUpgradeNegotiationFrame.SafeToClosePriorChannel safe_to_close_prior_channel = 5; +inline bool BandwidthUpgradeNegotiationFrame::_internal_has_safe_to_close_prior_channel() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || safe_to_close_prior_channel_ != nullptr); + return value; +} +inline bool BandwidthUpgradeNegotiationFrame::has_safe_to_close_prior_channel() const { + return _internal_has_safe_to_close_prior_channel(); +} +inline void BandwidthUpgradeNegotiationFrame::clear_safe_to_close_prior_channel() { + if (safe_to_close_prior_channel_ != nullptr) safe_to_close_prior_channel_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +inline const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& BandwidthUpgradeNegotiationFrame::_internal_safe_to_close_prior_channel() const { + const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* p = safe_to_close_prior_channel_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::connections::_BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel_default_instance_); +} +inline const ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel& BandwidthUpgradeNegotiationFrame::safe_to_close_prior_channel() const { + // @@protoc_insertion_point(field_get:location.nearby.connections.BandwidthUpgradeNegotiationFrame.safe_to_close_prior_channel) + return _internal_safe_to_close_prior_channel(); +} +inline void BandwidthUpgradeNegotiationFrame::unsafe_arena_set_allocated_safe_to_close_prior_channel( + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* safe_to_close_prior_channel) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(safe_to_close_prior_channel_); + } + safe_to_close_prior_channel_ = safe_to_close_prior_channel; + if (safe_to_close_prior_channel) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.connections.BandwidthUpgradeNegotiationFrame.safe_to_close_prior_channel) +} +inline ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* BandwidthUpgradeNegotiationFrame::release_safe_to_close_prior_channel() { + _has_bits_[0] &= ~0x00000008u; + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* temp = safe_to_close_prior_channel_; + safe_to_close_prior_channel_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* BandwidthUpgradeNegotiationFrame::unsafe_arena_release_safe_to_close_prior_channel() { + // @@protoc_insertion_point(field_release:location.nearby.connections.BandwidthUpgradeNegotiationFrame.safe_to_close_prior_channel) + _has_bits_[0] &= ~0x00000008u; + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* temp = safe_to_close_prior_channel_; + safe_to_close_prior_channel_ = nullptr; + return temp; +} +inline ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* BandwidthUpgradeNegotiationFrame::_internal_mutable_safe_to_close_prior_channel() { + _has_bits_[0] |= 0x00000008u; + if (safe_to_close_prior_channel_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel>(GetArenaForAllocation()); + safe_to_close_prior_channel_ = p; + } + return safe_to_close_prior_channel_; +} +inline ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* BandwidthUpgradeNegotiationFrame::mutable_safe_to_close_prior_channel() { + ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* _msg = _internal_mutable_safe_to_close_prior_channel(); + // @@protoc_insertion_point(field_mutable:location.nearby.connections.BandwidthUpgradeNegotiationFrame.safe_to_close_prior_channel) + return _msg; +} +inline void BandwidthUpgradeNegotiationFrame::set_allocated_safe_to_close_prior_channel(::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel* safe_to_close_prior_channel) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete safe_to_close_prior_channel_; + } + if (safe_to_close_prior_channel) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::connections::BandwidthUpgradeNegotiationFrame_SafeToClosePriorChannel>::GetOwningArena(safe_to_close_prior_channel); + if (message_arena != submessage_arena) { + safe_to_close_prior_channel = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, safe_to_close_prior_channel, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + safe_to_close_prior_channel_ = safe_to_close_prior_channel; + // @@protoc_insertion_point(field_set_allocated:location.nearby.connections.BandwidthUpgradeNegotiationFrame.safe_to_close_prior_channel) +} + +// ------------------------------------------------------------------- + +// BandwidthUpgradeRetryFrame + +// repeated .location.nearby.connections.BandwidthUpgradeRetryFrame.Medium supported_medium = 1; +inline int BandwidthUpgradeRetryFrame::_internal_supported_medium_size() const { + return supported_medium_.size(); +} +inline int BandwidthUpgradeRetryFrame::supported_medium_size() const { + return _internal_supported_medium_size(); +} +inline void BandwidthUpgradeRetryFrame::clear_supported_medium() { + supported_medium_.Clear(); +} +inline ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::_internal_supported_medium(int index) const { + return static_cast< ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium >(supported_medium_.Get(index)); +} +inline ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium BandwidthUpgradeRetryFrame::supported_medium(int index) const { + // @@protoc_insertion_point(field_get:location.nearby.connections.BandwidthUpgradeRetryFrame.supported_medium) + return _internal_supported_medium(index); +} +inline void BandwidthUpgradeRetryFrame::set_supported_medium(int index, ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium value) { + assert(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium_IsValid(value)); + supported_medium_.Set(index, value); + // @@protoc_insertion_point(field_set:location.nearby.connections.BandwidthUpgradeRetryFrame.supported_medium) +} +inline void BandwidthUpgradeRetryFrame::_internal_add_supported_medium(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium value) { + assert(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium_IsValid(value)); + supported_medium_.Add(value); +} +inline void BandwidthUpgradeRetryFrame::add_supported_medium(::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium value) { + _internal_add_supported_medium(value); + // @@protoc_insertion_point(field_add:location.nearby.connections.BandwidthUpgradeRetryFrame.supported_medium) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +BandwidthUpgradeRetryFrame::supported_medium() const { + // @@protoc_insertion_point(field_list:location.nearby.connections.BandwidthUpgradeRetryFrame.supported_medium) + return supported_medium_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +BandwidthUpgradeRetryFrame::_internal_mutable_supported_medium() { + return &supported_medium_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +BandwidthUpgradeRetryFrame::mutable_supported_medium() { + // @@protoc_insertion_point(field_mutable_list:location.nearby.connections.BandwidthUpgradeRetryFrame.supported_medium) + return _internal_mutable_supported_medium(); +} + +// optional bool is_request = 2; +inline bool BandwidthUpgradeRetryFrame::_internal_has_is_request() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool BandwidthUpgradeRetryFrame::has_is_request() const { + return _internal_has_is_request(); +} +inline void BandwidthUpgradeRetryFrame::clear_is_request() { + is_request_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool BandwidthUpgradeRetryFrame::_internal_is_request() const { + return is_request_; +} +inline bool BandwidthUpgradeRetryFrame::is_request() const { + // @@protoc_insertion_point(field_get:location.nearby.connections.BandwidthUpgradeRetryFrame.is_request) + return _internal_is_request(); +} +inline void BandwidthUpgradeRetryFrame::_internal_set_is_request(bool value) { + _has_bits_[0] |= 0x00000001u; + is_request_ = value; +} +inline void BandwidthUpgradeRetryFrame::set_is_request(bool value) { + _internal_set_is_request(value); + // @@protoc_insertion_point(field_set:location.nearby.connections.BandwidthUpgradeRetryFrame.is_request) +} + // ------------------------------------------------------------------- // KeepAliveFrame @@ -15666,6 +16483,10 @@ PresenceDevice::mutable_identity_type() { // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) @@ -15678,6 +16499,7 @@ PROTOBUF_NAMESPACE_OPEN template <> struct is_proto_enum< ::location::nearby::connections::OfflineFrame_Version> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::V1Frame_FrameType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::ConnectionRequestFrame_Medium> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::connections::ConnectionRequestFrame_ConnectionMode> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::ConnectionResponseFrame_ResponseStatus> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::PayloadTransferFrame_PayloadHeader_PayloadType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::PayloadTransferFrame_PayloadChunk_Flags> : ::std::true_type {}; @@ -15685,6 +16507,7 @@ template <> struct is_proto_enum< ::location::nearby::connections::PayloadTransf template <> struct is_proto_enum< ::location::nearby::connections::PayloadTransferFrame_PacketType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_UpgradePathInfo_Medium> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::BandwidthUpgradeNegotiationFrame_EventType> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::connections::BandwidthUpgradeRetryFrame_Medium> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::AutoResumeFrame_EventType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::AutoReconnectFrame_EventType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::connections::LocationStandard_Format> : ::std::true_type {}; diff --git a/compiled_proto/internal/proto/analytics/connections_log.pb.cc b/compiled_proto/internal/proto/analytics/connections_log.pb.cc index 82410f52..db4cdfe8 100644 --- a/compiled_proto/internal/proto/analytics/connections_log.pb.cc +++ b/compiled_proto/internal/proto/analytics/connections_log.pb.cc @@ -20,7 +20,9 @@ namespace proto { constexpr ConnectionsLog_ClientSession::ConnectionsLog_ClientSession( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : strategy_session_() - , duration_millis_(int64_t{0}){} + , connection_token_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , duration_millis_(int64_t{0}) + , client_flow_id_(int64_t{0}){} struct ConnectionsLog_ClientSessionDefaultTypeInternal { constexpr ConnectionsLog_ClientSessionDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -30,6 +32,41 @@ struct ConnectionsLog_ClientSessionDefaultTypeInternal { }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionsLog_ClientSessionDefaultTypeInternal _ConnectionsLog_ClientSession_default_instance_; +constexpr ConnectionsLog_OperationResult::ConnectionsLog_OperationResult( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : result_category_(0) + + , result_code_(0) +{} +struct ConnectionsLog_OperationResultDefaultTypeInternal { + constexpr ConnectionsLog_OperationResultDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ConnectionsLog_OperationResultDefaultTypeInternal() {} + union { + ConnectionsLog_OperationResult _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionsLog_OperationResultDefaultTypeInternal _ConnectionsLog_OperationResult_default_instance_; +constexpr ConnectionsLog_OperationResultWithMedium::ConnectionsLog_OperationResultWithMedium( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : medium_(0) + + , update_index_(0) + , result_category_(0) + + , result_code_(0) + + , connection_mode_(0) +{} +struct ConnectionsLog_OperationResultWithMediumDefaultTypeInternal { + constexpr ConnectionsLog_OperationResultWithMediumDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ConnectionsLog_OperationResultWithMediumDefaultTypeInternal() {} + union { + ConnectionsLog_OperationResultWithMedium _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionsLog_OperationResultWithMediumDefaultTypeInternal _ConnectionsLog_OperationResultWithMedium_default_instance_; constexpr ConnectionsLog_StrategySession::ConnectionsLog_StrategySession( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : role_() @@ -57,9 +94,12 @@ constexpr ConnectionsLog_DiscoveryPhase::ConnectionsLog_DiscoveryPhase( , discovered_endpoint_() , sent_connection_request_() , uwb_ranging_() + , adv_dis_result_() , discovery_metadata_(nullptr) , duration_millis_(int64_t{0}) - , client_flow_id_(int64_t{0}){} + , client_flow_id_(int64_t{0}) + , stop_reason_(0) +{} struct ConnectionsLog_DiscoveryPhaseDefaultTypeInternal { constexpr ConnectionsLog_DiscoveryPhaseDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -123,9 +163,12 @@ constexpr ConnectionsLog_AdvertisingPhase::ConnectionsLog_AdvertisingPhase( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : medium_() , received_connection_request_() + , adv_dis_result_() , advertising_metadata_(nullptr) , duration_millis_(int64_t{0}) - , client_flow_id_(int64_t{0}){} + , client_flow_id_(int64_t{0}) + , stop_reason_(0) +{} struct ConnectionsLog_AdvertisingPhaseDefaultTypeInternal { constexpr ConnectionsLog_AdvertisingPhaseDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -157,6 +200,7 @@ constexpr ConnectionsLog_ConnectionAttempt::ConnectionsLog_ConnectionAttempt( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : connection_token_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) , connection_attempt_metadata_(nullptr) + , operation_result_(nullptr) , duration_millis_(int64_t{0}) , type_(0) @@ -166,7 +210,9 @@ constexpr ConnectionsLog_ConnectionAttempt::ConnectionsLog_ConnectionAttempt( , attempt_result_(0) - , client_flow_id_(int64_t{0}){} + , client_flow_id_(int64_t{0}) + , connection_mode_(0) +{} struct ConnectionsLog_ConnectionAttemptDefaultTypeInternal { constexpr ConnectionsLog_ConnectionAttemptDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -181,6 +227,7 @@ constexpr ConnectionsLog_EstablishedConnection::ConnectionsLog_EstablishedConnec : sent_payload_() , received_payload_() , connection_token_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , operation_result_(nullptr) , duration_millis_(int64_t{0}) , medium_(0) @@ -202,14 +249,17 @@ struct ConnectionsLog_EstablishedConnectionDefaultTypeInternal { PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionsLog_EstablishedConnectionDefaultTypeInternal _ConnectionsLog_EstablishedConnection_default_instance_; constexpr ConnectionsLog_Payload::ConnectionsLog_Payload( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) - : duration_millis_(int64_t{0}) + : operation_result_(nullptr) + , duration_millis_(int64_t{0}) , total_size_bytes_(int64_t{0}) , type_(0) , num_chunks_(0) , num_bytes_transferred_(int64_t{0}) , status_(0) -{} + + , num_successful_auto_resume_(0) + , num_failed_auto_resume_(0){} struct ConnectionsLog_PayloadDefaultTypeInternal { constexpr ConnectionsLog_PayloadDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -222,6 +272,7 @@ PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionsLog_PayloadDefaultTy constexpr ConnectionsLog_BandwidthUpgradeAttempt::ConnectionsLog_BandwidthUpgradeAttempt( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : connection_token_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , operation_result_(nullptr) , duration_millis_(int64_t{0}) , direction_(0) @@ -272,6 +323,9 @@ constexpr ConnectionsLog_AdvertisingMetadata::ConnectionsLog_AdvertisingMetadata , supports_extended_ble_advertisements_(false) , supports_nfc_technology_(false) , multiple_advertisement_supported_(false) + , supports_dual_band_(false) + , supports_wifi_aware_(false) + , endpoint_info_size_(0) , power_level_(-1) {} struct ConnectionsLog_AdvertisingMetadataDefaultTypeInternal { @@ -424,6 +478,12 @@ class ConnectionsLog_ClientSession::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_duration_millis(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_client_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_connection_token(HasBits* has_bits) { (*has_bits)[0] |= 1u; } }; @@ -443,12 +503,29 @@ ConnectionsLog_ClientSession::ConnectionsLog_ClientSession(const ConnectionsLog_ _has_bits_(from._has_bits_), strategy_session_(from.strategy_session_) { _internal_metadata_.MergeFrom(from._internal_metadata_); - duration_millis_ = from.duration_millis_; + connection_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + connection_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_connection_token()) { + connection_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_connection_token(), + GetArenaForAllocation()); + } + ::memcpy(&duration_millis_, &from.duration_millis_, + static_cast(reinterpret_cast(&client_flow_id_) - + reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.ClientSession) } inline void ConnectionsLog_ClientSession::SharedCtor() { -duration_millis_ = int64_t{0}; +connection_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + connection_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&duration_millis_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&client_flow_id_) - + reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); } ConnectionsLog_ClientSession::~ConnectionsLog_ClientSession() { @@ -460,6 +537,7 @@ ConnectionsLog_ClientSession::~ConnectionsLog_ClientSession() { inline void ConnectionsLog_ClientSession::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + connection_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } void ConnectionsLog_ClientSession::ArenaDtor(void* object) { @@ -479,7 +557,15 @@ void ConnectionsLog_ClientSession::Clear() { (void) cached_has_bits; strategy_session_.Clear(); - duration_millis_ = int64_t{0}; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + connection_token_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000006u) { + ::memset(&duration_millis_, 0, static_cast( + reinterpret_cast(&client_flow_id_) - + reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + } _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -513,6 +599,24 @@ const char* ConnectionsLog_ClientSession::_InternalParse(const char* ptr, ::PROT } else goto handle_unusual; continue; + // optional int64 client_flow_id = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_client_flow_id(&has_bits); + client_flow_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string connection_token = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + auto str = _internal_mutable_connection_token(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -545,7 +649,7 @@ uint8_t* ConnectionsLog_ClientSession::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional int64 duration_millis = 1; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000002u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_duration_millis(), target); } @@ -558,6 +662,18 @@ uint8_t* ConnectionsLog_ClientSession::_InternalSerialize( InternalWriteMessage(2, this->_internal_strategy_session(i), target, stream); } + // optional int64 client_flow_id = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_client_flow_id(), target); + } + + // optional string connection_token = 4; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 4, this->_internal_connection_token(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -581,12 +697,26 @@ size_t ConnectionsLog_ClientSession::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } - // optional int64 duration_millis = 1; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); - } + if (cached_has_bits & 0x00000007u) { + // optional string connection_token = 4; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_connection_token()); + } + // optional int64 duration_millis = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); + } + + // optional int64 client_flow_id = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_client_flow_id()); + } + + } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); } @@ -608,8 +738,18 @@ void ConnectionsLog_ClientSession::MergeFrom(const ConnectionsLog_ClientSession& (void) cached_has_bits; strategy_session_.MergeFrom(from.strategy_session_); - if (from._internal_has_duration_millis()) { - _internal_set_duration_millis(from._internal_duration_millis()); + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_connection_token(from._internal_connection_token()); + } + if (cached_has_bits & 0x00000002u) { + duration_millis_ = from.duration_millis_; + } + if (cached_has_bits & 0x00000004u) { + client_flow_id_ = from.client_flow_id_; + } + _has_bits_[0] |= cached_has_bits; } _internal_metadata_.MergeFrom(from._internal_metadata_); } @@ -627,10 +767,22 @@ bool ConnectionsLog_ClientSession::IsInitialized() const { void ConnectionsLog_ClientSession::InternalSwap(ConnectionsLog_ClientSession* other) { using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); strategy_session_.InternalSwap(&other->strategy_session_); - swap(duration_millis_, other->duration_millis_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &connection_token_, lhs_arena, + &other->connection_token_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ConnectionsLog_ClientSession, client_flow_id_) + + sizeof(ConnectionsLog_ClientSession::client_flow_id_) + - PROTOBUF_FIELD_OFFSET(ConnectionsLog_ClientSession, duration_millis_)>( + reinterpret_cast(&duration_millis_), + reinterpret_cast(&other->duration_millis_)); } std::string ConnectionsLog_ClientSession::GetTypeName() const { @@ -638,6 +790,588 @@ std::string ConnectionsLog_ClientSession::GetTypeName() const { } +// =================================================================== + +class ConnectionsLog_OperationResult::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_result_category(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_result_code(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ConnectionsLog_OperationResult::ConnectionsLog_OperationResult(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.analytics.proto.ConnectionsLog.OperationResult) +} +ConnectionsLog_OperationResult::ConnectionsLog_OperationResult(const ConnectionsLog_OperationResult& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&result_category_, &from.result_category_, + static_cast(reinterpret_cast(&result_code_) - + reinterpret_cast(&result_category_)) + sizeof(result_code_)); + // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.OperationResult) +} + +inline void ConnectionsLog_OperationResult::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&result_category_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&result_code_) - + reinterpret_cast(&result_category_)) + sizeof(result_code_)); +} + +ConnectionsLog_OperationResult::~ConnectionsLog_OperationResult() { + // @@protoc_insertion_point(destructor:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void ConnectionsLog_OperationResult::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void ConnectionsLog_OperationResult::ArenaDtor(void* object) { + ConnectionsLog_OperationResult* _this = reinterpret_cast< ConnectionsLog_OperationResult* >(object); + (void)_this; +} +void ConnectionsLog_OperationResult::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ConnectionsLog_OperationResult::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ConnectionsLog_OperationResult::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&result_category_, 0, static_cast( + reinterpret_cast(&result_code_) - + reinterpret_cast(&result_category_)) + sizeof(result_code_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* ConnectionsLog_OperationResult::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::OperationResultCategory_IsValid(val))) { + _internal_set_result_category(static_cast<::location::nearby::proto::connections::OperationResultCategory>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.OperationResultCode result_code = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::OperationResultCode_IsValid(val))) { + _internal_set_result_code(static_cast<::location::nearby::proto::connections::OperationResultCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ConnectionsLog_OperationResult::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_result_category(), target); + } + + // optional .location.nearby.proto.connections.OperationResultCode result_code = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_result_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + return target; +} + +size_t ConnectionsLog_OperationResult::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_result_category()); + } + + // optional .location.nearby.proto.connections.OperationResultCode result_code = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_result_code()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ConnectionsLog_OperationResult::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void ConnectionsLog_OperationResult::MergeFrom(const ConnectionsLog_OperationResult& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + result_category_ = from.result_category_; + } + if (cached_has_bits & 0x00000002u) { + result_code_ = from.result_code_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void ConnectionsLog_OperationResult::CopyFrom(const ConnectionsLog_OperationResult& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ConnectionsLog_OperationResult::IsInitialized() const { + return true; +} + +void ConnectionsLog_OperationResult::InternalSwap(ConnectionsLog_OperationResult* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ConnectionsLog_OperationResult, result_code_) + + sizeof(ConnectionsLog_OperationResult::result_code_) + - PROTOBUF_FIELD_OFFSET(ConnectionsLog_OperationResult, result_category_)>( + reinterpret_cast(&result_category_), + reinterpret_cast(&other->result_category_)); +} + +std::string ConnectionsLog_OperationResult::GetTypeName() const { + return "location.nearby.analytics.proto.ConnectionsLog.OperationResult"; +} + + +// =================================================================== + +class ConnectionsLog_OperationResultWithMedium::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_medium(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_update_index(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_result_category(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_result_code(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_connection_mode(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } +}; + +ConnectionsLog_OperationResultWithMedium::ConnectionsLog_OperationResultWithMedium(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) +} +ConnectionsLog_OperationResultWithMedium::ConnectionsLog_OperationResultWithMedium(const ConnectionsLog_OperationResultWithMedium& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&medium_, &from.medium_, + static_cast(reinterpret_cast(&connection_mode_) - + reinterpret_cast(&medium_)) + sizeof(connection_mode_)); + // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) +} + +inline void ConnectionsLog_OperationResultWithMedium::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&medium_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&connection_mode_) - + reinterpret_cast(&medium_)) + sizeof(connection_mode_)); +} + +ConnectionsLog_OperationResultWithMedium::~ConnectionsLog_OperationResultWithMedium() { + // @@protoc_insertion_point(destructor:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void ConnectionsLog_OperationResultWithMedium::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void ConnectionsLog_OperationResultWithMedium::ArenaDtor(void* object) { + ConnectionsLog_OperationResultWithMedium* _this = reinterpret_cast< ConnectionsLog_OperationResultWithMedium* >(object); + (void)_this; +} +void ConnectionsLog_OperationResultWithMedium::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ConnectionsLog_OperationResultWithMedium::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ConnectionsLog_OperationResultWithMedium::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + ::memset(&medium_, 0, static_cast( + reinterpret_cast(&connection_mode_) - + reinterpret_cast(&medium_)) + sizeof(connection_mode_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* ConnectionsLog_OperationResultWithMedium::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.connections.Medium medium = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::Medium_IsValid(val))) { + _internal_set_medium(static_cast<::location::nearby::proto::connections::Medium>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 update_index = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_update_index(&has_bits); + update_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::OperationResultCategory_IsValid(val))) { + _internal_set_result_category(static_cast<::location::nearby::proto::connections::OperationResultCategory>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.OperationResultCode result_code = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::OperationResultCode_IsValid(val))) { + _internal_set_result_code(static_cast<::location::nearby::proto::connections::OperationResultCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::ConnectionMode_IsValid(val))) { + _internal_set_connection_mode(static_cast<::location::nearby::proto::connections::ConnectionMode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(5, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ConnectionsLog_OperationResultWithMedium::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.connections.Medium medium = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_medium(), target); + } + + // optional int32 update_index = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_update_index(), target); + } + + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_result_category(), target); + } + + // optional .location.nearby.proto.connections.OperationResultCode result_code = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_result_code(), target); + } + + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 5, this->_internal_connection_mode(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + return target; +} + +size_t ConnectionsLog_OperationResultWithMedium::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + // optional .location.nearby.proto.connections.Medium medium = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_medium()); + } + + // optional int32 update_index = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_update_index()); + } + + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_result_category()); + } + + // optional .location.nearby.proto.connections.OperationResultCode result_code = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_result_code()); + } + + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 5; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_connection_mode()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ConnectionsLog_OperationResultWithMedium::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void ConnectionsLog_OperationResultWithMedium::MergeFrom(const ConnectionsLog_OperationResultWithMedium& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x00000001u) { + medium_ = from.medium_; + } + if (cached_has_bits & 0x00000002u) { + update_index_ = from.update_index_; + } + if (cached_has_bits & 0x00000004u) { + result_category_ = from.result_category_; + } + if (cached_has_bits & 0x00000008u) { + result_code_ = from.result_code_; + } + if (cached_has_bits & 0x00000010u) { + connection_mode_ = from.connection_mode_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void ConnectionsLog_OperationResultWithMedium::CopyFrom(const ConnectionsLog_OperationResultWithMedium& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ConnectionsLog_OperationResultWithMedium::IsInitialized() const { + return true; +} + +void ConnectionsLog_OperationResultWithMedium::InternalSwap(ConnectionsLog_OperationResultWithMedium* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(ConnectionsLog_OperationResultWithMedium, connection_mode_) + + sizeof(ConnectionsLog_OperationResultWithMedium::connection_mode_) + - PROTOBUF_FIELD_OFFSET(ConnectionsLog_OperationResultWithMedium, medium_)>( + reinterpret_cast(&medium_), + reinterpret_cast(&other->medium_)); +} + +std::string ConnectionsLog_OperationResultWithMedium::GetTypeName() const { + return "location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium"; +} + + // =================================================================== class ConnectionsLog_StrategySession::_Internal { @@ -1152,6 +1886,9 @@ class ConnectionsLog_DiscoveryPhase::_Internal { static void set_has_discovery_metadata(HasBits* has_bits) { (*has_bits)[0] |= 1u; } + static void set_has_stop_reason(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } }; const ::location::nearby::analytics::proto::ConnectionsLog_DiscoveryMetadata& @@ -1164,7 +1901,8 @@ ConnectionsLog_DiscoveryPhase::ConnectionsLog_DiscoveryPhase(::PROTOBUF_NAMESPAC medium_(arena), discovered_endpoint_(arena), sent_connection_request_(arena), - uwb_ranging_(arena) { + uwb_ranging_(arena), + adv_dis_result_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); @@ -1177,7 +1915,8 @@ ConnectionsLog_DiscoveryPhase::ConnectionsLog_DiscoveryPhase(const ConnectionsLo medium_(from.medium_), discovered_endpoint_(from.discovered_endpoint_), sent_connection_request_(from.sent_connection_request_), - uwb_ranging_(from.uwb_ranging_) { + uwb_ranging_(from.uwb_ranging_), + adv_dis_result_(from.adv_dis_result_) { _internal_metadata_.MergeFrom(from._internal_metadata_); if (from._internal_has_discovery_metadata()) { discovery_metadata_ = new ::location::nearby::analytics::proto::ConnectionsLog_DiscoveryMetadata(*from.discovery_metadata_); @@ -1185,16 +1924,16 @@ ConnectionsLog_DiscoveryPhase::ConnectionsLog_DiscoveryPhase(const ConnectionsLo discovery_metadata_ = nullptr; } ::memcpy(&duration_millis_, &from.duration_millis_, - static_cast(reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + static_cast(reinterpret_cast(&stop_reason_) - + reinterpret_cast(&duration_millis_)) + sizeof(stop_reason_)); // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase) } inline void ConnectionsLog_DiscoveryPhase::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&discovery_metadata_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&discovery_metadata_)) + sizeof(client_flow_id_)); + 0, static_cast(reinterpret_cast(&stop_reason_) - + reinterpret_cast(&discovery_metadata_)) + sizeof(stop_reason_)); } ConnectionsLog_DiscoveryPhase::~ConnectionsLog_DiscoveryPhase() { @@ -1229,15 +1968,16 @@ void ConnectionsLog_DiscoveryPhase::Clear() { discovered_endpoint_.Clear(); sent_connection_request_.Clear(); uwb_ranging_.Clear(); + adv_dis_result_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(discovery_metadata_ != nullptr); discovery_metadata_->Clear(); } - if (cached_has_bits & 0x00000006u) { + if (cached_has_bits & 0x0000000eu) { ::memset(&duration_millis_, 0, static_cast( - reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + reinterpret_cast(&stop_reason_) - + reinterpret_cast(&duration_millis_)) + sizeof(stop_reason_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -1336,6 +2076,32 @@ const char* ConnectionsLog_DiscoveryPhase::_InternalParse(const char* ptr, ::PRO } else goto handle_unusual; continue; + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_adv_dis_result(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<66>(ptr)); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.StopDiscoveringReason stop_reason = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::StopDiscoveringReason_IsValid(val))) { + _internal_set_stop_reason(static_cast<::location::nearby::proto::connections::StopDiscoveringReason>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(9, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -1418,6 +2184,21 @@ uint8_t* ConnectionsLog_DiscoveryPhase::_InternalSerialize( 7, _Internal::discovery_metadata(this), target, stream); } + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 8; + for (unsigned int i = 0, + n = static_cast(this->_internal_adv_dis_result_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(8, this->_internal_adv_dis_result(i), target, stream); + } + + // optional .location.nearby.proto.connections.StopDiscoveringReason stop_reason = 9; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 9, this->_internal_stop_reason(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -1465,8 +2246,15 @@ size_t ConnectionsLog_DiscoveryPhase::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 8; + total_size += 1UL * this->_internal_adv_dis_result_size(); + for (const auto& msg : this->adv_dis_result_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x0000000fu) { // optional .location.nearby.analytics.proto.ConnectionsLog.DiscoveryMetadata discovery_metadata = 7; if (cached_has_bits & 0x00000001u) { total_size += 1 + @@ -1484,6 +2272,12 @@ size_t ConnectionsLog_DiscoveryPhase::ByteSizeLong() const { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_client_flow_id()); } + // optional .location.nearby.proto.connections.StopDiscoveringReason stop_reason = 9; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_stop_reason()); + } + } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); @@ -1509,8 +2303,9 @@ void ConnectionsLog_DiscoveryPhase::MergeFrom(const ConnectionsLog_DiscoveryPhas discovered_endpoint_.MergeFrom(from.discovered_endpoint_); sent_connection_request_.MergeFrom(from.sent_connection_request_); uwb_ranging_.MergeFrom(from.uwb_ranging_); + adv_dis_result_.MergeFrom(from.adv_dis_result_); cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x0000000fu) { if (cached_has_bits & 0x00000001u) { _internal_mutable_discovery_metadata()->::location::nearby::analytics::proto::ConnectionsLog_DiscoveryMetadata::MergeFrom(from._internal_discovery_metadata()); } @@ -1520,6 +2315,9 @@ void ConnectionsLog_DiscoveryPhase::MergeFrom(const ConnectionsLog_DiscoveryPhas if (cached_has_bits & 0x00000004u) { client_flow_id_ = from.client_flow_id_; } + if (cached_has_bits & 0x00000008u) { + stop_reason_ = from.stop_reason_; + } _has_bits_[0] |= cached_has_bits; } _internal_metadata_.MergeFrom(from._internal_metadata_); @@ -1544,9 +2342,10 @@ void ConnectionsLog_DiscoveryPhase::InternalSwap(ConnectionsLog_DiscoveryPhase* discovered_endpoint_.InternalSwap(&other->discovered_endpoint_); sent_connection_request_.InternalSwap(&other->sent_connection_request_); uwb_ranging_.InternalSwap(&other->uwb_ranging_); + adv_dis_result_.InternalSwap(&other->adv_dis_result_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(ConnectionsLog_DiscoveryPhase, client_flow_id_) - + sizeof(ConnectionsLog_DiscoveryPhase::client_flow_id_) + PROTOBUF_FIELD_OFFSET(ConnectionsLog_DiscoveryPhase, stop_reason_) + + sizeof(ConnectionsLog_DiscoveryPhase::stop_reason_) - PROTOBUF_FIELD_OFFSET(ConnectionsLog_DiscoveryPhase, discovery_metadata_)>( reinterpret_cast(&discovery_metadata_), reinterpret_cast(&other->discovery_metadata_)); @@ -2557,6 +3356,9 @@ class ConnectionsLog_AdvertisingPhase::_Internal { static void set_has_advertising_metadata(HasBits* has_bits) { (*has_bits)[0] |= 1u; } + static void set_has_stop_reason(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } }; const ::location::nearby::analytics::proto::ConnectionsLog_AdvertisingMetadata& @@ -2567,7 +3369,8 @@ ConnectionsLog_AdvertisingPhase::ConnectionsLog_AdvertisingPhase(::PROTOBUF_NAME bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned), medium_(arena), - received_connection_request_(arena) { + received_connection_request_(arena), + adv_dis_result_(arena) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); @@ -2578,7 +3381,8 @@ ConnectionsLog_AdvertisingPhase::ConnectionsLog_AdvertisingPhase(const Connectio : ::PROTOBUF_NAMESPACE_ID::MessageLite(), _has_bits_(from._has_bits_), medium_(from.medium_), - received_connection_request_(from.received_connection_request_) { + received_connection_request_(from.received_connection_request_), + adv_dis_result_(from.adv_dis_result_) { _internal_metadata_.MergeFrom(from._internal_metadata_); if (from._internal_has_advertising_metadata()) { advertising_metadata_ = new ::location::nearby::analytics::proto::ConnectionsLog_AdvertisingMetadata(*from.advertising_metadata_); @@ -2586,16 +3390,16 @@ ConnectionsLog_AdvertisingPhase::ConnectionsLog_AdvertisingPhase(const Connectio advertising_metadata_ = nullptr; } ::memcpy(&duration_millis_, &from.duration_millis_, - static_cast(reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + static_cast(reinterpret_cast(&stop_reason_) - + reinterpret_cast(&duration_millis_)) + sizeof(stop_reason_)); // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase) } inline void ConnectionsLog_AdvertisingPhase::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&advertising_metadata_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&advertising_metadata_)) + sizeof(client_flow_id_)); + 0, static_cast(reinterpret_cast(&stop_reason_) - + reinterpret_cast(&advertising_metadata_)) + sizeof(stop_reason_)); } ConnectionsLog_AdvertisingPhase::~ConnectionsLog_AdvertisingPhase() { @@ -2628,15 +3432,16 @@ void ConnectionsLog_AdvertisingPhase::Clear() { medium_.Clear(); received_connection_request_.Clear(); + adv_dis_result_.Clear(); cached_has_bits = _has_bits_[0]; if (cached_has_bits & 0x00000001u) { GOOGLE_DCHECK(advertising_metadata_ != nullptr); advertising_metadata_->Clear(); } - if (cached_has_bits & 0x00000006u) { + if (cached_has_bits & 0x0000000eu) { ::memset(&duration_millis_, 0, static_cast( - reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + reinterpret_cast(&stop_reason_) - + reinterpret_cast(&duration_millis_)) + sizeof(stop_reason_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -2709,6 +3514,32 @@ const char* ConnectionsLog_AdvertisingPhase::_InternalParse(const char* ptr, ::P } else goto handle_unusual; continue; + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_adv_dis_result(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.StopAdvertisingReason stop_reason = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::StopAdvertisingReason_IsValid(val))) { + _internal_set_stop_reason(static_cast<::location::nearby::proto::connections::StopAdvertisingReason>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(7, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -2775,6 +3606,21 @@ uint8_t* ConnectionsLog_AdvertisingPhase::_InternalSerialize( 5, _Internal::advertising_metadata(this), target, stream); } + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 6; + for (unsigned int i = 0, + n = static_cast(this->_internal_adv_dis_result_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(6, this->_internal_adv_dis_result(i), target, stream); + } + + // optional .location.nearby.proto.connections.StopAdvertisingReason stop_reason = 7; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 7, this->_internal_stop_reason(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -2808,8 +3654,15 @@ size_t ConnectionsLog_AdvertisingPhase::ByteSizeLong() const { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); } + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 6; + total_size += 1UL * this->_internal_adv_dis_result_size(); + for (const auto& msg : this->adv_dis_result_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x0000000fu) { // optional .location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata advertising_metadata = 5; if (cached_has_bits & 0x00000001u) { total_size += 1 + @@ -2827,6 +3680,12 @@ size_t ConnectionsLog_AdvertisingPhase::ByteSizeLong() const { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_client_flow_id()); } + // optional .location.nearby.proto.connections.StopAdvertisingReason stop_reason = 7; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_stop_reason()); + } + } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); @@ -2850,8 +3709,9 @@ void ConnectionsLog_AdvertisingPhase::MergeFrom(const ConnectionsLog_Advertising medium_.MergeFrom(from.medium_); received_connection_request_.MergeFrom(from.received_connection_request_); + adv_dis_result_.MergeFrom(from.adv_dis_result_); cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x0000000fu) { if (cached_has_bits & 0x00000001u) { _internal_mutable_advertising_metadata()->::location::nearby::analytics::proto::ConnectionsLog_AdvertisingMetadata::MergeFrom(from._internal_advertising_metadata()); } @@ -2861,6 +3721,9 @@ void ConnectionsLog_AdvertisingPhase::MergeFrom(const ConnectionsLog_Advertising if (cached_has_bits & 0x00000004u) { client_flow_id_ = from.client_flow_id_; } + if (cached_has_bits & 0x00000008u) { + stop_reason_ = from.stop_reason_; + } _has_bits_[0] |= cached_has_bits; } _internal_metadata_.MergeFrom(from._internal_metadata_); @@ -2883,9 +3746,10 @@ void ConnectionsLog_AdvertisingPhase::InternalSwap(ConnectionsLog_AdvertisingPha swap(_has_bits_[0], other->_has_bits_[0]); medium_.InternalSwap(&other->medium_); received_connection_request_.InternalSwap(&other->received_connection_request_); + adv_dis_result_.InternalSwap(&other->adv_dis_result_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(ConnectionsLog_AdvertisingPhase, client_flow_id_) - + sizeof(ConnectionsLog_AdvertisingPhase::client_flow_id_) + PROTOBUF_FIELD_OFFSET(ConnectionsLog_AdvertisingPhase, stop_reason_) + + sizeof(ConnectionsLog_AdvertisingPhase::stop_reason_) - PROTOBUF_FIELD_OFFSET(ConnectionsLog_AdvertisingPhase, advertising_metadata_)>( reinterpret_cast(&advertising_metadata_), reinterpret_cast(&other->advertising_metadata_)); @@ -3226,23 +4090,23 @@ class ConnectionsLog_ConnectionAttempt::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_duration_millis(HasBits* has_bits) { - (*has_bits)[0] |= 4u; - } - static void set_has_type(HasBits* has_bits) { (*has_bits)[0] |= 8u; } - static void set_has_direction(HasBits* has_bits) { + static void set_has_type(HasBits* has_bits) { (*has_bits)[0] |= 16u; } - static void set_has_medium(HasBits* has_bits) { + static void set_has_direction(HasBits* has_bits) { (*has_bits)[0] |= 32u; } - static void set_has_attempt_result(HasBits* has_bits) { + static void set_has_medium(HasBits* has_bits) { (*has_bits)[0] |= 64u; } - static void set_has_client_flow_id(HasBits* has_bits) { + static void set_has_attempt_result(HasBits* has_bits) { (*has_bits)[0] |= 128u; } + static void set_has_client_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } static void set_has_connection_token(HasBits* has_bits) { (*has_bits)[0] |= 1u; } @@ -3250,12 +4114,23 @@ class ConnectionsLog_ConnectionAttempt::_Internal { static void set_has_connection_attempt_metadata(HasBits* has_bits) { (*has_bits)[0] |= 2u; } + static const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result(const ConnectionsLog_ConnectionAttempt* msg); + static void set_has_operation_result(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_connection_mode(HasBits* has_bits) { + (*has_bits)[0] |= 512u; + } }; const ::location::nearby::analytics::proto::ConnectionsLog_ConnectionAttemptMetadata& ConnectionsLog_ConnectionAttempt::_Internal::connection_attempt_metadata(const ConnectionsLog_ConnectionAttempt* msg) { return *msg->connection_attempt_metadata_; } +const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& +ConnectionsLog_ConnectionAttempt::_Internal::operation_result(const ConnectionsLog_ConnectionAttempt* msg) { + return *msg->operation_result_; +} ConnectionsLog_ConnectionAttempt::ConnectionsLog_ConnectionAttempt(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { @@ -3282,9 +4157,14 @@ ConnectionsLog_ConnectionAttempt::ConnectionsLog_ConnectionAttempt(const Connect } else { connection_attempt_metadata_ = nullptr; } + if (from._internal_has_operation_result()) { + operation_result_ = new ::location::nearby::analytics::proto::ConnectionsLog_OperationResult(*from.operation_result_); + } else { + operation_result_ = nullptr; + } ::memcpy(&duration_millis_, &from.duration_millis_, - static_cast(reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + static_cast(reinterpret_cast(&connection_mode_) - + reinterpret_cast(&duration_millis_)) + sizeof(connection_mode_)); // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt) } @@ -3295,8 +4175,8 @@ connection_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyS #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&connection_attempt_metadata_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&connection_attempt_metadata_)) + sizeof(client_flow_id_)); + 0, static_cast(reinterpret_cast(&connection_mode_) - + reinterpret_cast(&connection_attempt_metadata_)) + sizeof(connection_mode_)); } ConnectionsLog_ConnectionAttempt::~ConnectionsLog_ConnectionAttempt() { @@ -3310,6 +4190,7 @@ inline void ConnectionsLog_ConnectionAttempt::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); connection_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (this != internal_default_instance()) delete connection_attempt_metadata_; + if (this != internal_default_instance()) delete operation_result_; } void ConnectionsLog_ConnectionAttempt::ArenaDtor(void* object) { @@ -3329,7 +4210,7 @@ void ConnectionsLog_ConnectionAttempt::Clear() { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { connection_token_.ClearNonDefaultToEmpty(); } @@ -3337,11 +4218,20 @@ void ConnectionsLog_ConnectionAttempt::Clear() { GOOGLE_DCHECK(connection_attempt_metadata_ != nullptr); connection_attempt_metadata_->Clear(); } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(operation_result_ != nullptr); + operation_result_->Clear(); + } } - if (cached_has_bits & 0x000000fcu) { + if (cached_has_bits & 0x000000f8u) { ::memset(&duration_millis_, 0, static_cast( - reinterpret_cast(&client_flow_id_) - - reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); + reinterpret_cast(&attempt_result_) - + reinterpret_cast(&duration_millis_)) + sizeof(attempt_result_)); + } + if (cached_has_bits & 0x00000300u) { + ::memset(&client_flow_id_, 0, static_cast( + reinterpret_cast(&connection_mode_) - + reinterpret_cast(&client_flow_id_)) + sizeof(connection_mode_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -3441,6 +4331,27 @@ const char* ConnectionsLog_ConnectionAttempt::_InternalParse(const char* ptr, :: } else goto handle_unusual; continue; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + ptr = ctx->ParseMessage(_internal_mutable_operation_result(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::connections::ConnectionMode_IsValid(val))) { + _internal_set_connection_mode(static_cast<::location::nearby::proto::connections::ConnectionMode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(10, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -3473,41 +4384,41 @@ uint8_t* ConnectionsLog_ConnectionAttempt::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional int64 duration_millis = 1; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_duration_millis(), target); } // optional .location.nearby.proto.connections.ConnectionAttemptType type = 2; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 2, this->_internal_type(), target); } // optional .location.nearby.proto.connections.ConnectionAttemptDirection direction = 3; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 3, this->_internal_direction(), target); } // optional .location.nearby.proto.connections.Medium medium = 4; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 4, this->_internal_medium(), target); } // optional .location.nearby.proto.connections.ConnectionAttemptResult attempt_result = 5; - if (cached_has_bits & 0x00000040u) { + if (cached_has_bits & 0x00000080u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 5, this->_internal_attempt_result(), target); } // optional int64 client_flow_id = 6; - if (cached_has_bits & 0x00000080u) { + if (cached_has_bits & 0x00000100u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(6, this->_internal_client_flow_id(), target); } @@ -3526,6 +4437,21 @@ uint8_t* ConnectionsLog_ConnectionAttempt::_InternalSerialize( 8, _Internal::connection_attempt_metadata(this), target, stream); } + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 9, _Internal::operation_result(this), target, stream); + } + + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 10; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 10, this->_internal_connection_mode(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -3558,40 +4484,55 @@ size_t ConnectionsLog_ConnectionAttempt::ByteSizeLong() const { *connection_attempt_metadata_); } - // optional int64 duration_millis = 1; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *operation_result_); + } + + // optional int64 duration_millis = 1; + if (cached_has_bits & 0x00000008u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); } // optional .location.nearby.proto.connections.ConnectionAttemptType type = 2; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); } // optional .location.nearby.proto.connections.ConnectionAttemptDirection direction = 3; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_direction()); } // optional .location.nearby.proto.connections.Medium medium = 4; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_medium()); } // optional .location.nearby.proto.connections.ConnectionAttemptResult attempt_result = 5; - if (cached_has_bits & 0x00000040u) { + if (cached_has_bits & 0x00000080u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_attempt_result()); } + } + if (cached_has_bits & 0x00000300u) { // optional int64 client_flow_id = 6; - if (cached_has_bits & 0x00000080u) { + if (cached_has_bits & 0x00000100u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_client_flow_id()); } + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 10; + if (cached_has_bits & 0x00000200u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_connection_mode()); + } + } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); @@ -3622,23 +4563,32 @@ void ConnectionsLog_ConnectionAttempt::MergeFrom(const ConnectionsLog_Connection _internal_mutable_connection_attempt_metadata()->::location::nearby::analytics::proto::ConnectionsLog_ConnectionAttemptMetadata::MergeFrom(from._internal_connection_attempt_metadata()); } if (cached_has_bits & 0x00000004u) { - duration_millis_ = from.duration_millis_; + _internal_mutable_operation_result()->::location::nearby::analytics::proto::ConnectionsLog_OperationResult::MergeFrom(from._internal_operation_result()); } if (cached_has_bits & 0x00000008u) { - type_ = from.type_; + duration_millis_ = from.duration_millis_; } if (cached_has_bits & 0x00000010u) { - direction_ = from.direction_; + type_ = from.type_; } if (cached_has_bits & 0x00000020u) { - medium_ = from.medium_; + direction_ = from.direction_; } if (cached_has_bits & 0x00000040u) { - attempt_result_ = from.attempt_result_; + medium_ = from.medium_; } if (cached_has_bits & 0x00000080u) { + attempt_result_ = from.attempt_result_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000100u) { client_flow_id_ = from.client_flow_id_; } + if (cached_has_bits & 0x00000200u) { + connection_mode_ = from.connection_mode_; + } _has_bits_[0] |= cached_has_bits; } _internal_metadata_.MergeFrom(from._internal_metadata_); @@ -3667,8 +4617,8 @@ void ConnectionsLog_ConnectionAttempt::InternalSwap(ConnectionsLog_ConnectionAtt &other->connection_token_, rhs_arena ); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(ConnectionsLog_ConnectionAttempt, client_flow_id_) - + sizeof(ConnectionsLog_ConnectionAttempt::client_flow_id_) + PROTOBUF_FIELD_OFFSET(ConnectionsLog_ConnectionAttempt, connection_mode_) + + sizeof(ConnectionsLog_ConnectionAttempt::connection_mode_) - PROTOBUF_FIELD_OFFSET(ConnectionsLog_ConnectionAttempt, connection_attempt_metadata_)>( reinterpret_cast(&connection_attempt_metadata_), reinterpret_cast(&other->connection_attempt_metadata_)); @@ -3685,28 +4635,36 @@ class ConnectionsLog_EstablishedConnection::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_duration_millis(HasBits* has_bits) { - (*has_bits)[0] |= 2u; - } - static void set_has_medium(HasBits* has_bits) { (*has_bits)[0] |= 4u; } - static void set_has_disconnection_reason(HasBits* has_bits) { + static void set_has_medium(HasBits* has_bits) { (*has_bits)[0] |= 8u; } - static void set_has_client_flow_id(HasBits* has_bits) { + static void set_has_disconnection_reason(HasBits* has_bits) { (*has_bits)[0] |= 16u; } + static void set_has_client_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } static void set_has_connection_token(HasBits* has_bits) { (*has_bits)[0] |= 1u; } static void set_has_type(HasBits* has_bits) { - (*has_bits)[0] |= 32u; + (*has_bits)[0] |= 64u; } static void set_has_safe_disconnection_result(HasBits* has_bits) { - (*has_bits)[0] |= 64u; + (*has_bits)[0] |= 128u; + } + static const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result(const ConnectionsLog_EstablishedConnection* msg); + static void set_has_operation_result(HasBits* has_bits) { + (*has_bits)[0] |= 2u; } }; +const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& +ConnectionsLog_EstablishedConnection::_Internal::operation_result(const ConnectionsLog_EstablishedConnection* msg) { + return *msg->operation_result_; +} ConnectionsLog_EstablishedConnection::ConnectionsLog_EstablishedConnection(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned), @@ -3732,6 +4690,11 @@ ConnectionsLog_EstablishedConnection::ConnectionsLog_EstablishedConnection(const connection_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_connection_token(), GetArenaForAllocation()); } + if (from._internal_has_operation_result()) { + operation_result_ = new ::location::nearby::analytics::proto::ConnectionsLog_OperationResult(*from.operation_result_); + } else { + operation_result_ = nullptr; + } ::memcpy(&duration_millis_, &from.duration_millis_, static_cast(reinterpret_cast(&safe_disconnection_result_) - reinterpret_cast(&duration_millis_)) + sizeof(safe_disconnection_result_)); @@ -3744,9 +4707,9 @@ connection_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyS connection_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast(this) + static_cast( - reinterpret_cast(&duration_millis_) - reinterpret_cast(this)), + reinterpret_cast(&operation_result_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&safe_disconnection_result_) - - reinterpret_cast(&duration_millis_)) + sizeof(safe_disconnection_result_)); + reinterpret_cast(&operation_result_)) + sizeof(safe_disconnection_result_)); } ConnectionsLog_EstablishedConnection::~ConnectionsLog_EstablishedConnection() { @@ -3759,6 +4722,7 @@ ConnectionsLog_EstablishedConnection::~ConnectionsLog_EstablishedConnection() { inline void ConnectionsLog_EstablishedConnection::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); connection_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete operation_result_; } void ConnectionsLog_EstablishedConnection::ArenaDtor(void* object) { @@ -3780,10 +4744,16 @@ void ConnectionsLog_EstablishedConnection::Clear() { sent_payload_.Clear(); received_payload_.Clear(); cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - connection_token_.ClearNonDefaultToEmpty(); + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + connection_token_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(operation_result_ != nullptr); + operation_result_->Clear(); + } } - if (cached_has_bits & 0x0000007eu) { + if (cached_has_bits & 0x000000fcu) { ::memset(&duration_millis_, 0, static_cast( reinterpret_cast(&safe_disconnection_result_) - reinterpret_cast(&duration_millis_)) + sizeof(safe_disconnection_result_)); @@ -3904,6 +4874,14 @@ const char* ConnectionsLog_EstablishedConnection::_InternalParse(const char* ptr } else goto handle_unusual; continue; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) { + ptr = ctx->ParseMessage(_internal_mutable_operation_result(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -3936,13 +4914,13 @@ uint8_t* ConnectionsLog_EstablishedConnection::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional int64 duration_millis = 1; - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_duration_millis(), target); } // optional .location.nearby.proto.connections.Medium medium = 2; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 2, this->_internal_medium(), target); @@ -3965,14 +4943,14 @@ uint8_t* ConnectionsLog_EstablishedConnection::_InternalSerialize( } // optional .location.nearby.proto.connections.DisconnectionReason disconnection_reason = 5; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 5, this->_internal_disconnection_reason(), target); } // optional int64 client_flow_id = 6; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(6, this->_internal_client_flow_id(), target); } @@ -3984,19 +4962,27 @@ uint8_t* ConnectionsLog_EstablishedConnection::_InternalSerialize( } // optional .location.nearby.proto.connections.ConnectionAttemptType type = 8; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 8, this->_internal_type(), target); } // optional .location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.SafeDisconnectionResult safe_disconnection_result = 9; - if (cached_has_bits & 0x00000040u) { + if (cached_has_bits & 0x00000080u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 9, this->_internal_safe_disconnection_result(), target); } + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 10; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 10, _Internal::operation_result(this), target, stream); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -4028,7 +5014,7 @@ size_t ConnectionsLog_EstablishedConnection::ByteSizeLong() const { } cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x000000ffu) { // optional string connection_token = 7; if (cached_has_bits & 0x00000001u) { total_size += 1 + @@ -4036,36 +5022,43 @@ size_t ConnectionsLog_EstablishedConnection::ByteSizeLong() const { this->_internal_connection_token()); } - // optional int64 duration_millis = 1; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 10; if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *operation_result_); + } + + // optional int64 duration_millis = 1; + if (cached_has_bits & 0x00000004u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); } // optional .location.nearby.proto.connections.Medium medium = 2; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_medium()); } // optional .location.nearby.proto.connections.DisconnectionReason disconnection_reason = 5; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_disconnection_reason()); } // optional int64 client_flow_id = 6; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_client_flow_id()); } // optional .location.nearby.proto.connections.ConnectionAttemptType type = 8; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); } // optional .location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.SafeDisconnectionResult safe_disconnection_result = 9; - if (cached_has_bits & 0x00000040u) { + if (cached_has_bits & 0x00000080u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_safe_disconnection_result()); } @@ -4094,26 +5087,29 @@ void ConnectionsLog_EstablishedConnection::MergeFrom(const ConnectionsLog_Establ sent_payload_.MergeFrom(from.sent_payload_); received_payload_.MergeFrom(from.received_payload_); cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x000000ffu) { if (cached_has_bits & 0x00000001u) { _internal_set_connection_token(from._internal_connection_token()); } if (cached_has_bits & 0x00000002u) { - duration_millis_ = from.duration_millis_; + _internal_mutable_operation_result()->::location::nearby::analytics::proto::ConnectionsLog_OperationResult::MergeFrom(from._internal_operation_result()); } if (cached_has_bits & 0x00000004u) { - medium_ = from.medium_; + duration_millis_ = from.duration_millis_; } if (cached_has_bits & 0x00000008u) { - disconnection_reason_ = from.disconnection_reason_; + medium_ = from.medium_; } if (cached_has_bits & 0x00000010u) { - client_flow_id_ = from.client_flow_id_; + disconnection_reason_ = from.disconnection_reason_; } if (cached_has_bits & 0x00000020u) { - type_ = from.type_; + client_flow_id_ = from.client_flow_id_; } if (cached_has_bits & 0x00000040u) { + type_ = from.type_; + } + if (cached_has_bits & 0x00000080u) { safe_disconnection_result_ = from.safe_disconnection_result_; } _has_bits_[0] |= cached_has_bits; @@ -4148,9 +5144,9 @@ void ConnectionsLog_EstablishedConnection::InternalSwap(ConnectionsLog_Establish ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(ConnectionsLog_EstablishedConnection, safe_disconnection_result_) + sizeof(ConnectionsLog_EstablishedConnection::safe_disconnection_result_) - - PROTOBUF_FIELD_OFFSET(ConnectionsLog_EstablishedConnection, duration_millis_)>( - reinterpret_cast(&duration_millis_), - reinterpret_cast(&other->duration_millis_)); + - PROTOBUF_FIELD_OFFSET(ConnectionsLog_EstablishedConnection, operation_result_)>( + reinterpret_cast(&operation_result_), + reinterpret_cast(&other->operation_result_)); } std::string ConnectionsLog_EstablishedConnection::GetTypeName() const { @@ -4164,25 +5160,39 @@ class ConnectionsLog_Payload::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_duration_millis(HasBits* has_bits) { - (*has_bits)[0] |= 1u; - } - static void set_has_type(HasBits* has_bits) { - (*has_bits)[0] |= 4u; - } - static void set_has_total_size_bytes(HasBits* has_bits) { (*has_bits)[0] |= 2u; } - static void set_has_num_bytes_transferred(HasBits* has_bits) { - (*has_bits)[0] |= 16u; - } - static void set_has_num_chunks(HasBits* has_bits) { + static void set_has_type(HasBits* has_bits) { (*has_bits)[0] |= 8u; } - static void set_has_status(HasBits* has_bits) { + static void set_has_total_size_bytes(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_num_bytes_transferred(HasBits* has_bits) { (*has_bits)[0] |= 32u; } + static void set_has_num_chunks(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_num_successful_auto_resume(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result(const ConnectionsLog_Payload* msg); + static void set_has_operation_result(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_num_failed_auto_resume(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } }; +const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& +ConnectionsLog_Payload::_Internal::operation_result(const ConnectionsLog_Payload* msg) { + return *msg->operation_result_; +} ConnectionsLog_Payload::ConnectionsLog_Payload(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { @@ -4196,17 +5206,22 @@ ConnectionsLog_Payload::ConnectionsLog_Payload(const ConnectionsLog_Payload& fro : ::PROTOBUF_NAMESPACE_ID::MessageLite(), _has_bits_(from._has_bits_) { _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_operation_result()) { + operation_result_ = new ::location::nearby::analytics::proto::ConnectionsLog_OperationResult(*from.operation_result_); + } else { + operation_result_ = nullptr; + } ::memcpy(&duration_millis_, &from.duration_millis_, - static_cast(reinterpret_cast(&status_) - - reinterpret_cast(&duration_millis_)) + sizeof(status_)); + static_cast(reinterpret_cast(&num_failed_auto_resume_) - + reinterpret_cast(&duration_millis_)) + sizeof(num_failed_auto_resume_)); // @@protoc_insertion_point(copy_constructor:location.nearby.analytics.proto.ConnectionsLog.Payload) } inline void ConnectionsLog_Payload::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( - reinterpret_cast(&duration_millis_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&status_) - - reinterpret_cast(&duration_millis_)) + sizeof(status_)); + reinterpret_cast(&operation_result_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&num_failed_auto_resume_) - + reinterpret_cast(&operation_result_)) + sizeof(num_failed_auto_resume_)); } ConnectionsLog_Payload::~ConnectionsLog_Payload() { @@ -4218,6 +5233,7 @@ ConnectionsLog_Payload::~ConnectionsLog_Payload() { inline void ConnectionsLog_Payload::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete operation_result_; } void ConnectionsLog_Payload::ArenaDtor(void* object) { @@ -4237,11 +5253,16 @@ void ConnectionsLog_Payload::Clear() { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - ::memset(&duration_millis_, 0, static_cast( - reinterpret_cast(&status_) - - reinterpret_cast(&duration_millis_)) + sizeof(status_)); + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(operation_result_ != nullptr); + operation_result_->Clear(); } + if (cached_has_bits & 0x000000feu) { + ::memset(&duration_millis_, 0, static_cast( + reinterpret_cast(&num_successful_auto_resume_) - + reinterpret_cast(&duration_millis_)) + sizeof(num_successful_auto_resume_)); + } + num_failed_auto_resume_ = 0; _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -4315,6 +5336,32 @@ const char* ConnectionsLog_Payload::_InternalParse(const char* ptr, ::PROTOBUF_N } else goto handle_unusual; continue; + // optional int32 num_successful_auto_resume = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_num_successful_auto_resume(&has_bits); + num_successful_auto_resume_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_operation_result(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 num_failed_auto_resume = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) { + _Internal::set_has_num_failed_auto_resume(&has_bits); + num_failed_auto_resume_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -4347,43 +5394,63 @@ uint8_t* ConnectionsLog_Payload::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional int64 duration_millis = 1; - if (cached_has_bits & 0x00000001u) { + if (cached_has_bits & 0x00000002u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_duration_millis(), target); } // optional .location.nearby.proto.connections.PayloadType type = 2; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 2, this->_internal_type(), target); } // optional int64 total_size_bytes = 3; - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_total_size_bytes(), target); } // optional int64 num_bytes_transferred = 4; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_num_bytes_transferred(), target); } // optional int32 num_chunks = 5; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_num_chunks(), target); } // optional .location.nearby.proto.connections.PayloadStatus status = 6; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 6, this->_internal_status(), target); } + // optional int32 num_successful_auto_resume = 7; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->_internal_num_successful_auto_resume(), target); + } + + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 8; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 8, _Internal::operation_result(this), target, stream); + } + + // optional int32 num_failed_auto_resume = 9; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(9, this->_internal_num_failed_auto_resume(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -4401,40 +5468,57 @@ size_t ConnectionsLog_Payload::ByteSizeLong() const { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { - // optional int64 duration_millis = 1; + if (cached_has_bits & 0x000000ffu) { + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 8; if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *operation_result_); + } + + // optional int64 duration_millis = 1; + if (cached_has_bits & 0x00000002u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); } // optional int64 total_size_bytes = 3; - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000004u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_total_size_bytes()); } // optional .location.nearby.proto.connections.PayloadType type = 2; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); } // optional int32 num_chunks = 5; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_num_chunks()); } // optional int64 num_bytes_transferred = 4; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_num_bytes_transferred()); } // optional .location.nearby.proto.connections.PayloadStatus status = 6; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); } + // optional int32 num_successful_auto_resume = 7; + if (cached_has_bits & 0x00000080u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_num_successful_auto_resume()); + } + } + // optional int32 num_failed_auto_resume = 9; + if (cached_has_bits & 0x00000100u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_num_failed_auto_resume()); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); } @@ -4456,27 +5540,36 @@ void ConnectionsLog_Payload::MergeFrom(const ConnectionsLog_Payload& from) { (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x000000ffu) { if (cached_has_bits & 0x00000001u) { - duration_millis_ = from.duration_millis_; + _internal_mutable_operation_result()->::location::nearby::analytics::proto::ConnectionsLog_OperationResult::MergeFrom(from._internal_operation_result()); } if (cached_has_bits & 0x00000002u) { - total_size_bytes_ = from.total_size_bytes_; + duration_millis_ = from.duration_millis_; } if (cached_has_bits & 0x00000004u) { - type_ = from.type_; + total_size_bytes_ = from.total_size_bytes_; } if (cached_has_bits & 0x00000008u) { - num_chunks_ = from.num_chunks_; + type_ = from.type_; } if (cached_has_bits & 0x00000010u) { - num_bytes_transferred_ = from.num_bytes_transferred_; + num_chunks_ = from.num_chunks_; } if (cached_has_bits & 0x00000020u) { + num_bytes_transferred_ = from.num_bytes_transferred_; + } + if (cached_has_bits & 0x00000040u) { status_ = from.status_; } + if (cached_has_bits & 0x00000080u) { + num_successful_auto_resume_ = from.num_successful_auto_resume_; + } _has_bits_[0] |= cached_has_bits; } + if (cached_has_bits & 0x00000100u) { + _internal_set_num_failed_auto_resume(from._internal_num_failed_auto_resume()); + } _internal_metadata_.MergeFrom(from._internal_metadata_); } @@ -4496,11 +5589,11 @@ void ConnectionsLog_Payload::InternalSwap(ConnectionsLog_Payload* other) { _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(ConnectionsLog_Payload, status_) - + sizeof(ConnectionsLog_Payload::status_) - - PROTOBUF_FIELD_OFFSET(ConnectionsLog_Payload, duration_millis_)>( - reinterpret_cast(&duration_millis_), - reinterpret_cast(&other->duration_millis_)); + PROTOBUF_FIELD_OFFSET(ConnectionsLog_Payload, num_failed_auto_resume_) + + sizeof(ConnectionsLog_Payload::num_failed_auto_resume_) + - PROTOBUF_FIELD_OFFSET(ConnectionsLog_Payload, operation_result_)>( + reinterpret_cast(&operation_result_), + reinterpret_cast(&other->operation_result_)); } std::string ConnectionsLog_Payload::GetTypeName() const { @@ -4514,31 +5607,39 @@ class ConnectionsLog_BandwidthUpgradeAttempt::_Internal { public: using HasBits = decltype(std::declval()._has_bits_); static void set_has_direction(HasBits* has_bits) { - (*has_bits)[0] |= 4u; - } - static void set_has_duration_millis(HasBits* has_bits) { - (*has_bits)[0] |= 2u; - } - static void set_has_from_medium(HasBits* has_bits) { (*has_bits)[0] |= 8u; } - static void set_has_to_medium(HasBits* has_bits) { + static void set_has_duration_millis(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_from_medium(HasBits* has_bits) { (*has_bits)[0] |= 16u; } - static void set_has_upgrade_result(HasBits* has_bits) { + static void set_has_to_medium(HasBits* has_bits) { (*has_bits)[0] |= 32u; } + static void set_has_upgrade_result(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } static void set_has_error_stage(HasBits* has_bits) { - (*has_bits)[0] |= 128u; + (*has_bits)[0] |= 256u; } static void set_has_client_flow_id(HasBits* has_bits) { - (*has_bits)[0] |= 64u; + (*has_bits)[0] |= 128u; } static void set_has_connection_token(HasBits* has_bits) { (*has_bits)[0] |= 1u; } + static const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result(const ConnectionsLog_BandwidthUpgradeAttempt* msg); + static void set_has_operation_result(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } }; +const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& +ConnectionsLog_BandwidthUpgradeAttempt::_Internal::operation_result(const ConnectionsLog_BandwidthUpgradeAttempt* msg) { + return *msg->operation_result_; +} ConnectionsLog_BandwidthUpgradeAttempt::ConnectionsLog_BandwidthUpgradeAttempt(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { @@ -4560,6 +5661,11 @@ ConnectionsLog_BandwidthUpgradeAttempt::ConnectionsLog_BandwidthUpgradeAttempt(c connection_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_connection_token(), GetArenaForAllocation()); } + if (from._internal_has_operation_result()) { + operation_result_ = new ::location::nearby::analytics::proto::ConnectionsLog_OperationResult(*from.operation_result_); + } else { + operation_result_ = nullptr; + } ::memcpy(&duration_millis_, &from.duration_millis_, static_cast(reinterpret_cast(&error_stage_) - reinterpret_cast(&duration_millis_)) + sizeof(error_stage_)); @@ -4572,9 +5678,9 @@ connection_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyS connection_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING ::memset(reinterpret_cast(this) + static_cast( - reinterpret_cast(&duration_millis_) - reinterpret_cast(this)), + reinterpret_cast(&operation_result_) - reinterpret_cast(this)), 0, static_cast(reinterpret_cast(&error_stage_) - - reinterpret_cast(&duration_millis_)) + sizeof(error_stage_)); + reinterpret_cast(&operation_result_)) + sizeof(error_stage_)); } ConnectionsLog_BandwidthUpgradeAttempt::~ConnectionsLog_BandwidthUpgradeAttempt() { @@ -4587,6 +5693,7 @@ ConnectionsLog_BandwidthUpgradeAttempt::~ConnectionsLog_BandwidthUpgradeAttempt( inline void ConnectionsLog_BandwidthUpgradeAttempt::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); connection_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete operation_result_; } void ConnectionsLog_BandwidthUpgradeAttempt::ArenaDtor(void* object) { @@ -4606,14 +5713,21 @@ void ConnectionsLog_BandwidthUpgradeAttempt::Clear() { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000001u) { - connection_token_.ClearNonDefaultToEmpty(); + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + connection_token_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(operation_result_ != nullptr); + operation_result_->Clear(); + } } - if (cached_has_bits & 0x000000feu) { + if (cached_has_bits & 0x000000fcu) { ::memset(&duration_millis_, 0, static_cast( - reinterpret_cast(&error_stage_) - - reinterpret_cast(&duration_millis_)) + sizeof(error_stage_)); + reinterpret_cast(&client_flow_id_) - + reinterpret_cast(&duration_millis_)) + sizeof(client_flow_id_)); } + error_stage_ = 0; _has_bits_.Clear(); _internal_metadata_.Clear(); } @@ -4717,6 +5831,14 @@ const char* ConnectionsLog_BandwidthUpgradeAttempt::_InternalParse(const char* p } else goto handle_unusual; continue; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + ptr = ctx->ParseMessage(_internal_mutable_operation_result(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -4749,48 +5871,48 @@ uint8_t* ConnectionsLog_BandwidthUpgradeAttempt::_InternalSerialize( cached_has_bits = _has_bits_[0]; // optional .location.nearby.proto.connections.ConnectionAttemptDirection direction = 1; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 1, this->_internal_direction(), target); } // optional int64 duration_millis = 2; - if (cached_has_bits & 0x00000002u) { + if (cached_has_bits & 0x00000004u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_duration_millis(), target); } // optional .location.nearby.proto.connections.Medium from_medium = 3; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 3, this->_internal_from_medium(), target); } // optional .location.nearby.proto.connections.Medium to_medium = 4; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 4, this->_internal_to_medium(), target); } // optional .location.nearby.proto.connections.BandwidthUpgradeResult upgrade_result = 5; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 5, this->_internal_upgrade_result(), target); } // optional .location.nearby.proto.connections.BandwidthUpgradeErrorStage error_stage = 6; - if (cached_has_bits & 0x00000080u) { + if (cached_has_bits & 0x00000100u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 6, this->_internal_error_stage(), target); } // optional int64 client_flow_id = 7; - if (cached_has_bits & 0x00000040u) { + if (cached_has_bits & 0x00000080u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(7, this->_internal_client_flow_id(), target); } @@ -4801,6 +5923,14 @@ uint8_t* ConnectionsLog_BandwidthUpgradeAttempt::_InternalSerialize( 8, this->_internal_connection_token(), target); } + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 9, _Internal::operation_result(this), target, stream); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -4826,47 +5956,54 @@ size_t ConnectionsLog_BandwidthUpgradeAttempt::ByteSizeLong() const { this->_internal_connection_token()); } - // optional int64 duration_millis = 2; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *operation_result_); + } + + // optional int64 duration_millis = 2; + if (cached_has_bits & 0x00000004u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); } // optional .location.nearby.proto.connections.ConnectionAttemptDirection direction = 1; - if (cached_has_bits & 0x00000004u) { + if (cached_has_bits & 0x00000008u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_direction()); } // optional .location.nearby.proto.connections.Medium from_medium = 3; - if (cached_has_bits & 0x00000008u) { + if (cached_has_bits & 0x00000010u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_from_medium()); } // optional .location.nearby.proto.connections.Medium to_medium = 4; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000020u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_to_medium()); } // optional .location.nearby.proto.connections.BandwidthUpgradeResult upgrade_result = 5; - if (cached_has_bits & 0x00000020u) { + if (cached_has_bits & 0x00000040u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_upgrade_result()); } // optional int64 client_flow_id = 7; - if (cached_has_bits & 0x00000040u) { + if (cached_has_bits & 0x00000080u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_client_flow_id()); } - // optional .location.nearby.proto.connections.BandwidthUpgradeErrorStage error_stage = 6; - if (cached_has_bits & 0x00000080u) { - total_size += 1 + - ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_error_stage()); - } - } + // optional .location.nearby.proto.connections.BandwidthUpgradeErrorStage error_stage = 6; + if (cached_has_bits & 0x00000100u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_error_stage()); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); } @@ -4893,28 +6030,31 @@ void ConnectionsLog_BandwidthUpgradeAttempt::MergeFrom(const ConnectionsLog_Band _internal_set_connection_token(from._internal_connection_token()); } if (cached_has_bits & 0x00000002u) { - duration_millis_ = from.duration_millis_; + _internal_mutable_operation_result()->::location::nearby::analytics::proto::ConnectionsLog_OperationResult::MergeFrom(from._internal_operation_result()); } if (cached_has_bits & 0x00000004u) { - direction_ = from.direction_; + duration_millis_ = from.duration_millis_; } if (cached_has_bits & 0x00000008u) { - from_medium_ = from.from_medium_; + direction_ = from.direction_; } if (cached_has_bits & 0x00000010u) { - to_medium_ = from.to_medium_; + from_medium_ = from.from_medium_; } if (cached_has_bits & 0x00000020u) { - upgrade_result_ = from.upgrade_result_; + to_medium_ = from.to_medium_; } if (cached_has_bits & 0x00000040u) { - client_flow_id_ = from.client_flow_id_; + upgrade_result_ = from.upgrade_result_; } if (cached_has_bits & 0x00000080u) { - error_stage_ = from.error_stage_; + client_flow_id_ = from.client_flow_id_; } _has_bits_[0] |= cached_has_bits; } + if (cached_has_bits & 0x00000100u) { + _internal_set_error_stage(from._internal_error_stage()); + } _internal_metadata_.MergeFrom(from._internal_metadata_); } @@ -4943,9 +6083,9 @@ void ConnectionsLog_BandwidthUpgradeAttempt::InternalSwap(ConnectionsLog_Bandwid ::PROTOBUF_NAMESPACE_ID::internal::memswap< PROTOBUF_FIELD_OFFSET(ConnectionsLog_BandwidthUpgradeAttempt, error_stage_) + sizeof(ConnectionsLog_BandwidthUpgradeAttempt::error_stage_) - - PROTOBUF_FIELD_OFFSET(ConnectionsLog_BandwidthUpgradeAttempt, duration_millis_)>( - reinterpret_cast(&duration_millis_), - reinterpret_cast(&other->duration_millis_)); + - PROTOBUF_FIELD_OFFSET(ConnectionsLog_BandwidthUpgradeAttempt, operation_result_)>( + reinterpret_cast(&operation_result_), + reinterpret_cast(&other->operation_result_)); } std::string ConnectionsLog_BandwidthUpgradeAttempt::GetTypeName() const { @@ -5967,8 +7107,17 @@ class ConnectionsLog_AdvertisingMetadata::_Internal { (*has_bits)[0] |= 8u; } static void set_has_power_level(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static void set_has_supports_dual_band(HasBits* has_bits) { (*has_bits)[0] |= 16u; } + static void set_has_supports_wifi_aware(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_endpoint_info_size(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } }; ConnectionsLog_AdvertisingMetadata::ConnectionsLog_AdvertisingMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, @@ -5993,8 +7142,8 @@ ConnectionsLog_AdvertisingMetadata::ConnectionsLog_AdvertisingMetadata(const Con inline void ConnectionsLog_AdvertisingMetadata::SharedCtor() { ::memset(reinterpret_cast(this) + static_cast( reinterpret_cast(&connected_ap_frequency_) - reinterpret_cast(this)), - 0, static_cast(reinterpret_cast(&multiple_advertisement_supported_) - - reinterpret_cast(&connected_ap_frequency_)) + sizeof(multiple_advertisement_supported_)); + 0, static_cast(reinterpret_cast(&endpoint_info_size_) - + reinterpret_cast(&connected_ap_frequency_)) + sizeof(endpoint_info_size_)); power_level_ = -1; } @@ -6026,10 +7175,10 @@ void ConnectionsLog_AdvertisingMetadata::Clear() { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x000000ffu) { ::memset(&connected_ap_frequency_, 0, static_cast( - reinterpret_cast(&multiple_advertisement_supported_) - - reinterpret_cast(&connected_ap_frequency_)) + sizeof(multiple_advertisement_supported_)); + reinterpret_cast(&endpoint_info_size_) - + reinterpret_cast(&connected_ap_frequency_)) + sizeof(endpoint_info_size_)); power_level_ = -1; } _has_bits_.Clear(); @@ -6092,6 +7241,33 @@ const char* ConnectionsLog_AdvertisingMetadata::_InternalParse(const char* ptr, } else goto handle_unusual; continue; + // optional bool supports_dual_band = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + _Internal::set_has_supports_dual_band(&has_bits); + supports_dual_band_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool supports_wifi_aware = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_supports_wifi_aware(&has_bits); + supports_wifi_aware_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 endpoint_info_size = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 64)) { + _Internal::set_has_endpoint_info_size(&has_bits); + endpoint_info_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -6148,12 +7324,30 @@ uint8_t* ConnectionsLog_AdvertisingMetadata::_InternalSerialize( } // optional .location.nearby.proto.connections.PowerLevel power_level = 5; - if (cached_has_bits & 0x00000010u) { + if (cached_has_bits & 0x00000080u) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 5, this->_internal_power_level(), target); } + // optional bool supports_dual_band = 6; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->_internal_supports_dual_band(), target); + } + + // optional bool supports_wifi_aware = 7; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(7, this->_internal_supports_wifi_aware(), target); + } + + // optional int32 endpoint_info_size = 8; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(8, this->_internal_endpoint_info_size(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -6171,7 +7365,7 @@ size_t ConnectionsLog_AdvertisingMetadata::ByteSizeLong() const { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x000000ffu) { // optional int32 connected_ap_frequency = 2; if (cached_has_bits & 0x00000001u) { total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_connected_ap_frequency()); @@ -6192,8 +7386,23 @@ size_t ConnectionsLog_AdvertisingMetadata::ByteSizeLong() const { total_size += 1 + 1; } - // optional .location.nearby.proto.connections.PowerLevel power_level = 5; + // optional bool supports_dual_band = 6; if (cached_has_bits & 0x00000010u) { + total_size += 1 + 1; + } + + // optional bool supports_wifi_aware = 7; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + 1; + } + + // optional int32 endpoint_info_size = 8; + if (cached_has_bits & 0x00000040u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_endpoint_info_size()); + } + + // optional .location.nearby.proto.connections.PowerLevel power_level = 5; + if (cached_has_bits & 0x00000080u) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_power_level()); } @@ -6220,7 +7429,7 @@ void ConnectionsLog_AdvertisingMetadata::MergeFrom(const ConnectionsLog_Advertis (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x000000ffu) { if (cached_has_bits & 0x00000001u) { connected_ap_frequency_ = from.connected_ap_frequency_; } @@ -6234,6 +7443,15 @@ void ConnectionsLog_AdvertisingMetadata::MergeFrom(const ConnectionsLog_Advertis multiple_advertisement_supported_ = from.multiple_advertisement_supported_; } if (cached_has_bits & 0x00000010u) { + supports_dual_band_ = from.supports_dual_band_; + } + if (cached_has_bits & 0x00000020u) { + supports_wifi_aware_ = from.supports_wifi_aware_; + } + if (cached_has_bits & 0x00000040u) { + endpoint_info_size_ = from.endpoint_info_size_; + } + if (cached_has_bits & 0x00000080u) { power_level_ = from.power_level_; } _has_bits_[0] |= cached_has_bits; @@ -6257,8 +7475,8 @@ void ConnectionsLog_AdvertisingMetadata::InternalSwap(ConnectionsLog_Advertising _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_has_bits_[0], other->_has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(ConnectionsLog_AdvertisingMetadata, multiple_advertisement_supported_) - + sizeof(ConnectionsLog_AdvertisingMetadata::multiple_advertisement_supported_) + PROTOBUF_FIELD_OFFSET(ConnectionsLog_AdvertisingMetadata, endpoint_info_size_) + + sizeof(ConnectionsLog_AdvertisingMetadata::endpoint_info_size_) - PROTOBUF_FIELD_OFFSET(ConnectionsLog_AdvertisingMetadata, connected_ap_frequency_)>( reinterpret_cast(&connected_ap_frequency_), reinterpret_cast(&other->connected_ap_frequency_)); @@ -7654,6 +8872,12 @@ PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::location::nearby::analytics::proto::ConnectionsLog_ClientSession* Arena::CreateMaybeMessage< ::location::nearby::analytics::proto::ConnectionsLog_ClientSession >(Arena* arena) { return Arena::CreateMessageInternal< ::location::nearby::analytics::proto::ConnectionsLog_ClientSession >(arena); } +template<> PROTOBUF_NOINLINE ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* Arena::CreateMaybeMessage< ::location::nearby::analytics::proto::ConnectionsLog_OperationResult >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::analytics::proto::ConnectionsLog_OperationResult >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* Arena::CreateMaybeMessage< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >(arena); +} template<> PROTOBUF_NOINLINE ::location::nearby::analytics::proto::ConnectionsLog_StrategySession* Arena::CreateMaybeMessage< ::location::nearby::analytics::proto::ConnectionsLog_StrategySession >(Arena* arena) { return Arena::CreateMessageInternal< ::location::nearby::analytics::proto::ConnectionsLog_StrategySession >(arena); } diff --git a/compiled_proto/internal/proto/analytics/connections_log.pb.h b/compiled_proto/internal/proto/analytics/connections_log.pb.h index c90e49b3..1370b031 100644 --- a/compiled_proto/internal/proto/analytics/connections_log.pb.h +++ b/compiled_proto/internal/proto/analytics/connections_log.pb.h @@ -47,7 +47,7 @@ struct TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto { PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] PROTOBUF_SECTION_VARIABLE(protodesc_cold); - static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[17] + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[19] PROTOBUF_SECTION_VARIABLE(protodesc_cold); static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; @@ -96,6 +96,12 @@ extern ConnectionsLog_ErrorCodeDefaultTypeInternal _ConnectionsLog_ErrorCode_def class ConnectionsLog_EstablishedConnection; struct ConnectionsLog_EstablishedConnectionDefaultTypeInternal; extern ConnectionsLog_EstablishedConnectionDefaultTypeInternal _ConnectionsLog_EstablishedConnection_default_instance_; +class ConnectionsLog_OperationResult; +struct ConnectionsLog_OperationResultDefaultTypeInternal; +extern ConnectionsLog_OperationResultDefaultTypeInternal _ConnectionsLog_OperationResult_default_instance_; +class ConnectionsLog_OperationResultWithMedium; +struct ConnectionsLog_OperationResultWithMediumDefaultTypeInternal; +extern ConnectionsLog_OperationResultWithMediumDefaultTypeInternal _ConnectionsLog_OperationResultWithMedium_default_instance_; class ConnectionsLog_Payload; struct ConnectionsLog_PayloadDefaultTypeInternal; extern ConnectionsLog_PayloadDefaultTypeInternal _ConnectionsLog_Payload_default_instance_; @@ -126,6 +132,8 @@ template<> ::location::nearby::analytics::proto::ConnectionsLog_DiscoveryMetadat template<> ::location::nearby::analytics::proto::ConnectionsLog_DiscoveryPhase* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_DiscoveryPhase>(Arena*); template<> ::location::nearby::analytics::proto::ConnectionsLog_ErrorCode* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_ErrorCode>(Arena*); template<> ::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection>(Arena*); +template<> ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>(Arena*); +template<> ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium>(Arena*); template<> ::location::nearby::analytics::proto::ConnectionsLog_Payload* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_Payload>(Arena*); template<> ::location::nearby::analytics::proto::ConnectionsLog_RawUwbRangingEvent* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_RawUwbRangingEvent>(Arena*); template<> ::location::nearby::analytics::proto::ConnectionsLog_StrategySession* Arena::CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_StrategySession>(Arena*); @@ -272,7 +280,9 @@ class ConnectionsLog_ClientSession final : enum : int { kStrategySessionFieldNumber = 2, + kConnectionTokenFieldNumber = 4, kDurationMillisFieldNumber = 1, + kClientFlowIdFieldNumber = 3, }; // repeated .location.nearby.analytics.proto.ConnectionsLog.StrategySession strategy_session = 2; int strategy_session_size() const; @@ -292,6 +302,24 @@ class ConnectionsLog_ClientSession final : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_StrategySession >& strategy_session() const; + // optional string connection_token = 4; + bool has_connection_token() const; + private: + bool _internal_has_connection_token() const; + public: + void clear_connection_token(); + const std::string& connection_token() const; + template + void set_connection_token(ArgT0&& arg0, ArgT... args); + std::string* mutable_connection_token(); + PROTOBUF_NODISCARD std::string* release_connection_token(); + void set_allocated_connection_token(std::string* connection_token); + private: + const std::string& _internal_connection_token() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_connection_token(const std::string& value); + std::string* _internal_mutable_connection_token(); + public: + // optional int64 duration_millis = 1; bool has_duration_millis() const; private: @@ -305,6 +333,19 @@ class ConnectionsLog_ClientSession final : void _internal_set_duration_millis(int64_t value); public: + // optional int64 client_flow_id = 3; + bool has_client_flow_id() const; + private: + bool _internal_has_client_flow_id() const; + public: + void clear_client_flow_id(); + int64_t client_flow_id() const; + void set_client_flow_id(int64_t value); + private: + int64_t _internal_client_flow_id() const; + void _internal_set_client_flow_id(int64_t value); + public: + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.ClientSession) private: class _Internal; @@ -315,7 +356,368 @@ class ConnectionsLog_ClientSession final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_StrategySession > strategy_session_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr connection_token_; int64_t duration_millis_; + int64_t client_flow_id_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class ConnectionsLog_OperationResult final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.analytics.proto.ConnectionsLog.OperationResult) */ { + public: + inline ConnectionsLog_OperationResult() : ConnectionsLog_OperationResult(nullptr) {} + ~ConnectionsLog_OperationResult() override; + explicit constexpr ConnectionsLog_OperationResult(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ConnectionsLog_OperationResult(const ConnectionsLog_OperationResult& from); + ConnectionsLog_OperationResult(ConnectionsLog_OperationResult&& from) noexcept + : ConnectionsLog_OperationResult() { + *this = ::std::move(from); + } + + inline ConnectionsLog_OperationResult& operator=(const ConnectionsLog_OperationResult& from) { + CopyFrom(from); + return *this; + } + inline ConnectionsLog_OperationResult& operator=(ConnectionsLog_OperationResult&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ConnectionsLog_OperationResult& default_instance() { + return *internal_default_instance(); + } + static inline const ConnectionsLog_OperationResult* internal_default_instance() { + return reinterpret_cast( + &_ConnectionsLog_OperationResult_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(ConnectionsLog_OperationResult& a, ConnectionsLog_OperationResult& b) { + a.Swap(&b); + } + inline void Swap(ConnectionsLog_OperationResult* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConnectionsLog_OperationResult* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ConnectionsLog_OperationResult* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ConnectionsLog_OperationResult& from); + void MergeFrom(const ConnectionsLog_OperationResult& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ConnectionsLog_OperationResult* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.analytics.proto.ConnectionsLog.OperationResult"; + } + protected: + explicit ConnectionsLog_OperationResult(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kResultCategoryFieldNumber = 1, + kResultCodeFieldNumber = 2, + }; + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 1; + bool has_result_category() const; + private: + bool _internal_has_result_category() const; + public: + void clear_result_category(); + ::location::nearby::proto::connections::OperationResultCategory result_category() const; + void set_result_category(::location::nearby::proto::connections::OperationResultCategory value); + private: + ::location::nearby::proto::connections::OperationResultCategory _internal_result_category() const; + void _internal_set_result_category(::location::nearby::proto::connections::OperationResultCategory value); + public: + + // optional .location.nearby.proto.connections.OperationResultCode result_code = 2; + bool has_result_code() const; + private: + bool _internal_has_result_code() const; + public: + void clear_result_code(); + ::location::nearby::proto::connections::OperationResultCode result_code() const; + void set_result_code(::location::nearby::proto::connections::OperationResultCode value); + private: + ::location::nearby::proto::connections::OperationResultCode _internal_result_code() const; + void _internal_set_result_code(::location::nearby::proto::connections::OperationResultCode value); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.OperationResult) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int result_category_; + int result_code_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class ConnectionsLog_OperationResultWithMedium final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) */ { + public: + inline ConnectionsLog_OperationResultWithMedium() : ConnectionsLog_OperationResultWithMedium(nullptr) {} + ~ConnectionsLog_OperationResultWithMedium() override; + explicit constexpr ConnectionsLog_OperationResultWithMedium(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ConnectionsLog_OperationResultWithMedium(const ConnectionsLog_OperationResultWithMedium& from); + ConnectionsLog_OperationResultWithMedium(ConnectionsLog_OperationResultWithMedium&& from) noexcept + : ConnectionsLog_OperationResultWithMedium() { + *this = ::std::move(from); + } + + inline ConnectionsLog_OperationResultWithMedium& operator=(const ConnectionsLog_OperationResultWithMedium& from) { + CopyFrom(from); + return *this; + } + inline ConnectionsLog_OperationResultWithMedium& operator=(ConnectionsLog_OperationResultWithMedium&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ConnectionsLog_OperationResultWithMedium& default_instance() { + return *internal_default_instance(); + } + static inline const ConnectionsLog_OperationResultWithMedium* internal_default_instance() { + return reinterpret_cast( + &_ConnectionsLog_OperationResultWithMedium_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(ConnectionsLog_OperationResultWithMedium& a, ConnectionsLog_OperationResultWithMedium& b) { + a.Swap(&b); + } + inline void Swap(ConnectionsLog_OperationResultWithMedium* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConnectionsLog_OperationResultWithMedium* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ConnectionsLog_OperationResultWithMedium* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ConnectionsLog_OperationResultWithMedium& from); + void MergeFrom(const ConnectionsLog_OperationResultWithMedium& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ConnectionsLog_OperationResultWithMedium* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium"; + } + protected: + explicit ConnectionsLog_OperationResultWithMedium(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMediumFieldNumber = 1, + kUpdateIndexFieldNumber = 2, + kResultCategoryFieldNumber = 3, + kResultCodeFieldNumber = 4, + kConnectionModeFieldNumber = 5, + }; + // optional .location.nearby.proto.connections.Medium medium = 1; + bool has_medium() const; + private: + bool _internal_has_medium() const; + public: + void clear_medium(); + ::location::nearby::proto::connections::Medium medium() const; + void set_medium(::location::nearby::proto::connections::Medium value); + private: + ::location::nearby::proto::connections::Medium _internal_medium() const; + void _internal_set_medium(::location::nearby::proto::connections::Medium value); + public: + + // optional int32 update_index = 2; + bool has_update_index() const; + private: + bool _internal_has_update_index() const; + public: + void clear_update_index(); + int32_t update_index() const; + void set_update_index(int32_t value); + private: + int32_t _internal_update_index() const; + void _internal_set_update_index(int32_t value); + public: + + // optional .location.nearby.proto.connections.OperationResultCategory result_category = 3; + bool has_result_category() const; + private: + bool _internal_has_result_category() const; + public: + void clear_result_category(); + ::location::nearby::proto::connections::OperationResultCategory result_category() const; + void set_result_category(::location::nearby::proto::connections::OperationResultCategory value); + private: + ::location::nearby::proto::connections::OperationResultCategory _internal_result_category() const; + void _internal_set_result_category(::location::nearby::proto::connections::OperationResultCategory value); + public: + + // optional .location.nearby.proto.connections.OperationResultCode result_code = 4; + bool has_result_code() const; + private: + bool _internal_has_result_code() const; + public: + void clear_result_code(); + ::location::nearby::proto::connections::OperationResultCode result_code() const; + void set_result_code(::location::nearby::proto::connections::OperationResultCode value); + private: + ::location::nearby::proto::connections::OperationResultCode _internal_result_code() const; + void _internal_set_result_code(::location::nearby::proto::connections::OperationResultCode value); + public: + + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 5; + bool has_connection_mode() const; + private: + bool _internal_has_connection_mode() const; + public: + void clear_connection_mode(); + ::location::nearby::proto::connections::ConnectionMode connection_mode() const; + void set_connection_mode(::location::nearby::proto::connections::ConnectionMode value); + private: + ::location::nearby::proto::connections::ConnectionMode _internal_connection_mode() const; + void _internal_set_connection_mode(::location::nearby::proto::connections::ConnectionMode value); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int medium_; + int32_t update_index_; + int result_category_; + int result_code_; + int connection_mode_; friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; }; // ------------------------------------------------------------------- @@ -366,7 +768,7 @@ class ConnectionsLog_StrategySession final : &_ConnectionsLog_StrategySession_default_instance_); } static constexpr int kIndexInFileMessages = - 1; + 3; friend void swap(ConnectionsLog_StrategySession& a, ConnectionsLog_StrategySession& b) { a.Swap(&b); @@ -662,7 +1064,7 @@ class ConnectionsLog_DiscoveryPhase final : &_ConnectionsLog_DiscoveryPhase_default_instance_); } static constexpr int kIndexInFileMessages = - 2; + 4; friend void swap(ConnectionsLog_DiscoveryPhase& a, ConnectionsLog_DiscoveryPhase& b) { a.Swap(&b); @@ -733,9 +1135,11 @@ class ConnectionsLog_DiscoveryPhase final : kDiscoveredEndpointFieldNumber = 3, kSentConnectionRequestFieldNumber = 4, kUwbRangingFieldNumber = 5, + kAdvDisResultFieldNumber = 8, kDiscoveryMetadataFieldNumber = 7, kDurationMillisFieldNumber = 1, kClientFlowIdFieldNumber = 6, + kStopReasonFieldNumber = 9, }; // repeated .location.nearby.proto.connections.Medium medium = 2; int medium_size() const; @@ -808,6 +1212,24 @@ class ConnectionsLog_DiscoveryPhase final : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_UwbRangingProcess >& uwb_ranging() const; + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 8; + int adv_dis_result_size() const; + private: + int _internal_adv_dis_result_size() const; + public: + void clear_adv_dis_result(); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* mutable_adv_dis_result(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >* + mutable_adv_dis_result(); + private: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& _internal_adv_dis_result(int index) const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* _internal_add_adv_dis_result(); + public: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& adv_dis_result(int index) const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* add_adv_dis_result(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >& + adv_dis_result() const; + // optional .location.nearby.analytics.proto.ConnectionsLog.DiscoveryMetadata discovery_metadata = 7; bool has_discovery_metadata() const; private: @@ -852,6 +1274,19 @@ class ConnectionsLog_DiscoveryPhase final : void _internal_set_client_flow_id(int64_t value); public: + // optional .location.nearby.proto.connections.StopDiscoveringReason stop_reason = 9; + bool has_stop_reason() const; + private: + bool _internal_has_stop_reason() const; + public: + void clear_stop_reason(); + ::location::nearby::proto::connections::StopDiscoveringReason stop_reason() const; + void set_stop_reason(::location::nearby::proto::connections::StopDiscoveringReason value); + private: + ::location::nearby::proto::connections::StopDiscoveringReason _internal_stop_reason() const; + void _internal_set_stop_reason(::location::nearby::proto::connections::StopDiscoveringReason value); + public: + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase) private: class _Internal; @@ -865,9 +1300,11 @@ class ConnectionsLog_DiscoveryPhase final : ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_DiscoveredEndpoint > discovered_endpoint_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_ConnectionRequest > sent_connection_request_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_UwbRangingProcess > uwb_ranging_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium > adv_dis_result_; ::location::nearby::analytics::proto::ConnectionsLog_DiscoveryMetadata* discovery_metadata_; int64_t duration_millis_; int64_t client_flow_id_; + int stop_reason_; friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; }; // ------------------------------------------------------------------- @@ -918,7 +1355,7 @@ class ConnectionsLog_DiscoveredEndpoint final : &_ConnectionsLog_DiscoveredEndpoint_default_instance_); } static constexpr int kIndexInFileMessages = - 3; + 5; friend void swap(ConnectionsLog_DiscoveredEndpoint& a, ConnectionsLog_DiscoveredEndpoint& b) { a.Swap(&b); @@ -1075,7 +1512,7 @@ class ConnectionsLog_UwbRangingProcess final : &_ConnectionsLog_UwbRangingProcess_default_instance_); } static constexpr int kIndexInFileMessages = - 4; + 6; friend void swap(ConnectionsLog_UwbRangingProcess& a, ConnectionsLog_UwbRangingProcess& b) { a.Swap(&b); @@ -1372,7 +1809,7 @@ class ConnectionsLog_RawUwbRangingEvent final : &_ConnectionsLog_RawUwbRangingEvent_default_instance_); } static constexpr int kIndexInFileMessages = - 5; + 7; friend void swap(ConnectionsLog_RawUwbRangingEvent& a, ConnectionsLog_RawUwbRangingEvent& b) { a.Swap(&b); @@ -1544,7 +1981,7 @@ class ConnectionsLog_AdvertisingPhase final : &_ConnectionsLog_AdvertisingPhase_default_instance_); } static constexpr int kIndexInFileMessages = - 6; + 8; friend void swap(ConnectionsLog_AdvertisingPhase& a, ConnectionsLog_AdvertisingPhase& b) { a.Swap(&b); @@ -1613,9 +2050,11 @@ class ConnectionsLog_AdvertisingPhase final : enum : int { kMediumFieldNumber = 2, kReceivedConnectionRequestFieldNumber = 3, + kAdvDisResultFieldNumber = 6, kAdvertisingMetadataFieldNumber = 5, kDurationMillisFieldNumber = 1, kClientFlowIdFieldNumber = 4, + kStopReasonFieldNumber = 7, }; // repeated .location.nearby.proto.connections.Medium medium = 2; int medium_size() const; @@ -1652,6 +2091,24 @@ class ConnectionsLog_AdvertisingPhase final : const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_ConnectionRequest >& received_connection_request() const; + // repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 6; + int adv_dis_result_size() const; + private: + int _internal_adv_dis_result_size() const; + public: + void clear_adv_dis_result(); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* mutable_adv_dis_result(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >* + mutable_adv_dis_result(); + private: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& _internal_adv_dis_result(int index) const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* _internal_add_adv_dis_result(); + public: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& adv_dis_result(int index) const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* add_adv_dis_result(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >& + adv_dis_result() const; + // optional .location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata advertising_metadata = 5; bool has_advertising_metadata() const; private: @@ -1696,6 +2153,19 @@ class ConnectionsLog_AdvertisingPhase final : void _internal_set_client_flow_id(int64_t value); public: + // optional .location.nearby.proto.connections.StopAdvertisingReason stop_reason = 7; + bool has_stop_reason() const; + private: + bool _internal_has_stop_reason() const; + public: + void clear_stop_reason(); + ::location::nearby::proto::connections::StopAdvertisingReason stop_reason() const; + void set_stop_reason(::location::nearby::proto::connections::StopAdvertisingReason value); + private: + ::location::nearby::proto::connections::StopAdvertisingReason _internal_stop_reason() const; + void _internal_set_stop_reason(::location::nearby::proto::connections::StopAdvertisingReason value); + public: + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase) private: class _Internal; @@ -1707,9 +2177,11 @@ class ConnectionsLog_AdvertisingPhase final : mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::RepeatedField medium_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_ConnectionRequest > received_connection_request_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium > adv_dis_result_; ::location::nearby::analytics::proto::ConnectionsLog_AdvertisingMetadata* advertising_metadata_; int64_t duration_millis_; int64_t client_flow_id_; + int stop_reason_; friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; }; // ------------------------------------------------------------------- @@ -1760,7 +2232,7 @@ class ConnectionsLog_ConnectionRequest final : &_ConnectionsLog_ConnectionRequest_default_instance_); } static constexpr int kIndexInFileMessages = - 7; + 9; friend void swap(ConnectionsLog_ConnectionRequest& a, ConnectionsLog_ConnectionRequest& b) { a.Swap(&b); @@ -1962,7 +2434,7 @@ class ConnectionsLog_ConnectionAttempt final : &_ConnectionsLog_ConnectionAttempt_default_instance_); } static constexpr int kIndexInFileMessages = - 8; + 10; friend void swap(ConnectionsLog_ConnectionAttempt& a, ConnectionsLog_ConnectionAttempt& b) { a.Swap(&b); @@ -2031,12 +2503,14 @@ class ConnectionsLog_ConnectionAttempt final : enum : int { kConnectionTokenFieldNumber = 7, kConnectionAttemptMetadataFieldNumber = 8, + kOperationResultFieldNumber = 9, kDurationMillisFieldNumber = 1, kTypeFieldNumber = 2, kDirectionFieldNumber = 3, kMediumFieldNumber = 4, kAttemptResultFieldNumber = 5, kClientFlowIdFieldNumber = 6, + kConnectionModeFieldNumber = 10, }; // optional string connection_token = 7; bool has_connection_token() const; @@ -2074,6 +2548,24 @@ class ConnectionsLog_ConnectionAttempt final : ::location::nearby::analytics::proto::ConnectionsLog_ConnectionAttemptMetadata* connection_attempt_metadata); ::location::nearby::analytics::proto::ConnectionsLog_ConnectionAttemptMetadata* unsafe_arena_release_connection_attempt_metadata(); + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; + bool has_operation_result() const; + private: + bool _internal_has_operation_result() const; + public: + void clear_operation_result(); + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result() const; + PROTOBUF_NODISCARD ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* release_operation_result(); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* mutable_operation_result(); + void set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + private: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& _internal_operation_result() const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _internal_mutable_operation_result(); + public: + void unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* unsafe_arena_release_operation_result(); + // optional int64 duration_millis = 1; bool has_duration_millis() const; private: @@ -2152,6 +2644,19 @@ class ConnectionsLog_ConnectionAttempt final : void _internal_set_client_flow_id(int64_t value); public: + // optional .location.nearby.proto.connections.ConnectionMode connection_mode = 10; + bool has_connection_mode() const; + private: + bool _internal_has_connection_mode() const; + public: + void clear_connection_mode(); + ::location::nearby::proto::connections::ConnectionMode connection_mode() const; + void set_connection_mode(::location::nearby::proto::connections::ConnectionMode value); + private: + ::location::nearby::proto::connections::ConnectionMode _internal_connection_mode() const; + void _internal_set_connection_mode(::location::nearby::proto::connections::ConnectionMode value); + public: + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt) private: class _Internal; @@ -2163,12 +2668,14 @@ class ConnectionsLog_ConnectionAttempt final : mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr connection_token_; ::location::nearby::analytics::proto::ConnectionsLog_ConnectionAttemptMetadata* connection_attempt_metadata_; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result_; int64_t duration_millis_; int type_; int direction_; int medium_; int attempt_result_; int64_t client_flow_id_; + int connection_mode_; friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; }; // ------------------------------------------------------------------- @@ -2219,7 +2726,7 @@ class ConnectionsLog_EstablishedConnection final : &_ConnectionsLog_EstablishedConnection_default_instance_); } static constexpr int kIndexInFileMessages = - 9; + 11; friend void swap(ConnectionsLog_EstablishedConnection& a, ConnectionsLog_EstablishedConnection& b) { a.Swap(&b); @@ -2317,6 +2824,7 @@ class ConnectionsLog_EstablishedConnection final : kSentPayloadFieldNumber = 3, kReceivedPayloadFieldNumber = 4, kConnectionTokenFieldNumber = 7, + kOperationResultFieldNumber = 10, kDurationMillisFieldNumber = 1, kMediumFieldNumber = 2, kDisconnectionReasonFieldNumber = 5, @@ -2378,6 +2886,24 @@ class ConnectionsLog_EstablishedConnection final : std::string* _internal_mutable_connection_token(); public: + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 10; + bool has_operation_result() const; + private: + bool _internal_has_operation_result() const; + public: + void clear_operation_result(); + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result() const; + PROTOBUF_NODISCARD ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* release_operation_result(); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* mutable_operation_result(); + void set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + private: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& _internal_operation_result() const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _internal_mutable_operation_result(); + public: + void unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* unsafe_arena_release_operation_result(); + // optional int64 duration_millis = 1; bool has_duration_millis() const; private: @@ -2468,6 +2994,7 @@ class ConnectionsLog_EstablishedConnection final : ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_Payload > sent_payload_; ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_Payload > received_payload_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr connection_token_; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result_; int64_t duration_millis_; int medium_; int disconnection_reason_; @@ -2524,7 +3051,7 @@ class ConnectionsLog_Payload final : &_ConnectionsLog_Payload_default_instance_); } static constexpr int kIndexInFileMessages = - 10; + 12; friend void swap(ConnectionsLog_Payload& a, ConnectionsLog_Payload& b) { a.Swap(&b); @@ -2591,13 +3118,34 @@ class ConnectionsLog_Payload final : // accessors ------------------------------------------------------- enum : int { + kOperationResultFieldNumber = 8, kDurationMillisFieldNumber = 1, kTotalSizeBytesFieldNumber = 3, kTypeFieldNumber = 2, kNumChunksFieldNumber = 5, kNumBytesTransferredFieldNumber = 4, kStatusFieldNumber = 6, + kNumSuccessfulAutoResumeFieldNumber = 7, + kNumFailedAutoResumeFieldNumber = 9, }; + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 8; + bool has_operation_result() const; + private: + bool _internal_has_operation_result() const; + public: + void clear_operation_result(); + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result() const; + PROTOBUF_NODISCARD ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* release_operation_result(); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* mutable_operation_result(); + void set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + private: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& _internal_operation_result() const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _internal_mutable_operation_result(); + public: + void unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* unsafe_arena_release_operation_result(); + // optional int64 duration_millis = 1; bool has_duration_millis() const; private: @@ -2676,6 +3224,32 @@ class ConnectionsLog_Payload final : void _internal_set_status(::location::nearby::proto::connections::PayloadStatus value); public: + // optional int32 num_successful_auto_resume = 7; + bool has_num_successful_auto_resume() const; + private: + bool _internal_has_num_successful_auto_resume() const; + public: + void clear_num_successful_auto_resume(); + int32_t num_successful_auto_resume() const; + void set_num_successful_auto_resume(int32_t value); + private: + int32_t _internal_num_successful_auto_resume() const; + void _internal_set_num_successful_auto_resume(int32_t value); + public: + + // optional int32 num_failed_auto_resume = 9; + bool has_num_failed_auto_resume() const; + private: + bool _internal_has_num_failed_auto_resume() const; + public: + void clear_num_failed_auto_resume(); + int32_t num_failed_auto_resume() const; + void set_num_failed_auto_resume(int32_t value); + private: + int32_t _internal_num_failed_auto_resume() const; + void _internal_set_num_failed_auto_resume(int32_t value); + public: + // @@protoc_insertion_point(class_scope:location.nearby.analytics.proto.ConnectionsLog.Payload) private: class _Internal; @@ -2685,12 +3259,15 @@ class ConnectionsLog_Payload final : typedef void DestructorSkippable_; ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result_; int64_t duration_millis_; int64_t total_size_bytes_; int type_; int32_t num_chunks_; int64_t num_bytes_transferred_; int status_; + int32_t num_successful_auto_resume_; + int32_t num_failed_auto_resume_; friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; }; // ------------------------------------------------------------------- @@ -2741,7 +3318,7 @@ class ConnectionsLog_BandwidthUpgradeAttempt final : &_ConnectionsLog_BandwidthUpgradeAttempt_default_instance_); } static constexpr int kIndexInFileMessages = - 11; + 13; friend void swap(ConnectionsLog_BandwidthUpgradeAttempt& a, ConnectionsLog_BandwidthUpgradeAttempt& b) { a.Swap(&b); @@ -2809,6 +3386,7 @@ class ConnectionsLog_BandwidthUpgradeAttempt final : enum : int { kConnectionTokenFieldNumber = 8, + kOperationResultFieldNumber = 9, kDurationMillisFieldNumber = 2, kDirectionFieldNumber = 1, kFromMediumFieldNumber = 3, @@ -2835,6 +3413,24 @@ class ConnectionsLog_BandwidthUpgradeAttempt final : std::string* _internal_mutable_connection_token(); public: + // optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; + bool has_operation_result() const; + private: + bool _internal_has_operation_result() const; + public: + void clear_operation_result(); + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& operation_result() const; + PROTOBUF_NODISCARD ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* release_operation_result(); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* mutable_operation_result(); + void set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + private: + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& _internal_operation_result() const; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _internal_mutable_operation_result(); + public: + void unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result); + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* unsafe_arena_release_operation_result(); + // optional int64 duration_millis = 2; bool has_duration_millis() const; private: @@ -2936,6 +3532,7 @@ class ConnectionsLog_BandwidthUpgradeAttempt final : ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr connection_token_; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result_; int64_t duration_millis_; int direction_; int from_medium_; @@ -3011,7 +3608,7 @@ class ConnectionsLog_ErrorCode final : &_ConnectionsLog_ErrorCode_default_instance_); } static constexpr int kIndexInFileMessages = - 12; + 14; friend void swap(ConnectionsLog_ErrorCode& a, ConnectionsLog_ErrorCode& b) { a.Swap(&b); @@ -3488,7 +4085,7 @@ class ConnectionsLog_AdvertisingMetadata final : &_ConnectionsLog_AdvertisingMetadata_default_instance_); } static constexpr int kIndexInFileMessages = - 13; + 15; friend void swap(ConnectionsLog_AdvertisingMetadata& a, ConnectionsLog_AdvertisingMetadata& b) { a.Swap(&b); @@ -3559,6 +4156,9 @@ class ConnectionsLog_AdvertisingMetadata final : kSupportsExtendedBleAdvertisementsFieldNumber = 1, kSupportsNfcTechnologyFieldNumber = 3, kMultipleAdvertisementSupportedFieldNumber = 4, + kSupportsDualBandFieldNumber = 6, + kSupportsWifiAwareFieldNumber = 7, + kEndpointInfoSizeFieldNumber = 8, kPowerLevelFieldNumber = 5, }; // optional int32 connected_ap_frequency = 2; @@ -3613,6 +4213,45 @@ class ConnectionsLog_AdvertisingMetadata final : void _internal_set_multiple_advertisement_supported(bool value); public: + // optional bool supports_dual_band = 6; + bool has_supports_dual_band() const; + private: + bool _internal_has_supports_dual_band() const; + public: + void clear_supports_dual_band(); + bool supports_dual_band() const; + void set_supports_dual_band(bool value); + private: + bool _internal_supports_dual_band() const; + void _internal_set_supports_dual_band(bool value); + public: + + // optional bool supports_wifi_aware = 7; + bool has_supports_wifi_aware() const; + private: + bool _internal_has_supports_wifi_aware() const; + public: + void clear_supports_wifi_aware(); + bool supports_wifi_aware() const; + void set_supports_wifi_aware(bool value); + private: + bool _internal_supports_wifi_aware() const; + void _internal_set_supports_wifi_aware(bool value); + public: + + // optional int32 endpoint_info_size = 8; + bool has_endpoint_info_size() const; + private: + bool _internal_has_endpoint_info_size() const; + public: + void clear_endpoint_info_size(); + int32_t endpoint_info_size() const; + void set_endpoint_info_size(int32_t value); + private: + int32_t _internal_endpoint_info_size() const; + void _internal_set_endpoint_info_size(int32_t value); + public: + // optional .location.nearby.proto.connections.PowerLevel power_level = 5; bool has_power_level() const; private: @@ -3639,6 +4278,9 @@ class ConnectionsLog_AdvertisingMetadata final : bool supports_extended_ble_advertisements_; bool supports_nfc_technology_; bool multiple_advertisement_supported_; + bool supports_dual_band_; + bool supports_wifi_aware_; + int32_t endpoint_info_size_; int power_level_; friend struct ::TableStruct_internal_2fproto_2fanalytics_2fconnections_5flog_2eproto; }; @@ -3690,7 +4332,7 @@ class ConnectionsLog_DiscoveryMetadata final : &_ConnectionsLog_DiscoveryMetadata_default_instance_); } static constexpr int kIndexInFileMessages = - 14; + 16; friend void swap(ConnectionsLog_DiscoveryMetadata& a, ConnectionsLog_DiscoveryMetadata& b) { a.Swap(&b); @@ -3877,7 +4519,7 @@ class ConnectionsLog_ConnectionAttemptMetadata final : &_ConnectionsLog_ConnectionAttemptMetadata_default_instance_); } static constexpr int kIndexInFileMessages = - 15; + 17; friend void swap(ConnectionsLog_ConnectionAttemptMetadata& a, ConnectionsLog_ConnectionAttemptMetadata& b) { a.Swap(&b); @@ -4239,7 +4881,7 @@ class ConnectionsLog final : &_ConnectionsLog_default_instance_); } static constexpr int kIndexInFileMessages = - 16; + 18; friend void swap(ConnectionsLog& a, ConnectionsLog& b) { a.Swap(&b); @@ -4304,6 +4946,8 @@ class ConnectionsLog final : // nested types ---------------------------------------------------- typedef ConnectionsLog_ClientSession ClientSession; + typedef ConnectionsLog_OperationResult OperationResult; + typedef ConnectionsLog_OperationResultWithMedium OperationResultWithMedium; typedef ConnectionsLog_StrategySession StrategySession; typedef ConnectionsLog_DiscoveryPhase DiscoveryPhase; typedef ConnectionsLog_DiscoveredEndpoint DiscoveredEndpoint; @@ -4458,7 +5102,7 @@ class ConnectionsLog final : // optional int64 duration_millis = 1; inline bool ConnectionsLog_ClientSession::_internal_has_duration_millis() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; return value; } inline bool ConnectionsLog_ClientSession::has_duration_millis() const { @@ -4466,7 +5110,7 @@ inline bool ConnectionsLog_ClientSession::has_duration_millis() const { } inline void ConnectionsLog_ClientSession::clear_duration_millis() { duration_millis_ = int64_t{0}; - _has_bits_[0] &= ~0x00000001u; + _has_bits_[0] &= ~0x00000002u; } inline int64_t ConnectionsLog_ClientSession::_internal_duration_millis() const { return duration_millis_; @@ -4476,7 +5120,7 @@ inline int64_t ConnectionsLog_ClientSession::duration_millis() const { return _internal_duration_millis(); } inline void ConnectionsLog_ClientSession::_internal_set_duration_millis(int64_t value) { - _has_bits_[0] |= 0x00000001u; + _has_bits_[0] |= 0x00000002u; duration_millis_ = value; } inline void ConnectionsLog_ClientSession::set_duration_millis(int64_t value) { @@ -4524,6 +5168,313 @@ ConnectionsLog_ClientSession::strategy_session() const { return strategy_session_; } +// optional int64 client_flow_id = 3; +inline bool ConnectionsLog_ClientSession::_internal_has_client_flow_id() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ConnectionsLog_ClientSession::has_client_flow_id() const { + return _internal_has_client_flow_id(); +} +inline void ConnectionsLog_ClientSession::clear_client_flow_id() { + client_flow_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t ConnectionsLog_ClientSession::_internal_client_flow_id() const { + return client_flow_id_; +} +inline int64_t ConnectionsLog_ClientSession::client_flow_id() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.ClientSession.client_flow_id) + return _internal_client_flow_id(); +} +inline void ConnectionsLog_ClientSession::_internal_set_client_flow_id(int64_t value) { + _has_bits_[0] |= 0x00000004u; + client_flow_id_ = value; +} +inline void ConnectionsLog_ClientSession::set_client_flow_id(int64_t value) { + _internal_set_client_flow_id(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.ClientSession.client_flow_id) +} + +// optional string connection_token = 4; +inline bool ConnectionsLog_ClientSession::_internal_has_connection_token() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ConnectionsLog_ClientSession::has_connection_token() const { + return _internal_has_connection_token(); +} +inline void ConnectionsLog_ClientSession::clear_connection_token() { + connection_token_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ConnectionsLog_ClientSession::connection_token() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.ClientSession.connection_token) + return _internal_connection_token(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void ConnectionsLog_ClientSession::set_connection_token(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + connection_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.ClientSession.connection_token) +} +inline std::string* ConnectionsLog_ClientSession::mutable_connection_token() { + std::string* _s = _internal_mutable_connection_token(); + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.ClientSession.connection_token) + return _s; +} +inline const std::string& ConnectionsLog_ClientSession::_internal_connection_token() const { + return connection_token_.Get(); +} +inline void ConnectionsLog_ClientSession::_internal_set_connection_token(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + connection_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* ConnectionsLog_ClientSession::_internal_mutable_connection_token() { + _has_bits_[0] |= 0x00000001u; + return connection_token_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* ConnectionsLog_ClientSession::release_connection_token() { + // @@protoc_insertion_point(field_release:location.nearby.analytics.proto.ConnectionsLog.ClientSession.connection_token) + if (!_internal_has_connection_token()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = connection_token_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (connection_token_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + connection_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ConnectionsLog_ClientSession::set_allocated_connection_token(std::string* connection_token) { + if (connection_token != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + connection_token_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), connection_token, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (connection_token_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + connection_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.ClientSession.connection_token) +} + +// ------------------------------------------------------------------- + +// ConnectionsLog_OperationResult + +// optional .location.nearby.proto.connections.OperationResultCategory result_category = 1; +inline bool ConnectionsLog_OperationResult::_internal_has_result_category() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResult::has_result_category() const { + return _internal_has_result_category(); +} +inline void ConnectionsLog_OperationResult::clear_result_category() { + result_category_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::connections::OperationResultCategory ConnectionsLog_OperationResult::_internal_result_category() const { + return static_cast< ::location::nearby::proto::connections::OperationResultCategory >(result_category_); +} +inline ::location::nearby::proto::connections::OperationResultCategory ConnectionsLog_OperationResult::result_category() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResult.result_category) + return _internal_result_category(); +} +inline void ConnectionsLog_OperationResult::_internal_set_result_category(::location::nearby::proto::connections::OperationResultCategory value) { + assert(::location::nearby::proto::connections::OperationResultCategory_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + result_category_ = value; +} +inline void ConnectionsLog_OperationResult::set_result_category(::location::nearby::proto::connections::OperationResultCategory value) { + _internal_set_result_category(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResult.result_category) +} + +// optional .location.nearby.proto.connections.OperationResultCode result_code = 2; +inline bool ConnectionsLog_OperationResult::_internal_has_result_code() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResult::has_result_code() const { + return _internal_has_result_code(); +} +inline void ConnectionsLog_OperationResult::clear_result_code() { + result_code_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::connections::OperationResultCode ConnectionsLog_OperationResult::_internal_result_code() const { + return static_cast< ::location::nearby::proto::connections::OperationResultCode >(result_code_); +} +inline ::location::nearby::proto::connections::OperationResultCode ConnectionsLog_OperationResult::result_code() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResult.result_code) + return _internal_result_code(); +} +inline void ConnectionsLog_OperationResult::_internal_set_result_code(::location::nearby::proto::connections::OperationResultCode value) { + assert(::location::nearby::proto::connections::OperationResultCode_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + result_code_ = value; +} +inline void ConnectionsLog_OperationResult::set_result_code(::location::nearby::proto::connections::OperationResultCode value) { + _internal_set_result_code(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResult.result_code) +} + +// ------------------------------------------------------------------- + +// ConnectionsLog_OperationResultWithMedium + +// optional .location.nearby.proto.connections.Medium medium = 1; +inline bool ConnectionsLog_OperationResultWithMedium::_internal_has_medium() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResultWithMedium::has_medium() const { + return _internal_has_medium(); +} +inline void ConnectionsLog_OperationResultWithMedium::clear_medium() { + medium_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::connections::Medium ConnectionsLog_OperationResultWithMedium::_internal_medium() const { + return static_cast< ::location::nearby::proto::connections::Medium >(medium_); +} +inline ::location::nearby::proto::connections::Medium ConnectionsLog_OperationResultWithMedium::medium() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.medium) + return _internal_medium(); +} +inline void ConnectionsLog_OperationResultWithMedium::_internal_set_medium(::location::nearby::proto::connections::Medium value) { + assert(::location::nearby::proto::connections::Medium_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + medium_ = value; +} +inline void ConnectionsLog_OperationResultWithMedium::set_medium(::location::nearby::proto::connections::Medium value) { + _internal_set_medium(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.medium) +} + +// optional int32 update_index = 2; +inline bool ConnectionsLog_OperationResultWithMedium::_internal_has_update_index() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResultWithMedium::has_update_index() const { + return _internal_has_update_index(); +} +inline void ConnectionsLog_OperationResultWithMedium::clear_update_index() { + update_index_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline int32_t ConnectionsLog_OperationResultWithMedium::_internal_update_index() const { + return update_index_; +} +inline int32_t ConnectionsLog_OperationResultWithMedium::update_index() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.update_index) + return _internal_update_index(); +} +inline void ConnectionsLog_OperationResultWithMedium::_internal_set_update_index(int32_t value) { + _has_bits_[0] |= 0x00000002u; + update_index_ = value; +} +inline void ConnectionsLog_OperationResultWithMedium::set_update_index(int32_t value) { + _internal_set_update_index(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.update_index) +} + +// optional .location.nearby.proto.connections.OperationResultCategory result_category = 3; +inline bool ConnectionsLog_OperationResultWithMedium::_internal_has_result_category() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResultWithMedium::has_result_category() const { + return _internal_has_result_category(); +} +inline void ConnectionsLog_OperationResultWithMedium::clear_result_category() { + result_category_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::connections::OperationResultCategory ConnectionsLog_OperationResultWithMedium::_internal_result_category() const { + return static_cast< ::location::nearby::proto::connections::OperationResultCategory >(result_category_); +} +inline ::location::nearby::proto::connections::OperationResultCategory ConnectionsLog_OperationResultWithMedium::result_category() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.result_category) + return _internal_result_category(); +} +inline void ConnectionsLog_OperationResultWithMedium::_internal_set_result_category(::location::nearby::proto::connections::OperationResultCategory value) { + assert(::location::nearby::proto::connections::OperationResultCategory_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + result_category_ = value; +} +inline void ConnectionsLog_OperationResultWithMedium::set_result_category(::location::nearby::proto::connections::OperationResultCategory value) { + _internal_set_result_category(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.result_category) +} + +// optional .location.nearby.proto.connections.OperationResultCode result_code = 4; +inline bool ConnectionsLog_OperationResultWithMedium::_internal_has_result_code() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResultWithMedium::has_result_code() const { + return _internal_has_result_code(); +} +inline void ConnectionsLog_OperationResultWithMedium::clear_result_code() { + result_code_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::connections::OperationResultCode ConnectionsLog_OperationResultWithMedium::_internal_result_code() const { + return static_cast< ::location::nearby::proto::connections::OperationResultCode >(result_code_); +} +inline ::location::nearby::proto::connections::OperationResultCode ConnectionsLog_OperationResultWithMedium::result_code() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.result_code) + return _internal_result_code(); +} +inline void ConnectionsLog_OperationResultWithMedium::_internal_set_result_code(::location::nearby::proto::connections::OperationResultCode value) { + assert(::location::nearby::proto::connections::OperationResultCode_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + result_code_ = value; +} +inline void ConnectionsLog_OperationResultWithMedium::set_result_code(::location::nearby::proto::connections::OperationResultCode value) { + _internal_set_result_code(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.result_code) +} + +// optional .location.nearby.proto.connections.ConnectionMode connection_mode = 5; +inline bool ConnectionsLog_OperationResultWithMedium::_internal_has_connection_mode() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ConnectionsLog_OperationResultWithMedium::has_connection_mode() const { + return _internal_has_connection_mode(); +} +inline void ConnectionsLog_OperationResultWithMedium::clear_connection_mode() { + connection_mode_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::location::nearby::proto::connections::ConnectionMode ConnectionsLog_OperationResultWithMedium::_internal_connection_mode() const { + return static_cast< ::location::nearby::proto::connections::ConnectionMode >(connection_mode_); +} +inline ::location::nearby::proto::connections::ConnectionMode ConnectionsLog_OperationResultWithMedium::connection_mode() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.connection_mode) + return _internal_connection_mode(); +} +inline void ConnectionsLog_OperationResultWithMedium::_internal_set_connection_mode(::location::nearby::proto::connections::ConnectionMode value) { + assert(::location::nearby::proto::connections::ConnectionMode_IsValid(value)); + _has_bits_[0] |= 0x00000010u; + connection_mode_ = value; +} +inline void ConnectionsLog_OperationResultWithMedium::set_connection_mode(::location::nearby::proto::connections::ConnectionMode value) { + _internal_set_connection_mode(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium.connection_mode) +} + // ------------------------------------------------------------------- // ConnectionsLog_StrategySession @@ -5214,6 +6165,75 @@ inline void ConnectionsLog_DiscoveryPhase::set_allocated_discovery_metadata(::lo // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.discovery_metadata) } +// repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 8; +inline int ConnectionsLog_DiscoveryPhase::_internal_adv_dis_result_size() const { + return adv_dis_result_.size(); +} +inline int ConnectionsLog_DiscoveryPhase::adv_dis_result_size() const { + return _internal_adv_dis_result_size(); +} +inline void ConnectionsLog_DiscoveryPhase::clear_adv_dis_result() { + adv_dis_result_.Clear(); +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* ConnectionsLog_DiscoveryPhase::mutable_adv_dis_result(int index) { + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.adv_dis_result) + return adv_dis_result_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >* +ConnectionsLog_DiscoveryPhase::mutable_adv_dis_result() { + // @@protoc_insertion_point(field_mutable_list:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.adv_dis_result) + return &adv_dis_result_; +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& ConnectionsLog_DiscoveryPhase::_internal_adv_dis_result(int index) const { + return adv_dis_result_.Get(index); +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& ConnectionsLog_DiscoveryPhase::adv_dis_result(int index) const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.adv_dis_result) + return _internal_adv_dis_result(index); +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* ConnectionsLog_DiscoveryPhase::_internal_add_adv_dis_result() { + return adv_dis_result_.Add(); +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* ConnectionsLog_DiscoveryPhase::add_adv_dis_result() { + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* _add = _internal_add_adv_dis_result(); + // @@protoc_insertion_point(field_add:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.adv_dis_result) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >& +ConnectionsLog_DiscoveryPhase::adv_dis_result() const { + // @@protoc_insertion_point(field_list:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.adv_dis_result) + return adv_dis_result_; +} + +// optional .location.nearby.proto.connections.StopDiscoveringReason stop_reason = 9; +inline bool ConnectionsLog_DiscoveryPhase::_internal_has_stop_reason() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ConnectionsLog_DiscoveryPhase::has_stop_reason() const { + return _internal_has_stop_reason(); +} +inline void ConnectionsLog_DiscoveryPhase::clear_stop_reason() { + stop_reason_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::connections::StopDiscoveringReason ConnectionsLog_DiscoveryPhase::_internal_stop_reason() const { + return static_cast< ::location::nearby::proto::connections::StopDiscoveringReason >(stop_reason_); +} +inline ::location::nearby::proto::connections::StopDiscoveringReason ConnectionsLog_DiscoveryPhase::stop_reason() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.stop_reason) + return _internal_stop_reason(); +} +inline void ConnectionsLog_DiscoveryPhase::_internal_set_stop_reason(::location::nearby::proto::connections::StopDiscoveringReason value) { + assert(::location::nearby::proto::connections::StopDiscoveringReason_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + stop_reason_ = value; +} +inline void ConnectionsLog_DiscoveryPhase::set_stop_reason(::location::nearby::proto::connections::StopDiscoveringReason value) { + _internal_set_stop_reason(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.DiscoveryPhase.stop_reason) +} + // ------------------------------------------------------------------- // ConnectionsLog_DiscoveredEndpoint @@ -5922,6 +6942,75 @@ inline void ConnectionsLog_AdvertisingPhase::set_allocated_advertising_metadata( // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.advertising_metadata) } +// repeated .location.nearby.analytics.proto.ConnectionsLog.OperationResultWithMedium adv_dis_result = 6; +inline int ConnectionsLog_AdvertisingPhase::_internal_adv_dis_result_size() const { + return adv_dis_result_.size(); +} +inline int ConnectionsLog_AdvertisingPhase::adv_dis_result_size() const { + return _internal_adv_dis_result_size(); +} +inline void ConnectionsLog_AdvertisingPhase::clear_adv_dis_result() { + adv_dis_result_.Clear(); +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* ConnectionsLog_AdvertisingPhase::mutable_adv_dis_result(int index) { + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.adv_dis_result) + return adv_dis_result_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >* +ConnectionsLog_AdvertisingPhase::mutable_adv_dis_result() { + // @@protoc_insertion_point(field_mutable_list:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.adv_dis_result) + return &adv_dis_result_; +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& ConnectionsLog_AdvertisingPhase::_internal_adv_dis_result(int index) const { + return adv_dis_result_.Get(index); +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium& ConnectionsLog_AdvertisingPhase::adv_dis_result(int index) const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.adv_dis_result) + return _internal_adv_dis_result(index); +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* ConnectionsLog_AdvertisingPhase::_internal_add_adv_dis_result() { + return adv_dis_result_.Add(); +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* ConnectionsLog_AdvertisingPhase::add_adv_dis_result() { + ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium* _add = _internal_add_adv_dis_result(); + // @@protoc_insertion_point(field_add:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.adv_dis_result) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::location::nearby::analytics::proto::ConnectionsLog_OperationResultWithMedium >& +ConnectionsLog_AdvertisingPhase::adv_dis_result() const { + // @@protoc_insertion_point(field_list:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.adv_dis_result) + return adv_dis_result_; +} + +// optional .location.nearby.proto.connections.StopAdvertisingReason stop_reason = 7; +inline bool ConnectionsLog_AdvertisingPhase::_internal_has_stop_reason() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool ConnectionsLog_AdvertisingPhase::has_stop_reason() const { + return _internal_has_stop_reason(); +} +inline void ConnectionsLog_AdvertisingPhase::clear_stop_reason() { + stop_reason_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::connections::StopAdvertisingReason ConnectionsLog_AdvertisingPhase::_internal_stop_reason() const { + return static_cast< ::location::nearby::proto::connections::StopAdvertisingReason >(stop_reason_); +} +inline ::location::nearby::proto::connections::StopAdvertisingReason ConnectionsLog_AdvertisingPhase::stop_reason() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.stop_reason) + return _internal_stop_reason(); +} +inline void ConnectionsLog_AdvertisingPhase::_internal_set_stop_reason(::location::nearby::proto::connections::StopAdvertisingReason value) { + assert(::location::nearby::proto::connections::StopAdvertisingReason_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + stop_reason_ = value; +} +inline void ConnectionsLog_AdvertisingPhase::set_stop_reason(::location::nearby::proto::connections::StopAdvertisingReason value) { + _internal_set_stop_reason(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.AdvertisingPhase.stop_reason) +} + // ------------------------------------------------------------------- // ConnectionsLog_ConnectionRequest @@ -6074,7 +7163,7 @@ inline void ConnectionsLog_ConnectionRequest::set_client_flow_id(int64_t value) // optional int64 duration_millis = 1; inline bool ConnectionsLog_ConnectionAttempt::_internal_has_duration_millis() const { - bool value = (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; return value; } inline bool ConnectionsLog_ConnectionAttempt::has_duration_millis() const { @@ -6082,7 +7171,7 @@ inline bool ConnectionsLog_ConnectionAttempt::has_duration_millis() const { } inline void ConnectionsLog_ConnectionAttempt::clear_duration_millis() { duration_millis_ = int64_t{0}; - _has_bits_[0] &= ~0x00000004u; + _has_bits_[0] &= ~0x00000008u; } inline int64_t ConnectionsLog_ConnectionAttempt::_internal_duration_millis() const { return duration_millis_; @@ -6092,7 +7181,7 @@ inline int64_t ConnectionsLog_ConnectionAttempt::duration_millis() const { return _internal_duration_millis(); } inline void ConnectionsLog_ConnectionAttempt::_internal_set_duration_millis(int64_t value) { - _has_bits_[0] |= 0x00000004u; + _has_bits_[0] |= 0x00000008u; duration_millis_ = value; } inline void ConnectionsLog_ConnectionAttempt::set_duration_millis(int64_t value) { @@ -6102,7 +7191,7 @@ inline void ConnectionsLog_ConnectionAttempt::set_duration_millis(int64_t value) // optional .location.nearby.proto.connections.ConnectionAttemptType type = 2; inline bool ConnectionsLog_ConnectionAttempt::_internal_has_type() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; return value; } inline bool ConnectionsLog_ConnectionAttempt::has_type() const { @@ -6110,7 +7199,7 @@ inline bool ConnectionsLog_ConnectionAttempt::has_type() const { } inline void ConnectionsLog_ConnectionAttempt::clear_type() { type_ = 0; - _has_bits_[0] &= ~0x00000008u; + _has_bits_[0] &= ~0x00000010u; } inline ::location::nearby::proto::connections::ConnectionAttemptType ConnectionsLog_ConnectionAttempt::_internal_type() const { return static_cast< ::location::nearby::proto::connections::ConnectionAttemptType >(type_); @@ -6121,7 +7210,7 @@ inline ::location::nearby::proto::connections::ConnectionAttemptType Connections } inline void ConnectionsLog_ConnectionAttempt::_internal_set_type(::location::nearby::proto::connections::ConnectionAttemptType value) { assert(::location::nearby::proto::connections::ConnectionAttemptType_IsValid(value)); - _has_bits_[0] |= 0x00000008u; + _has_bits_[0] |= 0x00000010u; type_ = value; } inline void ConnectionsLog_ConnectionAttempt::set_type(::location::nearby::proto::connections::ConnectionAttemptType value) { @@ -6131,7 +7220,7 @@ inline void ConnectionsLog_ConnectionAttempt::set_type(::location::nearby::proto // optional .location.nearby.proto.connections.ConnectionAttemptDirection direction = 3; inline bool ConnectionsLog_ConnectionAttempt::_internal_has_direction() const { - bool value = (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; return value; } inline bool ConnectionsLog_ConnectionAttempt::has_direction() const { @@ -6139,7 +7228,7 @@ inline bool ConnectionsLog_ConnectionAttempt::has_direction() const { } inline void ConnectionsLog_ConnectionAttempt::clear_direction() { direction_ = 0; - _has_bits_[0] &= ~0x00000010u; + _has_bits_[0] &= ~0x00000020u; } inline ::location::nearby::proto::connections::ConnectionAttemptDirection ConnectionsLog_ConnectionAttempt::_internal_direction() const { return static_cast< ::location::nearby::proto::connections::ConnectionAttemptDirection >(direction_); @@ -6150,7 +7239,7 @@ inline ::location::nearby::proto::connections::ConnectionAttemptDirection Connec } inline void ConnectionsLog_ConnectionAttempt::_internal_set_direction(::location::nearby::proto::connections::ConnectionAttemptDirection value) { assert(::location::nearby::proto::connections::ConnectionAttemptDirection_IsValid(value)); - _has_bits_[0] |= 0x00000010u; + _has_bits_[0] |= 0x00000020u; direction_ = value; } inline void ConnectionsLog_ConnectionAttempt::set_direction(::location::nearby::proto::connections::ConnectionAttemptDirection value) { @@ -6160,7 +7249,7 @@ inline void ConnectionsLog_ConnectionAttempt::set_direction(::location::nearby:: // optional .location.nearby.proto.connections.Medium medium = 4; inline bool ConnectionsLog_ConnectionAttempt::_internal_has_medium() const { - bool value = (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000040u) != 0; return value; } inline bool ConnectionsLog_ConnectionAttempt::has_medium() const { @@ -6168,7 +7257,7 @@ inline bool ConnectionsLog_ConnectionAttempt::has_medium() const { } inline void ConnectionsLog_ConnectionAttempt::clear_medium() { medium_ = 0; - _has_bits_[0] &= ~0x00000020u; + _has_bits_[0] &= ~0x00000040u; } inline ::location::nearby::proto::connections::Medium ConnectionsLog_ConnectionAttempt::_internal_medium() const { return static_cast< ::location::nearby::proto::connections::Medium >(medium_); @@ -6179,7 +7268,7 @@ inline ::location::nearby::proto::connections::Medium ConnectionsLog_ConnectionA } inline void ConnectionsLog_ConnectionAttempt::_internal_set_medium(::location::nearby::proto::connections::Medium value) { assert(::location::nearby::proto::connections::Medium_IsValid(value)); - _has_bits_[0] |= 0x00000020u; + _has_bits_[0] |= 0x00000040u; medium_ = value; } inline void ConnectionsLog_ConnectionAttempt::set_medium(::location::nearby::proto::connections::Medium value) { @@ -6189,7 +7278,7 @@ inline void ConnectionsLog_ConnectionAttempt::set_medium(::location::nearby::pro // optional .location.nearby.proto.connections.ConnectionAttemptResult attempt_result = 5; inline bool ConnectionsLog_ConnectionAttempt::_internal_has_attempt_result() const { - bool value = (_has_bits_[0] & 0x00000040u) != 0; + bool value = (_has_bits_[0] & 0x00000080u) != 0; return value; } inline bool ConnectionsLog_ConnectionAttempt::has_attempt_result() const { @@ -6197,7 +7286,7 @@ inline bool ConnectionsLog_ConnectionAttempt::has_attempt_result() const { } inline void ConnectionsLog_ConnectionAttempt::clear_attempt_result() { attempt_result_ = 0; - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000080u; } inline ::location::nearby::proto::connections::ConnectionAttemptResult ConnectionsLog_ConnectionAttempt::_internal_attempt_result() const { return static_cast< ::location::nearby::proto::connections::ConnectionAttemptResult >(attempt_result_); @@ -6208,7 +7297,7 @@ inline ::location::nearby::proto::connections::ConnectionAttemptResult Connectio } inline void ConnectionsLog_ConnectionAttempt::_internal_set_attempt_result(::location::nearby::proto::connections::ConnectionAttemptResult value) { assert(::location::nearby::proto::connections::ConnectionAttemptResult_IsValid(value)); - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000080u; attempt_result_ = value; } inline void ConnectionsLog_ConnectionAttempt::set_attempt_result(::location::nearby::proto::connections::ConnectionAttemptResult value) { @@ -6218,7 +7307,7 @@ inline void ConnectionsLog_ConnectionAttempt::set_attempt_result(::location::nea // optional int64 client_flow_id = 6; inline bool ConnectionsLog_ConnectionAttempt::_internal_has_client_flow_id() const { - bool value = (_has_bits_[0] & 0x00000080u) != 0; + bool value = (_has_bits_[0] & 0x00000100u) != 0; return value; } inline bool ConnectionsLog_ConnectionAttempt::has_client_flow_id() const { @@ -6226,7 +7315,7 @@ inline bool ConnectionsLog_ConnectionAttempt::has_client_flow_id() const { } inline void ConnectionsLog_ConnectionAttempt::clear_client_flow_id() { client_flow_id_ = int64_t{0}; - _has_bits_[0] &= ~0x00000080u; + _has_bits_[0] &= ~0x00000100u; } inline int64_t ConnectionsLog_ConnectionAttempt::_internal_client_flow_id() const { return client_flow_id_; @@ -6236,7 +7325,7 @@ inline int64_t ConnectionsLog_ConnectionAttempt::client_flow_id() const { return _internal_client_flow_id(); } inline void ConnectionsLog_ConnectionAttempt::_internal_set_client_flow_id(int64_t value) { - _has_bits_[0] |= 0x00000080u; + _has_bits_[0] |= 0x00000100u; client_flow_id_ = value; } inline void ConnectionsLog_ConnectionAttempt::set_client_flow_id(int64_t value) { @@ -6403,13 +7492,132 @@ inline void ConnectionsLog_ConnectionAttempt::set_allocated_connection_attempt_m // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.connection_attempt_metadata) } +// optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; +inline bool ConnectionsLog_ConnectionAttempt::_internal_has_operation_result() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || operation_result_ != nullptr); + return value; +} +inline bool ConnectionsLog_ConnectionAttempt::has_operation_result() const { + return _internal_has_operation_result(); +} +inline void ConnectionsLog_ConnectionAttempt::clear_operation_result() { + if (operation_result_ != nullptr) operation_result_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_ConnectionAttempt::_internal_operation_result() const { + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* p = operation_result_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::analytics::proto::_ConnectionsLog_OperationResult_default_instance_); +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_ConnectionAttempt::operation_result() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.operation_result) + return _internal_operation_result(); +} +inline void ConnectionsLog_ConnectionAttempt::unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(operation_result_); + } + operation_result_ = operation_result; + if (operation_result) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.operation_result) +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_ConnectionAttempt::release_operation_result() { + _has_bits_[0] &= ~0x00000004u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_ConnectionAttempt::unsafe_arena_release_operation_result() { + // @@protoc_insertion_point(field_release:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.operation_result) + _has_bits_[0] &= ~0x00000004u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_ConnectionAttempt::_internal_mutable_operation_result() { + _has_bits_[0] |= 0x00000004u; + if (operation_result_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>(GetArenaForAllocation()); + operation_result_ = p; + } + return operation_result_; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_ConnectionAttempt::mutable_operation_result() { + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _msg = _internal_mutable_operation_result(); + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.operation_result) + return _msg; +} +inline void ConnectionsLog_ConnectionAttempt::set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete operation_result_; + } + if (operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>::GetOwningArena(operation_result); + if (message_arena != submessage_arena) { + operation_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, operation_result, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + operation_result_ = operation_result; + // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.operation_result) +} + +// optional .location.nearby.proto.connections.ConnectionMode connection_mode = 10; +inline bool ConnectionsLog_ConnectionAttempt::_internal_has_connection_mode() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool ConnectionsLog_ConnectionAttempt::has_connection_mode() const { + return _internal_has_connection_mode(); +} +inline void ConnectionsLog_ConnectionAttempt::clear_connection_mode() { + connection_mode_ = 0; + _has_bits_[0] &= ~0x00000200u; +} +inline ::location::nearby::proto::connections::ConnectionMode ConnectionsLog_ConnectionAttempt::_internal_connection_mode() const { + return static_cast< ::location::nearby::proto::connections::ConnectionMode >(connection_mode_); +} +inline ::location::nearby::proto::connections::ConnectionMode ConnectionsLog_ConnectionAttempt::connection_mode() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.connection_mode) + return _internal_connection_mode(); +} +inline void ConnectionsLog_ConnectionAttempt::_internal_set_connection_mode(::location::nearby::proto::connections::ConnectionMode value) { + assert(::location::nearby::proto::connections::ConnectionMode_IsValid(value)); + _has_bits_[0] |= 0x00000200u; + connection_mode_ = value; +} +inline void ConnectionsLog_ConnectionAttempt::set_connection_mode(::location::nearby::proto::connections::ConnectionMode value) { + _internal_set_connection_mode(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.ConnectionAttempt.connection_mode) +} + // ------------------------------------------------------------------- // ConnectionsLog_EstablishedConnection // optional int64 duration_millis = 1; inline bool ConnectionsLog_EstablishedConnection::_internal_has_duration_millis() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; return value; } inline bool ConnectionsLog_EstablishedConnection::has_duration_millis() const { @@ -6417,7 +7625,7 @@ inline bool ConnectionsLog_EstablishedConnection::has_duration_millis() const { } inline void ConnectionsLog_EstablishedConnection::clear_duration_millis() { duration_millis_ = int64_t{0}; - _has_bits_[0] &= ~0x00000002u; + _has_bits_[0] &= ~0x00000004u; } inline int64_t ConnectionsLog_EstablishedConnection::_internal_duration_millis() const { return duration_millis_; @@ -6427,7 +7635,7 @@ inline int64_t ConnectionsLog_EstablishedConnection::duration_millis() const { return _internal_duration_millis(); } inline void ConnectionsLog_EstablishedConnection::_internal_set_duration_millis(int64_t value) { - _has_bits_[0] |= 0x00000002u; + _has_bits_[0] |= 0x00000004u; duration_millis_ = value; } inline void ConnectionsLog_EstablishedConnection::set_duration_millis(int64_t value) { @@ -6437,7 +7645,7 @@ inline void ConnectionsLog_EstablishedConnection::set_duration_millis(int64_t va // optional .location.nearby.proto.connections.Medium medium = 2; inline bool ConnectionsLog_EstablishedConnection::_internal_has_medium() const { - bool value = (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; return value; } inline bool ConnectionsLog_EstablishedConnection::has_medium() const { @@ -6445,7 +7653,7 @@ inline bool ConnectionsLog_EstablishedConnection::has_medium() const { } inline void ConnectionsLog_EstablishedConnection::clear_medium() { medium_ = 0; - _has_bits_[0] &= ~0x00000004u; + _has_bits_[0] &= ~0x00000008u; } inline ::location::nearby::proto::connections::Medium ConnectionsLog_EstablishedConnection::_internal_medium() const { return static_cast< ::location::nearby::proto::connections::Medium >(medium_); @@ -6456,7 +7664,7 @@ inline ::location::nearby::proto::connections::Medium ConnectionsLog_Established } inline void ConnectionsLog_EstablishedConnection::_internal_set_medium(::location::nearby::proto::connections::Medium value) { assert(::location::nearby::proto::connections::Medium_IsValid(value)); - _has_bits_[0] |= 0x00000004u; + _has_bits_[0] |= 0x00000008u; medium_ = value; } inline void ConnectionsLog_EstablishedConnection::set_medium(::location::nearby::proto::connections::Medium value) { @@ -6546,7 +7754,7 @@ ConnectionsLog_EstablishedConnection::received_payload() const { // optional .location.nearby.proto.connections.DisconnectionReason disconnection_reason = 5; inline bool ConnectionsLog_EstablishedConnection::_internal_has_disconnection_reason() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; return value; } inline bool ConnectionsLog_EstablishedConnection::has_disconnection_reason() const { @@ -6554,7 +7762,7 @@ inline bool ConnectionsLog_EstablishedConnection::has_disconnection_reason() con } inline void ConnectionsLog_EstablishedConnection::clear_disconnection_reason() { disconnection_reason_ = 0; - _has_bits_[0] &= ~0x00000008u; + _has_bits_[0] &= ~0x00000010u; } inline ::location::nearby::proto::connections::DisconnectionReason ConnectionsLog_EstablishedConnection::_internal_disconnection_reason() const { return static_cast< ::location::nearby::proto::connections::DisconnectionReason >(disconnection_reason_); @@ -6565,7 +7773,7 @@ inline ::location::nearby::proto::connections::DisconnectionReason ConnectionsLo } inline void ConnectionsLog_EstablishedConnection::_internal_set_disconnection_reason(::location::nearby::proto::connections::DisconnectionReason value) { assert(::location::nearby::proto::connections::DisconnectionReason_IsValid(value)); - _has_bits_[0] |= 0x00000008u; + _has_bits_[0] |= 0x00000010u; disconnection_reason_ = value; } inline void ConnectionsLog_EstablishedConnection::set_disconnection_reason(::location::nearby::proto::connections::DisconnectionReason value) { @@ -6575,7 +7783,7 @@ inline void ConnectionsLog_EstablishedConnection::set_disconnection_reason(::loc // optional int64 client_flow_id = 6; inline bool ConnectionsLog_EstablishedConnection::_internal_has_client_flow_id() const { - bool value = (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; return value; } inline bool ConnectionsLog_EstablishedConnection::has_client_flow_id() const { @@ -6583,7 +7791,7 @@ inline bool ConnectionsLog_EstablishedConnection::has_client_flow_id() const { } inline void ConnectionsLog_EstablishedConnection::clear_client_flow_id() { client_flow_id_ = int64_t{0}; - _has_bits_[0] &= ~0x00000010u; + _has_bits_[0] &= ~0x00000020u; } inline int64_t ConnectionsLog_EstablishedConnection::_internal_client_flow_id() const { return client_flow_id_; @@ -6593,7 +7801,7 @@ inline int64_t ConnectionsLog_EstablishedConnection::client_flow_id() const { return _internal_client_flow_id(); } inline void ConnectionsLog_EstablishedConnection::_internal_set_client_flow_id(int64_t value) { - _has_bits_[0] |= 0x00000010u; + _has_bits_[0] |= 0x00000020u; client_flow_id_ = value; } inline void ConnectionsLog_EstablishedConnection::set_client_flow_id(int64_t value) { @@ -6672,7 +7880,7 @@ inline void ConnectionsLog_EstablishedConnection::set_allocated_connection_token // optional .location.nearby.proto.connections.ConnectionAttemptType type = 8; inline bool ConnectionsLog_EstablishedConnection::_internal_has_type() const { - bool value = (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000040u) != 0; return value; } inline bool ConnectionsLog_EstablishedConnection::has_type() const { @@ -6680,7 +7888,7 @@ inline bool ConnectionsLog_EstablishedConnection::has_type() const { } inline void ConnectionsLog_EstablishedConnection::clear_type() { type_ = 0; - _has_bits_[0] &= ~0x00000020u; + _has_bits_[0] &= ~0x00000040u; } inline ::location::nearby::proto::connections::ConnectionAttemptType ConnectionsLog_EstablishedConnection::_internal_type() const { return static_cast< ::location::nearby::proto::connections::ConnectionAttemptType >(type_); @@ -6691,7 +7899,7 @@ inline ::location::nearby::proto::connections::ConnectionAttemptType Connections } inline void ConnectionsLog_EstablishedConnection::_internal_set_type(::location::nearby::proto::connections::ConnectionAttemptType value) { assert(::location::nearby::proto::connections::ConnectionAttemptType_IsValid(value)); - _has_bits_[0] |= 0x00000020u; + _has_bits_[0] |= 0x00000040u; type_ = value; } inline void ConnectionsLog_EstablishedConnection::set_type(::location::nearby::proto::connections::ConnectionAttemptType value) { @@ -6701,7 +7909,7 @@ inline void ConnectionsLog_EstablishedConnection::set_type(::location::nearby::p // optional .location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.SafeDisconnectionResult safe_disconnection_result = 9; inline bool ConnectionsLog_EstablishedConnection::_internal_has_safe_disconnection_result() const { - bool value = (_has_bits_[0] & 0x00000040u) != 0; + bool value = (_has_bits_[0] & 0x00000080u) != 0; return value; } inline bool ConnectionsLog_EstablishedConnection::has_safe_disconnection_result() const { @@ -6709,7 +7917,7 @@ inline bool ConnectionsLog_EstablishedConnection::has_safe_disconnection_result( } inline void ConnectionsLog_EstablishedConnection::clear_safe_disconnection_result() { safe_disconnection_result_ = 0; - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000080u; } inline ::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection_SafeDisconnectionResult ConnectionsLog_EstablishedConnection::_internal_safe_disconnection_result() const { return static_cast< ::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection_SafeDisconnectionResult >(safe_disconnection_result_); @@ -6720,7 +7928,7 @@ inline ::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnectio } inline void ConnectionsLog_EstablishedConnection::_internal_set_safe_disconnection_result(::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection_SafeDisconnectionResult value) { assert(::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection_SafeDisconnectionResult_IsValid(value)); - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000080u; safe_disconnection_result_ = value; } inline void ConnectionsLog_EstablishedConnection::set_safe_disconnection_result(::location::nearby::analytics::proto::ConnectionsLog_EstablishedConnection_SafeDisconnectionResult value) { @@ -6728,13 +7936,103 @@ inline void ConnectionsLog_EstablishedConnection::set_safe_disconnection_result( // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.safe_disconnection_result) } +// optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 10; +inline bool ConnectionsLog_EstablishedConnection::_internal_has_operation_result() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || operation_result_ != nullptr); + return value; +} +inline bool ConnectionsLog_EstablishedConnection::has_operation_result() const { + return _internal_has_operation_result(); +} +inline void ConnectionsLog_EstablishedConnection::clear_operation_result() { + if (operation_result_ != nullptr) operation_result_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_EstablishedConnection::_internal_operation_result() const { + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* p = operation_result_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::analytics::proto::_ConnectionsLog_OperationResult_default_instance_); +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_EstablishedConnection::operation_result() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.operation_result) + return _internal_operation_result(); +} +inline void ConnectionsLog_EstablishedConnection::unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(operation_result_); + } + operation_result_ = operation_result; + if (operation_result) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.operation_result) +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_EstablishedConnection::release_operation_result() { + _has_bits_[0] &= ~0x00000002u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_EstablishedConnection::unsafe_arena_release_operation_result() { + // @@protoc_insertion_point(field_release:location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.operation_result) + _has_bits_[0] &= ~0x00000002u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_EstablishedConnection::_internal_mutable_operation_result() { + _has_bits_[0] |= 0x00000002u; + if (operation_result_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>(GetArenaForAllocation()); + operation_result_ = p; + } + return operation_result_; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_EstablishedConnection::mutable_operation_result() { + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _msg = _internal_mutable_operation_result(); + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.operation_result) + return _msg; +} +inline void ConnectionsLog_EstablishedConnection::set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete operation_result_; + } + if (operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>::GetOwningArena(operation_result); + if (message_arena != submessage_arena) { + operation_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, operation_result, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + operation_result_ = operation_result; + // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.EstablishedConnection.operation_result) +} + // ------------------------------------------------------------------- // ConnectionsLog_Payload // optional int64 duration_millis = 1; inline bool ConnectionsLog_Payload::_internal_has_duration_millis() const { - bool value = (_has_bits_[0] & 0x00000001u) != 0; + bool value = (_has_bits_[0] & 0x00000002u) != 0; return value; } inline bool ConnectionsLog_Payload::has_duration_millis() const { @@ -6742,7 +8040,7 @@ inline bool ConnectionsLog_Payload::has_duration_millis() const { } inline void ConnectionsLog_Payload::clear_duration_millis() { duration_millis_ = int64_t{0}; - _has_bits_[0] &= ~0x00000001u; + _has_bits_[0] &= ~0x00000002u; } inline int64_t ConnectionsLog_Payload::_internal_duration_millis() const { return duration_millis_; @@ -6752,7 +8050,7 @@ inline int64_t ConnectionsLog_Payload::duration_millis() const { return _internal_duration_millis(); } inline void ConnectionsLog_Payload::_internal_set_duration_millis(int64_t value) { - _has_bits_[0] |= 0x00000001u; + _has_bits_[0] |= 0x00000002u; duration_millis_ = value; } inline void ConnectionsLog_Payload::set_duration_millis(int64_t value) { @@ -6762,7 +8060,7 @@ inline void ConnectionsLog_Payload::set_duration_millis(int64_t value) { // optional .location.nearby.proto.connections.PayloadType type = 2; inline bool ConnectionsLog_Payload::_internal_has_type() const { - bool value = (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; return value; } inline bool ConnectionsLog_Payload::has_type() const { @@ -6770,7 +8068,7 @@ inline bool ConnectionsLog_Payload::has_type() const { } inline void ConnectionsLog_Payload::clear_type() { type_ = 0; - _has_bits_[0] &= ~0x00000004u; + _has_bits_[0] &= ~0x00000008u; } inline ::location::nearby::proto::connections::PayloadType ConnectionsLog_Payload::_internal_type() const { return static_cast< ::location::nearby::proto::connections::PayloadType >(type_); @@ -6781,7 +8079,7 @@ inline ::location::nearby::proto::connections::PayloadType ConnectionsLog_Payloa } inline void ConnectionsLog_Payload::_internal_set_type(::location::nearby::proto::connections::PayloadType value) { assert(::location::nearby::proto::connections::PayloadType_IsValid(value)); - _has_bits_[0] |= 0x00000004u; + _has_bits_[0] |= 0x00000008u; type_ = value; } inline void ConnectionsLog_Payload::set_type(::location::nearby::proto::connections::PayloadType value) { @@ -6791,7 +8089,7 @@ inline void ConnectionsLog_Payload::set_type(::location::nearby::proto::connecti // optional int64 total_size_bytes = 3; inline bool ConnectionsLog_Payload::_internal_has_total_size_bytes() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; return value; } inline bool ConnectionsLog_Payload::has_total_size_bytes() const { @@ -6799,7 +8097,7 @@ inline bool ConnectionsLog_Payload::has_total_size_bytes() const { } inline void ConnectionsLog_Payload::clear_total_size_bytes() { total_size_bytes_ = int64_t{0}; - _has_bits_[0] &= ~0x00000002u; + _has_bits_[0] &= ~0x00000004u; } inline int64_t ConnectionsLog_Payload::_internal_total_size_bytes() const { return total_size_bytes_; @@ -6809,7 +8107,7 @@ inline int64_t ConnectionsLog_Payload::total_size_bytes() const { return _internal_total_size_bytes(); } inline void ConnectionsLog_Payload::_internal_set_total_size_bytes(int64_t value) { - _has_bits_[0] |= 0x00000002u; + _has_bits_[0] |= 0x00000004u; total_size_bytes_ = value; } inline void ConnectionsLog_Payload::set_total_size_bytes(int64_t value) { @@ -6819,7 +8117,7 @@ inline void ConnectionsLog_Payload::set_total_size_bytes(int64_t value) { // optional int64 num_bytes_transferred = 4; inline bool ConnectionsLog_Payload::_internal_has_num_bytes_transferred() const { - bool value = (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; return value; } inline bool ConnectionsLog_Payload::has_num_bytes_transferred() const { @@ -6827,7 +8125,7 @@ inline bool ConnectionsLog_Payload::has_num_bytes_transferred() const { } inline void ConnectionsLog_Payload::clear_num_bytes_transferred() { num_bytes_transferred_ = int64_t{0}; - _has_bits_[0] &= ~0x00000010u; + _has_bits_[0] &= ~0x00000020u; } inline int64_t ConnectionsLog_Payload::_internal_num_bytes_transferred() const { return num_bytes_transferred_; @@ -6837,7 +8135,7 @@ inline int64_t ConnectionsLog_Payload::num_bytes_transferred() const { return _internal_num_bytes_transferred(); } inline void ConnectionsLog_Payload::_internal_set_num_bytes_transferred(int64_t value) { - _has_bits_[0] |= 0x00000010u; + _has_bits_[0] |= 0x00000020u; num_bytes_transferred_ = value; } inline void ConnectionsLog_Payload::set_num_bytes_transferred(int64_t value) { @@ -6847,7 +8145,7 @@ inline void ConnectionsLog_Payload::set_num_bytes_transferred(int64_t value) { // optional int32 num_chunks = 5; inline bool ConnectionsLog_Payload::_internal_has_num_chunks() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; return value; } inline bool ConnectionsLog_Payload::has_num_chunks() const { @@ -6855,7 +8153,7 @@ inline bool ConnectionsLog_Payload::has_num_chunks() const { } inline void ConnectionsLog_Payload::clear_num_chunks() { num_chunks_ = 0; - _has_bits_[0] &= ~0x00000008u; + _has_bits_[0] &= ~0x00000010u; } inline int32_t ConnectionsLog_Payload::_internal_num_chunks() const { return num_chunks_; @@ -6865,7 +8163,7 @@ inline int32_t ConnectionsLog_Payload::num_chunks() const { return _internal_num_chunks(); } inline void ConnectionsLog_Payload::_internal_set_num_chunks(int32_t value) { - _has_bits_[0] |= 0x00000008u; + _has_bits_[0] |= 0x00000010u; num_chunks_ = value; } inline void ConnectionsLog_Payload::set_num_chunks(int32_t value) { @@ -6875,7 +8173,7 @@ inline void ConnectionsLog_Payload::set_num_chunks(int32_t value) { // optional .location.nearby.proto.connections.PayloadStatus status = 6; inline bool ConnectionsLog_Payload::_internal_has_status() const { - bool value = (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000040u) != 0; return value; } inline bool ConnectionsLog_Payload::has_status() const { @@ -6883,7 +8181,7 @@ inline bool ConnectionsLog_Payload::has_status() const { } inline void ConnectionsLog_Payload::clear_status() { status_ = 0; - _has_bits_[0] &= ~0x00000020u; + _has_bits_[0] &= ~0x00000040u; } inline ::location::nearby::proto::connections::PayloadStatus ConnectionsLog_Payload::_internal_status() const { return static_cast< ::location::nearby::proto::connections::PayloadStatus >(status_); @@ -6894,7 +8192,7 @@ inline ::location::nearby::proto::connections::PayloadStatus ConnectionsLog_Payl } inline void ConnectionsLog_Payload::_internal_set_status(::location::nearby::proto::connections::PayloadStatus value) { assert(::location::nearby::proto::connections::PayloadStatus_IsValid(value)); - _has_bits_[0] |= 0x00000020u; + _has_bits_[0] |= 0x00000040u; status_ = value; } inline void ConnectionsLog_Payload::set_status(::location::nearby::proto::connections::PayloadStatus value) { @@ -6902,13 +8200,159 @@ inline void ConnectionsLog_Payload::set_status(::location::nearby::proto::connec // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.Payload.status) } +// optional int32 num_successful_auto_resume = 7; +inline bool ConnectionsLog_Payload::_internal_has_num_successful_auto_resume() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool ConnectionsLog_Payload::has_num_successful_auto_resume() const { + return _internal_has_num_successful_auto_resume(); +} +inline void ConnectionsLog_Payload::clear_num_successful_auto_resume() { + num_successful_auto_resume_ = 0; + _has_bits_[0] &= ~0x00000080u; +} +inline int32_t ConnectionsLog_Payload::_internal_num_successful_auto_resume() const { + return num_successful_auto_resume_; +} +inline int32_t ConnectionsLog_Payload::num_successful_auto_resume() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.Payload.num_successful_auto_resume) + return _internal_num_successful_auto_resume(); +} +inline void ConnectionsLog_Payload::_internal_set_num_successful_auto_resume(int32_t value) { + _has_bits_[0] |= 0x00000080u; + num_successful_auto_resume_ = value; +} +inline void ConnectionsLog_Payload::set_num_successful_auto_resume(int32_t value) { + _internal_set_num_successful_auto_resume(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.Payload.num_successful_auto_resume) +} + +// optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 8; +inline bool ConnectionsLog_Payload::_internal_has_operation_result() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || operation_result_ != nullptr); + return value; +} +inline bool ConnectionsLog_Payload::has_operation_result() const { + return _internal_has_operation_result(); +} +inline void ConnectionsLog_Payload::clear_operation_result() { + if (operation_result_ != nullptr) operation_result_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_Payload::_internal_operation_result() const { + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* p = operation_result_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::analytics::proto::_ConnectionsLog_OperationResult_default_instance_); +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_Payload::operation_result() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.Payload.operation_result) + return _internal_operation_result(); +} +inline void ConnectionsLog_Payload::unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(operation_result_); + } + operation_result_ = operation_result; + if (operation_result) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.analytics.proto.ConnectionsLog.Payload.operation_result) +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_Payload::release_operation_result() { + _has_bits_[0] &= ~0x00000001u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_Payload::unsafe_arena_release_operation_result() { + // @@protoc_insertion_point(field_release:location.nearby.analytics.proto.ConnectionsLog.Payload.operation_result) + _has_bits_[0] &= ~0x00000001u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_Payload::_internal_mutable_operation_result() { + _has_bits_[0] |= 0x00000001u; + if (operation_result_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>(GetArenaForAllocation()); + operation_result_ = p; + } + return operation_result_; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_Payload::mutable_operation_result() { + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _msg = _internal_mutable_operation_result(); + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.Payload.operation_result) + return _msg; +} +inline void ConnectionsLog_Payload::set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete operation_result_; + } + if (operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>::GetOwningArena(operation_result); + if (message_arena != submessage_arena) { + operation_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, operation_result, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + operation_result_ = operation_result; + // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.Payload.operation_result) +} + +// optional int32 num_failed_auto_resume = 9; +inline bool ConnectionsLog_Payload::_internal_has_num_failed_auto_resume() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool ConnectionsLog_Payload::has_num_failed_auto_resume() const { + return _internal_has_num_failed_auto_resume(); +} +inline void ConnectionsLog_Payload::clear_num_failed_auto_resume() { + num_failed_auto_resume_ = 0; + _has_bits_[0] &= ~0x00000100u; +} +inline int32_t ConnectionsLog_Payload::_internal_num_failed_auto_resume() const { + return num_failed_auto_resume_; +} +inline int32_t ConnectionsLog_Payload::num_failed_auto_resume() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.Payload.num_failed_auto_resume) + return _internal_num_failed_auto_resume(); +} +inline void ConnectionsLog_Payload::_internal_set_num_failed_auto_resume(int32_t value) { + _has_bits_[0] |= 0x00000100u; + num_failed_auto_resume_ = value; +} +inline void ConnectionsLog_Payload::set_num_failed_auto_resume(int32_t value) { + _internal_set_num_failed_auto_resume(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.Payload.num_failed_auto_resume) +} + // ------------------------------------------------------------------- // ConnectionsLog_BandwidthUpgradeAttempt // optional .location.nearby.proto.connections.ConnectionAttemptDirection direction = 1; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_direction() const { - bool value = (_has_bits_[0] & 0x00000004u) != 0; + bool value = (_has_bits_[0] & 0x00000008u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_direction() const { @@ -6916,7 +8360,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_direction() const { } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_direction() { direction_ = 0; - _has_bits_[0] &= ~0x00000004u; + _has_bits_[0] &= ~0x00000008u; } inline ::location::nearby::proto::connections::ConnectionAttemptDirection ConnectionsLog_BandwidthUpgradeAttempt::_internal_direction() const { return static_cast< ::location::nearby::proto::connections::ConnectionAttemptDirection >(direction_); @@ -6927,7 +8371,7 @@ inline ::location::nearby::proto::connections::ConnectionAttemptDirection Connec } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_direction(::location::nearby::proto::connections::ConnectionAttemptDirection value) { assert(::location::nearby::proto::connections::ConnectionAttemptDirection_IsValid(value)); - _has_bits_[0] |= 0x00000004u; + _has_bits_[0] |= 0x00000008u; direction_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_direction(::location::nearby::proto::connections::ConnectionAttemptDirection value) { @@ -6937,7 +8381,7 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_direction(::location::ne // optional int64 duration_millis = 2; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_duration_millis() const { - bool value = (_has_bits_[0] & 0x00000002u) != 0; + bool value = (_has_bits_[0] & 0x00000004u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_duration_millis() const { @@ -6945,7 +8389,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_duration_millis() const } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_duration_millis() { duration_millis_ = int64_t{0}; - _has_bits_[0] &= ~0x00000002u; + _has_bits_[0] &= ~0x00000004u; } inline int64_t ConnectionsLog_BandwidthUpgradeAttempt::_internal_duration_millis() const { return duration_millis_; @@ -6955,7 +8399,7 @@ inline int64_t ConnectionsLog_BandwidthUpgradeAttempt::duration_millis() const { return _internal_duration_millis(); } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_duration_millis(int64_t value) { - _has_bits_[0] |= 0x00000002u; + _has_bits_[0] |= 0x00000004u; duration_millis_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_duration_millis(int64_t value) { @@ -6965,7 +8409,7 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_duration_millis(int64_t // optional .location.nearby.proto.connections.Medium from_medium = 3; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_from_medium() const { - bool value = (_has_bits_[0] & 0x00000008u) != 0; + bool value = (_has_bits_[0] & 0x00000010u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_from_medium() const { @@ -6973,7 +8417,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_from_medium() const { } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_from_medium() { from_medium_ = 0; - _has_bits_[0] &= ~0x00000008u; + _has_bits_[0] &= ~0x00000010u; } inline ::location::nearby::proto::connections::Medium ConnectionsLog_BandwidthUpgradeAttempt::_internal_from_medium() const { return static_cast< ::location::nearby::proto::connections::Medium >(from_medium_); @@ -6984,7 +8428,7 @@ inline ::location::nearby::proto::connections::Medium ConnectionsLog_BandwidthUp } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_from_medium(::location::nearby::proto::connections::Medium value) { assert(::location::nearby::proto::connections::Medium_IsValid(value)); - _has_bits_[0] |= 0x00000008u; + _has_bits_[0] |= 0x00000010u; from_medium_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_from_medium(::location::nearby::proto::connections::Medium value) { @@ -6994,7 +8438,7 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_from_medium(::location:: // optional .location.nearby.proto.connections.Medium to_medium = 4; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_to_medium() const { - bool value = (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000020u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_to_medium() const { @@ -7002,7 +8446,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_to_medium() const { } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_to_medium() { to_medium_ = 0; - _has_bits_[0] &= ~0x00000010u; + _has_bits_[0] &= ~0x00000020u; } inline ::location::nearby::proto::connections::Medium ConnectionsLog_BandwidthUpgradeAttempt::_internal_to_medium() const { return static_cast< ::location::nearby::proto::connections::Medium >(to_medium_); @@ -7013,7 +8457,7 @@ inline ::location::nearby::proto::connections::Medium ConnectionsLog_BandwidthUp } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_to_medium(::location::nearby::proto::connections::Medium value) { assert(::location::nearby::proto::connections::Medium_IsValid(value)); - _has_bits_[0] |= 0x00000010u; + _has_bits_[0] |= 0x00000020u; to_medium_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_to_medium(::location::nearby::proto::connections::Medium value) { @@ -7023,7 +8467,7 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_to_medium(::location::ne // optional .location.nearby.proto.connections.BandwidthUpgradeResult upgrade_result = 5; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_upgrade_result() const { - bool value = (_has_bits_[0] & 0x00000020u) != 0; + bool value = (_has_bits_[0] & 0x00000040u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_upgrade_result() const { @@ -7031,7 +8475,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_upgrade_result() const { } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_upgrade_result() { upgrade_result_ = 0; - _has_bits_[0] &= ~0x00000020u; + _has_bits_[0] &= ~0x00000040u; } inline ::location::nearby::proto::connections::BandwidthUpgradeResult ConnectionsLog_BandwidthUpgradeAttempt::_internal_upgrade_result() const { return static_cast< ::location::nearby::proto::connections::BandwidthUpgradeResult >(upgrade_result_); @@ -7042,7 +8486,7 @@ inline ::location::nearby::proto::connections::BandwidthUpgradeResult Connection } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_upgrade_result(::location::nearby::proto::connections::BandwidthUpgradeResult value) { assert(::location::nearby::proto::connections::BandwidthUpgradeResult_IsValid(value)); - _has_bits_[0] |= 0x00000020u; + _has_bits_[0] |= 0x00000040u; upgrade_result_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_upgrade_result(::location::nearby::proto::connections::BandwidthUpgradeResult value) { @@ -7052,7 +8496,7 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_upgrade_result(::locatio // optional .location.nearby.proto.connections.BandwidthUpgradeErrorStage error_stage = 6; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_error_stage() const { - bool value = (_has_bits_[0] & 0x00000080u) != 0; + bool value = (_has_bits_[0] & 0x00000100u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_error_stage() const { @@ -7060,7 +8504,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_error_stage() const { } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_error_stage() { error_stage_ = 0; - _has_bits_[0] &= ~0x00000080u; + _has_bits_[0] &= ~0x00000100u; } inline ::location::nearby::proto::connections::BandwidthUpgradeErrorStage ConnectionsLog_BandwidthUpgradeAttempt::_internal_error_stage() const { return static_cast< ::location::nearby::proto::connections::BandwidthUpgradeErrorStage >(error_stage_); @@ -7071,7 +8515,7 @@ inline ::location::nearby::proto::connections::BandwidthUpgradeErrorStage Connec } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_error_stage(::location::nearby::proto::connections::BandwidthUpgradeErrorStage value) { assert(::location::nearby::proto::connections::BandwidthUpgradeErrorStage_IsValid(value)); - _has_bits_[0] |= 0x00000080u; + _has_bits_[0] |= 0x00000100u; error_stage_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_error_stage(::location::nearby::proto::connections::BandwidthUpgradeErrorStage value) { @@ -7081,7 +8525,7 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_error_stage(::location:: // optional int64 client_flow_id = 7; inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_client_flow_id() const { - bool value = (_has_bits_[0] & 0x00000040u) != 0; + bool value = (_has_bits_[0] & 0x00000080u) != 0; return value; } inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_client_flow_id() const { @@ -7089,7 +8533,7 @@ inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_client_flow_id() const { } inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_client_flow_id() { client_flow_id_ = int64_t{0}; - _has_bits_[0] &= ~0x00000040u; + _has_bits_[0] &= ~0x00000080u; } inline int64_t ConnectionsLog_BandwidthUpgradeAttempt::_internal_client_flow_id() const { return client_flow_id_; @@ -7099,7 +8543,7 @@ inline int64_t ConnectionsLog_BandwidthUpgradeAttempt::client_flow_id() const { return _internal_client_flow_id(); } inline void ConnectionsLog_BandwidthUpgradeAttempt::_internal_set_client_flow_id(int64_t value) { - _has_bits_[0] |= 0x00000040u; + _has_bits_[0] |= 0x00000080u; client_flow_id_ = value; } inline void ConnectionsLog_BandwidthUpgradeAttempt::set_client_flow_id(int64_t value) { @@ -7176,6 +8620,96 @@ inline void ConnectionsLog_BandwidthUpgradeAttempt::set_allocated_connection_tok // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.BandwidthUpgradeAttempt.connection_token) } +// optional .location.nearby.analytics.proto.ConnectionsLog.OperationResult operation_result = 9; +inline bool ConnectionsLog_BandwidthUpgradeAttempt::_internal_has_operation_result() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || operation_result_ != nullptr); + return value; +} +inline bool ConnectionsLog_BandwidthUpgradeAttempt::has_operation_result() const { + return _internal_has_operation_result(); +} +inline void ConnectionsLog_BandwidthUpgradeAttempt::clear_operation_result() { + if (operation_result_ != nullptr) operation_result_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_BandwidthUpgradeAttempt::_internal_operation_result() const { + const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* p = operation_result_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::analytics::proto::_ConnectionsLog_OperationResult_default_instance_); +} +inline const ::location::nearby::analytics::proto::ConnectionsLog_OperationResult& ConnectionsLog_BandwidthUpgradeAttempt::operation_result() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.BandwidthUpgradeAttempt.operation_result) + return _internal_operation_result(); +} +inline void ConnectionsLog_BandwidthUpgradeAttempt::unsafe_arena_set_allocated_operation_result( + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(operation_result_); + } + operation_result_ = operation_result; + if (operation_result) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.analytics.proto.ConnectionsLog.BandwidthUpgradeAttempt.operation_result) +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_BandwidthUpgradeAttempt::release_operation_result() { + _has_bits_[0] &= ~0x00000002u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_BandwidthUpgradeAttempt::unsafe_arena_release_operation_result() { + // @@protoc_insertion_point(field_release:location.nearby.analytics.proto.ConnectionsLog.BandwidthUpgradeAttempt.operation_result) + _has_bits_[0] &= ~0x00000002u; + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* temp = operation_result_; + operation_result_ = nullptr; + return temp; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_BandwidthUpgradeAttempt::_internal_mutable_operation_result() { + _has_bits_[0] |= 0x00000002u; + if (operation_result_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>(GetArenaForAllocation()); + operation_result_ = p; + } + return operation_result_; +} +inline ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* ConnectionsLog_BandwidthUpgradeAttempt::mutable_operation_result() { + ::location::nearby::analytics::proto::ConnectionsLog_OperationResult* _msg = _internal_mutable_operation_result(); + // @@protoc_insertion_point(field_mutable:location.nearby.analytics.proto.ConnectionsLog.BandwidthUpgradeAttempt.operation_result) + return _msg; +} +inline void ConnectionsLog_BandwidthUpgradeAttempt::set_allocated_operation_result(::location::nearby::analytics::proto::ConnectionsLog_OperationResult* operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete operation_result_; + } + if (operation_result) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::analytics::proto::ConnectionsLog_OperationResult>::GetOwningArena(operation_result); + if (message_arena != submessage_arena) { + operation_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, operation_result, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + operation_result_ = operation_result; + // @@protoc_insertion_point(field_set_allocated:location.nearby.analytics.proto.ConnectionsLog.BandwidthUpgradeAttempt.operation_result) +} + // ------------------------------------------------------------------- // ConnectionsLog_ErrorCode @@ -8135,7 +9669,7 @@ inline void ConnectionsLog_AdvertisingMetadata::set_multiple_advertisement_suppo // optional .location.nearby.proto.connections.PowerLevel power_level = 5; inline bool ConnectionsLog_AdvertisingMetadata::_internal_has_power_level() const { - bool value = (_has_bits_[0] & 0x00000010u) != 0; + bool value = (_has_bits_[0] & 0x00000080u) != 0; return value; } inline bool ConnectionsLog_AdvertisingMetadata::has_power_level() const { @@ -8143,7 +9677,7 @@ inline bool ConnectionsLog_AdvertisingMetadata::has_power_level() const { } inline void ConnectionsLog_AdvertisingMetadata::clear_power_level() { power_level_ = -1; - _has_bits_[0] &= ~0x00000010u; + _has_bits_[0] &= ~0x00000080u; } inline ::location::nearby::proto::connections::PowerLevel ConnectionsLog_AdvertisingMetadata::_internal_power_level() const { return static_cast< ::location::nearby::proto::connections::PowerLevel >(power_level_); @@ -8154,7 +9688,7 @@ inline ::location::nearby::proto::connections::PowerLevel ConnectionsLog_Adverti } inline void ConnectionsLog_AdvertisingMetadata::_internal_set_power_level(::location::nearby::proto::connections::PowerLevel value) { assert(::location::nearby::proto::connections::PowerLevel_IsValid(value)); - _has_bits_[0] |= 0x00000010u; + _has_bits_[0] |= 0x00000080u; power_level_ = value; } inline void ConnectionsLog_AdvertisingMetadata::set_power_level(::location::nearby::proto::connections::PowerLevel value) { @@ -8162,6 +9696,90 @@ inline void ConnectionsLog_AdvertisingMetadata::set_power_level(::location::near // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.power_level) } +// optional bool supports_dual_band = 6; +inline bool ConnectionsLog_AdvertisingMetadata::_internal_has_supports_dual_band() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool ConnectionsLog_AdvertisingMetadata::has_supports_dual_band() const { + return _internal_has_supports_dual_band(); +} +inline void ConnectionsLog_AdvertisingMetadata::clear_supports_dual_band() { + supports_dual_band_ = false; + _has_bits_[0] &= ~0x00000010u; +} +inline bool ConnectionsLog_AdvertisingMetadata::_internal_supports_dual_band() const { + return supports_dual_band_; +} +inline bool ConnectionsLog_AdvertisingMetadata::supports_dual_band() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.supports_dual_band) + return _internal_supports_dual_band(); +} +inline void ConnectionsLog_AdvertisingMetadata::_internal_set_supports_dual_band(bool value) { + _has_bits_[0] |= 0x00000010u; + supports_dual_band_ = value; +} +inline void ConnectionsLog_AdvertisingMetadata::set_supports_dual_band(bool value) { + _internal_set_supports_dual_band(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.supports_dual_band) +} + +// optional bool supports_wifi_aware = 7; +inline bool ConnectionsLog_AdvertisingMetadata::_internal_has_supports_wifi_aware() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool ConnectionsLog_AdvertisingMetadata::has_supports_wifi_aware() const { + return _internal_has_supports_wifi_aware(); +} +inline void ConnectionsLog_AdvertisingMetadata::clear_supports_wifi_aware() { + supports_wifi_aware_ = false; + _has_bits_[0] &= ~0x00000020u; +} +inline bool ConnectionsLog_AdvertisingMetadata::_internal_supports_wifi_aware() const { + return supports_wifi_aware_; +} +inline bool ConnectionsLog_AdvertisingMetadata::supports_wifi_aware() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.supports_wifi_aware) + return _internal_supports_wifi_aware(); +} +inline void ConnectionsLog_AdvertisingMetadata::_internal_set_supports_wifi_aware(bool value) { + _has_bits_[0] |= 0x00000020u; + supports_wifi_aware_ = value; +} +inline void ConnectionsLog_AdvertisingMetadata::set_supports_wifi_aware(bool value) { + _internal_set_supports_wifi_aware(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.supports_wifi_aware) +} + +// optional int32 endpoint_info_size = 8; +inline bool ConnectionsLog_AdvertisingMetadata::_internal_has_endpoint_info_size() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool ConnectionsLog_AdvertisingMetadata::has_endpoint_info_size() const { + return _internal_has_endpoint_info_size(); +} +inline void ConnectionsLog_AdvertisingMetadata::clear_endpoint_info_size() { + endpoint_info_size_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline int32_t ConnectionsLog_AdvertisingMetadata::_internal_endpoint_info_size() const { + return endpoint_info_size_; +} +inline int32_t ConnectionsLog_AdvertisingMetadata::endpoint_info_size() const { + // @@protoc_insertion_point(field_get:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.endpoint_info_size) + return _internal_endpoint_info_size(); +} +inline void ConnectionsLog_AdvertisingMetadata::_internal_set_endpoint_info_size(int32_t value) { + _has_bits_[0] |= 0x00000040u; + endpoint_info_size_ = value; +} +inline void ConnectionsLog_AdvertisingMetadata::set_endpoint_info_size(int32_t value) { + _internal_set_endpoint_info_size(value); + // @@protoc_insertion_point(field_set:location.nearby.analytics.proto.ConnectionsLog.AdvertisingMetadata.endpoint_info_size) +} + // ------------------------------------------------------------------- // ConnectionsLog_DiscoveryMetadata @@ -9202,6 +10820,10 @@ inline void ConnectionsLog::set_allocated_files_migration_phase(std::string* fil // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/compiled_proto/internal/proto/analytics/experiments_log.pb.cc b/compiled_proto/internal/proto/analytics/experiments_log.pb.cc new file mode 100644 index 00000000..41b744c7 --- /dev/null +++ b/compiled_proto/internal/proto/analytics/experiments_log.pb.cc @@ -0,0 +1,311 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: internal/proto/analytics/experiments_log.proto + +#include "internal/proto/analytics/experiments_log.pb.h" + +#include + +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace nearby { +namespace experiments { +constexpr ExperimentsLog::ExperimentsLog( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : experiment_token_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , zwieback_cookie_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct ExperimentsLogDefaultTypeInternal { + constexpr ExperimentsLogDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ExperimentsLogDefaultTypeInternal() {} + union { + ExperimentsLog _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ExperimentsLogDefaultTypeInternal _ExperimentsLog_default_instance_; +} // namespace experiments +} // namespace nearby +namespace nearby { +namespace experiments { + +// =================================================================== + +class ExperimentsLog::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_experiment_token(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_zwieback_cookie(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +ExperimentsLog::ExperimentsLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.experiments.ExperimentsLog) +} +ExperimentsLog::ExperimentsLog(const ExperimentsLog& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + experiment_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + experiment_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_experiment_token()) { + experiment_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_experiment_token(), + GetArenaForAllocation()); + } + zwieback_cookie_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + zwieback_cookie_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_zwieback_cookie()) { + zwieback_cookie_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_zwieback_cookie(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:nearby.experiments.ExperimentsLog) +} + +inline void ExperimentsLog::SharedCtor() { +experiment_token_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + experiment_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +zwieback_cookie_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + zwieback_cookie_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +ExperimentsLog::~ExperimentsLog() { + // @@protoc_insertion_point(destructor:nearby.experiments.ExperimentsLog) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void ExperimentsLog::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + experiment_token_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + zwieback_cookie_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void ExperimentsLog::ArenaDtor(void* object) { + ExperimentsLog* _this = reinterpret_cast< ExperimentsLog* >(object); + (void)_this; +} +void ExperimentsLog::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ExperimentsLog::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ExperimentsLog::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.experiments.ExperimentsLog) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + experiment_token_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + zwieback_cookie_.ClearNonDefaultToEmpty(); + } + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* ExperimentsLog::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional bytes experiment_token = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_experiment_token(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string zwieback_cookie = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_zwieback_cookie(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ExperimentsLog::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.experiments.ExperimentsLog) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional bytes experiment_token = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_experiment_token(), target); + } + + // optional string zwieback_cookie = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_zwieback_cookie(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.experiments.ExperimentsLog) + return target; +} + +size_t ExperimentsLog::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.experiments.ExperimentsLog) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional bytes experiment_token = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_experiment_token()); + } + + // optional string zwieback_cookie = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_zwieback_cookie()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ExperimentsLog::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void ExperimentsLog::MergeFrom(const ExperimentsLog& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.experiments.ExperimentsLog) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_experiment_token(from._internal_experiment_token()); + } + if (cached_has_bits & 0x00000002u) { + _internal_set_zwieback_cookie(from._internal_zwieback_cookie()); + } + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void ExperimentsLog::CopyFrom(const ExperimentsLog& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.experiments.ExperimentsLog) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ExperimentsLog::IsInitialized() const { + return true; +} + +void ExperimentsLog::InternalSwap(ExperimentsLog* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &experiment_token_, lhs_arena, + &other->experiment_token_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &zwieback_cookie_, lhs_arena, + &other->zwieback_cookie_, rhs_arena + ); +} + +std::string ExperimentsLog::GetTypeName() const { + return "nearby.experiments.ExperimentsLog"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace experiments +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::nearby::experiments::ExperimentsLog* Arena::CreateMaybeMessage< ::nearby::experiments::ExperimentsLog >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::experiments::ExperimentsLog >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/compiled_proto/internal/proto/analytics/experiments_log.pb.h b/compiled_proto/internal/proto/analytics/experiments_log.pb.h new file mode 100644 index 00000000..7c7d253e --- /dev/null +++ b/compiled_proto/internal/proto/analytics/experiments_log.pb.h @@ -0,0 +1,394 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: internal/proto/analytics/experiments_log.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_internal_2fproto_2fanalytics_2fexperiments_5flog_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_internal_2fproto_2fanalytics_2fexperiments_5flog_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3019000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_internal_2fproto_2fanalytics_2fexperiments_5flog_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_internal_2fproto_2fanalytics_2fexperiments_5flog_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const uint32_t offsets[]; +}; +namespace nearby { +namespace experiments { +class ExperimentsLog; +struct ExperimentsLogDefaultTypeInternal; +extern ExperimentsLogDefaultTypeInternal _ExperimentsLog_default_instance_; +} // namespace experiments +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> ::nearby::experiments::ExperimentsLog* Arena::CreateMaybeMessage<::nearby::experiments::ExperimentsLog>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace nearby { +namespace experiments { + +// =================================================================== + +class ExperimentsLog final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.experiments.ExperimentsLog) */ { + public: + inline ExperimentsLog() : ExperimentsLog(nullptr) {} + ~ExperimentsLog() override; + explicit constexpr ExperimentsLog(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ExperimentsLog(const ExperimentsLog& from); + ExperimentsLog(ExperimentsLog&& from) noexcept + : ExperimentsLog() { + *this = ::std::move(from); + } + + inline ExperimentsLog& operator=(const ExperimentsLog& from) { + CopyFrom(from); + return *this; + } + inline ExperimentsLog& operator=(ExperimentsLog&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ExperimentsLog& default_instance() { + return *internal_default_instance(); + } + static inline const ExperimentsLog* internal_default_instance() { + return reinterpret_cast( + &_ExperimentsLog_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(ExperimentsLog& a, ExperimentsLog& b) { + a.Swap(&b); + } + inline void Swap(ExperimentsLog* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ExperimentsLog* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ExperimentsLog* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ExperimentsLog& from); + void MergeFrom(const ExperimentsLog& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ExperimentsLog* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.experiments.ExperimentsLog"; + } + protected: + explicit ExperimentsLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kExperimentTokenFieldNumber = 1, + kZwiebackCookieFieldNumber = 2, + }; + // optional bytes experiment_token = 1; + bool has_experiment_token() const; + private: + bool _internal_has_experiment_token() const; + public: + void clear_experiment_token(); + const std::string& experiment_token() const; + template + void set_experiment_token(ArgT0&& arg0, ArgT... args); + std::string* mutable_experiment_token(); + PROTOBUF_NODISCARD std::string* release_experiment_token(); + void set_allocated_experiment_token(std::string* experiment_token); + private: + const std::string& _internal_experiment_token() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_experiment_token(const std::string& value); + std::string* _internal_mutable_experiment_token(); + public: + + // optional string zwieback_cookie = 2; + bool has_zwieback_cookie() const; + private: + bool _internal_has_zwieback_cookie() const; + public: + void clear_zwieback_cookie(); + const std::string& zwieback_cookie() const; + template + void set_zwieback_cookie(ArgT0&& arg0, ArgT... args); + std::string* mutable_zwieback_cookie(); + PROTOBUF_NODISCARD std::string* release_zwieback_cookie(); + void set_allocated_zwieback_cookie(std::string* zwieback_cookie); + private: + const std::string& _internal_zwieback_cookie() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_zwieback_cookie(const std::string& value); + std::string* _internal_mutable_zwieback_cookie(); + public: + + // @@protoc_insertion_point(class_scope:nearby.experiments.ExperimentsLog) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr experiment_token_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr zwieback_cookie_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2fexperiments_5flog_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ExperimentsLog + +// optional bytes experiment_token = 1; +inline bool ExperimentsLog::_internal_has_experiment_token() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ExperimentsLog::has_experiment_token() const { + return _internal_has_experiment_token(); +} +inline void ExperimentsLog::clear_experiment_token() { + experiment_token_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& ExperimentsLog::experiment_token() const { + // @@protoc_insertion_point(field_get:nearby.experiments.ExperimentsLog.experiment_token) + return _internal_experiment_token(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void ExperimentsLog::set_experiment_token(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + experiment_token_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.experiments.ExperimentsLog.experiment_token) +} +inline std::string* ExperimentsLog::mutable_experiment_token() { + std::string* _s = _internal_mutable_experiment_token(); + // @@protoc_insertion_point(field_mutable:nearby.experiments.ExperimentsLog.experiment_token) + return _s; +} +inline const std::string& ExperimentsLog::_internal_experiment_token() const { + return experiment_token_.Get(); +} +inline void ExperimentsLog::_internal_set_experiment_token(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + experiment_token_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* ExperimentsLog::_internal_mutable_experiment_token() { + _has_bits_[0] |= 0x00000001u; + return experiment_token_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* ExperimentsLog::release_experiment_token() { + // @@protoc_insertion_point(field_release:nearby.experiments.ExperimentsLog.experiment_token) + if (!_internal_has_experiment_token()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = experiment_token_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (experiment_token_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + experiment_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ExperimentsLog::set_allocated_experiment_token(std::string* experiment_token) { + if (experiment_token != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + experiment_token_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), experiment_token, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (experiment_token_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + experiment_token_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.experiments.ExperimentsLog.experiment_token) +} + +// optional string zwieback_cookie = 2; +inline bool ExperimentsLog::_internal_has_zwieback_cookie() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool ExperimentsLog::has_zwieback_cookie() const { + return _internal_has_zwieback_cookie(); +} +inline void ExperimentsLog::clear_zwieback_cookie() { + zwieback_cookie_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& ExperimentsLog::zwieback_cookie() const { + // @@protoc_insertion_point(field_get:nearby.experiments.ExperimentsLog.zwieback_cookie) + return _internal_zwieback_cookie(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void ExperimentsLog::set_zwieback_cookie(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000002u; + zwieback_cookie_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.experiments.ExperimentsLog.zwieback_cookie) +} +inline std::string* ExperimentsLog::mutable_zwieback_cookie() { + std::string* _s = _internal_mutable_zwieback_cookie(); + // @@protoc_insertion_point(field_mutable:nearby.experiments.ExperimentsLog.zwieback_cookie) + return _s; +} +inline const std::string& ExperimentsLog::_internal_zwieback_cookie() const { + return zwieback_cookie_.Get(); +} +inline void ExperimentsLog::_internal_set_zwieback_cookie(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + zwieback_cookie_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* ExperimentsLog::_internal_mutable_zwieback_cookie() { + _has_bits_[0] |= 0x00000002u; + return zwieback_cookie_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* ExperimentsLog::release_zwieback_cookie() { + // @@protoc_insertion_point(field_release:nearby.experiments.ExperimentsLog.zwieback_cookie) + if (!_internal_has_zwieback_cookie()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + auto* p = zwieback_cookie_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (zwieback_cookie_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + zwieback_cookie_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void ExperimentsLog::set_allocated_zwieback_cookie(std::string* zwieback_cookie) { + if (zwieback_cookie != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + zwieback_cookie_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), zwieback_cookie, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (zwieback_cookie_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + zwieback_cookie_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.experiments.ExperimentsLog.zwieback_cookie) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) + +} // namespace experiments +} // namespace nearby + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_internal_2fproto_2fanalytics_2fexperiments_5flog_2eproto diff --git a/compiled_proto/internal/proto/analytics/fast_pair_log.pb.cc b/compiled_proto/internal/proto/analytics/fast_pair_log.pb.cc new file mode 100644 index 00000000..607bc1ce --- /dev/null +++ b/compiled_proto/internal/proto/analytics/fast_pair_log.pb.cc @@ -0,0 +1,2816 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: internal/proto/analytics/fast_pair_log.proto + +#include "internal/proto/analytics/fast_pair_log.pb.h" + +#include + +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace nearby { +namespace proto { +namespace fastpair { +constexpr FastPairLog_GattEvent::FastPairLog_GattEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : error_from_os_(0){} +struct FastPairLog_GattEventDefaultTypeInternal { + constexpr FastPairLog_GattEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_GattEventDefaultTypeInternal() {} + union { + FastPairLog_GattEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_GattEventDefaultTypeInternal _FastPairLog_GattEvent_default_instance_; +constexpr FastPairLog_BrEdrHandoverEvent::FastPairLog_BrEdrHandoverEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : error_code_(0) +{} +struct FastPairLog_BrEdrHandoverEventDefaultTypeInternal { + constexpr FastPairLog_BrEdrHandoverEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_BrEdrHandoverEventDefaultTypeInternal() {} + union { + FastPairLog_BrEdrHandoverEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_BrEdrHandoverEventDefaultTypeInternal _FastPairLog_BrEdrHandoverEvent_default_instance_; +constexpr FastPairLog_CreateBondEvent::FastPairLog_CreateBondEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : error_code_(0) + + , unbond_reason_(0){} +struct FastPairLog_CreateBondEventDefaultTypeInternal { + constexpr FastPairLog_CreateBondEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_CreateBondEventDefaultTypeInternal() {} + union { + FastPairLog_CreateBondEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_CreateBondEventDefaultTypeInternal _FastPairLog_CreateBondEvent_default_instance_; +constexpr FastPairLog_ConnectEvent::FastPairLog_ConnectEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : error_code_(0) + + , profile_uuid_(0){} +struct FastPairLog_ConnectEventDefaultTypeInternal { + constexpr FastPairLog_ConnectEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_ConnectEventDefaultTypeInternal() {} + union { + FastPairLog_ConnectEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_ConnectEventDefaultTypeInternal _FastPairLog_ConnectEvent_default_instance_; +constexpr FastPairLog_ProviderInfo::FastPairLog_ProviderInfo( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : database_hash_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , number_account_keys_on_provider_(0){} +struct FastPairLog_ProviderInfoDefaultTypeInternal { + constexpr FastPairLog_ProviderInfoDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_ProviderInfoDefaultTypeInternal() {} + union { + FastPairLog_ProviderInfo _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_ProviderInfoDefaultTypeInternal _FastPairLog_ProviderInfo_default_instance_; +constexpr FastPairLog_FootprintsInfo::FastPairLog_FootprintsInfo( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : number_devices_on_footprints_(0){} +struct FastPairLog_FootprintsInfoDefaultTypeInternal { + constexpr FastPairLog_FootprintsInfoDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_FootprintsInfoDefaultTypeInternal() {} + union { + FastPairLog_FootprintsInfo _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_FootprintsInfoDefaultTypeInternal _FastPairLog_FootprintsInfo_default_instance_; +constexpr FastPairLog_KeyBasedPairingInfo::FastPairLog_KeyBasedPairingInfo( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : request_flag_(0u) + , response_type_(0u) + , response_flag_(0u) + , response_device_count_(0u){} +struct FastPairLog_KeyBasedPairingInfoDefaultTypeInternal { + constexpr FastPairLog_KeyBasedPairingInfoDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLog_KeyBasedPairingInfoDefaultTypeInternal() {} + union { + FastPairLog_KeyBasedPairingInfo _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLog_KeyBasedPairingInfoDefaultTypeInternal _FastPairLog_KeyBasedPairingInfo_default_instance_; +constexpr FastPairLog::FastPairLog( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : gatt_event_(nullptr) + , br_edr_handover_event_(nullptr) + , bond_event_(nullptr) + , connect_event_(nullptr) + , provider_info_(nullptr) + , footprints_info_(nullptr) + , key_based_pairing_info_(nullptr) + , model_id_(0) + , bond_state_(0) + + , error_code_(0) + + , device_type_(0) + + , hashed_salted_device_address_(int64_t{0}) + , duration_(int64_t{0}) + , os_type_(0) + + , active_wifi_frequency_(0) + , number_connected_peripherals_(0) + , bonding_transport_(0u) + , is_scanned_by_offload_scanner_(false) + , is_first_day_new_user_(false) + , is_seven_days_new_user_(false) + , is_pair_triggered_by_settings_(false) + , bonded_device_count_(0u) + , nearby_mainline_tethering_version_(int64_t{0}) + , sass_connection_state_(0) + , is_in_paired_history_(false) + , nearby_nano_app_version_(int64_t{0}){} +struct FastPairLogDefaultTypeInternal { + constexpr FastPairLogDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairLogDefaultTypeInternal() {} + union { + FastPairLog _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairLogDefaultTypeInternal _FastPairLog_default_instance_; +} // namespace fastpair +} // namespace proto +} // namespace nearby +namespace nearby { +namespace proto { +namespace fastpair { + +// =================================================================== + +class FastPairLog_GattEvent::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_error_from_os(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +FastPairLog_GattEvent::FastPairLog_GattEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.GattEvent) +} +FastPairLog_GattEvent::FastPairLog_GattEvent(const FastPairLog_GattEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + error_from_os_ = from.error_from_os_; + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.GattEvent) +} + +inline void FastPairLog_GattEvent::SharedCtor() { +error_from_os_ = 0; +} + +FastPairLog_GattEvent::~FastPairLog_GattEvent() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.GattEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_GattEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairLog_GattEvent::ArenaDtor(void* object) { + FastPairLog_GattEvent* _this = reinterpret_cast< FastPairLog_GattEvent* >(object); + (void)_this; +} +void FastPairLog_GattEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_GattEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_GattEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.GattEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + error_from_os_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_GattEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 error_from_os = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_error_from_os(&has_bits); + error_from_os_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_GattEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.GattEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 error_from_os = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_error_from_os(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.GattEvent) + return target; +} + +size_t FastPairLog_GattEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.GattEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional int32 error_from_os = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_error_from_os()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_GattEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_GattEvent::MergeFrom(const FastPairLog_GattEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.GattEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_error_from_os()) { + _internal_set_error_from_os(from._internal_error_from_os()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_GattEvent::CopyFrom(const FastPairLog_GattEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.GattEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_GattEvent::IsInitialized() const { + return true; +} + +void FastPairLog_GattEvent::InternalSwap(FastPairLog_GattEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(error_from_os_, other->error_from_os_); +} + +std::string FastPairLog_GattEvent::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.GattEvent"; +} + + +// =================================================================== + +class FastPairLog_BrEdrHandoverEvent::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_error_code(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +FastPairLog_BrEdrHandoverEvent::FastPairLog_BrEdrHandoverEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) +} +FastPairLog_BrEdrHandoverEvent::FastPairLog_BrEdrHandoverEvent(const FastPairLog_BrEdrHandoverEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + error_code_ = from.error_code_; + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) +} + +inline void FastPairLog_BrEdrHandoverEvent::SharedCtor() { +error_code_ = 0; +} + +FastPairLog_BrEdrHandoverEvent::~FastPairLog_BrEdrHandoverEvent() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_BrEdrHandoverEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairLog_BrEdrHandoverEvent::ArenaDtor(void* object) { + FastPairLog_BrEdrHandoverEvent* _this = reinterpret_cast< FastPairLog_BrEdrHandoverEvent* >(object); + (void)_this; +} +void FastPairLog_BrEdrHandoverEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_BrEdrHandoverEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_BrEdrHandoverEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + error_code_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_BrEdrHandoverEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.proto.fastpair.FastPairEvent.BrEdrHandoverErrorCode error_code = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode_IsValid(val))) { + _internal_set_error_code(static_cast<::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_BrEdrHandoverEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.proto.fastpair.FastPairEvent.BrEdrHandoverErrorCode error_code = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_error_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + return target; +} + +size_t FastPairLog_BrEdrHandoverEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .nearby.proto.fastpair.FastPairEvent.BrEdrHandoverErrorCode error_code = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_error_code()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_BrEdrHandoverEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_BrEdrHandoverEvent::MergeFrom(const FastPairLog_BrEdrHandoverEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_error_code()) { + _internal_set_error_code(from._internal_error_code()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_BrEdrHandoverEvent::CopyFrom(const FastPairLog_BrEdrHandoverEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_BrEdrHandoverEvent::IsInitialized() const { + return true; +} + +void FastPairLog_BrEdrHandoverEvent::InternalSwap(FastPairLog_BrEdrHandoverEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(error_code_, other->error_code_); +} + +std::string FastPairLog_BrEdrHandoverEvent::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent"; +} + + +// =================================================================== + +class FastPairLog_CreateBondEvent::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_error_code(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_unbond_reason(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +FastPairLog_CreateBondEvent::FastPairLog_CreateBondEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.CreateBondEvent) +} +FastPairLog_CreateBondEvent::FastPairLog_CreateBondEvent(const FastPairLog_CreateBondEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&error_code_, &from.error_code_, + static_cast(reinterpret_cast(&unbond_reason_) - + reinterpret_cast(&error_code_)) + sizeof(unbond_reason_)); + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.CreateBondEvent) +} + +inline void FastPairLog_CreateBondEvent::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&error_code_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&unbond_reason_) - + reinterpret_cast(&error_code_)) + sizeof(unbond_reason_)); +} + +FastPairLog_CreateBondEvent::~FastPairLog_CreateBondEvent() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_CreateBondEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairLog_CreateBondEvent::ArenaDtor(void* object) { + FastPairLog_CreateBondEvent* _this = reinterpret_cast< FastPairLog_CreateBondEvent* >(object); + (void)_this; +} +void FastPairLog_CreateBondEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_CreateBondEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_CreateBondEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&error_code_, 0, static_cast( + reinterpret_cast(&unbond_reason_) - + reinterpret_cast(&error_code_)) + sizeof(unbond_reason_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_CreateBondEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.proto.fastpair.FastPairEvent.CreateBondErrorCode error_code = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode_IsValid(val))) { + _internal_set_error_code(static_cast<::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 unbond_reason = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_unbond_reason(&has_bits); + unbond_reason_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_CreateBondEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.proto.fastpair.FastPairEvent.CreateBondErrorCode error_code = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_error_code(), target); + } + + // optional int32 unbond_reason = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_unbond_reason(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + return target; +} + +size_t FastPairLog_CreateBondEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .nearby.proto.fastpair.FastPairEvent.CreateBondErrorCode error_code = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_error_code()); + } + + // optional int32 unbond_reason = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_unbond_reason()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_CreateBondEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_CreateBondEvent::MergeFrom(const FastPairLog_CreateBondEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + error_code_ = from.error_code_; + } + if (cached_has_bits & 0x00000002u) { + unbond_reason_ = from.unbond_reason_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_CreateBondEvent::CopyFrom(const FastPairLog_CreateBondEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_CreateBondEvent::IsInitialized() const { + return true; +} + +void FastPairLog_CreateBondEvent::InternalSwap(FastPairLog_CreateBondEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(FastPairLog_CreateBondEvent, unbond_reason_) + + sizeof(FastPairLog_CreateBondEvent::unbond_reason_) + - PROTOBUF_FIELD_OFFSET(FastPairLog_CreateBondEvent, error_code_)>( + reinterpret_cast(&error_code_), + reinterpret_cast(&other->error_code_)); +} + +std::string FastPairLog_CreateBondEvent::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.CreateBondEvent"; +} + + +// =================================================================== + +class FastPairLog_ConnectEvent::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_error_code(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_profile_uuid(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +FastPairLog_ConnectEvent::FastPairLog_ConnectEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.ConnectEvent) +} +FastPairLog_ConnectEvent::FastPairLog_ConnectEvent(const FastPairLog_ConnectEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&error_code_, &from.error_code_, + static_cast(reinterpret_cast(&profile_uuid_) - + reinterpret_cast(&error_code_)) + sizeof(profile_uuid_)); + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.ConnectEvent) +} + +inline void FastPairLog_ConnectEvent::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&error_code_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&profile_uuid_) - + reinterpret_cast(&error_code_)) + sizeof(profile_uuid_)); +} + +FastPairLog_ConnectEvent::~FastPairLog_ConnectEvent() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.ConnectEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_ConnectEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairLog_ConnectEvent::ArenaDtor(void* object) { + FastPairLog_ConnectEvent* _this = reinterpret_cast< FastPairLog_ConnectEvent* >(object); + (void)_this; +} +void FastPairLog_ConnectEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_ConnectEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_ConnectEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.ConnectEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&error_code_, 0, static_cast( + reinterpret_cast(&profile_uuid_) - + reinterpret_cast(&error_code_)) + sizeof(profile_uuid_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_ConnectEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.proto.fastpair.FastPairEvent.ConnectErrorCode error_code = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode_IsValid(val))) { + _internal_set_error_code(static_cast<::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 profile_uuid = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_profile_uuid(&has_bits); + profile_uuid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_ConnectEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.ConnectEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.proto.fastpair.FastPairEvent.ConnectErrorCode error_code = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_error_code(), target); + } + + // optional int32 profile_uuid = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_profile_uuid(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.ConnectEvent) + return target; +} + +size_t FastPairLog_ConnectEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.ConnectEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .nearby.proto.fastpair.FastPairEvent.ConnectErrorCode error_code = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_error_code()); + } + + // optional int32 profile_uuid = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_profile_uuid()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_ConnectEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_ConnectEvent::MergeFrom(const FastPairLog_ConnectEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.ConnectEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + error_code_ = from.error_code_; + } + if (cached_has_bits & 0x00000002u) { + profile_uuid_ = from.profile_uuid_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_ConnectEvent::CopyFrom(const FastPairLog_ConnectEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.ConnectEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_ConnectEvent::IsInitialized() const { + return true; +} + +void FastPairLog_ConnectEvent::InternalSwap(FastPairLog_ConnectEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(FastPairLog_ConnectEvent, profile_uuid_) + + sizeof(FastPairLog_ConnectEvent::profile_uuid_) + - PROTOBUF_FIELD_OFFSET(FastPairLog_ConnectEvent, error_code_)>( + reinterpret_cast(&error_code_), + reinterpret_cast(&other->error_code_)); +} + +std::string FastPairLog_ConnectEvent::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.ConnectEvent"; +} + + +// =================================================================== + +class FastPairLog_ProviderInfo::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_number_account_keys_on_provider(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_database_hash(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +FastPairLog_ProviderInfo::FastPairLog_ProviderInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.ProviderInfo) +} +FastPairLog_ProviderInfo::FastPairLog_ProviderInfo(const FastPairLog_ProviderInfo& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + database_hash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + database_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_database_hash()) { + database_hash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_database_hash(), + GetArenaForAllocation()); + } + number_account_keys_on_provider_ = from.number_account_keys_on_provider_; + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.ProviderInfo) +} + +inline void FastPairLog_ProviderInfo::SharedCtor() { +database_hash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + database_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +number_account_keys_on_provider_ = 0; +} + +FastPairLog_ProviderInfo::~FastPairLog_ProviderInfo() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.ProviderInfo) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_ProviderInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + database_hash_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void FastPairLog_ProviderInfo::ArenaDtor(void* object) { + FastPairLog_ProviderInfo* _this = reinterpret_cast< FastPairLog_ProviderInfo* >(object); + (void)_this; +} +void FastPairLog_ProviderInfo::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_ProviderInfo::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_ProviderInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.ProviderInfo) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + database_hash_.ClearNonDefaultToEmpty(); + } + number_account_keys_on_provider_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_ProviderInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 number_account_keys_on_provider = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_number_account_keys_on_provider(&has_bits); + number_account_keys_on_provider_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string database_hash = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_database_hash(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_ProviderInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.ProviderInfo) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 number_account_keys_on_provider = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_number_account_keys_on_provider(), target); + } + + // optional string database_hash = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_database_hash(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.ProviderInfo) + return target; +} + +size_t FastPairLog_ProviderInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.ProviderInfo) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional string database_hash = 2; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_database_hash()); + } + + // optional int32 number_account_keys_on_provider = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number_account_keys_on_provider()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_ProviderInfo::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_ProviderInfo::MergeFrom(const FastPairLog_ProviderInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.ProviderInfo) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_database_hash(from._internal_database_hash()); + } + if (cached_has_bits & 0x00000002u) { + number_account_keys_on_provider_ = from.number_account_keys_on_provider_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_ProviderInfo::CopyFrom(const FastPairLog_ProviderInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.ProviderInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_ProviderInfo::IsInitialized() const { + return true; +} + +void FastPairLog_ProviderInfo::InternalSwap(FastPairLog_ProviderInfo* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &database_hash_, lhs_arena, + &other->database_hash_, rhs_arena + ); + swap(number_account_keys_on_provider_, other->number_account_keys_on_provider_); +} + +std::string FastPairLog_ProviderInfo::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.ProviderInfo"; +} + + +// =================================================================== + +class FastPairLog_FootprintsInfo::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_number_devices_on_footprints(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +FastPairLog_FootprintsInfo::FastPairLog_FootprintsInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.FootprintsInfo) +} +FastPairLog_FootprintsInfo::FastPairLog_FootprintsInfo(const FastPairLog_FootprintsInfo& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + number_devices_on_footprints_ = from.number_devices_on_footprints_; + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.FootprintsInfo) +} + +inline void FastPairLog_FootprintsInfo::SharedCtor() { +number_devices_on_footprints_ = 0; +} + +FastPairLog_FootprintsInfo::~FastPairLog_FootprintsInfo() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_FootprintsInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairLog_FootprintsInfo::ArenaDtor(void* object) { + FastPairLog_FootprintsInfo* _this = reinterpret_cast< FastPairLog_FootprintsInfo* >(object); + (void)_this; +} +void FastPairLog_FootprintsInfo::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_FootprintsInfo::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_FootprintsInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + number_devices_on_footprints_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_FootprintsInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 number_devices_on_footprints = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_number_devices_on_footprints(&has_bits); + number_devices_on_footprints_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_FootprintsInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 number_devices_on_footprints = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_number_devices_on_footprints(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + return target; +} + +size_t FastPairLog_FootprintsInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional int32 number_devices_on_footprints = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number_devices_on_footprints()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_FootprintsInfo::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_FootprintsInfo::MergeFrom(const FastPairLog_FootprintsInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_number_devices_on_footprints()) { + _internal_set_number_devices_on_footprints(from._internal_number_devices_on_footprints()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_FootprintsInfo::CopyFrom(const FastPairLog_FootprintsInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_FootprintsInfo::IsInitialized() const { + return true; +} + +void FastPairLog_FootprintsInfo::InternalSwap(FastPairLog_FootprintsInfo* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(number_devices_on_footprints_, other->number_devices_on_footprints_); +} + +std::string FastPairLog_FootprintsInfo::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.FootprintsInfo"; +} + + +// =================================================================== + +class FastPairLog_KeyBasedPairingInfo::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_request_flag(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_response_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_response_flag(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_response_device_count(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +FastPairLog_KeyBasedPairingInfo::FastPairLog_KeyBasedPairingInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) +} +FastPairLog_KeyBasedPairingInfo::FastPairLog_KeyBasedPairingInfo(const FastPairLog_KeyBasedPairingInfo& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&request_flag_, &from.request_flag_, + static_cast(reinterpret_cast(&response_device_count_) - + reinterpret_cast(&request_flag_)) + sizeof(response_device_count_)); + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) +} + +inline void FastPairLog_KeyBasedPairingInfo::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&request_flag_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&response_device_count_) - + reinterpret_cast(&request_flag_)) + sizeof(response_device_count_)); +} + +FastPairLog_KeyBasedPairingInfo::~FastPairLog_KeyBasedPairingInfo() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog_KeyBasedPairingInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairLog_KeyBasedPairingInfo::ArenaDtor(void* object) { + FastPairLog_KeyBasedPairingInfo* _this = reinterpret_cast< FastPairLog_KeyBasedPairingInfo* >(object); + (void)_this; +} +void FastPairLog_KeyBasedPairingInfo::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog_KeyBasedPairingInfo::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog_KeyBasedPairingInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + ::memset(&request_flag_, 0, static_cast( + reinterpret_cast(&response_device_count_) - + reinterpret_cast(&request_flag_)) + sizeof(response_device_count_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog_KeyBasedPairingInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional uint32 request_flag = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_request_flag(&has_bits); + request_flag_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional uint32 response_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_response_type(&has_bits); + response_type_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional uint32 response_flag = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_response_flag(&has_bits); + response_flag_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional uint32 response_device_count = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_response_device_count(&has_bits); + response_device_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog_KeyBasedPairingInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional uint32 request_flag = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_request_flag(), target); + } + + // optional uint32 response_type = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_response_type(), target); + } + + // optional uint32 response_flag = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(3, this->_internal_response_flag(), target); + } + + // optional uint32 response_device_count = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(4, this->_internal_response_device_count(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + return target; +} + +size_t FastPairLog_KeyBasedPairingInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional uint32 request_flag = 1; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_request_flag()); + } + + // optional uint32 response_type = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_response_type()); + } + + // optional uint32 response_flag = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_response_flag()); + } + + // optional uint32 response_device_count = 4; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32SizePlusOne(this->_internal_response_device_count()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog_KeyBasedPairingInfo::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog_KeyBasedPairingInfo::MergeFrom(const FastPairLog_KeyBasedPairingInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + request_flag_ = from.request_flag_; + } + if (cached_has_bits & 0x00000002u) { + response_type_ = from.response_type_; + } + if (cached_has_bits & 0x00000004u) { + response_flag_ = from.response_flag_; + } + if (cached_has_bits & 0x00000008u) { + response_device_count_ = from.response_device_count_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog_KeyBasedPairingInfo::CopyFrom(const FastPairLog_KeyBasedPairingInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog_KeyBasedPairingInfo::IsInitialized() const { + return true; +} + +void FastPairLog_KeyBasedPairingInfo::InternalSwap(FastPairLog_KeyBasedPairingInfo* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(FastPairLog_KeyBasedPairingInfo, response_device_count_) + + sizeof(FastPairLog_KeyBasedPairingInfo::response_device_count_) + - PROTOBUF_FIELD_OFFSET(FastPairLog_KeyBasedPairingInfo, request_flag_)>( + reinterpret_cast(&request_flag_), + reinterpret_cast(&other->request_flag_)); +} + +std::string FastPairLog_KeyBasedPairingInfo::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo"; +} + + +// =================================================================== + +class FastPairLog::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_model_id(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static void set_has_bond_state(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } + static void set_has_error_code(HasBits* has_bits) { + (*has_bits)[0] |= 512u; + } + static const ::nearby::proto::fastpair::FastPairLog_GattEvent& gatt_event(const FastPairLog* msg); + static void set_has_gatt_event(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent& br_edr_handover_event(const FastPairLog* msg); + static void set_has_br_edr_handover_event(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent& bond_event(const FastPairLog* msg); + static void set_has_bond_event(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::nearby::proto::fastpair::FastPairLog_ConnectEvent& connect_event(const FastPairLog* msg); + static void set_has_connect_event(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_hashed_salted_device_address(HasBits* has_bits) { + (*has_bits)[0] |= 2048u; + } + static void set_has_duration(HasBits* has_bits) { + (*has_bits)[0] |= 4096u; + } + static const ::nearby::proto::fastpair::FastPairLog_ProviderInfo& provider_info(const FastPairLog* msg); + static void set_has_provider_info(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo& footprints_info(const FastPairLog* msg); + static void set_has_footprints_info(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_device_type(HasBits* has_bits) { + (*has_bits)[0] |= 1024u; + } + static void set_has_os_type(HasBits* has_bits) { + (*has_bits)[0] |= 8192u; + } + static void set_has_active_wifi_frequency(HasBits* has_bits) { + (*has_bits)[0] |= 16384u; + } + static void set_has_number_connected_peripherals(HasBits* has_bits) { + (*has_bits)[0] |= 32768u; + } + static void set_has_is_scanned_by_offload_scanner(HasBits* has_bits) { + (*has_bits)[0] |= 131072u; + } + static const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo& key_based_pairing_info(const FastPairLog* msg); + static void set_has_key_based_pairing_info(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_bonding_transport(HasBits* has_bits) { + (*has_bits)[0] |= 65536u; + } + static void set_has_is_first_day_new_user(HasBits* has_bits) { + (*has_bits)[0] |= 262144u; + } + static void set_has_is_seven_days_new_user(HasBits* has_bits) { + (*has_bits)[0] |= 524288u; + } + static void set_has_bonded_device_count(HasBits* has_bits) { + (*has_bits)[0] |= 2097152u; + } + static void set_has_sass_connection_state(HasBits* has_bits) { + (*has_bits)[0] |= 8388608u; + } + static void set_has_is_pair_triggered_by_settings(HasBits* has_bits) { + (*has_bits)[0] |= 1048576u; + } + static void set_has_nearby_mainline_tethering_version(HasBits* has_bits) { + (*has_bits)[0] |= 4194304u; + } + static void set_has_nearby_nano_app_version(HasBits* has_bits) { + (*has_bits)[0] |= 33554432u; + } + static void set_has_is_in_paired_history(HasBits* has_bits) { + (*has_bits)[0] |= 16777216u; + } +}; + +const ::nearby::proto::fastpair::FastPairLog_GattEvent& +FastPairLog::_Internal::gatt_event(const FastPairLog* msg) { + return *msg->gatt_event_; +} +const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent& +FastPairLog::_Internal::br_edr_handover_event(const FastPairLog* msg) { + return *msg->br_edr_handover_event_; +} +const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent& +FastPairLog::_Internal::bond_event(const FastPairLog* msg) { + return *msg->bond_event_; +} +const ::nearby::proto::fastpair::FastPairLog_ConnectEvent& +FastPairLog::_Internal::connect_event(const FastPairLog* msg) { + return *msg->connect_event_; +} +const ::nearby::proto::fastpair::FastPairLog_ProviderInfo& +FastPairLog::_Internal::provider_info(const FastPairLog* msg) { + return *msg->provider_info_; +} +const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo& +FastPairLog::_Internal::footprints_info(const FastPairLog* msg) { + return *msg->footprints_info_; +} +const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo& +FastPairLog::_Internal::key_based_pairing_info(const FastPairLog* msg) { + return *msg->key_based_pairing_info_; +} +FastPairLog::FastPairLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairLog) +} +FastPairLog::FastPairLog(const FastPairLog& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_gatt_event()) { + gatt_event_ = new ::nearby::proto::fastpair::FastPairLog_GattEvent(*from.gatt_event_); + } else { + gatt_event_ = nullptr; + } + if (from._internal_has_br_edr_handover_event()) { + br_edr_handover_event_ = new ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent(*from.br_edr_handover_event_); + } else { + br_edr_handover_event_ = nullptr; + } + if (from._internal_has_bond_event()) { + bond_event_ = new ::nearby::proto::fastpair::FastPairLog_CreateBondEvent(*from.bond_event_); + } else { + bond_event_ = nullptr; + } + if (from._internal_has_connect_event()) { + connect_event_ = new ::nearby::proto::fastpair::FastPairLog_ConnectEvent(*from.connect_event_); + } else { + connect_event_ = nullptr; + } + if (from._internal_has_provider_info()) { + provider_info_ = new ::nearby::proto::fastpair::FastPairLog_ProviderInfo(*from.provider_info_); + } else { + provider_info_ = nullptr; + } + if (from._internal_has_footprints_info()) { + footprints_info_ = new ::nearby::proto::fastpair::FastPairLog_FootprintsInfo(*from.footprints_info_); + } else { + footprints_info_ = nullptr; + } + if (from._internal_has_key_based_pairing_info()) { + key_based_pairing_info_ = new ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo(*from.key_based_pairing_info_); + } else { + key_based_pairing_info_ = nullptr; + } + ::memcpy(&model_id_, &from.model_id_, + static_cast(reinterpret_cast(&nearby_nano_app_version_) - + reinterpret_cast(&model_id_)) + sizeof(nearby_nano_app_version_)); + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairLog) +} + +inline void FastPairLog::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&gatt_event_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&nearby_nano_app_version_) - + reinterpret_cast(&gatt_event_)) + sizeof(nearby_nano_app_version_)); +} + +FastPairLog::~FastPairLog() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairLog) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairLog::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete gatt_event_; + if (this != internal_default_instance()) delete br_edr_handover_event_; + if (this != internal_default_instance()) delete bond_event_; + if (this != internal_default_instance()) delete connect_event_; + if (this != internal_default_instance()) delete provider_info_; + if (this != internal_default_instance()) delete footprints_info_; + if (this != internal_default_instance()) delete key_based_pairing_info_; +} + +void FastPairLog::ArenaDtor(void* object) { + FastPairLog* _this = reinterpret_cast< FastPairLog* >(object); + (void)_this; +} +void FastPairLog::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairLog::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairLog::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairLog) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(gatt_event_ != nullptr); + gatt_event_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(br_edr_handover_event_ != nullptr); + br_edr_handover_event_->Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(bond_event_ != nullptr); + bond_event_->Clear(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(connect_event_ != nullptr); + connect_event_->Clear(); + } + if (cached_has_bits & 0x00000010u) { + GOOGLE_DCHECK(provider_info_ != nullptr); + provider_info_->Clear(); + } + if (cached_has_bits & 0x00000020u) { + GOOGLE_DCHECK(footprints_info_ != nullptr); + footprints_info_->Clear(); + } + if (cached_has_bits & 0x00000040u) { + GOOGLE_DCHECK(key_based_pairing_info_ != nullptr); + key_based_pairing_info_->Clear(); + } + } + model_id_ = 0; + if (cached_has_bits & 0x0000ff00u) { + ::memset(&bond_state_, 0, static_cast( + reinterpret_cast(&number_connected_peripherals_) - + reinterpret_cast(&bond_state_)) + sizeof(number_connected_peripherals_)); + } + if (cached_has_bits & 0x00ff0000u) { + ::memset(&bonding_transport_, 0, static_cast( + reinterpret_cast(&sass_connection_state_) - + reinterpret_cast(&bonding_transport_)) + sizeof(sass_connection_state_)); + } + if (cached_has_bits & 0x03000000u) { + ::memset(&is_in_paired_history_, 0, static_cast( + reinterpret_cast(&nearby_nano_app_version_) - + reinterpret_cast(&is_in_paired_history_)) + sizeof(nearby_nano_app_version_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* FastPairLog::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 model_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_model_id(&has_bits); + model_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairEvent.BondState bond_state = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::FastPairEvent_BondState_IsValid(val))) { + _internal_set_bond_state(static_cast<::nearby::proto::fastpair::FastPairEvent_BondState>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairEvent.ErrorCode error_code = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::FastPairEvent_ErrorCode_IsValid(val))) { + _internal_set_error_code(static_cast<::nearby::proto::fastpair::FastPairEvent_ErrorCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.GattEvent gatt_event = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_gatt_event(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent br_edr_handover_event = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_br_edr_handover_event(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.CreateBondEvent bond_event = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_bond_event(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.ConnectEvent connect_event = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) { + ptr = ctx->ParseMessage(_internal_mutable_connect_event(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 hashed_salted_device_address = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 64)) { + _Internal::set_has_hashed_salted_device_address(&has_bits); + hashed_salted_device_address_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 duration = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) { + _Internal::set_has_duration(&has_bits); + duration_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.ProviderInfo provider_info = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) { + ptr = ctx->ParseMessage(_internal_mutable_provider_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.FootprintsInfo footprints_info = 11; + case 11: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 90)) { + ptr = ctx->ParseMessage(_internal_mutable_footprints_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.DeviceType device_type = 12; + case 12: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 96)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::DeviceType_IsValid(val))) { + _internal_set_device_type(static_cast<::nearby::proto::fastpair::DeviceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(12, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.OsType os_type = 13; + case 13: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 104)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::proto::fastpair::OsType_IsValid(val))) { + _internal_set_os_type(static_cast<::nearby::proto::fastpair::OsType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(13, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 active_wifi_frequency = 14; + case 14: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 112)) { + _Internal::set_has_active_wifi_frequency(&has_bits); + active_wifi_frequency_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 number_connected_peripherals = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 120)) { + _Internal::set_has_number_connected_peripherals(&has_bits); + number_connected_peripherals_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_scanned_by_offload_scanner = 16; + case 16: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 128)) { + _Internal::set_has_is_scanned_by_offload_scanner(&has_bits); + is_scanned_by_offload_scanner_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo key_based_pairing_info = 17; + case 17: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 138)) { + ptr = ctx->ParseMessage(_internal_mutable_key_based_pairing_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional uint32 bonding_transport = 18; + case 18: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 144)) { + _Internal::set_has_bonding_transport(&has_bits); + bonding_transport_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_first_day_new_user = 19; + case 19: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 152)) { + _Internal::set_has_is_first_day_new_user(&has_bits); + is_first_day_new_user_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_seven_days_new_user = 20; + case 20: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 160)) { + _Internal::set_has_is_seven_days_new_user(&has_bits); + is_seven_days_new_user_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional uint32 bonded_device_count = 21; + case 21: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 168)) { + _Internal::set_has_bonded_device_count(&has_bits); + bonded_device_count_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 sass_connection_state = 22; + case 22: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 176)) { + _Internal::set_has_sass_connection_state(&has_bits); + sass_connection_state_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_pair_triggered_by_settings = 23; + case 23: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 184)) { + _Internal::set_has_is_pair_triggered_by_settings(&has_bits); + is_pair_triggered_by_settings_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 nearby_mainline_tethering_version = 24; + case 24: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 192)) { + _Internal::set_has_nearby_mainline_tethering_version(&has_bits); + nearby_mainline_tethering_version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 nearby_nano_app_version = 25; + case 25: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 200)) { + _Internal::set_has_nearby_nano_app_version(&has_bits); + nearby_nano_app_version_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_in_paired_history = 26; + case 26: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 208)) { + _Internal::set_has_is_in_paired_history(&has_bits); + is_in_paired_history_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairLog::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairLog) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 model_id = 1; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_model_id(), target); + } + + // optional .nearby.proto.fastpair.FastPairEvent.BondState bond_state = 2; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_bond_state(), target); + } + + // optional .nearby.proto.fastpair.FastPairEvent.ErrorCode error_code = 3; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_error_code(), target); + } + + // optional .nearby.proto.fastpair.FastPairLog.GattEvent gatt_event = 4; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 4, _Internal::gatt_event(this), target, stream); + } + + // optional .nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent br_edr_handover_event = 5; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 5, _Internal::br_edr_handover_event(this), target, stream); + } + + // optional .nearby.proto.fastpair.FastPairLog.CreateBondEvent bond_event = 6; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 6, _Internal::bond_event(this), target, stream); + } + + // optional .nearby.proto.fastpair.FastPairLog.ConnectEvent connect_event = 7; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 7, _Internal::connect_event(this), target, stream); + } + + // optional int64 hashed_salted_device_address = 8; + if (cached_has_bits & 0x00000800u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(8, this->_internal_hashed_salted_device_address(), target); + } + + // optional int64 duration = 9; + if (cached_has_bits & 0x00001000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(9, this->_internal_duration(), target); + } + + // optional .nearby.proto.fastpair.FastPairLog.ProviderInfo provider_info = 10; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 10, _Internal::provider_info(this), target, stream); + } + + // optional .nearby.proto.fastpair.FastPairLog.FootprintsInfo footprints_info = 11; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 11, _Internal::footprints_info(this), target, stream); + } + + // optional .nearby.proto.fastpair.DeviceType device_type = 12; + if (cached_has_bits & 0x00000400u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 12, this->_internal_device_type(), target); + } + + // optional .nearby.proto.fastpair.OsType os_type = 13; + if (cached_has_bits & 0x00002000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 13, this->_internal_os_type(), target); + } + + // optional int32 active_wifi_frequency = 14; + if (cached_has_bits & 0x00004000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(14, this->_internal_active_wifi_frequency(), target); + } + + // optional int32 number_connected_peripherals = 15; + if (cached_has_bits & 0x00008000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(15, this->_internal_number_connected_peripherals(), target); + } + + // optional bool is_scanned_by_offload_scanner = 16; + if (cached_has_bits & 0x00020000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(16, this->_internal_is_scanned_by_offload_scanner(), target); + } + + // optional .nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo key_based_pairing_info = 17; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 17, _Internal::key_based_pairing_info(this), target, stream); + } + + // optional uint32 bonding_transport = 18; + if (cached_has_bits & 0x00010000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(18, this->_internal_bonding_transport(), target); + } + + // optional bool is_first_day_new_user = 19; + if (cached_has_bits & 0x00040000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(19, this->_internal_is_first_day_new_user(), target); + } + + // optional bool is_seven_days_new_user = 20; + if (cached_has_bits & 0x00080000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(20, this->_internal_is_seven_days_new_user(), target); + } + + // optional uint32 bonded_device_count = 21; + if (cached_has_bits & 0x00200000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(21, this->_internal_bonded_device_count(), target); + } + + // optional int32 sass_connection_state = 22; + if (cached_has_bits & 0x00800000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(22, this->_internal_sass_connection_state(), target); + } + + // optional bool is_pair_triggered_by_settings = 23; + if (cached_has_bits & 0x00100000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(23, this->_internal_is_pair_triggered_by_settings(), target); + } + + // optional int64 nearby_mainline_tethering_version = 24; + if (cached_has_bits & 0x00400000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(24, this->_internal_nearby_mainline_tethering_version(), target); + } + + // optional int64 nearby_nano_app_version = 25; + if (cached_has_bits & 0x02000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(25, this->_internal_nearby_nano_app_version(), target); + } + + // optional bool is_in_paired_history = 26; + if (cached_has_bits & 0x01000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(26, this->_internal_is_in_paired_history(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairLog) + return target; +} + +size_t FastPairLog::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairLog) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + // optional .nearby.proto.fastpair.FastPairLog.GattEvent gatt_event = 4; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *gatt_event_); + } + + // optional .nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent br_edr_handover_event = 5; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *br_edr_handover_event_); + } + + // optional .nearby.proto.fastpair.FastPairLog.CreateBondEvent bond_event = 6; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *bond_event_); + } + + // optional .nearby.proto.fastpair.FastPairLog.ConnectEvent connect_event = 7; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *connect_event_); + } + + // optional .nearby.proto.fastpair.FastPairLog.ProviderInfo provider_info = 10; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *provider_info_); + } + + // optional .nearby.proto.fastpair.FastPairLog.FootprintsInfo footprints_info = 11; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *footprints_info_); + } + + // optional .nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo key_based_pairing_info = 17; + if (cached_has_bits & 0x00000040u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *key_based_pairing_info_); + } + + // optional int32 model_id = 1; + if (cached_has_bits & 0x00000080u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_model_id()); + } + + } + if (cached_has_bits & 0x0000ff00u) { + // optional .nearby.proto.fastpair.FastPairEvent.BondState bond_state = 2; + if (cached_has_bits & 0x00000100u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_bond_state()); + } + + // optional .nearby.proto.fastpair.FastPairEvent.ErrorCode error_code = 3; + if (cached_has_bits & 0x00000200u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_error_code()); + } + + // optional .nearby.proto.fastpair.DeviceType device_type = 12; + if (cached_has_bits & 0x00000400u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_device_type()); + } + + // optional int64 hashed_salted_device_address = 8; + if (cached_has_bits & 0x00000800u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_hashed_salted_device_address()); + } + + // optional int64 duration = 9; + if (cached_has_bits & 0x00001000u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration()); + } + + // optional .nearby.proto.fastpair.OsType os_type = 13; + if (cached_has_bits & 0x00002000u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_os_type()); + } + + // optional int32 active_wifi_frequency = 14; + if (cached_has_bits & 0x00004000u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_active_wifi_frequency()); + } + + // optional int32 number_connected_peripherals = 15; + if (cached_has_bits & 0x00008000u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_number_connected_peripherals()); + } + + } + if (cached_has_bits & 0x00ff0000u) { + // optional uint32 bonding_transport = 18; + if (cached_has_bits & 0x00010000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( + this->_internal_bonding_transport()); + } + + // optional bool is_scanned_by_offload_scanner = 16; + if (cached_has_bits & 0x00020000u) { + total_size += 2 + 1; + } + + // optional bool is_first_day_new_user = 19; + if (cached_has_bits & 0x00040000u) { + total_size += 2 + 1; + } + + // optional bool is_seven_days_new_user = 20; + if (cached_has_bits & 0x00080000u) { + total_size += 2 + 1; + } + + // optional bool is_pair_triggered_by_settings = 23; + if (cached_has_bits & 0x00100000u) { + total_size += 2 + 1; + } + + // optional uint32 bonded_device_count = 21; + if (cached_has_bits & 0x00200000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt32Size( + this->_internal_bonded_device_count()); + } + + // optional int64 nearby_mainline_tethering_version = 24; + if (cached_has_bits & 0x00400000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( + this->_internal_nearby_mainline_tethering_version()); + } + + // optional int32 sass_connection_state = 22; + if (cached_has_bits & 0x00800000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + this->_internal_sass_connection_state()); + } + + } + if (cached_has_bits & 0x03000000u) { + // optional bool is_in_paired_history = 26; + if (cached_has_bits & 0x01000000u) { + total_size += 2 + 1; + } + + // optional int64 nearby_nano_app_version = 25; + if (cached_has_bits & 0x02000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64Size( + this->_internal_nearby_nano_app_version()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairLog::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairLog::MergeFrom(const FastPairLog& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairLog) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_gatt_event()->::nearby::proto::fastpair::FastPairLog_GattEvent::MergeFrom(from._internal_gatt_event()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_br_edr_handover_event()->::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent::MergeFrom(from._internal_br_edr_handover_event()); + } + if (cached_has_bits & 0x00000004u) { + _internal_mutable_bond_event()->::nearby::proto::fastpair::FastPairLog_CreateBondEvent::MergeFrom(from._internal_bond_event()); + } + if (cached_has_bits & 0x00000008u) { + _internal_mutable_connect_event()->::nearby::proto::fastpair::FastPairLog_ConnectEvent::MergeFrom(from._internal_connect_event()); + } + if (cached_has_bits & 0x00000010u) { + _internal_mutable_provider_info()->::nearby::proto::fastpair::FastPairLog_ProviderInfo::MergeFrom(from._internal_provider_info()); + } + if (cached_has_bits & 0x00000020u) { + _internal_mutable_footprints_info()->::nearby::proto::fastpair::FastPairLog_FootprintsInfo::MergeFrom(from._internal_footprints_info()); + } + if (cached_has_bits & 0x00000040u) { + _internal_mutable_key_based_pairing_info()->::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo::MergeFrom(from._internal_key_based_pairing_info()); + } + if (cached_has_bits & 0x00000080u) { + model_id_ = from.model_id_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x0000ff00u) { + if (cached_has_bits & 0x00000100u) { + bond_state_ = from.bond_state_; + } + if (cached_has_bits & 0x00000200u) { + error_code_ = from.error_code_; + } + if (cached_has_bits & 0x00000400u) { + device_type_ = from.device_type_; + } + if (cached_has_bits & 0x00000800u) { + hashed_salted_device_address_ = from.hashed_salted_device_address_; + } + if (cached_has_bits & 0x00001000u) { + duration_ = from.duration_; + } + if (cached_has_bits & 0x00002000u) { + os_type_ = from.os_type_; + } + if (cached_has_bits & 0x00004000u) { + active_wifi_frequency_ = from.active_wifi_frequency_; + } + if (cached_has_bits & 0x00008000u) { + number_connected_peripherals_ = from.number_connected_peripherals_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x00ff0000u) { + if (cached_has_bits & 0x00010000u) { + bonding_transport_ = from.bonding_transport_; + } + if (cached_has_bits & 0x00020000u) { + is_scanned_by_offload_scanner_ = from.is_scanned_by_offload_scanner_; + } + if (cached_has_bits & 0x00040000u) { + is_first_day_new_user_ = from.is_first_day_new_user_; + } + if (cached_has_bits & 0x00080000u) { + is_seven_days_new_user_ = from.is_seven_days_new_user_; + } + if (cached_has_bits & 0x00100000u) { + is_pair_triggered_by_settings_ = from.is_pair_triggered_by_settings_; + } + if (cached_has_bits & 0x00200000u) { + bonded_device_count_ = from.bonded_device_count_; + } + if (cached_has_bits & 0x00400000u) { + nearby_mainline_tethering_version_ = from.nearby_mainline_tethering_version_; + } + if (cached_has_bits & 0x00800000u) { + sass_connection_state_ = from.sass_connection_state_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x03000000u) { + if (cached_has_bits & 0x01000000u) { + is_in_paired_history_ = from.is_in_paired_history_; + } + if (cached_has_bits & 0x02000000u) { + nearby_nano_app_version_ = from.nearby_nano_app_version_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairLog::CopyFrom(const FastPairLog& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairLog) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairLog::IsInitialized() const { + return true; +} + +void FastPairLog::InternalSwap(FastPairLog* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(FastPairLog, nearby_nano_app_version_) + + sizeof(FastPairLog::nearby_nano_app_version_) + - PROTOBUF_FIELD_OFFSET(FastPairLog, gatt_event_)>( + reinterpret_cast(&gatt_event_), + reinterpret_cast(&other->gatt_event_)); +} + +std::string FastPairLog::GetTypeName() const { + return "nearby.proto.fastpair.FastPairLog"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace fastpair +} // namespace proto +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_GattEvent* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_GattEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_GattEvent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_CreateBondEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_CreateBondEvent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_ConnectEvent* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_ConnectEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_ConnectEvent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_ProviderInfo* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_ProviderInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_ProviderInfo >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_FootprintsInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_FootprintsInfo >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairLog* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairLog >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairLog >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/compiled_proto/internal/proto/analytics/fast_pair_log.pb.h b/compiled_proto/internal/proto/analytics/fast_pair_log.pb.h new file mode 100644 index 00000000..8a2a06e1 --- /dev/null +++ b/compiled_proto/internal/proto/analytics/fast_pair_log.pb.h @@ -0,0 +1,3387 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: internal/proto/analytics/fast_pair_log.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3019000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include "proto/fast_pair_enums.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[8] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const uint32_t offsets[]; +}; +namespace nearby { +namespace proto { +namespace fastpair { +class FastPairLog; +struct FastPairLogDefaultTypeInternal; +extern FastPairLogDefaultTypeInternal _FastPairLog_default_instance_; +class FastPairLog_BrEdrHandoverEvent; +struct FastPairLog_BrEdrHandoverEventDefaultTypeInternal; +extern FastPairLog_BrEdrHandoverEventDefaultTypeInternal _FastPairLog_BrEdrHandoverEvent_default_instance_; +class FastPairLog_ConnectEvent; +struct FastPairLog_ConnectEventDefaultTypeInternal; +extern FastPairLog_ConnectEventDefaultTypeInternal _FastPairLog_ConnectEvent_default_instance_; +class FastPairLog_CreateBondEvent; +struct FastPairLog_CreateBondEventDefaultTypeInternal; +extern FastPairLog_CreateBondEventDefaultTypeInternal _FastPairLog_CreateBondEvent_default_instance_; +class FastPairLog_FootprintsInfo; +struct FastPairLog_FootprintsInfoDefaultTypeInternal; +extern FastPairLog_FootprintsInfoDefaultTypeInternal _FastPairLog_FootprintsInfo_default_instance_; +class FastPairLog_GattEvent; +struct FastPairLog_GattEventDefaultTypeInternal; +extern FastPairLog_GattEventDefaultTypeInternal _FastPairLog_GattEvent_default_instance_; +class FastPairLog_KeyBasedPairingInfo; +struct FastPairLog_KeyBasedPairingInfoDefaultTypeInternal; +extern FastPairLog_KeyBasedPairingInfoDefaultTypeInternal _FastPairLog_KeyBasedPairingInfo_default_instance_; +class FastPairLog_ProviderInfo; +struct FastPairLog_ProviderInfoDefaultTypeInternal; +extern FastPairLog_ProviderInfoDefaultTypeInternal _FastPairLog_ProviderInfo_default_instance_; +} // namespace fastpair +} // namespace proto +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> ::nearby::proto::fastpair::FastPairLog* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_ConnectEvent* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_ConnectEvent>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_CreateBondEvent>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_FootprintsInfo>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_GattEvent* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_GattEvent>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo>(Arena*); +template<> ::nearby::proto::fastpair::FastPairLog_ProviderInfo* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_ProviderInfo>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace nearby { +namespace proto { +namespace fastpair { + +// =================================================================== + +class FastPairLog_GattEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.GattEvent) */ { + public: + inline FastPairLog_GattEvent() : FastPairLog_GattEvent(nullptr) {} + ~FastPairLog_GattEvent() override; + explicit constexpr FastPairLog_GattEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_GattEvent(const FastPairLog_GattEvent& from); + FastPairLog_GattEvent(FastPairLog_GattEvent&& from) noexcept + : FastPairLog_GattEvent() { + *this = ::std::move(from); + } + + inline FastPairLog_GattEvent& operator=(const FastPairLog_GattEvent& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_GattEvent& operator=(FastPairLog_GattEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_GattEvent& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_GattEvent* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_GattEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(FastPairLog_GattEvent& a, FastPairLog_GattEvent& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_GattEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_GattEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_GattEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_GattEvent& from); + void MergeFrom(const FastPairLog_GattEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_GattEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.GattEvent"; + } + protected: + explicit FastPairLog_GattEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kErrorFromOsFieldNumber = 1, + }; + // optional int32 error_from_os = 1; + bool has_error_from_os() const; + private: + bool _internal_has_error_from_os() const; + public: + void clear_error_from_os(); + int32_t error_from_os() const; + void set_error_from_os(int32_t value); + private: + int32_t _internal_error_from_os() const; + void _internal_set_error_from_os(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.GattEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int32_t error_from_os_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog_BrEdrHandoverEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) */ { + public: + inline FastPairLog_BrEdrHandoverEvent() : FastPairLog_BrEdrHandoverEvent(nullptr) {} + ~FastPairLog_BrEdrHandoverEvent() override; + explicit constexpr FastPairLog_BrEdrHandoverEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_BrEdrHandoverEvent(const FastPairLog_BrEdrHandoverEvent& from); + FastPairLog_BrEdrHandoverEvent(FastPairLog_BrEdrHandoverEvent&& from) noexcept + : FastPairLog_BrEdrHandoverEvent() { + *this = ::std::move(from); + } + + inline FastPairLog_BrEdrHandoverEvent& operator=(const FastPairLog_BrEdrHandoverEvent& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_BrEdrHandoverEvent& operator=(FastPairLog_BrEdrHandoverEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_BrEdrHandoverEvent& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_BrEdrHandoverEvent* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_BrEdrHandoverEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(FastPairLog_BrEdrHandoverEvent& a, FastPairLog_BrEdrHandoverEvent& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_BrEdrHandoverEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_BrEdrHandoverEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_BrEdrHandoverEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_BrEdrHandoverEvent& from); + void MergeFrom(const FastPairLog_BrEdrHandoverEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_BrEdrHandoverEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent"; + } + protected: + explicit FastPairLog_BrEdrHandoverEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kErrorCodeFieldNumber = 1, + }; + // optional .nearby.proto.fastpair.FastPairEvent.BrEdrHandoverErrorCode error_code = 1; + bool has_error_code() const; + private: + bool _internal_has_error_code() const; + public: + void clear_error_code(); + ::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode error_code() const; + void set_error_code(::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode value); + private: + ::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode _internal_error_code() const; + void _internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int error_code_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog_CreateBondEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.CreateBondEvent) */ { + public: + inline FastPairLog_CreateBondEvent() : FastPairLog_CreateBondEvent(nullptr) {} + ~FastPairLog_CreateBondEvent() override; + explicit constexpr FastPairLog_CreateBondEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_CreateBondEvent(const FastPairLog_CreateBondEvent& from); + FastPairLog_CreateBondEvent(FastPairLog_CreateBondEvent&& from) noexcept + : FastPairLog_CreateBondEvent() { + *this = ::std::move(from); + } + + inline FastPairLog_CreateBondEvent& operator=(const FastPairLog_CreateBondEvent& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_CreateBondEvent& operator=(FastPairLog_CreateBondEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_CreateBondEvent& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_CreateBondEvent* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_CreateBondEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(FastPairLog_CreateBondEvent& a, FastPairLog_CreateBondEvent& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_CreateBondEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_CreateBondEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_CreateBondEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_CreateBondEvent& from); + void MergeFrom(const FastPairLog_CreateBondEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_CreateBondEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.CreateBondEvent"; + } + protected: + explicit FastPairLog_CreateBondEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kErrorCodeFieldNumber = 1, + kUnbondReasonFieldNumber = 2, + }; + // optional .nearby.proto.fastpair.FastPairEvent.CreateBondErrorCode error_code = 1; + bool has_error_code() const; + private: + bool _internal_has_error_code() const; + public: + void clear_error_code(); + ::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode error_code() const; + void set_error_code(::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode value); + private: + ::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode _internal_error_code() const; + void _internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode value); + public: + + // optional int32 unbond_reason = 2; + bool has_unbond_reason() const; + private: + bool _internal_has_unbond_reason() const; + public: + void clear_unbond_reason(); + int32_t unbond_reason() const; + void set_unbond_reason(int32_t value); + private: + int32_t _internal_unbond_reason() const; + void _internal_set_unbond_reason(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.CreateBondEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int error_code_; + int32_t unbond_reason_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog_ConnectEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.ConnectEvent) */ { + public: + inline FastPairLog_ConnectEvent() : FastPairLog_ConnectEvent(nullptr) {} + ~FastPairLog_ConnectEvent() override; + explicit constexpr FastPairLog_ConnectEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_ConnectEvent(const FastPairLog_ConnectEvent& from); + FastPairLog_ConnectEvent(FastPairLog_ConnectEvent&& from) noexcept + : FastPairLog_ConnectEvent() { + *this = ::std::move(from); + } + + inline FastPairLog_ConnectEvent& operator=(const FastPairLog_ConnectEvent& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_ConnectEvent& operator=(FastPairLog_ConnectEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_ConnectEvent& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_ConnectEvent* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_ConnectEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(FastPairLog_ConnectEvent& a, FastPairLog_ConnectEvent& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_ConnectEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_ConnectEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_ConnectEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_ConnectEvent& from); + void MergeFrom(const FastPairLog_ConnectEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_ConnectEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.ConnectEvent"; + } + protected: + explicit FastPairLog_ConnectEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kErrorCodeFieldNumber = 1, + kProfileUuidFieldNumber = 2, + }; + // optional .nearby.proto.fastpair.FastPairEvent.ConnectErrorCode error_code = 1; + bool has_error_code() const; + private: + bool _internal_has_error_code() const; + public: + void clear_error_code(); + ::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode error_code() const; + void set_error_code(::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode value); + private: + ::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode _internal_error_code() const; + void _internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode value); + public: + + // optional int32 profile_uuid = 2; + bool has_profile_uuid() const; + private: + bool _internal_has_profile_uuid() const; + public: + void clear_profile_uuid(); + int32_t profile_uuid() const; + void set_profile_uuid(int32_t value); + private: + int32_t _internal_profile_uuid() const; + void _internal_set_profile_uuid(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.ConnectEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int error_code_; + int32_t profile_uuid_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog_ProviderInfo final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.ProviderInfo) */ { + public: + inline FastPairLog_ProviderInfo() : FastPairLog_ProviderInfo(nullptr) {} + ~FastPairLog_ProviderInfo() override; + explicit constexpr FastPairLog_ProviderInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_ProviderInfo(const FastPairLog_ProviderInfo& from); + FastPairLog_ProviderInfo(FastPairLog_ProviderInfo&& from) noexcept + : FastPairLog_ProviderInfo() { + *this = ::std::move(from); + } + + inline FastPairLog_ProviderInfo& operator=(const FastPairLog_ProviderInfo& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_ProviderInfo& operator=(FastPairLog_ProviderInfo&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_ProviderInfo& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_ProviderInfo* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_ProviderInfo_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(FastPairLog_ProviderInfo& a, FastPairLog_ProviderInfo& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_ProviderInfo* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_ProviderInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_ProviderInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_ProviderInfo& from); + void MergeFrom(const FastPairLog_ProviderInfo& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_ProviderInfo* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.ProviderInfo"; + } + protected: + explicit FastPairLog_ProviderInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDatabaseHashFieldNumber = 2, + kNumberAccountKeysOnProviderFieldNumber = 1, + }; + // optional string database_hash = 2; + bool has_database_hash() const; + private: + bool _internal_has_database_hash() const; + public: + void clear_database_hash(); + const std::string& database_hash() const; + template + void set_database_hash(ArgT0&& arg0, ArgT... args); + std::string* mutable_database_hash(); + PROTOBUF_NODISCARD std::string* release_database_hash(); + void set_allocated_database_hash(std::string* database_hash); + private: + const std::string& _internal_database_hash() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_database_hash(const std::string& value); + std::string* _internal_mutable_database_hash(); + public: + + // optional int32 number_account_keys_on_provider = 1; + bool has_number_account_keys_on_provider() const; + private: + bool _internal_has_number_account_keys_on_provider() const; + public: + void clear_number_account_keys_on_provider(); + int32_t number_account_keys_on_provider() const; + void set_number_account_keys_on_provider(int32_t value); + private: + int32_t _internal_number_account_keys_on_provider() const; + void _internal_set_number_account_keys_on_provider(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.ProviderInfo) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr database_hash_; + int32_t number_account_keys_on_provider_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog_FootprintsInfo final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.FootprintsInfo) */ { + public: + inline FastPairLog_FootprintsInfo() : FastPairLog_FootprintsInfo(nullptr) {} + ~FastPairLog_FootprintsInfo() override; + explicit constexpr FastPairLog_FootprintsInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_FootprintsInfo(const FastPairLog_FootprintsInfo& from); + FastPairLog_FootprintsInfo(FastPairLog_FootprintsInfo&& from) noexcept + : FastPairLog_FootprintsInfo() { + *this = ::std::move(from); + } + + inline FastPairLog_FootprintsInfo& operator=(const FastPairLog_FootprintsInfo& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_FootprintsInfo& operator=(FastPairLog_FootprintsInfo&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_FootprintsInfo& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_FootprintsInfo* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_FootprintsInfo_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(FastPairLog_FootprintsInfo& a, FastPairLog_FootprintsInfo& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_FootprintsInfo* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_FootprintsInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_FootprintsInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_FootprintsInfo& from); + void MergeFrom(const FastPairLog_FootprintsInfo& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_FootprintsInfo* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.FootprintsInfo"; + } + protected: + explicit FastPairLog_FootprintsInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNumberDevicesOnFootprintsFieldNumber = 1, + }; + // optional int32 number_devices_on_footprints = 1; + bool has_number_devices_on_footprints() const; + private: + bool _internal_has_number_devices_on_footprints() const; + public: + void clear_number_devices_on_footprints(); + int32_t number_devices_on_footprints() const; + void set_number_devices_on_footprints(int32_t value); + private: + int32_t _internal_number_devices_on_footprints() const; + void _internal_set_number_devices_on_footprints(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.FootprintsInfo) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int32_t number_devices_on_footprints_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog_KeyBasedPairingInfo final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) */ { + public: + inline FastPairLog_KeyBasedPairingInfo() : FastPairLog_KeyBasedPairingInfo(nullptr) {} + ~FastPairLog_KeyBasedPairingInfo() override; + explicit constexpr FastPairLog_KeyBasedPairingInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog_KeyBasedPairingInfo(const FastPairLog_KeyBasedPairingInfo& from); + FastPairLog_KeyBasedPairingInfo(FastPairLog_KeyBasedPairingInfo&& from) noexcept + : FastPairLog_KeyBasedPairingInfo() { + *this = ::std::move(from); + } + + inline FastPairLog_KeyBasedPairingInfo& operator=(const FastPairLog_KeyBasedPairingInfo& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog_KeyBasedPairingInfo& operator=(FastPairLog_KeyBasedPairingInfo&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog_KeyBasedPairingInfo& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog_KeyBasedPairingInfo* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_KeyBasedPairingInfo_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(FastPairLog_KeyBasedPairingInfo& a, FastPairLog_KeyBasedPairingInfo& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog_KeyBasedPairingInfo* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog_KeyBasedPairingInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog_KeyBasedPairingInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog_KeyBasedPairingInfo& from); + void MergeFrom(const FastPairLog_KeyBasedPairingInfo& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog_KeyBasedPairingInfo* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo"; + } + protected: + explicit FastPairLog_KeyBasedPairingInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kRequestFlagFieldNumber = 1, + kResponseTypeFieldNumber = 2, + kResponseFlagFieldNumber = 3, + kResponseDeviceCountFieldNumber = 4, + }; + // optional uint32 request_flag = 1; + bool has_request_flag() const; + private: + bool _internal_has_request_flag() const; + public: + void clear_request_flag(); + uint32_t request_flag() const; + void set_request_flag(uint32_t value); + private: + uint32_t _internal_request_flag() const; + void _internal_set_request_flag(uint32_t value); + public: + + // optional uint32 response_type = 2; + bool has_response_type() const; + private: + bool _internal_has_response_type() const; + public: + void clear_response_type(); + uint32_t response_type() const; + void set_response_type(uint32_t value); + private: + uint32_t _internal_response_type() const; + void _internal_set_response_type(uint32_t value); + public: + + // optional uint32 response_flag = 3; + bool has_response_flag() const; + private: + bool _internal_has_response_flag() const; + public: + void clear_response_flag(); + uint32_t response_flag() const; + void set_response_flag(uint32_t value); + private: + uint32_t _internal_response_flag() const; + void _internal_set_response_flag(uint32_t value); + public: + + // optional uint32 response_device_count = 4; + bool has_response_device_count() const; + private: + bool _internal_has_response_device_count() const; + public: + void clear_response_device_count(); + uint32_t response_device_count() const; + void set_response_device_count(uint32_t value); + private: + uint32_t _internal_response_device_count() const; + void _internal_set_response_device_count(uint32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + uint32_t request_flag_; + uint32_t response_type_; + uint32_t response_flag_; + uint32_t response_device_count_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class FastPairLog final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairLog) */ { + public: + inline FastPairLog() : FastPairLog(nullptr) {} + ~FastPairLog() override; + explicit constexpr FastPairLog(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairLog(const FastPairLog& from); + FastPairLog(FastPairLog&& from) noexcept + : FastPairLog() { + *this = ::std::move(from); + } + + inline FastPairLog& operator=(const FastPairLog& from) { + CopyFrom(from); + return *this; + } + inline FastPairLog& operator=(FastPairLog&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairLog& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairLog* internal_default_instance() { + return reinterpret_cast( + &_FastPairLog_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(FastPairLog& a, FastPairLog& b) { + a.Swap(&b); + } + inline void Swap(FastPairLog* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairLog* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairLog* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairLog& from); + void MergeFrom(const FastPairLog& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairLog* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairLog"; + } + protected: + explicit FastPairLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef FastPairLog_GattEvent GattEvent; + typedef FastPairLog_BrEdrHandoverEvent BrEdrHandoverEvent; + typedef FastPairLog_CreateBondEvent CreateBondEvent; + typedef FastPairLog_ConnectEvent ConnectEvent; + typedef FastPairLog_ProviderInfo ProviderInfo; + typedef FastPairLog_FootprintsInfo FootprintsInfo; + typedef FastPairLog_KeyBasedPairingInfo KeyBasedPairingInfo; + + // accessors ------------------------------------------------------- + + enum : int { + kGattEventFieldNumber = 4, + kBrEdrHandoverEventFieldNumber = 5, + kBondEventFieldNumber = 6, + kConnectEventFieldNumber = 7, + kProviderInfoFieldNumber = 10, + kFootprintsInfoFieldNumber = 11, + kKeyBasedPairingInfoFieldNumber = 17, + kModelIdFieldNumber = 1, + kBondStateFieldNumber = 2, + kErrorCodeFieldNumber = 3, + kDeviceTypeFieldNumber = 12, + kHashedSaltedDeviceAddressFieldNumber = 8, + kDurationFieldNumber = 9, + kOsTypeFieldNumber = 13, + kActiveWifiFrequencyFieldNumber = 14, + kNumberConnectedPeripheralsFieldNumber = 15, + kBondingTransportFieldNumber = 18, + kIsScannedByOffloadScannerFieldNumber = 16, + kIsFirstDayNewUserFieldNumber = 19, + kIsSevenDaysNewUserFieldNumber = 20, + kIsPairTriggeredBySettingsFieldNumber = 23, + kBondedDeviceCountFieldNumber = 21, + kNearbyMainlineTetheringVersionFieldNumber = 24, + kSassConnectionStateFieldNumber = 22, + kIsInPairedHistoryFieldNumber = 26, + kNearbyNanoAppVersionFieldNumber = 25, + }; + // optional .nearby.proto.fastpair.FastPairLog.GattEvent gatt_event = 4; + bool has_gatt_event() const; + private: + bool _internal_has_gatt_event() const; + public: + void clear_gatt_event(); + const ::nearby::proto::fastpair::FastPairLog_GattEvent& gatt_event() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_GattEvent* release_gatt_event(); + ::nearby::proto::fastpair::FastPairLog_GattEvent* mutable_gatt_event(); + void set_allocated_gatt_event(::nearby::proto::fastpair::FastPairLog_GattEvent* gatt_event); + private: + const ::nearby::proto::fastpair::FastPairLog_GattEvent& _internal_gatt_event() const; + ::nearby::proto::fastpair::FastPairLog_GattEvent* _internal_mutable_gatt_event(); + public: + void unsafe_arena_set_allocated_gatt_event( + ::nearby::proto::fastpair::FastPairLog_GattEvent* gatt_event); + ::nearby::proto::fastpair::FastPairLog_GattEvent* unsafe_arena_release_gatt_event(); + + // optional .nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent br_edr_handover_event = 5; + bool has_br_edr_handover_event() const; + private: + bool _internal_has_br_edr_handover_event() const; + public: + void clear_br_edr_handover_event(); + const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent& br_edr_handover_event() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* release_br_edr_handover_event(); + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* mutable_br_edr_handover_event(); + void set_allocated_br_edr_handover_event(::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* br_edr_handover_event); + private: + const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent& _internal_br_edr_handover_event() const; + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* _internal_mutable_br_edr_handover_event(); + public: + void unsafe_arena_set_allocated_br_edr_handover_event( + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* br_edr_handover_event); + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* unsafe_arena_release_br_edr_handover_event(); + + // optional .nearby.proto.fastpair.FastPairLog.CreateBondEvent bond_event = 6; + bool has_bond_event() const; + private: + bool _internal_has_bond_event() const; + public: + void clear_bond_event(); + const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent& bond_event() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* release_bond_event(); + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* mutable_bond_event(); + void set_allocated_bond_event(::nearby::proto::fastpair::FastPairLog_CreateBondEvent* bond_event); + private: + const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent& _internal_bond_event() const; + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* _internal_mutable_bond_event(); + public: + void unsafe_arena_set_allocated_bond_event( + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* bond_event); + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* unsafe_arena_release_bond_event(); + + // optional .nearby.proto.fastpair.FastPairLog.ConnectEvent connect_event = 7; + bool has_connect_event() const; + private: + bool _internal_has_connect_event() const; + public: + void clear_connect_event(); + const ::nearby::proto::fastpair::FastPairLog_ConnectEvent& connect_event() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_ConnectEvent* release_connect_event(); + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* mutable_connect_event(); + void set_allocated_connect_event(::nearby::proto::fastpair::FastPairLog_ConnectEvent* connect_event); + private: + const ::nearby::proto::fastpair::FastPairLog_ConnectEvent& _internal_connect_event() const; + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* _internal_mutable_connect_event(); + public: + void unsafe_arena_set_allocated_connect_event( + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* connect_event); + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* unsafe_arena_release_connect_event(); + + // optional .nearby.proto.fastpair.FastPairLog.ProviderInfo provider_info = 10; + bool has_provider_info() const; + private: + bool _internal_has_provider_info() const; + public: + void clear_provider_info(); + const ::nearby::proto::fastpair::FastPairLog_ProviderInfo& provider_info() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_ProviderInfo* release_provider_info(); + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* mutable_provider_info(); + void set_allocated_provider_info(::nearby::proto::fastpair::FastPairLog_ProviderInfo* provider_info); + private: + const ::nearby::proto::fastpair::FastPairLog_ProviderInfo& _internal_provider_info() const; + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* _internal_mutable_provider_info(); + public: + void unsafe_arena_set_allocated_provider_info( + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* provider_info); + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* unsafe_arena_release_provider_info(); + + // optional .nearby.proto.fastpair.FastPairLog.FootprintsInfo footprints_info = 11; + bool has_footprints_info() const; + private: + bool _internal_has_footprints_info() const; + public: + void clear_footprints_info(); + const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo& footprints_info() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* release_footprints_info(); + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* mutable_footprints_info(); + void set_allocated_footprints_info(::nearby::proto::fastpair::FastPairLog_FootprintsInfo* footprints_info); + private: + const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo& _internal_footprints_info() const; + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* _internal_mutable_footprints_info(); + public: + void unsafe_arena_set_allocated_footprints_info( + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* footprints_info); + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* unsafe_arena_release_footprints_info(); + + // optional .nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo key_based_pairing_info = 17; + bool has_key_based_pairing_info() const; + private: + bool _internal_has_key_based_pairing_info() const; + public: + void clear_key_based_pairing_info(); + const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo& key_based_pairing_info() const; + PROTOBUF_NODISCARD ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* release_key_based_pairing_info(); + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* mutable_key_based_pairing_info(); + void set_allocated_key_based_pairing_info(::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* key_based_pairing_info); + private: + const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo& _internal_key_based_pairing_info() const; + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* _internal_mutable_key_based_pairing_info(); + public: + void unsafe_arena_set_allocated_key_based_pairing_info( + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* key_based_pairing_info); + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* unsafe_arena_release_key_based_pairing_info(); + + // optional int32 model_id = 1; + bool has_model_id() const; + private: + bool _internal_has_model_id() const; + public: + void clear_model_id(); + int32_t model_id() const; + void set_model_id(int32_t value); + private: + int32_t _internal_model_id() const; + void _internal_set_model_id(int32_t value); + public: + + // optional .nearby.proto.fastpair.FastPairEvent.BondState bond_state = 2; + bool has_bond_state() const; + private: + bool _internal_has_bond_state() const; + public: + void clear_bond_state(); + ::nearby::proto::fastpair::FastPairEvent_BondState bond_state() const; + void set_bond_state(::nearby::proto::fastpair::FastPairEvent_BondState value); + private: + ::nearby::proto::fastpair::FastPairEvent_BondState _internal_bond_state() const; + void _internal_set_bond_state(::nearby::proto::fastpair::FastPairEvent_BondState value); + public: + + // optional .nearby.proto.fastpair.FastPairEvent.ErrorCode error_code = 3; + bool has_error_code() const; + private: + bool _internal_has_error_code() const; + public: + void clear_error_code(); + ::nearby::proto::fastpair::FastPairEvent_ErrorCode error_code() const; + void set_error_code(::nearby::proto::fastpair::FastPairEvent_ErrorCode value); + private: + ::nearby::proto::fastpair::FastPairEvent_ErrorCode _internal_error_code() const; + void _internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_ErrorCode value); + public: + + // optional .nearby.proto.fastpair.DeviceType device_type = 12; + bool has_device_type() const; + private: + bool _internal_has_device_type() const; + public: + void clear_device_type(); + ::nearby::proto::fastpair::DeviceType device_type() const; + void set_device_type(::nearby::proto::fastpair::DeviceType value); + private: + ::nearby::proto::fastpair::DeviceType _internal_device_type() const; + void _internal_set_device_type(::nearby::proto::fastpair::DeviceType value); + public: + + // optional int64 hashed_salted_device_address = 8; + bool has_hashed_salted_device_address() const; + private: + bool _internal_has_hashed_salted_device_address() const; + public: + void clear_hashed_salted_device_address(); + int64_t hashed_salted_device_address() const; + void set_hashed_salted_device_address(int64_t value); + private: + int64_t _internal_hashed_salted_device_address() const; + void _internal_set_hashed_salted_device_address(int64_t value); + public: + + // optional int64 duration = 9; + bool has_duration() const; + private: + bool _internal_has_duration() const; + public: + void clear_duration(); + int64_t duration() const; + void set_duration(int64_t value); + private: + int64_t _internal_duration() const; + void _internal_set_duration(int64_t value); + public: + + // optional .nearby.proto.fastpair.OsType os_type = 13; + bool has_os_type() const; + private: + bool _internal_has_os_type() const; + public: + void clear_os_type(); + ::nearby::proto::fastpair::OsType os_type() const; + void set_os_type(::nearby::proto::fastpair::OsType value); + private: + ::nearby::proto::fastpair::OsType _internal_os_type() const; + void _internal_set_os_type(::nearby::proto::fastpair::OsType value); + public: + + // optional int32 active_wifi_frequency = 14; + bool has_active_wifi_frequency() const; + private: + bool _internal_has_active_wifi_frequency() const; + public: + void clear_active_wifi_frequency(); + int32_t active_wifi_frequency() const; + void set_active_wifi_frequency(int32_t value); + private: + int32_t _internal_active_wifi_frequency() const; + void _internal_set_active_wifi_frequency(int32_t value); + public: + + // optional int32 number_connected_peripherals = 15; + bool has_number_connected_peripherals() const; + private: + bool _internal_has_number_connected_peripherals() const; + public: + void clear_number_connected_peripherals(); + int32_t number_connected_peripherals() const; + void set_number_connected_peripherals(int32_t value); + private: + int32_t _internal_number_connected_peripherals() const; + void _internal_set_number_connected_peripherals(int32_t value); + public: + + // optional uint32 bonding_transport = 18; + bool has_bonding_transport() const; + private: + bool _internal_has_bonding_transport() const; + public: + void clear_bonding_transport(); + uint32_t bonding_transport() const; + void set_bonding_transport(uint32_t value); + private: + uint32_t _internal_bonding_transport() const; + void _internal_set_bonding_transport(uint32_t value); + public: + + // optional bool is_scanned_by_offload_scanner = 16; + bool has_is_scanned_by_offload_scanner() const; + private: + bool _internal_has_is_scanned_by_offload_scanner() const; + public: + void clear_is_scanned_by_offload_scanner(); + bool is_scanned_by_offload_scanner() const; + void set_is_scanned_by_offload_scanner(bool value); + private: + bool _internal_is_scanned_by_offload_scanner() const; + void _internal_set_is_scanned_by_offload_scanner(bool value); + public: + + // optional bool is_first_day_new_user = 19; + bool has_is_first_day_new_user() const; + private: + bool _internal_has_is_first_day_new_user() const; + public: + void clear_is_first_day_new_user(); + bool is_first_day_new_user() const; + void set_is_first_day_new_user(bool value); + private: + bool _internal_is_first_day_new_user() const; + void _internal_set_is_first_day_new_user(bool value); + public: + + // optional bool is_seven_days_new_user = 20; + bool has_is_seven_days_new_user() const; + private: + bool _internal_has_is_seven_days_new_user() const; + public: + void clear_is_seven_days_new_user(); + bool is_seven_days_new_user() const; + void set_is_seven_days_new_user(bool value); + private: + bool _internal_is_seven_days_new_user() const; + void _internal_set_is_seven_days_new_user(bool value); + public: + + // optional bool is_pair_triggered_by_settings = 23; + bool has_is_pair_triggered_by_settings() const; + private: + bool _internal_has_is_pair_triggered_by_settings() const; + public: + void clear_is_pair_triggered_by_settings(); + bool is_pair_triggered_by_settings() const; + void set_is_pair_triggered_by_settings(bool value); + private: + bool _internal_is_pair_triggered_by_settings() const; + void _internal_set_is_pair_triggered_by_settings(bool value); + public: + + // optional uint32 bonded_device_count = 21; + bool has_bonded_device_count() const; + private: + bool _internal_has_bonded_device_count() const; + public: + void clear_bonded_device_count(); + uint32_t bonded_device_count() const; + void set_bonded_device_count(uint32_t value); + private: + uint32_t _internal_bonded_device_count() const; + void _internal_set_bonded_device_count(uint32_t value); + public: + + // optional int64 nearby_mainline_tethering_version = 24; + bool has_nearby_mainline_tethering_version() const; + private: + bool _internal_has_nearby_mainline_tethering_version() const; + public: + void clear_nearby_mainline_tethering_version(); + int64_t nearby_mainline_tethering_version() const; + void set_nearby_mainline_tethering_version(int64_t value); + private: + int64_t _internal_nearby_mainline_tethering_version() const; + void _internal_set_nearby_mainline_tethering_version(int64_t value); + public: + + // optional int32 sass_connection_state = 22; + bool has_sass_connection_state() const; + private: + bool _internal_has_sass_connection_state() const; + public: + void clear_sass_connection_state(); + int32_t sass_connection_state() const; + void set_sass_connection_state(int32_t value); + private: + int32_t _internal_sass_connection_state() const; + void _internal_set_sass_connection_state(int32_t value); + public: + + // optional bool is_in_paired_history = 26; + bool has_is_in_paired_history() const; + private: + bool _internal_has_is_in_paired_history() const; + public: + void clear_is_in_paired_history(); + bool is_in_paired_history() const; + void set_is_in_paired_history(bool value); + private: + bool _internal_is_in_paired_history() const; + void _internal_set_is_in_paired_history(bool value); + public: + + // optional int64 nearby_nano_app_version = 25; + bool has_nearby_nano_app_version() const; + private: + bool _internal_has_nearby_nano_app_version() const; + public: + void clear_nearby_nano_app_version(); + int64_t nearby_nano_app_version() const; + void set_nearby_nano_app_version(int64_t value); + private: + int64_t _internal_nearby_nano_app_version() const; + void _internal_set_nearby_nano_app_version(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairLog) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::proto::fastpair::FastPairLog_GattEvent* gatt_event_; + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* br_edr_handover_event_; + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* bond_event_; + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* connect_event_; + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* provider_info_; + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* footprints_info_; + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* key_based_pairing_info_; + int32_t model_id_; + int bond_state_; + int error_code_; + int device_type_; + int64_t hashed_salted_device_address_; + int64_t duration_; + int os_type_; + int32_t active_wifi_frequency_; + int32_t number_connected_peripherals_; + uint32_t bonding_transport_; + bool is_scanned_by_offload_scanner_; + bool is_first_day_new_user_; + bool is_seven_days_new_user_; + bool is_pair_triggered_by_settings_; + uint32_t bonded_device_count_; + int64_t nearby_mainline_tethering_version_; + int32_t sass_connection_state_; + bool is_in_paired_history_; + int64_t nearby_nano_app_version_; + friend struct ::TableStruct_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// FastPairLog_GattEvent + +// optional int32 error_from_os = 1; +inline bool FastPairLog_GattEvent::_internal_has_error_from_os() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_GattEvent::has_error_from_os() const { + return _internal_has_error_from_os(); +} +inline void FastPairLog_GattEvent::clear_error_from_os() { + error_from_os_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline int32_t FastPairLog_GattEvent::_internal_error_from_os() const { + return error_from_os_; +} +inline int32_t FastPairLog_GattEvent::error_from_os() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.GattEvent.error_from_os) + return _internal_error_from_os(); +} +inline void FastPairLog_GattEvent::_internal_set_error_from_os(int32_t value) { + _has_bits_[0] |= 0x00000001u; + error_from_os_ = value; +} +inline void FastPairLog_GattEvent::set_error_from_os(int32_t value) { + _internal_set_error_from_os(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.GattEvent.error_from_os) +} + +// ------------------------------------------------------------------- + +// FastPairLog_BrEdrHandoverEvent + +// optional .nearby.proto.fastpair.FastPairEvent.BrEdrHandoverErrorCode error_code = 1; +inline bool FastPairLog_BrEdrHandoverEvent::_internal_has_error_code() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_BrEdrHandoverEvent::has_error_code() const { + return _internal_has_error_code(); +} +inline void FastPairLog_BrEdrHandoverEvent::clear_error_code() { + error_code_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode FastPairLog_BrEdrHandoverEvent::_internal_error_code() const { + return static_cast< ::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode >(error_code_); +} +inline ::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode FastPairLog_BrEdrHandoverEvent::error_code() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent.error_code) + return _internal_error_code(); +} +inline void FastPairLog_BrEdrHandoverEvent::_internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode value) { + assert(::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + error_code_ = value; +} +inline void FastPairLog_BrEdrHandoverEvent::set_error_code(::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode value) { + _internal_set_error_code(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent.error_code) +} + +// ------------------------------------------------------------------- + +// FastPairLog_CreateBondEvent + +// optional .nearby.proto.fastpair.FastPairEvent.CreateBondErrorCode error_code = 1; +inline bool FastPairLog_CreateBondEvent::_internal_has_error_code() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_CreateBondEvent::has_error_code() const { + return _internal_has_error_code(); +} +inline void FastPairLog_CreateBondEvent::clear_error_code() { + error_code_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode FastPairLog_CreateBondEvent::_internal_error_code() const { + return static_cast< ::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode >(error_code_); +} +inline ::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode FastPairLog_CreateBondEvent::error_code() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.CreateBondEvent.error_code) + return _internal_error_code(); +} +inline void FastPairLog_CreateBondEvent::_internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode value) { + assert(::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + error_code_ = value; +} +inline void FastPairLog_CreateBondEvent::set_error_code(::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode value) { + _internal_set_error_code(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.CreateBondEvent.error_code) +} + +// optional int32 unbond_reason = 2; +inline bool FastPairLog_CreateBondEvent::_internal_has_unbond_reason() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool FastPairLog_CreateBondEvent::has_unbond_reason() const { + return _internal_has_unbond_reason(); +} +inline void FastPairLog_CreateBondEvent::clear_unbond_reason() { + unbond_reason_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline int32_t FastPairLog_CreateBondEvent::_internal_unbond_reason() const { + return unbond_reason_; +} +inline int32_t FastPairLog_CreateBondEvent::unbond_reason() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.CreateBondEvent.unbond_reason) + return _internal_unbond_reason(); +} +inline void FastPairLog_CreateBondEvent::_internal_set_unbond_reason(int32_t value) { + _has_bits_[0] |= 0x00000002u; + unbond_reason_ = value; +} +inline void FastPairLog_CreateBondEvent::set_unbond_reason(int32_t value) { + _internal_set_unbond_reason(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.CreateBondEvent.unbond_reason) +} + +// ------------------------------------------------------------------- + +// FastPairLog_ConnectEvent + +// optional .nearby.proto.fastpair.FastPairEvent.ConnectErrorCode error_code = 1; +inline bool FastPairLog_ConnectEvent::_internal_has_error_code() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_ConnectEvent::has_error_code() const { + return _internal_has_error_code(); +} +inline void FastPairLog_ConnectEvent::clear_error_code() { + error_code_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode FastPairLog_ConnectEvent::_internal_error_code() const { + return static_cast< ::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode >(error_code_); +} +inline ::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode FastPairLog_ConnectEvent::error_code() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.ConnectEvent.error_code) + return _internal_error_code(); +} +inline void FastPairLog_ConnectEvent::_internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode value) { + assert(::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + error_code_ = value; +} +inline void FastPairLog_ConnectEvent::set_error_code(::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode value) { + _internal_set_error_code(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.ConnectEvent.error_code) +} + +// optional int32 profile_uuid = 2; +inline bool FastPairLog_ConnectEvent::_internal_has_profile_uuid() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool FastPairLog_ConnectEvent::has_profile_uuid() const { + return _internal_has_profile_uuid(); +} +inline void FastPairLog_ConnectEvent::clear_profile_uuid() { + profile_uuid_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline int32_t FastPairLog_ConnectEvent::_internal_profile_uuid() const { + return profile_uuid_; +} +inline int32_t FastPairLog_ConnectEvent::profile_uuid() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.ConnectEvent.profile_uuid) + return _internal_profile_uuid(); +} +inline void FastPairLog_ConnectEvent::_internal_set_profile_uuid(int32_t value) { + _has_bits_[0] |= 0x00000002u; + profile_uuid_ = value; +} +inline void FastPairLog_ConnectEvent::set_profile_uuid(int32_t value) { + _internal_set_profile_uuid(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.ConnectEvent.profile_uuid) +} + +// ------------------------------------------------------------------- + +// FastPairLog_ProviderInfo + +// optional int32 number_account_keys_on_provider = 1; +inline bool FastPairLog_ProviderInfo::_internal_has_number_account_keys_on_provider() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool FastPairLog_ProviderInfo::has_number_account_keys_on_provider() const { + return _internal_has_number_account_keys_on_provider(); +} +inline void FastPairLog_ProviderInfo::clear_number_account_keys_on_provider() { + number_account_keys_on_provider_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline int32_t FastPairLog_ProviderInfo::_internal_number_account_keys_on_provider() const { + return number_account_keys_on_provider_; +} +inline int32_t FastPairLog_ProviderInfo::number_account_keys_on_provider() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.ProviderInfo.number_account_keys_on_provider) + return _internal_number_account_keys_on_provider(); +} +inline void FastPairLog_ProviderInfo::_internal_set_number_account_keys_on_provider(int32_t value) { + _has_bits_[0] |= 0x00000002u; + number_account_keys_on_provider_ = value; +} +inline void FastPairLog_ProviderInfo::set_number_account_keys_on_provider(int32_t value) { + _internal_set_number_account_keys_on_provider(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.ProviderInfo.number_account_keys_on_provider) +} + +// optional string database_hash = 2; +inline bool FastPairLog_ProviderInfo::_internal_has_database_hash() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_ProviderInfo::has_database_hash() const { + return _internal_has_database_hash(); +} +inline void FastPairLog_ProviderInfo::clear_database_hash() { + database_hash_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& FastPairLog_ProviderInfo::database_hash() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.ProviderInfo.database_hash) + return _internal_database_hash(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void FastPairLog_ProviderInfo::set_database_hash(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + database_hash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.ProviderInfo.database_hash) +} +inline std::string* FastPairLog_ProviderInfo::mutable_database_hash() { + std::string* _s = _internal_mutable_database_hash(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.ProviderInfo.database_hash) + return _s; +} +inline const std::string& FastPairLog_ProviderInfo::_internal_database_hash() const { + return database_hash_.Get(); +} +inline void FastPairLog_ProviderInfo::_internal_set_database_hash(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + database_hash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* FastPairLog_ProviderInfo::_internal_mutable_database_hash() { + _has_bits_[0] |= 0x00000001u; + return database_hash_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* FastPairLog_ProviderInfo::release_database_hash() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.ProviderInfo.database_hash) + if (!_internal_has_database_hash()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = database_hash_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (database_hash_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + database_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void FastPairLog_ProviderInfo::set_allocated_database_hash(std::string* database_hash) { + if (database_hash != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + database_hash_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), database_hash, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (database_hash_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + database_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.ProviderInfo.database_hash) +} + +// ------------------------------------------------------------------- + +// FastPairLog_FootprintsInfo + +// optional int32 number_devices_on_footprints = 1; +inline bool FastPairLog_FootprintsInfo::_internal_has_number_devices_on_footprints() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_FootprintsInfo::has_number_devices_on_footprints() const { + return _internal_has_number_devices_on_footprints(); +} +inline void FastPairLog_FootprintsInfo::clear_number_devices_on_footprints() { + number_devices_on_footprints_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline int32_t FastPairLog_FootprintsInfo::_internal_number_devices_on_footprints() const { + return number_devices_on_footprints_; +} +inline int32_t FastPairLog_FootprintsInfo::number_devices_on_footprints() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.FootprintsInfo.number_devices_on_footprints) + return _internal_number_devices_on_footprints(); +} +inline void FastPairLog_FootprintsInfo::_internal_set_number_devices_on_footprints(int32_t value) { + _has_bits_[0] |= 0x00000001u; + number_devices_on_footprints_ = value; +} +inline void FastPairLog_FootprintsInfo::set_number_devices_on_footprints(int32_t value) { + _internal_set_number_devices_on_footprints(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.FootprintsInfo.number_devices_on_footprints) +} + +// ------------------------------------------------------------------- + +// FastPairLog_KeyBasedPairingInfo + +// optional uint32 request_flag = 1; +inline bool FastPairLog_KeyBasedPairingInfo::_internal_has_request_flag() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool FastPairLog_KeyBasedPairingInfo::has_request_flag() const { + return _internal_has_request_flag(); +} +inline void FastPairLog_KeyBasedPairingInfo::clear_request_flag() { + request_flag_ = 0u; + _has_bits_[0] &= ~0x00000001u; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::_internal_request_flag() const { + return request_flag_; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::request_flag() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.request_flag) + return _internal_request_flag(); +} +inline void FastPairLog_KeyBasedPairingInfo::_internal_set_request_flag(uint32_t value) { + _has_bits_[0] |= 0x00000001u; + request_flag_ = value; +} +inline void FastPairLog_KeyBasedPairingInfo::set_request_flag(uint32_t value) { + _internal_set_request_flag(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.request_flag) +} + +// optional uint32 response_type = 2; +inline bool FastPairLog_KeyBasedPairingInfo::_internal_has_response_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool FastPairLog_KeyBasedPairingInfo::has_response_type() const { + return _internal_has_response_type(); +} +inline void FastPairLog_KeyBasedPairingInfo::clear_response_type() { + response_type_ = 0u; + _has_bits_[0] &= ~0x00000002u; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::_internal_response_type() const { + return response_type_; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::response_type() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.response_type) + return _internal_response_type(); +} +inline void FastPairLog_KeyBasedPairingInfo::_internal_set_response_type(uint32_t value) { + _has_bits_[0] |= 0x00000002u; + response_type_ = value; +} +inline void FastPairLog_KeyBasedPairingInfo::set_response_type(uint32_t value) { + _internal_set_response_type(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.response_type) +} + +// optional uint32 response_flag = 3; +inline bool FastPairLog_KeyBasedPairingInfo::_internal_has_response_flag() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool FastPairLog_KeyBasedPairingInfo::has_response_flag() const { + return _internal_has_response_flag(); +} +inline void FastPairLog_KeyBasedPairingInfo::clear_response_flag() { + response_flag_ = 0u; + _has_bits_[0] &= ~0x00000004u; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::_internal_response_flag() const { + return response_flag_; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::response_flag() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.response_flag) + return _internal_response_flag(); +} +inline void FastPairLog_KeyBasedPairingInfo::_internal_set_response_flag(uint32_t value) { + _has_bits_[0] |= 0x00000004u; + response_flag_ = value; +} +inline void FastPairLog_KeyBasedPairingInfo::set_response_flag(uint32_t value) { + _internal_set_response_flag(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.response_flag) +} + +// optional uint32 response_device_count = 4; +inline bool FastPairLog_KeyBasedPairingInfo::_internal_has_response_device_count() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool FastPairLog_KeyBasedPairingInfo::has_response_device_count() const { + return _internal_has_response_device_count(); +} +inline void FastPairLog_KeyBasedPairingInfo::clear_response_device_count() { + response_device_count_ = 0u; + _has_bits_[0] &= ~0x00000008u; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::_internal_response_device_count() const { + return response_device_count_; +} +inline uint32_t FastPairLog_KeyBasedPairingInfo::response_device_count() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.response_device_count) + return _internal_response_device_count(); +} +inline void FastPairLog_KeyBasedPairingInfo::_internal_set_response_device_count(uint32_t value) { + _has_bits_[0] |= 0x00000008u; + response_device_count_ = value; +} +inline void FastPairLog_KeyBasedPairingInfo::set_response_device_count(uint32_t value) { + _internal_set_response_device_count(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo.response_device_count) +} + +// ------------------------------------------------------------------- + +// FastPairLog + +// optional int32 model_id = 1; +inline bool FastPairLog::_internal_has_model_id() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool FastPairLog::has_model_id() const { + return _internal_has_model_id(); +} +inline void FastPairLog::clear_model_id() { + model_id_ = 0; + _has_bits_[0] &= ~0x00000080u; +} +inline int32_t FastPairLog::_internal_model_id() const { + return model_id_; +} +inline int32_t FastPairLog::model_id() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.model_id) + return _internal_model_id(); +} +inline void FastPairLog::_internal_set_model_id(int32_t value) { + _has_bits_[0] |= 0x00000080u; + model_id_ = value; +} +inline void FastPairLog::set_model_id(int32_t value) { + _internal_set_model_id(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.model_id) +} + +// optional .nearby.proto.fastpair.FastPairEvent.BondState bond_state = 2; +inline bool FastPairLog::_internal_has_bond_state() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool FastPairLog::has_bond_state() const { + return _internal_has_bond_state(); +} +inline void FastPairLog::clear_bond_state() { + bond_state_ = 0; + _has_bits_[0] &= ~0x00000100u; +} +inline ::nearby::proto::fastpair::FastPairEvent_BondState FastPairLog::_internal_bond_state() const { + return static_cast< ::nearby::proto::fastpair::FastPairEvent_BondState >(bond_state_); +} +inline ::nearby::proto::fastpair::FastPairEvent_BondState FastPairLog::bond_state() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.bond_state) + return _internal_bond_state(); +} +inline void FastPairLog::_internal_set_bond_state(::nearby::proto::fastpair::FastPairEvent_BondState value) { + assert(::nearby::proto::fastpair::FastPairEvent_BondState_IsValid(value)); + _has_bits_[0] |= 0x00000100u; + bond_state_ = value; +} +inline void FastPairLog::set_bond_state(::nearby::proto::fastpair::FastPairEvent_BondState value) { + _internal_set_bond_state(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.bond_state) +} + +// optional .nearby.proto.fastpair.FastPairEvent.ErrorCode error_code = 3; +inline bool FastPairLog::_internal_has_error_code() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool FastPairLog::has_error_code() const { + return _internal_has_error_code(); +} +inline void FastPairLog::clear_error_code() { + error_code_ = 0; + _has_bits_[0] &= ~0x00000200u; +} +inline ::nearby::proto::fastpair::FastPairEvent_ErrorCode FastPairLog::_internal_error_code() const { + return static_cast< ::nearby::proto::fastpair::FastPairEvent_ErrorCode >(error_code_); +} +inline ::nearby::proto::fastpair::FastPairEvent_ErrorCode FastPairLog::error_code() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.error_code) + return _internal_error_code(); +} +inline void FastPairLog::_internal_set_error_code(::nearby::proto::fastpair::FastPairEvent_ErrorCode value) { + assert(::nearby::proto::fastpair::FastPairEvent_ErrorCode_IsValid(value)); + _has_bits_[0] |= 0x00000200u; + error_code_ = value; +} +inline void FastPairLog::set_error_code(::nearby::proto::fastpair::FastPairEvent_ErrorCode value) { + _internal_set_error_code(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.error_code) +} + +// optional .nearby.proto.fastpair.FastPairLog.GattEvent gatt_event = 4; +inline bool FastPairLog::_internal_has_gatt_event() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || gatt_event_ != nullptr); + return value; +} +inline bool FastPairLog::has_gatt_event() const { + return _internal_has_gatt_event(); +} +inline void FastPairLog::clear_gatt_event() { + if (gatt_event_ != nullptr) gatt_event_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::proto::fastpair::FastPairLog_GattEvent& FastPairLog::_internal_gatt_event() const { + const ::nearby::proto::fastpair::FastPairLog_GattEvent* p = gatt_event_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_GattEvent_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_GattEvent& FastPairLog::gatt_event() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.gatt_event) + return _internal_gatt_event(); +} +inline void FastPairLog::unsafe_arena_set_allocated_gatt_event( + ::nearby::proto::fastpair::FastPairLog_GattEvent* gatt_event) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(gatt_event_); + } + gatt_event_ = gatt_event; + if (gatt_event) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.gatt_event) +} +inline ::nearby::proto::fastpair::FastPairLog_GattEvent* FastPairLog::release_gatt_event() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::proto::fastpair::FastPairLog_GattEvent* temp = gatt_event_; + gatt_event_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_GattEvent* FastPairLog::unsafe_arena_release_gatt_event() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.gatt_event) + _has_bits_[0] &= ~0x00000001u; + ::nearby::proto::fastpair::FastPairLog_GattEvent* temp = gatt_event_; + gatt_event_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_GattEvent* FastPairLog::_internal_mutable_gatt_event() { + _has_bits_[0] |= 0x00000001u; + if (gatt_event_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_GattEvent>(GetArenaForAllocation()); + gatt_event_ = p; + } + return gatt_event_; +} +inline ::nearby::proto::fastpair::FastPairLog_GattEvent* FastPairLog::mutable_gatt_event() { + ::nearby::proto::fastpair::FastPairLog_GattEvent* _msg = _internal_mutable_gatt_event(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.gatt_event) + return _msg; +} +inline void FastPairLog::set_allocated_gatt_event(::nearby::proto::fastpair::FastPairLog_GattEvent* gatt_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete gatt_event_; + } + if (gatt_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_GattEvent>::GetOwningArena(gatt_event); + if (message_arena != submessage_arena) { + gatt_event = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, gatt_event, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + gatt_event_ = gatt_event; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.gatt_event) +} + +// optional .nearby.proto.fastpair.FastPairLog.BrEdrHandoverEvent br_edr_handover_event = 5; +inline bool FastPairLog::_internal_has_br_edr_handover_event() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || br_edr_handover_event_ != nullptr); + return value; +} +inline bool FastPairLog::has_br_edr_handover_event() const { + return _internal_has_br_edr_handover_event(); +} +inline void FastPairLog::clear_br_edr_handover_event() { + if (br_edr_handover_event_ != nullptr) br_edr_handover_event_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent& FastPairLog::_internal_br_edr_handover_event() const { + const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* p = br_edr_handover_event_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_BrEdrHandoverEvent_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent& FastPairLog::br_edr_handover_event() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.br_edr_handover_event) + return _internal_br_edr_handover_event(); +} +inline void FastPairLog::unsafe_arena_set_allocated_br_edr_handover_event( + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* br_edr_handover_event) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(br_edr_handover_event_); + } + br_edr_handover_event_ = br_edr_handover_event; + if (br_edr_handover_event) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.br_edr_handover_event) +} +inline ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* FastPairLog::release_br_edr_handover_event() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* temp = br_edr_handover_event_; + br_edr_handover_event_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* FastPairLog::unsafe_arena_release_br_edr_handover_event() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.br_edr_handover_event) + _has_bits_[0] &= ~0x00000002u; + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* temp = br_edr_handover_event_; + br_edr_handover_event_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* FastPairLog::_internal_mutable_br_edr_handover_event() { + _has_bits_[0] |= 0x00000002u; + if (br_edr_handover_event_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent>(GetArenaForAllocation()); + br_edr_handover_event_ = p; + } + return br_edr_handover_event_; +} +inline ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* FastPairLog::mutable_br_edr_handover_event() { + ::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* _msg = _internal_mutable_br_edr_handover_event(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.br_edr_handover_event) + return _msg; +} +inline void FastPairLog::set_allocated_br_edr_handover_event(::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent* br_edr_handover_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete br_edr_handover_event_; + } + if (br_edr_handover_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_BrEdrHandoverEvent>::GetOwningArena(br_edr_handover_event); + if (message_arena != submessage_arena) { + br_edr_handover_event = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, br_edr_handover_event, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + br_edr_handover_event_ = br_edr_handover_event; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.br_edr_handover_event) +} + +// optional .nearby.proto.fastpair.FastPairLog.CreateBondEvent bond_event = 6; +inline bool FastPairLog::_internal_has_bond_event() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || bond_event_ != nullptr); + return value; +} +inline bool FastPairLog::has_bond_event() const { + return _internal_has_bond_event(); +} +inline void FastPairLog::clear_bond_event() { + if (bond_event_ != nullptr) bond_event_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +inline const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent& FastPairLog::_internal_bond_event() const { + const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* p = bond_event_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_CreateBondEvent_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_CreateBondEvent& FastPairLog::bond_event() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.bond_event) + return _internal_bond_event(); +} +inline void FastPairLog::unsafe_arena_set_allocated_bond_event( + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* bond_event) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(bond_event_); + } + bond_event_ = bond_event; + if (bond_event) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.bond_event) +} +inline ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* FastPairLog::release_bond_event() { + _has_bits_[0] &= ~0x00000004u; + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* temp = bond_event_; + bond_event_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* FastPairLog::unsafe_arena_release_bond_event() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.bond_event) + _has_bits_[0] &= ~0x00000004u; + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* temp = bond_event_; + bond_event_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* FastPairLog::_internal_mutable_bond_event() { + _has_bits_[0] |= 0x00000004u; + if (bond_event_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_CreateBondEvent>(GetArenaForAllocation()); + bond_event_ = p; + } + return bond_event_; +} +inline ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* FastPairLog::mutable_bond_event() { + ::nearby::proto::fastpair::FastPairLog_CreateBondEvent* _msg = _internal_mutable_bond_event(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.bond_event) + return _msg; +} +inline void FastPairLog::set_allocated_bond_event(::nearby::proto::fastpair::FastPairLog_CreateBondEvent* bond_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete bond_event_; + } + if (bond_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_CreateBondEvent>::GetOwningArena(bond_event); + if (message_arena != submessage_arena) { + bond_event = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, bond_event, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + bond_event_ = bond_event; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.bond_event) +} + +// optional .nearby.proto.fastpair.FastPairLog.ConnectEvent connect_event = 7; +inline bool FastPairLog::_internal_has_connect_event() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || connect_event_ != nullptr); + return value; +} +inline bool FastPairLog::has_connect_event() const { + return _internal_has_connect_event(); +} +inline void FastPairLog::clear_connect_event() { + if (connect_event_ != nullptr) connect_event_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +inline const ::nearby::proto::fastpair::FastPairLog_ConnectEvent& FastPairLog::_internal_connect_event() const { + const ::nearby::proto::fastpair::FastPairLog_ConnectEvent* p = connect_event_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_ConnectEvent_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_ConnectEvent& FastPairLog::connect_event() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.connect_event) + return _internal_connect_event(); +} +inline void FastPairLog::unsafe_arena_set_allocated_connect_event( + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* connect_event) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(connect_event_); + } + connect_event_ = connect_event; + if (connect_event) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.connect_event) +} +inline ::nearby::proto::fastpair::FastPairLog_ConnectEvent* FastPairLog::release_connect_event() { + _has_bits_[0] &= ~0x00000008u; + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* temp = connect_event_; + connect_event_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_ConnectEvent* FastPairLog::unsafe_arena_release_connect_event() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.connect_event) + _has_bits_[0] &= ~0x00000008u; + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* temp = connect_event_; + connect_event_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_ConnectEvent* FastPairLog::_internal_mutable_connect_event() { + _has_bits_[0] |= 0x00000008u; + if (connect_event_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_ConnectEvent>(GetArenaForAllocation()); + connect_event_ = p; + } + return connect_event_; +} +inline ::nearby::proto::fastpair::FastPairLog_ConnectEvent* FastPairLog::mutable_connect_event() { + ::nearby::proto::fastpair::FastPairLog_ConnectEvent* _msg = _internal_mutable_connect_event(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.connect_event) + return _msg; +} +inline void FastPairLog::set_allocated_connect_event(::nearby::proto::fastpair::FastPairLog_ConnectEvent* connect_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete connect_event_; + } + if (connect_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_ConnectEvent>::GetOwningArena(connect_event); + if (message_arena != submessage_arena) { + connect_event = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, connect_event, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + connect_event_ = connect_event; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.connect_event) +} + +// optional int64 hashed_salted_device_address = 8; +inline bool FastPairLog::_internal_has_hashed_salted_device_address() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + return value; +} +inline bool FastPairLog::has_hashed_salted_device_address() const { + return _internal_has_hashed_salted_device_address(); +} +inline void FastPairLog::clear_hashed_salted_device_address() { + hashed_salted_device_address_ = int64_t{0}; + _has_bits_[0] &= ~0x00000800u; +} +inline int64_t FastPairLog::_internal_hashed_salted_device_address() const { + return hashed_salted_device_address_; +} +inline int64_t FastPairLog::hashed_salted_device_address() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.hashed_salted_device_address) + return _internal_hashed_salted_device_address(); +} +inline void FastPairLog::_internal_set_hashed_salted_device_address(int64_t value) { + _has_bits_[0] |= 0x00000800u; + hashed_salted_device_address_ = value; +} +inline void FastPairLog::set_hashed_salted_device_address(int64_t value) { + _internal_set_hashed_salted_device_address(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.hashed_salted_device_address) +} + +// optional int64 duration = 9; +inline bool FastPairLog::_internal_has_duration() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + return value; +} +inline bool FastPairLog::has_duration() const { + return _internal_has_duration(); +} +inline void FastPairLog::clear_duration() { + duration_ = int64_t{0}; + _has_bits_[0] &= ~0x00001000u; +} +inline int64_t FastPairLog::_internal_duration() const { + return duration_; +} +inline int64_t FastPairLog::duration() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.duration) + return _internal_duration(); +} +inline void FastPairLog::_internal_set_duration(int64_t value) { + _has_bits_[0] |= 0x00001000u; + duration_ = value; +} +inline void FastPairLog::set_duration(int64_t value) { + _internal_set_duration(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.duration) +} + +// optional .nearby.proto.fastpair.FastPairLog.ProviderInfo provider_info = 10; +inline bool FastPairLog::_internal_has_provider_info() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || provider_info_ != nullptr); + return value; +} +inline bool FastPairLog::has_provider_info() const { + return _internal_has_provider_info(); +} +inline void FastPairLog::clear_provider_info() { + if (provider_info_ != nullptr) provider_info_->Clear(); + _has_bits_[0] &= ~0x00000010u; +} +inline const ::nearby::proto::fastpair::FastPairLog_ProviderInfo& FastPairLog::_internal_provider_info() const { + const ::nearby::proto::fastpair::FastPairLog_ProviderInfo* p = provider_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_ProviderInfo_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_ProviderInfo& FastPairLog::provider_info() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.provider_info) + return _internal_provider_info(); +} +inline void FastPairLog::unsafe_arena_set_allocated_provider_info( + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* provider_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(provider_info_); + } + provider_info_ = provider_info; + if (provider_info) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.provider_info) +} +inline ::nearby::proto::fastpair::FastPairLog_ProviderInfo* FastPairLog::release_provider_info() { + _has_bits_[0] &= ~0x00000010u; + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* temp = provider_info_; + provider_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_ProviderInfo* FastPairLog::unsafe_arena_release_provider_info() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.provider_info) + _has_bits_[0] &= ~0x00000010u; + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* temp = provider_info_; + provider_info_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_ProviderInfo* FastPairLog::_internal_mutable_provider_info() { + _has_bits_[0] |= 0x00000010u; + if (provider_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_ProviderInfo>(GetArenaForAllocation()); + provider_info_ = p; + } + return provider_info_; +} +inline ::nearby::proto::fastpair::FastPairLog_ProviderInfo* FastPairLog::mutable_provider_info() { + ::nearby::proto::fastpair::FastPairLog_ProviderInfo* _msg = _internal_mutable_provider_info(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.provider_info) + return _msg; +} +inline void FastPairLog::set_allocated_provider_info(::nearby::proto::fastpair::FastPairLog_ProviderInfo* provider_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete provider_info_; + } + if (provider_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_ProviderInfo>::GetOwningArena(provider_info); + if (message_arena != submessage_arena) { + provider_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, provider_info, submessage_arena); + } + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + provider_info_ = provider_info; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.provider_info) +} + +// optional .nearby.proto.fastpair.FastPairLog.FootprintsInfo footprints_info = 11; +inline bool FastPairLog::_internal_has_footprints_info() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || footprints_info_ != nullptr); + return value; +} +inline bool FastPairLog::has_footprints_info() const { + return _internal_has_footprints_info(); +} +inline void FastPairLog::clear_footprints_info() { + if (footprints_info_ != nullptr) footprints_info_->Clear(); + _has_bits_[0] &= ~0x00000020u; +} +inline const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo& FastPairLog::_internal_footprints_info() const { + const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* p = footprints_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_FootprintsInfo_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_FootprintsInfo& FastPairLog::footprints_info() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.footprints_info) + return _internal_footprints_info(); +} +inline void FastPairLog::unsafe_arena_set_allocated_footprints_info( + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* footprints_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(footprints_info_); + } + footprints_info_ = footprints_info; + if (footprints_info) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.footprints_info) +} +inline ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* FastPairLog::release_footprints_info() { + _has_bits_[0] &= ~0x00000020u; + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* temp = footprints_info_; + footprints_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* FastPairLog::unsafe_arena_release_footprints_info() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.footprints_info) + _has_bits_[0] &= ~0x00000020u; + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* temp = footprints_info_; + footprints_info_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* FastPairLog::_internal_mutable_footprints_info() { + _has_bits_[0] |= 0x00000020u; + if (footprints_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_FootprintsInfo>(GetArenaForAllocation()); + footprints_info_ = p; + } + return footprints_info_; +} +inline ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* FastPairLog::mutable_footprints_info() { + ::nearby::proto::fastpair::FastPairLog_FootprintsInfo* _msg = _internal_mutable_footprints_info(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.footprints_info) + return _msg; +} +inline void FastPairLog::set_allocated_footprints_info(::nearby::proto::fastpair::FastPairLog_FootprintsInfo* footprints_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete footprints_info_; + } + if (footprints_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_FootprintsInfo>::GetOwningArena(footprints_info); + if (message_arena != submessage_arena) { + footprints_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, footprints_info, submessage_arena); + } + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + footprints_info_ = footprints_info; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.footprints_info) +} + +// optional .nearby.proto.fastpair.DeviceType device_type = 12; +inline bool FastPairLog::_internal_has_device_type() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + return value; +} +inline bool FastPairLog::has_device_type() const { + return _internal_has_device_type(); +} +inline void FastPairLog::clear_device_type() { + device_type_ = 0; + _has_bits_[0] &= ~0x00000400u; +} +inline ::nearby::proto::fastpair::DeviceType FastPairLog::_internal_device_type() const { + return static_cast< ::nearby::proto::fastpair::DeviceType >(device_type_); +} +inline ::nearby::proto::fastpair::DeviceType FastPairLog::device_type() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.device_type) + return _internal_device_type(); +} +inline void FastPairLog::_internal_set_device_type(::nearby::proto::fastpair::DeviceType value) { + assert(::nearby::proto::fastpair::DeviceType_IsValid(value)); + _has_bits_[0] |= 0x00000400u; + device_type_ = value; +} +inline void FastPairLog::set_device_type(::nearby::proto::fastpair::DeviceType value) { + _internal_set_device_type(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.device_type) +} + +// optional .nearby.proto.fastpair.OsType os_type = 13; +inline bool FastPairLog::_internal_has_os_type() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + return value; +} +inline bool FastPairLog::has_os_type() const { + return _internal_has_os_type(); +} +inline void FastPairLog::clear_os_type() { + os_type_ = 0; + _has_bits_[0] &= ~0x00002000u; +} +inline ::nearby::proto::fastpair::OsType FastPairLog::_internal_os_type() const { + return static_cast< ::nearby::proto::fastpair::OsType >(os_type_); +} +inline ::nearby::proto::fastpair::OsType FastPairLog::os_type() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.os_type) + return _internal_os_type(); +} +inline void FastPairLog::_internal_set_os_type(::nearby::proto::fastpair::OsType value) { + assert(::nearby::proto::fastpair::OsType_IsValid(value)); + _has_bits_[0] |= 0x00002000u; + os_type_ = value; +} +inline void FastPairLog::set_os_type(::nearby::proto::fastpair::OsType value) { + _internal_set_os_type(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.os_type) +} + +// optional int32 active_wifi_frequency = 14; +inline bool FastPairLog::_internal_has_active_wifi_frequency() const { + bool value = (_has_bits_[0] & 0x00004000u) != 0; + return value; +} +inline bool FastPairLog::has_active_wifi_frequency() const { + return _internal_has_active_wifi_frequency(); +} +inline void FastPairLog::clear_active_wifi_frequency() { + active_wifi_frequency_ = 0; + _has_bits_[0] &= ~0x00004000u; +} +inline int32_t FastPairLog::_internal_active_wifi_frequency() const { + return active_wifi_frequency_; +} +inline int32_t FastPairLog::active_wifi_frequency() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.active_wifi_frequency) + return _internal_active_wifi_frequency(); +} +inline void FastPairLog::_internal_set_active_wifi_frequency(int32_t value) { + _has_bits_[0] |= 0x00004000u; + active_wifi_frequency_ = value; +} +inline void FastPairLog::set_active_wifi_frequency(int32_t value) { + _internal_set_active_wifi_frequency(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.active_wifi_frequency) +} + +// optional int32 number_connected_peripherals = 15; +inline bool FastPairLog::_internal_has_number_connected_peripherals() const { + bool value = (_has_bits_[0] & 0x00008000u) != 0; + return value; +} +inline bool FastPairLog::has_number_connected_peripherals() const { + return _internal_has_number_connected_peripherals(); +} +inline void FastPairLog::clear_number_connected_peripherals() { + number_connected_peripherals_ = 0; + _has_bits_[0] &= ~0x00008000u; +} +inline int32_t FastPairLog::_internal_number_connected_peripherals() const { + return number_connected_peripherals_; +} +inline int32_t FastPairLog::number_connected_peripherals() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.number_connected_peripherals) + return _internal_number_connected_peripherals(); +} +inline void FastPairLog::_internal_set_number_connected_peripherals(int32_t value) { + _has_bits_[0] |= 0x00008000u; + number_connected_peripherals_ = value; +} +inline void FastPairLog::set_number_connected_peripherals(int32_t value) { + _internal_set_number_connected_peripherals(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.number_connected_peripherals) +} + +// optional bool is_scanned_by_offload_scanner = 16; +inline bool FastPairLog::_internal_has_is_scanned_by_offload_scanner() const { + bool value = (_has_bits_[0] & 0x00020000u) != 0; + return value; +} +inline bool FastPairLog::has_is_scanned_by_offload_scanner() const { + return _internal_has_is_scanned_by_offload_scanner(); +} +inline void FastPairLog::clear_is_scanned_by_offload_scanner() { + is_scanned_by_offload_scanner_ = false; + _has_bits_[0] &= ~0x00020000u; +} +inline bool FastPairLog::_internal_is_scanned_by_offload_scanner() const { + return is_scanned_by_offload_scanner_; +} +inline bool FastPairLog::is_scanned_by_offload_scanner() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.is_scanned_by_offload_scanner) + return _internal_is_scanned_by_offload_scanner(); +} +inline void FastPairLog::_internal_set_is_scanned_by_offload_scanner(bool value) { + _has_bits_[0] |= 0x00020000u; + is_scanned_by_offload_scanner_ = value; +} +inline void FastPairLog::set_is_scanned_by_offload_scanner(bool value) { + _internal_set_is_scanned_by_offload_scanner(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.is_scanned_by_offload_scanner) +} + +// optional .nearby.proto.fastpair.FastPairLog.KeyBasedPairingInfo key_based_pairing_info = 17; +inline bool FastPairLog::_internal_has_key_based_pairing_info() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || key_based_pairing_info_ != nullptr); + return value; +} +inline bool FastPairLog::has_key_based_pairing_info() const { + return _internal_has_key_based_pairing_info(); +} +inline void FastPairLog::clear_key_based_pairing_info() { + if (key_based_pairing_info_ != nullptr) key_based_pairing_info_->Clear(); + _has_bits_[0] &= ~0x00000040u; +} +inline const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo& FastPairLog::_internal_key_based_pairing_info() const { + const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* p = key_based_pairing_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::proto::fastpair::_FastPairLog_KeyBasedPairingInfo_default_instance_); +} +inline const ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo& FastPairLog::key_based_pairing_info() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.key_based_pairing_info) + return _internal_key_based_pairing_info(); +} +inline void FastPairLog::unsafe_arena_set_allocated_key_based_pairing_info( + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* key_based_pairing_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(key_based_pairing_info_); + } + key_based_pairing_info_ = key_based_pairing_info; + if (key_based_pairing_info) { + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.proto.fastpair.FastPairLog.key_based_pairing_info) +} +inline ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* FastPairLog::release_key_based_pairing_info() { + _has_bits_[0] &= ~0x00000040u; + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* temp = key_based_pairing_info_; + key_based_pairing_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* FastPairLog::unsafe_arena_release_key_based_pairing_info() { + // @@protoc_insertion_point(field_release:nearby.proto.fastpair.FastPairLog.key_based_pairing_info) + _has_bits_[0] &= ~0x00000040u; + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* temp = key_based_pairing_info_; + key_based_pairing_info_ = nullptr; + return temp; +} +inline ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* FastPairLog::_internal_mutable_key_based_pairing_info() { + _has_bits_[0] |= 0x00000040u; + if (key_based_pairing_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo>(GetArenaForAllocation()); + key_based_pairing_info_ = p; + } + return key_based_pairing_info_; +} +inline ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* FastPairLog::mutable_key_based_pairing_info() { + ::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* _msg = _internal_mutable_key_based_pairing_info(); + // @@protoc_insertion_point(field_mutable:nearby.proto.fastpair.FastPairLog.key_based_pairing_info) + return _msg; +} +inline void FastPairLog::set_allocated_key_based_pairing_info(::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo* key_based_pairing_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete key_based_pairing_info_; + } + if (key_based_pairing_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::proto::fastpair::FastPairLog_KeyBasedPairingInfo>::GetOwningArena(key_based_pairing_info); + if (message_arena != submessage_arena) { + key_based_pairing_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, key_based_pairing_info, submessage_arena); + } + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + key_based_pairing_info_ = key_based_pairing_info; + // @@protoc_insertion_point(field_set_allocated:nearby.proto.fastpair.FastPairLog.key_based_pairing_info) +} + +// optional uint32 bonding_transport = 18; +inline bool FastPairLog::_internal_has_bonding_transport() const { + bool value = (_has_bits_[0] & 0x00010000u) != 0; + return value; +} +inline bool FastPairLog::has_bonding_transport() const { + return _internal_has_bonding_transport(); +} +inline void FastPairLog::clear_bonding_transport() { + bonding_transport_ = 0u; + _has_bits_[0] &= ~0x00010000u; +} +inline uint32_t FastPairLog::_internal_bonding_transport() const { + return bonding_transport_; +} +inline uint32_t FastPairLog::bonding_transport() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.bonding_transport) + return _internal_bonding_transport(); +} +inline void FastPairLog::_internal_set_bonding_transport(uint32_t value) { + _has_bits_[0] |= 0x00010000u; + bonding_transport_ = value; +} +inline void FastPairLog::set_bonding_transport(uint32_t value) { + _internal_set_bonding_transport(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.bonding_transport) +} + +// optional bool is_first_day_new_user = 19; +inline bool FastPairLog::_internal_has_is_first_day_new_user() const { + bool value = (_has_bits_[0] & 0x00040000u) != 0; + return value; +} +inline bool FastPairLog::has_is_first_day_new_user() const { + return _internal_has_is_first_day_new_user(); +} +inline void FastPairLog::clear_is_first_day_new_user() { + is_first_day_new_user_ = false; + _has_bits_[0] &= ~0x00040000u; +} +inline bool FastPairLog::_internal_is_first_day_new_user() const { + return is_first_day_new_user_; +} +inline bool FastPairLog::is_first_day_new_user() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.is_first_day_new_user) + return _internal_is_first_day_new_user(); +} +inline void FastPairLog::_internal_set_is_first_day_new_user(bool value) { + _has_bits_[0] |= 0x00040000u; + is_first_day_new_user_ = value; +} +inline void FastPairLog::set_is_first_day_new_user(bool value) { + _internal_set_is_first_day_new_user(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.is_first_day_new_user) +} + +// optional bool is_seven_days_new_user = 20; +inline bool FastPairLog::_internal_has_is_seven_days_new_user() const { + bool value = (_has_bits_[0] & 0x00080000u) != 0; + return value; +} +inline bool FastPairLog::has_is_seven_days_new_user() const { + return _internal_has_is_seven_days_new_user(); +} +inline void FastPairLog::clear_is_seven_days_new_user() { + is_seven_days_new_user_ = false; + _has_bits_[0] &= ~0x00080000u; +} +inline bool FastPairLog::_internal_is_seven_days_new_user() const { + return is_seven_days_new_user_; +} +inline bool FastPairLog::is_seven_days_new_user() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.is_seven_days_new_user) + return _internal_is_seven_days_new_user(); +} +inline void FastPairLog::_internal_set_is_seven_days_new_user(bool value) { + _has_bits_[0] |= 0x00080000u; + is_seven_days_new_user_ = value; +} +inline void FastPairLog::set_is_seven_days_new_user(bool value) { + _internal_set_is_seven_days_new_user(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.is_seven_days_new_user) +} + +// optional uint32 bonded_device_count = 21; +inline bool FastPairLog::_internal_has_bonded_device_count() const { + bool value = (_has_bits_[0] & 0x00200000u) != 0; + return value; +} +inline bool FastPairLog::has_bonded_device_count() const { + return _internal_has_bonded_device_count(); +} +inline void FastPairLog::clear_bonded_device_count() { + bonded_device_count_ = 0u; + _has_bits_[0] &= ~0x00200000u; +} +inline uint32_t FastPairLog::_internal_bonded_device_count() const { + return bonded_device_count_; +} +inline uint32_t FastPairLog::bonded_device_count() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.bonded_device_count) + return _internal_bonded_device_count(); +} +inline void FastPairLog::_internal_set_bonded_device_count(uint32_t value) { + _has_bits_[0] |= 0x00200000u; + bonded_device_count_ = value; +} +inline void FastPairLog::set_bonded_device_count(uint32_t value) { + _internal_set_bonded_device_count(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.bonded_device_count) +} + +// optional int32 sass_connection_state = 22; +inline bool FastPairLog::_internal_has_sass_connection_state() const { + bool value = (_has_bits_[0] & 0x00800000u) != 0; + return value; +} +inline bool FastPairLog::has_sass_connection_state() const { + return _internal_has_sass_connection_state(); +} +inline void FastPairLog::clear_sass_connection_state() { + sass_connection_state_ = 0; + _has_bits_[0] &= ~0x00800000u; +} +inline int32_t FastPairLog::_internal_sass_connection_state() const { + return sass_connection_state_; +} +inline int32_t FastPairLog::sass_connection_state() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.sass_connection_state) + return _internal_sass_connection_state(); +} +inline void FastPairLog::_internal_set_sass_connection_state(int32_t value) { + _has_bits_[0] |= 0x00800000u; + sass_connection_state_ = value; +} +inline void FastPairLog::set_sass_connection_state(int32_t value) { + _internal_set_sass_connection_state(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.sass_connection_state) +} + +// optional bool is_pair_triggered_by_settings = 23; +inline bool FastPairLog::_internal_has_is_pair_triggered_by_settings() const { + bool value = (_has_bits_[0] & 0x00100000u) != 0; + return value; +} +inline bool FastPairLog::has_is_pair_triggered_by_settings() const { + return _internal_has_is_pair_triggered_by_settings(); +} +inline void FastPairLog::clear_is_pair_triggered_by_settings() { + is_pair_triggered_by_settings_ = false; + _has_bits_[0] &= ~0x00100000u; +} +inline bool FastPairLog::_internal_is_pair_triggered_by_settings() const { + return is_pair_triggered_by_settings_; +} +inline bool FastPairLog::is_pair_triggered_by_settings() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.is_pair_triggered_by_settings) + return _internal_is_pair_triggered_by_settings(); +} +inline void FastPairLog::_internal_set_is_pair_triggered_by_settings(bool value) { + _has_bits_[0] |= 0x00100000u; + is_pair_triggered_by_settings_ = value; +} +inline void FastPairLog::set_is_pair_triggered_by_settings(bool value) { + _internal_set_is_pair_triggered_by_settings(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.is_pair_triggered_by_settings) +} + +// optional int64 nearby_mainline_tethering_version = 24; +inline bool FastPairLog::_internal_has_nearby_mainline_tethering_version() const { + bool value = (_has_bits_[0] & 0x00400000u) != 0; + return value; +} +inline bool FastPairLog::has_nearby_mainline_tethering_version() const { + return _internal_has_nearby_mainline_tethering_version(); +} +inline void FastPairLog::clear_nearby_mainline_tethering_version() { + nearby_mainline_tethering_version_ = int64_t{0}; + _has_bits_[0] &= ~0x00400000u; +} +inline int64_t FastPairLog::_internal_nearby_mainline_tethering_version() const { + return nearby_mainline_tethering_version_; +} +inline int64_t FastPairLog::nearby_mainline_tethering_version() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.nearby_mainline_tethering_version) + return _internal_nearby_mainline_tethering_version(); +} +inline void FastPairLog::_internal_set_nearby_mainline_tethering_version(int64_t value) { + _has_bits_[0] |= 0x00400000u; + nearby_mainline_tethering_version_ = value; +} +inline void FastPairLog::set_nearby_mainline_tethering_version(int64_t value) { + _internal_set_nearby_mainline_tethering_version(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.nearby_mainline_tethering_version) +} + +// optional int64 nearby_nano_app_version = 25; +inline bool FastPairLog::_internal_has_nearby_nano_app_version() const { + bool value = (_has_bits_[0] & 0x02000000u) != 0; + return value; +} +inline bool FastPairLog::has_nearby_nano_app_version() const { + return _internal_has_nearby_nano_app_version(); +} +inline void FastPairLog::clear_nearby_nano_app_version() { + nearby_nano_app_version_ = int64_t{0}; + _has_bits_[0] &= ~0x02000000u; +} +inline int64_t FastPairLog::_internal_nearby_nano_app_version() const { + return nearby_nano_app_version_; +} +inline int64_t FastPairLog::nearby_nano_app_version() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.nearby_nano_app_version) + return _internal_nearby_nano_app_version(); +} +inline void FastPairLog::_internal_set_nearby_nano_app_version(int64_t value) { + _has_bits_[0] |= 0x02000000u; + nearby_nano_app_version_ = value; +} +inline void FastPairLog::set_nearby_nano_app_version(int64_t value) { + _internal_set_nearby_nano_app_version(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.nearby_nano_app_version) +} + +// optional bool is_in_paired_history = 26; +inline bool FastPairLog::_internal_has_is_in_paired_history() const { + bool value = (_has_bits_[0] & 0x01000000u) != 0; + return value; +} +inline bool FastPairLog::has_is_in_paired_history() const { + return _internal_has_is_in_paired_history(); +} +inline void FastPairLog::clear_is_in_paired_history() { + is_in_paired_history_ = false; + _has_bits_[0] &= ~0x01000000u; +} +inline bool FastPairLog::_internal_is_in_paired_history() const { + return is_in_paired_history_; +} +inline bool FastPairLog::is_in_paired_history() const { + // @@protoc_insertion_point(field_get:nearby.proto.fastpair.FastPairLog.is_in_paired_history) + return _internal_is_in_paired_history(); +} +inline void FastPairLog::_internal_set_is_in_paired_history(bool value) { + _has_bits_[0] |= 0x01000000u; + is_in_paired_history_ = value; +} +inline void FastPairLog::set_is_in_paired_history(bool value) { + _internal_set_is_in_paired_history(value); + // @@protoc_insertion_point(field_set:nearby.proto.fastpair.FastPairLog.is_in_paired_history) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace fastpair +} // namespace proto +} // namespace nearby + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_internal_2fproto_2fanalytics_2ffast_5fpair_5flog_2eproto diff --git a/compiled_proto/proto/connections_enums.pb.cc b/compiled_proto/proto/connections_enums.pb.cc index 20cd2d6f..3223ef17 100644 --- a/compiled_proto/proto/connections_enums.pb.cc +++ b/compiled_proto/proto/connections_enums.pb.cc @@ -231,13 +231,14 @@ bool Medium_IsValid(int value) { case 9: case 10: case 11: + case 12: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed Medium_strings[12] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed Medium_strings[13] = {}; static const char Medium_names[] = "BLE" @@ -248,6 +249,7 @@ static const char Medium_names[] = "UNKNOWN_MEDIUM" "USB" "WEB_RTC" + "WEB_RTC_NON_CELLULAR" "WIFI_AWARE" "WIFI_DIRECT" "WIFI_HOTSPOT" @@ -262,25 +264,27 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry Medium_entries[] = { { {Medium_names + 28, 14}, 0 }, { {Medium_names + 42, 3}, 11 }, { {Medium_names + 45, 7}, 9 }, - { {Medium_names + 52, 10}, 6 }, - { {Medium_names + 62, 11}, 8 }, - { {Medium_names + 73, 12}, 3 }, - { {Medium_names + 85, 8}, 5 }, + { {Medium_names + 52, 20}, 12 }, + { {Medium_names + 72, 10}, 6 }, + { {Medium_names + 82, 11}, 8 }, + { {Medium_names + 93, 12}, 3 }, + { {Medium_names + 105, 8}, 5 }, }; static const int Medium_entries_by_number[] = { 5, // 0 -> UNKNOWN_MEDIUM 3, // 1 -> MDNS 2, // 2 -> BLUETOOTH - 10, // 3 -> WIFI_HOTSPOT + 11, // 3 -> WIFI_HOTSPOT 0, // 4 -> BLE - 11, // 5 -> WIFI_LAN - 8, // 6 -> WIFI_AWARE + 12, // 5 -> WIFI_LAN + 9, // 6 -> WIFI_AWARE 4, // 7 -> NFC - 9, // 8 -> WIFI_DIRECT + 10, // 8 -> WIFI_DIRECT 7, // 9 -> WEB_RTC 1, // 10 -> BLE_L2CAP 6, // 11 -> USB + 8, // 12 -> WEB_RTC_NON_CELLULAR }; const std::string& Medium_Name( @@ -289,12 +293,12 @@ const std::string& Medium_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( Medium_entries, Medium_entries_by_number, - 12, Medium_strings); + 13, Medium_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( Medium_entries, Medium_entries_by_number, - 12, value); + 13, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : Medium_strings[idx].get(); } @@ -302,7 +306,7 @@ bool Medium_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, Medium* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - Medium_entries, 12, name, &int_value); + Medium_entries, 13, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -474,6 +478,57 @@ bool ConnectionBand_Parse( } return success; } +bool ConnectionMode_IsValid(int value) { + switch (value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionMode_strings[2] = {}; + +static const char ConnectionMode_names[] = + "INSTANT" + "LEGACY"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ConnectionMode_entries[] = { + { {ConnectionMode_names + 0, 7}, 1 }, + { {ConnectionMode_names + 7, 6}, 0 }, +}; + +static const int ConnectionMode_entries_by_number[] = { + 1, // 0 -> LEGACY + 0, // 1 -> INSTANT +}; + +const std::string& ConnectionMode_Name( + ConnectionMode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ConnectionMode_entries, + ConnectionMode_entries_by_number, + 2, ConnectionMode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ConnectionMode_entries, + ConnectionMode_entries_by_number, + 2, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ConnectionMode_strings[idx].get(); +} +bool ConnectionMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionMode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ConnectionMode_entries, 2, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} bool ConnectionRequestResponse_IsValid(int value) { switch (value) { case 0: @@ -656,29 +711,33 @@ bool ConnectionAttemptType_IsValid(int value) { case 0: case 1: case 2: + case 3: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionAttemptType_strings[3] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionAttemptType_strings[4] = {}; static const char ConnectionAttemptType_names[] = "INITIAL" + "RECONNECT" "UNKNOWN_CONNECTION_ATTEMPT_TYPE" "UPGRADE"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ConnectionAttemptType_entries[] = { { {ConnectionAttemptType_names + 0, 7}, 1 }, - { {ConnectionAttemptType_names + 7, 31}, 0 }, - { {ConnectionAttemptType_names + 38, 7}, 2 }, + { {ConnectionAttemptType_names + 7, 9}, 3 }, + { {ConnectionAttemptType_names + 16, 31}, 0 }, + { {ConnectionAttemptType_names + 47, 7}, 2 }, }; static const int ConnectionAttemptType_entries_by_number[] = { - 1, // 0 -> UNKNOWN_CONNECTION_ATTEMPT_TYPE + 2, // 0 -> UNKNOWN_CONNECTION_ATTEMPT_TYPE 0, // 1 -> INITIAL - 2, // 2 -> UPGRADE + 3, // 2 -> UPGRADE + 1, // 3 -> RECONNECT }; const std::string& ConnectionAttemptType_Name( @@ -687,12 +746,12 @@ const std::string& ConnectionAttemptType_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( ConnectionAttemptType_entries, ConnectionAttemptType_entries_by_number, - 3, ConnectionAttemptType_strings); + 4, ConnectionAttemptType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( ConnectionAttemptType_entries, ConnectionAttemptType_entries_by_number, - 3, value); + 4, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : ConnectionAttemptType_strings[idx].get(); } @@ -700,7 +759,7 @@ bool ConnectionAttemptType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionAttemptType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - ConnectionAttemptType_entries, 3, name, &int_value); + ConnectionAttemptType_entries, 4, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -715,17 +774,21 @@ bool DisconnectionReason_IsValid(int value) { case 4: case 5: case 6: + case 7: + case 8: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed DisconnectionReason_strings[7] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed DisconnectionReason_strings[9] = {}; static const char DisconnectionReason_names[] = + "AUTHENTICATION_FAILURE" "IO_ERROR" "LOCAL_DISCONNECTION" + "PREV_CHANNEL_DISCONNECTION_IN_RECONNECT" "REMOTE_DISCONNECTION" "SHUTDOWN" "UNFINISHED" @@ -733,23 +796,27 @@ static const char DisconnectionReason_names[] = "UPGRADED"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry DisconnectionReason_entries[] = { - { {DisconnectionReason_names + 0, 8}, 3 }, - { {DisconnectionReason_names + 8, 19}, 1 }, - { {DisconnectionReason_names + 27, 20}, 2 }, - { {DisconnectionReason_names + 47, 8}, 5 }, - { {DisconnectionReason_names + 55, 10}, 6 }, - { {DisconnectionReason_names + 65, 28}, 0 }, - { {DisconnectionReason_names + 93, 8}, 4 }, + { {DisconnectionReason_names + 0, 22}, 8 }, + { {DisconnectionReason_names + 22, 8}, 3 }, + { {DisconnectionReason_names + 30, 19}, 1 }, + { {DisconnectionReason_names + 49, 39}, 7 }, + { {DisconnectionReason_names + 88, 20}, 2 }, + { {DisconnectionReason_names + 108, 8}, 5 }, + { {DisconnectionReason_names + 116, 10}, 6 }, + { {DisconnectionReason_names + 126, 28}, 0 }, + { {DisconnectionReason_names + 154, 8}, 4 }, }; static const int DisconnectionReason_entries_by_number[] = { - 5, // 0 -> UNKNOWN_DISCONNECTION_REASON - 1, // 1 -> LOCAL_DISCONNECTION - 2, // 2 -> REMOTE_DISCONNECTION - 0, // 3 -> IO_ERROR - 6, // 4 -> UPGRADED - 3, // 5 -> SHUTDOWN - 4, // 6 -> UNFINISHED + 7, // 0 -> UNKNOWN_DISCONNECTION_REASON + 2, // 1 -> LOCAL_DISCONNECTION + 4, // 2 -> REMOTE_DISCONNECTION + 1, // 3 -> IO_ERROR + 8, // 4 -> UPGRADED + 5, // 5 -> SHUTDOWN + 6, // 6 -> UNFINISHED + 3, // 7 -> PREV_CHANNEL_DISCONNECTION_IN_RECONNECT + 0, // 8 -> AUTHENTICATION_FAILURE }; const std::string& DisconnectionReason_Name( @@ -758,12 +825,12 @@ const std::string& DisconnectionReason_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( DisconnectionReason_entries, DisconnectionReason_entries_by_number, - 7, DisconnectionReason_strings); + 9, DisconnectionReason_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( DisconnectionReason_entries, DisconnectionReason_entries_by_number, - 7, value); + 9, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : DisconnectionReason_strings[idx].get(); } @@ -771,7 +838,7 @@ bool DisconnectionReason_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DisconnectionReason* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - DisconnectionReason_entries, 7, name, &int_value); + DisconnectionReason_entries, 9, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1292,38 +1359,54 @@ bool LogSource_IsValid(int value) { case 3: case 4: case 5: + case 6: + case 7: + case 8: + case 9: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed LogSource_strings[6] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed LogSource_strings[10] = {}; static const char LogSource_names[] = "BETA_TESTER_DEVICES" + "BETO_DOGFOOD_DEVICES" "DEBUG_DEVICES" "INTERNAL_DEVICES" "LAB_DEVICES" + "NEARBY_DOGFOOD_DEVICES" + "NEARBY_MODULE_FOOD_DEVICES" + "NEARBY_TEAMFOOD_DEVICES" "OEM_DEVICES" "UNSPECIFIED_SOURCE"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry LogSource_entries[] = { { {LogSource_names + 0, 19}, 3 }, - { {LogSource_names + 19, 13}, 5 }, - { {LogSource_names + 32, 16}, 2 }, - { {LogSource_names + 48, 11}, 1 }, - { {LogSource_names + 59, 11}, 4 }, - { {LogSource_names + 70, 18}, 0 }, + { {LogSource_names + 19, 20}, 7 }, + { {LogSource_names + 39, 13}, 5 }, + { {LogSource_names + 52, 16}, 2 }, + { {LogSource_names + 68, 11}, 1 }, + { {LogSource_names + 79, 22}, 8 }, + { {LogSource_names + 101, 26}, 6 }, + { {LogSource_names + 127, 23}, 9 }, + { {LogSource_names + 150, 11}, 4 }, + { {LogSource_names + 161, 18}, 0 }, }; static const int LogSource_entries_by_number[] = { - 5, // 0 -> UNSPECIFIED_SOURCE - 3, // 1 -> LAB_DEVICES - 2, // 2 -> INTERNAL_DEVICES + 9, // 0 -> UNSPECIFIED_SOURCE + 4, // 1 -> LAB_DEVICES + 3, // 2 -> INTERNAL_DEVICES 0, // 3 -> BETA_TESTER_DEVICES - 4, // 4 -> OEM_DEVICES - 1, // 5 -> DEBUG_DEVICES + 8, // 4 -> OEM_DEVICES + 2, // 5 -> DEBUG_DEVICES + 6, // 6 -> NEARBY_MODULE_FOOD_DEVICES + 1, // 7 -> BETO_DOGFOOD_DEVICES + 5, // 8 -> NEARBY_DOGFOOD_DEVICES + 7, // 9 -> NEARBY_TEAMFOOD_DEVICES }; const std::string& LogSource_Name( @@ -1332,12 +1415,12 @@ const std::string& LogSource_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( LogSource_entries, LogSource_entries_by_number, - 6, LogSource_strings); + 10, LogSource_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( LogSource_entries, LogSource_entries_by_number, - 6, value); + 10, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : LogSource_strings[idx].get(); } @@ -1345,7 +1428,7 @@ bool LogSource_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, LogSource* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - LogSource_entries, 6, name, &int_value); + LogSource_entries, 10, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1497,7 +1580,7 @@ bool OperationResultCategory_Parse( } return success; } -bool OperationResultDetail_IsValid(int value) { +bool OperationResultCode_IsValid(int value) { switch (value) { case 0: case 1: @@ -1569,6 +1652,14 @@ bool OperationResultDetail_IsValid(int value) { case 1536: case 1537: case 1538: + case 1539: + case 1540: + case 1541: + case 1542: + case 1543: + case 1544: + case 1545: + case 1546: case 2000: case 2001: case 2002: @@ -1586,6 +1677,25 @@ bool OperationResultDetail_IsValid(int value) { case 2014: case 2015: case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: case 2500: case 2501: case 2502: @@ -1599,6 +1709,10 @@ bool OperationResultDetail_IsValid(int value) { case 2510: case 2511: case 2512: + case 2513: + case 2514: + case 2515: + case 2516: case 3000: case 3001: case 3002: @@ -1670,6 +1784,52 @@ bool OperationResultDetail_IsValid(int value) { case 3553: case 3554: case 3555: + case 3556: + case 3557: + case 3558: + case 3559: + case 3560: + case 3561: + case 3562: + case 3563: + case 3564: + case 3565: + case 3566: + case 3567: + case 3568: + case 3569: + case 3570: + case 3571: + case 3572: + case 3573: + case 3574: + case 3575: + case 3576: + case 3577: + case 3578: + case 3579: + case 3580: + case 3581: + case 3582: + case 3583: + case 3584: + case 3585: + case 3586: + case 3587: + case 3588: + case 3589: + case 3590: + case 3591: + case 3592: + case 3593: + case 3594: + case 3595: + case 3596: + case 3597: + case 3598: + case 3599: + case 3600: + case 3601: case 4500: case 4501: case 4502: @@ -1737,15 +1897,65 @@ bool OperationResultDetail_IsValid(int value) { case 4564: case 4565: case 4566: + case 4567: + case 4568: + case 4569: + case 4570: + case 4571: + case 4572: + case 4573: + case 4574: + case 4575: + case 4576: + case 4577: + case 4578: + case 4579: + case 4580: + case 4581: + case 4582: + case 4583: + case 4584: + case 4585: + case 4586: + case 4587: + case 4588: + case 4589: + case 4590: + case 4591: + case 4592: + case 4593: + case 4594: + case 4595: + case 4596: + case 4597: + case 4598: + case 4599: + case 4600: + case 4601: + case 4602: + case 4603: + case 4604: + case 4605: + case 4606: + case 4607: + case 4608: + case 4609: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed OperationResultDetail_strings[238] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed OperationResultCode_strings[358] = {}; -static const char OperationResultDetail_names[] = +static const char OperationResultCode_names[] = + "CLIENT_ALREADY_CONNECTED_TO_ENDPOINT" + "CLIENT_ALREADY_CONNECTED_TO_TARGET" + "CLIENT_BLE_DUPLICATE_ADVERTISING" + "CLIENT_BLE_DUPLICATE_DISCOVERING" + "CLIENT_BLE_NO_LISTENING" + "CLIENT_BLUETOOTH_DUPLICATE_ADVERTISING" + "CLIENT_BLUETOOTH_DUPLICATE_DISCOVERING" "CLIENT_CANCELLATION_BT_SERVER_SOCKET_CREATION" "CLIENT_CANCELLATION_CANCEL_BLE_OUTGOING_CONNECTION" "CLIENT_CANCELLATION_CANCEL_BT_OUTGOING_CONNECTION" @@ -1770,6 +1980,7 @@ static const char OperationResultDetail_names[] = "CLIENT_CANCELLATION_WIFI_DIRECT_SERVER_SOCKET_CREATION" "CLIENT_CANCELLATION_WIFI_HOTSPOT_SERVER_SOCKET_CREATION" "CLIENT_CANCELLATION_WIFI_LAN_SERVER_SOCKET_CREATION" + "CLIENT_CONNECT_TO_UNKNOWN_ENDPOINT" "CLIENT_DUPLICATE_ACCEPTING_BLE_CONNECTION_REQUEST" "CLIENT_DUPLICATE_ACCEPTING_BT_CONNECTION_REQUEST" "CLIENT_DUPLICATE_ACCEPTING_L2CAP_CONNECTION_REQUEST" @@ -1784,37 +1995,85 @@ static const char OperationResultDetail_names[] = "CLIENT_DUPLICATE_WIFI_AWARE_SUBSCRIBING_REQUEST" "CLIENT_DUPLICATE_WIFI_DIRECT_CONNECTION_REQUEST" "CLIENT_DUPLICATE_WIFI_HOTSPOT_CONNECTION_REQUEST" + "CLIENT_FAILED_INCOMING_CONNECTION_DUE_TO_TOPOLOGICAL_LIMIT" + "CLIENT_NFC_DUPLICATE_ADVERTISING" + "CLIENT_NFC_DUPLICATE_DISCOVERING" + "CLIENT_OUT_OF_ORDER_API_CALL" + "CLIENT_PERMISSION_FAILURE" + "CLIENT_PROCESS_TIE_BREAK_LOSS" "CLIENT_UNSUPPORTED_USB_TO_BE_UPGRADE_MEDIUM" + "CLIENT_USB_DUPLICATE_ADVERTISING" + "CLIENT_USB_DUPLICATE_DISCOVERING" "CLIENT_WIFI_DIRECT_ALREADY_HOSTING_DIRECT_GROUP_FOR_THIS_CLIENT" "CLIENT_WIFI_HOTSPOT_ALREADY_HOSTING_HOTSPOT_FOR_THIS_CLIENT" + "CLIENT_WIFI_LAN_DUPLICATE_ADVERTISING" + "CLIENT_WIFI_LAN_DUPLICATE_DISCOVERING" + "CLIENT_WRONG_CONNECTING_PERMISSIONS" + "CONNECTIVITY_AUTO_RESUME_FAILURE" + "CONNECTIVITY_BLE_ADD_GATT_ADVERTISEMENT_FAILURE" "CONNECTIVITY_BLE_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_BLE_CREATE_GATT_CONNECTION_FAILURE" + "CONNECTIVITY_BLE_SCAN_FAILURE" "CONNECTIVITY_BLE_SERVER_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_BLE_START_ADVERTISING_FAILURE" + "CONNECTIVITY_BLE_START_GATT_SERVER_FAILURE" + "CONNECTIVITY_BLUETOOTH_CHANGE_SCAN_MODE_FAILURE" "CONNECTIVITY_BLUETOOTH_DEVICE_OBTAIN_FAILURE" "CONNECTIVITY_BLUETOOTH_INVALID_CREDENTIAL" + "CONNECTIVITY_BLUETOOTH_SCAN_FAILURE" + "CONNECTIVITY_BLUETOOTH_START_ADVERTISING_FAILURE" "CONNECTIVITY_BT_CLIENT_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_BT_CONNECTION_EXECUTION_EXCEPTION" + "CONNECTIVITY_BT_CONNECTION_INTERRUPTED_EXCEPTION" + "CONNECTIVITY_BT_CONNECTION_TIMEOUT_EXCEPTION" "CONNECTIVITY_BT_SERVER_SOCKET_CREATION_FAILURE" "CONNECTIVITY_BT_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE" + "CONNECTIVITY_BT_SOCKET_CONNECT_IO_EXCEPTION" + "CONNECTIVITY_BT_SOCKET_CREATION_IO_EXCEPTION" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE_L2CAP" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_BT" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_LAN" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_NFC" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_UNKNOWN_MEDIUM" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_USB" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_WEB_RTC" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_AWARE" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_DIRECT" + "CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_HOTSPOT" + "CONNECTIVITY_DIRECT_GROUP_MCC_FAILURE" "CONNECTIVITY_GATT_SERVER_OPEN_FAILURE" "CONNECTIVITY_GENERIC_PAYLOAD_SENT_ERROR" "CONNECTIVITY_GENERIC_WRITE_CLIENT_INTRODUCTION_ACK_IO_ERROR" "CONNECTIVITY_GENERIC_WRITING_CHANNEL_IO_ERROR" + "CONNECTIVITY_INSTANT_CONNECTION_LISTENING_TIMEOUT" "CONNECTIVITY_L2CAP_CLIENT_OBTAIN_FAIURE" "CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_TIMEOUT_FAILURE" "CONNECTIVITY_L2CAP_DATA_CONNECTION_FAILURE" "CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_FAILURE" "CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE" "CONNECTIVITY_LAN_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_LAN_GET_NETWORK_INTERFACES_FAILURE" + "CONNECTIVITY_LAN_MDNS_REGISTER_FAILURE" "CONNECTIVITY_LAN_SERVER_SOCKET_CREATION_FAILURE" "CONNECTIVITY_LAN_UNREACHABLE" + "CONNECTIVITY_MDNS_SCAN_FAILURE" + "CONNECTIVITY_MEDIUM_INVALID_CREDENTIAL" "CONNECTIVITY_NFC_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_NFC_SERVER_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_NFC_START_DISCOVERY_FAILURE" "CONNECTIVITY_USB_CLIENT_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_UWB_START_DISCOVERY_FAILURE" "CONNECTIVITY_WEB_RTC_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_WEB_RTC_CONNECT_TO_TACHYON_FAILURE" "CONNECTIVITY_WEB_RTC_INVALID_CREDENTIAL" "CONNECTIVITY_WEB_RTC_SERVER_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_WEB_RTC_UNSATISFIED_LINK_ERROR" + "CONNECTIVITY_WFD_CONNECTION_EXECUTION_EXCEPTION" + "CONNECTIVITY_WFD_CONNECTION_HOSTED_ADDRESS_NULL" + "CONNECTIVITY_WFD_CONNECTION_INTERRUPTED_EXCEPTION" + "CONNECTIVITY_WFD_CONNECTION_TIMEOUT_EXCEPTION" "CONNECTIVITY_WIFI_AWARE_ATTACH_FAILURE" "CONNECTIVITY_WIFI_AWARE_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_WIFI_AWARE_DISCOVERED_PEER_NULL" @@ -1824,25 +2083,34 @@ static const char OperationResultDetail_names[] = "CONNECTIVITY_WIFI_AWARE_L2MESSAGE_NETWORK_AVAILABLE_FRAME_NULL" "CONNECTIVITY_WIFI_AWARE_L2MESSAGE_SEND_HOST_NETWORK_FRAME_FAILURE" "CONNECTIVITY_WIFI_AWARE_SERVER_SOCKET_CREATION_FAILURE" + "CONNECTIVITY_WIFI_AWARE_START_ADVERTISING_FAILURE" + "CONNECTIVITY_WIFI_AWARE_START_DISCOVERY_FAILURE" "CONNECTIVITY_WIFI_AWARE_UPDATE_PUBLISH_FAILURE" "CONNECTIVITY_WIFI_DIRECT_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_WIFI_DIRECT_GET_NETWORK_INTERFACES_FAILURE" "CONNECTIVITY_WIFI_DIRECT_INCONSISTENT_HOSTED_WIFI_BAND" "CONNECTIVITY_WIFI_DIRECT_INVALID_CREDENTIAL" "CONNECTIVITY_WIFI_DIRECT_P2P_CHANNEL_INITIALIZE_FAILURE" + "CONNECTIVITY_WIFI_DIRECT_P2P_CONNECTION_FAILURE" "CONNECTIVITY_WIFI_DIRECT_P2P_GROUP_CREATION_FAILURE" "CONNECTIVITY_WIFI_DIRECT_SERVER_SOCKET_CREATION_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_CLIENT_SOCKET_CREATION_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_GET_NETWORK_INTERFACES_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_INCONSISTENT_HOSTED_WIFI_BAND" "CONNECTIVITY_WIFI_HOTSPOT_INVALID_CREDENTIAL" + "CONNECTIVITY_WIFI_HOTSPOT_LEGACY_STA_CONNECTION_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_LOHS_CREATION_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_P2P_CHANNEL_INITIALIZE_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_P2P_GROUP_CREATION_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_SERVER_SOCKET_CREATION_FAILURE" "CONNECTIVITY_WIFI_HOTSPOT_SOFT_AP_CREATION_FAILURE" + "CONNECTIVITY_WIFI_HOTSPOT_SPECIFIER_FAILURE" "CONNECTIVITY_WIFI_LAN_INVALID_CREDENTIAL" "CONNECTIVITY_WIFI_LAN_IP_ADDRESS_ERROR" + "CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_IO_EXCEPTION" + "CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_TIMEOUT" + "CONNECTIVITY_WIFI_LAN_START_ADVERTISING_FAILURE" + "CONNECTIVITY_WIFI_LAN_START_DISCOVERY_FAILURE" "DETAIL_SUCCESS" "DETAIL_UNKNOWN" "DEVICE_STATE_ERROR_UNFINISHED_UPGRADE_ATTEMPTS" @@ -1851,8 +2119,8 @@ static const char OperationResultDetail_names[] = "DEVICE_STATE_RADIO_DISABLING_FAILURE" "DEVICE_STATE_RADIO_ENABLING_FAILURE" "IO_ENDPOINT_IO_ERROR_ON_BLE" + "IO_ENDPOINT_IO_ERROR_ON_BLE_L2CAP" "IO_ENDPOINT_IO_ERROR_ON_BT" - "IO_ENDPOINT_IO_ERROR_ON_L2CAP" "IO_ENDPOINT_IO_ERROR_ON_LAN" "IO_ENDPOINT_IO_ERROR_ON_NFC" "IO_ENDPOINT_IO_ERROR_ON_USB" @@ -1870,19 +2138,27 @@ static const char OperationResultDetail_names[] = "MEDIUM_UNAVAILABLE_BLE_NC_LOGICAL_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_BLE_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_BLUETOOTH_NOT_AVAILABLE" + "MEDIUM_UNAVAILABLE_BT_MULTIPLEX_DISABLED" "MEDIUM_UNAVAILABLE_BT_NC_LOGICAL_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_DIRECT_HOTSPOT_NOT_SUPPORT" + "MEDIUM_UNAVAILABLE_DUPLICATE_FAST_ADVERTISING" "MEDIUM_UNAVAILABLE_L2CAP_NOT_AVAILABLE" + "MEDIUM_UNAVAILABLE_LAN_BLOCKED" "MEDIUM_UNAVAILABLE_LAN_NC_LOGICAL_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_LAN_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_DISRUPTIVE_FALSE" "MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_NOT_SUPPORT" "MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_NOT_SUPPORT_5G" + "MEDIUM_UNAVAILABLE_MDNS_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_NFC_NC_LOGICAL_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_NFC_NOT_AVAILABLE" + "MEDIUM_UNAVAILABLE_NSD_NOT_AVAILABLE" + "MEDIUM_UNAVAILABLE_POOR_SIGNAL" "MEDIUM_UNAVAILABLE_REJECT_L2CAP_ON_GATT_MULTIPLEX_CONNECTION" "MEDIUM_UNAVAILABLE_SOFT_AP_DISRUPTIVE_FALSE" "MEDIUM_UNAVAILABLE_SOFT_AP_NOT_SUPPORT" + "MEDIUM_UNAVAILABLE_STA_DISRUPTIVE_FALSE" + "MEDIUM_UNAVAILABLE_STA_USER_NOT_ALLOW" "MEDIUM_UNAVAILABLE_UPGRADE_ON_SAME_MEDIUM" "MEDIUM_UNAVAILABLE_UPGRADE_SKIP_BLE_LOW_QUALITY_MEDIUMS" "MEDIUM_UNAVAILABLE_UPGRADE_SKIP_BT_LOW_QUALITY_MEDIUMS" @@ -1905,31 +2181,50 @@ static const char OperationResultDetail_names[] = "MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_NOT_AVAILABLE" "MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_P2P_RESOURCE_NOT_AVAILABLE" "MISCELLEANEOUS_BLE_SYSTEM_SERVICE_NULL" + "MISCELLEANEOUS_BLUETOOTH_CHANGE_DEVICE_NAME_FAILURE" "MISCELLEANEOUS_BLUETOOTH_MAC_ADDRESS_NULL" "MISCELLEANEOUS_BT_NOT_ACCEPTING_CONNECTION_FOR_WORK_PROFILE" "MISCELLEANEOUS_BT_SYSTEM_SERVICE_NULL" "MISCELLEANEOUS_L2CAP_SYSTEM_SERVICE_NULL" "MISCELLEANEOUS_MOVE_TO_NEW_MEDIUM" + "MISCELLEANEOUS_WEB_RTC_FAILED_TO_RECEIVE_MESSAGE" "MISCELLEANEOUS_WEB_RTC_GET_DROIDGUARD_RESULT_FAILURE" + "MISCELLEANEOUS_WEB_RTC_ICE_SERVER_NULL" "MISCELLEANEOUS_WEB_RTC_TACHYON_SIGNALING_MESSENGER_NULL" "MISCELLEANEOUS_WIFI_AWARE_SYSTEM_SERVICE_NULL" "MISCELLEANEOUS_WIFI_DIRECT_SYSTEM_SERVICE_NULL" "MISCELLEANEOUS_WIFI_HOTSPOT_SOFT_AP_BLOCKED_BY_PROVISION" "MISCELLEANEOUS_WIFI_HOTSPOT_SYSTEM_SERVICE_NULL" "MISCELLEANEOUS_WIFI_LAN_SYSTEM_SERVICE_NULL" + "MISCELLEANEOUS_WORK_SOURCE_NULL" + "NEARBY_AUTHENTICATION_FAILURE" + "NEARBY_BAD_FILE_DESCRIPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD" "NEARBY_BLE_ADVERTISEMENT_MAPPING_TO_MAC_ERROR" + "NEARBY_BLE_ADVERTISE_TO_BYTES_FAILURE" "NEARBY_BLE_ENDPOINT_CHANNEL_CREATION_FAILURE" + "NEARBY_BLE_FAST_ADVERTISE_TO_BYTES_FAILURE" "NEARBY_BLE_GATT_ADVERTISEMENT_NULL_FOR_CONNECTION" "NEARBY_BLE_GATT_NULL_CALLBACK" + "NEARBY_BLE_INVALID_PCP_OPTIONS" "NEARBY_BLE_OPERATION_REGISTERED_FAILED" + "NEARBY_BLUETOOTH_ADVERTISE_TO_BYTES_FAILURE" + "NEARBY_BLUETOOTH_INVALID_PCP_OPTIONS" "NEARBY_BLUETOOTH_MAC_ADDRESS_INVALID_FOR_CONNECT" + "NEARBY_BLUETOOTH_NO_CLIENT_REGISTER_FOR_SCAN" + "NEARBY_BLUETOOTH_RECONNECT_MAC_NULL" "NEARBY_BT_ENDPOINT_CHANNEL_CREATION_FAILURE" "NEARBY_BT_MULTIPLEX_SOCKET_DISABLED" "NEARBY_BT_NULL_CALLBACK" "NEARBY_BT_OPERATION_REGISTERED_FAILED" "NEARBY_BT_VIRTUAL_SOCKET_CREATION_FAILURE" + "NEARBY_CAN_NOT_OBTAIN_DEVICE_PROVIDER" + "NEARBY_CONNECTIVITY_INFO_NULL_OR_WRONG" + "NEARBY_CONNECT_TO_ALL_MEDIUMS_FAILURE" + "NEARBY_ENCRYPTION_FAILURE" + "NEARBY_ENDPOINT_ID_MISMATCH" "NEARBY_GENERIC_CONNECTION_CLOSED" "NEARBY_GENERIC_ENDPOINT_UNENCRYPTED" + "NEARBY_GENERIC_INCOMING_PAYLOAD_CREATION_FAILURE" "NEARBY_GENERIC_INCOMING_PAYLOAD_NOT_DATA_TYPE" "NEARBY_GENERIC_NEW_ENDPOINT_CHANNEL_NULL" "NEARBY_GENERIC_OLD_ENDPOINT_CHANNEL_NULL" @@ -1944,6 +2239,7 @@ static const char OperationResultDetail_names[] = "NEARBY_GENERIC_REMOTE_REPORT_PAYLOADS_ERROR" "NEARBY_GENERIC_REMOTE_UPGRADE_FAILURE" "NEARBY_GENERIC_SEND_PAYLOAD_EXECUTOR_NULL" + "NEARBY_INSTANT_CONNECTION_WRONG_CONNECTIVITY_INFO" "NEARBY_L2CAP_ENDPOINT_CHANNEL_CREATION_FAILURE" "NEARBY_L2CAP_NULL_CALLBACK" "NEARBY_L2CAP_OPERATION_REGISTERED_FAILED" @@ -1952,18 +2248,39 @@ static const char OperationResultDetail_names[] = "NEARBY_LAN_MULTIPLEX_SOCKET_DISABLED" "NEARBY_LAN_NULL_CALLBACK" "NEARBY_LAN_OPERATION_REGISTERED_FAILED" + "NEARBY_LAN_RECONNECT_CONNECTION_INFO_NULL" + "NEARBY_LAN_RECONNECT_IP_NULL" "NEARBY_LAN_VIRTUAL_SOCKET_CREATION_FAILURE" + "NEARBY_LAN_VIRTUAL_SOCKET_NULL" + "NEARBY_LOCAL_CLIENT_STATE_WRONG" + "NEARBY_NEED_METHOD_OVERRIDE" + "NEARBY_NFC_ADVERTISE_TO_BYTES_FAILURE" "NEARBY_NFC_ENDPOINT_CHANNEL_CREATION_FAILURE" + "NEARBY_NFC_INVALID_PCP_OPTIONS" "NEARBY_NFC_NULL_CALLBACK" + "NEARBY_NOT_ADVERTISING_OR_LISTENING" + "NEARBY_REMOTE_EXCEPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD" + "NEARBY_SETUP_STRATEGY_FAILURE" + "NEARBY_TX_ADVERTISEMENT_NULL" + "NEARBY_UPGRADE_PATH_ON_WRONG_MEDIUM" + "NEARBY_USB_ADVERTISE_TO_BYTES_FAILURE" "NEARBY_USB_ENDPOINT_CHANNEL_CREATION_FAILURE" + "NEARBY_USB_INVALID_PCP_OPTIONS" "NEARBY_USB_NULL_CALLBACK" + "NEARBY_UWB_INVALID_PCP_OPTIONS" "NEARBY_WEB_RTC_CONNECTION_FLOW_NULL" "NEARBY_WEB_RTC_ENDPOINT_CHANNEL_CREATION_FAILURE" + "NEARBY_WEB_RTC_INVALID_PCP_OPTIONS" + "NEARBY_WEB_RTC_NO_LISTENING_PEER_FOUND" "NEARBY_WEB_RTC_NULL_CALLBACK" "NEARBY_WEB_RTC_OPERATION_REGISTERED_FAILED" + "NEARBY_WEB_RTC_RECONNECT_PEER_ID_NULL" + "NEARBY_WIFI_AWARE_ADVERTISE_TO_BYTES_FAILURE" "NEARBY_WIFI_AWARE_ENDPOINT_CHANNEL_CREATION_FAILURE" + "NEARBY_WIFI_AWARE_INVALID_PCP_OPTIONS" "NEARBY_WIFI_AWARE_NULL_CALLBACK" "NEARBY_WIFI_AWARE_OPERATION_REGISTERED_FAILED" + "NEARBY_WIFI_AWARE_RECONNECT_META_DATA_NULL" "NEARBY_WIFI_DIRECT_ENDPOINT_CHANNEL_CREATION_FAILURE" "NEARBY_WIFI_DIRECT_HOST_ON_SRD_CHANNELS" "NEARBY_WIFI_DIRECT_NO_GROUP_FOR_LISTENING" @@ -1973,6 +2290,8 @@ static const char OperationResultDetail_names[] = "NEARBY_WIFI_DIRECT_OPERATION_REGISTERED_FAILED" "NEARBY_WIFI_DIRECT_P2P_NON_DBS_WANT_2G_BUT_AP_5G" "NEARBY_WIFI_DIRECT_P2P_NON_DBS_WANT_5G_BUT_AP_2G" + "NEARBY_WIFI_DIRECT_RECONNECT_CONNECT_META_DATA_NULL" + "NEARBY_WIFI_DIRECT_RECONNECT_META_DATA_NULL" "NEARBY_WIFI_HOTSPOT_CLIENT_OPERATION_REGISTERED_FAILED" "NEARBY_WIFI_HOTSPOT_DIRECT_OPERATION_REGISTERED_FAILED" "NEARBY_WIFI_HOTSPOT_ENDPOINT_CHANNEL_CREATION_FAILURE" @@ -1982,513 +2301,867 @@ static const char OperationResultDetail_names[] = "NEARBY_WIFI_HOTSPOT_NULL_CALLBACK" "NEARBY_WIFI_HOTSPOT_P2P_NON_DBS_WANT_2G_BUT_AP_5G" "NEARBY_WIFI_HOTSPOT_P2P_NON_DBS_WANT_5G_BUT_AP_2G" + "NEARBY_WIFI_HOTSPOT_RECONNECT_CONNECT_META_DATA_NULL" + "NEARBY_WIFI_HOTSPOT_RECONNECT_META_DATA_NULL" "NEARBY_WIFI_HOTSPOT_SOFT_AP_OPERATION_REGISTERED_FAILED" + "NEARBY_WIFI_LAN_ADVERTISE_TO_BYTES_FAILURE" + "NEARBY_WIFI_LAN_INVALID_PCP_OPTIONS" "NEARBY_WIFI_LAN_IP_ADDRESS_ERROR"; -static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry OperationResultDetail_entries[] = { - { {OperationResultDetail_names + 0, 45}, 519 }, - { {OperationResultDetail_names + 45, 50}, 504 }, - { {OperationResultDetail_names + 95, 49}, 505 }, - { {OperationResultDetail_names + 144, 46}, 515 }, - { {OperationResultDetail_names + 190, 52}, 506 }, - { {OperationResultDetail_names + 242, 50}, 507 }, - { {OperationResultDetail_names + 292, 50}, 508 }, - { {OperationResultDetail_names + 342, 46}, 514 }, - { {OperationResultDetail_names + 388, 50}, 509 }, - { {OperationResultDetail_names + 438, 54}, 513 }, - { {OperationResultDetail_names + 492, 57}, 510 }, - { {OperationResultDetail_names + 549, 58}, 511 }, - { {OperationResultDetail_names + 607, 59}, 512 }, - { {OperationResultDetail_names + 666, 40}, 501 }, - { {OperationResultDetail_names + 706, 36}, 522 }, - { {OperationResultDetail_names + 742, 41}, 502 }, - { {OperationResultDetail_names + 783, 37}, 523 }, - { {OperationResultDetail_names + 820, 44}, 500 }, - { {OperationResultDetail_names + 864, 46}, 503 }, - { {OperationResultDetail_names + 910, 50}, 520 }, - { {OperationResultDetail_names + 960, 53}, 516 }, - { {OperationResultDetail_names + 1013, 54}, 517 }, - { {OperationResultDetail_names + 1067, 55}, 518 }, - { {OperationResultDetail_names + 1122, 51}, 521 }, - { {OperationResultDetail_names + 1173, 49}, 2002 }, - { {OperationResultDetail_names + 1222, 48}, 2004 }, - { {OperationResultDetail_names + 1270, 51}, 2003 }, - { {OperationResultDetail_names + 1321, 49}, 2005 }, - { {OperationResultDetail_names + 1370, 49}, 2006 }, - { {OperationResultDetail_names + 1419, 49}, 2011 }, - { {OperationResultDetail_names + 1468, 53}, 2007 }, - { {OperationResultDetail_names + 1521, 56}, 2008 }, - { {OperationResultDetail_names + 1577, 57}, 2010 }, - { {OperationResultDetail_names + 1634, 58}, 2009 }, - { {OperationResultDetail_names + 1692, 46}, 2012 }, - { {OperationResultDetail_names + 1738, 47}, 2015 }, - { {OperationResultDetail_names + 1785, 47}, 2013 }, - { {OperationResultDetail_names + 1832, 48}, 2014 }, - { {OperationResultDetail_names + 1880, 43}, 2016 }, - { {OperationResultDetail_names + 1923, 63}, 2000 }, - { {OperationResultDetail_names + 1986, 59}, 2001 }, - { {OperationResultDetail_names + 2045, 47}, 3502 }, - { {OperationResultDetail_names + 2092, 47}, 3513 }, - { {OperationResultDetail_names + 2139, 47}, 3539 }, - { {OperationResultDetail_names + 2186, 44}, 3501 }, - { {OperationResultDetail_names + 2230, 41}, 3518 }, - { {OperationResultDetail_names + 2271, 46}, 3504 }, - { {OperationResultDetail_names + 2317, 46}, 3541 }, - { {OperationResultDetail_names + 2363, 65}, 3555 }, - { {OperationResultDetail_names + 2428, 37}, 3538 }, - { {OperationResultDetail_names + 2465, 39}, 3553 }, - { {OperationResultDetail_names + 2504, 59}, 3551 }, - { {OperationResultDetail_names + 2563, 45}, 3550 }, - { {OperationResultDetail_names + 2608, 39}, 3525 }, - { {OperationResultDetail_names + 2647, 49}, 3503 }, - { {OperationResultDetail_names + 2696, 42}, 3526 }, - { {OperationResultDetail_names + 2738, 49}, 3540 }, - { {OperationResultDetail_names + 2787, 68}, 3554 }, - { {OperationResultDetail_names + 2855, 47}, 3505 }, - { {OperationResultDetail_names + 2902, 47}, 3531 }, - { {OperationResultDetail_names + 2949, 47}, 3542 }, - { {OperationResultDetail_names + 2996, 28}, 3529 }, - { {OperationResultDetail_names + 3024, 47}, 3506 }, - { {OperationResultDetail_names + 3071, 47}, 3547 }, - { {OperationResultDetail_names + 3118, 47}, 3511 }, - { {OperationResultDetail_names + 3165, 51}, 3507 }, - { {OperationResultDetail_names + 3216, 47}, 3512 }, - { {OperationResultDetail_names + 3263, 39}, 3523 }, - { {OperationResultDetail_names + 3302, 51}, 3543 }, - { {OperationResultDetail_names + 3353, 38}, 3500 }, - { {OperationResultDetail_names + 3391, 54}, 3508 }, - { {OperationResultDetail_names + 3445, 44}, 3552 }, - { {OperationResultDetail_names + 3489, 53}, 3515 }, - { {OperationResultDetail_names + 3542, 51}, 3514 }, - { {OperationResultDetail_names + 3593, 42}, 3522 }, - { {OperationResultDetail_names + 3635, 62}, 3527 }, - { {OperationResultDetail_names + 3697, 65}, 3528 }, - { {OperationResultDetail_names + 3762, 54}, 3544 }, - { {OperationResultDetail_names + 3816, 46}, 3549 }, - { {OperationResultDetail_names + 3862, 55}, 3510 }, - { {OperationResultDetail_names + 3917, 55}, 3532 }, - { {OperationResultDetail_names + 3972, 54}, 3516 }, - { {OperationResultDetail_names + 4026, 43}, 3520 }, - { {OperationResultDetail_names + 4069, 55}, 3535 }, - { {OperationResultDetail_names + 4124, 51}, 3537 }, - { {OperationResultDetail_names + 4175, 55}, 3546 }, - { {OperationResultDetail_names + 4230, 56}, 3509 }, - { {OperationResultDetail_names + 4286, 56}, 3533 }, - { {OperationResultDetail_names + 4342, 55}, 3517 }, - { {OperationResultDetail_names + 4397, 44}, 3521 }, - { {OperationResultDetail_names + 4441, 47}, 3530 }, - { {OperationResultDetail_names + 4488, 56}, 3534 }, - { {OperationResultDetail_names + 4544, 52}, 3536 }, - { {OperationResultDetail_names + 4596, 56}, 3545 }, - { {OperationResultDetail_names + 4652, 50}, 3548 }, - { {OperationResultDetail_names + 4702, 40}, 3519 }, - { {OperationResultDetail_names + 4742, 38}, 3524 }, - { {OperationResultDetail_names + 4780, 14}, 1 }, - { {OperationResultDetail_names + 4794, 14}, 0 }, - { {OperationResultDetail_names + 4808, 46}, 1000 }, - { {OperationResultDetail_names + 4854, 39}, 1001 }, - { {OperationResultDetail_names + 4893, 30}, 1002 }, - { {OperationResultDetail_names + 4923, 36}, 1003 }, - { {OperationResultDetail_names + 4959, 35}, 1004 }, - { {OperationResultDetail_names + 4994, 27}, 3005 }, - { {OperationResultDetail_names + 5021, 26}, 3007 }, - { {OperationResultDetail_names + 5047, 29}, 3006 }, - { {OperationResultDetail_names + 5076, 27}, 3009 }, - { {OperationResultDetail_names + 5103, 27}, 3013 }, - { {OperationResultDetail_names + 5130, 27}, 3014 }, - { {OperationResultDetail_names + 5157, 31}, 3008 }, - { {OperationResultDetail_names + 5188, 34}, 3012 }, - { {OperationResultDetail_names + 5222, 35}, 3010 }, - { {OperationResultDetail_names + 5257, 36}, 3011 }, - { {OperationResultDetail_names + 5293, 21}, 3000 }, - { {OperationResultDetail_names + 5314, 21}, 3001 }, - { {OperationResultDetail_names + 5335, 21}, 3002 }, - { {OperationResultDetail_names + 5356, 24}, 3003 }, - { {OperationResultDetail_names + 5380, 29}, 3004 }, - { {OperationResultDetail_names + 5409, 51}, 1534 }, - { {OperationResultDetail_names + 5460, 60}, 1535 }, - { {OperationResultDetail_names + 5520, 47}, 1515 }, - { {OperationResultDetail_names + 5567, 36}, 1505 }, - { {OperationResultDetail_names + 5603, 42}, 1507 }, - { {OperationResultDetail_names + 5645, 46}, 1516 }, - { {OperationResultDetail_names + 5691, 45}, 1501 }, - { {OperationResultDetail_names + 5736, 38}, 1506 }, - { {OperationResultDetail_names + 5774, 47}, 1517 }, - { {OperationResultDetail_names + 5821, 36}, 1513 }, - { {OperationResultDetail_names + 5857, 54}, 1532 }, - { {OperationResultDetail_names + 5911, 49}, 1503 }, - { {OperationResultDetail_names + 5960, 52}, 1504 }, - { {OperationResultDetail_names + 6012, 47}, 1518 }, - { {OperationResultDetail_names + 6059, 36}, 1512 }, - { {OperationResultDetail_names + 6095, 60}, 1536 }, - { {OperationResultDetail_names + 6155, 43}, 1533 }, - { {OperationResultDetail_names + 6198, 38}, 1502 }, - { {OperationResultDetail_names + 6236, 41}, 1537 }, - { {OperationResultDetail_names + 6277, 55}, 1526 }, - { {OperationResultDetail_names + 6332, 54}, 1530 }, - { {OperationResultDetail_names + 6386, 57}, 1527 }, - { {OperationResultDetail_names + 6443, 55}, 1529 }, - { {OperationResultDetail_names + 6498, 55}, 1531 }, - { {OperationResultDetail_names + 6553, 59}, 1528 }, - { {OperationResultDetail_names + 6612, 47}, 1519 }, - { {OperationResultDetail_names + 6659, 36}, 1514 }, - { {OperationResultDetail_names + 6695, 51}, 1520 }, - { {OperationResultDetail_names + 6746, 40}, 1508 }, - { {OperationResultDetail_names + 6786, 38}, 1538 }, - { {OperationResultDetail_names + 6824, 54}, 1521 }, - { {OperationResultDetail_names + 6878, 43}, 1509 }, - { {OperationResultDetail_names + 6921, 52}, 1500 }, - { {OperationResultDetail_names + 6973, 55}, 1523 }, - { {OperationResultDetail_names + 7028, 44}, 1511 }, - { {OperationResultDetail_names + 7072, 57}, 1525 }, - { {OperationResultDetail_names + 7129, 56}, 1522 }, - { {OperationResultDetail_names + 7185, 45}, 1510 }, - { {OperationResultDetail_names + 7230, 58}, 1524 }, - { {OperationResultDetail_names + 7288, 38}, 2503 }, - { {OperationResultDetail_names + 7326, 41}, 2500 }, - { {OperationResultDetail_names + 7367, 59}, 2510 }, - { {OperationResultDetail_names + 7426, 37}, 2505 }, - { {OperationResultDetail_names + 7463, 40}, 2504 }, - { {OperationResultDetail_names + 7503, 33}, 2501 }, - { {OperationResultDetail_names + 7536, 52}, 2511 }, - { {OperationResultDetail_names + 7588, 55}, 2512 }, - { {OperationResultDetail_names + 7643, 45}, 2506 }, - { {OperationResultDetail_names + 7688, 46}, 2507 }, - { {OperationResultDetail_names + 7734, 56}, 2502 }, - { {OperationResultDetail_names + 7790, 47}, 2509 }, - { {OperationResultDetail_names + 7837, 43}, 2508 }, - { {OperationResultDetail_names + 7880, 45}, 4500 }, - { {OperationResultDetail_names + 7925, 44}, 4504 }, - { {OperationResultDetail_names + 7969, 49}, 4515 }, - { {OperationResultDetail_names + 8018, 29}, 4518 }, - { {OperationResultDetail_names + 8047, 38}, 4536 }, - { {OperationResultDetail_names + 8085, 48}, 4501 }, - { {OperationResultDetail_names + 8133, 43}, 4506 }, - { {OperationResultDetail_names + 8176, 35}, 4530 }, - { {OperationResultDetail_names + 8211, 23}, 4520 }, - { {OperationResultDetail_names + 8234, 37}, 4538 }, - { {OperationResultDetail_names + 8271, 41}, 4563 }, - { {OperationResultDetail_names + 8312, 32}, 4503 }, - { {OperationResultDetail_names + 8344, 35}, 4514 }, - { {OperationResultDetail_names + 8379, 45}, 4552 }, - { {OperationResultDetail_names + 8424, 40}, 4532 }, - { {OperationResultDetail_names + 8464, 40}, 4535 }, - { {OperationResultDetail_names + 8504, 48}, 4547 }, - { {OperationResultDetail_names + 8552, 60}, 4556 }, - { {OperationResultDetail_names + 8612, 56}, 4558 }, - { {OperationResultDetail_names + 8668, 60}, 4557 }, - { {OperationResultDetail_names + 8728, 56}, 4553 }, - { {OperationResultDetail_names + 8784, 52}, 4555 }, - { {OperationResultDetail_names + 8836, 56}, 4554 }, - { {OperationResultDetail_names + 8892, 43}, 4559 }, - { {OperationResultDetail_names + 8935, 43}, 4560 }, - { {OperationResultDetail_names + 8978, 37}, 4561 }, - { {OperationResultDetail_names + 9015, 41}, 4562 }, - { {OperationResultDetail_names + 9056, 46}, 4505 }, - { {OperationResultDetail_names + 9102, 26}, 4519 }, - { {OperationResultDetail_names + 9128, 40}, 4537 }, - { {OperationResultDetail_names + 9168, 29}, 4566 }, - { {OperationResultDetail_names + 9197, 44}, 4507 }, - { {OperationResultDetail_names + 9241, 36}, 4531 }, - { {OperationResultDetail_names + 9277, 24}, 4525 }, - { {OperationResultDetail_names + 9301, 38}, 4539 }, - { {OperationResultDetail_names + 9339, 42}, 4564 }, - { {OperationResultDetail_names + 9381, 44}, 4508 }, - { {OperationResultDetail_names + 9425, 24}, 4522 }, - { {OperationResultDetail_names + 9449, 44}, 4513 }, - { {OperationResultDetail_names + 9493, 24}, 4521 }, - { {OperationResultDetail_names + 9517, 35}, 4502 }, - { {OperationResultDetail_names + 9552, 48}, 4512 }, - { {OperationResultDetail_names + 9600, 28}, 4524 }, - { {OperationResultDetail_names + 9628, 42}, 4540 }, - { {OperationResultDetail_names + 9670, 51}, 4509 }, - { {OperationResultDetail_names + 9721, 31}, 4523 }, - { {OperationResultDetail_names + 9752, 45}, 4541 }, - { {OperationResultDetail_names + 9797, 52}, 4511 }, - { {OperationResultDetail_names + 9849, 39}, 4516 }, - { {OperationResultDetail_names + 9888, 41}, 4533 }, - { {OperationResultDetail_names + 9929, 32}, 4527 }, - { {OperationResultDetail_names + 9961, 32}, 4529 }, - { {OperationResultDetail_names + 9993, 28}, 4528 }, - { {OperationResultDetail_names + 10021, 46}, 4546 }, - { {OperationResultDetail_names + 10067, 48}, 4549 }, - { {OperationResultDetail_names + 10115, 48}, 4551 }, - { {OperationResultDetail_names + 10163, 54}, 4545 }, - { {OperationResultDetail_names + 10217, 54}, 4542 }, - { {OperationResultDetail_names + 10271, 53}, 4510 }, - { {OperationResultDetail_names + 10324, 40}, 4517 }, - { {OperationResultDetail_names + 10364, 52}, 4544 }, - { {OperationResultDetail_names + 10416, 44}, 4534 }, - { {OperationResultDetail_names + 10460, 33}, 4526 }, - { {OperationResultDetail_names + 10493, 49}, 4548 }, - { {OperationResultDetail_names + 10542, 49}, 4550 }, - { {OperationResultDetail_names + 10591, 55}, 4543 }, - { {OperationResultDetail_names + 10646, 32}, 4565 }, +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry OperationResultCode_entries[] = { + { {OperationResultCode_names + 0, 36}, 2034 }, + { {OperationResultCode_names + 36, 34}, 2030 }, + { {OperationResultCode_names + 70, 32}, 2018 }, + { {OperationResultCode_names + 102, 32}, 2023 }, + { {OperationResultCode_names + 134, 23}, 2029 }, + { {OperationResultCode_names + 157, 38}, 2019 }, + { {OperationResultCode_names + 195, 38}, 2024 }, + { {OperationResultCode_names + 233, 45}, 519 }, + { {OperationResultCode_names + 278, 50}, 504 }, + { {OperationResultCode_names + 328, 49}, 505 }, + { {OperationResultCode_names + 377, 46}, 515 }, + { {OperationResultCode_names + 423, 52}, 506 }, + { {OperationResultCode_names + 475, 50}, 507 }, + { {OperationResultCode_names + 525, 50}, 508 }, + { {OperationResultCode_names + 575, 46}, 514 }, + { {OperationResultCode_names + 621, 50}, 509 }, + { {OperationResultCode_names + 671, 54}, 513 }, + { {OperationResultCode_names + 725, 57}, 510 }, + { {OperationResultCode_names + 782, 58}, 511 }, + { {OperationResultCode_names + 840, 59}, 512 }, + { {OperationResultCode_names + 899, 40}, 501 }, + { {OperationResultCode_names + 939, 36}, 522 }, + { {OperationResultCode_names + 975, 41}, 502 }, + { {OperationResultCode_names + 1016, 37}, 523 }, + { {OperationResultCode_names + 1053, 44}, 500 }, + { {OperationResultCode_names + 1097, 46}, 503 }, + { {OperationResultCode_names + 1143, 50}, 520 }, + { {OperationResultCode_names + 1193, 53}, 516 }, + { {OperationResultCode_names + 1246, 54}, 517 }, + { {OperationResultCode_names + 1300, 55}, 518 }, + { {OperationResultCode_names + 1355, 51}, 521 }, + { {OperationResultCode_names + 1406, 34}, 2035 }, + { {OperationResultCode_names + 1440, 49}, 2002 }, + { {OperationResultCode_names + 1489, 48}, 2004 }, + { {OperationResultCode_names + 1537, 51}, 2003 }, + { {OperationResultCode_names + 1588, 49}, 2005 }, + { {OperationResultCode_names + 1637, 49}, 2006 }, + { {OperationResultCode_names + 1686, 49}, 2011 }, + { {OperationResultCode_names + 1735, 53}, 2007 }, + { {OperationResultCode_names + 1788, 56}, 2008 }, + { {OperationResultCode_names + 1844, 57}, 2010 }, + { {OperationResultCode_names + 1901, 58}, 2009 }, + { {OperationResultCode_names + 1959, 46}, 2012 }, + { {OperationResultCode_names + 2005, 47}, 2015 }, + { {OperationResultCode_names + 2052, 47}, 2013 }, + { {OperationResultCode_names + 2099, 48}, 2014 }, + { {OperationResultCode_names + 2147, 58}, 2031 }, + { {OperationResultCode_names + 2205, 32}, 2020 }, + { {OperationResultCode_names + 2237, 32}, 2025 }, + { {OperationResultCode_names + 2269, 28}, 2032 }, + { {OperationResultCode_names + 2297, 25}, 2028 }, + { {OperationResultCode_names + 2322, 29}, 2017 }, + { {OperationResultCode_names + 2351, 43}, 2016 }, + { {OperationResultCode_names + 2394, 32}, 2022 }, + { {OperationResultCode_names + 2426, 32}, 2027 }, + { {OperationResultCode_names + 2458, 63}, 2000 }, + { {OperationResultCode_names + 2521, 59}, 2001 }, + { {OperationResultCode_names + 2580, 37}, 2021 }, + { {OperationResultCode_names + 2617, 37}, 2026 }, + { {OperationResultCode_names + 2654, 35}, 2033 }, + { {OperationResultCode_names + 2689, 32}, 3599 }, + { {OperationResultCode_names + 2721, 47}, 3585 }, + { {OperationResultCode_names + 2768, 47}, 3502 }, + { {OperationResultCode_names + 2815, 47}, 3513 }, + { {OperationResultCode_names + 2862, 29}, 3591 }, + { {OperationResultCode_names + 2891, 47}, 3539 }, + { {OperationResultCode_names + 2938, 42}, 3586 }, + { {OperationResultCode_names + 2980, 42}, 3584 }, + { {OperationResultCode_names + 3022, 47}, 3598 }, + { {OperationResultCode_names + 3069, 44}, 3501 }, + { {OperationResultCode_names + 3113, 41}, 3518 }, + { {OperationResultCode_names + 3154, 35}, 3590 }, + { {OperationResultCode_names + 3189, 48}, 3587 }, + { {OperationResultCode_names + 3237, 46}, 3504 }, + { {OperationResultCode_names + 3283, 46}, 3573 }, + { {OperationResultCode_names + 3329, 48}, 3572 }, + { {OperationResultCode_names + 3377, 44}, 3574 }, + { {OperationResultCode_names + 3421, 46}, 3541 }, + { {OperationResultCode_names + 3467, 65}, 3555 }, + { {OperationResultCode_names + 3532, 43}, 3571 }, + { {OperationResultCode_names + 3575, 44}, 3570 }, + { {OperationResultCode_names + 3619, 36}, 3559 }, + { {OperationResultCode_names + 3655, 42}, 3560 }, + { {OperationResultCode_names + 3697, 35}, 3561 }, + { {OperationResultCode_names + 3732, 36}, 3563 }, + { {OperationResultCode_names + 3768, 36}, 3567 }, + { {OperationResultCode_names + 3804, 47}, 3569 }, + { {OperationResultCode_names + 3851, 36}, 3568 }, + { {OperationResultCode_names + 3887, 40}, 3562 }, + { {OperationResultCode_names + 3927, 43}, 3566 }, + { {OperationResultCode_names + 3970, 44}, 3564 }, + { {OperationResultCode_names + 4014, 45}, 3565 }, + { {OperationResultCode_names + 4059, 37}, 3558 }, + { {OperationResultCode_names + 4096, 37}, 3538 }, + { {OperationResultCode_names + 4133, 39}, 3553 }, + { {OperationResultCode_names + 4172, 59}, 3551 }, + { {OperationResultCode_names + 4231, 45}, 3550 }, + { {OperationResultCode_names + 4276, 49}, 3600 }, + { {OperationResultCode_names + 4325, 39}, 3525 }, + { {OperationResultCode_names + 4364, 49}, 3503 }, + { {OperationResultCode_names + 4413, 57}, 3556 }, + { {OperationResultCode_names + 4470, 42}, 3526 }, + { {OperationResultCode_names + 4512, 49}, 3540 }, + { {OperationResultCode_names + 4561, 68}, 3554 }, + { {OperationResultCode_names + 4629, 47}, 3505 }, + { {OperationResultCode_names + 4676, 47}, 3531 }, + { {OperationResultCode_names + 4723, 38}, 3597 }, + { {OperationResultCode_names + 4761, 47}, 3542 }, + { {OperationResultCode_names + 4808, 28}, 3529 }, + { {OperationResultCode_names + 4836, 30}, 3592 }, + { {OperationResultCode_names + 4866, 38}, 3601 }, + { {OperationResultCode_names + 4904, 47}, 3506 }, + { {OperationResultCode_names + 4951, 47}, 3547 }, + { {OperationResultCode_names + 4998, 40}, 3593 }, + { {OperationResultCode_names + 5038, 47}, 3511 }, + { {OperationResultCode_names + 5085, 40}, 3596 }, + { {OperationResultCode_names + 5125, 51}, 3507 }, + { {OperationResultCode_names + 5176, 47}, 3512 }, + { {OperationResultCode_names + 5223, 39}, 3523 }, + { {OperationResultCode_names + 5262, 51}, 3543 }, + { {OperationResultCode_names + 5313, 43}, 3557 }, + { {OperationResultCode_names + 5356, 47}, 3577 }, + { {OperationResultCode_names + 5403, 47}, 3579 }, + { {OperationResultCode_names + 5450, 49}, 3576 }, + { {OperationResultCode_names + 5499, 45}, 3578 }, + { {OperationResultCode_names + 5544, 38}, 3500 }, + { {OperationResultCode_names + 5582, 54}, 3508 }, + { {OperationResultCode_names + 5636, 44}, 3552 }, + { {OperationResultCode_names + 5680, 53}, 3515 }, + { {OperationResultCode_names + 5733, 51}, 3514 }, + { {OperationResultCode_names + 5784, 42}, 3522 }, + { {OperationResultCode_names + 5826, 62}, 3527 }, + { {OperationResultCode_names + 5888, 65}, 3528 }, + { {OperationResultCode_names + 5953, 54}, 3544 }, + { {OperationResultCode_names + 6007, 49}, 3589 }, + { {OperationResultCode_names + 6056, 47}, 3595 }, + { {OperationResultCode_names + 6103, 46}, 3549 }, + { {OperationResultCode_names + 6149, 55}, 3510 }, + { {OperationResultCode_names + 6204, 55}, 3532 }, + { {OperationResultCode_names + 6259, 54}, 3516 }, + { {OperationResultCode_names + 6313, 43}, 3520 }, + { {OperationResultCode_names + 6356, 55}, 3535 }, + { {OperationResultCode_names + 6411, 47}, 3575 }, + { {OperationResultCode_names + 6458, 51}, 3537 }, + { {OperationResultCode_names + 6509, 55}, 3546 }, + { {OperationResultCode_names + 6564, 56}, 3509 }, + { {OperationResultCode_names + 6620, 56}, 3533 }, + { {OperationResultCode_names + 6676, 55}, 3517 }, + { {OperationResultCode_names + 6731, 44}, 3521 }, + { {OperationResultCode_names + 6775, 55}, 3581 }, + { {OperationResultCode_names + 6830, 47}, 3530 }, + { {OperationResultCode_names + 6877, 56}, 3534 }, + { {OperationResultCode_names + 6933, 52}, 3536 }, + { {OperationResultCode_names + 6985, 56}, 3545 }, + { {OperationResultCode_names + 7041, 50}, 3548 }, + { {OperationResultCode_names + 7091, 43}, 3580 }, + { {OperationResultCode_names + 7134, 40}, 3519 }, + { {OperationResultCode_names + 7174, 38}, 3524 }, + { {OperationResultCode_names + 7212, 49}, 3583 }, + { {OperationResultCode_names + 7261, 44}, 3582 }, + { {OperationResultCode_names + 7305, 47}, 3588 }, + { {OperationResultCode_names + 7352, 45}, 3594 }, + { {OperationResultCode_names + 7397, 14}, 1 }, + { {OperationResultCode_names + 7411, 14}, 0 }, + { {OperationResultCode_names + 7425, 46}, 1000 }, + { {OperationResultCode_names + 7471, 39}, 1001 }, + { {OperationResultCode_names + 7510, 30}, 1002 }, + { {OperationResultCode_names + 7540, 36}, 1003 }, + { {OperationResultCode_names + 7576, 35}, 1004 }, + { {OperationResultCode_names + 7611, 27}, 3005 }, + { {OperationResultCode_names + 7638, 33}, 3006 }, + { {OperationResultCode_names + 7671, 26}, 3007 }, + { {OperationResultCode_names + 7697, 27}, 3009 }, + { {OperationResultCode_names + 7724, 27}, 3013 }, + { {OperationResultCode_names + 7751, 27}, 3014 }, + { {OperationResultCode_names + 7778, 31}, 3008 }, + { {OperationResultCode_names + 7809, 34}, 3012 }, + { {OperationResultCode_names + 7843, 35}, 3010 }, + { {OperationResultCode_names + 7878, 36}, 3011 }, + { {OperationResultCode_names + 7914, 21}, 3000 }, + { {OperationResultCode_names + 7935, 21}, 3001 }, + { {OperationResultCode_names + 7956, 21}, 3002 }, + { {OperationResultCode_names + 7977, 24}, 3003 }, + { {OperationResultCode_names + 8001, 29}, 3004 }, + { {OperationResultCode_names + 8030, 51}, 1534 }, + { {OperationResultCode_names + 8081, 60}, 1535 }, + { {OperationResultCode_names + 8141, 47}, 1515 }, + { {OperationResultCode_names + 8188, 36}, 1505 }, + { {OperationResultCode_names + 8224, 42}, 1507 }, + { {OperationResultCode_names + 8266, 40}, 1546 }, + { {OperationResultCode_names + 8306, 46}, 1516 }, + { {OperationResultCode_names + 8352, 45}, 1501 }, + { {OperationResultCode_names + 8397, 45}, 1541 }, + { {OperationResultCode_names + 8442, 38}, 1506 }, + { {OperationResultCode_names + 8480, 30}, 1544 }, + { {OperationResultCode_names + 8510, 47}, 1517 }, + { {OperationResultCode_names + 8557, 36}, 1513 }, + { {OperationResultCode_names + 8593, 54}, 1532 }, + { {OperationResultCode_names + 8647, 49}, 1503 }, + { {OperationResultCode_names + 8696, 52}, 1504 }, + { {OperationResultCode_names + 8748, 37}, 1543 }, + { {OperationResultCode_names + 8785, 47}, 1518 }, + { {OperationResultCode_names + 8832, 36}, 1512 }, + { {OperationResultCode_names + 8868, 36}, 1542 }, + { {OperationResultCode_names + 8904, 30}, 1545 }, + { {OperationResultCode_names + 8934, 60}, 1536 }, + { {OperationResultCode_names + 8994, 43}, 1533 }, + { {OperationResultCode_names + 9037, 38}, 1502 }, + { {OperationResultCode_names + 9075, 39}, 1539 }, + { {OperationResultCode_names + 9114, 37}, 1540 }, + { {OperationResultCode_names + 9151, 41}, 1537 }, + { {OperationResultCode_names + 9192, 55}, 1526 }, + { {OperationResultCode_names + 9247, 54}, 1530 }, + { {OperationResultCode_names + 9301, 57}, 1527 }, + { {OperationResultCode_names + 9358, 55}, 1529 }, + { {OperationResultCode_names + 9413, 55}, 1531 }, + { {OperationResultCode_names + 9468, 59}, 1528 }, + { {OperationResultCode_names + 9527, 47}, 1519 }, + { {OperationResultCode_names + 9574, 36}, 1514 }, + { {OperationResultCode_names + 9610, 51}, 1520 }, + { {OperationResultCode_names + 9661, 40}, 1508 }, + { {OperationResultCode_names + 9701, 38}, 1538 }, + { {OperationResultCode_names + 9739, 54}, 1521 }, + { {OperationResultCode_names + 9793, 43}, 1509 }, + { {OperationResultCode_names + 9836, 52}, 1500 }, + { {OperationResultCode_names + 9888, 55}, 1523 }, + { {OperationResultCode_names + 9943, 44}, 1511 }, + { {OperationResultCode_names + 9987, 57}, 1525 }, + { {OperationResultCode_names + 10044, 56}, 1522 }, + { {OperationResultCode_names + 10100, 45}, 1510 }, + { {OperationResultCode_names + 10145, 58}, 1524 }, + { {OperationResultCode_names + 10203, 38}, 2503 }, + { {OperationResultCode_names + 10241, 51}, 2514 }, + { {OperationResultCode_names + 10292, 41}, 2500 }, + { {OperationResultCode_names + 10333, 59}, 2510 }, + { {OperationResultCode_names + 10392, 37}, 2505 }, + { {OperationResultCode_names + 10429, 40}, 2504 }, + { {OperationResultCode_names + 10469, 33}, 2501 }, + { {OperationResultCode_names + 10502, 48}, 2513 }, + { {OperationResultCode_names + 10550, 52}, 2511 }, + { {OperationResultCode_names + 10602, 38}, 2515 }, + { {OperationResultCode_names + 10640, 55}, 2512 }, + { {OperationResultCode_names + 10695, 45}, 2506 }, + { {OperationResultCode_names + 10740, 46}, 2507 }, + { {OperationResultCode_names + 10786, 56}, 2502 }, + { {OperationResultCode_names + 10842, 47}, 2509 }, + { {OperationResultCode_names + 10889, 43}, 2508 }, + { {OperationResultCode_names + 10932, 31}, 2516 }, + { {OperationResultCode_names + 10963, 29}, 4568 }, + { {OperationResultCode_names + 10992, 60}, 4609 }, + { {OperationResultCode_names + 11052, 45}, 4500 }, + { {OperationResultCode_names + 11097, 37}, 4571 }, + { {OperationResultCode_names + 11134, 44}, 4504 }, + { {OperationResultCode_names + 11178, 42}, 4572 }, + { {OperationResultCode_names + 11220, 49}, 4515 }, + { {OperationResultCode_names + 11269, 29}, 4518 }, + { {OperationResultCode_names + 11298, 30}, 4579 }, + { {OperationResultCode_names + 11328, 38}, 4536 }, + { {OperationResultCode_names + 11366, 43}, 4570 }, + { {OperationResultCode_names + 11409, 36}, 4578 }, + { {OperationResultCode_names + 11445, 48}, 4501 }, + { {OperationResultCode_names + 11493, 44}, 4585 }, + { {OperationResultCode_names + 11537, 35}, 4592 }, + { {OperationResultCode_names + 11572, 43}, 4506 }, + { {OperationResultCode_names + 11615, 35}, 4530 }, + { {OperationResultCode_names + 11650, 23}, 4520 }, + { {OperationResultCode_names + 11673, 37}, 4538 }, + { {OperationResultCode_names + 11710, 41}, 4563 }, + { {OperationResultCode_names + 11751, 37}, 4602 }, + { {OperationResultCode_names + 11788, 38}, 4606 }, + { {OperationResultCode_names + 11826, 37}, 4591 }, + { {OperationResultCode_names + 11863, 25}, 4567 }, + { {OperationResultCode_names + 11888, 27}, 4605 }, + { {OperationResultCode_names + 11915, 32}, 4503 }, + { {OperationResultCode_names + 11947, 35}, 4514 }, + { {OperationResultCode_names + 11982, 48}, 4588 }, + { {OperationResultCode_names + 12030, 45}, 4552 }, + { {OperationResultCode_names + 12075, 40}, 4532 }, + { {OperationResultCode_names + 12115, 40}, 4535 }, + { {OperationResultCode_names + 12155, 48}, 4547 }, + { {OperationResultCode_names + 12203, 60}, 4556 }, + { {OperationResultCode_names + 12263, 56}, 4558 }, + { {OperationResultCode_names + 12319, 60}, 4557 }, + { {OperationResultCode_names + 12379, 56}, 4553 }, + { {OperationResultCode_names + 12435, 52}, 4555 }, + { {OperationResultCode_names + 12487, 56}, 4554 }, + { {OperationResultCode_names + 12543, 43}, 4559 }, + { {OperationResultCode_names + 12586, 43}, 4560 }, + { {OperationResultCode_names + 12629, 37}, 4561 }, + { {OperationResultCode_names + 12666, 41}, 4562 }, + { {OperationResultCode_names + 12707, 49}, 4586 }, + { {OperationResultCode_names + 12756, 46}, 4505 }, + { {OperationResultCode_names + 12802, 26}, 4519 }, + { {OperationResultCode_names + 12828, 40}, 4537 }, + { {OperationResultCode_names + 12868, 29}, 4566 }, + { {OperationResultCode_names + 12897, 44}, 4507 }, + { {OperationResultCode_names + 12941, 36}, 4531 }, + { {OperationResultCode_names + 12977, 24}, 4525 }, + { {OperationResultCode_names + 13001, 38}, 4539 }, + { {OperationResultCode_names + 13039, 41}, 4593 }, + { {OperationResultCode_names + 13080, 28}, 4594 }, + { {OperationResultCode_names + 13108, 42}, 4564 }, + { {OperationResultCode_names + 13150, 30}, 4569 }, + { {OperationResultCode_names + 13180, 31}, 4607 }, + { {OperationResultCode_names + 13211, 27}, 4587 }, + { {OperationResultCode_names + 13238, 37}, 4573 }, + { {OperationResultCode_names + 13275, 44}, 4508 }, + { {OperationResultCode_names + 13319, 30}, 4577 }, + { {OperationResultCode_names + 13349, 24}, 4522 }, + { {OperationResultCode_names + 13373, 35}, 4601 }, + { {OperationResultCode_names + 13408, 56}, 4608 }, + { {OperationResultCode_names + 13464, 29}, 4603 }, + { {OperationResultCode_names + 13493, 28}, 4604 }, + { {OperationResultCode_names + 13521, 35}, 4590 }, + { {OperationResultCode_names + 13556, 37}, 4576 }, + { {OperationResultCode_names + 13593, 44}, 4513 }, + { {OperationResultCode_names + 13637, 30}, 4582 }, + { {OperationResultCode_names + 13667, 24}, 4521 }, + { {OperationResultCode_names + 13691, 30}, 4583 }, + { {OperationResultCode_names + 13721, 35}, 4502 }, + { {OperationResultCode_names + 13756, 48}, 4512 }, + { {OperationResultCode_names + 13804, 34}, 4584 }, + { {OperationResultCode_names + 13838, 38}, 4589 }, + { {OperationResultCode_names + 13876, 28}, 4524 }, + { {OperationResultCode_names + 13904, 42}, 4540 }, + { {OperationResultCode_names + 13946, 37}, 4599 }, + { {OperationResultCode_names + 13983, 44}, 4575 }, + { {OperationResultCode_names + 14027, 51}, 4509 }, + { {OperationResultCode_names + 14078, 37}, 4581 }, + { {OperationResultCode_names + 14115, 31}, 4523 }, + { {OperationResultCode_names + 14146, 45}, 4541 }, + { {OperationResultCode_names + 14191, 42}, 4600 }, + { {OperationResultCode_names + 14233, 52}, 4511 }, + { {OperationResultCode_names + 14285, 39}, 4516 }, + { {OperationResultCode_names + 14324, 41}, 4533 }, + { {OperationResultCode_names + 14365, 32}, 4527 }, + { {OperationResultCode_names + 14397, 32}, 4529 }, + { {OperationResultCode_names + 14429, 28}, 4528 }, + { {OperationResultCode_names + 14457, 46}, 4546 }, + { {OperationResultCode_names + 14503, 48}, 4549 }, + { {OperationResultCode_names + 14551, 48}, 4551 }, + { {OperationResultCode_names + 14599, 51}, 4596 }, + { {OperationResultCode_names + 14650, 43}, 4595 }, + { {OperationResultCode_names + 14693, 54}, 4545 }, + { {OperationResultCode_names + 14747, 54}, 4542 }, + { {OperationResultCode_names + 14801, 53}, 4510 }, + { {OperationResultCode_names + 14854, 40}, 4517 }, + { {OperationResultCode_names + 14894, 52}, 4544 }, + { {OperationResultCode_names + 14946, 44}, 4534 }, + { {OperationResultCode_names + 14990, 33}, 4526 }, + { {OperationResultCode_names + 15023, 49}, 4548 }, + { {OperationResultCode_names + 15072, 49}, 4550 }, + { {OperationResultCode_names + 15121, 52}, 4598 }, + { {OperationResultCode_names + 15173, 44}, 4597 }, + { {OperationResultCode_names + 15217, 55}, 4543 }, + { {OperationResultCode_names + 15272, 42}, 4574 }, + { {OperationResultCode_names + 15314, 35}, 4580 }, + { {OperationResultCode_names + 15349, 32}, 4565 }, }; -static const int OperationResultDetail_entries_by_number[] = { - 98, // 0 -> DETAIL_UNKNOWN - 97, // 1 -> DETAIL_SUCCESS - 17, // 500 -> CLIENT_CANCELLATION_REMOTE_IN_CANCELED_STATE - 13, // 501 -> CLIENT_CANCELLATION_LOCAL_CANCEL_PAYLOAD - 15, // 502 -> CLIENT_CANCELLATION_REMOTE_CANCEL_PAYLOAD - 18, // 503 -> CLIENT_CANCELLATION_UPGRADE_CANCELED_BY_REMOTE - 1, // 504 -> CLIENT_CANCELLATION_CANCEL_BLE_OUTGOING_CONNECTION - 2, // 505 -> CLIENT_CANCELLATION_CANCEL_BT_OUTGOING_CONNECTION - 4, // 506 -> CLIENT_CANCELLATION_CANCEL_L2CAP_OUTGOING_CONNECTION - 5, // 507 -> CLIENT_CANCELLATION_CANCEL_LAN_OUTGOING_CONNECTION - 6, // 508 -> CLIENT_CANCELLATION_CANCEL_NFC_OUTGOING_CONNECTION - 8, // 509 -> CLIENT_CANCELLATION_CANCEL_USB_OUTGOING_CONNECTION - 10, // 510 -> CLIENT_CANCELLATION_CANCEL_WIFI_AWARE_OUTGOING_CONNECTION - 11, // 511 -> CLIENT_CANCELLATION_CANCEL_WIFI_DIRECT_OUTGOING_CONNECTION - 12, // 512 -> CLIENT_CANCELLATION_CANCEL_WIFI_HOTSPOT_OUTGOING_CONNECTION - 9, // 513 -> CLIENT_CANCELLATION_CANCEL_WEB_RTC_OUTGOING_CONNECTION - 7, // 514 -> CLIENT_CANCELLATION_CANCEL_OUTGOING_CONNECTION - 3, // 515 -> CLIENT_CANCELLATION_CANCEL_INCOMING_CONNECTION - 20, // 516 -> CLIENT_CANCELLATION_WIFI_AWARE_SERVER_SOCKET_CREATION - 21, // 517 -> CLIENT_CANCELLATION_WIFI_DIRECT_SERVER_SOCKET_CREATION - 22, // 518 -> CLIENT_CANCELLATION_WIFI_HOTSPOT_SERVER_SOCKET_CREATION - 0, // 519 -> CLIENT_CANCELLATION_BT_SERVER_SOCKET_CREATION - 19, // 520 -> CLIENT_CANCELLATION_WEB_RTC_SERVER_SOCKET_CREATION - 23, // 521 -> CLIENT_CANCELLATION_WIFI_LAN_SERVER_SOCKET_CREATION - 14, // 522 -> CLIENT_CANCELLATION_LOCAL_DISCONNECT - 16, // 523 -> CLIENT_CANCELLATION_REMOTE_DISCONNECT - 99, // 1000 -> DEVICE_STATE_ERROR_UNFINISHED_UPGRADE_ATTEMPTS - 100, // 1001 -> DEVICE_STATE_ERROR_USER_HOTSPOT_ENABLED - 101, // 1002 -> DEVICE_STATE_LOCATION_DISABLED - 102, // 1003 -> DEVICE_STATE_RADIO_DISABLING_FAILURE - 103, // 1004 -> DEVICE_STATE_RADIO_ENABLING_FAILURE - 151, // 1500 -> MEDIUM_UNAVAILABLE_WIFI_AWARE_RESOURCE_NOT_AVAILABLE - 125, // 1501 -> MEDIUM_UNAVAILABLE_DIRECT_HOTSPOT_NOT_SUPPORT - 136, // 1502 -> MEDIUM_UNAVAILABLE_SOFT_AP_NOT_SUPPORT - 130, // 1503 -> MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_NOT_SUPPORT - 131, // 1504 -> MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_NOT_SUPPORT_5G - 122, // 1505 -> MEDIUM_UNAVAILABLE_BLE_NOT_AVAILABLE - 126, // 1506 -> MEDIUM_UNAVAILABLE_L2CAP_NOT_AVAILABLE - 123, // 1507 -> MEDIUM_UNAVAILABLE_BLUETOOTH_NOT_AVAILABLE - 147, // 1508 -> MEDIUM_UNAVAILABLE_WEB_RTC_NOT_AVAILABLE - 150, // 1509 -> MEDIUM_UNAVAILABLE_WIFI_AWARE_NOT_AVAILABLE - 156, // 1510 -> MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_NOT_AVAILABLE - 153, // 1511 -> MEDIUM_UNAVAILABLE_WIFI_DIRECT_NOT_AVAILABLE - 133, // 1512 -> MEDIUM_UNAVAILABLE_NFC_NOT_AVAILABLE - 128, // 1513 -> MEDIUM_UNAVAILABLE_LAN_NOT_AVAILABLE - 145, // 1514 -> MEDIUM_UNAVAILABLE_USB_NOT_AVAILABLE - 121, // 1515 -> MEDIUM_UNAVAILABLE_BLE_NC_LOGICAL_NOT_AVAILABLE - 124, // 1516 -> MEDIUM_UNAVAILABLE_BT_NC_LOGICAL_NOT_AVAILABLE - 127, // 1517 -> MEDIUM_UNAVAILABLE_LAN_NC_LOGICAL_NOT_AVAILABLE - 132, // 1518 -> MEDIUM_UNAVAILABLE_NFC_NC_LOGICAL_NOT_AVAILABLE - 144, // 1519 -> MEDIUM_UNAVAILABLE_USB_NC_LOGICAL_NOT_AVAILABLE - 146, // 1520 -> MEDIUM_UNAVAILABLE_WEB_RTC_NC_LOGICAL_NOT_AVAILABLE - 149, // 1521 -> MEDIUM_UNAVAILABLE_WIFI_AWARE_NC_LOGICAL_NOT_AVAILABLE - 155, // 1522 -> MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_NC_LOGICAL_NOT_AVAILABLE - 152, // 1523 -> MEDIUM_UNAVAILABLE_WIFI_DIRECT_NC_LOGICAL_NOT_AVAILABLE - 157, // 1524 -> MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_P2P_RESOURCE_NOT_AVAILABLE - 154, // 1525 -> MEDIUM_UNAVAILABLE_WIFI_DIRECT_P2P_RESOURCE_NOT_AVAILABLE - 138, // 1526 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_BLE_LOW_QUALITY_MEDIUMS - 140, // 1527 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_L2CAP_LOW_QUALITY_MEDIUMS - 143, // 1528 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_WEB_RTC_LOW_QUALITY_MEDIUMS - 141, // 1529 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_LAN_LOW_QUALITY_MEDIUMS - 139, // 1530 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_BT_LOW_QUALITY_MEDIUMS - 142, // 1531 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_USB_LOW_QUALITY_MEDIUMS - 129, // 1532 -> MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_DISRUPTIVE_FALSE - 135, // 1533 -> MEDIUM_UNAVAILABLE_SOFT_AP_DISRUPTIVE_FALSE - 119, // 1534 -> MEDIUM_UNAVAILABLE_ALREADY_HAVE_A_WIFI_DIRECT_GROUP - 120, // 1535 -> MEDIUM_UNAVAILABLE_ALREADY_HOSTING_HOTSPOT_FOR_OTHER_CLIENTS - 134, // 1536 -> MEDIUM_UNAVAILABLE_REJECT_L2CAP_ON_GATT_MULTIPLEX_CONNECTION - 137, // 1537 -> MEDIUM_UNAVAILABLE_UPGRADE_ON_SAME_MEDIUM - 148, // 1538 -> MEDIUM_UNAVAILABLE_WEB_RTC_NO_INTERNET - 39, // 2000 -> CLIENT_WIFI_DIRECT_ALREADY_HOSTING_DIRECT_GROUP_FOR_THIS_CLIENT - 40, // 2001 -> CLIENT_WIFI_HOTSPOT_ALREADY_HOSTING_HOTSPOT_FOR_THIS_CLIENT - 24, // 2002 -> CLIENT_DUPLICATE_ACCEPTING_BLE_CONNECTION_REQUEST - 26, // 2003 -> CLIENT_DUPLICATE_ACCEPTING_L2CAP_CONNECTION_REQUEST - 25, // 2004 -> CLIENT_DUPLICATE_ACCEPTING_BT_CONNECTION_REQUEST - 27, // 2005 -> CLIENT_DUPLICATE_ACCEPTING_LAN_CONNECTION_REQUEST - 28, // 2006 -> CLIENT_DUPLICATE_ACCEPTING_NFC_CONNECTION_REQUEST - 30, // 2007 -> CLIENT_DUPLICATE_ACCEPTING_WEB_RTC_CONNECTION_REQUEST - 31, // 2008 -> CLIENT_DUPLICATE_ACCEPTING_WIFI_AWARE_CONNECTION_REQUEST - 33, // 2009 -> CLIENT_DUPLICATE_ACCEPTING_WIFI_HOTSPOT_CONNECTION_REQUEST - 32, // 2010 -> CLIENT_DUPLICATE_ACCEPTING_WIFI_DIRECT_CONNECTION_REQUEST - 29, // 2011 -> CLIENT_DUPLICATE_ACCEPTING_USB_CONNECTION_REQUEST - 34, // 2012 -> CLIENT_DUPLICATE_WIFI_AWARE_CONNECTION_REQUEST - 36, // 2013 -> CLIENT_DUPLICATE_WIFI_DIRECT_CONNECTION_REQUEST - 37, // 2014 -> CLIENT_DUPLICATE_WIFI_HOTSPOT_CONNECTION_REQUEST - 35, // 2015 -> CLIENT_DUPLICATE_WIFI_AWARE_SUBSCRIBING_REQUEST - 38, // 2016 -> CLIENT_UNSUPPORTED_USB_TO_BE_UPGRADE_MEDIUM - 159, // 2500 -> MISCELLEANEOUS_BLUETOOTH_MAC_ADDRESS_NULL - 163, // 2501 -> MISCELLEANEOUS_MOVE_TO_NEW_MEDIUM - 168, // 2502 -> MISCELLEANEOUS_WIFI_HOTSPOT_SOFT_AP_BLOCKED_BY_PROVISION - 158, // 2503 -> MISCELLEANEOUS_BLE_SYSTEM_SERVICE_NULL - 162, // 2504 -> MISCELLEANEOUS_L2CAP_SYSTEM_SERVICE_NULL - 161, // 2505 -> MISCELLEANEOUS_BT_SYSTEM_SERVICE_NULL - 166, // 2506 -> MISCELLEANEOUS_WIFI_AWARE_SYSTEM_SERVICE_NULL - 167, // 2507 -> MISCELLEANEOUS_WIFI_DIRECT_SYSTEM_SERVICE_NULL - 170, // 2508 -> MISCELLEANEOUS_WIFI_LAN_SYSTEM_SERVICE_NULL - 169, // 2509 -> MISCELLEANEOUS_WIFI_HOTSPOT_SYSTEM_SERVICE_NULL - 160, // 2510 -> MISCELLEANEOUS_BT_NOT_ACCEPTING_CONNECTION_FOR_WORK_PROFILE - 164, // 2511 -> MISCELLEANEOUS_WEB_RTC_GET_DROIDGUARD_RESULT_FAILURE - 165, // 2512 -> MISCELLEANEOUS_WEB_RTC_TACHYON_SIGNALING_MESSENGER_NULL - 114, // 3000 -> IO_FILE_OPENING_ERROR - 115, // 3001 -> IO_FILE_READING_ERROR - 116, // 3002 -> IO_FILE_WRITING_ERROR - 117, // 3003 -> IO_FOLDER_CREATION_ERROR - 118, // 3004 -> IO_STREAM_CREATE_PIPE_FAILURE - 104, // 3005 -> IO_ENDPOINT_IO_ERROR_ON_BLE - 106, // 3006 -> IO_ENDPOINT_IO_ERROR_ON_L2CAP - 105, // 3007 -> IO_ENDPOINT_IO_ERROR_ON_BT - 110, // 3008 -> IO_ENDPOINT_IO_ERROR_ON_WEB_RTC - 107, // 3009 -> IO_ENDPOINT_IO_ERROR_ON_LAN - 112, // 3010 -> IO_ENDPOINT_IO_ERROR_ON_WIFI_DIRECT - 113, // 3011 -> IO_ENDPOINT_IO_ERROR_ON_WIFI_HOTSPOT - 111, // 3012 -> IO_ENDPOINT_IO_ERROR_ON_WIFI_AWARE - 108, // 3013 -> IO_ENDPOINT_IO_ERROR_ON_NFC - 109, // 3014 -> IO_ENDPOINT_IO_ERROR_ON_USB - 69, // 3500 -> CONNECTIVITY_WIFI_AWARE_ATTACH_FAILURE - 44, // 3501 -> CONNECTIVITY_BLUETOOTH_DEVICE_OBTAIN_FAILURE - 41, // 3502 -> CONNECTIVITY_BLE_CLIENT_SOCKET_CREATION_FAILURE - 54, // 3503 -> CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_FAILURE - 46, // 3504 -> CONNECTIVITY_BT_CLIENT_SOCKET_CREATION_FAILURE - 58, // 3505 -> CONNECTIVITY_LAN_CLIENT_SOCKET_CREATION_FAILURE - 62, // 3506 -> CONNECTIVITY_NFC_CLIENT_SOCKET_CREATION_FAILURE - 65, // 3507 -> CONNECTIVITY_WEB_RTC_CLIENT_SOCKET_CREATION_FAILURE - 70, // 3508 -> CONNECTIVITY_WIFI_AWARE_CLIENT_SOCKET_CREATION_FAILURE - 86, // 3509 -> CONNECTIVITY_WIFI_HOTSPOT_CLIENT_SOCKET_CREATION_FAILURE - 79, // 3510 -> CONNECTIVITY_WIFI_DIRECT_CLIENT_SOCKET_CREATION_FAILURE - 64, // 3511 -> CONNECTIVITY_USB_CLIENT_SOCKET_CREATION_FAILURE - 66, // 3512 -> CONNECTIVITY_WEB_RTC_CONNECT_TO_TACHYON_FAILURE - 42, // 3513 -> CONNECTIVITY_BLE_CREATE_GATT_CONNECTION_FAILURE - 73, // 3514 -> CONNECTIVITY_WIFI_AWARE_GET_REMOTE_IP_FRAME_FAILURE - 72, // 3515 -> CONNECTIVITY_WIFI_AWARE_GET_REMOTE_IP_ADDRESS_FAILURE - 81, // 3516 -> CONNECTIVITY_WIFI_DIRECT_INCONSISTENT_HOSTED_WIFI_BAND - 88, // 3517 -> CONNECTIVITY_WIFI_HOTSPOT_INCONSISTENT_HOSTED_WIFI_BAND - 45, // 3518 -> CONNECTIVITY_BLUETOOTH_INVALID_CREDENTIAL - 95, // 3519 -> CONNECTIVITY_WIFI_LAN_INVALID_CREDENTIAL - 82, // 3520 -> CONNECTIVITY_WIFI_DIRECT_INVALID_CREDENTIAL - 89, // 3521 -> CONNECTIVITY_WIFI_HOTSPOT_INVALID_CREDENTIAL - 74, // 3522 -> CONNECTIVITY_WIFI_AWARE_INVALID_CREDENTIAL - 67, // 3523 -> CONNECTIVITY_WEB_RTC_INVALID_CREDENTIAL - 96, // 3524 -> CONNECTIVITY_WIFI_LAN_IP_ADDRESS_ERROR - 53, // 3525 -> CONNECTIVITY_L2CAP_CLIENT_OBTAIN_FAIURE - 55, // 3526 -> CONNECTIVITY_L2CAP_DATA_CONNECTION_FAILURE - 75, // 3527 -> CONNECTIVITY_WIFI_AWARE_L2MESSAGE_NETWORK_AVAILABLE_FRAME_NULL - 76, // 3528 -> CONNECTIVITY_WIFI_AWARE_L2MESSAGE_SEND_HOST_NETWORK_FRAME_FAILURE - 61, // 3529 -> CONNECTIVITY_LAN_UNREACHABLE - 90, // 3530 -> CONNECTIVITY_WIFI_HOTSPOT_LOHS_CREATION_FAILURE - 59, // 3531 -> CONNECTIVITY_LAN_GET_NETWORK_INTERFACES_FAILURE - 80, // 3532 -> CONNECTIVITY_WIFI_DIRECT_GET_NETWORK_INTERFACES_FAILURE - 87, // 3533 -> CONNECTIVITY_WIFI_HOTSPOT_GET_NETWORK_INTERFACES_FAILURE - 91, // 3534 -> CONNECTIVITY_WIFI_HOTSPOT_P2P_CHANNEL_INITIALIZE_FAILURE - 83, // 3535 -> CONNECTIVITY_WIFI_DIRECT_P2P_CHANNEL_INITIALIZE_FAILURE - 92, // 3536 -> CONNECTIVITY_WIFI_HOTSPOT_P2P_GROUP_CREATION_FAILURE - 84, // 3537 -> CONNECTIVITY_WIFI_DIRECT_P2P_GROUP_CREATION_FAILURE - 49, // 3538 -> CONNECTIVITY_GATT_SERVER_OPEN_FAILURE - 43, // 3539 -> CONNECTIVITY_BLE_SERVER_SOCKET_CREATION_FAILURE - 56, // 3540 -> CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_FAILURE - 47, // 3541 -> CONNECTIVITY_BT_SERVER_SOCKET_CREATION_FAILURE - 60, // 3542 -> CONNECTIVITY_LAN_SERVER_SOCKET_CREATION_FAILURE - 68, // 3543 -> CONNECTIVITY_WEB_RTC_SERVER_SOCKET_CREATION_FAILURE - 77, // 3544 -> CONNECTIVITY_WIFI_AWARE_SERVER_SOCKET_CREATION_FAILURE - 93, // 3545 -> CONNECTIVITY_WIFI_HOTSPOT_SERVER_SOCKET_CREATION_FAILURE - 85, // 3546 -> CONNECTIVITY_WIFI_DIRECT_SERVER_SOCKET_CREATION_FAILURE - 63, // 3547 -> CONNECTIVITY_NFC_SERVER_SOCKET_CREATION_FAILURE - 94, // 3548 -> CONNECTIVITY_WIFI_HOTSPOT_SOFT_AP_CREATION_FAILURE - 78, // 3549 -> CONNECTIVITY_WIFI_AWARE_UPDATE_PUBLISH_FAILURE - 52, // 3550 -> CONNECTIVITY_GENERIC_WRITING_CHANNEL_IO_ERROR - 51, // 3551 -> CONNECTIVITY_GENERIC_WRITE_CLIENT_INTRODUCTION_ACK_IO_ERROR - 71, // 3552 -> CONNECTIVITY_WIFI_AWARE_DISCOVERED_PEER_NULL - 50, // 3553 -> CONNECTIVITY_GENERIC_PAYLOAD_SENT_ERROR - 57, // 3554 -> CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE - 48, // 3555 -> CONNECTIVITY_BT_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE - 171, // 4500 -> NEARBY_BLE_ADVERTISEMENT_MAPPING_TO_MAC_ERROR - 176, // 4501 -> NEARBY_BLUETOOTH_MAC_ADDRESS_INVALID_FOR_CONNECT - 211, // 4502 -> NEARBY_WEB_RTC_CONNECTION_FLOW_NULL - 182, // 4503 -> NEARBY_GENERIC_CONNECTION_CLOSED - 172, // 4504 -> NEARBY_BLE_ENDPOINT_CHANNEL_CREATION_FAILURE - 198, // 4505 -> NEARBY_L2CAP_ENDPOINT_CHANNEL_CREATION_FAILURE - 177, // 4506 -> NEARBY_BT_ENDPOINT_CHANNEL_CREATION_FAILURE - 202, // 4507 -> NEARBY_LAN_ENDPOINT_CHANNEL_CREATION_FAILURE - 207, // 4508 -> NEARBY_NFC_ENDPOINT_CHANNEL_CREATION_FAILURE - 215, // 4509 -> NEARBY_WIFI_AWARE_ENDPOINT_CHANNEL_CREATION_FAILURE - 229, // 4510 -> NEARBY_WIFI_HOTSPOT_ENDPOINT_CHANNEL_CREATION_FAILURE - 218, // 4511 -> NEARBY_WIFI_DIRECT_ENDPOINT_CHANNEL_CREATION_FAILURE - 212, // 4512 -> NEARBY_WEB_RTC_ENDPOINT_CHANNEL_CREATION_FAILURE - 209, // 4513 -> NEARBY_USB_ENDPOINT_CHANNEL_CREATION_FAILURE - 183, // 4514 -> NEARBY_GENERIC_ENDPOINT_UNENCRYPTED - 173, // 4515 -> NEARBY_BLE_GATT_ADVERTISEMENT_NULL_FOR_CONNECTION - 219, // 4516 -> NEARBY_WIFI_DIRECT_HOST_ON_SRD_CHANNELS - 230, // 4517 -> NEARBY_WIFI_HOTSPOT_HOST_ON_SRD_CHANNELS - 174, // 4518 -> NEARBY_BLE_GATT_NULL_CALLBACK - 199, // 4519 -> NEARBY_L2CAP_NULL_CALLBACK - 179, // 4520 -> NEARBY_BT_NULL_CALLBACK - 210, // 4521 -> NEARBY_USB_NULL_CALLBACK - 208, // 4522 -> NEARBY_NFC_NULL_CALLBACK - 216, // 4523 -> NEARBY_WIFI_AWARE_NULL_CALLBACK - 213, // 4524 -> NEARBY_WEB_RTC_NULL_CALLBACK - 204, // 4525 -> NEARBY_LAN_NULL_CALLBACK - 233, // 4526 -> NEARBY_WIFI_HOTSPOT_NULL_CALLBACK - 221, // 4527 -> NEARBY_WIFI_DIRECT_NULL_CALLBACK - 223, // 4528 -> NEARBY_WIFI_DIRECT_NULL_SSID - 222, // 4529 -> NEARBY_WIFI_DIRECT_NULL_PASSWORD - 178, // 4530 -> NEARBY_BT_MULTIPLEX_SOCKET_DISABLED - 203, // 4531 -> NEARBY_LAN_MULTIPLEX_SOCKET_DISABLED - 185, // 4532 -> NEARBY_GENERIC_NEW_ENDPOINT_CHANNEL_NULL - 220, // 4533 -> NEARBY_WIFI_DIRECT_NO_GROUP_FOR_LISTENING - 232, // 4534 -> NEARBY_WIFI_HOTSPOT_NO_HOTSPOT_FOR_LISTENING - 186, // 4535 -> NEARBY_GENERIC_OLD_ENDPOINT_CHANNEL_NULL - 175, // 4536 -> NEARBY_BLE_OPERATION_REGISTERED_FAILED - 200, // 4537 -> NEARBY_L2CAP_OPERATION_REGISTERED_FAILED - 180, // 4538 -> NEARBY_BT_OPERATION_REGISTERED_FAILED - 205, // 4539 -> NEARBY_LAN_OPERATION_REGISTERED_FAILED - 214, // 4540 -> NEARBY_WEB_RTC_OPERATION_REGISTERED_FAILED - 217, // 4541 -> NEARBY_WIFI_AWARE_OPERATION_REGISTERED_FAILED - 228, // 4542 -> NEARBY_WIFI_HOTSPOT_DIRECT_OPERATION_REGISTERED_FAILED - 236, // 4543 -> NEARBY_WIFI_HOTSPOT_SOFT_AP_OPERATION_REGISTERED_FAILED - 231, // 4544 -> NEARBY_WIFI_HOTSPOT_LOHS_OPERATION_REGISTERED_FAILED - 227, // 4545 -> NEARBY_WIFI_HOTSPOT_CLIENT_OPERATION_REGISTERED_FAILED - 224, // 4546 -> NEARBY_WIFI_DIRECT_OPERATION_REGISTERED_FAILED - 187, // 4547 -> NEARBY_GENERIC_OUTGOING_PAYLOAD_CREATION_FAILURE - 234, // 4548 -> NEARBY_WIFI_HOTSPOT_P2P_NON_DBS_WANT_2G_BUT_AP_5G - 225, // 4549 -> NEARBY_WIFI_DIRECT_P2P_NON_DBS_WANT_2G_BUT_AP_5G - 235, // 4550 -> NEARBY_WIFI_HOTSPOT_P2P_NON_DBS_WANT_5G_BUT_AP_2G - 226, // 4551 -> NEARBY_WIFI_DIRECT_P2P_NON_DBS_WANT_5G_BUT_AP_2G - 184, // 4552 -> NEARBY_GENERIC_INCOMING_PAYLOAD_NOT_DATA_TYPE - 191, // 4553 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_EVENT_TYPE_ERROR - 193, // 4554 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_FRAME_TYPE_ERROR - 192, // 4555 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_FORMAT_ERROR - 188, // 4556 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_ACK_EVENT_TYPE_ERROR - 190, // 4557 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_ACK_FRAME_TYPE_ERROR - 189, // 4558 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_ACK_FORMAT_ERROR - 194, // 4559 -> NEARBY_GENERIC_REMOTE_ENDPOINT_STATUS_ERROR - 195, // 4560 -> NEARBY_GENERIC_REMOTE_REPORT_PAYLOADS_ERROR - 196, // 4561 -> NEARBY_GENERIC_REMOTE_UPGRADE_FAILURE - 197, // 4562 -> NEARBY_GENERIC_SEND_PAYLOAD_EXECUTOR_NULL - 181, // 4563 -> NEARBY_BT_VIRTUAL_SOCKET_CREATION_FAILURE - 206, // 4564 -> NEARBY_LAN_VIRTUAL_SOCKET_CREATION_FAILURE - 237, // 4565 -> NEARBY_WIFI_LAN_IP_ADDRESS_ERROR - 201, // 4566 -> NEARBY_L2CAP_PSM_NOT_POSITIVE +static const int OperationResultCode_entries_by_number[] = { + 163, // 0 -> DETAIL_UNKNOWN + 162, // 1 -> DETAIL_SUCCESS + 24, // 500 -> CLIENT_CANCELLATION_REMOTE_IN_CANCELED_STATE + 20, // 501 -> CLIENT_CANCELLATION_LOCAL_CANCEL_PAYLOAD + 22, // 502 -> CLIENT_CANCELLATION_REMOTE_CANCEL_PAYLOAD + 25, // 503 -> CLIENT_CANCELLATION_UPGRADE_CANCELED_BY_REMOTE + 8, // 504 -> CLIENT_CANCELLATION_CANCEL_BLE_OUTGOING_CONNECTION + 9, // 505 -> CLIENT_CANCELLATION_CANCEL_BT_OUTGOING_CONNECTION + 11, // 506 -> CLIENT_CANCELLATION_CANCEL_L2CAP_OUTGOING_CONNECTION + 12, // 507 -> CLIENT_CANCELLATION_CANCEL_LAN_OUTGOING_CONNECTION + 13, // 508 -> CLIENT_CANCELLATION_CANCEL_NFC_OUTGOING_CONNECTION + 15, // 509 -> CLIENT_CANCELLATION_CANCEL_USB_OUTGOING_CONNECTION + 17, // 510 -> CLIENT_CANCELLATION_CANCEL_WIFI_AWARE_OUTGOING_CONNECTION + 18, // 511 -> CLIENT_CANCELLATION_CANCEL_WIFI_DIRECT_OUTGOING_CONNECTION + 19, // 512 -> CLIENT_CANCELLATION_CANCEL_WIFI_HOTSPOT_OUTGOING_CONNECTION + 16, // 513 -> CLIENT_CANCELLATION_CANCEL_WEB_RTC_OUTGOING_CONNECTION + 14, // 514 -> CLIENT_CANCELLATION_CANCEL_OUTGOING_CONNECTION + 10, // 515 -> CLIENT_CANCELLATION_CANCEL_INCOMING_CONNECTION + 27, // 516 -> CLIENT_CANCELLATION_WIFI_AWARE_SERVER_SOCKET_CREATION + 28, // 517 -> CLIENT_CANCELLATION_WIFI_DIRECT_SERVER_SOCKET_CREATION + 29, // 518 -> CLIENT_CANCELLATION_WIFI_HOTSPOT_SERVER_SOCKET_CREATION + 7, // 519 -> CLIENT_CANCELLATION_BT_SERVER_SOCKET_CREATION + 26, // 520 -> CLIENT_CANCELLATION_WEB_RTC_SERVER_SOCKET_CREATION + 30, // 521 -> CLIENT_CANCELLATION_WIFI_LAN_SERVER_SOCKET_CREATION + 21, // 522 -> CLIENT_CANCELLATION_LOCAL_DISCONNECT + 23, // 523 -> CLIENT_CANCELLATION_REMOTE_DISCONNECT + 164, // 1000 -> DEVICE_STATE_ERROR_UNFINISHED_UPGRADE_ATTEMPTS + 165, // 1001 -> DEVICE_STATE_ERROR_USER_HOTSPOT_ENABLED + 166, // 1002 -> DEVICE_STATE_LOCATION_DISABLED + 167, // 1003 -> DEVICE_STATE_RADIO_DISABLING_FAILURE + 168, // 1004 -> DEVICE_STATE_RADIO_ENABLING_FAILURE + 224, // 1500 -> MEDIUM_UNAVAILABLE_WIFI_AWARE_RESOURCE_NOT_AVAILABLE + 191, // 1501 -> MEDIUM_UNAVAILABLE_DIRECT_HOTSPOT_NOT_SUPPORT + 207, // 1502 -> MEDIUM_UNAVAILABLE_SOFT_AP_NOT_SUPPORT + 198, // 1503 -> MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_NOT_SUPPORT + 199, // 1504 -> MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_NOT_SUPPORT_5G + 187, // 1505 -> MEDIUM_UNAVAILABLE_BLE_NOT_AVAILABLE + 193, // 1506 -> MEDIUM_UNAVAILABLE_L2CAP_NOT_AVAILABLE + 188, // 1507 -> MEDIUM_UNAVAILABLE_BLUETOOTH_NOT_AVAILABLE + 220, // 1508 -> MEDIUM_UNAVAILABLE_WEB_RTC_NOT_AVAILABLE + 223, // 1509 -> MEDIUM_UNAVAILABLE_WIFI_AWARE_NOT_AVAILABLE + 229, // 1510 -> MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_NOT_AVAILABLE + 226, // 1511 -> MEDIUM_UNAVAILABLE_WIFI_DIRECT_NOT_AVAILABLE + 202, // 1512 -> MEDIUM_UNAVAILABLE_NFC_NOT_AVAILABLE + 196, // 1513 -> MEDIUM_UNAVAILABLE_LAN_NOT_AVAILABLE + 218, // 1514 -> MEDIUM_UNAVAILABLE_USB_NOT_AVAILABLE + 186, // 1515 -> MEDIUM_UNAVAILABLE_BLE_NC_LOGICAL_NOT_AVAILABLE + 190, // 1516 -> MEDIUM_UNAVAILABLE_BT_NC_LOGICAL_NOT_AVAILABLE + 195, // 1517 -> MEDIUM_UNAVAILABLE_LAN_NC_LOGICAL_NOT_AVAILABLE + 201, // 1518 -> MEDIUM_UNAVAILABLE_NFC_NC_LOGICAL_NOT_AVAILABLE + 217, // 1519 -> MEDIUM_UNAVAILABLE_USB_NC_LOGICAL_NOT_AVAILABLE + 219, // 1520 -> MEDIUM_UNAVAILABLE_WEB_RTC_NC_LOGICAL_NOT_AVAILABLE + 222, // 1521 -> MEDIUM_UNAVAILABLE_WIFI_AWARE_NC_LOGICAL_NOT_AVAILABLE + 228, // 1522 -> MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_NC_LOGICAL_NOT_AVAILABLE + 225, // 1523 -> MEDIUM_UNAVAILABLE_WIFI_DIRECT_NC_LOGICAL_NOT_AVAILABLE + 230, // 1524 -> MEDIUM_UNAVAILABLE_WIFI_HOTSPOT_P2P_RESOURCE_NOT_AVAILABLE + 227, // 1525 -> MEDIUM_UNAVAILABLE_WIFI_DIRECT_P2P_RESOURCE_NOT_AVAILABLE + 211, // 1526 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_BLE_LOW_QUALITY_MEDIUMS + 213, // 1527 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_L2CAP_LOW_QUALITY_MEDIUMS + 216, // 1528 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_WEB_RTC_LOW_QUALITY_MEDIUMS + 214, // 1529 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_LAN_LOW_QUALITY_MEDIUMS + 212, // 1530 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_BT_LOW_QUALITY_MEDIUMS + 215, // 1531 -> MEDIUM_UNAVAILABLE_UPGRADE_SKIP_USB_LOW_QUALITY_MEDIUMS + 197, // 1532 -> MEDIUM_UNAVAILABLE_LOCAL_ONLY_HOTSPOT_DISRUPTIVE_FALSE + 206, // 1533 -> MEDIUM_UNAVAILABLE_SOFT_AP_DISRUPTIVE_FALSE + 184, // 1534 -> MEDIUM_UNAVAILABLE_ALREADY_HAVE_A_WIFI_DIRECT_GROUP + 185, // 1535 -> MEDIUM_UNAVAILABLE_ALREADY_HOSTING_HOTSPOT_FOR_OTHER_CLIENTS + 205, // 1536 -> MEDIUM_UNAVAILABLE_REJECT_L2CAP_ON_GATT_MULTIPLEX_CONNECTION + 210, // 1537 -> MEDIUM_UNAVAILABLE_UPGRADE_ON_SAME_MEDIUM + 221, // 1538 -> MEDIUM_UNAVAILABLE_WEB_RTC_NO_INTERNET + 208, // 1539 -> MEDIUM_UNAVAILABLE_STA_DISRUPTIVE_FALSE + 209, // 1540 -> MEDIUM_UNAVAILABLE_STA_USER_NOT_ALLOW + 192, // 1541 -> MEDIUM_UNAVAILABLE_DUPLICATE_FAST_ADVERTISING + 203, // 1542 -> MEDIUM_UNAVAILABLE_NSD_NOT_AVAILABLE + 200, // 1543 -> MEDIUM_UNAVAILABLE_MDNS_NOT_AVAILABLE + 194, // 1544 -> MEDIUM_UNAVAILABLE_LAN_BLOCKED + 204, // 1545 -> MEDIUM_UNAVAILABLE_POOR_SIGNAL + 189, // 1546 -> MEDIUM_UNAVAILABLE_BT_MULTIPLEX_DISABLED + 55, // 2000 -> CLIENT_WIFI_DIRECT_ALREADY_HOSTING_DIRECT_GROUP_FOR_THIS_CLIENT + 56, // 2001 -> CLIENT_WIFI_HOTSPOT_ALREADY_HOSTING_HOTSPOT_FOR_THIS_CLIENT + 32, // 2002 -> CLIENT_DUPLICATE_ACCEPTING_BLE_CONNECTION_REQUEST + 34, // 2003 -> CLIENT_DUPLICATE_ACCEPTING_L2CAP_CONNECTION_REQUEST + 33, // 2004 -> CLIENT_DUPLICATE_ACCEPTING_BT_CONNECTION_REQUEST + 35, // 2005 -> CLIENT_DUPLICATE_ACCEPTING_LAN_CONNECTION_REQUEST + 36, // 2006 -> CLIENT_DUPLICATE_ACCEPTING_NFC_CONNECTION_REQUEST + 38, // 2007 -> CLIENT_DUPLICATE_ACCEPTING_WEB_RTC_CONNECTION_REQUEST + 39, // 2008 -> CLIENT_DUPLICATE_ACCEPTING_WIFI_AWARE_CONNECTION_REQUEST + 41, // 2009 -> CLIENT_DUPLICATE_ACCEPTING_WIFI_HOTSPOT_CONNECTION_REQUEST + 40, // 2010 -> CLIENT_DUPLICATE_ACCEPTING_WIFI_DIRECT_CONNECTION_REQUEST + 37, // 2011 -> CLIENT_DUPLICATE_ACCEPTING_USB_CONNECTION_REQUEST + 42, // 2012 -> CLIENT_DUPLICATE_WIFI_AWARE_CONNECTION_REQUEST + 44, // 2013 -> CLIENT_DUPLICATE_WIFI_DIRECT_CONNECTION_REQUEST + 45, // 2014 -> CLIENT_DUPLICATE_WIFI_HOTSPOT_CONNECTION_REQUEST + 43, // 2015 -> CLIENT_DUPLICATE_WIFI_AWARE_SUBSCRIBING_REQUEST + 52, // 2016 -> CLIENT_UNSUPPORTED_USB_TO_BE_UPGRADE_MEDIUM + 51, // 2017 -> CLIENT_PROCESS_TIE_BREAK_LOSS + 2, // 2018 -> CLIENT_BLE_DUPLICATE_ADVERTISING + 5, // 2019 -> CLIENT_BLUETOOTH_DUPLICATE_ADVERTISING + 47, // 2020 -> CLIENT_NFC_DUPLICATE_ADVERTISING + 57, // 2021 -> CLIENT_WIFI_LAN_DUPLICATE_ADVERTISING + 53, // 2022 -> CLIENT_USB_DUPLICATE_ADVERTISING + 3, // 2023 -> CLIENT_BLE_DUPLICATE_DISCOVERING + 6, // 2024 -> CLIENT_BLUETOOTH_DUPLICATE_DISCOVERING + 48, // 2025 -> CLIENT_NFC_DUPLICATE_DISCOVERING + 58, // 2026 -> CLIENT_WIFI_LAN_DUPLICATE_DISCOVERING + 54, // 2027 -> CLIENT_USB_DUPLICATE_DISCOVERING + 50, // 2028 -> CLIENT_PERMISSION_FAILURE + 4, // 2029 -> CLIENT_BLE_NO_LISTENING + 1, // 2030 -> CLIENT_ALREADY_CONNECTED_TO_TARGET + 46, // 2031 -> CLIENT_FAILED_INCOMING_CONNECTION_DUE_TO_TOPOLOGICAL_LIMIT + 49, // 2032 -> CLIENT_OUT_OF_ORDER_API_CALL + 59, // 2033 -> CLIENT_WRONG_CONNECTING_PERMISSIONS + 0, // 2034 -> CLIENT_ALREADY_CONNECTED_TO_ENDPOINT + 31, // 2035 -> CLIENT_CONNECT_TO_UNKNOWN_ENDPOINT + 233, // 2500 -> MISCELLEANEOUS_BLUETOOTH_MAC_ADDRESS_NULL + 237, // 2501 -> MISCELLEANEOUS_MOVE_TO_NEW_MEDIUM + 244, // 2502 -> MISCELLEANEOUS_WIFI_HOTSPOT_SOFT_AP_BLOCKED_BY_PROVISION + 231, // 2503 -> MISCELLEANEOUS_BLE_SYSTEM_SERVICE_NULL + 236, // 2504 -> MISCELLEANEOUS_L2CAP_SYSTEM_SERVICE_NULL + 235, // 2505 -> MISCELLEANEOUS_BT_SYSTEM_SERVICE_NULL + 242, // 2506 -> MISCELLEANEOUS_WIFI_AWARE_SYSTEM_SERVICE_NULL + 243, // 2507 -> MISCELLEANEOUS_WIFI_DIRECT_SYSTEM_SERVICE_NULL + 246, // 2508 -> MISCELLEANEOUS_WIFI_LAN_SYSTEM_SERVICE_NULL + 245, // 2509 -> MISCELLEANEOUS_WIFI_HOTSPOT_SYSTEM_SERVICE_NULL + 234, // 2510 -> MISCELLEANEOUS_BT_NOT_ACCEPTING_CONNECTION_FOR_WORK_PROFILE + 239, // 2511 -> MISCELLEANEOUS_WEB_RTC_GET_DROIDGUARD_RESULT_FAILURE + 241, // 2512 -> MISCELLEANEOUS_WEB_RTC_TACHYON_SIGNALING_MESSENGER_NULL + 238, // 2513 -> MISCELLEANEOUS_WEB_RTC_FAILED_TO_RECEIVE_MESSAGE + 232, // 2514 -> MISCELLEANEOUS_BLUETOOTH_CHANGE_DEVICE_NAME_FAILURE + 240, // 2515 -> MISCELLEANEOUS_WEB_RTC_ICE_SERVER_NULL + 247, // 2516 -> MISCELLEANEOUS_WORK_SOURCE_NULL + 179, // 3000 -> IO_FILE_OPENING_ERROR + 180, // 3001 -> IO_FILE_READING_ERROR + 181, // 3002 -> IO_FILE_WRITING_ERROR + 182, // 3003 -> IO_FOLDER_CREATION_ERROR + 183, // 3004 -> IO_STREAM_CREATE_PIPE_FAILURE + 169, // 3005 -> IO_ENDPOINT_IO_ERROR_ON_BLE + 170, // 3006 -> IO_ENDPOINT_IO_ERROR_ON_BLE_L2CAP + 171, // 3007 -> IO_ENDPOINT_IO_ERROR_ON_BT + 175, // 3008 -> IO_ENDPOINT_IO_ERROR_ON_WEB_RTC + 172, // 3009 -> IO_ENDPOINT_IO_ERROR_ON_LAN + 177, // 3010 -> IO_ENDPOINT_IO_ERROR_ON_WIFI_DIRECT + 178, // 3011 -> IO_ENDPOINT_IO_ERROR_ON_WIFI_HOTSPOT + 176, // 3012 -> IO_ENDPOINT_IO_ERROR_ON_WIFI_AWARE + 173, // 3013 -> IO_ENDPOINT_IO_ERROR_ON_NFC + 174, // 3014 -> IO_ENDPOINT_IO_ERROR_ON_USB + 125, // 3500 -> CONNECTIVITY_WIFI_AWARE_ATTACH_FAILURE + 69, // 3501 -> CONNECTIVITY_BLUETOOTH_DEVICE_OBTAIN_FAILURE + 62, // 3502 -> CONNECTIVITY_BLE_CLIENT_SOCKET_CREATION_FAILURE + 99, // 3503 -> CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_FAILURE + 73, // 3504 -> CONNECTIVITY_BT_CLIENT_SOCKET_CREATION_FAILURE + 104, // 3505 -> CONNECTIVITY_LAN_CLIENT_SOCKET_CREATION_FAILURE + 111, // 3506 -> CONNECTIVITY_NFC_CLIENT_SOCKET_CREATION_FAILURE + 116, // 3507 -> CONNECTIVITY_WEB_RTC_CLIENT_SOCKET_CREATION_FAILURE + 126, // 3508 -> CONNECTIVITY_WIFI_AWARE_CLIENT_SOCKET_CREATION_FAILURE + 145, // 3509 -> CONNECTIVITY_WIFI_HOTSPOT_CLIENT_SOCKET_CREATION_FAILURE + 137, // 3510 -> CONNECTIVITY_WIFI_DIRECT_CLIENT_SOCKET_CREATION_FAILURE + 114, // 3511 -> CONNECTIVITY_USB_CLIENT_SOCKET_CREATION_FAILURE + 117, // 3512 -> CONNECTIVITY_WEB_RTC_CONNECT_TO_TACHYON_FAILURE + 63, // 3513 -> CONNECTIVITY_BLE_CREATE_GATT_CONNECTION_FAILURE + 129, // 3514 -> CONNECTIVITY_WIFI_AWARE_GET_REMOTE_IP_FRAME_FAILURE + 128, // 3515 -> CONNECTIVITY_WIFI_AWARE_GET_REMOTE_IP_ADDRESS_FAILURE + 139, // 3516 -> CONNECTIVITY_WIFI_DIRECT_INCONSISTENT_HOSTED_WIFI_BAND + 147, // 3517 -> CONNECTIVITY_WIFI_HOTSPOT_INCONSISTENT_HOSTED_WIFI_BAND + 70, // 3518 -> CONNECTIVITY_BLUETOOTH_INVALID_CREDENTIAL + 156, // 3519 -> CONNECTIVITY_WIFI_LAN_INVALID_CREDENTIAL + 140, // 3520 -> CONNECTIVITY_WIFI_DIRECT_INVALID_CREDENTIAL + 148, // 3521 -> CONNECTIVITY_WIFI_HOTSPOT_INVALID_CREDENTIAL + 130, // 3522 -> CONNECTIVITY_WIFI_AWARE_INVALID_CREDENTIAL + 118, // 3523 -> CONNECTIVITY_WEB_RTC_INVALID_CREDENTIAL + 157, // 3524 -> CONNECTIVITY_WIFI_LAN_IP_ADDRESS_ERROR + 98, // 3525 -> CONNECTIVITY_L2CAP_CLIENT_OBTAIN_FAIURE + 101, // 3526 -> CONNECTIVITY_L2CAP_DATA_CONNECTION_FAILURE + 131, // 3527 -> CONNECTIVITY_WIFI_AWARE_L2MESSAGE_NETWORK_AVAILABLE_FRAME_NULL + 132, // 3528 -> CONNECTIVITY_WIFI_AWARE_L2MESSAGE_SEND_HOST_NETWORK_FRAME_FAILURE + 108, // 3529 -> CONNECTIVITY_LAN_UNREACHABLE + 150, // 3530 -> CONNECTIVITY_WIFI_HOTSPOT_LOHS_CREATION_FAILURE + 105, // 3531 -> CONNECTIVITY_LAN_GET_NETWORK_INTERFACES_FAILURE + 138, // 3532 -> CONNECTIVITY_WIFI_DIRECT_GET_NETWORK_INTERFACES_FAILURE + 146, // 3533 -> CONNECTIVITY_WIFI_HOTSPOT_GET_NETWORK_INTERFACES_FAILURE + 151, // 3534 -> CONNECTIVITY_WIFI_HOTSPOT_P2P_CHANNEL_INITIALIZE_FAILURE + 141, // 3535 -> CONNECTIVITY_WIFI_DIRECT_P2P_CHANNEL_INITIALIZE_FAILURE + 152, // 3536 -> CONNECTIVITY_WIFI_HOTSPOT_P2P_GROUP_CREATION_FAILURE + 143, // 3537 -> CONNECTIVITY_WIFI_DIRECT_P2P_GROUP_CREATION_FAILURE + 93, // 3538 -> CONNECTIVITY_GATT_SERVER_OPEN_FAILURE + 65, // 3539 -> CONNECTIVITY_BLE_SERVER_SOCKET_CREATION_FAILURE + 102, // 3540 -> CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_FAILURE + 77, // 3541 -> CONNECTIVITY_BT_SERVER_SOCKET_CREATION_FAILURE + 107, // 3542 -> CONNECTIVITY_LAN_SERVER_SOCKET_CREATION_FAILURE + 119, // 3543 -> CONNECTIVITY_WEB_RTC_SERVER_SOCKET_CREATION_FAILURE + 133, // 3544 -> CONNECTIVITY_WIFI_AWARE_SERVER_SOCKET_CREATION_FAILURE + 153, // 3545 -> CONNECTIVITY_WIFI_HOTSPOT_SERVER_SOCKET_CREATION_FAILURE + 144, // 3546 -> CONNECTIVITY_WIFI_DIRECT_SERVER_SOCKET_CREATION_FAILURE + 112, // 3547 -> CONNECTIVITY_NFC_SERVER_SOCKET_CREATION_FAILURE + 154, // 3548 -> CONNECTIVITY_WIFI_HOTSPOT_SOFT_AP_CREATION_FAILURE + 136, // 3549 -> CONNECTIVITY_WIFI_AWARE_UPDATE_PUBLISH_FAILURE + 96, // 3550 -> CONNECTIVITY_GENERIC_WRITING_CHANNEL_IO_ERROR + 95, // 3551 -> CONNECTIVITY_GENERIC_WRITE_CLIENT_INTRODUCTION_ACK_IO_ERROR + 127, // 3552 -> CONNECTIVITY_WIFI_AWARE_DISCOVERED_PEER_NULL + 94, // 3553 -> CONNECTIVITY_GENERIC_PAYLOAD_SENT_ERROR + 103, // 3554 -> CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE + 78, // 3555 -> CONNECTIVITY_BT_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE + 100, // 3556 -> CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_TIMEOUT_FAILURE + 120, // 3557 -> CONNECTIVITY_WEB_RTC_UNSATISFIED_LINK_ERROR + 92, // 3558 -> CONNECTIVITY_DIRECT_GROUP_MCC_FAILURE + 81, // 3559 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE + 82, // 3560 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE_L2CAP + 83, // 3561 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_BT + 88, // 3562 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_WEB_RTC + 84, // 3563 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_LAN + 90, // 3564 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_DIRECT + 91, // 3565 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_HOTSPOT + 89, // 3566 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_AWARE + 85, // 3567 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_NFC + 87, // 3568 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_USB + 86, // 3569 -> CONNECTIVITY_CHANNEL_IO_ERROR_ON_UNKNOWN_MEDIUM + 80, // 3570 -> CONNECTIVITY_BT_SOCKET_CREATION_IO_EXCEPTION + 79, // 3571 -> CONNECTIVITY_BT_SOCKET_CONNECT_IO_EXCEPTION + 75, // 3572 -> CONNECTIVITY_BT_CONNECTION_INTERRUPTED_EXCEPTION + 74, // 3573 -> CONNECTIVITY_BT_CONNECTION_EXECUTION_EXCEPTION + 76, // 3574 -> CONNECTIVITY_BT_CONNECTION_TIMEOUT_EXCEPTION + 142, // 3575 -> CONNECTIVITY_WIFI_DIRECT_P2P_CONNECTION_FAILURE + 123, // 3576 -> CONNECTIVITY_WFD_CONNECTION_INTERRUPTED_EXCEPTION + 121, // 3577 -> CONNECTIVITY_WFD_CONNECTION_EXECUTION_EXCEPTION + 124, // 3578 -> CONNECTIVITY_WFD_CONNECTION_TIMEOUT_EXCEPTION + 122, // 3579 -> CONNECTIVITY_WFD_CONNECTION_HOSTED_ADDRESS_NULL + 155, // 3580 -> CONNECTIVITY_WIFI_HOTSPOT_SPECIFIER_FAILURE + 149, // 3581 -> CONNECTIVITY_WIFI_HOTSPOT_LEGACY_STA_CONNECTION_FAILURE + 159, // 3582 -> CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_TIMEOUT + 158, // 3583 -> CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_IO_EXCEPTION + 67, // 3584 -> CONNECTIVITY_BLE_START_GATT_SERVER_FAILURE + 61, // 3585 -> CONNECTIVITY_BLE_ADD_GATT_ADVERTISEMENT_FAILURE + 66, // 3586 -> CONNECTIVITY_BLE_START_ADVERTISING_FAILURE + 72, // 3587 -> CONNECTIVITY_BLUETOOTH_START_ADVERTISING_FAILURE + 160, // 3588 -> CONNECTIVITY_WIFI_LAN_START_ADVERTISING_FAILURE + 134, // 3589 -> CONNECTIVITY_WIFI_AWARE_START_ADVERTISING_FAILURE + 71, // 3590 -> CONNECTIVITY_BLUETOOTH_SCAN_FAILURE + 64, // 3591 -> CONNECTIVITY_BLE_SCAN_FAILURE + 109, // 3592 -> CONNECTIVITY_MDNS_SCAN_FAILURE + 113, // 3593 -> CONNECTIVITY_NFC_START_DISCOVERY_FAILURE + 161, // 3594 -> CONNECTIVITY_WIFI_LAN_START_DISCOVERY_FAILURE + 135, // 3595 -> CONNECTIVITY_WIFI_AWARE_START_DISCOVERY_FAILURE + 115, // 3596 -> CONNECTIVITY_UWB_START_DISCOVERY_FAILURE + 106, // 3597 -> CONNECTIVITY_LAN_MDNS_REGISTER_FAILURE + 68, // 3598 -> CONNECTIVITY_BLUETOOTH_CHANGE_SCAN_MODE_FAILURE + 60, // 3599 -> CONNECTIVITY_AUTO_RESUME_FAILURE + 97, // 3600 -> CONNECTIVITY_INSTANT_CONNECTION_LISTENING_TIMEOUT + 110, // 3601 -> CONNECTIVITY_MEDIUM_INVALID_CREDENTIAL + 250, // 4500 -> NEARBY_BLE_ADVERTISEMENT_MAPPING_TO_MAC_ERROR + 260, // 4501 -> NEARBY_BLUETOOTH_MAC_ADDRESS_INVALID_FOR_CONNECT + 319, // 4502 -> NEARBY_WEB_RTC_CONNECTION_FLOW_NULL + 273, // 4503 -> NEARBY_GENERIC_CONNECTION_CLOSED + 252, // 4504 -> NEARBY_BLE_ENDPOINT_CHANNEL_CREATION_FAILURE + 291, // 4505 -> NEARBY_L2CAP_ENDPOINT_CHANNEL_CREATION_FAILURE + 263, // 4506 -> NEARBY_BT_ENDPOINT_CHANNEL_CREATION_FAILURE + 295, // 4507 -> NEARBY_LAN_ENDPOINT_CHANNEL_CREATION_FAILURE + 306, // 4508 -> NEARBY_NFC_ENDPOINT_CHANNEL_CREATION_FAILURE + 327, // 4509 -> NEARBY_WIFI_AWARE_ENDPOINT_CHANNEL_CREATION_FAILURE + 345, // 4510 -> NEARBY_WIFI_HOTSPOT_ENDPOINT_CHANNEL_CREATION_FAILURE + 332, // 4511 -> NEARBY_WIFI_DIRECT_ENDPOINT_CHANNEL_CREATION_FAILURE + 320, // 4512 -> NEARBY_WEB_RTC_ENDPOINT_CHANNEL_CREATION_FAILURE + 315, // 4513 -> NEARBY_USB_ENDPOINT_CHANNEL_CREATION_FAILURE + 274, // 4514 -> NEARBY_GENERIC_ENDPOINT_UNENCRYPTED + 254, // 4515 -> NEARBY_BLE_GATT_ADVERTISEMENT_NULL_FOR_CONNECTION + 333, // 4516 -> NEARBY_WIFI_DIRECT_HOST_ON_SRD_CHANNELS + 346, // 4517 -> NEARBY_WIFI_HOTSPOT_HOST_ON_SRD_CHANNELS + 255, // 4518 -> NEARBY_BLE_GATT_NULL_CALLBACK + 292, // 4519 -> NEARBY_L2CAP_NULL_CALLBACK + 265, // 4520 -> NEARBY_BT_NULL_CALLBACK + 317, // 4521 -> NEARBY_USB_NULL_CALLBACK + 308, // 4522 -> NEARBY_NFC_NULL_CALLBACK + 329, // 4523 -> NEARBY_WIFI_AWARE_NULL_CALLBACK + 323, // 4524 -> NEARBY_WEB_RTC_NULL_CALLBACK + 297, // 4525 -> NEARBY_LAN_NULL_CALLBACK + 349, // 4526 -> NEARBY_WIFI_HOTSPOT_NULL_CALLBACK + 335, // 4527 -> NEARBY_WIFI_DIRECT_NULL_CALLBACK + 337, // 4528 -> NEARBY_WIFI_DIRECT_NULL_SSID + 336, // 4529 -> NEARBY_WIFI_DIRECT_NULL_PASSWORD + 264, // 4530 -> NEARBY_BT_MULTIPLEX_SOCKET_DISABLED + 296, // 4531 -> NEARBY_LAN_MULTIPLEX_SOCKET_DISABLED + 277, // 4532 -> NEARBY_GENERIC_NEW_ENDPOINT_CHANNEL_NULL + 334, // 4533 -> NEARBY_WIFI_DIRECT_NO_GROUP_FOR_LISTENING + 348, // 4534 -> NEARBY_WIFI_HOTSPOT_NO_HOTSPOT_FOR_LISTENING + 278, // 4535 -> NEARBY_GENERIC_OLD_ENDPOINT_CHANNEL_NULL + 257, // 4536 -> NEARBY_BLE_OPERATION_REGISTERED_FAILED + 293, // 4537 -> NEARBY_L2CAP_OPERATION_REGISTERED_FAILED + 266, // 4538 -> NEARBY_BT_OPERATION_REGISTERED_FAILED + 298, // 4539 -> NEARBY_LAN_OPERATION_REGISTERED_FAILED + 324, // 4540 -> NEARBY_WEB_RTC_OPERATION_REGISTERED_FAILED + 330, // 4541 -> NEARBY_WIFI_AWARE_OPERATION_REGISTERED_FAILED + 344, // 4542 -> NEARBY_WIFI_HOTSPOT_DIRECT_OPERATION_REGISTERED_FAILED + 354, // 4543 -> NEARBY_WIFI_HOTSPOT_SOFT_AP_OPERATION_REGISTERED_FAILED + 347, // 4544 -> NEARBY_WIFI_HOTSPOT_LOHS_OPERATION_REGISTERED_FAILED + 343, // 4545 -> NEARBY_WIFI_HOTSPOT_CLIENT_OPERATION_REGISTERED_FAILED + 338, // 4546 -> NEARBY_WIFI_DIRECT_OPERATION_REGISTERED_FAILED + 279, // 4547 -> NEARBY_GENERIC_OUTGOING_PAYLOAD_CREATION_FAILURE + 350, // 4548 -> NEARBY_WIFI_HOTSPOT_P2P_NON_DBS_WANT_2G_BUT_AP_5G + 339, // 4549 -> NEARBY_WIFI_DIRECT_P2P_NON_DBS_WANT_2G_BUT_AP_5G + 351, // 4550 -> NEARBY_WIFI_HOTSPOT_P2P_NON_DBS_WANT_5G_BUT_AP_2G + 340, // 4551 -> NEARBY_WIFI_DIRECT_P2P_NON_DBS_WANT_5G_BUT_AP_2G + 276, // 4552 -> NEARBY_GENERIC_INCOMING_PAYLOAD_NOT_DATA_TYPE + 283, // 4553 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_EVENT_TYPE_ERROR + 285, // 4554 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_FRAME_TYPE_ERROR + 284, // 4555 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_FORMAT_ERROR + 280, // 4556 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_ACK_EVENT_TYPE_ERROR + 282, // 4557 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_ACK_FRAME_TYPE_ERROR + 281, // 4558 -> NEARBY_GENERIC_READ_CLIENT_INTRODUCTION_ACK_FORMAT_ERROR + 286, // 4559 -> NEARBY_GENERIC_REMOTE_ENDPOINT_STATUS_ERROR + 287, // 4560 -> NEARBY_GENERIC_REMOTE_REPORT_PAYLOADS_ERROR + 288, // 4561 -> NEARBY_GENERIC_REMOTE_UPGRADE_FAILURE + 289, // 4562 -> NEARBY_GENERIC_SEND_PAYLOAD_EXECUTOR_NULL + 267, // 4563 -> NEARBY_BT_VIRTUAL_SOCKET_CREATION_FAILURE + 301, // 4564 -> NEARBY_LAN_VIRTUAL_SOCKET_CREATION_FAILURE + 357, // 4565 -> NEARBY_WIFI_LAN_IP_ADDRESS_ERROR + 294, // 4566 -> NEARBY_L2CAP_PSM_NOT_POSITIVE + 271, // 4567 -> NEARBY_ENCRYPTION_FAILURE + 248, // 4568 -> NEARBY_AUTHENTICATION_FAILURE + 302, // 4569 -> NEARBY_LAN_VIRTUAL_SOCKET_NULL + 258, // 4570 -> NEARBY_BLUETOOTH_ADVERTISE_TO_BYTES_FAILURE + 251, // 4571 -> NEARBY_BLE_ADVERTISE_TO_BYTES_FAILURE + 253, // 4572 -> NEARBY_BLE_FAST_ADVERTISE_TO_BYTES_FAILURE + 305, // 4573 -> NEARBY_NFC_ADVERTISE_TO_BYTES_FAILURE + 355, // 4574 -> NEARBY_WIFI_LAN_ADVERTISE_TO_BYTES_FAILURE + 326, // 4575 -> NEARBY_WIFI_AWARE_ADVERTISE_TO_BYTES_FAILURE + 314, // 4576 -> NEARBY_USB_ADVERTISE_TO_BYTES_FAILURE + 307, // 4577 -> NEARBY_NFC_INVALID_PCP_OPTIONS + 259, // 4578 -> NEARBY_BLUETOOTH_INVALID_PCP_OPTIONS + 256, // 4579 -> NEARBY_BLE_INVALID_PCP_OPTIONS + 356, // 4580 -> NEARBY_WIFI_LAN_INVALID_PCP_OPTIONS + 328, // 4581 -> NEARBY_WIFI_AWARE_INVALID_PCP_OPTIONS + 316, // 4582 -> NEARBY_USB_INVALID_PCP_OPTIONS + 318, // 4583 -> NEARBY_UWB_INVALID_PCP_OPTIONS + 321, // 4584 -> NEARBY_WEB_RTC_INVALID_PCP_OPTIONS + 261, // 4585 -> NEARBY_BLUETOOTH_NO_CLIENT_REGISTER_FOR_SCAN + 290, // 4586 -> NEARBY_INSTANT_CONNECTION_WRONG_CONNECTIVITY_INFO + 304, // 4587 -> NEARBY_NEED_METHOD_OVERRIDE + 275, // 4588 -> NEARBY_GENERIC_INCOMING_PAYLOAD_CREATION_FAILURE + 322, // 4589 -> NEARBY_WEB_RTC_NO_LISTENING_PEER_FOUND + 313, // 4590 -> NEARBY_UPGRADE_PATH_ON_WRONG_MEDIUM + 270, // 4591 -> NEARBY_CONNECT_TO_ALL_MEDIUMS_FAILURE + 262, // 4592 -> NEARBY_BLUETOOTH_RECONNECT_MAC_NULL + 299, // 4593 -> NEARBY_LAN_RECONNECT_CONNECTION_INFO_NULL + 300, // 4594 -> NEARBY_LAN_RECONNECT_IP_NULL + 342, // 4595 -> NEARBY_WIFI_DIRECT_RECONNECT_META_DATA_NULL + 341, // 4596 -> NEARBY_WIFI_DIRECT_RECONNECT_CONNECT_META_DATA_NULL + 353, // 4597 -> NEARBY_WIFI_HOTSPOT_RECONNECT_META_DATA_NULL + 352, // 4598 -> NEARBY_WIFI_HOTSPOT_RECONNECT_CONNECT_META_DATA_NULL + 325, // 4599 -> NEARBY_WEB_RTC_RECONNECT_PEER_ID_NULL + 331, // 4600 -> NEARBY_WIFI_AWARE_RECONNECT_META_DATA_NULL + 309, // 4601 -> NEARBY_NOT_ADVERTISING_OR_LISTENING + 268, // 4602 -> NEARBY_CAN_NOT_OBTAIN_DEVICE_PROVIDER + 311, // 4603 -> NEARBY_SETUP_STRATEGY_FAILURE + 312, // 4604 -> NEARBY_TX_ADVERTISEMENT_NULL + 272, // 4605 -> NEARBY_ENDPOINT_ID_MISMATCH + 269, // 4606 -> NEARBY_CONNECTIVITY_INFO_NULL_OR_WRONG + 303, // 4607 -> NEARBY_LOCAL_CLIENT_STATE_WRONG + 310, // 4608 -> NEARBY_REMOTE_EXCEPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD + 249, // 4609 -> NEARBY_BAD_FILE_DESCRIPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD }; -const std::string& OperationResultDetail_Name( - OperationResultDetail value) { +const std::string& OperationResultCode_Name( + OperationResultCode value) { static const bool dummy = ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( - OperationResultDetail_entries, - OperationResultDetail_entries_by_number, - 238, OperationResultDetail_strings); + OperationResultCode_entries, + OperationResultCode_entries_by_number, + 358, OperationResultCode_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( - OperationResultDetail_entries, - OperationResultDetail_entries_by_number, - 238, value); + OperationResultCode_entries, + OperationResultCode_entries_by_number, + 358, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : - OperationResultDetail_strings[idx].get(); + OperationResultCode_strings[idx].get(); } -bool OperationResultDetail_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OperationResultDetail* value) { +bool OperationResultCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OperationResultCode* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - OperationResultDetail_entries, 238, name, &int_value); + OperationResultCode_entries, 358, name, &int_value); if (success) { - *value = static_cast(int_value); + *value = static_cast(int_value); + } + return success; +} +bool StopAdvertisingReason_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed StopAdvertisingReason_strings[3] = {}; + +static const char StopAdvertisingReason_names[] = + "CLIENT_STOP_ADVERTISING" + "FINISH_SESSION_STOP_ADVERTISING" + "STOP_ADVERTISING_REASON_UNKNOWN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry StopAdvertisingReason_entries[] = { + { {StopAdvertisingReason_names + 0, 23}, 1 }, + { {StopAdvertisingReason_names + 23, 31}, 2 }, + { {StopAdvertisingReason_names + 54, 31}, 0 }, +}; + +static const int StopAdvertisingReason_entries_by_number[] = { + 2, // 0 -> STOP_ADVERTISING_REASON_UNKNOWN + 0, // 1 -> CLIENT_STOP_ADVERTISING + 1, // 2 -> FINISH_SESSION_STOP_ADVERTISING +}; + +const std::string& StopAdvertisingReason_Name( + StopAdvertisingReason value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + StopAdvertisingReason_entries, + StopAdvertisingReason_entries_by_number, + 3, StopAdvertisingReason_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + StopAdvertisingReason_entries, + StopAdvertisingReason_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + StopAdvertisingReason_strings[idx].get(); +} +bool StopAdvertisingReason_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, StopAdvertisingReason* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + StopAdvertisingReason_entries, 3, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +bool StopDiscoveringReason_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed StopDiscoveringReason_strings[3] = {}; + +static const char StopDiscoveringReason_names[] = + "CLIENT_STOP_DISCOVERING" + "FINISH_SESSION_STOP_DISCOVERING" + "STOP_DISCOVERING_REASON_UNKNOWN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry StopDiscoveringReason_entries[] = { + { {StopDiscoveringReason_names + 0, 23}, 1 }, + { {StopDiscoveringReason_names + 23, 31}, 2 }, + { {StopDiscoveringReason_names + 54, 31}, 0 }, +}; + +static const int StopDiscoveringReason_entries_by_number[] = { + 2, // 0 -> STOP_DISCOVERING_REASON_UNKNOWN + 0, // 1 -> CLIENT_STOP_DISCOVERING + 1, // 2 -> FINISH_SESSION_STOP_DISCOVERING +}; + +const std::string& StopDiscoveringReason_Name( + StopDiscoveringReason value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + StopDiscoveringReason_entries, + StopDiscoveringReason_entries_by_number, + 3, StopDiscoveringReason_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + StopDiscoveringReason_entries, + StopDiscoveringReason_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + StopDiscoveringReason_strings[idx].get(); +} +bool StopDiscoveringReason_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, StopDiscoveringReason* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + StopDiscoveringReason_entries, 3, name, &int_value); + if (success) { + *value = static_cast(int_value); } return success; } diff --git a/compiled_proto/proto/connections_enums.pb.h b/compiled_proto/proto/connections_enums.pb.h index 5f00902d..daaf209c 100644 --- a/compiled_proto/proto/connections_enums.pb.h +++ b/compiled_proto/proto/connections_enums.pb.h @@ -136,11 +136,12 @@ enum Medium : int { WIFI_DIRECT = 8, WEB_RTC = 9, BLE_L2CAP = 10, - USB = 11 + USB = 11, + WEB_RTC_NON_CELLULAR = 12 }; bool Medium_IsValid(int value); constexpr Medium Medium_MIN = UNKNOWN_MEDIUM; -constexpr Medium Medium_MAX = USB; +constexpr Medium Medium_MAX = WEB_RTC_NON_CELLULAR; constexpr int Medium_ARRAYSIZE = Medium_MAX + 1; const std::string& Medium_Name(Medium value); @@ -207,6 +208,25 @@ inline const std::string& ConnectionBand_Name(T enum_t_value) { } bool ConnectionBand_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionBand* value); +enum ConnectionMode : int { + LEGACY = 0, + INSTANT = 1 +}; +bool ConnectionMode_IsValid(int value); +constexpr ConnectionMode ConnectionMode_MIN = LEGACY; +constexpr ConnectionMode ConnectionMode_MAX = INSTANT; +constexpr int ConnectionMode_ARRAYSIZE = ConnectionMode_MAX + 1; + +const std::string& ConnectionMode_Name(ConnectionMode value); +template +inline const std::string& ConnectionMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConnectionMode_Name."); + return ConnectionMode_Name(static_cast(enum_t_value)); +} +bool ConnectionMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionMode* value); enum ConnectionRequestResponse : int { UNKNOWN_CONNECTION_REQUEST_RESPONSE = 0, ACCEPTED = 1, @@ -273,11 +293,12 @@ bool ConnectionAttemptDirection_Parse( enum ConnectionAttemptType : int { UNKNOWN_CONNECTION_ATTEMPT_TYPE = 0, INITIAL = 1, - UPGRADE = 2 + UPGRADE = 2, + RECONNECT = 3 }; bool ConnectionAttemptType_IsValid(int value); constexpr ConnectionAttemptType ConnectionAttemptType_MIN = UNKNOWN_CONNECTION_ATTEMPT_TYPE; -constexpr ConnectionAttemptType ConnectionAttemptType_MAX = UPGRADE; +constexpr ConnectionAttemptType ConnectionAttemptType_MAX = RECONNECT; constexpr int ConnectionAttemptType_ARRAYSIZE = ConnectionAttemptType_MAX + 1; const std::string& ConnectionAttemptType_Name(ConnectionAttemptType value); @@ -297,11 +318,13 @@ enum DisconnectionReason : int { IO_ERROR = 3, UPGRADED = 4, SHUTDOWN = 5, - UNFINISHED = 6 + UNFINISHED = 6, + PREV_CHANNEL_DISCONNECTION_IN_RECONNECT = 7, + AUTHENTICATION_FAILURE = 8 }; bool DisconnectionReason_IsValid(int value); constexpr DisconnectionReason DisconnectionReason_MIN = UNKNOWN_DISCONNECTION_REASON; -constexpr DisconnectionReason DisconnectionReason_MAX = UNFINISHED; +constexpr DisconnectionReason DisconnectionReason_MAX = AUTHENTICATION_FAILURE; constexpr int DisconnectionReason_ARRAYSIZE = DisconnectionReason_MAX + 1; const std::string& DisconnectionReason_Name(DisconnectionReason value); @@ -478,11 +501,15 @@ enum LogSource : int { INTERNAL_DEVICES = 2, BETA_TESTER_DEVICES = 3, OEM_DEVICES = 4, - DEBUG_DEVICES = 5 + DEBUG_DEVICES = 5, + NEARBY_MODULE_FOOD_DEVICES = 6, + BETO_DOGFOOD_DEVICES = 7, + NEARBY_DOGFOOD_DEVICES = 8, + NEARBY_TEAMFOOD_DEVICES = 9 }; bool LogSource_IsValid(int value); constexpr LogSource LogSource_MIN = UNSPECIFIED_SOURCE; -constexpr LogSource LogSource_MAX = DEBUG_DEVICES; +constexpr LogSource LogSource_MAX = NEARBY_TEAMFOOD_DEVICES; constexpr int LogSource_ARRAYSIZE = LogSource_MAX + 1; const std::string& LogSource_Name(LogSource value); @@ -544,7 +571,7 @@ inline const std::string& OperationResultCategory_Name(T enum_t_value) { } bool OperationResultCategory_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OperationResultCategory* value); -enum OperationResultDetail : int { +enum OperationResultCode : int { DETAIL_UNKNOWN = 0, DETAIL_SUCCESS = 1, CLIENT_CANCELLATION_REMOTE_IN_CANCELED_STATE = 500, @@ -615,6 +642,14 @@ enum OperationResultDetail : int { MEDIUM_UNAVAILABLE_REJECT_L2CAP_ON_GATT_MULTIPLEX_CONNECTION = 1536, MEDIUM_UNAVAILABLE_UPGRADE_ON_SAME_MEDIUM = 1537, MEDIUM_UNAVAILABLE_WEB_RTC_NO_INTERNET = 1538, + MEDIUM_UNAVAILABLE_STA_DISRUPTIVE_FALSE = 1539, + MEDIUM_UNAVAILABLE_STA_USER_NOT_ALLOW = 1540, + MEDIUM_UNAVAILABLE_DUPLICATE_FAST_ADVERTISING = 1541, + MEDIUM_UNAVAILABLE_NSD_NOT_AVAILABLE = 1542, + MEDIUM_UNAVAILABLE_MDNS_NOT_AVAILABLE = 1543, + MEDIUM_UNAVAILABLE_LAN_BLOCKED = 1544, + MEDIUM_UNAVAILABLE_POOR_SIGNAL = 1545, + MEDIUM_UNAVAILABLE_BT_MULTIPLEX_DISABLED = 1546, CLIENT_WIFI_DIRECT_ALREADY_HOSTING_DIRECT_GROUP_FOR_THIS_CLIENT = 2000, CLIENT_WIFI_HOTSPOT_ALREADY_HOSTING_HOTSPOT_FOR_THIS_CLIENT = 2001, CLIENT_DUPLICATE_ACCEPTING_BLE_CONNECTION_REQUEST = 2002, @@ -632,6 +667,25 @@ enum OperationResultDetail : int { CLIENT_DUPLICATE_WIFI_HOTSPOT_CONNECTION_REQUEST = 2014, CLIENT_DUPLICATE_WIFI_AWARE_SUBSCRIBING_REQUEST = 2015, CLIENT_UNSUPPORTED_USB_TO_BE_UPGRADE_MEDIUM = 2016, + CLIENT_PROCESS_TIE_BREAK_LOSS = 2017, + CLIENT_BLE_DUPLICATE_ADVERTISING = 2018, + CLIENT_BLUETOOTH_DUPLICATE_ADVERTISING = 2019, + CLIENT_NFC_DUPLICATE_ADVERTISING = 2020, + CLIENT_WIFI_LAN_DUPLICATE_ADVERTISING = 2021, + CLIENT_USB_DUPLICATE_ADVERTISING = 2022, + CLIENT_BLE_DUPLICATE_DISCOVERING = 2023, + CLIENT_BLUETOOTH_DUPLICATE_DISCOVERING = 2024, + CLIENT_NFC_DUPLICATE_DISCOVERING = 2025, + CLIENT_WIFI_LAN_DUPLICATE_DISCOVERING = 2026, + CLIENT_USB_DUPLICATE_DISCOVERING = 2027, + CLIENT_PERMISSION_FAILURE = 2028, + CLIENT_BLE_NO_LISTENING = 2029, + CLIENT_ALREADY_CONNECTED_TO_TARGET = 2030, + CLIENT_FAILED_INCOMING_CONNECTION_DUE_TO_TOPOLOGICAL_LIMIT = 2031, + CLIENT_OUT_OF_ORDER_API_CALL = 2032, + CLIENT_WRONG_CONNECTING_PERMISSIONS = 2033, + CLIENT_ALREADY_CONNECTED_TO_ENDPOINT = 2034, + CLIENT_CONNECT_TO_UNKNOWN_ENDPOINT = 2035, MISCELLEANEOUS_BLUETOOTH_MAC_ADDRESS_NULL = 2500, MISCELLEANEOUS_MOVE_TO_NEW_MEDIUM = 2501, MISCELLEANEOUS_WIFI_HOTSPOT_SOFT_AP_BLOCKED_BY_PROVISION = 2502, @@ -645,21 +699,25 @@ enum OperationResultDetail : int { MISCELLEANEOUS_BT_NOT_ACCEPTING_CONNECTION_FOR_WORK_PROFILE = 2510, MISCELLEANEOUS_WEB_RTC_GET_DROIDGUARD_RESULT_FAILURE = 2511, MISCELLEANEOUS_WEB_RTC_TACHYON_SIGNALING_MESSENGER_NULL = 2512, + MISCELLEANEOUS_WEB_RTC_FAILED_TO_RECEIVE_MESSAGE = 2513, + MISCELLEANEOUS_BLUETOOTH_CHANGE_DEVICE_NAME_FAILURE = 2514, + MISCELLEANEOUS_WEB_RTC_ICE_SERVER_NULL = 2515, + MISCELLEANEOUS_WORK_SOURCE_NULL = 2516, IO_FILE_OPENING_ERROR = 3000, IO_FILE_READING_ERROR = 3001, IO_FILE_WRITING_ERROR = 3002, IO_FOLDER_CREATION_ERROR = 3003, IO_STREAM_CREATE_PIPE_FAILURE = 3004, - IO_ENDPOINT_IO_ERROR_ON_BLE = 3005, - IO_ENDPOINT_IO_ERROR_ON_L2CAP = 3006, - IO_ENDPOINT_IO_ERROR_ON_BT = 3007, - IO_ENDPOINT_IO_ERROR_ON_WEB_RTC = 3008, - IO_ENDPOINT_IO_ERROR_ON_LAN = 3009, - IO_ENDPOINT_IO_ERROR_ON_WIFI_DIRECT = 3010, - IO_ENDPOINT_IO_ERROR_ON_WIFI_HOTSPOT = 3011, - IO_ENDPOINT_IO_ERROR_ON_WIFI_AWARE = 3012, - IO_ENDPOINT_IO_ERROR_ON_NFC = 3013, - IO_ENDPOINT_IO_ERROR_ON_USB = 3014, + IO_ENDPOINT_IO_ERROR_ON_BLE PROTOBUF_DEPRECATED_ENUM = 3005, + IO_ENDPOINT_IO_ERROR_ON_BLE_L2CAP PROTOBUF_DEPRECATED_ENUM = 3006, + IO_ENDPOINT_IO_ERROR_ON_BT PROTOBUF_DEPRECATED_ENUM = 3007, + IO_ENDPOINT_IO_ERROR_ON_WEB_RTC PROTOBUF_DEPRECATED_ENUM = 3008, + IO_ENDPOINT_IO_ERROR_ON_LAN PROTOBUF_DEPRECATED_ENUM = 3009, + IO_ENDPOINT_IO_ERROR_ON_WIFI_DIRECT PROTOBUF_DEPRECATED_ENUM = 3010, + IO_ENDPOINT_IO_ERROR_ON_WIFI_HOTSPOT PROTOBUF_DEPRECATED_ENUM = 3011, + IO_ENDPOINT_IO_ERROR_ON_WIFI_AWARE PROTOBUF_DEPRECATED_ENUM = 3012, + IO_ENDPOINT_IO_ERROR_ON_NFC PROTOBUF_DEPRECATED_ENUM = 3013, + IO_ENDPOINT_IO_ERROR_ON_USB PROTOBUF_DEPRECATED_ENUM = 3014, CONNECTIVITY_WIFI_AWARE_ATTACH_FAILURE = 3500, CONNECTIVITY_BLUETOOTH_DEVICE_OBTAIN_FAILURE = 3501, CONNECTIVITY_BLE_CLIENT_SOCKET_CREATION_FAILURE = 3502, @@ -716,6 +774,52 @@ enum OperationResultDetail : int { CONNECTIVITY_GENERIC_PAYLOAD_SENT_ERROR = 3553, CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE = 3554, CONNECTIVITY_BT_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE = 3555, + CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_TIMEOUT_FAILURE = 3556, + CONNECTIVITY_WEB_RTC_UNSATISFIED_LINK_ERROR = 3557, + CONNECTIVITY_DIRECT_GROUP_MCC_FAILURE = 3558, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE = 3559, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE_L2CAP = 3560, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_BT = 3561, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WEB_RTC = 3562, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_LAN = 3563, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_DIRECT = 3564, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_HOTSPOT = 3565, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_AWARE = 3566, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_NFC = 3567, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_USB = 3568, + CONNECTIVITY_CHANNEL_IO_ERROR_ON_UNKNOWN_MEDIUM = 3569, + CONNECTIVITY_BT_SOCKET_CREATION_IO_EXCEPTION = 3570, + CONNECTIVITY_BT_SOCKET_CONNECT_IO_EXCEPTION = 3571, + CONNECTIVITY_BT_CONNECTION_INTERRUPTED_EXCEPTION = 3572, + CONNECTIVITY_BT_CONNECTION_EXECUTION_EXCEPTION = 3573, + CONNECTIVITY_BT_CONNECTION_TIMEOUT_EXCEPTION = 3574, + CONNECTIVITY_WIFI_DIRECT_P2P_CONNECTION_FAILURE = 3575, + CONNECTIVITY_WFD_CONNECTION_INTERRUPTED_EXCEPTION = 3576, + CONNECTIVITY_WFD_CONNECTION_EXECUTION_EXCEPTION = 3577, + CONNECTIVITY_WFD_CONNECTION_TIMEOUT_EXCEPTION = 3578, + CONNECTIVITY_WFD_CONNECTION_HOSTED_ADDRESS_NULL = 3579, + CONNECTIVITY_WIFI_HOTSPOT_SPECIFIER_FAILURE = 3580, + CONNECTIVITY_WIFI_HOTSPOT_LEGACY_STA_CONNECTION_FAILURE = 3581, + CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_TIMEOUT = 3582, + CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_IO_EXCEPTION = 3583, + CONNECTIVITY_BLE_START_GATT_SERVER_FAILURE = 3584, + CONNECTIVITY_BLE_ADD_GATT_ADVERTISEMENT_FAILURE = 3585, + CONNECTIVITY_BLE_START_ADVERTISING_FAILURE = 3586, + CONNECTIVITY_BLUETOOTH_START_ADVERTISING_FAILURE = 3587, + CONNECTIVITY_WIFI_LAN_START_ADVERTISING_FAILURE = 3588, + CONNECTIVITY_WIFI_AWARE_START_ADVERTISING_FAILURE = 3589, + CONNECTIVITY_BLUETOOTH_SCAN_FAILURE = 3590, + CONNECTIVITY_BLE_SCAN_FAILURE = 3591, + CONNECTIVITY_MDNS_SCAN_FAILURE = 3592, + CONNECTIVITY_NFC_START_DISCOVERY_FAILURE = 3593, + CONNECTIVITY_WIFI_LAN_START_DISCOVERY_FAILURE = 3594, + CONNECTIVITY_WIFI_AWARE_START_DISCOVERY_FAILURE = 3595, + CONNECTIVITY_UWB_START_DISCOVERY_FAILURE = 3596, + CONNECTIVITY_LAN_MDNS_REGISTER_FAILURE = 3597, + CONNECTIVITY_BLUETOOTH_CHANGE_SCAN_MODE_FAILURE = 3598, + CONNECTIVITY_AUTO_RESUME_FAILURE = 3599, + CONNECTIVITY_INSTANT_CONNECTION_LISTENING_TIMEOUT = 3600, + CONNECTIVITY_MEDIUM_INVALID_CREDENTIAL = 3601, NEARBY_BLE_ADVERTISEMENT_MAPPING_TO_MAC_ERROR = 4500, NEARBY_BLUETOOTH_MAC_ADDRESS_INVALID_FOR_CONNECT = 4501, NEARBY_WEB_RTC_CONNECTION_FLOW_NULL = 4502, @@ -746,7 +850,7 @@ enum OperationResultDetail : int { NEARBY_WIFI_DIRECT_NULL_CALLBACK = 4527, NEARBY_WIFI_DIRECT_NULL_SSID = 4528, NEARBY_WIFI_DIRECT_NULL_PASSWORD = 4529, - NEARBY_BT_MULTIPLEX_SOCKET_DISABLED = 4530, + NEARBY_BT_MULTIPLEX_SOCKET_DISABLED PROTOBUF_DEPRECATED_ENUM = 4530, NEARBY_LAN_MULTIPLEX_SOCKET_DISABLED = 4531, NEARBY_GENERIC_NEW_ENDPOINT_CHANNEL_NULL = 4532, NEARBY_WIFI_DIRECT_NO_GROUP_FOR_LISTENING = 4533, @@ -782,23 +886,106 @@ enum OperationResultDetail : int { NEARBY_BT_VIRTUAL_SOCKET_CREATION_FAILURE = 4563, NEARBY_LAN_VIRTUAL_SOCKET_CREATION_FAILURE = 4564, NEARBY_WIFI_LAN_IP_ADDRESS_ERROR = 4565, - NEARBY_L2CAP_PSM_NOT_POSITIVE = 4566 + NEARBY_L2CAP_PSM_NOT_POSITIVE = 4566, + NEARBY_ENCRYPTION_FAILURE = 4567, + NEARBY_AUTHENTICATION_FAILURE = 4568, + NEARBY_LAN_VIRTUAL_SOCKET_NULL = 4569, + NEARBY_BLUETOOTH_ADVERTISE_TO_BYTES_FAILURE = 4570, + NEARBY_BLE_ADVERTISE_TO_BYTES_FAILURE = 4571, + NEARBY_BLE_FAST_ADVERTISE_TO_BYTES_FAILURE = 4572, + NEARBY_NFC_ADVERTISE_TO_BYTES_FAILURE = 4573, + NEARBY_WIFI_LAN_ADVERTISE_TO_BYTES_FAILURE = 4574, + NEARBY_WIFI_AWARE_ADVERTISE_TO_BYTES_FAILURE = 4575, + NEARBY_USB_ADVERTISE_TO_BYTES_FAILURE = 4576, + NEARBY_NFC_INVALID_PCP_OPTIONS = 4577, + NEARBY_BLUETOOTH_INVALID_PCP_OPTIONS = 4578, + NEARBY_BLE_INVALID_PCP_OPTIONS = 4579, + NEARBY_WIFI_LAN_INVALID_PCP_OPTIONS = 4580, + NEARBY_WIFI_AWARE_INVALID_PCP_OPTIONS = 4581, + NEARBY_USB_INVALID_PCP_OPTIONS = 4582, + NEARBY_UWB_INVALID_PCP_OPTIONS = 4583, + NEARBY_WEB_RTC_INVALID_PCP_OPTIONS = 4584, + NEARBY_BLUETOOTH_NO_CLIENT_REGISTER_FOR_SCAN = 4585, + NEARBY_INSTANT_CONNECTION_WRONG_CONNECTIVITY_INFO = 4586, + NEARBY_NEED_METHOD_OVERRIDE = 4587, + NEARBY_GENERIC_INCOMING_PAYLOAD_CREATION_FAILURE = 4588, + NEARBY_WEB_RTC_NO_LISTENING_PEER_FOUND = 4589, + NEARBY_UPGRADE_PATH_ON_WRONG_MEDIUM = 4590, + NEARBY_CONNECT_TO_ALL_MEDIUMS_FAILURE = 4591, + NEARBY_BLUETOOTH_RECONNECT_MAC_NULL = 4592, + NEARBY_LAN_RECONNECT_CONNECTION_INFO_NULL = 4593, + NEARBY_LAN_RECONNECT_IP_NULL = 4594, + NEARBY_WIFI_DIRECT_RECONNECT_META_DATA_NULL = 4595, + NEARBY_WIFI_DIRECT_RECONNECT_CONNECT_META_DATA_NULL = 4596, + NEARBY_WIFI_HOTSPOT_RECONNECT_META_DATA_NULL = 4597, + NEARBY_WIFI_HOTSPOT_RECONNECT_CONNECT_META_DATA_NULL = 4598, + NEARBY_WEB_RTC_RECONNECT_PEER_ID_NULL = 4599, + NEARBY_WIFI_AWARE_RECONNECT_META_DATA_NULL = 4600, + NEARBY_NOT_ADVERTISING_OR_LISTENING = 4601, + NEARBY_CAN_NOT_OBTAIN_DEVICE_PROVIDER = 4602, + NEARBY_SETUP_STRATEGY_FAILURE = 4603, + NEARBY_TX_ADVERTISEMENT_NULL = 4604, + NEARBY_ENDPOINT_ID_MISMATCH = 4605, + NEARBY_CONNECTIVITY_INFO_NULL_OR_WRONG = 4606, + NEARBY_LOCAL_CLIENT_STATE_WRONG = 4607, + NEARBY_REMOTE_EXCEPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD = 4608, + NEARBY_BAD_FILE_DESCRIPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD = 4609 }; -bool OperationResultDetail_IsValid(int value); -constexpr OperationResultDetail OperationResultDetail_MIN = DETAIL_UNKNOWN; -constexpr OperationResultDetail OperationResultDetail_MAX = NEARBY_L2CAP_PSM_NOT_POSITIVE; -constexpr int OperationResultDetail_ARRAYSIZE = OperationResultDetail_MAX + 1; +bool OperationResultCode_IsValid(int value); +constexpr OperationResultCode OperationResultCode_MIN = DETAIL_UNKNOWN; +constexpr OperationResultCode OperationResultCode_MAX = NEARBY_BAD_FILE_DESCRIPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD; +constexpr int OperationResultCode_ARRAYSIZE = OperationResultCode_MAX + 1; -const std::string& OperationResultDetail_Name(OperationResultDetail value); +const std::string& OperationResultCode_Name(OperationResultCode value); template -inline const std::string& OperationResultDetail_Name(T enum_t_value) { - static_assert(::std::is_same::value || +inline const std::string& OperationResultCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || ::std::is_integral::value, - "Incorrect type passed to function OperationResultDetail_Name."); - return OperationResultDetail_Name(static_cast(enum_t_value)); + "Incorrect type passed to function OperationResultCode_Name."); + return OperationResultCode_Name(static_cast(enum_t_value)); } -bool OperationResultDetail_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OperationResultDetail* value); +bool OperationResultCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OperationResultCode* value); +enum StopAdvertisingReason : int { + STOP_ADVERTISING_REASON_UNKNOWN = 0, + CLIENT_STOP_ADVERTISING = 1, + FINISH_SESSION_STOP_ADVERTISING = 2 +}; +bool StopAdvertisingReason_IsValid(int value); +constexpr StopAdvertisingReason StopAdvertisingReason_MIN = STOP_ADVERTISING_REASON_UNKNOWN; +constexpr StopAdvertisingReason StopAdvertisingReason_MAX = FINISH_SESSION_STOP_ADVERTISING; +constexpr int StopAdvertisingReason_ARRAYSIZE = StopAdvertisingReason_MAX + 1; + +const std::string& StopAdvertisingReason_Name(StopAdvertisingReason value); +template +inline const std::string& StopAdvertisingReason_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function StopAdvertisingReason_Name."); + return StopAdvertisingReason_Name(static_cast(enum_t_value)); +} +bool StopAdvertisingReason_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, StopAdvertisingReason* value); +enum StopDiscoveringReason : int { + STOP_DISCOVERING_REASON_UNKNOWN = 0, + CLIENT_STOP_DISCOVERING = 1, + FINISH_SESSION_STOP_DISCOVERING = 2 +}; +bool StopDiscoveringReason_IsValid(int value); +constexpr StopDiscoveringReason StopDiscoveringReason_MIN = STOP_DISCOVERING_REASON_UNKNOWN; +constexpr StopDiscoveringReason StopDiscoveringReason_MAX = FINISH_SESSION_STOP_DISCOVERING; +constexpr int StopDiscoveringReason_ARRAYSIZE = StopDiscoveringReason_MAX + 1; + +const std::string& StopDiscoveringReason_Name(StopDiscoveringReason value); +template +inline const std::string& StopDiscoveringReason_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function StopDiscoveringReason_Name."); + return StopDiscoveringReason_Name(static_cast(enum_t_value)); +} +bool StopDiscoveringReason_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, StopDiscoveringReason* value); // =================================================================== @@ -830,6 +1017,7 @@ template <> struct is_proto_enum< ::location::nearby::proto::connections::Sessio template <> struct is_proto_enum< ::location::nearby::proto::connections::Medium> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::ConnectionTechnology> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::ConnectionBand> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::connections::ConnectionMode> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::ConnectionRequestResponse> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::ConnectionAttemptResult> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::ConnectionAttemptDirection> : ::std::true_type {}; @@ -843,7 +1031,9 @@ template <> struct is_proto_enum< ::location::nearby::proto::connections::Bandwi template <> struct is_proto_enum< ::location::nearby::proto::connections::LogSource> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::PowerLevel> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::connections::OperationResultCategory> : ::std::true_type {}; -template <> struct is_proto_enum< ::location::nearby::proto::connections::OperationResultDetail> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::connections::OperationResultCode> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::connections::StopAdvertisingReason> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::connections::StopDiscoveringReason> : ::std::true_type {}; PROTOBUF_NAMESPACE_CLOSE diff --git a/compiled_proto/proto/fast_pair_enums.pb.cc b/compiled_proto/proto/fast_pair_enums.pb.cc new file mode 100644 index 00000000..8a5bbb06 --- /dev/null +++ b/compiled_proto/proto/fast_pair_enums.pb.cc @@ -0,0 +1,748 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: proto/fast_pair_enums.proto + +#include "proto/fast_pair_enums.pb.h" + +#include + +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace nearby { +namespace proto { +namespace fastpair { +constexpr FastPairEvent::FastPairEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct FastPairEventDefaultTypeInternal { + constexpr FastPairEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~FastPairEventDefaultTypeInternal() {} + union { + FastPairEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FastPairEventDefaultTypeInternal _FastPairEvent_default_instance_; +} // namespace fastpair +} // namespace proto +} // namespace nearby +namespace nearby { +namespace proto { +namespace fastpair { +bool FastPairEvent_BondState_IsValid(int value) { + switch (value) { + case 0: + case 10: + case 11: + case 12: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed FastPairEvent_BondState_strings[4] = {}; + +static const char FastPairEvent_BondState_names[] = + "BONDED" + "BONDING" + "NONE" + "UNKNOWN_BOND_STATE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry FastPairEvent_BondState_entries[] = { + { {FastPairEvent_BondState_names + 0, 6}, 12 }, + { {FastPairEvent_BondState_names + 6, 7}, 11 }, + { {FastPairEvent_BondState_names + 13, 4}, 10 }, + { {FastPairEvent_BondState_names + 17, 18}, 0 }, +}; + +static const int FastPairEvent_BondState_entries_by_number[] = { + 3, // 0 -> UNKNOWN_BOND_STATE + 2, // 10 -> NONE + 1, // 11 -> BONDING + 0, // 12 -> BONDED +}; + +const std::string& FastPairEvent_BondState_Name( + FastPairEvent_BondState value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + FastPairEvent_BondState_entries, + FastPairEvent_BondState_entries_by_number, + 4, FastPairEvent_BondState_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + FastPairEvent_BondState_entries, + FastPairEvent_BondState_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + FastPairEvent_BondState_strings[idx].get(); +} +bool FastPairEvent_BondState_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_BondState* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + FastPairEvent_BondState_entries, 4, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr FastPairEvent_BondState FastPairEvent::UNKNOWN_BOND_STATE; +constexpr FastPairEvent_BondState FastPairEvent::NONE; +constexpr FastPairEvent_BondState FastPairEvent::BONDING; +constexpr FastPairEvent_BondState FastPairEvent::BONDED; +constexpr FastPairEvent_BondState FastPairEvent::BondState_MIN; +constexpr FastPairEvent_BondState FastPairEvent::BondState_MAX; +constexpr int FastPairEvent::BondState_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool FastPairEvent_ErrorCode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed FastPairEvent_ErrorCode_strings[17] = {}; + +static const char FastPairEvent_ErrorCode_names[] = + "DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR" + "DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION" + "EXECUTION_EXCEPTION" + "INTERRUPTED" + "MDH_REMOTE_EXCEPTION" + "OTHER_ERROR" + "PARSE_EXCEPTION" + "REFLECTIVE_OPERATION_EXCEPTION" + "SUCCESS_ADDRESS_ROTATE" + "SUCCESS_RETRY_GATT_ERROR" + "SUCCESS_RETRY_GATT_TIMEOUT" + "SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR" + "SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT" + "SUCCESS_SECRET_HANDSHAKE_RECONNECT" + "SUCCESS_SIGNAL_LOST" + "TIMEOUT" + "UNKNOWN_ERROR_CODE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry FastPairEvent_ErrorCode_entries[] = { + { {FastPairEvent_ErrorCode_names + 0, 41}, 16 }, + { {FastPairEvent_ErrorCode_names + 41, 38}, 15 }, + { {FastPairEvent_ErrorCode_names + 79, 19}, 5 }, + { {FastPairEvent_ErrorCode_names + 98, 11}, 3 }, + { {FastPairEvent_ErrorCode_names + 109, 20}, 7 }, + { {FastPairEvent_ErrorCode_names + 129, 11}, 1 }, + { {FastPairEvent_ErrorCode_names + 140, 15}, 6 }, + { {FastPairEvent_ErrorCode_names + 155, 30}, 4 }, + { {FastPairEvent_ErrorCode_names + 185, 22}, 13 }, + { {FastPairEvent_ErrorCode_names + 207, 24}, 8 }, + { {FastPairEvent_ErrorCode_names + 231, 26}, 9 }, + { {FastPairEvent_ErrorCode_names + 257, 36}, 10 }, + { {FastPairEvent_ErrorCode_names + 293, 38}, 11 }, + { {FastPairEvent_ErrorCode_names + 331, 34}, 12 }, + { {FastPairEvent_ErrorCode_names + 365, 19}, 14 }, + { {FastPairEvent_ErrorCode_names + 384, 7}, 2 }, + { {FastPairEvent_ErrorCode_names + 391, 18}, 0 }, +}; + +static const int FastPairEvent_ErrorCode_entries_by_number[] = { + 16, // 0 -> UNKNOWN_ERROR_CODE + 5, // 1 -> OTHER_ERROR + 15, // 2 -> TIMEOUT + 3, // 3 -> INTERRUPTED + 7, // 4 -> REFLECTIVE_OPERATION_EXCEPTION + 2, // 5 -> EXECUTION_EXCEPTION + 6, // 6 -> PARSE_EXCEPTION + 4, // 7 -> MDH_REMOTE_EXCEPTION + 9, // 8 -> SUCCESS_RETRY_GATT_ERROR + 10, // 9 -> SUCCESS_RETRY_GATT_TIMEOUT + 11, // 10 -> SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR + 12, // 11 -> SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT + 13, // 12 -> SUCCESS_SECRET_HANDSHAKE_RECONNECT + 8, // 13 -> SUCCESS_ADDRESS_ROTATE + 14, // 14 -> SUCCESS_SIGNAL_LOST + 1, // 15 -> DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION + 0, // 16 -> DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR +}; + +const std::string& FastPairEvent_ErrorCode_Name( + FastPairEvent_ErrorCode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + FastPairEvent_ErrorCode_entries, + FastPairEvent_ErrorCode_entries_by_number, + 17, FastPairEvent_ErrorCode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + FastPairEvent_ErrorCode_entries, + FastPairEvent_ErrorCode_entries_by_number, + 17, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + FastPairEvent_ErrorCode_strings[idx].get(); +} +bool FastPairEvent_ErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_ErrorCode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + FastPairEvent_ErrorCode_entries, 17, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr FastPairEvent_ErrorCode FastPairEvent::UNKNOWN_ERROR_CODE; +constexpr FastPairEvent_ErrorCode FastPairEvent::OTHER_ERROR; +constexpr FastPairEvent_ErrorCode FastPairEvent::TIMEOUT; +constexpr FastPairEvent_ErrorCode FastPairEvent::INTERRUPTED; +constexpr FastPairEvent_ErrorCode FastPairEvent::REFLECTIVE_OPERATION_EXCEPTION; +constexpr FastPairEvent_ErrorCode FastPairEvent::EXECUTION_EXCEPTION; +constexpr FastPairEvent_ErrorCode FastPairEvent::PARSE_EXCEPTION; +constexpr FastPairEvent_ErrorCode FastPairEvent::MDH_REMOTE_EXCEPTION; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_RETRY_GATT_ERROR; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_RETRY_GATT_TIMEOUT; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_SECRET_HANDSHAKE_RECONNECT; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_ADDRESS_ROTATE; +constexpr FastPairEvent_ErrorCode FastPairEvent::SUCCESS_SIGNAL_LOST; +constexpr FastPairEvent_ErrorCode FastPairEvent::DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION; +constexpr FastPairEvent_ErrorCode FastPairEvent::DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR; +constexpr FastPairEvent_ErrorCode FastPairEvent::ErrorCode_MIN; +constexpr FastPairEvent_ErrorCode FastPairEvent::ErrorCode_MAX; +constexpr int FastPairEvent::ErrorCode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool FastPairEvent_BrEdrHandoverErrorCode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed FastPairEvent_BrEdrHandoverErrorCode_strings[4] = {}; + +static const char FastPairEvent_BrEdrHandoverErrorCode_names[] = + "BLUETOOTH_MAC_INVALID" + "CONTROL_POINT_RESULT_CODE_NOT_SUCCESS" + "TRANSPORT_BLOCK_INVALID" + "UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry FastPairEvent_BrEdrHandoverErrorCode_entries[] = { + { {FastPairEvent_BrEdrHandoverErrorCode_names + 0, 21}, 2 }, + { {FastPairEvent_BrEdrHandoverErrorCode_names + 21, 37}, 1 }, + { {FastPairEvent_BrEdrHandoverErrorCode_names + 58, 23}, 3 }, + { {FastPairEvent_BrEdrHandoverErrorCode_names + 81, 34}, 0 }, +}; + +static const int FastPairEvent_BrEdrHandoverErrorCode_entries_by_number[] = { + 3, // 0 -> UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE + 1, // 1 -> CONTROL_POINT_RESULT_CODE_NOT_SUCCESS + 0, // 2 -> BLUETOOTH_MAC_INVALID + 2, // 3 -> TRANSPORT_BLOCK_INVALID +}; + +const std::string& FastPairEvent_BrEdrHandoverErrorCode_Name( + FastPairEvent_BrEdrHandoverErrorCode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + FastPairEvent_BrEdrHandoverErrorCode_entries, + FastPairEvent_BrEdrHandoverErrorCode_entries_by_number, + 4, FastPairEvent_BrEdrHandoverErrorCode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + FastPairEvent_BrEdrHandoverErrorCode_entries, + FastPairEvent_BrEdrHandoverErrorCode_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + FastPairEvent_BrEdrHandoverErrorCode_strings[idx].get(); +} +bool FastPairEvent_BrEdrHandoverErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_BrEdrHandoverErrorCode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + FastPairEvent_BrEdrHandoverErrorCode_entries, 4, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent::UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE; +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent::CONTROL_POINT_RESULT_CODE_NOT_SUCCESS; +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent::BLUETOOTH_MAC_INVALID; +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent::TRANSPORT_BLOCK_INVALID; +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent::BrEdrHandoverErrorCode_MIN; +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent::BrEdrHandoverErrorCode_MAX; +constexpr int FastPairEvent::BrEdrHandoverErrorCode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool FastPairEvent_CreateBondErrorCode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed FastPairEvent_CreateBondErrorCode_strings[6] = {}; + +static const char FastPairEvent_CreateBondErrorCode_names[] = + "BOND_BROKEN" + "FAILED_BUT_ALREADY_RECEIVE_PASS_KEY" + "INCORRECT_VARIANT" + "NO_PERMISSION" + "POSSIBLE_MITM" + "UNKNOWN_BOND_ERROR_CODE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry FastPairEvent_CreateBondErrorCode_entries[] = { + { {FastPairEvent_CreateBondErrorCode_names + 0, 11}, 1 }, + { {FastPairEvent_CreateBondErrorCode_names + 11, 35}, 5 }, + { {FastPairEvent_CreateBondErrorCode_names + 46, 17}, 4 }, + { {FastPairEvent_CreateBondErrorCode_names + 63, 13}, 3 }, + { {FastPairEvent_CreateBondErrorCode_names + 76, 13}, 2 }, + { {FastPairEvent_CreateBondErrorCode_names + 89, 23}, 0 }, +}; + +static const int FastPairEvent_CreateBondErrorCode_entries_by_number[] = { + 5, // 0 -> UNKNOWN_BOND_ERROR_CODE + 0, // 1 -> BOND_BROKEN + 4, // 2 -> POSSIBLE_MITM + 3, // 3 -> NO_PERMISSION + 2, // 4 -> INCORRECT_VARIANT + 1, // 5 -> FAILED_BUT_ALREADY_RECEIVE_PASS_KEY +}; + +const std::string& FastPairEvent_CreateBondErrorCode_Name( + FastPairEvent_CreateBondErrorCode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + FastPairEvent_CreateBondErrorCode_entries, + FastPairEvent_CreateBondErrorCode_entries_by_number, + 6, FastPairEvent_CreateBondErrorCode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + FastPairEvent_CreateBondErrorCode_entries, + FastPairEvent_CreateBondErrorCode_entries_by_number, + 6, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + FastPairEvent_CreateBondErrorCode_strings[idx].get(); +} +bool FastPairEvent_CreateBondErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_CreateBondErrorCode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + FastPairEvent_CreateBondErrorCode_entries, 6, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::UNKNOWN_BOND_ERROR_CODE; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::BOND_BROKEN; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::POSSIBLE_MITM; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::NO_PERMISSION; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::INCORRECT_VARIANT; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::FAILED_BUT_ALREADY_RECEIVE_PASS_KEY; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::CreateBondErrorCode_MIN; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent::CreateBondErrorCode_MAX; +constexpr int FastPairEvent::CreateBondErrorCode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool FastPairEvent_ConnectErrorCode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed FastPairEvent_ConnectErrorCode_strings[7] = {}; + +static const char FastPairEvent_ConnectErrorCode_names[] = + "DISCONNECTED" + "DISCOVERY_NOT_FINISHED" + "FAIL_TO_DISCOVERY" + "GET_PROFILE_PROXY_FAILED" + "LINK_KEY_CLEARED" + "UNKNOWN_CONNECT_ERROR_CODE" + "UNSUPPORTED_PROFILE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry FastPairEvent_ConnectErrorCode_entries[] = { + { {FastPairEvent_ConnectErrorCode_names + 0, 12}, 3 }, + { {FastPairEvent_ConnectErrorCode_names + 12, 22}, 6 }, + { {FastPairEvent_ConnectErrorCode_names + 34, 17}, 5 }, + { {FastPairEvent_ConnectErrorCode_names + 51, 24}, 2 }, + { {FastPairEvent_ConnectErrorCode_names + 75, 16}, 4 }, + { {FastPairEvent_ConnectErrorCode_names + 91, 26}, 0 }, + { {FastPairEvent_ConnectErrorCode_names + 117, 19}, 1 }, +}; + +static const int FastPairEvent_ConnectErrorCode_entries_by_number[] = { + 5, // 0 -> UNKNOWN_CONNECT_ERROR_CODE + 6, // 1 -> UNSUPPORTED_PROFILE + 3, // 2 -> GET_PROFILE_PROXY_FAILED + 0, // 3 -> DISCONNECTED + 4, // 4 -> LINK_KEY_CLEARED + 2, // 5 -> FAIL_TO_DISCOVERY + 1, // 6 -> DISCOVERY_NOT_FINISHED +}; + +const std::string& FastPairEvent_ConnectErrorCode_Name( + FastPairEvent_ConnectErrorCode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + FastPairEvent_ConnectErrorCode_entries, + FastPairEvent_ConnectErrorCode_entries_by_number, + 7, FastPairEvent_ConnectErrorCode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + FastPairEvent_ConnectErrorCode_entries, + FastPairEvent_ConnectErrorCode_entries_by_number, + 7, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + FastPairEvent_ConnectErrorCode_strings[idx].get(); +} +bool FastPairEvent_ConnectErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_ConnectErrorCode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + FastPairEvent_ConnectErrorCode_entries, 7, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::UNKNOWN_CONNECT_ERROR_CODE; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::UNSUPPORTED_PROFILE; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::GET_PROFILE_PROXY_FAILED; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::DISCONNECTED; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::LINK_KEY_CLEARED; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::FAIL_TO_DISCOVERY; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::DISCOVERY_NOT_FINISHED; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::ConnectErrorCode_MIN; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent::ConnectErrorCode_MAX; +constexpr int FastPairEvent::ConnectErrorCode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool DeviceType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed DeviceType_strings[7] = {}; + +static const char DeviceType_names[] = + "AUTO" + "PC" + "PHONE" + "TABLET" + "TV" + "UNKNOWN_DEVICE_TYPE" + "WEARABLE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry DeviceType_entries[] = { + { {DeviceType_names + 0, 4}, 3 }, + { {DeviceType_names + 4, 2}, 4 }, + { {DeviceType_names + 6, 5}, 1 }, + { {DeviceType_names + 11, 6}, 6 }, + { {DeviceType_names + 17, 2}, 5 }, + { {DeviceType_names + 19, 19}, 0 }, + { {DeviceType_names + 38, 8}, 2 }, +}; + +static const int DeviceType_entries_by_number[] = { + 5, // 0 -> UNKNOWN_DEVICE_TYPE + 2, // 1 -> PHONE + 6, // 2 -> WEARABLE + 0, // 3 -> AUTO + 1, // 4 -> PC + 4, // 5 -> TV + 3, // 6 -> TABLET +}; + +const std::string& DeviceType_Name( + DeviceType value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + DeviceType_entries, + DeviceType_entries_by_number, + 7, DeviceType_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + DeviceType_entries, + DeviceType_entries_by_number, + 7, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + DeviceType_strings[idx].get(); +} +bool DeviceType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DeviceType* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + DeviceType_entries, 7, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +bool OsType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed OsType_strings[3] = {}; + +static const char OsType_names[] = + "ANDROID" + "CHROME_OS" + "UNKNOWN_OS_TYPE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry OsType_entries[] = { + { {OsType_names + 0, 7}, 1 }, + { {OsType_names + 7, 9}, 2 }, + { {OsType_names + 16, 15}, 0 }, +}; + +static const int OsType_entries_by_number[] = { + 2, // 0 -> UNKNOWN_OS_TYPE + 0, // 1 -> ANDROID + 1, // 2 -> CHROME_OS +}; + +const std::string& OsType_Name( + OsType value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + OsType_entries, + OsType_entries_by_number, + 3, OsType_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + OsType_entries, + OsType_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + OsType_strings[idx].get(); +} +bool OsType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OsType* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + OsType_entries, 3, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} + +// =================================================================== + +class FastPairEvent::_Internal { + public: +}; + +FastPairEvent::FastPairEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.proto.fastpair.FastPairEvent) +} +FastPairEvent::FastPairEvent(const FastPairEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.proto.fastpair.FastPairEvent) +} + +inline void FastPairEvent::SharedCtor() { +} + +FastPairEvent::~FastPairEvent() { + // @@protoc_insertion_point(destructor:nearby.proto.fastpair.FastPairEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void FastPairEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void FastPairEvent::ArenaDtor(void* object) { + FastPairEvent* _this = reinterpret_cast< FastPairEvent* >(object); + (void)_this; +} +void FastPairEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void FastPairEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void FastPairEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.proto.fastpair.FastPairEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* FastPairEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* FastPairEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.proto.fastpair.FastPairEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.proto.fastpair.FastPairEvent) + return target; +} + +size_t FastPairEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.proto.fastpair.FastPairEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void FastPairEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void FastPairEvent::MergeFrom(const FastPairEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.proto.fastpair.FastPairEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void FastPairEvent::CopyFrom(const FastPairEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.proto.fastpair.FastPairEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool FastPairEvent::IsInitialized() const { + return true; +} + +void FastPairEvent::InternalSwap(FastPairEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string FastPairEvent::GetTypeName() const { + return "nearby.proto.fastpair.FastPairEvent"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace fastpair +} // namespace proto +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::nearby::proto::fastpair::FastPairEvent* Arena::CreateMaybeMessage< ::nearby::proto::fastpair::FastPairEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::proto::fastpair::FastPairEvent >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/compiled_proto/proto/fast_pair_enums.pb.h b/compiled_proto/proto/fast_pair_enums.pb.h new file mode 100644 index 00000000..e101c0dc --- /dev/null +++ b/compiled_proto/proto/fast_pair_enums.pb.h @@ -0,0 +1,583 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: proto/fast_pair_enums.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_proto_2ffast_5fpair_5fenums_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_proto_2ffast_5fpair_5fenums_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3019000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_proto_2ffast_5fpair_5fenums_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_proto_2ffast_5fpair_5fenums_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[1] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const uint32_t offsets[]; +}; +namespace nearby { +namespace proto { +namespace fastpair { +class FastPairEvent; +struct FastPairEventDefaultTypeInternal; +extern FastPairEventDefaultTypeInternal _FastPairEvent_default_instance_; +} // namespace fastpair +} // namespace proto +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> ::nearby::proto::fastpair::FastPairEvent* Arena::CreateMaybeMessage<::nearby::proto::fastpair::FastPairEvent>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace nearby { +namespace proto { +namespace fastpair { + +enum FastPairEvent_BondState : int { + FastPairEvent_BondState_UNKNOWN_BOND_STATE = 0, + FastPairEvent_BondState_NONE = 10, + FastPairEvent_BondState_BONDING = 11, + FastPairEvent_BondState_BONDED = 12 +}; +bool FastPairEvent_BondState_IsValid(int value); +constexpr FastPairEvent_BondState FastPairEvent_BondState_BondState_MIN = FastPairEvent_BondState_UNKNOWN_BOND_STATE; +constexpr FastPairEvent_BondState FastPairEvent_BondState_BondState_MAX = FastPairEvent_BondState_BONDED; +constexpr int FastPairEvent_BondState_BondState_ARRAYSIZE = FastPairEvent_BondState_BondState_MAX + 1; + +const std::string& FastPairEvent_BondState_Name(FastPairEvent_BondState value); +template +inline const std::string& FastPairEvent_BondState_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FastPairEvent_BondState_Name."); + return FastPairEvent_BondState_Name(static_cast(enum_t_value)); +} +bool FastPairEvent_BondState_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_BondState* value); +enum FastPairEvent_ErrorCode : int { + FastPairEvent_ErrorCode_UNKNOWN_ERROR_CODE = 0, + FastPairEvent_ErrorCode_OTHER_ERROR = 1, + FastPairEvent_ErrorCode_TIMEOUT = 2, + FastPairEvent_ErrorCode_INTERRUPTED = 3, + FastPairEvent_ErrorCode_REFLECTIVE_OPERATION_EXCEPTION = 4, + FastPairEvent_ErrorCode_EXECUTION_EXCEPTION = 5, + FastPairEvent_ErrorCode_PARSE_EXCEPTION = 6, + FastPairEvent_ErrorCode_MDH_REMOTE_EXCEPTION = 7, + FastPairEvent_ErrorCode_SUCCESS_RETRY_GATT_ERROR = 8, + FastPairEvent_ErrorCode_SUCCESS_RETRY_GATT_TIMEOUT = 9, + FastPairEvent_ErrorCode_SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR = 10, + FastPairEvent_ErrorCode_SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT = 11, + FastPairEvent_ErrorCode_SUCCESS_SECRET_HANDSHAKE_RECONNECT = 12, + FastPairEvent_ErrorCode_SUCCESS_ADDRESS_ROTATE = 13, + FastPairEvent_ErrorCode_SUCCESS_SIGNAL_LOST = 14, + FastPairEvent_ErrorCode_DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION = 15, + FastPairEvent_ErrorCode_DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR = 16 +}; +bool FastPairEvent_ErrorCode_IsValid(int value); +constexpr FastPairEvent_ErrorCode FastPairEvent_ErrorCode_ErrorCode_MIN = FastPairEvent_ErrorCode_UNKNOWN_ERROR_CODE; +constexpr FastPairEvent_ErrorCode FastPairEvent_ErrorCode_ErrorCode_MAX = FastPairEvent_ErrorCode_DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR; +constexpr int FastPairEvent_ErrorCode_ErrorCode_ARRAYSIZE = FastPairEvent_ErrorCode_ErrorCode_MAX + 1; + +const std::string& FastPairEvent_ErrorCode_Name(FastPairEvent_ErrorCode value); +template +inline const std::string& FastPairEvent_ErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FastPairEvent_ErrorCode_Name."); + return FastPairEvent_ErrorCode_Name(static_cast(enum_t_value)); +} +bool FastPairEvent_ErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_ErrorCode* value); +enum FastPairEvent_BrEdrHandoverErrorCode : int { + FastPairEvent_BrEdrHandoverErrorCode_UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE = 0, + FastPairEvent_BrEdrHandoverErrorCode_CONTROL_POINT_RESULT_CODE_NOT_SUCCESS = 1, + FastPairEvent_BrEdrHandoverErrorCode_BLUETOOTH_MAC_INVALID = 2, + FastPairEvent_BrEdrHandoverErrorCode_TRANSPORT_BLOCK_INVALID = 3 +}; +bool FastPairEvent_BrEdrHandoverErrorCode_IsValid(int value); +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_MIN = FastPairEvent_BrEdrHandoverErrorCode_UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE; +constexpr FastPairEvent_BrEdrHandoverErrorCode FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_MAX = FastPairEvent_BrEdrHandoverErrorCode_TRANSPORT_BLOCK_INVALID; +constexpr int FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_ARRAYSIZE = FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_MAX + 1; + +const std::string& FastPairEvent_BrEdrHandoverErrorCode_Name(FastPairEvent_BrEdrHandoverErrorCode value); +template +inline const std::string& FastPairEvent_BrEdrHandoverErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FastPairEvent_BrEdrHandoverErrorCode_Name."); + return FastPairEvent_BrEdrHandoverErrorCode_Name(static_cast(enum_t_value)); +} +bool FastPairEvent_BrEdrHandoverErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_BrEdrHandoverErrorCode* value); +enum FastPairEvent_CreateBondErrorCode : int { + FastPairEvent_CreateBondErrorCode_UNKNOWN_BOND_ERROR_CODE = 0, + FastPairEvent_CreateBondErrorCode_BOND_BROKEN = 1, + FastPairEvent_CreateBondErrorCode_POSSIBLE_MITM = 2, + FastPairEvent_CreateBondErrorCode_NO_PERMISSION = 3, + FastPairEvent_CreateBondErrorCode_INCORRECT_VARIANT = 4, + FastPairEvent_CreateBondErrorCode_FAILED_BUT_ALREADY_RECEIVE_PASS_KEY = 5 +}; +bool FastPairEvent_CreateBondErrorCode_IsValid(int value); +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_MIN = FastPairEvent_CreateBondErrorCode_UNKNOWN_BOND_ERROR_CODE; +constexpr FastPairEvent_CreateBondErrorCode FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_MAX = FastPairEvent_CreateBondErrorCode_FAILED_BUT_ALREADY_RECEIVE_PASS_KEY; +constexpr int FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_ARRAYSIZE = FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_MAX + 1; + +const std::string& FastPairEvent_CreateBondErrorCode_Name(FastPairEvent_CreateBondErrorCode value); +template +inline const std::string& FastPairEvent_CreateBondErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FastPairEvent_CreateBondErrorCode_Name."); + return FastPairEvent_CreateBondErrorCode_Name(static_cast(enum_t_value)); +} +bool FastPairEvent_CreateBondErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_CreateBondErrorCode* value); +enum FastPairEvent_ConnectErrorCode : int { + FastPairEvent_ConnectErrorCode_UNKNOWN_CONNECT_ERROR_CODE = 0, + FastPairEvent_ConnectErrorCode_UNSUPPORTED_PROFILE = 1, + FastPairEvent_ConnectErrorCode_GET_PROFILE_PROXY_FAILED = 2, + FastPairEvent_ConnectErrorCode_DISCONNECTED = 3, + FastPairEvent_ConnectErrorCode_LINK_KEY_CLEARED = 4, + FastPairEvent_ConnectErrorCode_FAIL_TO_DISCOVERY = 5, + FastPairEvent_ConnectErrorCode_DISCOVERY_NOT_FINISHED = 6 +}; +bool FastPairEvent_ConnectErrorCode_IsValid(int value); +constexpr FastPairEvent_ConnectErrorCode FastPairEvent_ConnectErrorCode_ConnectErrorCode_MIN = FastPairEvent_ConnectErrorCode_UNKNOWN_CONNECT_ERROR_CODE; +constexpr FastPairEvent_ConnectErrorCode FastPairEvent_ConnectErrorCode_ConnectErrorCode_MAX = FastPairEvent_ConnectErrorCode_DISCOVERY_NOT_FINISHED; +constexpr int FastPairEvent_ConnectErrorCode_ConnectErrorCode_ARRAYSIZE = FastPairEvent_ConnectErrorCode_ConnectErrorCode_MAX + 1; + +const std::string& FastPairEvent_ConnectErrorCode_Name(FastPairEvent_ConnectErrorCode value); +template +inline const std::string& FastPairEvent_ConnectErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FastPairEvent_ConnectErrorCode_Name."); + return FastPairEvent_ConnectErrorCode_Name(static_cast(enum_t_value)); +} +bool FastPairEvent_ConnectErrorCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FastPairEvent_ConnectErrorCode* value); +enum DeviceType : int { + UNKNOWN_DEVICE_TYPE = 0, + PHONE = 1, + WEARABLE = 2, + AUTO = 3, + PC = 4, + TV = 5, + TABLET = 6 +}; +bool DeviceType_IsValid(int value); +constexpr DeviceType DeviceType_MIN = UNKNOWN_DEVICE_TYPE; +constexpr DeviceType DeviceType_MAX = TABLET; +constexpr int DeviceType_ARRAYSIZE = DeviceType_MAX + 1; + +const std::string& DeviceType_Name(DeviceType value); +template +inline const std::string& DeviceType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function DeviceType_Name."); + return DeviceType_Name(static_cast(enum_t_value)); +} +bool DeviceType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DeviceType* value); +enum OsType : int { + UNKNOWN_OS_TYPE = 0, + ANDROID = 1, + CHROME_OS = 2 +}; +bool OsType_IsValid(int value); +constexpr OsType OsType_MIN = UNKNOWN_OS_TYPE; +constexpr OsType OsType_MAX = CHROME_OS; +constexpr int OsType_ARRAYSIZE = OsType_MAX + 1; + +const std::string& OsType_Name(OsType value); +template +inline const std::string& OsType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function OsType_Name."); + return OsType_Name(static_cast(enum_t_value)); +} +bool OsType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OsType* value); +// =================================================================== + +class FastPairEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.proto.fastpair.FastPairEvent) */ { + public: + inline FastPairEvent() : FastPairEvent(nullptr) {} + ~FastPairEvent() override; + explicit constexpr FastPairEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + FastPairEvent(const FastPairEvent& from); + FastPairEvent(FastPairEvent&& from) noexcept + : FastPairEvent() { + *this = ::std::move(from); + } + + inline FastPairEvent& operator=(const FastPairEvent& from) { + CopyFrom(from); + return *this; + } + inline FastPairEvent& operator=(FastPairEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const FastPairEvent& default_instance() { + return *internal_default_instance(); + } + static inline const FastPairEvent* internal_default_instance() { + return reinterpret_cast( + &_FastPairEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(FastPairEvent& a, FastPairEvent& b) { + a.Swap(&b); + } + inline void Swap(FastPairEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(FastPairEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + FastPairEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const FastPairEvent& from); + void MergeFrom(const FastPairEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(FastPairEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.proto.fastpair.FastPairEvent"; + } + protected: + explicit FastPairEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef FastPairEvent_BondState BondState; + static constexpr BondState UNKNOWN_BOND_STATE = + FastPairEvent_BondState_UNKNOWN_BOND_STATE; + static constexpr BondState NONE = + FastPairEvent_BondState_NONE; + static constexpr BondState BONDING = + FastPairEvent_BondState_BONDING; + static constexpr BondState BONDED = + FastPairEvent_BondState_BONDED; + static inline bool BondState_IsValid(int value) { + return FastPairEvent_BondState_IsValid(value); + } + static constexpr BondState BondState_MIN = + FastPairEvent_BondState_BondState_MIN; + static constexpr BondState BondState_MAX = + FastPairEvent_BondState_BondState_MAX; + static constexpr int BondState_ARRAYSIZE = + FastPairEvent_BondState_BondState_ARRAYSIZE; + template + static inline const std::string& BondState_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function BondState_Name."); + return FastPairEvent_BondState_Name(enum_t_value); + } + static inline bool BondState_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + BondState* value) { + return FastPairEvent_BondState_Parse(name, value); + } + + typedef FastPairEvent_ErrorCode ErrorCode; + static constexpr ErrorCode UNKNOWN_ERROR_CODE = + FastPairEvent_ErrorCode_UNKNOWN_ERROR_CODE; + static constexpr ErrorCode OTHER_ERROR = + FastPairEvent_ErrorCode_OTHER_ERROR; + static constexpr ErrorCode TIMEOUT = + FastPairEvent_ErrorCode_TIMEOUT; + static constexpr ErrorCode INTERRUPTED = + FastPairEvent_ErrorCode_INTERRUPTED; + static constexpr ErrorCode REFLECTIVE_OPERATION_EXCEPTION = + FastPairEvent_ErrorCode_REFLECTIVE_OPERATION_EXCEPTION; + static constexpr ErrorCode EXECUTION_EXCEPTION = + FastPairEvent_ErrorCode_EXECUTION_EXCEPTION; + static constexpr ErrorCode PARSE_EXCEPTION = + FastPairEvent_ErrorCode_PARSE_EXCEPTION; + static constexpr ErrorCode MDH_REMOTE_EXCEPTION = + FastPairEvent_ErrorCode_MDH_REMOTE_EXCEPTION; + static constexpr ErrorCode SUCCESS_RETRY_GATT_ERROR = + FastPairEvent_ErrorCode_SUCCESS_RETRY_GATT_ERROR; + static constexpr ErrorCode SUCCESS_RETRY_GATT_TIMEOUT = + FastPairEvent_ErrorCode_SUCCESS_RETRY_GATT_TIMEOUT; + static constexpr ErrorCode SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR = + FastPairEvent_ErrorCode_SUCCESS_RETRY_SECRET_HANDSHAKE_ERROR; + static constexpr ErrorCode SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT = + FastPairEvent_ErrorCode_SUCCESS_RETRY_SECRET_HANDSHAKE_TIMEOUT; + static constexpr ErrorCode SUCCESS_SECRET_HANDSHAKE_RECONNECT = + FastPairEvent_ErrorCode_SUCCESS_SECRET_HANDSHAKE_RECONNECT; + static constexpr ErrorCode SUCCESS_ADDRESS_ROTATE = + FastPairEvent_ErrorCode_SUCCESS_ADDRESS_ROTATE; + static constexpr ErrorCode SUCCESS_SIGNAL_LOST = + FastPairEvent_ErrorCode_SUCCESS_SIGNAL_LOST; + static constexpr ErrorCode DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION = + FastPairEvent_ErrorCode_DEVICE_NOT_IN_PAIRED_HISTORY_EXCEPTION; + static constexpr ErrorCode DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR = + FastPairEvent_ErrorCode_DEVICE_NOT_BONDED_DURING_RETROACTIVE_PAIR; + static inline bool ErrorCode_IsValid(int value) { + return FastPairEvent_ErrorCode_IsValid(value); + } + static constexpr ErrorCode ErrorCode_MIN = + FastPairEvent_ErrorCode_ErrorCode_MIN; + static constexpr ErrorCode ErrorCode_MAX = + FastPairEvent_ErrorCode_ErrorCode_MAX; + static constexpr int ErrorCode_ARRAYSIZE = + FastPairEvent_ErrorCode_ErrorCode_ARRAYSIZE; + template + static inline const std::string& ErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ErrorCode_Name."); + return FastPairEvent_ErrorCode_Name(enum_t_value); + } + static inline bool ErrorCode_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + ErrorCode* value) { + return FastPairEvent_ErrorCode_Parse(name, value); + } + + typedef FastPairEvent_BrEdrHandoverErrorCode BrEdrHandoverErrorCode; + static constexpr BrEdrHandoverErrorCode UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE = + FastPairEvent_BrEdrHandoverErrorCode_UNKNOWN_BR_EDR_HANDOVER_ERROR_CODE; + static constexpr BrEdrHandoverErrorCode CONTROL_POINT_RESULT_CODE_NOT_SUCCESS = + FastPairEvent_BrEdrHandoverErrorCode_CONTROL_POINT_RESULT_CODE_NOT_SUCCESS; + static constexpr BrEdrHandoverErrorCode BLUETOOTH_MAC_INVALID = + FastPairEvent_BrEdrHandoverErrorCode_BLUETOOTH_MAC_INVALID; + static constexpr BrEdrHandoverErrorCode TRANSPORT_BLOCK_INVALID = + FastPairEvent_BrEdrHandoverErrorCode_TRANSPORT_BLOCK_INVALID; + static inline bool BrEdrHandoverErrorCode_IsValid(int value) { + return FastPairEvent_BrEdrHandoverErrorCode_IsValid(value); + } + static constexpr BrEdrHandoverErrorCode BrEdrHandoverErrorCode_MIN = + FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_MIN; + static constexpr BrEdrHandoverErrorCode BrEdrHandoverErrorCode_MAX = + FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_MAX; + static constexpr int BrEdrHandoverErrorCode_ARRAYSIZE = + FastPairEvent_BrEdrHandoverErrorCode_BrEdrHandoverErrorCode_ARRAYSIZE; + template + static inline const std::string& BrEdrHandoverErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function BrEdrHandoverErrorCode_Name."); + return FastPairEvent_BrEdrHandoverErrorCode_Name(enum_t_value); + } + static inline bool BrEdrHandoverErrorCode_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + BrEdrHandoverErrorCode* value) { + return FastPairEvent_BrEdrHandoverErrorCode_Parse(name, value); + } + + typedef FastPairEvent_CreateBondErrorCode CreateBondErrorCode; + static constexpr CreateBondErrorCode UNKNOWN_BOND_ERROR_CODE = + FastPairEvent_CreateBondErrorCode_UNKNOWN_BOND_ERROR_CODE; + static constexpr CreateBondErrorCode BOND_BROKEN = + FastPairEvent_CreateBondErrorCode_BOND_BROKEN; + static constexpr CreateBondErrorCode POSSIBLE_MITM = + FastPairEvent_CreateBondErrorCode_POSSIBLE_MITM; + static constexpr CreateBondErrorCode NO_PERMISSION = + FastPairEvent_CreateBondErrorCode_NO_PERMISSION; + static constexpr CreateBondErrorCode INCORRECT_VARIANT = + FastPairEvent_CreateBondErrorCode_INCORRECT_VARIANT; + static constexpr CreateBondErrorCode FAILED_BUT_ALREADY_RECEIVE_PASS_KEY = + FastPairEvent_CreateBondErrorCode_FAILED_BUT_ALREADY_RECEIVE_PASS_KEY; + static inline bool CreateBondErrorCode_IsValid(int value) { + return FastPairEvent_CreateBondErrorCode_IsValid(value); + } + static constexpr CreateBondErrorCode CreateBondErrorCode_MIN = + FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_MIN; + static constexpr CreateBondErrorCode CreateBondErrorCode_MAX = + FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_MAX; + static constexpr int CreateBondErrorCode_ARRAYSIZE = + FastPairEvent_CreateBondErrorCode_CreateBondErrorCode_ARRAYSIZE; + template + static inline const std::string& CreateBondErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function CreateBondErrorCode_Name."); + return FastPairEvent_CreateBondErrorCode_Name(enum_t_value); + } + static inline bool CreateBondErrorCode_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + CreateBondErrorCode* value) { + return FastPairEvent_CreateBondErrorCode_Parse(name, value); + } + + typedef FastPairEvent_ConnectErrorCode ConnectErrorCode; + static constexpr ConnectErrorCode UNKNOWN_CONNECT_ERROR_CODE = + FastPairEvent_ConnectErrorCode_UNKNOWN_CONNECT_ERROR_CODE; + static constexpr ConnectErrorCode UNSUPPORTED_PROFILE = + FastPairEvent_ConnectErrorCode_UNSUPPORTED_PROFILE; + static constexpr ConnectErrorCode GET_PROFILE_PROXY_FAILED = + FastPairEvent_ConnectErrorCode_GET_PROFILE_PROXY_FAILED; + static constexpr ConnectErrorCode DISCONNECTED = + FastPairEvent_ConnectErrorCode_DISCONNECTED; + static constexpr ConnectErrorCode LINK_KEY_CLEARED = + FastPairEvent_ConnectErrorCode_LINK_KEY_CLEARED; + static constexpr ConnectErrorCode FAIL_TO_DISCOVERY = + FastPairEvent_ConnectErrorCode_FAIL_TO_DISCOVERY; + static constexpr ConnectErrorCode DISCOVERY_NOT_FINISHED = + FastPairEvent_ConnectErrorCode_DISCOVERY_NOT_FINISHED; + static inline bool ConnectErrorCode_IsValid(int value) { + return FastPairEvent_ConnectErrorCode_IsValid(value); + } + static constexpr ConnectErrorCode ConnectErrorCode_MIN = + FastPairEvent_ConnectErrorCode_ConnectErrorCode_MIN; + static constexpr ConnectErrorCode ConnectErrorCode_MAX = + FastPairEvent_ConnectErrorCode_ConnectErrorCode_MAX; + static constexpr int ConnectErrorCode_ARRAYSIZE = + FastPairEvent_ConnectErrorCode_ConnectErrorCode_ARRAYSIZE; + template + static inline const std::string& ConnectErrorCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConnectErrorCode_Name."); + return FastPairEvent_ConnectErrorCode_Name(enum_t_value); + } + static inline bool ConnectErrorCode_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + ConnectErrorCode* value) { + return FastPairEvent_ConnectErrorCode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.proto.fastpair.FastPairEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2ffast_5fpair_5fenums_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// FastPairEvent + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) + +} // namespace fastpair +} // namespace proto +} // namespace nearby + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::nearby::proto::fastpair::FastPairEvent_BondState> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::proto::fastpair::FastPairEvent_ErrorCode> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::proto::fastpair::FastPairEvent_BrEdrHandoverErrorCode> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::proto::fastpair::FastPairEvent_CreateBondErrorCode> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::proto::fastpair::FastPairEvent_ConnectErrorCode> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::proto::fastpair::DeviceType> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::proto::fastpair::OsType> : ::std::true_type {}; + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_proto_2ffast_5fpair_5fenums_2eproto diff --git a/compiled_proto/proto/mediums/multiplex_frames.pb.cc b/compiled_proto/proto/mediums/multiplex_frames.pb.cc new file mode 100644 index 00000000..aa39ff0b --- /dev/null +++ b/compiled_proto/proto/mediums/multiplex_frames.pb.cc @@ -0,0 +1,2092 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: proto/mediums/multiplex_frames.proto + +#include "proto/mediums/multiplex_frames.pb.h" + +#include + +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace location { +namespace nearby { +namespace mediums { +constexpr MultiplexFrame::MultiplexFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : header_(nullptr) + , frame_type_(0) + + , _oneof_case_{}{} +struct MultiplexFrameDefaultTypeInternal { + constexpr MultiplexFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~MultiplexFrameDefaultTypeInternal() {} + union { + MultiplexFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MultiplexFrameDefaultTypeInternal _MultiplexFrame_default_instance_; +constexpr MultiplexFrameHeader::MultiplexFrameHeader( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : salted_service_id_hash_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , service_id_hash_salt_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct MultiplexFrameHeaderDefaultTypeInternal { + constexpr MultiplexFrameHeaderDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~MultiplexFrameHeaderDefaultTypeInternal() {} + union { + MultiplexFrameHeader _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MultiplexFrameHeaderDefaultTypeInternal _MultiplexFrameHeader_default_instance_; +constexpr MultiplexControlFrame::MultiplexControlFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : control_frame_type_(0) + + , _oneof_case_{}{} +struct MultiplexControlFrameDefaultTypeInternal { + constexpr MultiplexControlFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~MultiplexControlFrameDefaultTypeInternal() {} + union { + MultiplexControlFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MultiplexControlFrameDefaultTypeInternal _MultiplexControlFrame_default_instance_; +constexpr ConnectionRequestFrame::ConnectionRequestFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct ConnectionRequestFrameDefaultTypeInternal { + constexpr ConnectionRequestFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ConnectionRequestFrameDefaultTypeInternal() {} + union { + ConnectionRequestFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionRequestFrameDefaultTypeInternal _ConnectionRequestFrame_default_instance_; +constexpr ConnectionResponseFrame::ConnectionResponseFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : connection_response_code_(0) +{} +struct ConnectionResponseFrameDefaultTypeInternal { + constexpr ConnectionResponseFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~ConnectionResponseFrameDefaultTypeInternal() {} + union { + ConnectionResponseFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ConnectionResponseFrameDefaultTypeInternal _ConnectionResponseFrame_default_instance_; +constexpr DisconnectFrame::DisconnectFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct DisconnectFrameDefaultTypeInternal { + constexpr DisconnectFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~DisconnectFrameDefaultTypeInternal() {} + union { + DisconnectFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DisconnectFrameDefaultTypeInternal _DisconnectFrame_default_instance_; +constexpr MultiplexDataFrame::MultiplexDataFrame( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct MultiplexDataFrameDefaultTypeInternal { + constexpr MultiplexDataFrameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~MultiplexDataFrameDefaultTypeInternal() {} + union { + MultiplexDataFrame _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT MultiplexDataFrameDefaultTypeInternal _MultiplexDataFrame_default_instance_; +} // namespace mediums +} // namespace nearby +} // namespace location +namespace location { +namespace nearby { +namespace mediums { +bool MultiplexFrame_MultiplexFrameType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed MultiplexFrame_MultiplexFrameType_strings[3] = {}; + +static const char MultiplexFrame_MultiplexFrameType_names[] = + "CONTROL_FRAME" + "DATA_FRAME" + "UNKNOWN_FRAME_TYPE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry MultiplexFrame_MultiplexFrameType_entries[] = { + { {MultiplexFrame_MultiplexFrameType_names + 0, 13}, 1 }, + { {MultiplexFrame_MultiplexFrameType_names + 13, 10}, 2 }, + { {MultiplexFrame_MultiplexFrameType_names + 23, 18}, 0 }, +}; + +static const int MultiplexFrame_MultiplexFrameType_entries_by_number[] = { + 2, // 0 -> UNKNOWN_FRAME_TYPE + 0, // 1 -> CONTROL_FRAME + 1, // 2 -> DATA_FRAME +}; + +const std::string& MultiplexFrame_MultiplexFrameType_Name( + MultiplexFrame_MultiplexFrameType value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + MultiplexFrame_MultiplexFrameType_entries, + MultiplexFrame_MultiplexFrameType_entries_by_number, + 3, MultiplexFrame_MultiplexFrameType_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + MultiplexFrame_MultiplexFrameType_entries, + MultiplexFrame_MultiplexFrameType_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + MultiplexFrame_MultiplexFrameType_strings[idx].get(); +} +bool MultiplexFrame_MultiplexFrameType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, MultiplexFrame_MultiplexFrameType* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + MultiplexFrame_MultiplexFrameType_entries, 3, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame::UNKNOWN_FRAME_TYPE; +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame::CONTROL_FRAME; +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame::DATA_FRAME; +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame::MultiplexFrameType_MIN; +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame::MultiplexFrameType_MAX; +constexpr int MultiplexFrame::MultiplexFrameType_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool MultiplexControlFrame_MultiplexControlFrameType_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed MultiplexControlFrame_MultiplexControlFrameType_strings[4] = {}; + +static const char MultiplexControlFrame_MultiplexControlFrameType_names[] = + "CONNECTION_REQUEST" + "CONNECTION_RESPONSE" + "DISCONNECTION" + "UNKNOWN_CONTROL_FRAME_TYPE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry MultiplexControlFrame_MultiplexControlFrameType_entries[] = { + { {MultiplexControlFrame_MultiplexControlFrameType_names + 0, 18}, 1 }, + { {MultiplexControlFrame_MultiplexControlFrameType_names + 18, 19}, 2 }, + { {MultiplexControlFrame_MultiplexControlFrameType_names + 37, 13}, 3 }, + { {MultiplexControlFrame_MultiplexControlFrameType_names + 50, 26}, 0 }, +}; + +static const int MultiplexControlFrame_MultiplexControlFrameType_entries_by_number[] = { + 3, // 0 -> UNKNOWN_CONTROL_FRAME_TYPE + 0, // 1 -> CONNECTION_REQUEST + 1, // 2 -> CONNECTION_RESPONSE + 2, // 3 -> DISCONNECTION +}; + +const std::string& MultiplexControlFrame_MultiplexControlFrameType_Name( + MultiplexControlFrame_MultiplexControlFrameType value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + MultiplexControlFrame_MultiplexControlFrameType_entries, + MultiplexControlFrame_MultiplexControlFrameType_entries_by_number, + 4, MultiplexControlFrame_MultiplexControlFrameType_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + MultiplexControlFrame_MultiplexControlFrameType_entries, + MultiplexControlFrame_MultiplexControlFrameType_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + MultiplexControlFrame_MultiplexControlFrameType_strings[idx].get(); +} +bool MultiplexControlFrame_MultiplexControlFrameType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, MultiplexControlFrame_MultiplexControlFrameType* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + MultiplexControlFrame_MultiplexControlFrameType_entries, 4, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::UNKNOWN_CONTROL_FRAME_TYPE; +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::CONNECTION_REQUEST; +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::CONNECTION_RESPONSE; +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::DISCONNECTION; +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::MultiplexControlFrameType_MIN; +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::MultiplexControlFrameType_MAX; +constexpr int MultiplexControlFrame::MultiplexControlFrameType_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool ConnectionResponseFrame_ConnectionResponseCode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ConnectionResponseFrame_ConnectionResponseCode_strings[3] = {}; + +static const char ConnectionResponseFrame_ConnectionResponseCode_names[] = + "CONNECTION_ACCEPTED" + "NOT_LISTENING" + "UNKNOWN_RESPONSE_CODE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ConnectionResponseFrame_ConnectionResponseCode_entries[] = { + { {ConnectionResponseFrame_ConnectionResponseCode_names + 0, 19}, 1 }, + { {ConnectionResponseFrame_ConnectionResponseCode_names + 19, 13}, 2 }, + { {ConnectionResponseFrame_ConnectionResponseCode_names + 32, 21}, 0 }, +}; + +static const int ConnectionResponseFrame_ConnectionResponseCode_entries_by_number[] = { + 2, // 0 -> UNKNOWN_RESPONSE_CODE + 0, // 1 -> CONNECTION_ACCEPTED + 1, // 2 -> NOT_LISTENING +}; + +const std::string& ConnectionResponseFrame_ConnectionResponseCode_Name( + ConnectionResponseFrame_ConnectionResponseCode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ConnectionResponseFrame_ConnectionResponseCode_entries, + ConnectionResponseFrame_ConnectionResponseCode_entries_by_number, + 3, ConnectionResponseFrame_ConnectionResponseCode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ConnectionResponseFrame_ConnectionResponseCode_entries, + ConnectionResponseFrame_ConnectionResponseCode_entries_by_number, + 3, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ConnectionResponseFrame_ConnectionResponseCode_strings[idx].get(); +} +bool ConnectionResponseFrame_ConnectionResponseCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionResponseFrame_ConnectionResponseCode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ConnectionResponseFrame_ConnectionResponseCode_entries, 3, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::UNKNOWN_RESPONSE_CODE; +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::CONNECTION_ACCEPTED; +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::NOT_LISTENING; +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::ConnectionResponseCode_MIN; +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::ConnectionResponseCode_MAX; +constexpr int ConnectionResponseFrame::ConnectionResponseCode_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +// =================================================================== + +class MultiplexFrame::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static const ::location::nearby::mediums::MultiplexFrameHeader& header(const MultiplexFrame* msg); + static void set_has_header(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_frame_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static const ::location::nearby::mediums::MultiplexControlFrame& control_frame(const MultiplexFrame* msg); + static const ::location::nearby::mediums::MultiplexDataFrame& data_frame(const MultiplexFrame* msg); +}; + +const ::location::nearby::mediums::MultiplexFrameHeader& +MultiplexFrame::_Internal::header(const MultiplexFrame* msg) { + return *msg->header_; +} +const ::location::nearby::mediums::MultiplexControlFrame& +MultiplexFrame::_Internal::control_frame(const MultiplexFrame* msg) { + return *msg->Frame_.control_frame_; +} +const ::location::nearby::mediums::MultiplexDataFrame& +MultiplexFrame::_Internal::data_frame(const MultiplexFrame* msg) { + return *msg->Frame_.data_frame_; +} +void MultiplexFrame::set_allocated_control_frame(::location::nearby::mediums::MultiplexControlFrame* control_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_Frame(); + if (control_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::mediums::MultiplexControlFrame>::GetOwningArena(control_frame); + if (message_arena != submessage_arena) { + control_frame = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, control_frame, submessage_arena); + } + set_has_control_frame(); + Frame_.control_frame_ = control_frame; + } + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexFrame.control_frame) +} +void MultiplexFrame::set_allocated_data_frame(::location::nearby::mediums::MultiplexDataFrame* data_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_Frame(); + if (data_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::mediums::MultiplexDataFrame>::GetOwningArena(data_frame); + if (message_arena != submessage_arena) { + data_frame = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, data_frame, submessage_arena); + } + set_has_data_frame(); + Frame_.data_frame_ = data_frame; + } + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexFrame.data_frame) +} +MultiplexFrame::MultiplexFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.MultiplexFrame) +} +MultiplexFrame::MultiplexFrame(const MultiplexFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_header()) { + header_ = new ::location::nearby::mediums::MultiplexFrameHeader(*from.header_); + } else { + header_ = nullptr; + } + frame_type_ = from.frame_type_; + clear_has_Frame(); + switch (from.Frame_case()) { + case kControlFrame: { + _internal_mutable_control_frame()->::location::nearby::mediums::MultiplexControlFrame::MergeFrom(from._internal_control_frame()); + break; + } + case kDataFrame: { + _internal_mutable_data_frame()->::location::nearby::mediums::MultiplexDataFrame::MergeFrom(from._internal_data_frame()); + break; + } + case FRAME_NOT_SET: { + break; + } + } + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.MultiplexFrame) +} + +inline void MultiplexFrame::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&header_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&frame_type_) - + reinterpret_cast(&header_)) + sizeof(frame_type_)); +clear_has_Frame(); +} + +MultiplexFrame::~MultiplexFrame() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.MultiplexFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void MultiplexFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete header_; + if (has_Frame()) { + clear_Frame(); + } +} + +void MultiplexFrame::ArenaDtor(void* object) { + MultiplexFrame* _this = reinterpret_cast< MultiplexFrame* >(object); + (void)_this; +} +void MultiplexFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void MultiplexFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void MultiplexFrame::clear_Frame() { +// @@protoc_insertion_point(one_of_clear_start:location.nearby.mediums.MultiplexFrame) + switch (Frame_case()) { + case kControlFrame: { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.control_frame_; + } + break; + } + case kDataFrame: { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.data_frame_; + } + break; + } + case FRAME_NOT_SET: { + break; + } + } + _oneof_case_[0] = FRAME_NOT_SET; +} + + +void MultiplexFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.MultiplexFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(header_ != nullptr); + header_->Clear(); + } + frame_type_ = 0; + clear_Frame(); + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* MultiplexFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.mediums.MultiplexFrameHeader header = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_header(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.mediums.MultiplexFrame.MultiplexFrameType frame_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::mediums::MultiplexFrame_MultiplexFrameType_IsValid(val))) { + _internal_set_frame_type(static_cast<::location::nearby::mediums::MultiplexFrame_MultiplexFrameType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // .location.nearby.mediums.MultiplexControlFrame control_frame = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_control_frame(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .location.nearby.mediums.MultiplexDataFrame data_frame = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_data_frame(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* MultiplexFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.MultiplexFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.mediums.MultiplexFrameHeader header = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 1, _Internal::header(this), target, stream); + } + + // optional .location.nearby.mediums.MultiplexFrame.MultiplexFrameType frame_type = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_frame_type(), target); + } + + switch (Frame_case()) { + case kControlFrame: { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::control_frame(this), target, stream); + break; + } + case kDataFrame: { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 4, _Internal::data_frame(this), target, stream); + break; + } + default: ; + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.MultiplexFrame) + return target; +} + +size_t MultiplexFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.MultiplexFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.mediums.MultiplexFrameHeader header = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *header_); + } + + // optional .location.nearby.mediums.MultiplexFrame.MultiplexFrameType frame_type = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_frame_type()); + } + + } + switch (Frame_case()) { + // .location.nearby.mediums.MultiplexControlFrame control_frame = 3; + case kControlFrame: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *Frame_.control_frame_); + break; + } + // .location.nearby.mediums.MultiplexDataFrame data_frame = 4; + case kDataFrame: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *Frame_.data_frame_); + break; + } + case FRAME_NOT_SET: { + break; + } + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void MultiplexFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void MultiplexFrame::MergeFrom(const MultiplexFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.MultiplexFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_header()->::location::nearby::mediums::MultiplexFrameHeader::MergeFrom(from._internal_header()); + } + if (cached_has_bits & 0x00000002u) { + frame_type_ = from.frame_type_; + } + _has_bits_[0] |= cached_has_bits; + } + switch (from.Frame_case()) { + case kControlFrame: { + _internal_mutable_control_frame()->::location::nearby::mediums::MultiplexControlFrame::MergeFrom(from._internal_control_frame()); + break; + } + case kDataFrame: { + _internal_mutable_data_frame()->::location::nearby::mediums::MultiplexDataFrame::MergeFrom(from._internal_data_frame()); + break; + } + case FRAME_NOT_SET: { + break; + } + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void MultiplexFrame::CopyFrom(const MultiplexFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.MultiplexFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MultiplexFrame::IsInitialized() const { + return true; +} + +void MultiplexFrame::InternalSwap(MultiplexFrame* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(MultiplexFrame, frame_type_) + + sizeof(MultiplexFrame::frame_type_) + - PROTOBUF_FIELD_OFFSET(MultiplexFrame, header_)>( + reinterpret_cast(&header_), + reinterpret_cast(&other->header_)); + swap(Frame_, other->Frame_); + swap(_oneof_case_[0], other->_oneof_case_[0]); +} + +std::string MultiplexFrame::GetTypeName() const { + return "location.nearby.mediums.MultiplexFrame"; +} + + +// =================================================================== + +class MultiplexFrameHeader::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_salted_service_id_hash(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_service_id_hash_salt(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +MultiplexFrameHeader::MultiplexFrameHeader(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.MultiplexFrameHeader) +} +MultiplexFrameHeader::MultiplexFrameHeader(const MultiplexFrameHeader& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + salted_service_id_hash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + salted_service_id_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_salted_service_id_hash()) { + salted_service_id_hash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_salted_service_id_hash(), + GetArenaForAllocation()); + } + service_id_hash_salt_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + service_id_hash_salt_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_service_id_hash_salt()) { + service_id_hash_salt_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_service_id_hash_salt(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.MultiplexFrameHeader) +} + +inline void MultiplexFrameHeader::SharedCtor() { +salted_service_id_hash_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + salted_service_id_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +service_id_hash_salt_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + service_id_hash_salt_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +MultiplexFrameHeader::~MultiplexFrameHeader() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.MultiplexFrameHeader) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void MultiplexFrameHeader::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + salted_service_id_hash_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + service_id_hash_salt_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void MultiplexFrameHeader::ArenaDtor(void* object) { + MultiplexFrameHeader* _this = reinterpret_cast< MultiplexFrameHeader* >(object); + (void)_this; +} +void MultiplexFrameHeader::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void MultiplexFrameHeader::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void MultiplexFrameHeader::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.MultiplexFrameHeader) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + salted_service_id_hash_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + service_id_hash_salt_.ClearNonDefaultToEmpty(); + } + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* MultiplexFrameHeader::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional bytes salted_service_id_hash = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_salted_service_id_hash(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string service_id_hash_salt = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_service_id_hash_salt(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* MultiplexFrameHeader::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.MultiplexFrameHeader) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional bytes salted_service_id_hash = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_salted_service_id_hash(), target); + } + + // optional string service_id_hash_salt = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_service_id_hash_salt(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.MultiplexFrameHeader) + return target; +} + +size_t MultiplexFrameHeader::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.MultiplexFrameHeader) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional bytes salted_service_id_hash = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_salted_service_id_hash()); + } + + // optional string service_id_hash_salt = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_service_id_hash_salt()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void MultiplexFrameHeader::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void MultiplexFrameHeader::MergeFrom(const MultiplexFrameHeader& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.MultiplexFrameHeader) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_salted_service_id_hash(from._internal_salted_service_id_hash()); + } + if (cached_has_bits & 0x00000002u) { + _internal_set_service_id_hash_salt(from._internal_service_id_hash_salt()); + } + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void MultiplexFrameHeader::CopyFrom(const MultiplexFrameHeader& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.MultiplexFrameHeader) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MultiplexFrameHeader::IsInitialized() const { + return true; +} + +void MultiplexFrameHeader::InternalSwap(MultiplexFrameHeader* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &salted_service_id_hash_, lhs_arena, + &other->salted_service_id_hash_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &service_id_hash_salt_, lhs_arena, + &other->service_id_hash_salt_, rhs_arena + ); +} + +std::string MultiplexFrameHeader::GetTypeName() const { + return "location.nearby.mediums.MultiplexFrameHeader"; +} + + +// =================================================================== + +class MultiplexControlFrame::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_control_frame_type(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::location::nearby::mediums::ConnectionRequestFrame& connection_request_frame(const MultiplexControlFrame* msg); + static const ::location::nearby::mediums::ConnectionResponseFrame& connection_response_frame(const MultiplexControlFrame* msg); + static const ::location::nearby::mediums::DisconnectFrame& disconnect_frame(const MultiplexControlFrame* msg); +}; + +const ::location::nearby::mediums::ConnectionRequestFrame& +MultiplexControlFrame::_Internal::connection_request_frame(const MultiplexControlFrame* msg) { + return *msg->Frame_.connection_request_frame_; +} +const ::location::nearby::mediums::ConnectionResponseFrame& +MultiplexControlFrame::_Internal::connection_response_frame(const MultiplexControlFrame* msg) { + return *msg->Frame_.connection_response_frame_; +} +const ::location::nearby::mediums::DisconnectFrame& +MultiplexControlFrame::_Internal::disconnect_frame(const MultiplexControlFrame* msg) { + return *msg->Frame_.disconnect_frame_; +} +void MultiplexControlFrame::set_allocated_connection_request_frame(::location::nearby::mediums::ConnectionRequestFrame* connection_request_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_Frame(); + if (connection_request_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::mediums::ConnectionRequestFrame>::GetOwningArena(connection_request_frame); + if (message_arena != submessage_arena) { + connection_request_frame = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, connection_request_frame, submessage_arena); + } + set_has_connection_request_frame(); + Frame_.connection_request_frame_ = connection_request_frame; + } + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexControlFrame.connection_request_frame) +} +void MultiplexControlFrame::set_allocated_connection_response_frame(::location::nearby::mediums::ConnectionResponseFrame* connection_response_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_Frame(); + if (connection_response_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::mediums::ConnectionResponseFrame>::GetOwningArena(connection_response_frame); + if (message_arena != submessage_arena) { + connection_response_frame = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, connection_response_frame, submessage_arena); + } + set_has_connection_response_frame(); + Frame_.connection_response_frame_ = connection_response_frame; + } + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexControlFrame.connection_response_frame) +} +void MultiplexControlFrame::set_allocated_disconnect_frame(::location::nearby::mediums::DisconnectFrame* disconnect_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_Frame(); + if (disconnect_frame) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::mediums::DisconnectFrame>::GetOwningArena(disconnect_frame); + if (message_arena != submessage_arena) { + disconnect_frame = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, disconnect_frame, submessage_arena); + } + set_has_disconnect_frame(); + Frame_.disconnect_frame_ = disconnect_frame; + } + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexControlFrame.disconnect_frame) +} +MultiplexControlFrame::MultiplexControlFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.MultiplexControlFrame) +} +MultiplexControlFrame::MultiplexControlFrame(const MultiplexControlFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + control_frame_type_ = from.control_frame_type_; + clear_has_Frame(); + switch (from.Frame_case()) { + case kConnectionRequestFrame: { + _internal_mutable_connection_request_frame()->::location::nearby::mediums::ConnectionRequestFrame::MergeFrom(from._internal_connection_request_frame()); + break; + } + case kConnectionResponseFrame: { + _internal_mutable_connection_response_frame()->::location::nearby::mediums::ConnectionResponseFrame::MergeFrom(from._internal_connection_response_frame()); + break; + } + case kDisconnectFrame: { + _internal_mutable_disconnect_frame()->::location::nearby::mediums::DisconnectFrame::MergeFrom(from._internal_disconnect_frame()); + break; + } + case FRAME_NOT_SET: { + break; + } + } + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.MultiplexControlFrame) +} + +inline void MultiplexControlFrame::SharedCtor() { +control_frame_type_ = 0; +clear_has_Frame(); +} + +MultiplexControlFrame::~MultiplexControlFrame() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.MultiplexControlFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void MultiplexControlFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (has_Frame()) { + clear_Frame(); + } +} + +void MultiplexControlFrame::ArenaDtor(void* object) { + MultiplexControlFrame* _this = reinterpret_cast< MultiplexControlFrame* >(object); + (void)_this; +} +void MultiplexControlFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void MultiplexControlFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void MultiplexControlFrame::clear_Frame() { +// @@protoc_insertion_point(one_of_clear_start:location.nearby.mediums.MultiplexControlFrame) + switch (Frame_case()) { + case kConnectionRequestFrame: { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.connection_request_frame_; + } + break; + } + case kConnectionResponseFrame: { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.connection_response_frame_; + } + break; + } + case kDisconnectFrame: { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.disconnect_frame_; + } + break; + } + case FRAME_NOT_SET: { + break; + } + } + _oneof_case_[0] = FRAME_NOT_SET; +} + + +void MultiplexControlFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.MultiplexControlFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + control_frame_type_ = 0; + clear_Frame(); + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* MultiplexControlFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.mediums.MultiplexControlFrame.MultiplexControlFrameType control_frame_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType_IsValid(val))) { + _internal_set_control_frame_type(static_cast<::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // .location.nearby.mediums.ConnectionRequestFrame connection_request_frame = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_connection_request_frame(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .location.nearby.mediums.ConnectionResponseFrame connection_response_frame = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_connection_response_frame(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .location.nearby.mediums.DisconnectFrame disconnect_frame = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_disconnect_frame(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* MultiplexControlFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.MultiplexControlFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.mediums.MultiplexControlFrame.MultiplexControlFrameType control_frame_type = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_control_frame_type(), target); + } + + switch (Frame_case()) { + case kConnectionRequestFrame: { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::connection_request_frame(this), target, stream); + break; + } + case kConnectionResponseFrame: { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::connection_response_frame(this), target, stream); + break; + } + case kDisconnectFrame: { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 4, _Internal::disconnect_frame(this), target, stream); + break; + } + default: ; + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.MultiplexControlFrame) + return target; +} + +size_t MultiplexControlFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.MultiplexControlFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.mediums.MultiplexControlFrame.MultiplexControlFrameType control_frame_type = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_control_frame_type()); + } + + switch (Frame_case()) { + // .location.nearby.mediums.ConnectionRequestFrame connection_request_frame = 2; + case kConnectionRequestFrame: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *Frame_.connection_request_frame_); + break; + } + // .location.nearby.mediums.ConnectionResponseFrame connection_response_frame = 3; + case kConnectionResponseFrame: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *Frame_.connection_response_frame_); + break; + } + // .location.nearby.mediums.DisconnectFrame disconnect_frame = 4; + case kDisconnectFrame: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *Frame_.disconnect_frame_); + break; + } + case FRAME_NOT_SET: { + break; + } + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void MultiplexControlFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void MultiplexControlFrame::MergeFrom(const MultiplexControlFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.MultiplexControlFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_control_frame_type()) { + _internal_set_control_frame_type(from._internal_control_frame_type()); + } + switch (from.Frame_case()) { + case kConnectionRequestFrame: { + _internal_mutable_connection_request_frame()->::location::nearby::mediums::ConnectionRequestFrame::MergeFrom(from._internal_connection_request_frame()); + break; + } + case kConnectionResponseFrame: { + _internal_mutable_connection_response_frame()->::location::nearby::mediums::ConnectionResponseFrame::MergeFrom(from._internal_connection_response_frame()); + break; + } + case kDisconnectFrame: { + _internal_mutable_disconnect_frame()->::location::nearby::mediums::DisconnectFrame::MergeFrom(from._internal_disconnect_frame()); + break; + } + case FRAME_NOT_SET: { + break; + } + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void MultiplexControlFrame::CopyFrom(const MultiplexControlFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.MultiplexControlFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MultiplexControlFrame::IsInitialized() const { + return true; +} + +void MultiplexControlFrame::InternalSwap(MultiplexControlFrame* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(control_frame_type_, other->control_frame_type_); + swap(Frame_, other->Frame_); + swap(_oneof_case_[0], other->_oneof_case_[0]); +} + +std::string MultiplexControlFrame::GetTypeName() const { + return "location.nearby.mediums.MultiplexControlFrame"; +} + + +// =================================================================== + +class ConnectionRequestFrame::_Internal { + public: +}; + +ConnectionRequestFrame::ConnectionRequestFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.ConnectionRequestFrame) +} +ConnectionRequestFrame::ConnectionRequestFrame(const ConnectionRequestFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.ConnectionRequestFrame) +} + +inline void ConnectionRequestFrame::SharedCtor() { +} + +ConnectionRequestFrame::~ConnectionRequestFrame() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.ConnectionRequestFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void ConnectionRequestFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void ConnectionRequestFrame::ArenaDtor(void* object) { + ConnectionRequestFrame* _this = reinterpret_cast< ConnectionRequestFrame* >(object); + (void)_this; +} +void ConnectionRequestFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ConnectionRequestFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ConnectionRequestFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.ConnectionRequestFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* ConnectionRequestFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ConnectionRequestFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.ConnectionRequestFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.ConnectionRequestFrame) + return target; +} + +size_t ConnectionRequestFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.ConnectionRequestFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ConnectionRequestFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void ConnectionRequestFrame::MergeFrom(const ConnectionRequestFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.ConnectionRequestFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void ConnectionRequestFrame::CopyFrom(const ConnectionRequestFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.ConnectionRequestFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ConnectionRequestFrame::IsInitialized() const { + return true; +} + +void ConnectionRequestFrame::InternalSwap(ConnectionRequestFrame* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string ConnectionRequestFrame::GetTypeName() const { + return "location.nearby.mediums.ConnectionRequestFrame"; +} + + +// =================================================================== + +class ConnectionResponseFrame::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_connection_response_code(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +ConnectionResponseFrame::ConnectionResponseFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.ConnectionResponseFrame) +} +ConnectionResponseFrame::ConnectionResponseFrame(const ConnectionResponseFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + connection_response_code_ = from.connection_response_code_; + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.ConnectionResponseFrame) +} + +inline void ConnectionResponseFrame::SharedCtor() { +connection_response_code_ = 0; +} + +ConnectionResponseFrame::~ConnectionResponseFrame() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.ConnectionResponseFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void ConnectionResponseFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void ConnectionResponseFrame::ArenaDtor(void* object) { + ConnectionResponseFrame* _this = reinterpret_cast< ConnectionResponseFrame* >(object); + (void)_this; +} +void ConnectionResponseFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void ConnectionResponseFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void ConnectionResponseFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.ConnectionResponseFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + connection_response_code_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* ConnectionResponseFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.mediums.ConnectionResponseFrame.ConnectionResponseCode connection_response_code = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode_IsValid(val))) { + _internal_set_connection_response_code(static_cast<::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ConnectionResponseFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.ConnectionResponseFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.mediums.ConnectionResponseFrame.ConnectionResponseCode connection_response_code = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_connection_response_code(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.ConnectionResponseFrame) + return target; +} + +size_t ConnectionResponseFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.ConnectionResponseFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.mediums.ConnectionResponseFrame.ConnectionResponseCode connection_response_code = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_connection_response_code()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void ConnectionResponseFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void ConnectionResponseFrame::MergeFrom(const ConnectionResponseFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.ConnectionResponseFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_connection_response_code()) { + _internal_set_connection_response_code(from._internal_connection_response_code()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void ConnectionResponseFrame::CopyFrom(const ConnectionResponseFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.ConnectionResponseFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ConnectionResponseFrame::IsInitialized() const { + return true; +} + +void ConnectionResponseFrame::InternalSwap(ConnectionResponseFrame* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(connection_response_code_, other->connection_response_code_); +} + +std::string ConnectionResponseFrame::GetTypeName() const { + return "location.nearby.mediums.ConnectionResponseFrame"; +} + + +// =================================================================== + +class DisconnectFrame::_Internal { + public: +}; + +DisconnectFrame::DisconnectFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.DisconnectFrame) +} +DisconnectFrame::DisconnectFrame(const DisconnectFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.DisconnectFrame) +} + +inline void DisconnectFrame::SharedCtor() { +} + +DisconnectFrame::~DisconnectFrame() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.DisconnectFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void DisconnectFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void DisconnectFrame::ArenaDtor(void* object) { + DisconnectFrame* _this = reinterpret_cast< DisconnectFrame* >(object); + (void)_this; +} +void DisconnectFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void DisconnectFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void DisconnectFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.DisconnectFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* DisconnectFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* DisconnectFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.DisconnectFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.DisconnectFrame) + return target; +} + +size_t DisconnectFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.DisconnectFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void DisconnectFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void DisconnectFrame::MergeFrom(const DisconnectFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.DisconnectFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void DisconnectFrame::CopyFrom(const DisconnectFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.DisconnectFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool DisconnectFrame::IsInitialized() const { + return true; +} + +void DisconnectFrame::InternalSwap(DisconnectFrame* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string DisconnectFrame::GetTypeName() const { + return "location.nearby.mediums.DisconnectFrame"; +} + + +// =================================================================== + +class MultiplexDataFrame::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_data(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +MultiplexDataFrame::MultiplexDataFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:location.nearby.mediums.MultiplexDataFrame) +} +MultiplexDataFrame::MultiplexDataFrame(const MultiplexDataFrame& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_data()) { + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.MultiplexDataFrame) +} + +inline void MultiplexDataFrame::SharedCtor() { +data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +MultiplexDataFrame::~MultiplexDataFrame() { + // @@protoc_insertion_point(destructor:location.nearby.mediums.MultiplexDataFrame) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void MultiplexDataFrame::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void MultiplexDataFrame::ArenaDtor(void* object) { + MultiplexDataFrame* _this = reinterpret_cast< MultiplexDataFrame* >(object); + (void)_this; +} +void MultiplexDataFrame::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void MultiplexDataFrame::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void MultiplexDataFrame::Clear() { +// @@protoc_insertion_point(message_clear_start:location.nearby.mediums.MultiplexDataFrame) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + data_.ClearNonDefaultToEmpty(); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* MultiplexDataFrame::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional bytes data = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_data(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* MultiplexDataFrame::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:location.nearby.mediums.MultiplexDataFrame) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional bytes data = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteBytesMaybeAliased( + 1, this->_internal_data(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:location.nearby.mediums.MultiplexDataFrame) + return target; +} + +size_t MultiplexDataFrame::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:location.nearby.mediums.MultiplexDataFrame) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional bytes data = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_data()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void MultiplexDataFrame::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void MultiplexDataFrame::MergeFrom(const MultiplexDataFrame& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:location.nearby.mediums.MultiplexDataFrame) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_data()) { + _internal_set_data(from._internal_data()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void MultiplexDataFrame::CopyFrom(const MultiplexDataFrame& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:location.nearby.mediums.MultiplexDataFrame) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MultiplexDataFrame::IsInitialized() const { + return true; +} + +void MultiplexDataFrame::InternalSwap(MultiplexDataFrame* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &data_, lhs_arena, + &other->data_, rhs_arena + ); +} + +std::string MultiplexDataFrame::GetTypeName() const { + return "location.nearby.mediums.MultiplexDataFrame"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace mediums +} // namespace nearby +} // namespace location +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::MultiplexFrame* Arena::CreateMaybeMessage< ::location::nearby::mediums::MultiplexFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::MultiplexFrame >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::MultiplexFrameHeader* Arena::CreateMaybeMessage< ::location::nearby::mediums::MultiplexFrameHeader >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::MultiplexFrameHeader >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::MultiplexControlFrame* Arena::CreateMaybeMessage< ::location::nearby::mediums::MultiplexControlFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::MultiplexControlFrame >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::ConnectionRequestFrame* Arena::CreateMaybeMessage< ::location::nearby::mediums::ConnectionRequestFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::ConnectionRequestFrame >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::ConnectionResponseFrame* Arena::CreateMaybeMessage< ::location::nearby::mediums::ConnectionResponseFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::ConnectionResponseFrame >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::DisconnectFrame* Arena::CreateMaybeMessage< ::location::nearby::mediums::DisconnectFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::DisconnectFrame >(arena); +} +template<> PROTOBUF_NOINLINE ::location::nearby::mediums::MultiplexDataFrame* Arena::CreateMaybeMessage< ::location::nearby::mediums::MultiplexDataFrame >(Arena* arena) { + return Arena::CreateMessageInternal< ::location::nearby::mediums::MultiplexDataFrame >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/compiled_proto/proto/mediums/multiplex_frames.pb.h b/compiled_proto/proto/mediums/multiplex_frames.pb.h new file mode 100644 index 00000000..ba90a48e --- /dev/null +++ b/compiled_proto/proto/mediums/multiplex_frames.pb.h @@ -0,0 +1,2229 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: proto/mediums/multiplex_frames.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_proto_2fmediums_2fmultiplex_5fframes_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_proto_2fmediums_2fmultiplex_5fframes_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3019000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_proto_2fmediums_2fmultiplex_5fframes_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[7] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const uint32_t offsets[]; +}; +namespace location { +namespace nearby { +namespace mediums { +class ConnectionRequestFrame; +struct ConnectionRequestFrameDefaultTypeInternal; +extern ConnectionRequestFrameDefaultTypeInternal _ConnectionRequestFrame_default_instance_; +class ConnectionResponseFrame; +struct ConnectionResponseFrameDefaultTypeInternal; +extern ConnectionResponseFrameDefaultTypeInternal _ConnectionResponseFrame_default_instance_; +class DisconnectFrame; +struct DisconnectFrameDefaultTypeInternal; +extern DisconnectFrameDefaultTypeInternal _DisconnectFrame_default_instance_; +class MultiplexControlFrame; +struct MultiplexControlFrameDefaultTypeInternal; +extern MultiplexControlFrameDefaultTypeInternal _MultiplexControlFrame_default_instance_; +class MultiplexDataFrame; +struct MultiplexDataFrameDefaultTypeInternal; +extern MultiplexDataFrameDefaultTypeInternal _MultiplexDataFrame_default_instance_; +class MultiplexFrame; +struct MultiplexFrameDefaultTypeInternal; +extern MultiplexFrameDefaultTypeInternal _MultiplexFrame_default_instance_; +class MultiplexFrameHeader; +struct MultiplexFrameHeaderDefaultTypeInternal; +extern MultiplexFrameHeaderDefaultTypeInternal _MultiplexFrameHeader_default_instance_; +} // namespace mediums +} // namespace nearby +} // namespace location +PROTOBUF_NAMESPACE_OPEN +template<> ::location::nearby::mediums::ConnectionRequestFrame* Arena::CreateMaybeMessage<::location::nearby::mediums::ConnectionRequestFrame>(Arena*); +template<> ::location::nearby::mediums::ConnectionResponseFrame* Arena::CreateMaybeMessage<::location::nearby::mediums::ConnectionResponseFrame>(Arena*); +template<> ::location::nearby::mediums::DisconnectFrame* Arena::CreateMaybeMessage<::location::nearby::mediums::DisconnectFrame>(Arena*); +template<> ::location::nearby::mediums::MultiplexControlFrame* Arena::CreateMaybeMessage<::location::nearby::mediums::MultiplexControlFrame>(Arena*); +template<> ::location::nearby::mediums::MultiplexDataFrame* Arena::CreateMaybeMessage<::location::nearby::mediums::MultiplexDataFrame>(Arena*); +template<> ::location::nearby::mediums::MultiplexFrame* Arena::CreateMaybeMessage<::location::nearby::mediums::MultiplexFrame>(Arena*); +template<> ::location::nearby::mediums::MultiplexFrameHeader* Arena::CreateMaybeMessage<::location::nearby::mediums::MultiplexFrameHeader>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace location { +namespace nearby { +namespace mediums { + +enum MultiplexFrame_MultiplexFrameType : int { + MultiplexFrame_MultiplexFrameType_UNKNOWN_FRAME_TYPE = 0, + MultiplexFrame_MultiplexFrameType_CONTROL_FRAME = 1, + MultiplexFrame_MultiplexFrameType_DATA_FRAME = 2 +}; +bool MultiplexFrame_MultiplexFrameType_IsValid(int value); +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame_MultiplexFrameType_MultiplexFrameType_MIN = MultiplexFrame_MultiplexFrameType_UNKNOWN_FRAME_TYPE; +constexpr MultiplexFrame_MultiplexFrameType MultiplexFrame_MultiplexFrameType_MultiplexFrameType_MAX = MultiplexFrame_MultiplexFrameType_DATA_FRAME; +constexpr int MultiplexFrame_MultiplexFrameType_MultiplexFrameType_ARRAYSIZE = MultiplexFrame_MultiplexFrameType_MultiplexFrameType_MAX + 1; + +const std::string& MultiplexFrame_MultiplexFrameType_Name(MultiplexFrame_MultiplexFrameType value); +template +inline const std::string& MultiplexFrame_MultiplexFrameType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function MultiplexFrame_MultiplexFrameType_Name."); + return MultiplexFrame_MultiplexFrameType_Name(static_cast(enum_t_value)); +} +bool MultiplexFrame_MultiplexFrameType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, MultiplexFrame_MultiplexFrameType* value); +enum MultiplexControlFrame_MultiplexControlFrameType : int { + MultiplexControlFrame_MultiplexControlFrameType_UNKNOWN_CONTROL_FRAME_TYPE = 0, + MultiplexControlFrame_MultiplexControlFrameType_CONNECTION_REQUEST = 1, + MultiplexControlFrame_MultiplexControlFrameType_CONNECTION_RESPONSE = 2, + MultiplexControlFrame_MultiplexControlFrameType_DISCONNECTION = 3 +}; +bool MultiplexControlFrame_MultiplexControlFrameType_IsValid(int value); +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_MIN = MultiplexControlFrame_MultiplexControlFrameType_UNKNOWN_CONTROL_FRAME_TYPE; +constexpr MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_MAX = MultiplexControlFrame_MultiplexControlFrameType_DISCONNECTION; +constexpr int MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_ARRAYSIZE = MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_MAX + 1; + +const std::string& MultiplexControlFrame_MultiplexControlFrameType_Name(MultiplexControlFrame_MultiplexControlFrameType value); +template +inline const std::string& MultiplexControlFrame_MultiplexControlFrameType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function MultiplexControlFrame_MultiplexControlFrameType_Name."); + return MultiplexControlFrame_MultiplexControlFrameType_Name(static_cast(enum_t_value)); +} +bool MultiplexControlFrame_MultiplexControlFrameType_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, MultiplexControlFrame_MultiplexControlFrameType* value); +enum ConnectionResponseFrame_ConnectionResponseCode : int { + ConnectionResponseFrame_ConnectionResponseCode_UNKNOWN_RESPONSE_CODE = 0, + ConnectionResponseFrame_ConnectionResponseCode_CONNECTION_ACCEPTED = 1, + ConnectionResponseFrame_ConnectionResponseCode_NOT_LISTENING = 2 +}; +bool ConnectionResponseFrame_ConnectionResponseCode_IsValid(int value); +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_MIN = ConnectionResponseFrame_ConnectionResponseCode_UNKNOWN_RESPONSE_CODE; +constexpr ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_MAX = ConnectionResponseFrame_ConnectionResponseCode_NOT_LISTENING; +constexpr int ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_ARRAYSIZE = ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_MAX + 1; + +const std::string& ConnectionResponseFrame_ConnectionResponseCode_Name(ConnectionResponseFrame_ConnectionResponseCode value); +template +inline const std::string& ConnectionResponseFrame_ConnectionResponseCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConnectionResponseFrame_ConnectionResponseCode_Name."); + return ConnectionResponseFrame_ConnectionResponseCode_Name(static_cast(enum_t_value)); +} +bool ConnectionResponseFrame_ConnectionResponseCode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ConnectionResponseFrame_ConnectionResponseCode* value); +// =================================================================== + +class MultiplexFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.MultiplexFrame) */ { + public: + inline MultiplexFrame() : MultiplexFrame(nullptr) {} + ~MultiplexFrame() override; + explicit constexpr MultiplexFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + MultiplexFrame(const MultiplexFrame& from); + MultiplexFrame(MultiplexFrame&& from) noexcept + : MultiplexFrame() { + *this = ::std::move(from); + } + + inline MultiplexFrame& operator=(const MultiplexFrame& from) { + CopyFrom(from); + return *this; + } + inline MultiplexFrame& operator=(MultiplexFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const MultiplexFrame& default_instance() { + return *internal_default_instance(); + } + enum FrameCase { + kControlFrame = 3, + kDataFrame = 4, + FRAME_NOT_SET = 0, + }; + + static inline const MultiplexFrame* internal_default_instance() { + return reinterpret_cast( + &_MultiplexFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(MultiplexFrame& a, MultiplexFrame& b) { + a.Swap(&b); + } + inline void Swap(MultiplexFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MultiplexFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + MultiplexFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const MultiplexFrame& from); + void MergeFrom(const MultiplexFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(MultiplexFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.MultiplexFrame"; + } + protected: + explicit MultiplexFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef MultiplexFrame_MultiplexFrameType MultiplexFrameType; + static constexpr MultiplexFrameType UNKNOWN_FRAME_TYPE = + MultiplexFrame_MultiplexFrameType_UNKNOWN_FRAME_TYPE; + static constexpr MultiplexFrameType CONTROL_FRAME = + MultiplexFrame_MultiplexFrameType_CONTROL_FRAME; + static constexpr MultiplexFrameType DATA_FRAME = + MultiplexFrame_MultiplexFrameType_DATA_FRAME; + static inline bool MultiplexFrameType_IsValid(int value) { + return MultiplexFrame_MultiplexFrameType_IsValid(value); + } + static constexpr MultiplexFrameType MultiplexFrameType_MIN = + MultiplexFrame_MultiplexFrameType_MultiplexFrameType_MIN; + static constexpr MultiplexFrameType MultiplexFrameType_MAX = + MultiplexFrame_MultiplexFrameType_MultiplexFrameType_MAX; + static constexpr int MultiplexFrameType_ARRAYSIZE = + MultiplexFrame_MultiplexFrameType_MultiplexFrameType_ARRAYSIZE; + template + static inline const std::string& MultiplexFrameType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function MultiplexFrameType_Name."); + return MultiplexFrame_MultiplexFrameType_Name(enum_t_value); + } + static inline bool MultiplexFrameType_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + MultiplexFrameType* value) { + return MultiplexFrame_MultiplexFrameType_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kHeaderFieldNumber = 1, + kFrameTypeFieldNumber = 2, + kControlFrameFieldNumber = 3, + kDataFrameFieldNumber = 4, + }; + // optional .location.nearby.mediums.MultiplexFrameHeader header = 1; + bool has_header() const; + private: + bool _internal_has_header() const; + public: + void clear_header(); + const ::location::nearby::mediums::MultiplexFrameHeader& header() const; + PROTOBUF_NODISCARD ::location::nearby::mediums::MultiplexFrameHeader* release_header(); + ::location::nearby::mediums::MultiplexFrameHeader* mutable_header(); + void set_allocated_header(::location::nearby::mediums::MultiplexFrameHeader* header); + private: + const ::location::nearby::mediums::MultiplexFrameHeader& _internal_header() const; + ::location::nearby::mediums::MultiplexFrameHeader* _internal_mutable_header(); + public: + void unsafe_arena_set_allocated_header( + ::location::nearby::mediums::MultiplexFrameHeader* header); + ::location::nearby::mediums::MultiplexFrameHeader* unsafe_arena_release_header(); + + // optional .location.nearby.mediums.MultiplexFrame.MultiplexFrameType frame_type = 2; + bool has_frame_type() const; + private: + bool _internal_has_frame_type() const; + public: + void clear_frame_type(); + ::location::nearby::mediums::MultiplexFrame_MultiplexFrameType frame_type() const; + void set_frame_type(::location::nearby::mediums::MultiplexFrame_MultiplexFrameType value); + private: + ::location::nearby::mediums::MultiplexFrame_MultiplexFrameType _internal_frame_type() const; + void _internal_set_frame_type(::location::nearby::mediums::MultiplexFrame_MultiplexFrameType value); + public: + + // .location.nearby.mediums.MultiplexControlFrame control_frame = 3; + bool has_control_frame() const; + private: + bool _internal_has_control_frame() const; + public: + void clear_control_frame(); + const ::location::nearby::mediums::MultiplexControlFrame& control_frame() const; + PROTOBUF_NODISCARD ::location::nearby::mediums::MultiplexControlFrame* release_control_frame(); + ::location::nearby::mediums::MultiplexControlFrame* mutable_control_frame(); + void set_allocated_control_frame(::location::nearby::mediums::MultiplexControlFrame* control_frame); + private: + const ::location::nearby::mediums::MultiplexControlFrame& _internal_control_frame() const; + ::location::nearby::mediums::MultiplexControlFrame* _internal_mutable_control_frame(); + public: + void unsafe_arena_set_allocated_control_frame( + ::location::nearby::mediums::MultiplexControlFrame* control_frame); + ::location::nearby::mediums::MultiplexControlFrame* unsafe_arena_release_control_frame(); + + // .location.nearby.mediums.MultiplexDataFrame data_frame = 4; + bool has_data_frame() const; + private: + bool _internal_has_data_frame() const; + public: + void clear_data_frame(); + const ::location::nearby::mediums::MultiplexDataFrame& data_frame() const; + PROTOBUF_NODISCARD ::location::nearby::mediums::MultiplexDataFrame* release_data_frame(); + ::location::nearby::mediums::MultiplexDataFrame* mutable_data_frame(); + void set_allocated_data_frame(::location::nearby::mediums::MultiplexDataFrame* data_frame); + private: + const ::location::nearby::mediums::MultiplexDataFrame& _internal_data_frame() const; + ::location::nearby::mediums::MultiplexDataFrame* _internal_mutable_data_frame(); + public: + void unsafe_arena_set_allocated_data_frame( + ::location::nearby::mediums::MultiplexDataFrame* data_frame); + ::location::nearby::mediums::MultiplexDataFrame* unsafe_arena_release_data_frame(); + + void clear_Frame(); + FrameCase Frame_case() const; + // @@protoc_insertion_point(class_scope:location.nearby.mediums.MultiplexFrame) + private: + class _Internal; + void set_has_control_frame(); + void set_has_data_frame(); + + inline bool has_Frame() const; + inline void clear_has_Frame(); + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::location::nearby::mediums::MultiplexFrameHeader* header_; + int frame_type_; + union FrameUnion { + constexpr FrameUnion() : _constinit_{} {} + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; + ::location::nearby::mediums::MultiplexControlFrame* control_frame_; + ::location::nearby::mediums::MultiplexDataFrame* data_frame_; + } Frame_; + uint32_t _oneof_case_[1]; + + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// ------------------------------------------------------------------- + +class MultiplexFrameHeader final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.MultiplexFrameHeader) */ { + public: + inline MultiplexFrameHeader() : MultiplexFrameHeader(nullptr) {} + ~MultiplexFrameHeader() override; + explicit constexpr MultiplexFrameHeader(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + MultiplexFrameHeader(const MultiplexFrameHeader& from); + MultiplexFrameHeader(MultiplexFrameHeader&& from) noexcept + : MultiplexFrameHeader() { + *this = ::std::move(from); + } + + inline MultiplexFrameHeader& operator=(const MultiplexFrameHeader& from) { + CopyFrom(from); + return *this; + } + inline MultiplexFrameHeader& operator=(MultiplexFrameHeader&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const MultiplexFrameHeader& default_instance() { + return *internal_default_instance(); + } + static inline const MultiplexFrameHeader* internal_default_instance() { + return reinterpret_cast( + &_MultiplexFrameHeader_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(MultiplexFrameHeader& a, MultiplexFrameHeader& b) { + a.Swap(&b); + } + inline void Swap(MultiplexFrameHeader* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MultiplexFrameHeader* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + MultiplexFrameHeader* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const MultiplexFrameHeader& from); + void MergeFrom(const MultiplexFrameHeader& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(MultiplexFrameHeader* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.MultiplexFrameHeader"; + } + protected: + explicit MultiplexFrameHeader(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSaltedServiceIdHashFieldNumber = 1, + kServiceIdHashSaltFieldNumber = 2, + }; + // optional bytes salted_service_id_hash = 1; + bool has_salted_service_id_hash() const; + private: + bool _internal_has_salted_service_id_hash() const; + public: + void clear_salted_service_id_hash(); + const std::string& salted_service_id_hash() const; + template + void set_salted_service_id_hash(ArgT0&& arg0, ArgT... args); + std::string* mutable_salted_service_id_hash(); + PROTOBUF_NODISCARD std::string* release_salted_service_id_hash(); + void set_allocated_salted_service_id_hash(std::string* salted_service_id_hash); + private: + const std::string& _internal_salted_service_id_hash() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_salted_service_id_hash(const std::string& value); + std::string* _internal_mutable_salted_service_id_hash(); + public: + + // optional string service_id_hash_salt = 2; + bool has_service_id_hash_salt() const; + private: + bool _internal_has_service_id_hash_salt() const; + public: + void clear_service_id_hash_salt(); + const std::string& service_id_hash_salt() const; + template + void set_service_id_hash_salt(ArgT0&& arg0, ArgT... args); + std::string* mutable_service_id_hash_salt(); + PROTOBUF_NODISCARD std::string* release_service_id_hash_salt(); + void set_allocated_service_id_hash_salt(std::string* service_id_hash_salt); + private: + const std::string& _internal_service_id_hash_salt() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_service_id_hash_salt(const std::string& value); + std::string* _internal_mutable_service_id_hash_salt(); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.mediums.MultiplexFrameHeader) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr salted_service_id_hash_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr service_id_hash_salt_; + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// ------------------------------------------------------------------- + +class MultiplexControlFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.MultiplexControlFrame) */ { + public: + inline MultiplexControlFrame() : MultiplexControlFrame(nullptr) {} + ~MultiplexControlFrame() override; + explicit constexpr MultiplexControlFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + MultiplexControlFrame(const MultiplexControlFrame& from); + MultiplexControlFrame(MultiplexControlFrame&& from) noexcept + : MultiplexControlFrame() { + *this = ::std::move(from); + } + + inline MultiplexControlFrame& operator=(const MultiplexControlFrame& from) { + CopyFrom(from); + return *this; + } + inline MultiplexControlFrame& operator=(MultiplexControlFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const MultiplexControlFrame& default_instance() { + return *internal_default_instance(); + } + enum FrameCase { + kConnectionRequestFrame = 2, + kConnectionResponseFrame = 3, + kDisconnectFrame = 4, + FRAME_NOT_SET = 0, + }; + + static inline const MultiplexControlFrame* internal_default_instance() { + return reinterpret_cast( + &_MultiplexControlFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(MultiplexControlFrame& a, MultiplexControlFrame& b) { + a.Swap(&b); + } + inline void Swap(MultiplexControlFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MultiplexControlFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + MultiplexControlFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const MultiplexControlFrame& from); + void MergeFrom(const MultiplexControlFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(MultiplexControlFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.MultiplexControlFrame"; + } + protected: + explicit MultiplexControlFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrameType; + static constexpr MultiplexControlFrameType UNKNOWN_CONTROL_FRAME_TYPE = + MultiplexControlFrame_MultiplexControlFrameType_UNKNOWN_CONTROL_FRAME_TYPE; + static constexpr MultiplexControlFrameType CONNECTION_REQUEST = + MultiplexControlFrame_MultiplexControlFrameType_CONNECTION_REQUEST; + static constexpr MultiplexControlFrameType CONNECTION_RESPONSE = + MultiplexControlFrame_MultiplexControlFrameType_CONNECTION_RESPONSE; + static constexpr MultiplexControlFrameType DISCONNECTION = + MultiplexControlFrame_MultiplexControlFrameType_DISCONNECTION; + static inline bool MultiplexControlFrameType_IsValid(int value) { + return MultiplexControlFrame_MultiplexControlFrameType_IsValid(value); + } + static constexpr MultiplexControlFrameType MultiplexControlFrameType_MIN = + MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_MIN; + static constexpr MultiplexControlFrameType MultiplexControlFrameType_MAX = + MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_MAX; + static constexpr int MultiplexControlFrameType_ARRAYSIZE = + MultiplexControlFrame_MultiplexControlFrameType_MultiplexControlFrameType_ARRAYSIZE; + template + static inline const std::string& MultiplexControlFrameType_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function MultiplexControlFrameType_Name."); + return MultiplexControlFrame_MultiplexControlFrameType_Name(enum_t_value); + } + static inline bool MultiplexControlFrameType_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + MultiplexControlFrameType* value) { + return MultiplexControlFrame_MultiplexControlFrameType_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kControlFrameTypeFieldNumber = 1, + kConnectionRequestFrameFieldNumber = 2, + kConnectionResponseFrameFieldNumber = 3, + kDisconnectFrameFieldNumber = 4, + }; + // optional .location.nearby.mediums.MultiplexControlFrame.MultiplexControlFrameType control_frame_type = 1; + bool has_control_frame_type() const; + private: + bool _internal_has_control_frame_type() const; + public: + void clear_control_frame_type(); + ::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType control_frame_type() const; + void set_control_frame_type(::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType value); + private: + ::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType _internal_control_frame_type() const; + void _internal_set_control_frame_type(::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType value); + public: + + // .location.nearby.mediums.ConnectionRequestFrame connection_request_frame = 2; + bool has_connection_request_frame() const; + private: + bool _internal_has_connection_request_frame() const; + public: + void clear_connection_request_frame(); + const ::location::nearby::mediums::ConnectionRequestFrame& connection_request_frame() const; + PROTOBUF_NODISCARD ::location::nearby::mediums::ConnectionRequestFrame* release_connection_request_frame(); + ::location::nearby::mediums::ConnectionRequestFrame* mutable_connection_request_frame(); + void set_allocated_connection_request_frame(::location::nearby::mediums::ConnectionRequestFrame* connection_request_frame); + private: + const ::location::nearby::mediums::ConnectionRequestFrame& _internal_connection_request_frame() const; + ::location::nearby::mediums::ConnectionRequestFrame* _internal_mutable_connection_request_frame(); + public: + void unsafe_arena_set_allocated_connection_request_frame( + ::location::nearby::mediums::ConnectionRequestFrame* connection_request_frame); + ::location::nearby::mediums::ConnectionRequestFrame* unsafe_arena_release_connection_request_frame(); + + // .location.nearby.mediums.ConnectionResponseFrame connection_response_frame = 3; + bool has_connection_response_frame() const; + private: + bool _internal_has_connection_response_frame() const; + public: + void clear_connection_response_frame(); + const ::location::nearby::mediums::ConnectionResponseFrame& connection_response_frame() const; + PROTOBUF_NODISCARD ::location::nearby::mediums::ConnectionResponseFrame* release_connection_response_frame(); + ::location::nearby::mediums::ConnectionResponseFrame* mutable_connection_response_frame(); + void set_allocated_connection_response_frame(::location::nearby::mediums::ConnectionResponseFrame* connection_response_frame); + private: + const ::location::nearby::mediums::ConnectionResponseFrame& _internal_connection_response_frame() const; + ::location::nearby::mediums::ConnectionResponseFrame* _internal_mutable_connection_response_frame(); + public: + void unsafe_arena_set_allocated_connection_response_frame( + ::location::nearby::mediums::ConnectionResponseFrame* connection_response_frame); + ::location::nearby::mediums::ConnectionResponseFrame* unsafe_arena_release_connection_response_frame(); + + // .location.nearby.mediums.DisconnectFrame disconnect_frame = 4; + bool has_disconnect_frame() const; + private: + bool _internal_has_disconnect_frame() const; + public: + void clear_disconnect_frame(); + const ::location::nearby::mediums::DisconnectFrame& disconnect_frame() const; + PROTOBUF_NODISCARD ::location::nearby::mediums::DisconnectFrame* release_disconnect_frame(); + ::location::nearby::mediums::DisconnectFrame* mutable_disconnect_frame(); + void set_allocated_disconnect_frame(::location::nearby::mediums::DisconnectFrame* disconnect_frame); + private: + const ::location::nearby::mediums::DisconnectFrame& _internal_disconnect_frame() const; + ::location::nearby::mediums::DisconnectFrame* _internal_mutable_disconnect_frame(); + public: + void unsafe_arena_set_allocated_disconnect_frame( + ::location::nearby::mediums::DisconnectFrame* disconnect_frame); + ::location::nearby::mediums::DisconnectFrame* unsafe_arena_release_disconnect_frame(); + + void clear_Frame(); + FrameCase Frame_case() const; + // @@protoc_insertion_point(class_scope:location.nearby.mediums.MultiplexControlFrame) + private: + class _Internal; + void set_has_connection_request_frame(); + void set_has_connection_response_frame(); + void set_has_disconnect_frame(); + + inline bool has_Frame() const; + inline void clear_has_Frame(); + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int control_frame_type_; + union FrameUnion { + constexpr FrameUnion() : _constinit_{} {} + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; + ::location::nearby::mediums::ConnectionRequestFrame* connection_request_frame_; + ::location::nearby::mediums::ConnectionResponseFrame* connection_response_frame_; + ::location::nearby::mediums::DisconnectFrame* disconnect_frame_; + } Frame_; + uint32_t _oneof_case_[1]; + + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// ------------------------------------------------------------------- + +class ConnectionRequestFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.ConnectionRequestFrame) */ { + public: + inline ConnectionRequestFrame() : ConnectionRequestFrame(nullptr) {} + ~ConnectionRequestFrame() override; + explicit constexpr ConnectionRequestFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ConnectionRequestFrame(const ConnectionRequestFrame& from); + ConnectionRequestFrame(ConnectionRequestFrame&& from) noexcept + : ConnectionRequestFrame() { + *this = ::std::move(from); + } + + inline ConnectionRequestFrame& operator=(const ConnectionRequestFrame& from) { + CopyFrom(from); + return *this; + } + inline ConnectionRequestFrame& operator=(ConnectionRequestFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ConnectionRequestFrame& default_instance() { + return *internal_default_instance(); + } + static inline const ConnectionRequestFrame* internal_default_instance() { + return reinterpret_cast( + &_ConnectionRequestFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(ConnectionRequestFrame& a, ConnectionRequestFrame& b) { + a.Swap(&b); + } + inline void Swap(ConnectionRequestFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConnectionRequestFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ConnectionRequestFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ConnectionRequestFrame& from); + void MergeFrom(const ConnectionRequestFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ConnectionRequestFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.ConnectionRequestFrame"; + } + protected: + explicit ConnectionRequestFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:location.nearby.mediums.ConnectionRequestFrame) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// ------------------------------------------------------------------- + +class ConnectionResponseFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.ConnectionResponseFrame) */ { + public: + inline ConnectionResponseFrame() : ConnectionResponseFrame(nullptr) {} + ~ConnectionResponseFrame() override; + explicit constexpr ConnectionResponseFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ConnectionResponseFrame(const ConnectionResponseFrame& from); + ConnectionResponseFrame(ConnectionResponseFrame&& from) noexcept + : ConnectionResponseFrame() { + *this = ::std::move(from); + } + + inline ConnectionResponseFrame& operator=(const ConnectionResponseFrame& from) { + CopyFrom(from); + return *this; + } + inline ConnectionResponseFrame& operator=(ConnectionResponseFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ConnectionResponseFrame& default_instance() { + return *internal_default_instance(); + } + static inline const ConnectionResponseFrame* internal_default_instance() { + return reinterpret_cast( + &_ConnectionResponseFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(ConnectionResponseFrame& a, ConnectionResponseFrame& b) { + a.Swap(&b); + } + inline void Swap(ConnectionResponseFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ConnectionResponseFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ConnectionResponseFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const ConnectionResponseFrame& from); + void MergeFrom(const ConnectionResponseFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(ConnectionResponseFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.ConnectionResponseFrame"; + } + protected: + explicit ConnectionResponseFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseCode; + static constexpr ConnectionResponseCode UNKNOWN_RESPONSE_CODE = + ConnectionResponseFrame_ConnectionResponseCode_UNKNOWN_RESPONSE_CODE; + static constexpr ConnectionResponseCode CONNECTION_ACCEPTED = + ConnectionResponseFrame_ConnectionResponseCode_CONNECTION_ACCEPTED; + static constexpr ConnectionResponseCode NOT_LISTENING = + ConnectionResponseFrame_ConnectionResponseCode_NOT_LISTENING; + static inline bool ConnectionResponseCode_IsValid(int value) { + return ConnectionResponseFrame_ConnectionResponseCode_IsValid(value); + } + static constexpr ConnectionResponseCode ConnectionResponseCode_MIN = + ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_MIN; + static constexpr ConnectionResponseCode ConnectionResponseCode_MAX = + ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_MAX; + static constexpr int ConnectionResponseCode_ARRAYSIZE = + ConnectionResponseFrame_ConnectionResponseCode_ConnectionResponseCode_ARRAYSIZE; + template + static inline const std::string& ConnectionResponseCode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ConnectionResponseCode_Name."); + return ConnectionResponseFrame_ConnectionResponseCode_Name(enum_t_value); + } + static inline bool ConnectionResponseCode_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + ConnectionResponseCode* value) { + return ConnectionResponseFrame_ConnectionResponseCode_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kConnectionResponseCodeFieldNumber = 1, + }; + // optional .location.nearby.mediums.ConnectionResponseFrame.ConnectionResponseCode connection_response_code = 1; + bool has_connection_response_code() const; + private: + bool _internal_has_connection_response_code() const; + public: + void clear_connection_response_code(); + ::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode connection_response_code() const; + void set_connection_response_code(::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode value); + private: + ::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode _internal_connection_response_code() const; + void _internal_set_connection_response_code(::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode value); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.mediums.ConnectionResponseFrame) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int connection_response_code_; + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// ------------------------------------------------------------------- + +class DisconnectFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.DisconnectFrame) */ { + public: + inline DisconnectFrame() : DisconnectFrame(nullptr) {} + ~DisconnectFrame() override; + explicit constexpr DisconnectFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + DisconnectFrame(const DisconnectFrame& from); + DisconnectFrame(DisconnectFrame&& from) noexcept + : DisconnectFrame() { + *this = ::std::move(from); + } + + inline DisconnectFrame& operator=(const DisconnectFrame& from) { + CopyFrom(from); + return *this; + } + inline DisconnectFrame& operator=(DisconnectFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const DisconnectFrame& default_instance() { + return *internal_default_instance(); + } + static inline const DisconnectFrame* internal_default_instance() { + return reinterpret_cast( + &_DisconnectFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(DisconnectFrame& a, DisconnectFrame& b) { + a.Swap(&b); + } + inline void Swap(DisconnectFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(DisconnectFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + DisconnectFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const DisconnectFrame& from); + void MergeFrom(const DisconnectFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(DisconnectFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.DisconnectFrame"; + } + protected: + explicit DisconnectFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:location.nearby.mediums.DisconnectFrame) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// ------------------------------------------------------------------- + +class MultiplexDataFrame final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:location.nearby.mediums.MultiplexDataFrame) */ { + public: + inline MultiplexDataFrame() : MultiplexDataFrame(nullptr) {} + ~MultiplexDataFrame() override; + explicit constexpr MultiplexDataFrame(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + MultiplexDataFrame(const MultiplexDataFrame& from); + MultiplexDataFrame(MultiplexDataFrame&& from) noexcept + : MultiplexDataFrame() { + *this = ::std::move(from); + } + + inline MultiplexDataFrame& operator=(const MultiplexDataFrame& from) { + CopyFrom(from); + return *this; + } + inline MultiplexDataFrame& operator=(MultiplexDataFrame&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const MultiplexDataFrame& default_instance() { + return *internal_default_instance(); + } + static inline const MultiplexDataFrame* internal_default_instance() { + return reinterpret_cast( + &_MultiplexDataFrame_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(MultiplexDataFrame& a, MultiplexDataFrame& b) { + a.Swap(&b); + } + inline void Swap(MultiplexDataFrame* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MultiplexDataFrame* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + MultiplexDataFrame* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const MultiplexDataFrame& from); + void MergeFrom(const MultiplexDataFrame& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(MultiplexDataFrame* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "location.nearby.mediums.MultiplexDataFrame"; + } + protected: + explicit MultiplexDataFrame(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDataFieldNumber = 1, + }; + // optional bytes data = 1; + bool has_data() const; + private: + bool _internal_has_data() const; + public: + void clear_data(); + const std::string& data() const; + template + void set_data(ArgT0&& arg0, ArgT... args); + std::string* mutable_data(); + PROTOBUF_NODISCARD std::string* release_data(); + void set_allocated_data(std::string* data); + private: + const std::string& _internal_data() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value); + std::string* _internal_mutable_data(); + public: + + // @@protoc_insertion_point(class_scope:location.nearby.mediums.MultiplexDataFrame) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_; + friend struct ::TableStruct_proto_2fmediums_2fmultiplex_5fframes_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// MultiplexFrame + +// optional .location.nearby.mediums.MultiplexFrameHeader header = 1; +inline bool MultiplexFrame::_internal_has_header() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || header_ != nullptr); + return value; +} +inline bool MultiplexFrame::has_header() const { + return _internal_has_header(); +} +inline void MultiplexFrame::clear_header() { + if (header_ != nullptr) header_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::location::nearby::mediums::MultiplexFrameHeader& MultiplexFrame::_internal_header() const { + const ::location::nearby::mediums::MultiplexFrameHeader* p = header_; + return p != nullptr ? *p : reinterpret_cast( + ::location::nearby::mediums::_MultiplexFrameHeader_default_instance_); +} +inline const ::location::nearby::mediums::MultiplexFrameHeader& MultiplexFrame::header() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexFrame.header) + return _internal_header(); +} +inline void MultiplexFrame::unsafe_arena_set_allocated_header( + ::location::nearby::mediums::MultiplexFrameHeader* header) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(header_); + } + header_ = header; + if (header) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.mediums.MultiplexFrame.header) +} +inline ::location::nearby::mediums::MultiplexFrameHeader* MultiplexFrame::release_header() { + _has_bits_[0] &= ~0x00000001u; + ::location::nearby::mediums::MultiplexFrameHeader* temp = header_; + header_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::location::nearby::mediums::MultiplexFrameHeader* MultiplexFrame::unsafe_arena_release_header() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexFrame.header) + _has_bits_[0] &= ~0x00000001u; + ::location::nearby::mediums::MultiplexFrameHeader* temp = header_; + header_ = nullptr; + return temp; +} +inline ::location::nearby::mediums::MultiplexFrameHeader* MultiplexFrame::_internal_mutable_header() { + _has_bits_[0] |= 0x00000001u; + if (header_ == nullptr) { + auto* p = CreateMaybeMessage<::location::nearby::mediums::MultiplexFrameHeader>(GetArenaForAllocation()); + header_ = p; + } + return header_; +} +inline ::location::nearby::mediums::MultiplexFrameHeader* MultiplexFrame::mutable_header() { + ::location::nearby::mediums::MultiplexFrameHeader* _msg = _internal_mutable_header(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexFrame.header) + return _msg; +} +inline void MultiplexFrame::set_allocated_header(::location::nearby::mediums::MultiplexFrameHeader* header) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete header_; + } + if (header) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::location::nearby::mediums::MultiplexFrameHeader>::GetOwningArena(header); + if (message_arena != submessage_arena) { + header = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, header, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + header_ = header; + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexFrame.header) +} + +// optional .location.nearby.mediums.MultiplexFrame.MultiplexFrameType frame_type = 2; +inline bool MultiplexFrame::_internal_has_frame_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool MultiplexFrame::has_frame_type() const { + return _internal_has_frame_type(); +} +inline void MultiplexFrame::clear_frame_type() { + frame_type_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::mediums::MultiplexFrame_MultiplexFrameType MultiplexFrame::_internal_frame_type() const { + return static_cast< ::location::nearby::mediums::MultiplexFrame_MultiplexFrameType >(frame_type_); +} +inline ::location::nearby::mediums::MultiplexFrame_MultiplexFrameType MultiplexFrame::frame_type() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexFrame.frame_type) + return _internal_frame_type(); +} +inline void MultiplexFrame::_internal_set_frame_type(::location::nearby::mediums::MultiplexFrame_MultiplexFrameType value) { + assert(::location::nearby::mediums::MultiplexFrame_MultiplexFrameType_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + frame_type_ = value; +} +inline void MultiplexFrame::set_frame_type(::location::nearby::mediums::MultiplexFrame_MultiplexFrameType value) { + _internal_set_frame_type(value); + // @@protoc_insertion_point(field_set:location.nearby.mediums.MultiplexFrame.frame_type) +} + +// .location.nearby.mediums.MultiplexControlFrame control_frame = 3; +inline bool MultiplexFrame::_internal_has_control_frame() const { + return Frame_case() == kControlFrame; +} +inline bool MultiplexFrame::has_control_frame() const { + return _internal_has_control_frame(); +} +inline void MultiplexFrame::set_has_control_frame() { + _oneof_case_[0] = kControlFrame; +} +inline void MultiplexFrame::clear_control_frame() { + if (_internal_has_control_frame()) { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.control_frame_; + } + clear_has_Frame(); + } +} +inline ::location::nearby::mediums::MultiplexControlFrame* MultiplexFrame::release_control_frame() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexFrame.control_frame) + if (_internal_has_control_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::MultiplexControlFrame* temp = Frame_.control_frame_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + Frame_.control_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::location::nearby::mediums::MultiplexControlFrame& MultiplexFrame::_internal_control_frame() const { + return _internal_has_control_frame() + ? *Frame_.control_frame_ + : reinterpret_cast< ::location::nearby::mediums::MultiplexControlFrame&>(::location::nearby::mediums::_MultiplexControlFrame_default_instance_); +} +inline const ::location::nearby::mediums::MultiplexControlFrame& MultiplexFrame::control_frame() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexFrame.control_frame) + return _internal_control_frame(); +} +inline ::location::nearby::mediums::MultiplexControlFrame* MultiplexFrame::unsafe_arena_release_control_frame() { + // @@protoc_insertion_point(field_unsafe_arena_release:location.nearby.mediums.MultiplexFrame.control_frame) + if (_internal_has_control_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::MultiplexControlFrame* temp = Frame_.control_frame_; + Frame_.control_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void MultiplexFrame::unsafe_arena_set_allocated_control_frame(::location::nearby::mediums::MultiplexControlFrame* control_frame) { + clear_Frame(); + if (control_frame) { + set_has_control_frame(); + Frame_.control_frame_ = control_frame; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.mediums.MultiplexFrame.control_frame) +} +inline ::location::nearby::mediums::MultiplexControlFrame* MultiplexFrame::_internal_mutable_control_frame() { + if (!_internal_has_control_frame()) { + clear_Frame(); + set_has_control_frame(); + Frame_.control_frame_ = CreateMaybeMessage< ::location::nearby::mediums::MultiplexControlFrame >(GetArenaForAllocation()); + } + return Frame_.control_frame_; +} +inline ::location::nearby::mediums::MultiplexControlFrame* MultiplexFrame::mutable_control_frame() { + ::location::nearby::mediums::MultiplexControlFrame* _msg = _internal_mutable_control_frame(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexFrame.control_frame) + return _msg; +} + +// .location.nearby.mediums.MultiplexDataFrame data_frame = 4; +inline bool MultiplexFrame::_internal_has_data_frame() const { + return Frame_case() == kDataFrame; +} +inline bool MultiplexFrame::has_data_frame() const { + return _internal_has_data_frame(); +} +inline void MultiplexFrame::set_has_data_frame() { + _oneof_case_[0] = kDataFrame; +} +inline void MultiplexFrame::clear_data_frame() { + if (_internal_has_data_frame()) { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.data_frame_; + } + clear_has_Frame(); + } +} +inline ::location::nearby::mediums::MultiplexDataFrame* MultiplexFrame::release_data_frame() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexFrame.data_frame) + if (_internal_has_data_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::MultiplexDataFrame* temp = Frame_.data_frame_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + Frame_.data_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::location::nearby::mediums::MultiplexDataFrame& MultiplexFrame::_internal_data_frame() const { + return _internal_has_data_frame() + ? *Frame_.data_frame_ + : reinterpret_cast< ::location::nearby::mediums::MultiplexDataFrame&>(::location::nearby::mediums::_MultiplexDataFrame_default_instance_); +} +inline const ::location::nearby::mediums::MultiplexDataFrame& MultiplexFrame::data_frame() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexFrame.data_frame) + return _internal_data_frame(); +} +inline ::location::nearby::mediums::MultiplexDataFrame* MultiplexFrame::unsafe_arena_release_data_frame() { + // @@protoc_insertion_point(field_unsafe_arena_release:location.nearby.mediums.MultiplexFrame.data_frame) + if (_internal_has_data_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::MultiplexDataFrame* temp = Frame_.data_frame_; + Frame_.data_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void MultiplexFrame::unsafe_arena_set_allocated_data_frame(::location::nearby::mediums::MultiplexDataFrame* data_frame) { + clear_Frame(); + if (data_frame) { + set_has_data_frame(); + Frame_.data_frame_ = data_frame; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.mediums.MultiplexFrame.data_frame) +} +inline ::location::nearby::mediums::MultiplexDataFrame* MultiplexFrame::_internal_mutable_data_frame() { + if (!_internal_has_data_frame()) { + clear_Frame(); + set_has_data_frame(); + Frame_.data_frame_ = CreateMaybeMessage< ::location::nearby::mediums::MultiplexDataFrame >(GetArenaForAllocation()); + } + return Frame_.data_frame_; +} +inline ::location::nearby::mediums::MultiplexDataFrame* MultiplexFrame::mutable_data_frame() { + ::location::nearby::mediums::MultiplexDataFrame* _msg = _internal_mutable_data_frame(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexFrame.data_frame) + return _msg; +} + +inline bool MultiplexFrame::has_Frame() const { + return Frame_case() != FRAME_NOT_SET; +} +inline void MultiplexFrame::clear_has_Frame() { + _oneof_case_[0] = FRAME_NOT_SET; +} +inline MultiplexFrame::FrameCase MultiplexFrame::Frame_case() const { + return MultiplexFrame::FrameCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// MultiplexFrameHeader + +// optional bytes salted_service_id_hash = 1; +inline bool MultiplexFrameHeader::_internal_has_salted_service_id_hash() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool MultiplexFrameHeader::has_salted_service_id_hash() const { + return _internal_has_salted_service_id_hash(); +} +inline void MultiplexFrameHeader::clear_salted_service_id_hash() { + salted_service_id_hash_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& MultiplexFrameHeader::salted_service_id_hash() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexFrameHeader.salted_service_id_hash) + return _internal_salted_service_id_hash(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void MultiplexFrameHeader::set_salted_service_id_hash(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + salted_service_id_hash_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:location.nearby.mediums.MultiplexFrameHeader.salted_service_id_hash) +} +inline std::string* MultiplexFrameHeader::mutable_salted_service_id_hash() { + std::string* _s = _internal_mutable_salted_service_id_hash(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexFrameHeader.salted_service_id_hash) + return _s; +} +inline const std::string& MultiplexFrameHeader::_internal_salted_service_id_hash() const { + return salted_service_id_hash_.Get(); +} +inline void MultiplexFrameHeader::_internal_set_salted_service_id_hash(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + salted_service_id_hash_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* MultiplexFrameHeader::_internal_mutable_salted_service_id_hash() { + _has_bits_[0] |= 0x00000001u; + return salted_service_id_hash_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* MultiplexFrameHeader::release_salted_service_id_hash() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexFrameHeader.salted_service_id_hash) + if (!_internal_has_salted_service_id_hash()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = salted_service_id_hash_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (salted_service_id_hash_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + salted_service_id_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void MultiplexFrameHeader::set_allocated_salted_service_id_hash(std::string* salted_service_id_hash) { + if (salted_service_id_hash != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + salted_service_id_hash_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), salted_service_id_hash, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (salted_service_id_hash_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + salted_service_id_hash_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexFrameHeader.salted_service_id_hash) +} + +// optional string service_id_hash_salt = 2; +inline bool MultiplexFrameHeader::_internal_has_service_id_hash_salt() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool MultiplexFrameHeader::has_service_id_hash_salt() const { + return _internal_has_service_id_hash_salt(); +} +inline void MultiplexFrameHeader::clear_service_id_hash_salt() { + service_id_hash_salt_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& MultiplexFrameHeader::service_id_hash_salt() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexFrameHeader.service_id_hash_salt) + return _internal_service_id_hash_salt(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void MultiplexFrameHeader::set_service_id_hash_salt(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000002u; + service_id_hash_salt_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:location.nearby.mediums.MultiplexFrameHeader.service_id_hash_salt) +} +inline std::string* MultiplexFrameHeader::mutable_service_id_hash_salt() { + std::string* _s = _internal_mutable_service_id_hash_salt(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexFrameHeader.service_id_hash_salt) + return _s; +} +inline const std::string& MultiplexFrameHeader::_internal_service_id_hash_salt() const { + return service_id_hash_salt_.Get(); +} +inline void MultiplexFrameHeader::_internal_set_service_id_hash_salt(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + service_id_hash_salt_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* MultiplexFrameHeader::_internal_mutable_service_id_hash_salt() { + _has_bits_[0] |= 0x00000002u; + return service_id_hash_salt_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* MultiplexFrameHeader::release_service_id_hash_salt() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexFrameHeader.service_id_hash_salt) + if (!_internal_has_service_id_hash_salt()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + auto* p = service_id_hash_salt_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (service_id_hash_salt_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + service_id_hash_salt_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void MultiplexFrameHeader::set_allocated_service_id_hash_salt(std::string* service_id_hash_salt) { + if (service_id_hash_salt != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + service_id_hash_salt_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), service_id_hash_salt, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (service_id_hash_salt_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + service_id_hash_salt_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexFrameHeader.service_id_hash_salt) +} + +// ------------------------------------------------------------------- + +// MultiplexControlFrame + +// optional .location.nearby.mediums.MultiplexControlFrame.MultiplexControlFrameType control_frame_type = 1; +inline bool MultiplexControlFrame::_internal_has_control_frame_type() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool MultiplexControlFrame::has_control_frame_type() const { + return _internal_has_control_frame_type(); +} +inline void MultiplexControlFrame::clear_control_frame_type() { + control_frame_type_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::_internal_control_frame_type() const { + return static_cast< ::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType >(control_frame_type_); +} +inline ::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType MultiplexControlFrame::control_frame_type() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexControlFrame.control_frame_type) + return _internal_control_frame_type(); +} +inline void MultiplexControlFrame::_internal_set_control_frame_type(::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType value) { + assert(::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + control_frame_type_ = value; +} +inline void MultiplexControlFrame::set_control_frame_type(::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType value) { + _internal_set_control_frame_type(value); + // @@protoc_insertion_point(field_set:location.nearby.mediums.MultiplexControlFrame.control_frame_type) +} + +// .location.nearby.mediums.ConnectionRequestFrame connection_request_frame = 2; +inline bool MultiplexControlFrame::_internal_has_connection_request_frame() const { + return Frame_case() == kConnectionRequestFrame; +} +inline bool MultiplexControlFrame::has_connection_request_frame() const { + return _internal_has_connection_request_frame(); +} +inline void MultiplexControlFrame::set_has_connection_request_frame() { + _oneof_case_[0] = kConnectionRequestFrame; +} +inline void MultiplexControlFrame::clear_connection_request_frame() { + if (_internal_has_connection_request_frame()) { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.connection_request_frame_; + } + clear_has_Frame(); + } +} +inline ::location::nearby::mediums::ConnectionRequestFrame* MultiplexControlFrame::release_connection_request_frame() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexControlFrame.connection_request_frame) + if (_internal_has_connection_request_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::ConnectionRequestFrame* temp = Frame_.connection_request_frame_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + Frame_.connection_request_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::location::nearby::mediums::ConnectionRequestFrame& MultiplexControlFrame::_internal_connection_request_frame() const { + return _internal_has_connection_request_frame() + ? *Frame_.connection_request_frame_ + : reinterpret_cast< ::location::nearby::mediums::ConnectionRequestFrame&>(::location::nearby::mediums::_ConnectionRequestFrame_default_instance_); +} +inline const ::location::nearby::mediums::ConnectionRequestFrame& MultiplexControlFrame::connection_request_frame() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexControlFrame.connection_request_frame) + return _internal_connection_request_frame(); +} +inline ::location::nearby::mediums::ConnectionRequestFrame* MultiplexControlFrame::unsafe_arena_release_connection_request_frame() { + // @@protoc_insertion_point(field_unsafe_arena_release:location.nearby.mediums.MultiplexControlFrame.connection_request_frame) + if (_internal_has_connection_request_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::ConnectionRequestFrame* temp = Frame_.connection_request_frame_; + Frame_.connection_request_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void MultiplexControlFrame::unsafe_arena_set_allocated_connection_request_frame(::location::nearby::mediums::ConnectionRequestFrame* connection_request_frame) { + clear_Frame(); + if (connection_request_frame) { + set_has_connection_request_frame(); + Frame_.connection_request_frame_ = connection_request_frame; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.mediums.MultiplexControlFrame.connection_request_frame) +} +inline ::location::nearby::mediums::ConnectionRequestFrame* MultiplexControlFrame::_internal_mutable_connection_request_frame() { + if (!_internal_has_connection_request_frame()) { + clear_Frame(); + set_has_connection_request_frame(); + Frame_.connection_request_frame_ = CreateMaybeMessage< ::location::nearby::mediums::ConnectionRequestFrame >(GetArenaForAllocation()); + } + return Frame_.connection_request_frame_; +} +inline ::location::nearby::mediums::ConnectionRequestFrame* MultiplexControlFrame::mutable_connection_request_frame() { + ::location::nearby::mediums::ConnectionRequestFrame* _msg = _internal_mutable_connection_request_frame(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexControlFrame.connection_request_frame) + return _msg; +} + +// .location.nearby.mediums.ConnectionResponseFrame connection_response_frame = 3; +inline bool MultiplexControlFrame::_internal_has_connection_response_frame() const { + return Frame_case() == kConnectionResponseFrame; +} +inline bool MultiplexControlFrame::has_connection_response_frame() const { + return _internal_has_connection_response_frame(); +} +inline void MultiplexControlFrame::set_has_connection_response_frame() { + _oneof_case_[0] = kConnectionResponseFrame; +} +inline void MultiplexControlFrame::clear_connection_response_frame() { + if (_internal_has_connection_response_frame()) { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.connection_response_frame_; + } + clear_has_Frame(); + } +} +inline ::location::nearby::mediums::ConnectionResponseFrame* MultiplexControlFrame::release_connection_response_frame() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexControlFrame.connection_response_frame) + if (_internal_has_connection_response_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::ConnectionResponseFrame* temp = Frame_.connection_response_frame_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + Frame_.connection_response_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::location::nearby::mediums::ConnectionResponseFrame& MultiplexControlFrame::_internal_connection_response_frame() const { + return _internal_has_connection_response_frame() + ? *Frame_.connection_response_frame_ + : reinterpret_cast< ::location::nearby::mediums::ConnectionResponseFrame&>(::location::nearby::mediums::_ConnectionResponseFrame_default_instance_); +} +inline const ::location::nearby::mediums::ConnectionResponseFrame& MultiplexControlFrame::connection_response_frame() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexControlFrame.connection_response_frame) + return _internal_connection_response_frame(); +} +inline ::location::nearby::mediums::ConnectionResponseFrame* MultiplexControlFrame::unsafe_arena_release_connection_response_frame() { + // @@protoc_insertion_point(field_unsafe_arena_release:location.nearby.mediums.MultiplexControlFrame.connection_response_frame) + if (_internal_has_connection_response_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::ConnectionResponseFrame* temp = Frame_.connection_response_frame_; + Frame_.connection_response_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void MultiplexControlFrame::unsafe_arena_set_allocated_connection_response_frame(::location::nearby::mediums::ConnectionResponseFrame* connection_response_frame) { + clear_Frame(); + if (connection_response_frame) { + set_has_connection_response_frame(); + Frame_.connection_response_frame_ = connection_response_frame; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.mediums.MultiplexControlFrame.connection_response_frame) +} +inline ::location::nearby::mediums::ConnectionResponseFrame* MultiplexControlFrame::_internal_mutable_connection_response_frame() { + if (!_internal_has_connection_response_frame()) { + clear_Frame(); + set_has_connection_response_frame(); + Frame_.connection_response_frame_ = CreateMaybeMessage< ::location::nearby::mediums::ConnectionResponseFrame >(GetArenaForAllocation()); + } + return Frame_.connection_response_frame_; +} +inline ::location::nearby::mediums::ConnectionResponseFrame* MultiplexControlFrame::mutable_connection_response_frame() { + ::location::nearby::mediums::ConnectionResponseFrame* _msg = _internal_mutable_connection_response_frame(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexControlFrame.connection_response_frame) + return _msg; +} + +// .location.nearby.mediums.DisconnectFrame disconnect_frame = 4; +inline bool MultiplexControlFrame::_internal_has_disconnect_frame() const { + return Frame_case() == kDisconnectFrame; +} +inline bool MultiplexControlFrame::has_disconnect_frame() const { + return _internal_has_disconnect_frame(); +} +inline void MultiplexControlFrame::set_has_disconnect_frame() { + _oneof_case_[0] = kDisconnectFrame; +} +inline void MultiplexControlFrame::clear_disconnect_frame() { + if (_internal_has_disconnect_frame()) { + if (GetArenaForAllocation() == nullptr) { + delete Frame_.disconnect_frame_; + } + clear_has_Frame(); + } +} +inline ::location::nearby::mediums::DisconnectFrame* MultiplexControlFrame::release_disconnect_frame() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexControlFrame.disconnect_frame) + if (_internal_has_disconnect_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::DisconnectFrame* temp = Frame_.disconnect_frame_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + Frame_.disconnect_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::location::nearby::mediums::DisconnectFrame& MultiplexControlFrame::_internal_disconnect_frame() const { + return _internal_has_disconnect_frame() + ? *Frame_.disconnect_frame_ + : reinterpret_cast< ::location::nearby::mediums::DisconnectFrame&>(::location::nearby::mediums::_DisconnectFrame_default_instance_); +} +inline const ::location::nearby::mediums::DisconnectFrame& MultiplexControlFrame::disconnect_frame() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexControlFrame.disconnect_frame) + return _internal_disconnect_frame(); +} +inline ::location::nearby::mediums::DisconnectFrame* MultiplexControlFrame::unsafe_arena_release_disconnect_frame() { + // @@protoc_insertion_point(field_unsafe_arena_release:location.nearby.mediums.MultiplexControlFrame.disconnect_frame) + if (_internal_has_disconnect_frame()) { + clear_has_Frame(); + ::location::nearby::mediums::DisconnectFrame* temp = Frame_.disconnect_frame_; + Frame_.disconnect_frame_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void MultiplexControlFrame::unsafe_arena_set_allocated_disconnect_frame(::location::nearby::mediums::DisconnectFrame* disconnect_frame) { + clear_Frame(); + if (disconnect_frame) { + set_has_disconnect_frame(); + Frame_.disconnect_frame_ = disconnect_frame; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:location.nearby.mediums.MultiplexControlFrame.disconnect_frame) +} +inline ::location::nearby::mediums::DisconnectFrame* MultiplexControlFrame::_internal_mutable_disconnect_frame() { + if (!_internal_has_disconnect_frame()) { + clear_Frame(); + set_has_disconnect_frame(); + Frame_.disconnect_frame_ = CreateMaybeMessage< ::location::nearby::mediums::DisconnectFrame >(GetArenaForAllocation()); + } + return Frame_.disconnect_frame_; +} +inline ::location::nearby::mediums::DisconnectFrame* MultiplexControlFrame::mutable_disconnect_frame() { + ::location::nearby::mediums::DisconnectFrame* _msg = _internal_mutable_disconnect_frame(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexControlFrame.disconnect_frame) + return _msg; +} + +inline bool MultiplexControlFrame::has_Frame() const { + return Frame_case() != FRAME_NOT_SET; +} +inline void MultiplexControlFrame::clear_has_Frame() { + _oneof_case_[0] = FRAME_NOT_SET; +} +inline MultiplexControlFrame::FrameCase MultiplexControlFrame::Frame_case() const { + return MultiplexControlFrame::FrameCase(_oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// ConnectionRequestFrame + +// ------------------------------------------------------------------- + +// ConnectionResponseFrame + +// optional .location.nearby.mediums.ConnectionResponseFrame.ConnectionResponseCode connection_response_code = 1; +inline bool ConnectionResponseFrame::_internal_has_connection_response_code() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool ConnectionResponseFrame::has_connection_response_code() const { + return _internal_has_connection_response_code(); +} +inline void ConnectionResponseFrame::clear_connection_response_code() { + connection_response_code_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::_internal_connection_response_code() const { + return static_cast< ::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode >(connection_response_code_); +} +inline ::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode ConnectionResponseFrame::connection_response_code() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.ConnectionResponseFrame.connection_response_code) + return _internal_connection_response_code(); +} +inline void ConnectionResponseFrame::_internal_set_connection_response_code(::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode value) { + assert(::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + connection_response_code_ = value; +} +inline void ConnectionResponseFrame::set_connection_response_code(::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode value) { + _internal_set_connection_response_code(value); + // @@protoc_insertion_point(field_set:location.nearby.mediums.ConnectionResponseFrame.connection_response_code) +} + +// ------------------------------------------------------------------- + +// DisconnectFrame + +// ------------------------------------------------------------------- + +// MultiplexDataFrame + +// optional bytes data = 1; +inline bool MultiplexDataFrame::_internal_has_data() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool MultiplexDataFrame::has_data() const { + return _internal_has_data(); +} +inline void MultiplexDataFrame::clear_data() { + data_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& MultiplexDataFrame::data() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.MultiplexDataFrame.data) + return _internal_data(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void MultiplexDataFrame::set_data(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + data_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:location.nearby.mediums.MultiplexDataFrame.data) +} +inline std::string* MultiplexDataFrame::mutable_data() { + std::string* _s = _internal_mutable_data(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.MultiplexDataFrame.data) + return _s; +} +inline const std::string& MultiplexDataFrame::_internal_data() const { + return data_.Get(); +} +inline void MultiplexDataFrame::_internal_set_data(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* MultiplexDataFrame::_internal_mutable_data() { + _has_bits_[0] |= 0x00000001u; + return data_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* MultiplexDataFrame::release_data() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.MultiplexDataFrame.data) + if (!_internal_has_data()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = data_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (data_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void MultiplexDataFrame::set_allocated_data(std::string* data) { + if (data != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + data_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), data, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (data_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + data_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.MultiplexDataFrame.data) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace mediums +} // namespace nearby +} // namespace location + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::location::nearby::mediums::MultiplexFrame_MultiplexFrameType> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::mediums::MultiplexControlFrame_MultiplexControlFrameType> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::mediums::ConnectionResponseFrame_ConnectionResponseCode> : ::std::true_type {}; + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_proto_2fmediums_2fmultiplex_5fframes_2eproto diff --git a/compiled_proto/proto/mediums/nfc_frames.pb.cc b/compiled_proto/proto/mediums/nfc_frames.pb.cc index 4bf6bbbf..1f7a6795 100644 --- a/compiled_proto/proto/mediums/nfc_frames.pb.cc +++ b/compiled_proto/proto/mediums/nfc_frames.pb.cc @@ -19,7 +19,8 @@ namespace mediums { constexpr AdvertisementData::AdvertisementData( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : tag_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) - , public_key_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} + , public_key_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , rx_advertisement_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} struct AdvertisementDataDefaultTypeInternal { constexpr AdvertisementDataDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} @@ -61,6 +62,9 @@ class AdvertisementData::_Internal { static void set_has_public_key(HasBits* has_bits) { (*has_bits)[0] |= 2u; } + static void set_has_rx_advertisement(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } }; AdvertisementData::AdvertisementData(::PROTOBUF_NAMESPACE_ID::Arena* arena, @@ -92,6 +96,14 @@ AdvertisementData::AdvertisementData(const AdvertisementData& from) public_key_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_public_key(), GetArenaForAllocation()); } + rx_advertisement_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + rx_advertisement_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_rx_advertisement()) { + rx_advertisement_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_rx_advertisement(), + GetArenaForAllocation()); + } // @@protoc_insertion_point(copy_constructor:location.nearby.mediums.AdvertisementData) } @@ -104,6 +116,10 @@ public_key_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringA #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING public_key_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +rx_advertisement_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + rx_advertisement_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING } AdvertisementData::~AdvertisementData() { @@ -117,6 +133,7 @@ inline void AdvertisementData::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); tag_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); public_key_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + rx_advertisement_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } void AdvertisementData::ArenaDtor(void* object) { @@ -136,13 +153,16 @@ void AdvertisementData::Clear() { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { tag_.ClearNonDefaultToEmpty(); } if (cached_has_bits & 0x00000002u) { public_key_.ClearNonDefaultToEmpty(); } + if (cached_has_bits & 0x00000004u) { + rx_advertisement_.ClearNonDefaultToEmpty(); + } } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -173,6 +193,15 @@ const char* AdvertisementData::_InternalParse(const char* ptr, ::PROTOBUF_NAMESP } else goto handle_unusual; continue; + // optional bytes rx_advertisement = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_rx_advertisement(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -216,6 +245,12 @@ uint8_t* AdvertisementData::_InternalSerialize( 2, this->_internal_public_key(), target); } + // optional bytes rx_advertisement = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->WriteBytesMaybeAliased( + 3, this->_internal_rx_advertisement(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); @@ -233,7 +268,7 @@ size_t AdvertisementData::ByteSizeLong() const { (void) cached_has_bits; cached_has_bits = _has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000007u) { // optional bytes tag = 1; if (cached_has_bits & 0x00000001u) { total_size += 1 + @@ -248,6 +283,13 @@ size_t AdvertisementData::ByteSizeLong() const { this->_internal_public_key()); } + // optional bytes rx_advertisement = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize( + this->_internal_rx_advertisement()); + } + } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); @@ -270,13 +312,16 @@ void AdvertisementData::MergeFrom(const AdvertisementData& from) { (void) cached_has_bits; cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000007u) { if (cached_has_bits & 0x00000001u) { _internal_set_tag(from._internal_tag()); } if (cached_has_bits & 0x00000002u) { _internal_set_public_key(from._internal_public_key()); } + if (cached_has_bits & 0x00000004u) { + _internal_set_rx_advertisement(from._internal_rx_advertisement()); + } } _internal_metadata_.MergeFrom(from._internal_metadata_); } @@ -308,6 +353,11 @@ void AdvertisementData::InternalSwap(AdvertisementData* other) { &public_key_, lhs_arena, &other->public_key_, rhs_arena ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &rx_advertisement_, lhs_arena, + &other->rx_advertisement_, rhs_arena + ); } std::string AdvertisementData::GetTypeName() const { diff --git a/compiled_proto/proto/mediums/nfc_frames.pb.h b/compiled_proto/proto/mediums/nfc_frames.pb.h index 761291bd..94f60fbc 100644 --- a/compiled_proto/proto/mediums/nfc_frames.pb.h +++ b/compiled_proto/proto/mediums/nfc_frames.pb.h @@ -187,6 +187,7 @@ class AdvertisementData final : enum : int { kTagFieldNumber = 1, kPublicKeyFieldNumber = 2, + kRxAdvertisementFieldNumber = 3, }; // optional bytes tag = 1; bool has_tag() const; @@ -224,6 +225,24 @@ class AdvertisementData final : std::string* _internal_mutable_public_key(); public: + // optional bytes rx_advertisement = 3; + bool has_rx_advertisement() const; + private: + bool _internal_has_rx_advertisement() const; + public: + void clear_rx_advertisement(); + const std::string& rx_advertisement() const; + template + void set_rx_advertisement(ArgT0&& arg0, ArgT... args); + std::string* mutable_rx_advertisement(); + PROTOBUF_NODISCARD std::string* release_rx_advertisement(); + void set_allocated_rx_advertisement(std::string* rx_advertisement); + private: + const std::string& _internal_rx_advertisement() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_rx_advertisement(const std::string& value); + std::string* _internal_mutable_rx_advertisement(); + public: + // @@protoc_insertion_point(class_scope:location.nearby.mediums.AdvertisementData) private: class _Internal; @@ -235,6 +254,7 @@ class AdvertisementData final : mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr tag_; ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr public_key_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr rx_advertisement_; friend struct ::TableStruct_proto_2fmediums_2fnfc_5fframes_2eproto; }; // ------------------------------------------------------------------- @@ -573,6 +593,75 @@ inline void AdvertisementData::set_allocated_public_key(std::string* public_key) // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.AdvertisementData.public_key) } +// optional bytes rx_advertisement = 3; +inline bool AdvertisementData::_internal_has_rx_advertisement() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool AdvertisementData::has_rx_advertisement() const { + return _internal_has_rx_advertisement(); +} +inline void AdvertisementData::clear_rx_advertisement() { + rx_advertisement_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& AdvertisementData::rx_advertisement() const { + // @@protoc_insertion_point(field_get:location.nearby.mediums.AdvertisementData.rx_advertisement) + return _internal_rx_advertisement(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AdvertisementData::set_rx_advertisement(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000004u; + rx_advertisement_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:location.nearby.mediums.AdvertisementData.rx_advertisement) +} +inline std::string* AdvertisementData::mutable_rx_advertisement() { + std::string* _s = _internal_mutable_rx_advertisement(); + // @@protoc_insertion_point(field_mutable:location.nearby.mediums.AdvertisementData.rx_advertisement) + return _s; +} +inline const std::string& AdvertisementData::_internal_rx_advertisement() const { + return rx_advertisement_.Get(); +} +inline void AdvertisementData::_internal_set_rx_advertisement(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + rx_advertisement_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* AdvertisementData::_internal_mutable_rx_advertisement() { + _has_bits_[0] |= 0x00000004u; + return rx_advertisement_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* AdvertisementData::release_rx_advertisement() { + // @@protoc_insertion_point(field_release:location.nearby.mediums.AdvertisementData.rx_advertisement) + if (!_internal_has_rx_advertisement()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + auto* p = rx_advertisement_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (rx_advertisement_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + rx_advertisement_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void AdvertisementData::set_allocated_rx_advertisement(std::string* rx_advertisement) { + if (rx_advertisement != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + rx_advertisement_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), rx_advertisement, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (rx_advertisement_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + rx_advertisement_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:location.nearby.mediums.AdvertisementData.rx_advertisement) +} + // ------------------------------------------------------------------- // AdvertisementRequest diff --git a/compiled_proto/proto/sharing_enums.pb.cc b/compiled_proto/proto/sharing_enums.pb.cc index 9b200e94..ff52c476 100644 --- a/compiled_proto/proto/sharing_enums.pb.cc +++ b/compiled_proto/proto/sharing_enums.pb.cc @@ -91,13 +91,16 @@ bool EventType_IsValid(int value) { case 62: case 63: case 64: + case 65: + case 66: + case 67: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed EventType_strings[65] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed EventType_strings[68] = {}; static const char EventType_names[] = "ACCEPT_AGREEMENTS" @@ -148,6 +151,7 @@ static const char EventType_names[] = "SEND_ATTACHMENTS_END" "SEND_ATTACHMENTS_START" "SEND_DESKTOP_NOTIFICATION" + "SEND_DESKTOP_TRANSFER_EVENT" "SEND_FAST_INITIALIZATION" "SEND_INTRODUCTION" "SEND_START" @@ -156,6 +160,7 @@ static const char EventType_names[] = "SET_DATA_USAGE" "SET_DEVICE_NAME" "SET_VISIBILITY" + "SHOW_ALLOW_PERMISSION_AUTO_ACCESS" "TAP_FEEDBACK" "TAP_HELP" "TAP_PRIVACY_NOTIFICATION" @@ -164,7 +169,8 @@ static const char EventType_names[] = "TAP_QUICK_SETTINGS_TILE" "TOGGLE_SHOW_NOTIFICATION" "UNKNOWN_EVENT_TYPE" - "VERIFY_APK"; + "VERIFY_APK" + "WAITING_FOR_ACCEPT"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry EventType_entries[] = { { {EventType_names + 0, 17}, 1 }, @@ -215,39 +221,42 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry EventType_entries[] = { {EventType_names + 998, 20}, 16 }, { {EventType_names + 1018, 22}, 15 }, { {EventType_names + 1040, 25}, 62 }, - { {EventType_names + 1065, 24}, 9 }, - { {EventType_names + 1089, 17}, 12 }, - { {EventType_names + 1106, 10}, 26 }, - { {EventType_names + 1116, 12}, 57 }, - { {EventType_names + 1128, 11}, 63 }, - { {EventType_names + 1139, 14}, 28 }, - { {EventType_names + 1153, 15}, 45 }, - { {EventType_names + 1168, 14}, 3 }, - { {EventType_names + 1182, 12}, 35 }, - { {EventType_names + 1194, 8}, 34 }, - { {EventType_names + 1202, 24}, 33 }, - { {EventType_names + 1226, 11}, 58 }, - { {EventType_names + 1237, 29}, 52 }, - { {EventType_names + 1266, 23}, 39 }, - { {EventType_names + 1289, 24}, 44 }, - { {EventType_names + 1313, 18}, 0 }, - { {EventType_names + 1331, 10}, 41 }, + { {EventType_names + 1065, 27}, 66 }, + { {EventType_names + 1092, 24}, 9 }, + { {EventType_names + 1116, 17}, 12 }, + { {EventType_names + 1133, 10}, 26 }, + { {EventType_names + 1143, 12}, 57 }, + { {EventType_names + 1155, 11}, 63 }, + { {EventType_names + 1166, 14}, 28 }, + { {EventType_names + 1180, 15}, 45 }, + { {EventType_names + 1195, 14}, 3 }, + { {EventType_names + 1209, 33}, 65 }, + { {EventType_names + 1242, 12}, 35 }, + { {EventType_names + 1254, 8}, 34 }, + { {EventType_names + 1262, 24}, 33 }, + { {EventType_names + 1286, 11}, 58 }, + { {EventType_names + 1297, 29}, 52 }, + { {EventType_names + 1326, 23}, 39 }, + { {EventType_names + 1349, 24}, 44 }, + { {EventType_names + 1373, 18}, 0 }, + { {EventType_names + 1391, 10}, 41 }, + { {EventType_names + 1401, 18}, 67 }, }; static const int EventType_entries_by_number[] = { - 63, // 0 -> UNKNOWN_EVENT_TYPE + 65, // 0 -> UNKNOWN_EVENT_TYPE 0, // 1 -> ACCEPT_AGREEMENTS 21, // 2 -> ENABLE_NEARBY_SHARING - 55, // 3 -> SET_VISIBILITY + 56, // 3 -> SET_VISIBILITY 14, // 4 -> DESCRIBE_ATTACHMENTS 44, // 5 -> SCAN_FOR_SHARE_TARGETS_START 43, // 6 -> SCAN_FOR_SHARE_TARGETS_END 5, // 7 -> ADVERTISE_DEVICE_PRESENCE_START 4, // 8 -> ADVERTISE_DEVICE_PRESENCE_END - 48, // 9 -> SEND_FAST_INITIALIZATION + 49, // 9 -> SEND_FAST_INITIALIZATION 37, // 10 -> RECEIVE_FAST_INITIALIZATION 16, // 11 -> DISCOVER_SHARE_TARGET - 49, // 12 -> SEND_INTRODUCTION + 50, // 12 -> SEND_INTRODUCTION 38, // 13 -> RECEIVE_INTRODUCTION 42, // 14 -> RESPOND_TO_INTRODUCTION 46, // 15 -> SEND_ATTACHMENTS_START @@ -261,45 +270,48 @@ static const int EventType_entries_by_number[] = { 2, // 23 -> ADD_CONTACT 39, // 24 -> REMOVE_CONTACT 24, // 25 -> FAST_SHARE_SERVER_RESPONSE - 50, // 26 -> SEND_START + 51, // 26 -> SEND_START 1, // 27 -> ACCEPT_FAST_INITIALIZATION - 53, // 28 -> SET_DATA_USAGE + 54, // 28 -> SET_DATA_USAGE 17, // 29 -> DISMISS_FAST_INITIALIZATION 8, // 30 -> CANCEL_CONNECTION 26, // 31 -> LAUNCH_ACTIVITY 18, // 32 -> DISMISS_PRIVACY_NOTIFICATION - 58, // 33 -> TAP_PRIVACY_NOTIFICATION - 57, // 34 -> TAP_HELP - 56, // 35 -> TAP_FEEDBACK + 60, // 33 -> TAP_PRIVACY_NOTIFICATION + 59, // 34 -> TAP_HELP + 58, // 35 -> TAP_FEEDBACK 3, // 36 -> ADD_QUICK_SETTINGS_TILE 40, // 37 -> REMOVE_QUICK_SETTINGS_TILE 28, // 38 -> LAUNCH_PHONE_CONSENT - 61, // 39 -> TAP_QUICK_SETTINGS_TILE + 63, // 39 -> TAP_QUICK_SETTINGS_TILE 25, // 40 -> INSTALL_APK - 64, // 41 -> VERIFY_APK + 66, // 41 -> VERIFY_APK 27, // 42 -> LAUNCH_CONSENT 33, // 43 -> PROCESS_RECEIVED_ATTACHMENTS_END - 62, // 44 -> TOGGLE_SHOW_NOTIFICATION - 54, // 45 -> SET_DEVICE_NAME + 64, // 44 -> TOGGLE_SHOW_NOTIFICATION + 55, // 45 -> SET_DEVICE_NAME 11, // 46 -> DECLINE_AGREEMENTS 41, // 47 -> REQUEST_SETTING_PERMISSIONS 22, // 48 -> ESTABLISH_CONNECTION 15, // 49 -> DEVICE_SETTINGS 7, // 50 -> AUTO_DISMISS_FAST_INITIALIZATION 6, // 51 -> APP_CRASH - 60, // 52 -> TAP_QUICK_SETTINGS_FILE_SHARE + 62, // 52 -> TAP_QUICK_SETTINGS_FILE_SHARE 20, // 53 -> DISPLAY_PRIVACY_NOTIFICATION 19, // 54 -> DISPLAY_PHONE_CONSENT 32, // 55 -> PREFERENCES_USAGE 13, // 56 -> DEFAULT_OPT_IN - 51, // 57 -> SETUP_WIZARD - 59, // 58 -> TAP_QR_CODE + 52, // 57 -> SETUP_WIZARD + 61, // 58 -> TAP_QR_CODE 34, // 59 -> QR_CODE_LINK_SHOWN 31, // 60 -> PARSING_FAILED_ENDPOINT_ID 23, // 61 -> FAST_INIT_DISCOVER_DEVICE 47, // 62 -> SEND_DESKTOP_NOTIFICATION - 52, // 63 -> SET_ACCOUNT + 53, // 63 -> SET_ACCOUNT 12, // 64 -> DECRYPT_CERTIFICATE_FAILURE + 57, // 65 -> SHOW_ALLOW_PERMISSION_AUTO_ACCESS + 48, // 66 -> SEND_DESKTOP_TRANSFER_EVENT + 67, // 67 -> WAITING_FOR_ACCEPT }; const std::string& EventType_Name( @@ -308,12 +320,12 @@ const std::string& EventType_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( EventType_entries, EventType_entries_by_number, - 65, EventType_strings); + 68, EventType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( EventType_entries, EventType_entries_by_number, - 65, value); + 68, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : EventType_strings[idx].get(); } @@ -321,7 +333,7 @@ bool EventType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, EventType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - EventType_entries, 65, name, &int_value); + EventType_entries, 68, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -573,32 +585,60 @@ bool EstablishConnectionStatus_IsValid(int value) { case 1: case 2: case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed EstablishConnectionStatus_strings[4] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed EstablishConnectionStatus_strings[11] = {}; static const char EstablishConnectionStatus_names[] = "CONNECTION_STATUS_CANCELLATION" + "CONNECTION_STATUS_FAILED_NO_TRANSFER_UPDATE_CALLBACK" + "CONNECTION_STATUS_FAILED_NULL_CONNECTION" + "CONNECTION_STATUS_FAILED_PAIRED_KEYHANDSHAKE" + "CONNECTION_STATUS_FAILED_WRITE_INTRODUCTION" "CONNECTION_STATUS_FAILURE" + "CONNECTION_STATUS_INVALID_ADVERTISEMENT" + "CONNECTION_STATUS_LOST_CONNECTIVITY" + "CONNECTION_STATUS_MEDIA_UNAVAILABLE_ATTACHMENT" "CONNECTION_STATUS_SUCCESS" "CONNECTION_STATUS_UNKNOWN"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry EstablishConnectionStatus_entries[] = { { {EstablishConnectionStatus_names + 0, 30}, 3 }, - { {EstablishConnectionStatus_names + 30, 25}, 2 }, - { {EstablishConnectionStatus_names + 55, 25}, 1 }, - { {EstablishConnectionStatus_names + 80, 25}, 0 }, + { {EstablishConnectionStatus_names + 30, 52}, 8 }, + { {EstablishConnectionStatus_names + 82, 40}, 7 }, + { {EstablishConnectionStatus_names + 122, 44}, 5 }, + { {EstablishConnectionStatus_names + 166, 43}, 6 }, + { {EstablishConnectionStatus_names + 209, 25}, 2 }, + { {EstablishConnectionStatus_names + 234, 39}, 10 }, + { {EstablishConnectionStatus_names + 273, 35}, 9 }, + { {EstablishConnectionStatus_names + 308, 46}, 4 }, + { {EstablishConnectionStatus_names + 354, 25}, 1 }, + { {EstablishConnectionStatus_names + 379, 25}, 0 }, }; static const int EstablishConnectionStatus_entries_by_number[] = { - 3, // 0 -> CONNECTION_STATUS_UNKNOWN - 2, // 1 -> CONNECTION_STATUS_SUCCESS - 1, // 2 -> CONNECTION_STATUS_FAILURE + 10, // 0 -> CONNECTION_STATUS_UNKNOWN + 9, // 1 -> CONNECTION_STATUS_SUCCESS + 5, // 2 -> CONNECTION_STATUS_FAILURE 0, // 3 -> CONNECTION_STATUS_CANCELLATION + 8, // 4 -> CONNECTION_STATUS_MEDIA_UNAVAILABLE_ATTACHMENT + 3, // 5 -> CONNECTION_STATUS_FAILED_PAIRED_KEYHANDSHAKE + 4, // 6 -> CONNECTION_STATUS_FAILED_WRITE_INTRODUCTION + 2, // 7 -> CONNECTION_STATUS_FAILED_NULL_CONNECTION + 1, // 8 -> CONNECTION_STATUS_FAILED_NO_TRANSFER_UPDATE_CALLBACK + 7, // 9 -> CONNECTION_STATUS_LOST_CONNECTIVITY + 6, // 10 -> CONNECTION_STATUS_INVALID_ADVERTISEMENT }; const std::string& EstablishConnectionStatus_Name( @@ -607,12 +647,12 @@ const std::string& EstablishConnectionStatus_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( EstablishConnectionStatus_entries, EstablishConnectionStatus_entries_by_number, - 4, EstablishConnectionStatus_strings); + 11, EstablishConnectionStatus_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( EstablishConnectionStatus_entries, EstablishConnectionStatus_entries_by_number, - 4, value); + 11, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : EstablishConnectionStatus_strings[idx].get(); } @@ -620,7 +660,7 @@ bool EstablishConnectionStatus_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, EstablishConnectionStatus* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - EstablishConnectionStatus_entries, 4, name, &int_value); + EstablishConnectionStatus_entries, 11, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -650,13 +690,21 @@ bool AttachmentTransmissionStatus_IsValid(int value) { case 19: case 20: case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed AttachmentTransmissionStatus_strings[22] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed AttachmentTransmissionStatus_strings[30] = {}; static const char AttachmentTransmissionStatus_names[] = "AWAITING_REMOTE_ACCEPTANCE_FAILED_ATTACHMENT" @@ -673,14 +721,22 @@ static const char AttachmentTransmissionStatus_names[] = "FAILED_NULL_CONNECTION_LOST_CONNECTIVITY" "FAILED_PAIRED_KEYHANDSHAKE" "FAILED_UNKNOWN_REMOTE_RESPONSE" + "FAILED_UNKNOWN_REMOTE_RESPONSE_TRANSMISSION_STATUS" "FAILED_WRITE_INTRODUCTION" + "LOST_CONNECTIVITY_TRANSMISSION_STATUS" "MEDIA_UNAVAILABLE_ATTACHMENT" "NOT_ENOUGH_SPACE_ATTACHMENT" + "NOT_ENOUGH_SPACE_ATTACHMENT_TRANSMISSION_STATUS" "NO_ATTACHMENT_FOUND" + "NO_RESPONSE_FRAME_CONNECTION_CLOSED_LOST_CONNECTIVITY_TRANSMISSION_STATUS" + "NO_RESPONSE_FRAME_CONNECTION_CLOSED_TRANSMISSION_STATUS" "REJECTED_ATTACHMENT" + "REJECTED_ATTACHMENT_TRANSMISSION_STATUS" "TIMED_OUT_ATTACHMENT" + "TIMED_OUT_ATTACHMENT_TRANSMISSION_STATUS" "UNKNOWN_ATTACHMENT_TRANSMISSION_STATUS" - "UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT"; + "UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT" + "UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT_TRANSMISSION_STATUS"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry AttachmentTransmissionStatus_entries[] = { { {AttachmentTransmissionStatus_names + 0, 44}, 6 }, @@ -697,39 +753,55 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry AttachmentTransmission { {AttachmentTransmissionStatus_names + 364, 40}, 20 }, { {AttachmentTransmissionStatus_names + 404, 26}, 13 }, { {AttachmentTransmissionStatus_names + 430, 30}, 17 }, - { {AttachmentTransmissionStatus_names + 460, 25}, 16 }, - { {AttachmentTransmissionStatus_names + 485, 28}, 9 }, - { {AttachmentTransmissionStatus_names + 513, 27}, 7 }, - { {AttachmentTransmissionStatus_names + 540, 19}, 11 }, - { {AttachmentTransmissionStatus_names + 559, 19}, 4 }, - { {AttachmentTransmissionStatus_names + 578, 20}, 5 }, - { {AttachmentTransmissionStatus_names + 598, 38}, 0 }, - { {AttachmentTransmissionStatus_names + 636, 38}, 10 }, + { {AttachmentTransmissionStatus_names + 460, 50}, 26 }, + { {AttachmentTransmissionStatus_names + 510, 25}, 16 }, + { {AttachmentTransmissionStatus_names + 535, 37}, 29 }, + { {AttachmentTransmissionStatus_names + 572, 28}, 9 }, + { {AttachmentTransmissionStatus_names + 600, 27}, 7 }, + { {AttachmentTransmissionStatus_names + 627, 47}, 24 }, + { {AttachmentTransmissionStatus_names + 674, 19}, 11 }, + { {AttachmentTransmissionStatus_names + 693, 73}, 27 }, + { {AttachmentTransmissionStatus_names + 766, 55}, 28 }, + { {AttachmentTransmissionStatus_names + 821, 19}, 4 }, + { {AttachmentTransmissionStatus_names + 840, 39}, 22 }, + { {AttachmentTransmissionStatus_names + 879, 20}, 5 }, + { {AttachmentTransmissionStatus_names + 899, 40}, 23 }, + { {AttachmentTransmissionStatus_names + 939, 38}, 0 }, + { {AttachmentTransmissionStatus_names + 977, 38}, 10 }, + { {AttachmentTransmissionStatus_names + 1015, 58}, 25 }, }; static const int AttachmentTransmissionStatus_entries_by_number[] = { - 20, // 0 -> UNKNOWN_ATTACHMENT_TRANSMISSION_STATUS + 27, // 0 -> UNKNOWN_ATTACHMENT_TRANSMISSION_STATUS 2, // 1 -> COMPLETE_ATTACHMENT_TRANSMISSION_STATUS 1, // 2 -> CANCELED_ATTACHMENT_TRANSMISSION_STATUS 3, // 3 -> FAILED_ATTACHMENT_TRANSMISSION_STATUS - 18, // 4 -> REJECTED_ATTACHMENT - 19, // 5 -> TIMED_OUT_ATTACHMENT + 23, // 4 -> REJECTED_ATTACHMENT + 25, // 5 -> TIMED_OUT_ATTACHMENT 0, // 6 -> AWAITING_REMOTE_ACCEPTANCE_FAILED_ATTACHMENT - 16, // 7 -> NOT_ENOUGH_SPACE_ATTACHMENT + 18, // 7 -> NOT_ENOUGH_SPACE_ATTACHMENT 6, // 8 -> FAILED_NO_TRANSFER_UPDATE_CALLBACK - 15, // 9 -> MEDIA_UNAVAILABLE_ATTACHMENT - 21, // 10 -> UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT - 17, // 11 -> NO_ATTACHMENT_FOUND + 17, // 9 -> MEDIA_UNAVAILABLE_ATTACHMENT + 28, // 10 -> UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT + 20, // 11 -> NO_ATTACHMENT_FOUND 5, // 12 -> FAILED_NO_SHARE_TARGET_ENDPOINT 12, // 13 -> FAILED_PAIRED_KEYHANDSHAKE 7, // 14 -> FAILED_NULL_CONNECTION 4, // 15 -> FAILED_NO_PAYLOAD - 14, // 16 -> FAILED_WRITE_INTRODUCTION + 15, // 16 -> FAILED_WRITE_INTRODUCTION 13, // 17 -> FAILED_UNKNOWN_REMOTE_RESPONSE 10, // 18 -> FAILED_NULL_CONNECTION_INIT_OUTGOING 8, // 19 -> FAILED_NULL_CONNECTION_DISCONNECTED 11, // 20 -> FAILED_NULL_CONNECTION_LOST_CONNECTIVITY 9, // 21 -> FAILED_NULL_CONNECTION_FAILURE + 24, // 22 -> REJECTED_ATTACHMENT_TRANSMISSION_STATUS + 26, // 23 -> TIMED_OUT_ATTACHMENT_TRANSMISSION_STATUS + 19, // 24 -> NOT_ENOUGH_SPACE_ATTACHMENT_TRANSMISSION_STATUS + 29, // 25 -> UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT_TRANSMISSION_STATUS + 14, // 26 -> FAILED_UNKNOWN_REMOTE_RESPONSE_TRANSMISSION_STATUS + 21, // 27 -> NO_RESPONSE_FRAME_CONNECTION_CLOSED_LOST_CONNECTIVITY_TRANSMISSION_STATUS + 22, // 28 -> NO_RESPONSE_FRAME_CONNECTION_CLOSED_TRANSMISSION_STATUS + 16, // 29 -> LOST_CONNECTIVITY_TRANSMISSION_STATUS }; const std::string& AttachmentTransmissionStatus_Name( @@ -738,12 +810,12 @@ const std::string& AttachmentTransmissionStatus_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( AttachmentTransmissionStatus_entries, AttachmentTransmissionStatus_entries_by_number, - 22, AttachmentTransmissionStatus_strings); + 30, AttachmentTransmissionStatus_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( AttachmentTransmissionStatus_entries, AttachmentTransmissionStatus_entries_by_number, - 22, value); + 30, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : AttachmentTransmissionStatus_strings[idx].get(); } @@ -751,7 +823,7 @@ bool AttachmentTransmissionStatus_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AttachmentTransmissionStatus* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - AttachmentTransmissionStatus_entries, 22, name, &int_value); + AttachmentTransmissionStatus_entries, 30, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1063,32 +1135,36 @@ bool DeviceType_IsValid(int value) { case 1: case 2: case 3: + case 4: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed DeviceType_strings[4] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed DeviceType_strings[5] = {}; static const char DeviceType_names[] = + "CAR" "LAPTOP" "PHONE" "TABLET" "UNKNOWN_DEVICE_TYPE"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry DeviceType_entries[] = { - { {DeviceType_names + 0, 6}, 3 }, - { {DeviceType_names + 6, 5}, 1 }, - { {DeviceType_names + 11, 6}, 2 }, - { {DeviceType_names + 17, 19}, 0 }, + { {DeviceType_names + 0, 3}, 4 }, + { {DeviceType_names + 3, 6}, 3 }, + { {DeviceType_names + 9, 5}, 1 }, + { {DeviceType_names + 14, 6}, 2 }, + { {DeviceType_names + 20, 19}, 0 }, }; static const int DeviceType_entries_by_number[] = { - 3, // 0 -> UNKNOWN_DEVICE_TYPE - 1, // 1 -> PHONE - 2, // 2 -> TABLET - 0, // 3 -> LAPTOP + 4, // 0 -> UNKNOWN_DEVICE_TYPE + 2, // 1 -> PHONE + 3, // 2 -> TABLET + 1, // 3 -> LAPTOP + 0, // 4 -> CAR }; const std::string& DeviceType_Name( @@ -1097,12 +1173,12 @@ const std::string& DeviceType_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( DeviceType_entries, DeviceType_entries_by_number, - 4, DeviceType_strings); + 5, DeviceType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( DeviceType_entries, DeviceType_entries_by_number, - 4, value); + 5, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : DeviceType_strings[idx].get(); } @@ -1110,7 +1186,7 @@ bool DeviceType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DeviceType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - DeviceType_entries, 4, name, &int_value); + DeviceType_entries, 5, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1123,18 +1199,20 @@ bool OSType_IsValid(int value) { case 2: case 3: case 4: + case 5: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed OSType_strings[5] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed OSType_strings[6] = {}; static const char OSType_names[] = "ANDROID" "CHROME_OS" "IOS" + "MACOS" "UNKNOWN_OS_TYPE" "WINDOWS"; @@ -1142,16 +1220,18 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry OSType_entries[] = { { {OSType_names + 0, 7}, 1 }, { {OSType_names + 7, 9}, 2 }, { {OSType_names + 16, 3}, 3 }, - { {OSType_names + 19, 15}, 0 }, - { {OSType_names + 34, 7}, 4 }, + { {OSType_names + 19, 5}, 5 }, + { {OSType_names + 24, 15}, 0 }, + { {OSType_names + 39, 7}, 4 }, }; static const int OSType_entries_by_number[] = { - 3, // 0 -> UNKNOWN_OS_TYPE + 4, // 0 -> UNKNOWN_OS_TYPE 0, // 1 -> ANDROID 1, // 2 -> CHROME_OS 2, // 3 -> IOS - 4, // 4 -> WINDOWS + 5, // 4 -> WINDOWS + 3, // 5 -> MACOS }; const std::string& OSType_Name( @@ -1160,12 +1240,12 @@ const std::string& OSType_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( OSType_entries, OSType_entries_by_number, - 5, OSType_strings); + 6, OSType_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( OSType_entries, OSType_entries_by_number, - 5, value); + 6, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : OSType_strings[idx].get(); } @@ -1173,7 +1253,7 @@ bool OSType_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, OSType* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - OSType_entries, 5, name, &int_value); + OSType_entries, 6, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1247,41 +1327,53 @@ bool LogSource_IsValid(int value) { case 4: case 5: case 6: + case 7: + case 8: + case 9: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed LogSource_strings[7] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed LogSource_strings[10] = {}; static const char LogSource_names[] = "BETA_TESTER_DEVICES" + "BETO_DOGFOOD_DEVICES" "DEBUG_DEVICES" "INTERNAL_DEVICES" "LAB_DEVICES" + "NEARBY_DOGFOOD_DEVICES" "NEARBY_MODULE_FOOD_DEVICES" + "NEARBY_TEAMFOOD_DEVICES" "OEM_DEVICES" "UNSPECIFIED_SOURCE"; static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry LogSource_entries[] = { { {LogSource_names + 0, 19}, 3 }, - { {LogSource_names + 19, 13}, 5 }, - { {LogSource_names + 32, 16}, 2 }, - { {LogSource_names + 48, 11}, 1 }, - { {LogSource_names + 59, 26}, 6 }, - { {LogSource_names + 85, 11}, 4 }, - { {LogSource_names + 96, 18}, 0 }, + { {LogSource_names + 19, 20}, 7 }, + { {LogSource_names + 39, 13}, 5 }, + { {LogSource_names + 52, 16}, 2 }, + { {LogSource_names + 68, 11}, 1 }, + { {LogSource_names + 79, 22}, 8 }, + { {LogSource_names + 101, 26}, 6 }, + { {LogSource_names + 127, 23}, 9 }, + { {LogSource_names + 150, 11}, 4 }, + { {LogSource_names + 161, 18}, 0 }, }; static const int LogSource_entries_by_number[] = { - 6, // 0 -> UNSPECIFIED_SOURCE - 3, // 1 -> LAB_DEVICES - 2, // 2 -> INTERNAL_DEVICES + 9, // 0 -> UNSPECIFIED_SOURCE + 4, // 1 -> LAB_DEVICES + 3, // 2 -> INTERNAL_DEVICES 0, // 3 -> BETA_TESTER_DEVICES - 5, // 4 -> OEM_DEVICES - 1, // 5 -> DEBUG_DEVICES - 4, // 6 -> NEARBY_MODULE_FOOD_DEVICES + 8, // 4 -> OEM_DEVICES + 2, // 5 -> DEBUG_DEVICES + 6, // 6 -> NEARBY_MODULE_FOOD_DEVICES + 1, // 7 -> BETO_DOGFOOD_DEVICES + 5, // 8 -> NEARBY_DOGFOOD_DEVICES + 7, // 9 -> NEARBY_TEAMFOOD_DEVICES }; const std::string& LogSource_Name( @@ -1290,12 +1382,12 @@ const std::string& LogSource_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( LogSource_entries, LogSource_entries_by_number, - 7, LogSource_strings); + 10, LogSource_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( LogSource_entries, LogSource_entries_by_number, - 7, value); + 10, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : LogSource_strings[idx].get(); } @@ -1303,7 +1395,7 @@ bool LogSource_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, LogSource* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - LogSource_entries, 7, name, &int_value); + LogSource_entries, 10, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1322,18 +1414,22 @@ bool ServerActionName_IsValid(int value) { case 8: case 9: case 10: + case 11: + case 12: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ServerActionName_strings[11] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ServerActionName_strings[13] = {}; static const char ServerActionName_names[] = "CHECK_REACHABILITY" "DOWNLOAD_CERTIFICATES" + "DOWNLOAD_CERTIFICATES_INFO" "DOWNLOAD_SENDER_CERTIFICATES" + "LIST_CONTACT_PEOPLE" "LIST_MY_DEVICES" "LIST_REACHABLE_PHONE_NUMBERS" "UNKNOWN_SERVER_ACTION" @@ -1346,29 +1442,33 @@ static const char ServerActionName_names[] = static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ServerActionName_entries[] = { { {ServerActionName_names + 0, 18}, 3 }, { {ServerActionName_names + 18, 21}, 2 }, - { {ServerActionName_names + 39, 28}, 7 }, - { {ServerActionName_names + 67, 15}, 10 }, - { {ServerActionName_names + 82, 28}, 9 }, - { {ServerActionName_names + 110, 21}, 0 }, - { {ServerActionName_names + 131, 18}, 5 }, - { {ServerActionName_names + 149, 19}, 1 }, - { {ServerActionName_names + 168, 15}, 4 }, - { {ServerActionName_names + 183, 32}, 8 }, - { {ServerActionName_names + 215, 26}, 6 }, + { {ServerActionName_names + 39, 26}, 12 }, + { {ServerActionName_names + 65, 28}, 7 }, + { {ServerActionName_names + 93, 19}, 11 }, + { {ServerActionName_names + 112, 15}, 10 }, + { {ServerActionName_names + 127, 28}, 9 }, + { {ServerActionName_names + 155, 21}, 0 }, + { {ServerActionName_names + 176, 18}, 5 }, + { {ServerActionName_names + 194, 19}, 1 }, + { {ServerActionName_names + 213, 15}, 4 }, + { {ServerActionName_names + 228, 32}, 8 }, + { {ServerActionName_names + 260, 26}, 6 }, }; static const int ServerActionName_entries_by_number[] = { - 5, // 0 -> UNKNOWN_SERVER_ACTION - 7, // 1 -> UPLOAD_CERTIFICATES + 7, // 0 -> UNKNOWN_SERVER_ACTION + 9, // 1 -> UPLOAD_CERTIFICATES 1, // 2 -> DOWNLOAD_CERTIFICATES 0, // 3 -> CHECK_REACHABILITY - 8, // 4 -> UPLOAD_CONTACTS - 6, // 5 -> UPDATE_DEVICE_NAME - 10, // 6 -> UPLOAD_SENDER_CERTIFICATES - 2, // 7 -> DOWNLOAD_SENDER_CERTIFICATES - 9, // 8 -> UPLOAD_CONTACTS_AND_CERTIFICATES - 4, // 9 -> LIST_REACHABLE_PHONE_NUMBERS - 3, // 10 -> LIST_MY_DEVICES + 10, // 4 -> UPLOAD_CONTACTS + 8, // 5 -> UPDATE_DEVICE_NAME + 12, // 6 -> UPLOAD_SENDER_CERTIFICATES + 3, // 7 -> DOWNLOAD_SENDER_CERTIFICATES + 11, // 8 -> UPLOAD_CONTACTS_AND_CERTIFICATES + 6, // 9 -> LIST_REACHABLE_PHONE_NUMBERS + 5, // 10 -> LIST_MY_DEVICES + 4, // 11 -> LIST_CONTACT_PEOPLE + 2, // 12 -> DOWNLOAD_CERTIFICATES_INFO }; const std::string& ServerActionName_Name( @@ -1377,12 +1477,12 @@ const std::string& ServerActionName_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( ServerActionName_entries, ServerActionName_entries_by_number, - 11, ServerActionName_strings); + 13, ServerActionName_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( ServerActionName_entries, ServerActionName_entries_by_number, - 11, value); + 13, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : ServerActionName_strings[idx].get(); } @@ -1390,7 +1490,7 @@ bool ServerActionName_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ServerActionName* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - ServerActionName_entries, 11, name, &int_value); + ServerActionName_entries, 13, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1501,13 +1601,15 @@ bool SyncPurpose_IsValid(int value) { case 13: case 14: case 15: + case 16: + case 17: return true; default: return false; } } -static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed SyncPurpose_strings[16] = {}; +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed SyncPurpose_strings[18] = {}; static const char SyncPurpose_names[] = "SYNC_PURPOSE_ACCOUNT_CHANGE" @@ -1515,9 +1617,11 @@ static const char SyncPurpose_names[] = "SYNC_PURPOSE_CHIME_NOTIFICATION" "SYNC_PURPOSE_CONTACT_LIST_CHANGE" "SYNC_PURPOSE_DAILY_SYNC" + "SYNC_PURPOSE_DEVICE_CONTACTS_CONSENT_CHANGE" "SYNC_PURPOSE_NEARBY_SHARE_ENABLED" "SYNC_PURPOSE_ON_DEMAND_SYNC" "SYNC_PURPOSE_OPT_IN_FIRST_SYNC" + "SYNC_PURPOSE_REGENERATE_CERTIFICATES" "SYNC_PURPOSE_REGULAR_CHECK_CONTACT_REACHABILITY" "SYNC_PURPOSE_SHOW_C11N_VIEW" "SYNC_PURPOSE_SYNC_AT_ADVERTISEMENT" @@ -1533,36 +1637,40 @@ static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry SyncPurpose_entries[] { {SyncPurpose_names + 60, 31}, 2 }, { {SyncPurpose_names + 91, 32}, 11 }, { {SyncPurpose_names + 123, 23}, 3 }, - { {SyncPurpose_names + 146, 33}, 6 }, - { {SyncPurpose_names + 179, 27}, 1 }, - { {SyncPurpose_names + 206, 30}, 4 }, - { {SyncPurpose_names + 236, 47}, 13 }, - { {SyncPurpose_names + 283, 27}, 12 }, - { {SyncPurpose_names + 310, 34}, 10 }, - { {SyncPurpose_names + 344, 30}, 8 }, - { {SyncPurpose_names + 374, 30}, 7 }, - { {SyncPurpose_names + 404, 45}, 9 }, - { {SyncPurpose_names + 449, 20}, 0 }, - { {SyncPurpose_names + 469, 47}, 14 }, + { {SyncPurpose_names + 146, 43}, 17 }, + { {SyncPurpose_names + 189, 33}, 6 }, + { {SyncPurpose_names + 222, 27}, 1 }, + { {SyncPurpose_names + 249, 30}, 4 }, + { {SyncPurpose_names + 279, 36}, 16 }, + { {SyncPurpose_names + 315, 47}, 13 }, + { {SyncPurpose_names + 362, 27}, 12 }, + { {SyncPurpose_names + 389, 34}, 10 }, + { {SyncPurpose_names + 423, 30}, 8 }, + { {SyncPurpose_names + 453, 30}, 7 }, + { {SyncPurpose_names + 483, 45}, 9 }, + { {SyncPurpose_names + 528, 20}, 0 }, + { {SyncPurpose_names + 548, 47}, 14 }, }; static const int SyncPurpose_entries_by_number[] = { - 14, // 0 -> SYNC_PURPOSE_UNKNOWN - 6, // 1 -> SYNC_PURPOSE_ON_DEMAND_SYNC + 16, // 0 -> SYNC_PURPOSE_UNKNOWN + 7, // 1 -> SYNC_PURPOSE_ON_DEMAND_SYNC 2, // 2 -> SYNC_PURPOSE_CHIME_NOTIFICATION 4, // 3 -> SYNC_PURPOSE_DAILY_SYNC - 7, // 4 -> SYNC_PURPOSE_OPT_IN_FIRST_SYNC + 8, // 4 -> SYNC_PURPOSE_OPT_IN_FIRST_SYNC 1, // 5 -> SYNC_PURPOSE_CHECK_DEFAULT_OPT_IN - 5, // 6 -> SYNC_PURPOSE_NEARBY_SHARE_ENABLED - 12, // 7 -> SYNC_PURPOSE_SYNC_AT_FAST_INIT - 11, // 8 -> SYNC_PURPOSE_SYNC_AT_DISCOVERY - 13, // 9 -> SYNC_PURPOSE_SYNC_AT_LOAD_PRIVATE_CERTIFICATE - 10, // 10 -> SYNC_PURPOSE_SYNC_AT_ADVERTISEMENT + 6, // 6 -> SYNC_PURPOSE_NEARBY_SHARE_ENABLED + 14, // 7 -> SYNC_PURPOSE_SYNC_AT_FAST_INIT + 13, // 8 -> SYNC_PURPOSE_SYNC_AT_DISCOVERY + 15, // 9 -> SYNC_PURPOSE_SYNC_AT_LOAD_PRIVATE_CERTIFICATE + 12, // 10 -> SYNC_PURPOSE_SYNC_AT_ADVERTISEMENT 3, // 11 -> SYNC_PURPOSE_CONTACT_LIST_CHANGE - 9, // 12 -> SYNC_PURPOSE_SHOW_C11N_VIEW - 8, // 13 -> SYNC_PURPOSE_REGULAR_CHECK_CONTACT_REACHABILITY - 15, // 14 -> SYNC_PURPOSE_VISIBILITY_SELECTED_CONTACT_CHANGE + 11, // 12 -> SYNC_PURPOSE_SHOW_C11N_VIEW + 10, // 13 -> SYNC_PURPOSE_REGULAR_CHECK_CONTACT_REACHABILITY + 17, // 14 -> SYNC_PURPOSE_VISIBILITY_SELECTED_CONTACT_CHANGE 0, // 15 -> SYNC_PURPOSE_ACCOUNT_CHANGE + 9, // 16 -> SYNC_PURPOSE_REGENERATE_CERTIFICATES + 5, // 17 -> SYNC_PURPOSE_DEVICE_CONTACTS_CONSENT_CHANGE }; const std::string& SyncPurpose_Name( @@ -1571,12 +1679,12 @@ const std::string& SyncPurpose_Name( ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( SyncPurpose_entries, SyncPurpose_entries_by_number, - 16, SyncPurpose_strings); + 18, SyncPurpose_strings); (void) dummy; int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( SyncPurpose_entries, SyncPurpose_entries_by_number, - 16, value); + 18, value); return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : SyncPurpose_strings[idx].get(); } @@ -1584,7 +1692,7 @@ bool SyncPurpose_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SyncPurpose* value) { int int_value; bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( - SyncPurpose_entries, 16, name, &int_value); + SyncPurpose_entries, 18, name, &int_value); if (success) { *value = static_cast(int_value); } @@ -1826,6 +1934,69 @@ bool AdvertisingMode_Parse( } return success; } +bool DiscoveryMode_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed DiscoveryMode_strings[5] = {}; + +static const char DiscoveryMode_names[] = + "BACKGROUND_DISCOVERY_MODE" + "FOREGROUND_DISCOVERY_MODE" + "MIDGROUND_DISCOVERY_MODE" + "SCREEN_OFF_DISCOVERY_MODE" + "UNKNOWN_DISCOVERY_MODE"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry DiscoveryMode_entries[] = { + { {DiscoveryMode_names + 0, 25}, 2 }, + { {DiscoveryMode_names + 25, 25}, 4 }, + { {DiscoveryMode_names + 50, 24}, 3 }, + { {DiscoveryMode_names + 74, 25}, 1 }, + { {DiscoveryMode_names + 99, 22}, 0 }, +}; + +static const int DiscoveryMode_entries_by_number[] = { + 4, // 0 -> UNKNOWN_DISCOVERY_MODE + 3, // 1 -> SCREEN_OFF_DISCOVERY_MODE + 0, // 2 -> BACKGROUND_DISCOVERY_MODE + 2, // 3 -> MIDGROUND_DISCOVERY_MODE + 1, // 4 -> FOREGROUND_DISCOVERY_MODE +}; + +const std::string& DiscoveryMode_Name( + DiscoveryMode value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + DiscoveryMode_entries, + DiscoveryMode_entries_by_number, + 5, DiscoveryMode_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + DiscoveryMode_entries, + DiscoveryMode_entries_by_number, + 5, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + DiscoveryMode_strings[idx].get(); +} +bool DiscoveryMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DiscoveryMode* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + DiscoveryMode_entries, 5, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} bool ActivityName_IsValid(int value) { switch (value) { case 0: @@ -3055,6 +3226,187 @@ bool DecryptCertificateFailureStatus_Parse( } return success; } +bool ContactAccess_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ContactAccess_strings[5] = {}; + +static const char ContactAccess_names[] = + "CONTACT_ACCESS_NO_CONTACT_UPLOADED" + "CONTACT_ACCESS_ONLY_UPLOAD_GOOGLE_CONTACT" + "CONTACT_ACCESS_UNKNOWN" + "CONTACT_ACCESS_UPLOAD_CONTACT_FOR_DEVICE_CONTACT_CONSENT" + "CONTACT_ACCESS_UPLOAD_CONTACT_FOR_QUICK_SHARE_CONSENT"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ContactAccess_entries[] = { + { {ContactAccess_names + 0, 34}, 1 }, + { {ContactAccess_names + 34, 41}, 2 }, + { {ContactAccess_names + 75, 22}, 0 }, + { {ContactAccess_names + 97, 56}, 3 }, + { {ContactAccess_names + 153, 53}, 4 }, +}; + +static const int ContactAccess_entries_by_number[] = { + 2, // 0 -> CONTACT_ACCESS_UNKNOWN + 0, // 1 -> CONTACT_ACCESS_NO_CONTACT_UPLOADED + 1, // 2 -> CONTACT_ACCESS_ONLY_UPLOAD_GOOGLE_CONTACT + 3, // 3 -> CONTACT_ACCESS_UPLOAD_CONTACT_FOR_DEVICE_CONTACT_CONSENT + 4, // 4 -> CONTACT_ACCESS_UPLOAD_CONTACT_FOR_QUICK_SHARE_CONSENT +}; + +const std::string& ContactAccess_Name( + ContactAccess value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ContactAccess_entries, + ContactAccess_entries_by_number, + 5, ContactAccess_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ContactAccess_entries, + ContactAccess_entries_by_number, + 5, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ContactAccess_strings[idx].get(); +} +bool ContactAccess_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContactAccess* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ContactAccess_entries, 5, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +bool IdentityVerification_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed IdentityVerification_strings[4] = {}; + +static const char IdentityVerification_names[] = + "IDENTITY_VERIFICATION_NO_PHONE_NUMBER_VERIFIED" + "IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_LINKED_TO_QS_GAIA" + "IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_NOT_LINKED_TO_GAIA" + "IDENTITY_VERIFICATION_UNKNOWN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry IdentityVerification_entries[] = { + { {IdentityVerification_names + 0, 46}, 1 }, + { {IdentityVerification_names + 46, 61}, 3 }, + { {IdentityVerification_names + 107, 62}, 2 }, + { {IdentityVerification_names + 169, 29}, 0 }, +}; + +static const int IdentityVerification_entries_by_number[] = { + 3, // 0 -> IDENTITY_VERIFICATION_UNKNOWN + 0, // 1 -> IDENTITY_VERIFICATION_NO_PHONE_NUMBER_VERIFIED + 2, // 2 -> IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_NOT_LINKED_TO_GAIA + 1, // 3 -> IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_LINKED_TO_QS_GAIA +}; + +const std::string& IdentityVerification_Name( + IdentityVerification value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + IdentityVerification_entries, + IdentityVerification_entries_by_number, + 4, IdentityVerification_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + IdentityVerification_entries, + IdentityVerification_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + IdentityVerification_strings[idx].get(); +} +bool IdentityVerification_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, IdentityVerification* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + IdentityVerification_entries, 4, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +bool ButtonStatus_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed ButtonStatus_strings[4] = {}; + +static const char ButtonStatus_names[] = + "BUTTON_STATUS_CLICK_ACCEPT" + "BUTTON_STATUS_CLICK_REJECT" + "BUTTON_STATUS_IGNORE" + "BUTTON_STATUS_UNKNOWN"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry ButtonStatus_entries[] = { + { {ButtonStatus_names + 0, 26}, 1 }, + { {ButtonStatus_names + 26, 26}, 2 }, + { {ButtonStatus_names + 52, 20}, 3 }, + { {ButtonStatus_names + 72, 21}, 0 }, +}; + +static const int ButtonStatus_entries_by_number[] = { + 3, // 0 -> BUTTON_STATUS_UNKNOWN + 0, // 1 -> BUTTON_STATUS_CLICK_ACCEPT + 1, // 2 -> BUTTON_STATUS_CLICK_REJECT + 2, // 3 -> BUTTON_STATUS_IGNORE +}; + +const std::string& ButtonStatus_Name( + ButtonStatus value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + ButtonStatus_entries, + ButtonStatus_entries_by_number, + 4, ButtonStatus_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + ButtonStatus_entries, + ButtonStatus_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + ButtonStatus_strings[idx].get(); +} +bool ButtonStatus_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ButtonStatus* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + ButtonStatus_entries, 4, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} // @@protoc_insertion_point(namespace_scope) } // namespace sharing diff --git a/compiled_proto/proto/sharing_enums.pb.h b/compiled_proto/proto/sharing_enums.pb.h index 6bf8b7c6..04c3f64d 100644 --- a/compiled_proto/proto/sharing_enums.pb.h +++ b/compiled_proto/proto/sharing_enums.pb.h @@ -122,11 +122,14 @@ enum EventType : int { FAST_INIT_DISCOVER_DEVICE = 61, SEND_DESKTOP_NOTIFICATION = 62, SET_ACCOUNT = 63, - DECRYPT_CERTIFICATE_FAILURE = 64 + DECRYPT_CERTIFICATE_FAILURE = 64, + SHOW_ALLOW_PERMISSION_AUTO_ACCESS = 65, + SEND_DESKTOP_TRANSFER_EVENT = 66, + WAITING_FOR_ACCEPT = 67 }; bool EventType_IsValid(int value); constexpr EventType EventType_MIN = UNKNOWN_EVENT_TYPE; -constexpr EventType EventType_MAX = DECRYPT_CERTIFICATE_FAILURE; +constexpr EventType EventType_MAX = WAITING_FOR_ACCEPT; constexpr int EventType_ARRAYSIZE = EventType_MAX + 1; const std::string& EventType_Name(EventType value); @@ -228,11 +231,18 @@ enum EstablishConnectionStatus : int { CONNECTION_STATUS_UNKNOWN = 0, CONNECTION_STATUS_SUCCESS = 1, CONNECTION_STATUS_FAILURE = 2, - CONNECTION_STATUS_CANCELLATION = 3 + CONNECTION_STATUS_CANCELLATION = 3, + CONNECTION_STATUS_MEDIA_UNAVAILABLE_ATTACHMENT = 4, + CONNECTION_STATUS_FAILED_PAIRED_KEYHANDSHAKE = 5, + CONNECTION_STATUS_FAILED_WRITE_INTRODUCTION = 6, + CONNECTION_STATUS_FAILED_NULL_CONNECTION = 7, + CONNECTION_STATUS_FAILED_NO_TRANSFER_UPDATE_CALLBACK = 8, + CONNECTION_STATUS_LOST_CONNECTIVITY = 9, + CONNECTION_STATUS_INVALID_ADVERTISEMENT = 10 }; bool EstablishConnectionStatus_IsValid(int value); constexpr EstablishConnectionStatus EstablishConnectionStatus_MIN = CONNECTION_STATUS_UNKNOWN; -constexpr EstablishConnectionStatus EstablishConnectionStatus_MAX = CONNECTION_STATUS_CANCELLATION; +constexpr EstablishConnectionStatus EstablishConnectionStatus_MAX = CONNECTION_STATUS_INVALID_ADVERTISEMENT; constexpr int EstablishConnectionStatus_ARRAYSIZE = EstablishConnectionStatus_MAX + 1; const std::string& EstablishConnectionStatus_Name(EstablishConnectionStatus value); @@ -250,28 +260,36 @@ enum AttachmentTransmissionStatus : int { COMPLETE_ATTACHMENT_TRANSMISSION_STATUS = 1, CANCELED_ATTACHMENT_TRANSMISSION_STATUS = 2, FAILED_ATTACHMENT_TRANSMISSION_STATUS = 3, - REJECTED_ATTACHMENT = 4, - TIMED_OUT_ATTACHMENT = 5, + REJECTED_ATTACHMENT PROTOBUF_DEPRECATED_ENUM = 4, + TIMED_OUT_ATTACHMENT PROTOBUF_DEPRECATED_ENUM = 5, AWAITING_REMOTE_ACCEPTANCE_FAILED_ATTACHMENT PROTOBUF_DEPRECATED_ENUM = 6, - NOT_ENOUGH_SPACE_ATTACHMENT = 7, - FAILED_NO_TRANSFER_UPDATE_CALLBACK = 8, - MEDIA_UNAVAILABLE_ATTACHMENT = 9, - UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT = 10, - NO_ATTACHMENT_FOUND = 11, - FAILED_NO_SHARE_TARGET_ENDPOINT = 12, - FAILED_PAIRED_KEYHANDSHAKE = 13, - FAILED_NULL_CONNECTION = 14, - FAILED_NO_PAYLOAD = 15, - FAILED_WRITE_INTRODUCTION = 16, - FAILED_UNKNOWN_REMOTE_RESPONSE = 17, + NOT_ENOUGH_SPACE_ATTACHMENT PROTOBUF_DEPRECATED_ENUM = 7, + FAILED_NO_TRANSFER_UPDATE_CALLBACK PROTOBUF_DEPRECATED_ENUM = 8, + MEDIA_UNAVAILABLE_ATTACHMENT PROTOBUF_DEPRECATED_ENUM = 9, + UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT PROTOBUF_DEPRECATED_ENUM = 10, + NO_ATTACHMENT_FOUND PROTOBUF_DEPRECATED_ENUM = 11, + FAILED_NO_SHARE_TARGET_ENDPOINT PROTOBUF_DEPRECATED_ENUM = 12, + FAILED_PAIRED_KEYHANDSHAKE PROTOBUF_DEPRECATED_ENUM = 13, + FAILED_NULL_CONNECTION PROTOBUF_DEPRECATED_ENUM = 14, + FAILED_NO_PAYLOAD PROTOBUF_DEPRECATED_ENUM = 15, + FAILED_WRITE_INTRODUCTION PROTOBUF_DEPRECATED_ENUM = 16, + FAILED_UNKNOWN_REMOTE_RESPONSE PROTOBUF_DEPRECATED_ENUM = 17, FAILED_NULL_CONNECTION_INIT_OUTGOING = 18, FAILED_NULL_CONNECTION_DISCONNECTED = 19, - FAILED_NULL_CONNECTION_LOST_CONNECTIVITY = 20, - FAILED_NULL_CONNECTION_FAILURE = 21 + FAILED_NULL_CONNECTION_LOST_CONNECTIVITY PROTOBUF_DEPRECATED_ENUM = 20, + FAILED_NULL_CONNECTION_FAILURE PROTOBUF_DEPRECATED_ENUM = 21, + REJECTED_ATTACHMENT_TRANSMISSION_STATUS = 22, + TIMED_OUT_ATTACHMENT_TRANSMISSION_STATUS = 23, + NOT_ENOUGH_SPACE_ATTACHMENT_TRANSMISSION_STATUS = 24, + UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT_TRANSMISSION_STATUS = 25, + FAILED_UNKNOWN_REMOTE_RESPONSE_TRANSMISSION_STATUS = 26, + NO_RESPONSE_FRAME_CONNECTION_CLOSED_LOST_CONNECTIVITY_TRANSMISSION_STATUS PROTOBUF_DEPRECATED_ENUM = 27, + NO_RESPONSE_FRAME_CONNECTION_CLOSED_TRANSMISSION_STATUS = 28, + LOST_CONNECTIVITY_TRANSMISSION_STATUS = 29 }; bool AttachmentTransmissionStatus_IsValid(int value); constexpr AttachmentTransmissionStatus AttachmentTransmissionStatus_MIN = UNKNOWN_ATTACHMENT_TRANSMISSION_STATUS; -constexpr AttachmentTransmissionStatus AttachmentTransmissionStatus_MAX = FAILED_NULL_CONNECTION_FAILURE; +constexpr AttachmentTransmissionStatus AttachmentTransmissionStatus_MAX = LOST_CONNECTIVITY_TRANSMISSION_STATUS; constexpr int AttachmentTransmissionStatus_ARRAYSIZE = AttachmentTransmissionStatus_MAX + 1; const std::string& AttachmentTransmissionStatus_Name(AttachmentTransmissionStatus value); @@ -388,11 +406,12 @@ enum DeviceType : int { UNKNOWN_DEVICE_TYPE = 0, PHONE = 1, TABLET = 2, - LAPTOP = 3 + LAPTOP = 3, + CAR = 4 }; bool DeviceType_IsValid(int value); constexpr DeviceType DeviceType_MIN = UNKNOWN_DEVICE_TYPE; -constexpr DeviceType DeviceType_MAX = LAPTOP; +constexpr DeviceType DeviceType_MAX = CAR; constexpr int DeviceType_ARRAYSIZE = DeviceType_MAX + 1; const std::string& DeviceType_Name(DeviceType value); @@ -410,11 +429,12 @@ enum OSType : int { ANDROID = 1, CHROME_OS = 2, IOS = 3, - WINDOWS = 4 + WINDOWS = 4, + MACOS = 5 }; bool OSType_IsValid(int value); constexpr OSType OSType_MIN = UNKNOWN_OS_TYPE; -constexpr OSType OSType_MAX = WINDOWS; +constexpr OSType OSType_MAX = MACOS; constexpr int OSType_ARRAYSIZE = OSType_MAX + 1; const std::string& OSType_Name(OSType value); @@ -455,11 +475,14 @@ enum LogSource : int { BETA_TESTER_DEVICES = 3, OEM_DEVICES = 4, DEBUG_DEVICES = 5, - NEARBY_MODULE_FOOD_DEVICES = 6 + NEARBY_MODULE_FOOD_DEVICES = 6, + BETO_DOGFOOD_DEVICES = 7, + NEARBY_DOGFOOD_DEVICES = 8, + NEARBY_TEAMFOOD_DEVICES = 9 }; bool LogSource_IsValid(int value); constexpr LogSource LogSource_MIN = UNSPECIFIED_SOURCE; -constexpr LogSource LogSource_MAX = NEARBY_MODULE_FOOD_DEVICES; +constexpr LogSource LogSource_MAX = NEARBY_TEAMFOOD_DEVICES; constexpr int LogSource_ARRAYSIZE = LogSource_MAX + 1; const std::string& LogSource_Name(LogSource value); @@ -483,11 +506,13 @@ enum ServerActionName : int { DOWNLOAD_SENDER_CERTIFICATES = 7, UPLOAD_CONTACTS_AND_CERTIFICATES = 8, LIST_REACHABLE_PHONE_NUMBERS = 9, - LIST_MY_DEVICES = 10 + LIST_MY_DEVICES = 10, + LIST_CONTACT_PEOPLE = 11, + DOWNLOAD_CERTIFICATES_INFO = 12 }; bool ServerActionName_IsValid(int value); constexpr ServerActionName ServerActionName_MIN = UNKNOWN_SERVER_ACTION; -constexpr ServerActionName ServerActionName_MAX = LIST_MY_DEVICES; +constexpr ServerActionName ServerActionName_MAX = DOWNLOAD_CERTIFICATES_INFO; constexpr int ServerActionName_ARRAYSIZE = ServerActionName_MAX + 1; const std::string& ServerActionName_Name(ServerActionName value); @@ -544,11 +569,13 @@ enum SyncPurpose : int { SYNC_PURPOSE_SHOW_C11N_VIEW = 12, SYNC_PURPOSE_REGULAR_CHECK_CONTACT_REACHABILITY = 13, SYNC_PURPOSE_VISIBILITY_SELECTED_CONTACT_CHANGE = 14, - SYNC_PURPOSE_ACCOUNT_CHANGE = 15 + SYNC_PURPOSE_ACCOUNT_CHANGE = 15, + SYNC_PURPOSE_REGENERATE_CERTIFICATES = 16, + SYNC_PURPOSE_DEVICE_CONTACTS_CONSENT_CHANGE = 17 }; bool SyncPurpose_IsValid(int value); constexpr SyncPurpose SyncPurpose_MIN = SYNC_PURPOSE_UNKNOWN; -constexpr SyncPurpose SyncPurpose_MAX = SYNC_PURPOSE_ACCOUNT_CHANGE; +constexpr SyncPurpose SyncPurpose_MAX = SYNC_PURPOSE_DEVICE_CONTACTS_CONSENT_CHANGE; constexpr int SyncPurpose_ARRAYSIZE = SyncPurpose_MAX + 1; const std::string& SyncPurpose_Name(SyncPurpose value); @@ -645,6 +672,28 @@ inline const std::string& AdvertisingMode_Name(T enum_t_value) { } bool AdvertisingMode_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AdvertisingMode* value); +enum DiscoveryMode : int { + UNKNOWN_DISCOVERY_MODE = 0, + SCREEN_OFF_DISCOVERY_MODE = 1, + BACKGROUND_DISCOVERY_MODE = 2, + MIDGROUND_DISCOVERY_MODE = 3, + FOREGROUND_DISCOVERY_MODE = 4 +}; +bool DiscoveryMode_IsValid(int value); +constexpr DiscoveryMode DiscoveryMode_MIN = UNKNOWN_DISCOVERY_MODE; +constexpr DiscoveryMode DiscoveryMode_MAX = FOREGROUND_DISCOVERY_MODE; +constexpr int DiscoveryMode_ARRAYSIZE = DiscoveryMode_MAX + 1; + +const std::string& DiscoveryMode_Name(DiscoveryMode value); +template +inline const std::string& DiscoveryMode_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function DiscoveryMode_Name."); + return DiscoveryMode_Name(static_cast(enum_t_value)); +} +bool DiscoveryMode_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DiscoveryMode* value); enum ActivityName : int { UNKNOWN_ACTIVITY = 0, SHARE_SHEET_ACTIVITY = 1, @@ -1071,6 +1120,70 @@ inline const std::string& DecryptCertificateFailureStatus_Name(T enum_t_value) { } bool DecryptCertificateFailureStatus_Parse( ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, DecryptCertificateFailureStatus* value); +enum ContactAccess : int { + CONTACT_ACCESS_UNKNOWN = 0, + CONTACT_ACCESS_NO_CONTACT_UPLOADED = 1, + CONTACT_ACCESS_ONLY_UPLOAD_GOOGLE_CONTACT = 2, + CONTACT_ACCESS_UPLOAD_CONTACT_FOR_DEVICE_CONTACT_CONSENT = 3, + CONTACT_ACCESS_UPLOAD_CONTACT_FOR_QUICK_SHARE_CONSENT = 4 +}; +bool ContactAccess_IsValid(int value); +constexpr ContactAccess ContactAccess_MIN = CONTACT_ACCESS_UNKNOWN; +constexpr ContactAccess ContactAccess_MAX = CONTACT_ACCESS_UPLOAD_CONTACT_FOR_QUICK_SHARE_CONSENT; +constexpr int ContactAccess_ARRAYSIZE = ContactAccess_MAX + 1; + +const std::string& ContactAccess_Name(ContactAccess value); +template +inline const std::string& ContactAccess_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ContactAccess_Name."); + return ContactAccess_Name(static_cast(enum_t_value)); +} +bool ContactAccess_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ContactAccess* value); +enum IdentityVerification : int { + IDENTITY_VERIFICATION_UNKNOWN = 0, + IDENTITY_VERIFICATION_NO_PHONE_NUMBER_VERIFIED = 1, + IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_NOT_LINKED_TO_GAIA = 2, + IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_LINKED_TO_QS_GAIA = 3 +}; +bool IdentityVerification_IsValid(int value); +constexpr IdentityVerification IdentityVerification_MIN = IDENTITY_VERIFICATION_UNKNOWN; +constexpr IdentityVerification IdentityVerification_MAX = IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_LINKED_TO_QS_GAIA; +constexpr int IdentityVerification_ARRAYSIZE = IdentityVerification_MAX + 1; + +const std::string& IdentityVerification_Name(IdentityVerification value); +template +inline const std::string& IdentityVerification_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function IdentityVerification_Name."); + return IdentityVerification_Name(static_cast(enum_t_value)); +} +bool IdentityVerification_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, IdentityVerification* value); +enum ButtonStatus : int { + BUTTON_STATUS_UNKNOWN = 0, + BUTTON_STATUS_CLICK_ACCEPT = 1, + BUTTON_STATUS_CLICK_REJECT = 2, + BUTTON_STATUS_IGNORE = 3 +}; +bool ButtonStatus_IsValid(int value); +constexpr ButtonStatus ButtonStatus_MIN = BUTTON_STATUS_UNKNOWN; +constexpr ButtonStatus ButtonStatus_MAX = BUTTON_STATUS_IGNORE; +constexpr int ButtonStatus_ARRAYSIZE = ButtonStatus_MAX + 1; + +const std::string& ButtonStatus_Name(ButtonStatus value); +template +inline const std::string& ButtonStatus_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function ButtonStatus_Name."); + return ButtonStatus_Name(static_cast(enum_t_value)); +} +bool ButtonStatus_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ButtonStatus* value); // =================================================================== @@ -1118,6 +1231,7 @@ template <> struct is_proto_enum< ::location::nearby::proto::sharing::ClientRole template <> struct is_proto_enum< ::location::nearby::proto::sharing::ScanType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::ParsingFailedType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::AdvertisingMode> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::sharing::DiscoveryMode> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::ActivityName> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::ConsentType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::ConsentAcceptanceStatus> : ::std::true_type {}; @@ -1137,6 +1251,9 @@ template <> struct is_proto_enum< ::location::nearby::proto::sharing::FastInitTy template <> struct is_proto_enum< ::location::nearby::proto::sharing::DesktopNotification> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::DesktopTransferEventType> : ::std::true_type {}; template <> struct is_proto_enum< ::location::nearby::proto::sharing::DecryptCertificateFailureStatus> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::sharing::ContactAccess> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::sharing::IdentityVerification> : ::std::true_type {}; +template <> struct is_proto_enum< ::location::nearby::proto::sharing::ButtonStatus> : ::std::true_type {}; PROTOBUF_NAMESPACE_CLOSE diff --git a/compiled_proto/sharing/proto/analytics/nearby_sharing_log.pb.cc b/compiled_proto/sharing/proto/analytics/nearby_sharing_log.pb.cc new file mode 100644 index 00000000..4f215ffe --- /dev/null +++ b/compiled_proto/sharing/proto/analytics/nearby_sharing_log.pb.cc @@ -0,0 +1,23717 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: sharing/proto/analytics/nearby_sharing_log.proto + +#include "sharing/proto/analytics/nearby_sharing_log.pb.h" + +#include + +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG +namespace nearby { +namespace sharing { +namespace analytics { +namespace proto { +constexpr SharingLog_AppInfo::SharingLog_AppInfo( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : app_version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , app_language_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , update_track_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct SharingLog_AppInfoDefaultTypeInternal { + constexpr SharingLog_AppInfoDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AppInfoDefaultTypeInternal() {} + union { + SharingLog_AppInfo _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AppInfoDefaultTypeInternal _SharingLog_AppInfo_default_instance_; +constexpr SharingLog_DeviceSettings::SharingLog_DeviceSettings( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : visibility_(0) + + , data_usage_(0) + + , device_name_size_(0) + , is_show_notification_enabled_(false) + , is_bt_enabled_(false) + , is_location_enabled_(false) + , is_wifi_enabled_(false){} +struct SharingLog_DeviceSettingsDefaultTypeInternal { + constexpr SharingLog_DeviceSettingsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DeviceSettingsDefaultTypeInternal() {} + union { + SharingLog_DeviceSettings _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DeviceSettingsDefaultTypeInternal _SharingLog_DeviceSettings_default_instance_; +constexpr SharingLog_PreferencesUsage::SharingLog_PreferencesUsage( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : action_(0) + + , action_status_(0) + + , prev_sub_action_(0) + + , next_sub_action_(0) +{} +struct SharingLog_PreferencesUsageDefaultTypeInternal { + constexpr SharingLog_PreferencesUsageDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_PreferencesUsageDefaultTypeInternal() {} + union { + SharingLog_PreferencesUsage _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_PreferencesUsageDefaultTypeInternal _SharingLog_PreferencesUsage_default_instance_; +constexpr SharingLog_UnknownEvent::SharingLog_UnknownEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_UnknownEventDefaultTypeInternal { + constexpr SharingLog_UnknownEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_UnknownEventDefaultTypeInternal() {} + union { + SharingLog_UnknownEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_UnknownEventDefaultTypeInternal _SharingLog_UnknownEvent_default_instance_; +constexpr SharingLog_EstablishConnection::SharingLog_EstablishConnection( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , share_target_info_(nullptr) + , session_id_(int64_t{0}) + , status_(0) + + , transfer_position_(0) + , duration_millis_(int64_t{0}) + , concurrent_connections_(0) + , qr_code_flow_(false) + , is_incoming_connection_(false){} +struct SharingLog_EstablishConnectionDefaultTypeInternal { + constexpr SharingLog_EstablishConnectionDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_EstablishConnectionDefaultTypeInternal() {} + union { + SharingLog_EstablishConnection _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_EstablishConnectionDefaultTypeInternal _SharingLog_EstablishConnection_default_instance_; +constexpr SharingLog_AcceptAgreements::SharingLog_AcceptAgreements( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_AcceptAgreementsDefaultTypeInternal { + constexpr SharingLog_AcceptAgreementsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AcceptAgreementsDefaultTypeInternal() {} + union { + SharingLog_AcceptAgreements _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AcceptAgreementsDefaultTypeInternal _SharingLog_AcceptAgreements_default_instance_; +constexpr SharingLog_DeclineAgreements::SharingLog_DeclineAgreements( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_DeclineAgreementsDefaultTypeInternal { + constexpr SharingLog_DeclineAgreementsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DeclineAgreementsDefaultTypeInternal() {} + union { + SharingLog_DeclineAgreements _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DeclineAgreementsDefaultTypeInternal _SharingLog_DeclineAgreements_default_instance_; +constexpr SharingLog_EnableNearbySharing::SharingLog_EnableNearbySharing( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : status_(0) + + , has_opted_in_(false){} +struct SharingLog_EnableNearbySharingDefaultTypeInternal { + constexpr SharingLog_EnableNearbySharingDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_EnableNearbySharingDefaultTypeInternal() {} + union { + SharingLog_EnableNearbySharing _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_EnableNearbySharingDefaultTypeInternal _SharingLog_EnableNearbySharing_default_instance_; +constexpr SharingLog_SetAccount::SharingLog_SetAccount( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : activity_name_(0) +{} +struct SharingLog_SetAccountDefaultTypeInternal { + constexpr SharingLog_SetAccountDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SetAccountDefaultTypeInternal() {} + union { + SharingLog_SetAccount _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SetAccountDefaultTypeInternal _SharingLog_SetAccount_default_instance_; +constexpr SharingLog_SetVisibility::SharingLog_SetVisibility( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : visibility_(0) + + , source_visibility_(0) + + , duration_millis_(int64_t{0}) + , source_activity_name_(0) +{} +struct SharingLog_SetVisibilityDefaultTypeInternal { + constexpr SharingLog_SetVisibilityDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SetVisibilityDefaultTypeInternal() {} + union { + SharingLog_SetVisibility _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SetVisibilityDefaultTypeInternal _SharingLog_SetVisibility_default_instance_; +constexpr SharingLog_SetDataUsage::SharingLog_SetDataUsage( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : original_preference_(0) + + , preference_(0) +{} +struct SharingLog_SetDataUsageDefaultTypeInternal { + constexpr SharingLog_SetDataUsageDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SetDataUsageDefaultTypeInternal() {} + union { + SharingLog_SetDataUsage _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SetDataUsageDefaultTypeInternal _SharingLog_SetDataUsage_default_instance_; +constexpr SharingLog_ScanForShareTargetsStart::SharingLog_ScanForShareTargetsStart( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , session_id_(int64_t{0}) + , status_(0) + + , scan_type_(0) + + , flow_id_(int64_t{0}){} +struct SharingLog_ScanForShareTargetsStartDefaultTypeInternal { + constexpr SharingLog_ScanForShareTargetsStartDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ScanForShareTargetsStartDefaultTypeInternal() {} + union { + SharingLog_ScanForShareTargetsStart _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ScanForShareTargetsStartDefaultTypeInternal _SharingLog_ScanForShareTargetsStart_default_instance_; +constexpr SharingLog_ScanForShareTargetsEnd::SharingLog_ScanForShareTargetsEnd( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : session_id_(int64_t{0}){} +struct SharingLog_ScanForShareTargetsEndDefaultTypeInternal { + constexpr SharingLog_ScanForShareTargetsEndDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ScanForShareTargetsEndDefaultTypeInternal() {} + union { + SharingLog_ScanForShareTargetsEnd _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ScanForShareTargetsEndDefaultTypeInternal _SharingLog_ScanForShareTargetsEnd_default_instance_; +constexpr SharingLog_AdvertiseDevicePresenceStart::SharingLog_AdvertiseDevicePresenceStart( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , session_id_(int64_t{0}) + , visibility_(0) + + , status_(0) + + , data_usage_(0) + + , device_name_size_(0) + , advertising_mode_(0) + + , qr_code_flow_(false){} +struct SharingLog_AdvertiseDevicePresenceStartDefaultTypeInternal { + constexpr SharingLog_AdvertiseDevicePresenceStartDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AdvertiseDevicePresenceStartDefaultTypeInternal() {} + union { + SharingLog_AdvertiseDevicePresenceStart _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AdvertiseDevicePresenceStartDefaultTypeInternal _SharingLog_AdvertiseDevicePresenceStart_default_instance_; +constexpr SharingLog_AdvertiseDevicePresenceEnd::SharingLog_AdvertiseDevicePresenceEnd( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : session_id_(int64_t{0}){} +struct SharingLog_AdvertiseDevicePresenceEndDefaultTypeInternal { + constexpr SharingLog_AdvertiseDevicePresenceEndDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AdvertiseDevicePresenceEndDefaultTypeInternal() {} + union { + SharingLog_AdvertiseDevicePresenceEnd _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AdvertiseDevicePresenceEndDefaultTypeInternal _SharingLog_AdvertiseDevicePresenceEnd_default_instance_; +constexpr SharingLog_SendFastInitialization::SharingLog_SendFastInitialization( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_SendFastInitializationDefaultTypeInternal { + constexpr SharingLog_SendFastInitializationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendFastInitializationDefaultTypeInternal() {} + union { + SharingLog_SendFastInitialization _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendFastInitializationDefaultTypeInternal _SharingLog_SendFastInitialization_default_instance_; +constexpr SharingLog_ReceiveFastInitialization::SharingLog_ReceiveFastInitialization( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : time_elapse_since_screen_unlock_millis_(int64_t{0}) + , notifications_enabled_(false) + , notifications_filtered_(false){} +struct SharingLog_ReceiveFastInitializationDefaultTypeInternal { + constexpr SharingLog_ReceiveFastInitializationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ReceiveFastInitializationDefaultTypeInternal() {} + union { + SharingLog_ReceiveFastInitialization _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ReceiveFastInitializationDefaultTypeInternal _SharingLog_ReceiveFastInitialization_default_instance_; +constexpr SharingLog_DismissFastInitialization::SharingLog_DismissFastInitialization( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_DismissFastInitializationDefaultTypeInternal { + constexpr SharingLog_DismissFastInitializationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DismissFastInitializationDefaultTypeInternal() {} + union { + SharingLog_DismissFastInitialization _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DismissFastInitializationDefaultTypeInternal _SharingLog_DismissFastInitialization_default_instance_; +constexpr SharingLog_AutoDismissFastInitialization::SharingLog_AutoDismissFastInitialization( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_AutoDismissFastInitializationDefaultTypeInternal { + constexpr SharingLog_AutoDismissFastInitializationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AutoDismissFastInitializationDefaultTypeInternal() {} + union { + SharingLog_AutoDismissFastInitialization _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AutoDismissFastInitializationDefaultTypeInternal _SharingLog_AutoDismissFastInitialization_default_instance_; +constexpr SharingLog_EventMetadata::SharingLog_EventMetadata( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : use_case_(0) + + , initial_opt_in_(false) + , opt_in_(false) + , initial_enable_status_(false) + , flow_id_(int64_t{0}) + , session_id_(int64_t{0}) + , vendor_id_(0){} +struct SharingLog_EventMetadataDefaultTypeInternal { + constexpr SharingLog_EventMetadataDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_EventMetadataDefaultTypeInternal() {} + union { + SharingLog_EventMetadata _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_EventMetadataDefaultTypeInternal _SharingLog_EventMetadata_default_instance_; +constexpr SharingLog_DiscoverShareTarget::SharingLog_DiscoverShareTarget( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , share_target_info_(nullptr) + , duration_since_scanning_(nullptr) + , session_id_(int64_t{0}) + , flow_id_(int64_t{0}) + , scan_type_(0) + + , latency_since_activity_start_millis_(int64_t{-1}){} +struct SharingLog_DiscoverShareTargetDefaultTypeInternal { + constexpr SharingLog_DiscoverShareTargetDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DiscoverShareTargetDefaultTypeInternal() {} + union { + SharingLog_DiscoverShareTarget _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DiscoverShareTargetDefaultTypeInternal _SharingLog_DiscoverShareTarget_default_instance_; +constexpr SharingLog_ParsingFailedEndpointId::SharingLog_ParsingFailedEndpointId( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : endpoint_id_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , duration_since_scanning_(nullptr) + , duration_since_last_sync_(nullptr) + , session_id_(int64_t{0}) + , flow_id_(int64_t{0}) + , scan_type_(0) + + , parsing_failed_type_(0) + + , discovery_mode_(0) + + , latency_since_activity_start_millis_(int64_t{-1}){} +struct SharingLog_ParsingFailedEndpointIdDefaultTypeInternal { + constexpr SharingLog_ParsingFailedEndpointIdDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ParsingFailedEndpointIdDefaultTypeInternal() {} + union { + SharingLog_ParsingFailedEndpointId _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ParsingFailedEndpointIdDefaultTypeInternal _SharingLog_ParsingFailedEndpointId_default_instance_; +constexpr SharingLog_DescribeAttachments::SharingLog_DescribeAttachments( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : attachments_info_(nullptr){} +struct SharingLog_DescribeAttachmentsDefaultTypeInternal { + constexpr SharingLog_DescribeAttachmentsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DescribeAttachmentsDefaultTypeInternal() {} + union { + SharingLog_DescribeAttachments _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DescribeAttachmentsDefaultTypeInternal _SharingLog_DescribeAttachments_default_instance_; +constexpr SharingLog_SendIntroduction::SharingLog_SendIntroduction( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : share_target_info_(nullptr) + , session_id_(int64_t{0}) + , transfer_position_(0) + , concurrent_connections_(0){} +struct SharingLog_SendIntroductionDefaultTypeInternal { + constexpr SharingLog_SendIntroductionDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendIntroductionDefaultTypeInternal() {} + union { + SharingLog_SendIntroduction _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendIntroductionDefaultTypeInternal _SharingLog_SendIntroduction_default_instance_; +constexpr SharingLog_ReceiveIntroduction::SharingLog_ReceiveIntroduction( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , share_target_info_(nullptr) + , session_id_(int64_t{0}){} +struct SharingLog_ReceiveIntroductionDefaultTypeInternal { + constexpr SharingLog_ReceiveIntroductionDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ReceiveIntroductionDefaultTypeInternal() {} + union { + SharingLog_ReceiveIntroduction _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ReceiveIntroductionDefaultTypeInternal _SharingLog_ReceiveIntroduction_default_instance_; +constexpr SharingLog_RespondToIntroduction::SharingLog_RespondToIntroduction( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : session_id_(int64_t{0}) + , action_(0) + + , qr_code_flow_(false){} +struct SharingLog_RespondToIntroductionDefaultTypeInternal { + constexpr SharingLog_RespondToIntroductionDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_RespondToIntroductionDefaultTypeInternal() {} + union { + SharingLog_RespondToIntroduction _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_RespondToIntroductionDefaultTypeInternal _SharingLog_RespondToIntroduction_default_instance_; +constexpr SharingLog_SendAttachmentsStart::SharingLog_SendAttachmentsStart( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : attachments_info_(nullptr) + , session_id_(int64_t{0}) + , transfer_position_(0) + , concurrent_connections_(0) + , qr_code_flow_(false){} +struct SharingLog_SendAttachmentsStartDefaultTypeInternal { + constexpr SharingLog_SendAttachmentsStartDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendAttachmentsStartDefaultTypeInternal() {} + union { + SharingLog_SendAttachmentsStart _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendAttachmentsStartDefaultTypeInternal _SharingLog_SendAttachmentsStart_default_instance_; +constexpr SharingLog_SendAttachmentsEnd::SharingLog_SendAttachmentsEnd( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , attachments_info_(nullptr) + , share_target_info_(nullptr) + , session_id_(int64_t{0}) + , sent_bytes_(int64_t{0}) + , status_(0) + + , transfer_position_(0) + , duration_millis_(int64_t{0}) + , concurrent_connections_(0) + , connection_layer_status_(0) +{} +struct SharingLog_SendAttachmentsEndDefaultTypeInternal { + constexpr SharingLog_SendAttachmentsEndDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendAttachmentsEndDefaultTypeInternal() {} + union { + SharingLog_SendAttachmentsEnd _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendAttachmentsEndDefaultTypeInternal _SharingLog_SendAttachmentsEnd_default_instance_; +constexpr SharingLog_ReceiveAttachmentsStart::SharingLog_ReceiveAttachmentsStart( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : attachments_info_(nullptr) + , share_target_info_(nullptr) + , session_id_(int64_t{0}){} +struct SharingLog_ReceiveAttachmentsStartDefaultTypeInternal { + constexpr SharingLog_ReceiveAttachmentsStartDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ReceiveAttachmentsStartDefaultTypeInternal() {} + union { + SharingLog_ReceiveAttachmentsStart _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ReceiveAttachmentsStartDefaultTypeInternal _SharingLog_ReceiveAttachmentsStart_default_instance_; +constexpr SharingLog_ReceiveAttachmentsEnd::SharingLog_ReceiveAttachmentsEnd( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , share_target_info_(nullptr) + , session_id_(int64_t{0}) + , received_bytes_(int64_t{0}) + , status_(0) +{} +struct SharingLog_ReceiveAttachmentsEndDefaultTypeInternal { + constexpr SharingLog_ReceiveAttachmentsEndDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ReceiveAttachmentsEndDefaultTypeInternal() {} + union { + SharingLog_ReceiveAttachmentsEnd _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ReceiveAttachmentsEndDefaultTypeInternal _SharingLog_ReceiveAttachmentsEnd_default_instance_; +constexpr SharingLog_CancelConnection::SharingLog_CancelConnection( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : session_id_(int64_t{0}) + , transfer_position_(0) + , concurrent_connections_(0){} +struct SharingLog_CancelConnectionDefaultTypeInternal { + constexpr SharingLog_CancelConnectionDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_CancelConnectionDefaultTypeInternal() {} + union { + SharingLog_CancelConnection _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_CancelConnectionDefaultTypeInternal _SharingLog_CancelConnection_default_instance_; +constexpr SharingLog_CancelSendingAttachments::SharingLog_CancelSendingAttachments( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_CancelSendingAttachmentsDefaultTypeInternal { + constexpr SharingLog_CancelSendingAttachmentsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_CancelSendingAttachmentsDefaultTypeInternal() {} + union { + SharingLog_CancelSendingAttachments _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_CancelSendingAttachmentsDefaultTypeInternal _SharingLog_CancelSendingAttachments_default_instance_; +constexpr SharingLog_CancelReceivingAttachments::SharingLog_CancelReceivingAttachments( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_CancelReceivingAttachmentsDefaultTypeInternal { + constexpr SharingLog_CancelReceivingAttachmentsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_CancelReceivingAttachmentsDefaultTypeInternal() {} + union { + SharingLog_CancelReceivingAttachments _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_CancelReceivingAttachmentsDefaultTypeInternal _SharingLog_CancelReceivingAttachments_default_instance_; +constexpr SharingLog_ProcessReceivedAttachmentsEnd::SharingLog_ProcessReceivedAttachmentsEnd( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : session_id_(int64_t{0}) + , status_(0) +{} +struct SharingLog_ProcessReceivedAttachmentsEndDefaultTypeInternal { + constexpr SharingLog_ProcessReceivedAttachmentsEndDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ProcessReceivedAttachmentsEndDefaultTypeInternal() {} + union { + SharingLog_ProcessReceivedAttachmentsEnd _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ProcessReceivedAttachmentsEndDefaultTypeInternal _SharingLog_ProcessReceivedAttachmentsEnd_default_instance_; +constexpr SharingLog_OpenReceivedAttachments::SharingLog_OpenReceivedAttachments( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : attachments_info_(nullptr) + , session_id_(int64_t{0}){} +struct SharingLog_OpenReceivedAttachmentsDefaultTypeInternal { + constexpr SharingLog_OpenReceivedAttachmentsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_OpenReceivedAttachmentsDefaultTypeInternal() {} + union { + SharingLog_OpenReceivedAttachments _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_OpenReceivedAttachmentsDefaultTypeInternal _SharingLog_OpenReceivedAttachments_default_instance_; +constexpr SharingLog_LaunchSetupActivity::SharingLog_LaunchSetupActivity( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_LaunchSetupActivityDefaultTypeInternal { + constexpr SharingLog_LaunchSetupActivityDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_LaunchSetupActivityDefaultTypeInternal() {} + union { + SharingLog_LaunchSetupActivity _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_LaunchSetupActivityDefaultTypeInternal _SharingLog_LaunchSetupActivity_default_instance_; +constexpr SharingLog_AddContact::SharingLog_AddContact( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : was_phone_added_(false) + , was_email_added_(false){} +struct SharingLog_AddContactDefaultTypeInternal { + constexpr SharingLog_AddContactDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AddContactDefaultTypeInternal() {} + union { + SharingLog_AddContact _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AddContactDefaultTypeInternal _SharingLog_AddContact_default_instance_; +constexpr SharingLog_RemoveContact::SharingLog_RemoveContact( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : was_phone_removed_(false) + , was_email_removed_(false){} +struct SharingLog_RemoveContactDefaultTypeInternal { + constexpr SharingLog_RemoveContactDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_RemoveContactDefaultTypeInternal() {} + union { + SharingLog_RemoveContact _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_RemoveContactDefaultTypeInternal _SharingLog_RemoveContact_default_instance_; +constexpr SharingLog_FastShareServerResponse::SharingLog_FastShareServerResponse( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : status_(0) + + , name_(0) + + , latency_millis_(int64_t{0}) + , purpose_(0) + + , requester_(0) + + , device_type_(0) +{} +struct SharingLog_FastShareServerResponseDefaultTypeInternal { + constexpr SharingLog_FastShareServerResponseDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_FastShareServerResponseDefaultTypeInternal() {} + union { + SharingLog_FastShareServerResponse _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_FastShareServerResponseDefaultTypeInternal _SharingLog_FastShareServerResponse_default_instance_; +constexpr SharingLog_SendStart::SharingLog_SendStart( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : share_target_info_(nullptr) + , session_id_(int64_t{0}) + , transfer_position_(0) + , concurrent_connections_(0){} +struct SharingLog_SendStartDefaultTypeInternal { + constexpr SharingLog_SendStartDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendStartDefaultTypeInternal() {} + union { + SharingLog_SendStart _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendStartDefaultTypeInternal _SharingLog_SendStart_default_instance_; +constexpr SharingLog_AcceptFastInitialization::SharingLog_AcceptFastInitialization( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_AcceptFastInitializationDefaultTypeInternal { + constexpr SharingLog_AcceptFastInitializationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AcceptFastInitializationDefaultTypeInternal() {} + union { + SharingLog_AcceptFastInitialization _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AcceptFastInitializationDefaultTypeInternal _SharingLog_AcceptFastInitialization_default_instance_; +constexpr SharingLog_LaunchActivity::SharingLog_LaunchActivity( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : referrer_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , duration_millis_(int64_t{0}) + , activity_name_(0) + + , previous_transfer_in_progress_(false) + , has_opted_in_(false) + , is_finishing_(false) + , source_activity_name_(0) +{} +struct SharingLog_LaunchActivityDefaultTypeInternal { + constexpr SharingLog_LaunchActivityDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_LaunchActivityDefaultTypeInternal() {} + union { + SharingLog_LaunchActivity _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_LaunchActivityDefaultTypeInternal _SharingLog_LaunchActivity_default_instance_; +constexpr SharingLog_DismissPrivacyNotification::SharingLog_DismissPrivacyNotification( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_DismissPrivacyNotificationDefaultTypeInternal { + constexpr SharingLog_DismissPrivacyNotificationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DismissPrivacyNotificationDefaultTypeInternal() {} + union { + SharingLog_DismissPrivacyNotification _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DismissPrivacyNotificationDefaultTypeInternal _SharingLog_DismissPrivacyNotification_default_instance_; +constexpr SharingLog_TapPrivacyNotification::SharingLog_TapPrivacyNotification( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_TapPrivacyNotificationDefaultTypeInternal { + constexpr SharingLog_TapPrivacyNotificationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TapPrivacyNotificationDefaultTypeInternal() {} + union { + SharingLog_TapPrivacyNotification _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TapPrivacyNotificationDefaultTypeInternal _SharingLog_TapPrivacyNotification_default_instance_; +constexpr SharingLog_TapHelp::SharingLog_TapHelp( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_TapHelpDefaultTypeInternal { + constexpr SharingLog_TapHelpDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TapHelpDefaultTypeInternal() {} + union { + SharingLog_TapHelp _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TapHelpDefaultTypeInternal _SharingLog_TapHelp_default_instance_; +constexpr SharingLog_TapFeedback::SharingLog_TapFeedback( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_TapFeedbackDefaultTypeInternal { + constexpr SharingLog_TapFeedbackDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TapFeedbackDefaultTypeInternal() {} + union { + SharingLog_TapFeedback _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TapFeedbackDefaultTypeInternal _SharingLog_TapFeedback_default_instance_; +constexpr SharingLog_AddQuickSettingsTile::SharingLog_AddQuickSettingsTile( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_AddQuickSettingsTileDefaultTypeInternal { + constexpr SharingLog_AddQuickSettingsTileDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AddQuickSettingsTileDefaultTypeInternal() {} + union { + SharingLog_AddQuickSettingsTile _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AddQuickSettingsTileDefaultTypeInternal _SharingLog_AddQuickSettingsTile_default_instance_; +constexpr SharingLog_RemoveQuickSettingsTile::SharingLog_RemoveQuickSettingsTile( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_RemoveQuickSettingsTileDefaultTypeInternal { + constexpr SharingLog_RemoveQuickSettingsTileDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_RemoveQuickSettingsTileDefaultTypeInternal() {} + union { + SharingLog_RemoveQuickSettingsTile _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_RemoveQuickSettingsTileDefaultTypeInternal _SharingLog_RemoveQuickSettingsTile_default_instance_; +constexpr SharingLog_LaunchPhoneConsent::SharingLog_LaunchPhoneConsent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_LaunchPhoneConsentDefaultTypeInternal { + constexpr SharingLog_LaunchPhoneConsentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_LaunchPhoneConsentDefaultTypeInternal() {} + union { + SharingLog_LaunchPhoneConsent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_LaunchPhoneConsentDefaultTypeInternal _SharingLog_LaunchPhoneConsent_default_instance_; +constexpr SharingLog_DisplayPhoneConsent::SharingLog_DisplayPhoneConsent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_DisplayPhoneConsentDefaultTypeInternal { + constexpr SharingLog_DisplayPhoneConsentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DisplayPhoneConsentDefaultTypeInternal() {} + union { + SharingLog_DisplayPhoneConsent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DisplayPhoneConsentDefaultTypeInternal _SharingLog_DisplayPhoneConsent_default_instance_; +constexpr SharingLog_TapQuickSettingsTile::SharingLog_TapQuickSettingsTile( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_TapQuickSettingsTileDefaultTypeInternal { + constexpr SharingLog_TapQuickSettingsTileDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TapQuickSettingsTileDefaultTypeInternal() {} + union { + SharingLog_TapQuickSettingsTile _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TapQuickSettingsTileDefaultTypeInternal _SharingLog_TapQuickSettingsTile_default_instance_; +constexpr SharingLog_TapQuickSettingsFileShare::SharingLog_TapQuickSettingsFileShare( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_TapQuickSettingsFileShareDefaultTypeInternal { + constexpr SharingLog_TapQuickSettingsFileShareDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TapQuickSettingsFileShareDefaultTypeInternal() {} + union { + SharingLog_TapQuickSettingsFileShare _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TapQuickSettingsFileShareDefaultTypeInternal _SharingLog_TapQuickSettingsFileShare_default_instance_; +constexpr SharingLog_DisplayPrivacyNotification::SharingLog_DisplayPrivacyNotification( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_DisplayPrivacyNotificationDefaultTypeInternal { + constexpr SharingLog_DisplayPrivacyNotificationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DisplayPrivacyNotificationDefaultTypeInternal() {} + union { + SharingLog_DisplayPrivacyNotification _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DisplayPrivacyNotificationDefaultTypeInternal _SharingLog_DisplayPrivacyNotification_default_instance_; +constexpr SharingLog_DefaultOptIn::SharingLog_DefaultOptIn( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_DefaultOptInDefaultTypeInternal { + constexpr SharingLog_DefaultOptInDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DefaultOptInDefaultTypeInternal() {} + union { + SharingLog_DefaultOptIn _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DefaultOptInDefaultTypeInternal _SharingLog_DefaultOptIn_default_instance_; +constexpr SharingLog_SetDeviceName::SharingLog_SetDeviceName( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : device_name_size_(0){} +struct SharingLog_SetDeviceNameDefaultTypeInternal { + constexpr SharingLog_SetDeviceNameDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SetDeviceNameDefaultTypeInternal() {} + union { + SharingLog_SetDeviceName _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SetDeviceNameDefaultTypeInternal _SharingLog_SetDeviceName_default_instance_; +constexpr SharingLog_RequestSettingPermissions::SharingLog_RequestSettingPermissions( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : permission_type_(0) + + , permission_request_result_(0) +{} +struct SharingLog_RequestSettingPermissionsDefaultTypeInternal { + constexpr SharingLog_RequestSettingPermissionsDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_RequestSettingPermissionsDefaultTypeInternal() {} + union { + SharingLog_RequestSettingPermissions _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_RequestSettingPermissionsDefaultTypeInternal _SharingLog_RequestSettingPermissions_default_instance_; +constexpr SharingLog_LaunchConsent::SharingLog_LaunchConsent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : consent_type_(0) + + , status_(0) +{} +struct SharingLog_LaunchConsentDefaultTypeInternal { + constexpr SharingLog_LaunchConsentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_LaunchConsentDefaultTypeInternal() {} + union { + SharingLog_LaunchConsent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_LaunchConsentDefaultTypeInternal _SharingLog_LaunchConsent_default_instance_; +constexpr SharingLog_InstallAPKStatus::SharingLog_InstallAPKStatus( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : status_() + , _status_cached_byte_size_(0) + , source_() + , _source_cached_byte_size_(0){} +struct SharingLog_InstallAPKStatusDefaultTypeInternal { + constexpr SharingLog_InstallAPKStatusDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_InstallAPKStatusDefaultTypeInternal() {} + union { + SharingLog_InstallAPKStatus _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_InstallAPKStatusDefaultTypeInternal _SharingLog_InstallAPKStatus_default_instance_; +constexpr SharingLog_VerifyAPKStatus::SharingLog_VerifyAPKStatus( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : status_() + , _status_cached_byte_size_(0) + , source_() + , _source_cached_byte_size_(0){} +struct SharingLog_VerifyAPKStatusDefaultTypeInternal { + constexpr SharingLog_VerifyAPKStatusDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_VerifyAPKStatusDefaultTypeInternal() {} + union { + SharingLog_VerifyAPKStatus _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_VerifyAPKStatusDefaultTypeInternal _SharingLog_VerifyAPKStatus_default_instance_; +constexpr SharingLog_ToggleShowNotification::SharingLog_ToggleShowNotification( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : previous_status_(0) + + , current_status_(0) +{} +struct SharingLog_ToggleShowNotificationDefaultTypeInternal { + constexpr SharingLog_ToggleShowNotificationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ToggleShowNotificationDefaultTypeInternal() {} + union { + SharingLog_ToggleShowNotification _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ToggleShowNotificationDefaultTypeInternal _SharingLog_ToggleShowNotification_default_instance_; +constexpr SharingLog_DecryptCertificateFailure::SharingLog_DecryptCertificateFailure( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : status_(0) +{} +struct SharingLog_DecryptCertificateFailureDefaultTypeInternal { + constexpr SharingLog_DecryptCertificateFailureDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_DecryptCertificateFailureDefaultTypeInternal() {} + union { + SharingLog_DecryptCertificateFailure _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_DecryptCertificateFailureDefaultTypeInternal _SharingLog_DecryptCertificateFailure_default_instance_; +constexpr SharingLog_ShowAllowPermissionAutoAccess::SharingLog_ShowAllowPermissionAutoAccess( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : activity_name_(0) + + , allowed_auto_access_(false) + , is_wifi_missing_(false) + , is_bt_missing_(false){} +struct SharingLog_ShowAllowPermissionAutoAccessDefaultTypeInternal { + constexpr SharingLog_ShowAllowPermissionAutoAccessDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ShowAllowPermissionAutoAccessDefaultTypeInternal() {} + union { + SharingLog_ShowAllowPermissionAutoAccess _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ShowAllowPermissionAutoAccessDefaultTypeInternal _SharingLog_ShowAllowPermissionAutoAccess_default_instance_; +constexpr SharingLog_TapQrCode::SharingLog_TapQrCode( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_TapQrCodeDefaultTypeInternal { + constexpr SharingLog_TapQrCodeDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TapQrCodeDefaultTypeInternal() {} + union { + SharingLog_TapQrCode _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TapQrCodeDefaultTypeInternal _SharingLog_TapQrCode_default_instance_; +constexpr SharingLog_QrCodeLinkShown::SharingLog_QrCodeLinkShown( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} +struct SharingLog_QrCodeLinkShownDefaultTypeInternal { + constexpr SharingLog_QrCodeLinkShownDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_QrCodeLinkShownDefaultTypeInternal() {} + union { + SharingLog_QrCodeLinkShown _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_QrCodeLinkShownDefaultTypeInternal _SharingLog_QrCodeLinkShown_default_instance_; +constexpr SharingLog_FastInitDiscoverDevice::SharingLog_FastInitDiscoverDevice( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : fast_init_type_(0) + + , fast_init_state_(0) +{} +struct SharingLog_FastInitDiscoverDeviceDefaultTypeInternal { + constexpr SharingLog_FastInitDiscoverDeviceDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_FastInitDiscoverDeviceDefaultTypeInternal() {} + union { + SharingLog_FastInitDiscoverDevice _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_FastInitDiscoverDeviceDefaultTypeInternal _SharingLog_FastInitDiscoverDevice_default_instance_; +constexpr SharingLog_ShareTargetInfo::SharingLog_ShareTargetInfo( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : device_type_(0) + + , os_type_(0) + + , device_relationship_(0) +{} +struct SharingLog_ShareTargetInfoDefaultTypeInternal { + constexpr SharingLog_ShareTargetInfoDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_ShareTargetInfoDefaultTypeInternal() {} + union { + SharingLog_ShareTargetInfo _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_ShareTargetInfoDefaultTypeInternal _SharingLog_ShareTargetInfo_default_instance_; +constexpr SharingLog_AttachmentsInfo::SharingLog_AttachmentsInfo( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : text_attachment_() + , file_attachment_() + , wifi_credentials_attachment_() + , app_attachment_() + , stream_attachment_() + , required_app_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} +struct SharingLog_AttachmentsInfoDefaultTypeInternal { + constexpr SharingLog_AttachmentsInfoDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AttachmentsInfoDefaultTypeInternal() {} + union { + SharingLog_AttachmentsInfo _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AttachmentsInfoDefaultTypeInternal _SharingLog_AttachmentsInfo_default_instance_; +constexpr SharingLog_TextAttachment::SharingLog_TextAttachment( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : size_bytes_(int64_t{0}) + , type_(0) + + , source_type_(0) + + , batch_id_(int64_t{0}){} +struct SharingLog_TextAttachmentDefaultTypeInternal { + constexpr SharingLog_TextAttachmentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_TextAttachmentDefaultTypeInternal() {} + union { + SharingLog_TextAttachment _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_TextAttachmentDefaultTypeInternal _SharingLog_TextAttachment_default_instance_; +constexpr SharingLog_FileAttachment::SharingLog_FileAttachment( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : size_bytes_(int64_t{0}) + , type_(0) + + , source_type_(0) + + , offset_bytes_(int64_t{0}) + , batch_id_(int64_t{0}){} +struct SharingLog_FileAttachmentDefaultTypeInternal { + constexpr SharingLog_FileAttachmentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_FileAttachmentDefaultTypeInternal() {} + union { + SharingLog_FileAttachment _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_FileAttachmentDefaultTypeInternal _SharingLog_FileAttachment_default_instance_; +constexpr SharingLog_WifiCredentialsAttachment::SharingLog_WifiCredentialsAttachment( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : batch_id_(int64_t{0}) + , security_type_(0) + , source_type_(0) +{} +struct SharingLog_WifiCredentialsAttachmentDefaultTypeInternal { + constexpr SharingLog_WifiCredentialsAttachmentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_WifiCredentialsAttachmentDefaultTypeInternal() {} + union { + SharingLog_WifiCredentialsAttachment _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_WifiCredentialsAttachmentDefaultTypeInternal _SharingLog_WifiCredentialsAttachment_default_instance_; +constexpr SharingLog_AppAttachment::SharingLog_AppAttachment( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : package_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , size_(int64_t{0}) + , batch_id_(int64_t{0}) + , source_type_(0) +{} +struct SharingLog_AppAttachmentDefaultTypeInternal { + constexpr SharingLog_AppAttachmentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AppAttachmentDefaultTypeInternal() {} + union { + SharingLog_AppAttachment _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AppAttachmentDefaultTypeInternal _SharingLog_AppAttachment_default_instance_; +constexpr SharingLog_StreamAttachment::SharingLog_StreamAttachment( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : package_name_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , batch_id_(int64_t{0}) + , source_type_(0) +{} +struct SharingLog_StreamAttachmentDefaultTypeInternal { + constexpr SharingLog_StreamAttachmentDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_StreamAttachmentDefaultTypeInternal() {} + union { + SharingLog_StreamAttachment _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_StreamAttachmentDefaultTypeInternal _SharingLog_StreamAttachment_default_instance_; +constexpr SharingLog_AppCrash::SharingLog_AppCrash( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : crash_reason_(0) +{} +struct SharingLog_AppCrashDefaultTypeInternal { + constexpr SharingLog_AppCrashDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_AppCrashDefaultTypeInternal() {} + union { + SharingLog_AppCrash _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_AppCrashDefaultTypeInternal _SharingLog_AppCrash_default_instance_; +constexpr SharingLog_SetupWizard::SharingLog_SetupWizard( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : visibility_(0) +{} +struct SharingLog_SetupWizardDefaultTypeInternal { + constexpr SharingLog_SetupWizardDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SetupWizardDefaultTypeInternal() {} + union { + SharingLog_SetupWizard _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SetupWizardDefaultTypeInternal _SharingLog_SetupWizard_default_instance_; +constexpr SharingLog_SendDesktopNotification::SharingLog_SendDesktopNotification( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : event_(0) +{} +struct SharingLog_SendDesktopNotificationDefaultTypeInternal { + constexpr SharingLog_SendDesktopNotificationDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendDesktopNotificationDefaultTypeInternal() {} + union { + SharingLog_SendDesktopNotification _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendDesktopNotificationDefaultTypeInternal _SharingLog_SendDesktopNotification_default_instance_; +constexpr SharingLog_SendDesktopTransferEvent::SharingLog_SendDesktopTransferEvent( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : event_(0) +{} +struct SharingLog_SendDesktopTransferEventDefaultTypeInternal { + constexpr SharingLog_SendDesktopTransferEventDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLog_SendDesktopTransferEventDefaultTypeInternal() {} + union { + SharingLog_SendDesktopTransferEvent _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLog_SendDesktopTransferEventDefaultTypeInternal _SharingLog_SendDesktopTransferEvent_default_instance_; +constexpr SharingLog::SharingLog( + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) + : version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , files_migration_phase_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , app_version_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) + , unknown_event_(nullptr) + , accept_agreements_(nullptr) + , enable_nearby_sharing_(nullptr) + , set_visibility_(nullptr) + , describe_attachments_(nullptr) + , scan_for_share_targets_start_(nullptr) + , scan_for_share_targets_end_(nullptr) + , advertise_device_presence_start_(nullptr) + , advertise_device_presence_end_(nullptr) + , send_initialization_(nullptr) + , receive_initialization_(nullptr) + , discover_share_target_(nullptr) + , send_introduction_(nullptr) + , receive_introduction_(nullptr) + , respond_introduction_(nullptr) + , send_attachments_start_(nullptr) + , send_attachments_end_(nullptr) + , receive_attachments_start_(nullptr) + , receive_attachments_end_(nullptr) + , cancel_sending_attachments_(nullptr) + , cancel_receiving_attachments_(nullptr) + , open_received_attachments_(nullptr) + , launch_activity_(nullptr) + , add_contact_(nullptr) + , remove_contact_(nullptr) + , fast_share_server_response_(nullptr) + , send_start_(nullptr) + , accept_fast_initialization_(nullptr) + , set_data_usage_(nullptr) + , dismiss_fast_initialization_(nullptr) + , cancel_connection_(nullptr) + , dismiss_privacy_notification_(nullptr) + , tap_privacy_notification_(nullptr) + , tap_help_(nullptr) + , tap_feedback_(nullptr) + , add_quick_settings_tile_(nullptr) + , remove_quick_settings_tile_(nullptr) + , launch_phone_consent_(nullptr) + , tap_quick_settings_tile_(nullptr) + , install_apk_status_(nullptr) + , verify_apk_status_(nullptr) + , launch_consent_(nullptr) + , process_received_attachments_end_(nullptr) + , toggle_show_notification_(nullptr) + , set_device_name_(nullptr) + , decline_agreements_(nullptr) + , request_setting_permissions_(nullptr) + , device_settings_(nullptr) + , establish_connection_(nullptr) + , auto_dismiss_fast_initialization_(nullptr) + , event_metadata_(nullptr) + , app_crash_(nullptr) + , tap_quick_settings_file_share_(nullptr) + , app_info_(nullptr) + , display_privacy_notification_(nullptr) + , display_phone_consent_(nullptr) + , preferences_usage_(nullptr) + , default_opt_in_(nullptr) + , setup_wizard_(nullptr) + , tap_qr_code_(nullptr) + , qr_code_link_shown_(nullptr) + , parsing_failed_endpoint_id_(nullptr) + , fast_init_discover_device_(nullptr) + , send_desktop_notification_(nullptr) + , send_desktop_transfer_event_(nullptr) + , set_account_(nullptr) + , decrypt_certificate_failure_(nullptr) + , show_allow_permission_auto_access_(nullptr) + , event_type_(0) + + , log_source_(0) + + , event_category_(0) +{} +struct SharingLogDefaultTypeInternal { + constexpr SharingLogDefaultTypeInternal() + : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} + ~SharingLogDefaultTypeInternal() {} + union { + SharingLog _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SharingLogDefaultTypeInternal _SharingLog_default_instance_; +} // namespace proto +} // namespace analytics +} // namespace sharing +} // namespace nearby +namespace nearby { +namespace sharing { +namespace analytics { +namespace proto { +bool SharingLog_TextAttachment_Type_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed SharingLog_TextAttachment_Type_strings[4] = {}; + +static const char SharingLog_TextAttachment_Type_names[] = + "ADDRESS" + "PHONE_NUMBER" + "UNKNOWN_TEXT_TYPE" + "URL"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry SharingLog_TextAttachment_Type_entries[] = { + { {SharingLog_TextAttachment_Type_names + 0, 7}, 2 }, + { {SharingLog_TextAttachment_Type_names + 7, 12}, 3 }, + { {SharingLog_TextAttachment_Type_names + 19, 17}, 0 }, + { {SharingLog_TextAttachment_Type_names + 36, 3}, 1 }, +}; + +static const int SharingLog_TextAttachment_Type_entries_by_number[] = { + 2, // 0 -> UNKNOWN_TEXT_TYPE + 3, // 1 -> URL + 0, // 2 -> ADDRESS + 1, // 3 -> PHONE_NUMBER +}; + +const std::string& SharingLog_TextAttachment_Type_Name( + SharingLog_TextAttachment_Type value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + SharingLog_TextAttachment_Type_entries, + SharingLog_TextAttachment_Type_entries_by_number, + 4, SharingLog_TextAttachment_Type_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + SharingLog_TextAttachment_Type_entries, + SharingLog_TextAttachment_Type_entries_by_number, + 4, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + SharingLog_TextAttachment_Type_strings[idx].get(); +} +bool SharingLog_TextAttachment_Type_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SharingLog_TextAttachment_Type* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + SharingLog_TextAttachment_Type_entries, 4, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment::UNKNOWN_TEXT_TYPE; +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment::URL; +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment::ADDRESS; +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment::PHONE_NUMBER; +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment::Type_MIN; +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment::Type_MAX; +constexpr int SharingLog_TextAttachment::Type_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +bool SharingLog_FileAttachment_Type_IsValid(int value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return true; + default: + return false; + } +} + +static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed SharingLog_FileAttachment_Type_strings[6] = {}; + +static const char SharingLog_FileAttachment_Type_names[] = + "ANDROID_APP" + "AUDIO" + "DOCUMENT" + "IMAGE" + "UNKNOWN_FILE_TYPE" + "VIDEO"; + +static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry SharingLog_FileAttachment_Type_entries[] = { + { {SharingLog_FileAttachment_Type_names + 0, 11}, 3 }, + { {SharingLog_FileAttachment_Type_names + 11, 5}, 4 }, + { {SharingLog_FileAttachment_Type_names + 16, 8}, 5 }, + { {SharingLog_FileAttachment_Type_names + 24, 5}, 1 }, + { {SharingLog_FileAttachment_Type_names + 29, 17}, 0 }, + { {SharingLog_FileAttachment_Type_names + 46, 5}, 2 }, +}; + +static const int SharingLog_FileAttachment_Type_entries_by_number[] = { + 4, // 0 -> UNKNOWN_FILE_TYPE + 3, // 1 -> IMAGE + 5, // 2 -> VIDEO + 0, // 3 -> ANDROID_APP + 1, // 4 -> AUDIO + 2, // 5 -> DOCUMENT +}; + +const std::string& SharingLog_FileAttachment_Type_Name( + SharingLog_FileAttachment_Type value) { + static const bool dummy = + ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings( + SharingLog_FileAttachment_Type_entries, + SharingLog_FileAttachment_Type_entries_by_number, + 6, SharingLog_FileAttachment_Type_strings); + (void) dummy; + int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName( + SharingLog_FileAttachment_Type_entries, + SharingLog_FileAttachment_Type_entries_by_number, + 6, value); + return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() : + SharingLog_FileAttachment_Type_strings[idx].get(); +} +bool SharingLog_FileAttachment_Type_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SharingLog_FileAttachment_Type* value) { + int int_value; + bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue( + SharingLog_FileAttachment_Type_entries, 6, name, &int_value); + if (success) { + *value = static_cast(int_value); + } + return success; +} +#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::UNKNOWN_FILE_TYPE; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::IMAGE; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::VIDEO; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::ANDROID_APP; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::AUDIO; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::DOCUMENT; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::Type_MIN; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment::Type_MAX; +constexpr int SharingLog_FileAttachment::Type_ARRAYSIZE; +#endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)) + +// =================================================================== + +class SharingLog_AppInfo::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_app_version(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_app_language(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_update_track(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_AppInfo::SharingLog_AppInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AppInfo) +} +SharingLog_AppInfo::SharingLog_AppInfo(const SharingLog_AppInfo& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + app_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_app_version()) { + app_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_app_version(), + GetArenaForAllocation()); + } + app_language_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + app_language_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_app_language()) { + app_language_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_app_language(), + GetArenaForAllocation()); + } + update_track_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + update_track_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_update_track()) { + update_track_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_update_track(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AppInfo) +} + +inline void SharingLog_AppInfo::SharedCtor() { +app_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +app_language_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + app_language_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +update_track_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + update_track_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +SharingLog_AppInfo::~SharingLog_AppInfo() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AppInfo) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AppInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + app_version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + app_language_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + update_track_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_AppInfo::ArenaDtor(void* object) { + SharingLog_AppInfo* _this = reinterpret_cast< SharingLog_AppInfo* >(object); + (void)_this; +} +void SharingLog_AppInfo::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AppInfo::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AppInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AppInfo) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + app_version_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + app_language_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + update_track_.ClearNonDefaultToEmpty(); + } + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AppInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string app_version = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_app_version(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string app_language = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + auto str = _internal_mutable_app_language(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string update_track = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_update_track(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AppInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AppInfo) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional string app_version = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_app_version(), target); + } + + // optional string app_language = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 2, this->_internal_app_language(), target); + } + + // optional string update_track = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_update_track(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AppInfo) + return target; +} + +size_t SharingLog_AppInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AppInfo) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional string app_version = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_app_version()); + } + + // optional string app_language = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_app_language()); + } + + // optional string update_track = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_update_track()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AppInfo::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AppInfo::MergeFrom(const SharingLog_AppInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AppInfo) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_app_version(from._internal_app_version()); + } + if (cached_has_bits & 0x00000002u) { + _internal_set_app_language(from._internal_app_language()); + } + if (cached_has_bits & 0x00000004u) { + _internal_set_update_track(from._internal_update_track()); + } + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AppInfo::CopyFrom(const SharingLog_AppInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AppInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AppInfo::IsInitialized() const { + return true; +} + +void SharingLog_AppInfo::InternalSwap(SharingLog_AppInfo* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &app_version_, lhs_arena, + &other->app_version_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &app_language_, lhs_arena, + &other->app_language_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &update_track_, lhs_arena, + &other->update_track_, rhs_arena + ); +} + +std::string SharingLog_AppInfo::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AppInfo"; +} + + +// =================================================================== + +class SharingLog_DeviceSettings::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_visibility(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_data_usage(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_device_name_size(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_is_show_notification_enabled(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_is_bt_enabled(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_is_location_enabled(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_is_wifi_enabled(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } +}; + +SharingLog_DeviceSettings::SharingLog_DeviceSettings(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) +} +SharingLog_DeviceSettings::SharingLog_DeviceSettings(const SharingLog_DeviceSettings& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&visibility_, &from.visibility_, + static_cast(reinterpret_cast(&is_wifi_enabled_) - + reinterpret_cast(&visibility_)) + sizeof(is_wifi_enabled_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) +} + +inline void SharingLog_DeviceSettings::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&visibility_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&is_wifi_enabled_) - + reinterpret_cast(&visibility_)) + sizeof(is_wifi_enabled_)); +} + +SharingLog_DeviceSettings::~SharingLog_DeviceSettings() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DeviceSettings::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DeviceSettings::ArenaDtor(void* object) { + SharingLog_DeviceSettings* _this = reinterpret_cast< SharingLog_DeviceSettings* >(object); + (void)_this; +} +void SharingLog_DeviceSettings::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DeviceSettings::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DeviceSettings::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + ::memset(&visibility_, 0, static_cast( + reinterpret_cast(&is_wifi_enabled_) - + reinterpret_cast(&visibility_)) + sizeof(is_wifi_enabled_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_DeviceSettings::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::Visibility_IsValid(val))) { + _internal_set_visibility(static_cast<::location::nearby::proto::sharing::Visibility>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.DataUsage data_usage = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DataUsage_IsValid(val))) { + _internal_set_data_usage(static_cast<::location::nearby::proto::sharing::DataUsage>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 device_name_size = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_device_name_size(&has_bits); + device_name_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_show_notification_enabled = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_is_show_notification_enabled(&has_bits); + is_show_notification_enabled_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_bt_enabled = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_is_bt_enabled(&has_bits); + is_bt_enabled_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_location_enabled = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + _Internal::set_has_is_location_enabled(&has_bits); + is_location_enabled_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_wifi_enabled = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_is_wifi_enabled(&has_bits); + is_wifi_enabled_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DeviceSettings::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_visibility(), target); + } + + // optional .location.nearby.proto.sharing.DataUsage data_usage = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_data_usage(), target); + } + + // optional int32 device_name_size = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_device_name_size(), target); + } + + // optional bool is_show_notification_enabled = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_is_show_notification_enabled(), target); + } + + // optional bool is_bt_enabled = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_is_bt_enabled(), target); + } + + // optional bool is_location_enabled = 6; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->_internal_is_location_enabled(), target); + } + + // optional bool is_wifi_enabled = 7; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(7, this->_internal_is_wifi_enabled(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + return target; +} + +size_t SharingLog_DeviceSettings::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_visibility()); + } + + // optional .location.nearby.proto.sharing.DataUsage data_usage = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_data_usage()); + } + + // optional int32 device_name_size = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_device_name_size()); + } + + // optional bool is_show_notification_enabled = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + 1; + } + + // optional bool is_bt_enabled = 5; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + 1; + } + + // optional bool is_location_enabled = 6; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + 1; + } + + // optional bool is_wifi_enabled = 7; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DeviceSettings::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DeviceSettings::MergeFrom(const SharingLog_DeviceSettings& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + visibility_ = from.visibility_; + } + if (cached_has_bits & 0x00000002u) { + data_usage_ = from.data_usage_; + } + if (cached_has_bits & 0x00000004u) { + device_name_size_ = from.device_name_size_; + } + if (cached_has_bits & 0x00000008u) { + is_show_notification_enabled_ = from.is_show_notification_enabled_; + } + if (cached_has_bits & 0x00000010u) { + is_bt_enabled_ = from.is_bt_enabled_; + } + if (cached_has_bits & 0x00000020u) { + is_location_enabled_ = from.is_location_enabled_; + } + if (cached_has_bits & 0x00000040u) { + is_wifi_enabled_ = from.is_wifi_enabled_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DeviceSettings::CopyFrom(const SharingLog_DeviceSettings& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DeviceSettings::IsInitialized() const { + return true; +} + +void SharingLog_DeviceSettings::InternalSwap(SharingLog_DeviceSettings* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_DeviceSettings, is_wifi_enabled_) + + sizeof(SharingLog_DeviceSettings::is_wifi_enabled_) + - PROTOBUF_FIELD_OFFSET(SharingLog_DeviceSettings, visibility_)>( + reinterpret_cast(&visibility_), + reinterpret_cast(&other->visibility_)); +} + +std::string SharingLog_DeviceSettings::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DeviceSettings"; +} + + +// =================================================================== + +class SharingLog_PreferencesUsage::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_action(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_action_status(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_prev_sub_action(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_next_sub_action(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +SharingLog_PreferencesUsage::SharingLog_PreferencesUsage(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) +} +SharingLog_PreferencesUsage::SharingLog_PreferencesUsage(const SharingLog_PreferencesUsage& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&action_, &from.action_, + static_cast(reinterpret_cast(&next_sub_action_) - + reinterpret_cast(&action_)) + sizeof(next_sub_action_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) +} + +inline void SharingLog_PreferencesUsage::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&action_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&next_sub_action_) - + reinterpret_cast(&action_)) + sizeof(next_sub_action_)); +} + +SharingLog_PreferencesUsage::~SharingLog_PreferencesUsage() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_PreferencesUsage::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_PreferencesUsage::ArenaDtor(void* object) { + SharingLog_PreferencesUsage* _this = reinterpret_cast< SharingLog_PreferencesUsage* >(object); + (void)_this; +} +void SharingLog_PreferencesUsage::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_PreferencesUsage::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_PreferencesUsage::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + ::memset(&action_, 0, static_cast( + reinterpret_cast(&next_sub_action_) - + reinterpret_cast(&action_)) + sizeof(next_sub_action_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_PreferencesUsage::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.PreferencesAction action = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::PreferencesAction_IsValid(val))) { + _internal_set_action(static_cast<::location::nearby::proto::sharing::PreferencesAction>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.PreferencesActionStatus action_status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::PreferencesActionStatus_IsValid(val))) { + _internal_set_action_status(static_cast<::location::nearby::proto::sharing::PreferencesActionStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.PreferencesAction prev_sub_action = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::PreferencesAction_IsValid(val))) { + _internal_set_prev_sub_action(static_cast<::location::nearby::proto::sharing::PreferencesAction>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.PreferencesAction next_sub_action = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::PreferencesAction_IsValid(val))) { + _internal_set_next_sub_action(static_cast<::location::nearby::proto::sharing::PreferencesAction>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_PreferencesUsage::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.PreferencesAction action = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_action(), target); + } + + // optional .location.nearby.proto.sharing.PreferencesActionStatus action_status = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_action_status(), target); + } + + // optional .location.nearby.proto.sharing.PreferencesAction prev_sub_action = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_prev_sub_action(), target); + } + + // optional .location.nearby.proto.sharing.PreferencesAction next_sub_action = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_next_sub_action(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + return target; +} + +size_t SharingLog_PreferencesUsage::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional .location.nearby.proto.sharing.PreferencesAction action = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_action()); + } + + // optional .location.nearby.proto.sharing.PreferencesActionStatus action_status = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_action_status()); + } + + // optional .location.nearby.proto.sharing.PreferencesAction prev_sub_action = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_prev_sub_action()); + } + + // optional .location.nearby.proto.sharing.PreferencesAction next_sub_action = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_next_sub_action()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_PreferencesUsage::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_PreferencesUsage::MergeFrom(const SharingLog_PreferencesUsage& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + action_ = from.action_; + } + if (cached_has_bits & 0x00000002u) { + action_status_ = from.action_status_; + } + if (cached_has_bits & 0x00000004u) { + prev_sub_action_ = from.prev_sub_action_; + } + if (cached_has_bits & 0x00000008u) { + next_sub_action_ = from.next_sub_action_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_PreferencesUsage::CopyFrom(const SharingLog_PreferencesUsage& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_PreferencesUsage::IsInitialized() const { + return true; +} + +void SharingLog_PreferencesUsage::InternalSwap(SharingLog_PreferencesUsage* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_PreferencesUsage, next_sub_action_) + + sizeof(SharingLog_PreferencesUsage::next_sub_action_) + - PROTOBUF_FIELD_OFFSET(SharingLog_PreferencesUsage, action_)>( + reinterpret_cast(&action_), + reinterpret_cast(&other->action_)); +} + +std::string SharingLog_PreferencesUsage::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.PreferencesUsage"; +} + + +// =================================================================== + +class SharingLog_UnknownEvent::_Internal { + public: +}; + +SharingLog_UnknownEvent::SharingLog_UnknownEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) +} +SharingLog_UnknownEvent::SharingLog_UnknownEvent(const SharingLog_UnknownEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) +} + +inline void SharingLog_UnknownEvent::SharedCtor() { +} + +SharingLog_UnknownEvent::~SharingLog_UnknownEvent() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_UnknownEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_UnknownEvent::ArenaDtor(void* object) { + SharingLog_UnknownEvent* _this = reinterpret_cast< SharingLog_UnknownEvent* >(object); + (void)_this; +} +void SharingLog_UnknownEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_UnknownEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_UnknownEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_UnknownEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_UnknownEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + return target; +} + +size_t SharingLog_UnknownEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_UnknownEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_UnknownEvent::MergeFrom(const SharingLog_UnknownEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_UnknownEvent::CopyFrom(const SharingLog_UnknownEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_UnknownEvent::IsInitialized() const { + return true; +} + +void SharingLog_UnknownEvent::InternalSwap(SharingLog_UnknownEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_UnknownEvent::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.UnknownEvent"; +} + + +// =================================================================== + +class SharingLog_EstablishConnection::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_transfer_position(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_concurrent_connections(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_duration_millis(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_EstablishConnection* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_qr_code_flow(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static void set_has_is_incoming_connection(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_EstablishConnection::_Internal::share_target_info(const SharingLog_EstablishConnection* msg) { + return *msg->share_target_info_; +} +SharingLog_EstablishConnection::SharingLog_EstablishConnection(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) +} +SharingLog_EstablishConnection::SharingLog_EstablishConnection(const SharingLog_EstablishConnection& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&is_incoming_connection_) - + reinterpret_cast(&session_id_)) + sizeof(is_incoming_connection_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) +} + +inline void SharingLog_EstablishConnection::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&share_target_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&is_incoming_connection_) - + reinterpret_cast(&share_target_info_)) + sizeof(is_incoming_connection_)); +} + +SharingLog_EstablishConnection::~SharingLog_EstablishConnection() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_EstablishConnection::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_EstablishConnection::ArenaDtor(void* object) { + SharingLog_EstablishConnection* _this = reinterpret_cast< SharingLog_EstablishConnection* >(object); + (void)_this; +} +void SharingLog_EstablishConnection::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_EstablishConnection::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_EstablishConnection::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + } + if (cached_has_bits & 0x000000fcu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + } + is_incoming_connection_ = false; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_EstablishConnection::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.EstablishConnectionStatus status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::EstablishConnectionStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::EstablishConnectionStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 session_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 transfer_position = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_transfer_position(&has_bits); + transfer_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 concurrent_connections = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_concurrent_connections(&has_bits); + concurrent_connections_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 duration_millis = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_duration_millis(&has_bits); + duration_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool qr_code_flow = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 64)) { + _Internal::set_has_qr_code_flow(&has_bits); + qr_code_flow_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_incoming_connection = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) { + _Internal::set_has_is_incoming_connection(&has_bits); + is_incoming_connection_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_EstablishConnection::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.EstablishConnectionStatus status = 1; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_status(), target); + } + + // optional int64 session_id = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_session_id(), target); + } + + // optional int32 transfer_position = 3; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_transfer_position(), target); + } + + // optional int32 concurrent_connections = 4; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_concurrent_connections(), target); + } + + // optional int64 duration_millis = 5; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->_internal_duration_millis(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 6; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 6, _Internal::share_target_info(this), target, stream); + } + + // optional string referrer_name = 7; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 7, this->_internal_referrer_name(), target); + } + + // optional bool qr_code_flow = 8; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_qr_code_flow(), target); + } + + // optional bool is_incoming_connection = 9; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(9, this->_internal_is_incoming_connection(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + return target; +} + +size_t SharingLog_EstablishConnection::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + // optional string referrer_name = 7; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 6; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 2; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional .location.nearby.proto.sharing.EstablishConnectionStatus status = 1; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + // optional int32 transfer_position = 3; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_transfer_position()); + } + + // optional int64 duration_millis = 5; + if (cached_has_bits & 0x00000020u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); + } + + // optional int32 concurrent_connections = 4; + if (cached_has_bits & 0x00000040u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_concurrent_connections()); + } + + // optional bool qr_code_flow = 8; + if (cached_has_bits & 0x00000080u) { + total_size += 1 + 1; + } + + } + // optional bool is_incoming_connection = 9; + if (cached_has_bits & 0x00000100u) { + total_size += 1 + 1; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_EstablishConnection::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_EstablishConnection::MergeFrom(const SharingLog_EstablishConnection& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000004u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000008u) { + status_ = from.status_; + } + if (cached_has_bits & 0x00000010u) { + transfer_position_ = from.transfer_position_; + } + if (cached_has_bits & 0x00000020u) { + duration_millis_ = from.duration_millis_; + } + if (cached_has_bits & 0x00000040u) { + concurrent_connections_ = from.concurrent_connections_; + } + if (cached_has_bits & 0x00000080u) { + qr_code_flow_ = from.qr_code_flow_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x00000100u) { + _internal_set_is_incoming_connection(from._internal_is_incoming_connection()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_EstablishConnection::CopyFrom(const SharingLog_EstablishConnection& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_EstablishConnection::IsInitialized() const { + return true; +} + +void SharingLog_EstablishConnection::InternalSwap(SharingLog_EstablishConnection* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_EstablishConnection, is_incoming_connection_) + + sizeof(SharingLog_EstablishConnection::is_incoming_connection_) + - PROTOBUF_FIELD_OFFSET(SharingLog_EstablishConnection, share_target_info_)>( + reinterpret_cast(&share_target_info_), + reinterpret_cast(&other->share_target_info_)); +} + +std::string SharingLog_EstablishConnection::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.EstablishConnection"; +} + + +// =================================================================== + +class SharingLog_AcceptAgreements::_Internal { + public: +}; + +SharingLog_AcceptAgreements::SharingLog_AcceptAgreements(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) +} +SharingLog_AcceptAgreements::SharingLog_AcceptAgreements(const SharingLog_AcceptAgreements& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) +} + +inline void SharingLog_AcceptAgreements::SharedCtor() { +} + +SharingLog_AcceptAgreements::~SharingLog_AcceptAgreements() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AcceptAgreements::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AcceptAgreements::ArenaDtor(void* object) { + SharingLog_AcceptAgreements* _this = reinterpret_cast< SharingLog_AcceptAgreements* >(object); + (void)_this; +} +void SharingLog_AcceptAgreements::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AcceptAgreements::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AcceptAgreements::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_AcceptAgreements::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AcceptAgreements::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + return target; +} + +size_t SharingLog_AcceptAgreements::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AcceptAgreements::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AcceptAgreements::MergeFrom(const SharingLog_AcceptAgreements& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AcceptAgreements::CopyFrom(const SharingLog_AcceptAgreements& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AcceptAgreements::IsInitialized() const { + return true; +} + +void SharingLog_AcceptAgreements::InternalSwap(SharingLog_AcceptAgreements* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_AcceptAgreements::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AcceptAgreements"; +} + + +// =================================================================== + +class SharingLog_DeclineAgreements::_Internal { + public: +}; + +SharingLog_DeclineAgreements::SharingLog_DeclineAgreements(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) +} +SharingLog_DeclineAgreements::SharingLog_DeclineAgreements(const SharingLog_DeclineAgreements& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) +} + +inline void SharingLog_DeclineAgreements::SharedCtor() { +} + +SharingLog_DeclineAgreements::~SharingLog_DeclineAgreements() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DeclineAgreements::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DeclineAgreements::ArenaDtor(void* object) { + SharingLog_DeclineAgreements* _this = reinterpret_cast< SharingLog_DeclineAgreements* >(object); + (void)_this; +} +void SharingLog_DeclineAgreements::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DeclineAgreements::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DeclineAgreements::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_DeclineAgreements::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DeclineAgreements::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + return target; +} + +size_t SharingLog_DeclineAgreements::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DeclineAgreements::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DeclineAgreements::MergeFrom(const SharingLog_DeclineAgreements& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DeclineAgreements::CopyFrom(const SharingLog_DeclineAgreements& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DeclineAgreements::IsInitialized() const { + return true; +} + +void SharingLog_DeclineAgreements::InternalSwap(SharingLog_DeclineAgreements* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_DeclineAgreements::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DeclineAgreements"; +} + + +// =================================================================== + +class SharingLog_EnableNearbySharing::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_has_opted_in(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_EnableNearbySharing::SharingLog_EnableNearbySharing(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) +} +SharingLog_EnableNearbySharing::SharingLog_EnableNearbySharing(const SharingLog_EnableNearbySharing& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&status_, &from.status_, + static_cast(reinterpret_cast(&has_opted_in_) - + reinterpret_cast(&status_)) + sizeof(has_opted_in_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) +} + +inline void SharingLog_EnableNearbySharing::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&status_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&has_opted_in_) - + reinterpret_cast(&status_)) + sizeof(has_opted_in_)); +} + +SharingLog_EnableNearbySharing::~SharingLog_EnableNearbySharing() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_EnableNearbySharing::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_EnableNearbySharing::ArenaDtor(void* object) { + SharingLog_EnableNearbySharing* _this = reinterpret_cast< SharingLog_EnableNearbySharing* >(object); + (void)_this; +} +void SharingLog_EnableNearbySharing::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_EnableNearbySharing::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_EnableNearbySharing::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&status_, 0, static_cast( + reinterpret_cast(&has_opted_in_) - + reinterpret_cast(&status_)) + sizeof(has_opted_in_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_EnableNearbySharing::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.NearbySharingStatus status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::NearbySharingStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::NearbySharingStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional bool has_opted_in = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_has_opted_in(&has_bits); + has_opted_in_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_EnableNearbySharing::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.NearbySharingStatus status = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_status(), target); + } + + // optional bool has_opted_in = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_has_opted_in(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + return target; +} + +size_t SharingLog_EnableNearbySharing::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.sharing.NearbySharingStatus status = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + // optional bool has_opted_in = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_EnableNearbySharing::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_EnableNearbySharing::MergeFrom(const SharingLog_EnableNearbySharing& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + status_ = from.status_; + } + if (cached_has_bits & 0x00000002u) { + has_opted_in_ = from.has_opted_in_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_EnableNearbySharing::CopyFrom(const SharingLog_EnableNearbySharing& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_EnableNearbySharing::IsInitialized() const { + return true; +} + +void SharingLog_EnableNearbySharing::InternalSwap(SharingLog_EnableNearbySharing* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_EnableNearbySharing, has_opted_in_) + + sizeof(SharingLog_EnableNearbySharing::has_opted_in_) + - PROTOBUF_FIELD_OFFSET(SharingLog_EnableNearbySharing, status_)>( + reinterpret_cast(&status_), + reinterpret_cast(&other->status_)); +} + +std::string SharingLog_EnableNearbySharing::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing"; +} + + +// =================================================================== + +class SharingLog_SetAccount::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_activity_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_SetAccount::SharingLog_SetAccount(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SetAccount) +} +SharingLog_SetAccount::SharingLog_SetAccount(const SharingLog_SetAccount& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + activity_name_ = from.activity_name_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SetAccount) +} + +inline void SharingLog_SetAccount::SharedCtor() { +activity_name_ = 0; +} + +SharingLog_SetAccount::~SharingLog_SetAccount() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SetAccount) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SetAccount::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SetAccount::ArenaDtor(void* object) { + SharingLog_SetAccount* _this = reinterpret_cast< SharingLog_SetAccount* >(object); + (void)_this; +} +void SharingLog_SetAccount::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SetAccount::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SetAccount::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SetAccount) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + activity_name_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SetAccount::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ActivityName_IsValid(val))) { + _internal_set_activity_name(static_cast<::location::nearby::proto::sharing::ActivityName>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SetAccount::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SetAccount) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_activity_name(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SetAccount) + return target; +} + +size_t SharingLog_SetAccount::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SetAccount) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_activity_name()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SetAccount::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SetAccount::MergeFrom(const SharingLog_SetAccount& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SetAccount) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_activity_name()) { + _internal_set_activity_name(from._internal_activity_name()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SetAccount::CopyFrom(const SharingLog_SetAccount& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SetAccount) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SetAccount::IsInitialized() const { + return true; +} + +void SharingLog_SetAccount::InternalSwap(SharingLog_SetAccount* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(activity_name_, other->activity_name_); +} + +std::string SharingLog_SetAccount::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SetAccount"; +} + + +// =================================================================== + +class SharingLog_SetVisibility::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_visibility(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_source_visibility(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_duration_millis(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_source_activity_name(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +SharingLog_SetVisibility::SharingLog_SetVisibility(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SetVisibility) +} +SharingLog_SetVisibility::SharingLog_SetVisibility(const SharingLog_SetVisibility& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&visibility_, &from.visibility_, + static_cast(reinterpret_cast(&source_activity_name_) - + reinterpret_cast(&visibility_)) + sizeof(source_activity_name_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SetVisibility) +} + +inline void SharingLog_SetVisibility::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&visibility_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&source_activity_name_) - + reinterpret_cast(&visibility_)) + sizeof(source_activity_name_)); +} + +SharingLog_SetVisibility::~SharingLog_SetVisibility() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SetVisibility::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SetVisibility::ArenaDtor(void* object) { + SharingLog_SetVisibility* _this = reinterpret_cast< SharingLog_SetVisibility* >(object); + (void)_this; +} +void SharingLog_SetVisibility::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SetVisibility::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SetVisibility::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + ::memset(&visibility_, 0, static_cast( + reinterpret_cast(&source_activity_name_) - + reinterpret_cast(&visibility_)) + sizeof(source_activity_name_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SetVisibility::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::Visibility_IsValid(val))) { + _internal_set_visibility(static_cast<::location::nearby::proto::sharing::Visibility>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.Visibility source_visibility = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::Visibility_IsValid(val))) { + _internal_set_source_visibility(static_cast<::location::nearby::proto::sharing::Visibility>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 duration_millis = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_duration_millis(&has_bits); + duration_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ActivityName_IsValid(val))) { + _internal_set_source_activity_name(static_cast<::location::nearby::proto::sharing::ActivityName>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SetVisibility::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_visibility(), target); + } + + // optional .location.nearby.proto.sharing.Visibility source_visibility = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_source_visibility(), target); + } + + // optional int64 duration_millis = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_duration_millis(), target); + } + + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_source_activity_name(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + return target; +} + +size_t SharingLog_SetVisibility::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_visibility()); + } + + // optional .location.nearby.proto.sharing.Visibility source_visibility = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_visibility()); + } + + // optional int64 duration_millis = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); + } + + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_activity_name()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SetVisibility::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SetVisibility::MergeFrom(const SharingLog_SetVisibility& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + visibility_ = from.visibility_; + } + if (cached_has_bits & 0x00000002u) { + source_visibility_ = from.source_visibility_; + } + if (cached_has_bits & 0x00000004u) { + duration_millis_ = from.duration_millis_; + } + if (cached_has_bits & 0x00000008u) { + source_activity_name_ = from.source_activity_name_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SetVisibility::CopyFrom(const SharingLog_SetVisibility& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SetVisibility::IsInitialized() const { + return true; +} + +void SharingLog_SetVisibility::InternalSwap(SharingLog_SetVisibility* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_SetVisibility, source_activity_name_) + + sizeof(SharingLog_SetVisibility::source_activity_name_) + - PROTOBUF_FIELD_OFFSET(SharingLog_SetVisibility, visibility_)>( + reinterpret_cast(&visibility_), + reinterpret_cast(&other->visibility_)); +} + +std::string SharingLog_SetVisibility::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SetVisibility"; +} + + +// =================================================================== + +class SharingLog_SetDataUsage::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_original_preference(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_preference(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_SetDataUsage::SharingLog_SetDataUsage(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) +} +SharingLog_SetDataUsage::SharingLog_SetDataUsage(const SharingLog_SetDataUsage& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&original_preference_, &from.original_preference_, + static_cast(reinterpret_cast(&preference_) - + reinterpret_cast(&original_preference_)) + sizeof(preference_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) +} + +inline void SharingLog_SetDataUsage::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&original_preference_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&preference_) - + reinterpret_cast(&original_preference_)) + sizeof(preference_)); +} + +SharingLog_SetDataUsage::~SharingLog_SetDataUsage() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SetDataUsage::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SetDataUsage::ArenaDtor(void* object) { + SharingLog_SetDataUsage* _this = reinterpret_cast< SharingLog_SetDataUsage* >(object); + (void)_this; +} +void SharingLog_SetDataUsage::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SetDataUsage::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SetDataUsage::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&original_preference_, 0, static_cast( + reinterpret_cast(&preference_) - + reinterpret_cast(&original_preference_)) + sizeof(preference_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SetDataUsage::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.DataUsage original_preference = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DataUsage_IsValid(val))) { + _internal_set_original_preference(static_cast<::location::nearby::proto::sharing::DataUsage>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.DataUsage preference = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DataUsage_IsValid(val))) { + _internal_set_preference(static_cast<::location::nearby::proto::sharing::DataUsage>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SetDataUsage::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.DataUsage original_preference = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_original_preference(), target); + } + + // optional .location.nearby.proto.sharing.DataUsage preference = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_preference(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + return target; +} + +size_t SharingLog_SetDataUsage::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.sharing.DataUsage original_preference = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_original_preference()); + } + + // optional .location.nearby.proto.sharing.DataUsage preference = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_preference()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SetDataUsage::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SetDataUsage::MergeFrom(const SharingLog_SetDataUsage& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + original_preference_ = from.original_preference_; + } + if (cached_has_bits & 0x00000002u) { + preference_ = from.preference_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SetDataUsage::CopyFrom(const SharingLog_SetDataUsage& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SetDataUsage::IsInitialized() const { + return true; +} + +void SharingLog_SetDataUsage::InternalSwap(SharingLog_SetDataUsage* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_SetDataUsage, preference_) + + sizeof(SharingLog_SetDataUsage::preference_) + - PROTOBUF_FIELD_OFFSET(SharingLog_SetDataUsage, original_preference_)>( + reinterpret_cast(&original_preference_), + reinterpret_cast(&other->original_preference_)); +} + +std::string SharingLog_SetDataUsage::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SetDataUsage"; +} + + +// =================================================================== + +class SharingLog_ScanForShareTargetsStart::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_scan_type(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_ScanForShareTargetsStart::SharingLog_ScanForShareTargetsStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) +} +SharingLog_ScanForShareTargetsStart::SharingLog_ScanForShareTargetsStart(const SharingLog_ScanForShareTargetsStart& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&flow_id_) - + reinterpret_cast(&session_id_)) + sizeof(flow_id_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) +} + +inline void SharingLog_ScanForShareTargetsStart::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&session_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&flow_id_) - + reinterpret_cast(&session_id_)) + sizeof(flow_id_)); +} + +SharingLog_ScanForShareTargetsStart::~SharingLog_ScanForShareTargetsStart() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ScanForShareTargetsStart::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_ScanForShareTargetsStart::ArenaDtor(void* object) { + SharingLog_ScanForShareTargetsStart* _this = reinterpret_cast< SharingLog_ScanForShareTargetsStart* >(object); + (void)_this; +} +void SharingLog_ScanForShareTargetsStart::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ScanForShareTargetsStart::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ScanForShareTargetsStart::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x0000001eu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&flow_id_) - + reinterpret_cast(&session_id_)) + sizeof(flow_id_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ScanForShareTargetsStart::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.SessionStatus status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::SessionStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::SessionStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ScanType scan_type = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ScanType_IsValid(val))) { + _internal_set_scan_type(static_cast<::location::nearby::proto::sharing::ScanType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 flow_id = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_flow_id(&has_bits); + flow_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ScanForShareTargetsStart::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional .location.nearby.proto.sharing.SessionStatus status = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_status(), target); + } + + // optional .location.nearby.proto.sharing.ScanType scan_type = 3; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_scan_type(), target); + } + + // optional int64 flow_id = 4; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_flow_id(), target); + } + + // optional string referrer_name = 5; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 5, this->_internal_referrer_name(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + return target; +} + +size_t SharingLog_ScanForShareTargetsStart::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + // optional string referrer_name = 5; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional .location.nearby.proto.sharing.SessionStatus status = 2; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + // optional .location.nearby.proto.sharing.ScanType scan_type = 3; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_scan_type()); + } + + // optional int64 flow_id = 4; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_flow_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ScanForShareTargetsStart::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ScanForShareTargetsStart::MergeFrom(const SharingLog_ScanForShareTargetsStart& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000004u) { + status_ = from.status_; + } + if (cached_has_bits & 0x00000008u) { + scan_type_ = from.scan_type_; + } + if (cached_has_bits & 0x00000010u) { + flow_id_ = from.flow_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ScanForShareTargetsStart::CopyFrom(const SharingLog_ScanForShareTargetsStart& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ScanForShareTargetsStart::IsInitialized() const { + return true; +} + +void SharingLog_ScanForShareTargetsStart::InternalSwap(SharingLog_ScanForShareTargetsStart* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ScanForShareTargetsStart, flow_id_) + + sizeof(SharingLog_ScanForShareTargetsStart::flow_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ScanForShareTargetsStart, session_id_)>( + reinterpret_cast(&session_id_), + reinterpret_cast(&other->session_id_)); +} + +std::string SharingLog_ScanForShareTargetsStart::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart"; +} + + +// =================================================================== + +class SharingLog_ScanForShareTargetsEnd::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_ScanForShareTargetsEnd::SharingLog_ScanForShareTargetsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) +} +SharingLog_ScanForShareTargetsEnd::SharingLog_ScanForShareTargetsEnd(const SharingLog_ScanForShareTargetsEnd& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + session_id_ = from.session_id_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) +} + +inline void SharingLog_ScanForShareTargetsEnd::SharedCtor() { +session_id_ = int64_t{0}; +} + +SharingLog_ScanForShareTargetsEnd::~SharingLog_ScanForShareTargetsEnd() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ScanForShareTargetsEnd::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_ScanForShareTargetsEnd::ArenaDtor(void* object) { + SharingLog_ScanForShareTargetsEnd* _this = reinterpret_cast< SharingLog_ScanForShareTargetsEnd* >(object); + (void)_this; +} +void SharingLog_ScanForShareTargetsEnd::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ScanForShareTargetsEnd::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ScanForShareTargetsEnd::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + session_id_ = int64_t{0}; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ScanForShareTargetsEnd::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ScanForShareTargetsEnd::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + return target; +} + +size_t SharingLog_ScanForShareTargetsEnd::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional int64 session_id = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ScanForShareTargetsEnd::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ScanForShareTargetsEnd::MergeFrom(const SharingLog_ScanForShareTargetsEnd& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_session_id()) { + _internal_set_session_id(from._internal_session_id()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ScanForShareTargetsEnd::CopyFrom(const SharingLog_ScanForShareTargetsEnd& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ScanForShareTargetsEnd::IsInitialized() const { + return true; +} + +void SharingLog_ScanForShareTargetsEnd::InternalSwap(SharingLog_ScanForShareTargetsEnd* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(session_id_, other->session_id_); +} + +std::string SharingLog_ScanForShareTargetsEnd::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd"; +} + + +// =================================================================== + +class SharingLog_AdvertiseDevicePresenceStart::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_visibility(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_data_usage(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_device_name_size(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_advertising_mode(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_qr_code_flow(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } +}; + +SharingLog_AdvertiseDevicePresenceStart::SharingLog_AdvertiseDevicePresenceStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) +} +SharingLog_AdvertiseDevicePresenceStart::SharingLog_AdvertiseDevicePresenceStart(const SharingLog_AdvertiseDevicePresenceStart& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) +} + +inline void SharingLog_AdvertiseDevicePresenceStart::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&session_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); +} + +SharingLog_AdvertiseDevicePresenceStart::~SharingLog_AdvertiseDevicePresenceStart() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AdvertiseDevicePresenceStart::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_AdvertiseDevicePresenceStart::ArenaDtor(void* object) { + SharingLog_AdvertiseDevicePresenceStart* _this = reinterpret_cast< SharingLog_AdvertiseDevicePresenceStart* >(object); + (void)_this; +} +void SharingLog_AdvertiseDevicePresenceStart::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AdvertiseDevicePresenceStart::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AdvertiseDevicePresenceStart::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x000000feu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AdvertiseDevicePresenceStart::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1 [deprecated = true]; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.Visibility visibility = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::Visibility_IsValid(val))) { + _internal_set_visibility(static_cast<::location::nearby::proto::sharing::Visibility>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.SessionStatus status = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::SessionStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::SessionStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.DataUsage data_usage = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DataUsage_IsValid(val))) { + _internal_set_data_usage(static_cast<::location::nearby::proto::sharing::DataUsage>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 device_name_size = 5 [deprecated = true]; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_device_name_size(&has_bits); + device_name_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AdvertisingMode advertising_mode = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AdvertisingMode_IsValid(val))) { + _internal_set_advertising_mode(static_cast<::location::nearby::proto::sharing::AdvertisingMode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(7, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional bool qr_code_flow = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 64)) { + _Internal::set_has_qr_code_flow(&has_bits); + qr_code_flow_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AdvertiseDevicePresenceStart::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1 [deprecated = true]; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional .location.nearby.proto.sharing.Visibility visibility = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_visibility(), target); + } + + // optional .location.nearby.proto.sharing.SessionStatus status = 3; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_status(), target); + } + + // optional .location.nearby.proto.sharing.DataUsage data_usage = 4; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_data_usage(), target); + } + + // optional int32 device_name_size = 5 [deprecated = true]; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_device_name_size(), target); + } + + // optional string referrer_name = 6; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 6, this->_internal_referrer_name(), target); + } + + // optional .location.nearby.proto.sharing.AdvertisingMode advertising_mode = 7; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 7, this->_internal_advertising_mode(), target); + } + + // optional bool qr_code_flow = 8; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(8, this->_internal_qr_code_flow(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + return target; +} + +size_t SharingLog_AdvertiseDevicePresenceStart::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + // optional string referrer_name = 6; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional int64 session_id = 1 [deprecated = true]; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional .location.nearby.proto.sharing.Visibility visibility = 2; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_visibility()); + } + + // optional .location.nearby.proto.sharing.SessionStatus status = 3; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + // optional .location.nearby.proto.sharing.DataUsage data_usage = 4; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_data_usage()); + } + + // optional int32 device_name_size = 5 [deprecated = true]; + if (cached_has_bits & 0x00000020u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_device_name_size()); + } + + // optional .location.nearby.proto.sharing.AdvertisingMode advertising_mode = 7; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_advertising_mode()); + } + + // optional bool qr_code_flow = 8; + if (cached_has_bits & 0x00000080u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AdvertiseDevicePresenceStart::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AdvertiseDevicePresenceStart::MergeFrom(const SharingLog_AdvertiseDevicePresenceStart& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000004u) { + visibility_ = from.visibility_; + } + if (cached_has_bits & 0x00000008u) { + status_ = from.status_; + } + if (cached_has_bits & 0x00000010u) { + data_usage_ = from.data_usage_; + } + if (cached_has_bits & 0x00000020u) { + device_name_size_ = from.device_name_size_; + } + if (cached_has_bits & 0x00000040u) { + advertising_mode_ = from.advertising_mode_; + } + if (cached_has_bits & 0x00000080u) { + qr_code_flow_ = from.qr_code_flow_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AdvertiseDevicePresenceStart::CopyFrom(const SharingLog_AdvertiseDevicePresenceStart& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AdvertiseDevicePresenceStart::IsInitialized() const { + return true; +} + +void SharingLog_AdvertiseDevicePresenceStart::InternalSwap(SharingLog_AdvertiseDevicePresenceStart* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_AdvertiseDevicePresenceStart, qr_code_flow_) + + sizeof(SharingLog_AdvertiseDevicePresenceStart::qr_code_flow_) + - PROTOBUF_FIELD_OFFSET(SharingLog_AdvertiseDevicePresenceStart, session_id_)>( + reinterpret_cast(&session_id_), + reinterpret_cast(&other->session_id_)); +} + +std::string SharingLog_AdvertiseDevicePresenceStart::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart"; +} + + +// =================================================================== + +class SharingLog_AdvertiseDevicePresenceEnd::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_AdvertiseDevicePresenceEnd::SharingLog_AdvertiseDevicePresenceEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) +} +SharingLog_AdvertiseDevicePresenceEnd::SharingLog_AdvertiseDevicePresenceEnd(const SharingLog_AdvertiseDevicePresenceEnd& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + session_id_ = from.session_id_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) +} + +inline void SharingLog_AdvertiseDevicePresenceEnd::SharedCtor() { +session_id_ = int64_t{0}; +} + +SharingLog_AdvertiseDevicePresenceEnd::~SharingLog_AdvertiseDevicePresenceEnd() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AdvertiseDevicePresenceEnd::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AdvertiseDevicePresenceEnd::ArenaDtor(void* object) { + SharingLog_AdvertiseDevicePresenceEnd* _this = reinterpret_cast< SharingLog_AdvertiseDevicePresenceEnd* >(object); + (void)_this; +} +void SharingLog_AdvertiseDevicePresenceEnd::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AdvertiseDevicePresenceEnd::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AdvertiseDevicePresenceEnd::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + session_id_ = int64_t{0}; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AdvertiseDevicePresenceEnd::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1 [deprecated = true]; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AdvertiseDevicePresenceEnd::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1 [deprecated = true]; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + return target; +} + +size_t SharingLog_AdvertiseDevicePresenceEnd::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional int64 session_id = 1 [deprecated = true]; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AdvertiseDevicePresenceEnd::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AdvertiseDevicePresenceEnd::MergeFrom(const SharingLog_AdvertiseDevicePresenceEnd& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_session_id()) { + _internal_set_session_id(from._internal_session_id()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AdvertiseDevicePresenceEnd::CopyFrom(const SharingLog_AdvertiseDevicePresenceEnd& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AdvertiseDevicePresenceEnd::IsInitialized() const { + return true; +} + +void SharingLog_AdvertiseDevicePresenceEnd::InternalSwap(SharingLog_AdvertiseDevicePresenceEnd* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(session_id_, other->session_id_); +} + +std::string SharingLog_AdvertiseDevicePresenceEnd::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd"; +} + + +// =================================================================== + +class SharingLog_SendFastInitialization::_Internal { + public: +}; + +SharingLog_SendFastInitialization::SharingLog_SendFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) +} +SharingLog_SendFastInitialization::SharingLog_SendFastInitialization(const SharingLog_SendFastInitialization& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) +} + +inline void SharingLog_SendFastInitialization::SharedCtor() { +} + +SharingLog_SendFastInitialization::~SharingLog_SendFastInitialization() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendFastInitialization::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SendFastInitialization::ArenaDtor(void* object) { + SharingLog_SendFastInitialization* _this = reinterpret_cast< SharingLog_SendFastInitialization* >(object); + (void)_this; +} +void SharingLog_SendFastInitialization::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendFastInitialization::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendFastInitialization::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendFastInitialization::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendFastInitialization::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + return target; +} + +size_t SharingLog_SendFastInitialization::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendFastInitialization::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendFastInitialization::MergeFrom(const SharingLog_SendFastInitialization& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendFastInitialization::CopyFrom(const SharingLog_SendFastInitialization& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendFastInitialization::IsInitialized() const { + return true; +} + +void SharingLog_SendFastInitialization::InternalSwap(SharingLog_SendFastInitialization* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_SendFastInitialization::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendFastInitialization"; +} + + +// =================================================================== + +class SharingLog_ReceiveFastInitialization::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_time_elapse_since_screen_unlock_millis(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_notifications_enabled(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_notifications_filtered(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_ReceiveFastInitialization::SharingLog_ReceiveFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) +} +SharingLog_ReceiveFastInitialization::SharingLog_ReceiveFastInitialization(const SharingLog_ReceiveFastInitialization& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&time_elapse_since_screen_unlock_millis_, &from.time_elapse_since_screen_unlock_millis_, + static_cast(reinterpret_cast(¬ifications_filtered_) - + reinterpret_cast(&time_elapse_since_screen_unlock_millis_)) + sizeof(notifications_filtered_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) +} + +inline void SharingLog_ReceiveFastInitialization::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&time_elapse_since_screen_unlock_millis_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(¬ifications_filtered_) - + reinterpret_cast(&time_elapse_since_screen_unlock_millis_)) + sizeof(notifications_filtered_)); +} + +SharingLog_ReceiveFastInitialization::~SharingLog_ReceiveFastInitialization() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ReceiveFastInitialization::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_ReceiveFastInitialization::ArenaDtor(void* object) { + SharingLog_ReceiveFastInitialization* _this = reinterpret_cast< SharingLog_ReceiveFastInitialization* >(object); + (void)_this; +} +void SharingLog_ReceiveFastInitialization::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ReceiveFastInitialization::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ReceiveFastInitialization::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + ::memset(&time_elapse_since_screen_unlock_millis_, 0, static_cast( + reinterpret_cast(¬ifications_filtered_) - + reinterpret_cast(&time_elapse_since_screen_unlock_millis_)) + sizeof(notifications_filtered_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ReceiveFastInitialization::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 time_elapse_since_screen_unlock_millis = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_time_elapse_since_screen_unlock_millis(&has_bits); + time_elapse_since_screen_unlock_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool notifications_enabled = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_notifications_enabled(&has_bits); + notifications_enabled_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool notifications_filtered = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_notifications_filtered(&has_bits); + notifications_filtered_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ReceiveFastInitialization::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 time_elapse_since_screen_unlock_millis = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_time_elapse_since_screen_unlock_millis(), target); + } + + // optional bool notifications_enabled = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_notifications_enabled(), target); + } + + // optional bool notifications_filtered = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_notifications_filtered(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + return target; +} + +size_t SharingLog_ReceiveFastInitialization::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional int64 time_elapse_since_screen_unlock_millis = 1; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_time_elapse_since_screen_unlock_millis()); + } + + // optional bool notifications_enabled = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + 1; + } + + // optional bool notifications_filtered = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ReceiveFastInitialization::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ReceiveFastInitialization::MergeFrom(const SharingLog_ReceiveFastInitialization& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + time_elapse_since_screen_unlock_millis_ = from.time_elapse_since_screen_unlock_millis_; + } + if (cached_has_bits & 0x00000002u) { + notifications_enabled_ = from.notifications_enabled_; + } + if (cached_has_bits & 0x00000004u) { + notifications_filtered_ = from.notifications_filtered_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ReceiveFastInitialization::CopyFrom(const SharingLog_ReceiveFastInitialization& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ReceiveFastInitialization::IsInitialized() const { + return true; +} + +void SharingLog_ReceiveFastInitialization::InternalSwap(SharingLog_ReceiveFastInitialization* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveFastInitialization, notifications_filtered_) + + sizeof(SharingLog_ReceiveFastInitialization::notifications_filtered_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveFastInitialization, time_elapse_since_screen_unlock_millis_)>( + reinterpret_cast(&time_elapse_since_screen_unlock_millis_), + reinterpret_cast(&other->time_elapse_since_screen_unlock_millis_)); +} + +std::string SharingLog_ReceiveFastInitialization::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization"; +} + + +// =================================================================== + +class SharingLog_DismissFastInitialization::_Internal { + public: +}; + +SharingLog_DismissFastInitialization::SharingLog_DismissFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) +} +SharingLog_DismissFastInitialization::SharingLog_DismissFastInitialization(const SharingLog_DismissFastInitialization& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) +} + +inline void SharingLog_DismissFastInitialization::SharedCtor() { +} + +SharingLog_DismissFastInitialization::~SharingLog_DismissFastInitialization() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DismissFastInitialization::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DismissFastInitialization::ArenaDtor(void* object) { + SharingLog_DismissFastInitialization* _this = reinterpret_cast< SharingLog_DismissFastInitialization* >(object); + (void)_this; +} +void SharingLog_DismissFastInitialization::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DismissFastInitialization::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DismissFastInitialization::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_DismissFastInitialization::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DismissFastInitialization::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + return target; +} + +size_t SharingLog_DismissFastInitialization::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DismissFastInitialization::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DismissFastInitialization::MergeFrom(const SharingLog_DismissFastInitialization& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DismissFastInitialization::CopyFrom(const SharingLog_DismissFastInitialization& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DismissFastInitialization::IsInitialized() const { + return true; +} + +void SharingLog_DismissFastInitialization::InternalSwap(SharingLog_DismissFastInitialization* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_DismissFastInitialization::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization"; +} + + +// =================================================================== + +class SharingLog_AutoDismissFastInitialization::_Internal { + public: +}; + +SharingLog_AutoDismissFastInitialization::SharingLog_AutoDismissFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) +} +SharingLog_AutoDismissFastInitialization::SharingLog_AutoDismissFastInitialization(const SharingLog_AutoDismissFastInitialization& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) +} + +inline void SharingLog_AutoDismissFastInitialization::SharedCtor() { +} + +SharingLog_AutoDismissFastInitialization::~SharingLog_AutoDismissFastInitialization() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AutoDismissFastInitialization::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AutoDismissFastInitialization::ArenaDtor(void* object) { + SharingLog_AutoDismissFastInitialization* _this = reinterpret_cast< SharingLog_AutoDismissFastInitialization* >(object); + (void)_this; +} +void SharingLog_AutoDismissFastInitialization::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AutoDismissFastInitialization::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AutoDismissFastInitialization::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_AutoDismissFastInitialization::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AutoDismissFastInitialization::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + return target; +} + +size_t SharingLog_AutoDismissFastInitialization::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AutoDismissFastInitialization::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AutoDismissFastInitialization::MergeFrom(const SharingLog_AutoDismissFastInitialization& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AutoDismissFastInitialization::CopyFrom(const SharingLog_AutoDismissFastInitialization& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AutoDismissFastInitialization::IsInitialized() const { + return true; +} + +void SharingLog_AutoDismissFastInitialization::InternalSwap(SharingLog_AutoDismissFastInitialization* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_AutoDismissFastInitialization::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization"; +} + + +// =================================================================== + +class SharingLog_EventMetadata::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_use_case(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_initial_opt_in(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_opt_in(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_initial_enable_status(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_vendor_id(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } +}; + +SharingLog_EventMetadata::SharingLog_EventMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.EventMetadata) +} +SharingLog_EventMetadata::SharingLog_EventMetadata(const SharingLog_EventMetadata& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&use_case_, &from.use_case_, + static_cast(reinterpret_cast(&vendor_id_) - + reinterpret_cast(&use_case_)) + sizeof(vendor_id_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.EventMetadata) +} + +inline void SharingLog_EventMetadata::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&use_case_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&vendor_id_) - + reinterpret_cast(&use_case_)) + sizeof(vendor_id_)); +} + +SharingLog_EventMetadata::~SharingLog_EventMetadata() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_EventMetadata::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_EventMetadata::ArenaDtor(void* object) { + SharingLog_EventMetadata* _this = reinterpret_cast< SharingLog_EventMetadata* >(object); + (void)_this; +} +void SharingLog_EventMetadata::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_EventMetadata::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_EventMetadata::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + ::memset(&use_case_, 0, static_cast( + reinterpret_cast(&vendor_id_) - + reinterpret_cast(&use_case_)) + sizeof(vendor_id_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_EventMetadata::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.SharingUseCase use_case = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::SharingUseCase_IsValid(val))) { + _internal_set_use_case(static_cast<::location::nearby::proto::sharing::SharingUseCase>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional bool initial_opt_in = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_initial_opt_in(&has_bits); + initial_opt_in_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool opt_in = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_opt_in(&has_bits); + opt_in_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool initial_enable_status = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_initial_enable_status(&has_bits); + initial_enable_status_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 flow_id = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_flow_id(&has_bits); + flow_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 session_id = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 vendor_id = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_vendor_id(&has_bits); + vendor_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_EventMetadata::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.SharingUseCase use_case = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_use_case(), target); + } + + // optional bool initial_opt_in = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_initial_opt_in(), target); + } + + // optional bool opt_in = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_opt_in(), target); + } + + // optional bool initial_enable_status = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_initial_enable_status(), target); + } + + // optional int64 flow_id = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->_internal_flow_id(), target); + } + + // optional int64 session_id = 6; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(6, this->_internal_session_id(), target); + } + + // optional int32 vendor_id = 7; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(7, this->_internal_vendor_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + return target; +} + +size_t SharingLog_EventMetadata::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + // optional .location.nearby.proto.sharing.SharingUseCase use_case = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_use_case()); + } + + // optional bool initial_opt_in = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + 1; + } + + // optional bool opt_in = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + 1; + } + + // optional bool initial_enable_status = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + 1; + } + + // optional int64 flow_id = 5; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_flow_id()); + } + + // optional int64 session_id = 6; + if (cached_has_bits & 0x00000020u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int32 vendor_id = 7; + if (cached_has_bits & 0x00000040u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_vendor_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_EventMetadata::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_EventMetadata::MergeFrom(const SharingLog_EventMetadata& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + use_case_ = from.use_case_; + } + if (cached_has_bits & 0x00000002u) { + initial_opt_in_ = from.initial_opt_in_; + } + if (cached_has_bits & 0x00000004u) { + opt_in_ = from.opt_in_; + } + if (cached_has_bits & 0x00000008u) { + initial_enable_status_ = from.initial_enable_status_; + } + if (cached_has_bits & 0x00000010u) { + flow_id_ = from.flow_id_; + } + if (cached_has_bits & 0x00000020u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000040u) { + vendor_id_ = from.vendor_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_EventMetadata::CopyFrom(const SharingLog_EventMetadata& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_EventMetadata::IsInitialized() const { + return true; +} + +void SharingLog_EventMetadata::InternalSwap(SharingLog_EventMetadata* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_EventMetadata, vendor_id_) + + sizeof(SharingLog_EventMetadata::vendor_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_EventMetadata, use_case_)>( + reinterpret_cast(&use_case_), + reinterpret_cast(&other->use_case_)); +} + +std::string SharingLog_EventMetadata::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.EventMetadata"; +} + + +// =================================================================== + +class SharingLog_DiscoverShareTarget::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_DiscoverShareTarget* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static const ::PROTOBUF_NAMESPACE_ID::Duration& duration_since_scanning(const SharingLog_DiscoverShareTarget* msg); + static void set_has_duration_since_scanning(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_latency_since_activity_start_millis(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_scan_type(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_DiscoverShareTarget::_Internal::share_target_info(const SharingLog_DiscoverShareTarget* msg) { + return *msg->share_target_info_; +} +const ::PROTOBUF_NAMESPACE_ID::Duration& +SharingLog_DiscoverShareTarget::_Internal::duration_since_scanning(const SharingLog_DiscoverShareTarget* msg) { + return *msg->duration_since_scanning_; +} +void SharingLog_DiscoverShareTarget::clear_duration_since_scanning() { + if (duration_since_scanning_ != nullptr) duration_since_scanning_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +SharingLog_DiscoverShareTarget::SharingLog_DiscoverShareTarget(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) +} +SharingLog_DiscoverShareTarget::SharingLog_DiscoverShareTarget(const SharingLog_DiscoverShareTarget& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + if (from._internal_has_duration_since_scanning()) { + duration_since_scanning_ = new ::PROTOBUF_NAMESPACE_ID::Duration(*from.duration_since_scanning_); + } else { + duration_since_scanning_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&latency_since_activity_start_millis_) - + reinterpret_cast(&session_id_)) + sizeof(latency_since_activity_start_millis_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) +} + +inline void SharingLog_DiscoverShareTarget::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&share_target_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&scan_type_) - + reinterpret_cast(&share_target_info_)) + sizeof(scan_type_)); +latency_since_activity_start_millis_ = int64_t{-1}; +} + +SharingLog_DiscoverShareTarget::~SharingLog_DiscoverShareTarget() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DiscoverShareTarget::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete share_target_info_; + if (this != internal_default_instance()) delete duration_since_scanning_; +} + +void SharingLog_DiscoverShareTarget::ArenaDtor(void* object) { + SharingLog_DiscoverShareTarget* _this = reinterpret_cast< SharingLog_DiscoverShareTarget* >(object); + (void)_this; +} +void SharingLog_DiscoverShareTarget::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DiscoverShareTarget::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DiscoverShareTarget::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(duration_since_scanning_ != nullptr); + duration_since_scanning_->Clear(); + } + } + if (cached_has_bits & 0x00000078u) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&scan_type_) - + reinterpret_cast(&session_id_)) + sizeof(scan_type_)); + latency_since_activity_start_millis_ = int64_t{-1}; + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_DiscoverShareTarget::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .google.protobuf.Duration duration_since_scanning = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_duration_since_scanning(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 session_id = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 flow_id = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_flow_id(&has_bits); + flow_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + _Internal::set_has_latency_since_activity_start_millis(&has_bits); + latency_since_activity_start_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ScanType_IsValid(val))) { + _internal_set_scan_type(static_cast<::location::nearby::proto::sharing::ScanType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(7, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DiscoverShareTarget::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 1, _Internal::share_target_info(this), target, stream); + } + + // optional .google.protobuf.Duration duration_since_scanning = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::duration_since_scanning(this), target, stream); + } + + // optional int64 session_id = 3; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_session_id(), target); + } + + // optional int64 flow_id = 4; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_flow_id(), target); + } + + // optional string referrer_name = 5; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 5, this->_internal_referrer_name(), target); + } + + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(6, this->_internal_latency_since_activity_start_millis(), target); + } + + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 7, this->_internal_scan_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + return target; +} + +size_t SharingLog_DiscoverShareTarget::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + // optional string referrer_name = 5; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional .google.protobuf.Duration duration_since_scanning = 2; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *duration_since_scanning_); + } + + // optional int64 session_id = 3; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int64 flow_id = 4; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_flow_id()); + } + + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_scan_type()); + } + + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + if (cached_has_bits & 0x00000040u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_latency_since_activity_start_millis()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DiscoverShareTarget::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DiscoverShareTarget::MergeFrom(const SharingLog_DiscoverShareTarget& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000004u) { + _internal_mutable_duration_since_scanning()->::PROTOBUF_NAMESPACE_ID::Duration::MergeFrom(from._internal_duration_since_scanning()); + } + if (cached_has_bits & 0x00000008u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000010u) { + flow_id_ = from.flow_id_; + } + if (cached_has_bits & 0x00000020u) { + scan_type_ = from.scan_type_; + } + if (cached_has_bits & 0x00000040u) { + latency_since_activity_start_millis_ = from.latency_since_activity_start_millis_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DiscoverShareTarget::CopyFrom(const SharingLog_DiscoverShareTarget& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DiscoverShareTarget::IsInitialized() const { + return true; +} + +void SharingLog_DiscoverShareTarget::InternalSwap(SharingLog_DiscoverShareTarget* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_DiscoverShareTarget, scan_type_) + + sizeof(SharingLog_DiscoverShareTarget::scan_type_) + - PROTOBUF_FIELD_OFFSET(SharingLog_DiscoverShareTarget, share_target_info_)>( + reinterpret_cast(&share_target_info_), + reinterpret_cast(&other->share_target_info_)); + swap(latency_since_activity_start_millis_, other->latency_since_activity_start_millis_); +} + +std::string SharingLog_DiscoverShareTarget::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget"; +} + + +// =================================================================== + +class SharingLog_ParsingFailedEndpointId::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_endpoint_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::PROTOBUF_NAMESPACE_ID::Duration& duration_since_scanning(const SharingLog_ParsingFailedEndpointId* msg); + static void set_has_duration_since_scanning(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_flow_id(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_latency_since_activity_start_millis(HasBits* has_bits) { + (*has_bits)[0] |= 512u; + } + static void set_has_scan_type(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static const ::PROTOBUF_NAMESPACE_ID::Duration& duration_since_last_sync(const SharingLog_ParsingFailedEndpointId* msg); + static void set_has_duration_since_last_sync(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_parsing_failed_type(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static void set_has_discovery_mode(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } +}; + +const ::PROTOBUF_NAMESPACE_ID::Duration& +SharingLog_ParsingFailedEndpointId::_Internal::duration_since_scanning(const SharingLog_ParsingFailedEndpointId* msg) { + return *msg->duration_since_scanning_; +} +const ::PROTOBUF_NAMESPACE_ID::Duration& +SharingLog_ParsingFailedEndpointId::_Internal::duration_since_last_sync(const SharingLog_ParsingFailedEndpointId* msg) { + return *msg->duration_since_last_sync_; +} +void SharingLog_ParsingFailedEndpointId::clear_duration_since_scanning() { + if (duration_since_scanning_ != nullptr) duration_since_scanning_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +void SharingLog_ParsingFailedEndpointId::clear_duration_since_last_sync() { + if (duration_since_last_sync_ != nullptr) duration_since_last_sync_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +SharingLog_ParsingFailedEndpointId::SharingLog_ParsingFailedEndpointId(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) +} +SharingLog_ParsingFailedEndpointId::SharingLog_ParsingFailedEndpointId(const SharingLog_ParsingFailedEndpointId& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + endpoint_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + endpoint_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_endpoint_id()) { + endpoint_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_endpoint_id(), + GetArenaForAllocation()); + } + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + if (from._internal_has_duration_since_scanning()) { + duration_since_scanning_ = new ::PROTOBUF_NAMESPACE_ID::Duration(*from.duration_since_scanning_); + } else { + duration_since_scanning_ = nullptr; + } + if (from._internal_has_duration_since_last_sync()) { + duration_since_last_sync_ = new ::PROTOBUF_NAMESPACE_ID::Duration(*from.duration_since_last_sync_); + } else { + duration_since_last_sync_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&latency_since_activity_start_millis_) - + reinterpret_cast(&session_id_)) + sizeof(latency_since_activity_start_millis_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) +} + +inline void SharingLog_ParsingFailedEndpointId::SharedCtor() { +endpoint_id_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + endpoint_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&duration_since_scanning_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&discovery_mode_) - + reinterpret_cast(&duration_since_scanning_)) + sizeof(discovery_mode_)); +latency_since_activity_start_millis_ = int64_t{-1}; +} + +SharingLog_ParsingFailedEndpointId::~SharingLog_ParsingFailedEndpointId() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ParsingFailedEndpointId::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + endpoint_id_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete duration_since_scanning_; + if (this != internal_default_instance()) delete duration_since_last_sync_; +} + +void SharingLog_ParsingFailedEndpointId::ArenaDtor(void* object) { + SharingLog_ParsingFailedEndpointId* _this = reinterpret_cast< SharingLog_ParsingFailedEndpointId* >(object); + (void)_this; +} +void SharingLog_ParsingFailedEndpointId::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ParsingFailedEndpointId::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ParsingFailedEndpointId::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + endpoint_id_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(duration_since_scanning_ != nullptr); + duration_since_scanning_->Clear(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(duration_since_last_sync_ != nullptr); + duration_since_last_sync_->Clear(); + } + } + if (cached_has_bits & 0x000000f0u) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&parsing_failed_type_) - + reinterpret_cast(&session_id_)) + sizeof(parsing_failed_type_)); + } + if (cached_has_bits & 0x00000300u) { + discovery_mode_ = 0; + latency_since_activity_start_millis_ = int64_t{-1}; + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ParsingFailedEndpointId::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string endpoint_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_endpoint_id(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .google.protobuf.Duration duration_since_scanning = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_duration_since_scanning(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 session_id = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 flow_id = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_flow_id(&has_bits); + flow_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + _Internal::set_has_latency_since_activity_start_millis(&has_bits); + latency_since_activity_start_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ScanType_IsValid(val))) { + _internal_set_scan_type(static_cast<::location::nearby::proto::sharing::ScanType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(7, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .google.protobuf.Duration duration_since_last_sync = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_duration_since_last_sync(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ParsingFailedType parsing_failed_type = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 72)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ParsingFailedType_IsValid(val))) { + _internal_set_parsing_failed_type(static_cast<::location::nearby::proto::sharing::ParsingFailedType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(9, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.DiscoveryMode discovery_mode = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DiscoveryMode_IsValid(val))) { + _internal_set_discovery_mode(static_cast<::location::nearby::proto::sharing::DiscoveryMode>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(10, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ParsingFailedEndpointId::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional string endpoint_id = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_endpoint_id(), target); + } + + // optional .google.protobuf.Duration duration_since_scanning = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::duration_since_scanning(this), target, stream); + } + + // optional int64 session_id = 3; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_session_id(), target); + } + + // optional int64 flow_id = 4; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_flow_id(), target); + } + + // optional string referrer_name = 5; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 5, this->_internal_referrer_name(), target); + } + + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(6, this->_internal_latency_since_activity_start_millis(), target); + } + + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 7, this->_internal_scan_type(), target); + } + + // optional .google.protobuf.Duration duration_since_last_sync = 8; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 8, _Internal::duration_since_last_sync(this), target, stream); + } + + // optional .location.nearby.proto.sharing.ParsingFailedType parsing_failed_type = 9; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 9, this->_internal_parsing_failed_type(), target); + } + + // optional .location.nearby.proto.sharing.DiscoveryMode discovery_mode = 10; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 10, this->_internal_discovery_mode(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + return target; +} + +size_t SharingLog_ParsingFailedEndpointId::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + // optional string endpoint_id = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_endpoint_id()); + } + + // optional string referrer_name = 5; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional .google.protobuf.Duration duration_since_scanning = 2; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *duration_since_scanning_); + } + + // optional .google.protobuf.Duration duration_since_last_sync = 8; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *duration_since_last_sync_); + } + + // optional int64 session_id = 3; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int64 flow_id = 4; + if (cached_has_bits & 0x00000020u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_flow_id()); + } + + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_scan_type()); + } + + // optional .location.nearby.proto.sharing.ParsingFailedType parsing_failed_type = 9; + if (cached_has_bits & 0x00000080u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_parsing_failed_type()); + } + + } + if (cached_has_bits & 0x00000300u) { + // optional .location.nearby.proto.sharing.DiscoveryMode discovery_mode = 10; + if (cached_has_bits & 0x00000100u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_discovery_mode()); + } + + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + if (cached_has_bits & 0x00000200u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_latency_since_activity_start_millis()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ParsingFailedEndpointId::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ParsingFailedEndpointId::MergeFrom(const SharingLog_ParsingFailedEndpointId& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_endpoint_id(from._internal_endpoint_id()); + } + if (cached_has_bits & 0x00000002u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000004u) { + _internal_mutable_duration_since_scanning()->::PROTOBUF_NAMESPACE_ID::Duration::MergeFrom(from._internal_duration_since_scanning()); + } + if (cached_has_bits & 0x00000008u) { + _internal_mutable_duration_since_last_sync()->::PROTOBUF_NAMESPACE_ID::Duration::MergeFrom(from._internal_duration_since_last_sync()); + } + if (cached_has_bits & 0x00000010u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000020u) { + flow_id_ = from.flow_id_; + } + if (cached_has_bits & 0x00000040u) { + scan_type_ = from.scan_type_; + } + if (cached_has_bits & 0x00000080u) { + parsing_failed_type_ = from.parsing_failed_type_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000100u) { + discovery_mode_ = from.discovery_mode_; + } + if (cached_has_bits & 0x00000200u) { + latency_since_activity_start_millis_ = from.latency_since_activity_start_millis_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ParsingFailedEndpointId::CopyFrom(const SharingLog_ParsingFailedEndpointId& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ParsingFailedEndpointId::IsInitialized() const { + return true; +} + +void SharingLog_ParsingFailedEndpointId::InternalSwap(SharingLog_ParsingFailedEndpointId* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &endpoint_id_, lhs_arena, + &other->endpoint_id_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ParsingFailedEndpointId, discovery_mode_) + + sizeof(SharingLog_ParsingFailedEndpointId::discovery_mode_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ParsingFailedEndpointId, duration_since_scanning_)>( + reinterpret_cast(&duration_since_scanning_), + reinterpret_cast(&other->duration_since_scanning_)); + swap(latency_since_activity_start_millis_, other->latency_since_activity_start_millis_); +} + +std::string SharingLog_ParsingFailedEndpointId::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId"; +} + + +// =================================================================== + +class SharingLog_DescribeAttachments::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info(const SharingLog_DescribeAttachments* msg); + static void set_has_attachments_info(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& +SharingLog_DescribeAttachments::_Internal::attachments_info(const SharingLog_DescribeAttachments* msg) { + return *msg->attachments_info_; +} +SharingLog_DescribeAttachments::SharingLog_DescribeAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) +} +SharingLog_DescribeAttachments::SharingLog_DescribeAttachments(const SharingLog_DescribeAttachments& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_attachments_info()) { + attachments_info_ = new ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo(*from.attachments_info_); + } else { + attachments_info_ = nullptr; + } + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) +} + +inline void SharingLog_DescribeAttachments::SharedCtor() { +attachments_info_ = nullptr; +} + +SharingLog_DescribeAttachments::~SharingLog_DescribeAttachments() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DescribeAttachments::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete attachments_info_; +} + +void SharingLog_DescribeAttachments::ArenaDtor(void* object) { + SharingLog_DescribeAttachments* _this = reinterpret_cast< SharingLog_DescribeAttachments* >(object); + (void)_this; +} +void SharingLog_DescribeAttachments::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DescribeAttachments::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DescribeAttachments::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(attachments_info_ != nullptr); + attachments_info_->Clear(); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_DescribeAttachments::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_attachments_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DescribeAttachments::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 1, _Internal::attachments_info(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + return target; +} + +size_t SharingLog_DescribeAttachments::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *attachments_info_); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DescribeAttachments::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DescribeAttachments::MergeFrom(const SharingLog_DescribeAttachments& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_attachments_info()) { + _internal_mutable_attachments_info()->::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo::MergeFrom(from._internal_attachments_info()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DescribeAttachments::CopyFrom(const SharingLog_DescribeAttachments& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DescribeAttachments::IsInitialized() const { + return true; +} + +void SharingLog_DescribeAttachments::InternalSwap(SharingLog_DescribeAttachments* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(attachments_info_, other->attachments_info_); +} + +std::string SharingLog_DescribeAttachments::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DescribeAttachments"; +} + + +// =================================================================== + +class SharingLog_SendIntroduction::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_SendIntroduction* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_transfer_position(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_concurrent_connections(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_SendIntroduction::_Internal::share_target_info(const SharingLog_SendIntroduction* msg) { + return *msg->share_target_info_; +} +SharingLog_SendIntroduction::SharingLog_SendIntroduction(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) +} +SharingLog_SendIntroduction::SharingLog_SendIntroduction(const SharingLog_SendIntroduction& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) +} + +inline void SharingLog_SendIntroduction::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&share_target_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&share_target_info_)) + sizeof(concurrent_connections_)); +} + +SharingLog_SendIntroduction::~SharingLog_SendIntroduction() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendIntroduction::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_SendIntroduction::ArenaDtor(void* object) { + SharingLog_SendIntroduction* _this = reinterpret_cast< SharingLog_SendIntroduction* >(object); + (void)_this; +} +void SharingLog_SendIntroduction::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendIntroduction::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendIntroduction::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + if (cached_has_bits & 0x0000000eu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendIntroduction::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 session_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 transfer_position = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_transfer_position(&has_bits); + transfer_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 concurrent_connections = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_concurrent_connections(&has_bits); + concurrent_connections_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendIntroduction::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 1, _Internal::share_target_info(this), target, stream); + } + + // optional int64 session_id = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_session_id(), target); + } + + // optional int32 transfer_position = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_transfer_position(), target); + } + + // optional int32 concurrent_connections = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_concurrent_connections(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + return target; +} + +size_t SharingLog_SendIntroduction::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int32 transfer_position = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_transfer_position()); + } + + // optional int32 concurrent_connections = 4; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_concurrent_connections()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendIntroduction::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendIntroduction::MergeFrom(const SharingLog_SendIntroduction& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000002u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000004u) { + transfer_position_ = from.transfer_position_; + } + if (cached_has_bits & 0x00000008u) { + concurrent_connections_ = from.concurrent_connections_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendIntroduction::CopyFrom(const SharingLog_SendIntroduction& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendIntroduction::IsInitialized() const { + return true; +} + +void SharingLog_SendIntroduction::InternalSwap(SharingLog_SendIntroduction* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_SendIntroduction, concurrent_connections_) + + sizeof(SharingLog_SendIntroduction::concurrent_connections_) + - PROTOBUF_FIELD_OFFSET(SharingLog_SendIntroduction, share_target_info_)>( + reinterpret_cast(&share_target_info_), + reinterpret_cast(&other->share_target_info_)); +} + +std::string SharingLog_SendIntroduction::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendIntroduction"; +} + + +// =================================================================== + +class SharingLog_ReceiveIntroduction::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_ReceiveIntroduction* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_ReceiveIntroduction::_Internal::share_target_info(const SharingLog_ReceiveIntroduction* msg) { + return *msg->share_target_info_; +} +SharingLog_ReceiveIntroduction::SharingLog_ReceiveIntroduction(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) +} +SharingLog_ReceiveIntroduction::SharingLog_ReceiveIntroduction(const SharingLog_ReceiveIntroduction& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + session_id_ = from.session_id_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) +} + +inline void SharingLog_ReceiveIntroduction::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&share_target_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&session_id_) - + reinterpret_cast(&share_target_info_)) + sizeof(session_id_)); +} + +SharingLog_ReceiveIntroduction::~SharingLog_ReceiveIntroduction() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ReceiveIntroduction::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_ReceiveIntroduction::ArenaDtor(void* object) { + SharingLog_ReceiveIntroduction* _this = reinterpret_cast< SharingLog_ReceiveIntroduction* >(object); + (void)_this; +} +void SharingLog_ReceiveIntroduction::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ReceiveIntroduction::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ReceiveIntroduction::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + } + session_id_ = int64_t{0}; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ReceiveIntroduction::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ReceiveIntroduction::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::share_target_info(this), target, stream); + } + + // optional string referrer_name = 3; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_referrer_name(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + return target; +} + +size_t SharingLog_ReceiveIntroduction::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional string referrer_name = 3; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ReceiveIntroduction::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ReceiveIntroduction::MergeFrom(const SharingLog_ReceiveIntroduction& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000004u) { + session_id_ = from.session_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ReceiveIntroduction::CopyFrom(const SharingLog_ReceiveIntroduction& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ReceiveIntroduction::IsInitialized() const { + return true; +} + +void SharingLog_ReceiveIntroduction::InternalSwap(SharingLog_ReceiveIntroduction* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveIntroduction, session_id_) + + sizeof(SharingLog_ReceiveIntroduction::session_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveIntroduction, share_target_info_)>( + reinterpret_cast(&share_target_info_), + reinterpret_cast(&other->share_target_info_)); +} + +std::string SharingLog_ReceiveIntroduction::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction"; +} + + +// =================================================================== + +class SharingLog_RespondToIntroduction::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_action(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_qr_code_flow(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_RespondToIntroduction::SharingLog_RespondToIntroduction(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) +} +SharingLog_RespondToIntroduction::SharingLog_RespondToIntroduction(const SharingLog_RespondToIntroduction& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) +} + +inline void SharingLog_RespondToIntroduction::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&session_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); +} + +SharingLog_RespondToIntroduction::~SharingLog_RespondToIntroduction() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_RespondToIntroduction::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_RespondToIntroduction::ArenaDtor(void* object) { + SharingLog_RespondToIntroduction* _this = reinterpret_cast< SharingLog_RespondToIntroduction* >(object); + (void)_this; +} +void SharingLog_RespondToIntroduction::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_RespondToIntroduction::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_RespondToIntroduction::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_RespondToIntroduction::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ResponseToIntroduction action = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ResponseToIntroduction_IsValid(val))) { + _internal_set_action(static_cast<::location::nearby::proto::sharing::ResponseToIntroduction>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 session_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool qr_code_flow = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_qr_code_flow(&has_bits); + qr_code_flow_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_RespondToIntroduction::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ResponseToIntroduction action = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_action(), target); + } + + // optional int64 session_id = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_session_id(), target); + } + + // optional bool qr_code_flow = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_qr_code_flow(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + return target; +} + +size_t SharingLog_RespondToIntroduction::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional int64 session_id = 2; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional .location.nearby.proto.sharing.ResponseToIntroduction action = 1; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_action()); + } + + // optional bool qr_code_flow = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_RespondToIntroduction::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_RespondToIntroduction::MergeFrom(const SharingLog_RespondToIntroduction& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000002u) { + action_ = from.action_; + } + if (cached_has_bits & 0x00000004u) { + qr_code_flow_ = from.qr_code_flow_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_RespondToIntroduction::CopyFrom(const SharingLog_RespondToIntroduction& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_RespondToIntroduction::IsInitialized() const { + return true; +} + +void SharingLog_RespondToIntroduction::InternalSwap(SharingLog_RespondToIntroduction* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_RespondToIntroduction, qr_code_flow_) + + sizeof(SharingLog_RespondToIntroduction::qr_code_flow_) + - PROTOBUF_FIELD_OFFSET(SharingLog_RespondToIntroduction, session_id_)>( + reinterpret_cast(&session_id_), + reinterpret_cast(&other->session_id_)); +} + +std::string SharingLog_RespondToIntroduction::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction"; +} + + +// =================================================================== + +class SharingLog_SendAttachmentsStart::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info(const SharingLog_SendAttachmentsStart* msg); + static void set_has_attachments_info(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_transfer_position(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_concurrent_connections(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_qr_code_flow(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& +SharingLog_SendAttachmentsStart::_Internal::attachments_info(const SharingLog_SendAttachmentsStart* msg) { + return *msg->attachments_info_; +} +SharingLog_SendAttachmentsStart::SharingLog_SendAttachmentsStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) +} +SharingLog_SendAttachmentsStart::SharingLog_SendAttachmentsStart(const SharingLog_SendAttachmentsStart& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_attachments_info()) { + attachments_info_ = new ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo(*from.attachments_info_); + } else { + attachments_info_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) +} + +inline void SharingLog_SendAttachmentsStart::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&attachments_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&attachments_info_)) + sizeof(qr_code_flow_)); +} + +SharingLog_SendAttachmentsStart::~SharingLog_SendAttachmentsStart() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendAttachmentsStart::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete attachments_info_; +} + +void SharingLog_SendAttachmentsStart::ArenaDtor(void* object) { + SharingLog_SendAttachmentsStart* _this = reinterpret_cast< SharingLog_SendAttachmentsStart* >(object); + (void)_this; +} +void SharingLog_SendAttachmentsStart::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendAttachmentsStart::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendAttachmentsStart::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(attachments_info_ != nullptr); + attachments_info_->Clear(); + } + if (cached_has_bits & 0x0000001eu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&qr_code_flow_) - + reinterpret_cast(&session_id_)) + sizeof(qr_code_flow_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendAttachmentsStart::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_attachments_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 transfer_position = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_transfer_position(&has_bits); + transfer_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 concurrent_connections = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_concurrent_connections(&has_bits); + concurrent_connections_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool qr_code_flow = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_qr_code_flow(&has_bits); + qr_code_flow_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendAttachmentsStart::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::attachments_info(this), target, stream); + } + + // optional int32 transfer_position = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_transfer_position(), target); + } + + // optional int32 concurrent_connections = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_concurrent_connections(), target); + } + + // optional bool qr_code_flow = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_qr_code_flow(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + return target; +} + +size_t SharingLog_SendAttachmentsStart::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *attachments_info_); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int32 transfer_position = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_transfer_position()); + } + + // optional int32 concurrent_connections = 4; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_concurrent_connections()); + } + + // optional bool qr_code_flow = 5; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendAttachmentsStart::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendAttachmentsStart::MergeFrom(const SharingLog_SendAttachmentsStart& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_attachments_info()->::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo::MergeFrom(from._internal_attachments_info()); + } + if (cached_has_bits & 0x00000002u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000004u) { + transfer_position_ = from.transfer_position_; + } + if (cached_has_bits & 0x00000008u) { + concurrent_connections_ = from.concurrent_connections_; + } + if (cached_has_bits & 0x00000010u) { + qr_code_flow_ = from.qr_code_flow_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendAttachmentsStart::CopyFrom(const SharingLog_SendAttachmentsStart& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendAttachmentsStart::IsInitialized() const { + return true; +} + +void SharingLog_SendAttachmentsStart::InternalSwap(SharingLog_SendAttachmentsStart* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_SendAttachmentsStart, qr_code_flow_) + + sizeof(SharingLog_SendAttachmentsStart::qr_code_flow_) + - PROTOBUF_FIELD_OFFSET(SharingLog_SendAttachmentsStart, attachments_info_)>( + reinterpret_cast(&attachments_info_), + reinterpret_cast(&other->attachments_info_)); +} + +std::string SharingLog_SendAttachmentsStart::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart"; +} + + +// =================================================================== + +class SharingLog_SendAttachmentsEnd::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_sent_bytes(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static void set_has_transfer_position(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_concurrent_connections(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info(const SharingLog_SendAttachmentsEnd* msg); + static void set_has_attachments_info(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_duration_millis(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_SendAttachmentsEnd* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_connection_layer_status(HasBits* has_bits) { + (*has_bits)[0] |= 512u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& +SharingLog_SendAttachmentsEnd::_Internal::attachments_info(const SharingLog_SendAttachmentsEnd* msg) { + return *msg->attachments_info_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_SendAttachmentsEnd::_Internal::share_target_info(const SharingLog_SendAttachmentsEnd* msg) { + return *msg->share_target_info_; +} +SharingLog_SendAttachmentsEnd::SharingLog_SendAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) +} +SharingLog_SendAttachmentsEnd::SharingLog_SendAttachmentsEnd(const SharingLog_SendAttachmentsEnd& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + if (from._internal_has_attachments_info()) { + attachments_info_ = new ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo(*from.attachments_info_); + } else { + attachments_info_ = nullptr; + } + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&connection_layer_status_) - + reinterpret_cast(&session_id_)) + sizeof(connection_layer_status_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) +} + +inline void SharingLog_SendAttachmentsEnd::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&attachments_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&connection_layer_status_) - + reinterpret_cast(&attachments_info_)) + sizeof(connection_layer_status_)); +} + +SharingLog_SendAttachmentsEnd::~SharingLog_SendAttachmentsEnd() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendAttachmentsEnd::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete attachments_info_; + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_SendAttachmentsEnd::ArenaDtor(void* object) { + SharingLog_SendAttachmentsEnd* _this = reinterpret_cast< SharingLog_SendAttachmentsEnd* >(object); + (void)_this; +} +void SharingLog_SendAttachmentsEnd::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendAttachmentsEnd::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendAttachmentsEnd::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(attachments_info_ != nullptr); + attachments_info_->Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + } + if (cached_has_bits & 0x000000f8u) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&duration_millis_) - + reinterpret_cast(&session_id_)) + sizeof(duration_millis_)); + } + if (cached_has_bits & 0x00000300u) { + ::memset(&concurrent_connections_, 0, static_cast( + reinterpret_cast(&connection_layer_status_) - + reinterpret_cast(&concurrent_connections_)) + sizeof(connection_layer_status_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendAttachmentsEnd::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 sent_bytes = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_sent_bytes(&has_bits); + sent_bytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentTransmissionStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::AttachmentTransmissionStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int32 transfer_position = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_transfer_position(&has_bits); + transfer_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 concurrent_connections = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_concurrent_connections(&has_bits); + concurrent_connections_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_attachments_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 duration_millis = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_duration_millis(&has_bits); + duration_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ConnectionLayerStatus connection_layer_status = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 80)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ConnectionLayerStatus_IsValid(val))) { + _internal_set_connection_layer_status(static_cast<::location::nearby::proto::sharing::ConnectionLayerStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(10, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendAttachmentsEnd::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional int64 sent_bytes = 2; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_sent_bytes(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_status(), target); + } + + // optional int32 transfer_position = 4; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_transfer_position(), target); + } + + // optional int32 concurrent_connections = 5; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_concurrent_connections(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 6; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 6, _Internal::attachments_info(this), target, stream); + } + + // optional int64 duration_millis = 7; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(7, this->_internal_duration_millis(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 8; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 8, _Internal::share_target_info(this), target, stream); + } + + // optional string referrer_name = 9; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 9, this->_internal_referrer_name(), target); + } + + // optional .location.nearby.proto.sharing.ConnectionLayerStatus connection_layer_status = 10; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 10, this->_internal_connection_layer_status(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + return target; +} + +size_t SharingLog_SendAttachmentsEnd::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + // optional string referrer_name = 9; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 6; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *attachments_info_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 8; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int64 sent_bytes = 2; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_sent_bytes()); + } + + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + // optional int32 transfer_position = 4; + if (cached_has_bits & 0x00000040u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_transfer_position()); + } + + // optional int64 duration_millis = 7; + if (cached_has_bits & 0x00000080u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); + } + + } + if (cached_has_bits & 0x00000300u) { + // optional int32 concurrent_connections = 5; + if (cached_has_bits & 0x00000100u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_concurrent_connections()); + } + + // optional .location.nearby.proto.sharing.ConnectionLayerStatus connection_layer_status = 10; + if (cached_has_bits & 0x00000200u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_connection_layer_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendAttachmentsEnd::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendAttachmentsEnd::MergeFrom(const SharingLog_SendAttachmentsEnd& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_attachments_info()->::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo::MergeFrom(from._internal_attachments_info()); + } + if (cached_has_bits & 0x00000004u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000008u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000010u) { + sent_bytes_ = from.sent_bytes_; + } + if (cached_has_bits & 0x00000020u) { + status_ = from.status_; + } + if (cached_has_bits & 0x00000040u) { + transfer_position_ = from.transfer_position_; + } + if (cached_has_bits & 0x00000080u) { + duration_millis_ = from.duration_millis_; + } + _has_bits_[0] |= cached_has_bits; + } + if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000100u) { + concurrent_connections_ = from.concurrent_connections_; + } + if (cached_has_bits & 0x00000200u) { + connection_layer_status_ = from.connection_layer_status_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendAttachmentsEnd::CopyFrom(const SharingLog_SendAttachmentsEnd& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendAttachmentsEnd::IsInitialized() const { + return true; +} + +void SharingLog_SendAttachmentsEnd::InternalSwap(SharingLog_SendAttachmentsEnd* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_SendAttachmentsEnd, connection_layer_status_) + + sizeof(SharingLog_SendAttachmentsEnd::connection_layer_status_) + - PROTOBUF_FIELD_OFFSET(SharingLog_SendAttachmentsEnd, attachments_info_)>( + reinterpret_cast(&attachments_info_), + reinterpret_cast(&other->attachments_info_)); +} + +std::string SharingLog_SendAttachmentsEnd::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd"; +} + + +// =================================================================== + +class SharingLog_ReceiveAttachmentsStart::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info(const SharingLog_ReceiveAttachmentsStart* msg); + static void set_has_attachments_info(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_ReceiveAttachmentsStart* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& +SharingLog_ReceiveAttachmentsStart::_Internal::attachments_info(const SharingLog_ReceiveAttachmentsStart* msg) { + return *msg->attachments_info_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_ReceiveAttachmentsStart::_Internal::share_target_info(const SharingLog_ReceiveAttachmentsStart* msg) { + return *msg->share_target_info_; +} +SharingLog_ReceiveAttachmentsStart::SharingLog_ReceiveAttachmentsStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) +} +SharingLog_ReceiveAttachmentsStart::SharingLog_ReceiveAttachmentsStart(const SharingLog_ReceiveAttachmentsStart& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_attachments_info()) { + attachments_info_ = new ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo(*from.attachments_info_); + } else { + attachments_info_ = nullptr; + } + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + session_id_ = from.session_id_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) +} + +inline void SharingLog_ReceiveAttachmentsStart::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&attachments_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&session_id_) - + reinterpret_cast(&attachments_info_)) + sizeof(session_id_)); +} + +SharingLog_ReceiveAttachmentsStart::~SharingLog_ReceiveAttachmentsStart() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ReceiveAttachmentsStart::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete attachments_info_; + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_ReceiveAttachmentsStart::ArenaDtor(void* object) { + SharingLog_ReceiveAttachmentsStart* _this = reinterpret_cast< SharingLog_ReceiveAttachmentsStart* >(object); + (void)_this; +} +void SharingLog_ReceiveAttachmentsStart::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ReceiveAttachmentsStart::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ReceiveAttachmentsStart::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(attachments_info_ != nullptr); + attachments_info_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + } + session_id_ = int64_t{0}; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ReceiveAttachmentsStart::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_attachments_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ReceiveAttachmentsStart::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::attachments_info(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 3; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::share_target_info(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + return target; +} + +size_t SharingLog_ReceiveAttachmentsStart::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *attachments_info_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 3; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ReceiveAttachmentsStart::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ReceiveAttachmentsStart::MergeFrom(const SharingLog_ReceiveAttachmentsStart& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_attachments_info()->::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo::MergeFrom(from._internal_attachments_info()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000004u) { + session_id_ = from.session_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ReceiveAttachmentsStart::CopyFrom(const SharingLog_ReceiveAttachmentsStart& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ReceiveAttachmentsStart::IsInitialized() const { + return true; +} + +void SharingLog_ReceiveAttachmentsStart::InternalSwap(SharingLog_ReceiveAttachmentsStart* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveAttachmentsStart, session_id_) + + sizeof(SharingLog_ReceiveAttachmentsStart::session_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveAttachmentsStart, attachments_info_)>( + reinterpret_cast(&attachments_info_), + reinterpret_cast(&other->attachments_info_)); +} + +std::string SharingLog_ReceiveAttachmentsStart::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart"; +} + + +// =================================================================== + +class SharingLog_ReceiveAttachmentsEnd::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_received_bytes(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_ReceiveAttachmentsEnd* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_ReceiveAttachmentsEnd::_Internal::share_target_info(const SharingLog_ReceiveAttachmentsEnd* msg) { + return *msg->share_target_info_; +} +SharingLog_ReceiveAttachmentsEnd::SharingLog_ReceiveAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) +} +SharingLog_ReceiveAttachmentsEnd::SharingLog_ReceiveAttachmentsEnd(const SharingLog_ReceiveAttachmentsEnd& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&session_id_)) + sizeof(status_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) +} + +inline void SharingLog_ReceiveAttachmentsEnd::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&share_target_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&share_target_info_)) + sizeof(status_)); +} + +SharingLog_ReceiveAttachmentsEnd::~SharingLog_ReceiveAttachmentsEnd() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ReceiveAttachmentsEnd::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_ReceiveAttachmentsEnd::ArenaDtor(void* object) { + SharingLog_ReceiveAttachmentsEnd* _this = reinterpret_cast< SharingLog_ReceiveAttachmentsEnd* >(object); + (void)_this; +} +void SharingLog_ReceiveAttachmentsEnd::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ReceiveAttachmentsEnd::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ReceiveAttachmentsEnd::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + } + if (cached_has_bits & 0x0000001cu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&status_) - + reinterpret_cast(&session_id_)) + sizeof(status_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ReceiveAttachmentsEnd::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 received_bytes = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_received_bytes(&has_bits); + received_bytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentTransmissionStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::AttachmentTransmissionStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional string referrer_name = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ReceiveAttachmentsEnd::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional int64 received_bytes = 2; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_received_bytes(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_status(), target); + } + + // optional string referrer_name = 4; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 4, this->_internal_referrer_name(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 5; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 5, _Internal::share_target_info(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + return target; +} + +size_t SharingLog_ReceiveAttachmentsEnd::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + // optional string referrer_name = 4; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 5; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int64 received_bytes = 2; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_received_bytes()); + } + + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ReceiveAttachmentsEnd::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ReceiveAttachmentsEnd::MergeFrom(const SharingLog_ReceiveAttachmentsEnd& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000004u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000008u) { + received_bytes_ = from.received_bytes_; + } + if (cached_has_bits & 0x00000010u) { + status_ = from.status_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ReceiveAttachmentsEnd::CopyFrom(const SharingLog_ReceiveAttachmentsEnd& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ReceiveAttachmentsEnd::IsInitialized() const { + return true; +} + +void SharingLog_ReceiveAttachmentsEnd::InternalSwap(SharingLog_ReceiveAttachmentsEnd* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveAttachmentsEnd, status_) + + sizeof(SharingLog_ReceiveAttachmentsEnd::status_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ReceiveAttachmentsEnd, share_target_info_)>( + reinterpret_cast(&share_target_info_), + reinterpret_cast(&other->share_target_info_)); +} + +std::string SharingLog_ReceiveAttachmentsEnd::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd"; +} + + +// =================================================================== + +class SharingLog_CancelConnection::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_transfer_position(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_concurrent_connections(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_CancelConnection::SharingLog_CancelConnection(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.CancelConnection) +} +SharingLog_CancelConnection::SharingLog_CancelConnection(const SharingLog_CancelConnection& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.CancelConnection) +} + +inline void SharingLog_CancelConnection::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&session_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); +} + +SharingLog_CancelConnection::~SharingLog_CancelConnection() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_CancelConnection::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_CancelConnection::ArenaDtor(void* object) { + SharingLog_CancelConnection* _this = reinterpret_cast< SharingLog_CancelConnection* >(object); + (void)_this; +} +void SharingLog_CancelConnection::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_CancelConnection::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_CancelConnection::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_CancelConnection::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 transfer_position = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_transfer_position(&has_bits); + transfer_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 concurrent_connections = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_concurrent_connections(&has_bits); + concurrent_connections_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_CancelConnection::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional int32 transfer_position = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_transfer_position(), target); + } + + // optional int32 concurrent_connections = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_concurrent_connections(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + return target; +} + +size_t SharingLog_CancelConnection::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int32 transfer_position = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_transfer_position()); + } + + // optional int32 concurrent_connections = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_concurrent_connections()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_CancelConnection::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_CancelConnection::MergeFrom(const SharingLog_CancelConnection& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000002u) { + transfer_position_ = from.transfer_position_; + } + if (cached_has_bits & 0x00000004u) { + concurrent_connections_ = from.concurrent_connections_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_CancelConnection::CopyFrom(const SharingLog_CancelConnection& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_CancelConnection::IsInitialized() const { + return true; +} + +void SharingLog_CancelConnection::InternalSwap(SharingLog_CancelConnection* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_CancelConnection, concurrent_connections_) + + sizeof(SharingLog_CancelConnection::concurrent_connections_) + - PROTOBUF_FIELD_OFFSET(SharingLog_CancelConnection, session_id_)>( + reinterpret_cast(&session_id_), + reinterpret_cast(&other->session_id_)); +} + +std::string SharingLog_CancelConnection::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.CancelConnection"; +} + + +// =================================================================== + +class SharingLog_CancelSendingAttachments::_Internal { + public: +}; + +SharingLog_CancelSendingAttachments::SharingLog_CancelSendingAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) +} +SharingLog_CancelSendingAttachments::SharingLog_CancelSendingAttachments(const SharingLog_CancelSendingAttachments& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) +} + +inline void SharingLog_CancelSendingAttachments::SharedCtor() { +} + +SharingLog_CancelSendingAttachments::~SharingLog_CancelSendingAttachments() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_CancelSendingAttachments::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_CancelSendingAttachments::ArenaDtor(void* object) { + SharingLog_CancelSendingAttachments* _this = reinterpret_cast< SharingLog_CancelSendingAttachments* >(object); + (void)_this; +} +void SharingLog_CancelSendingAttachments::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_CancelSendingAttachments::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_CancelSendingAttachments::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_CancelSendingAttachments::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_CancelSendingAttachments::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + return target; +} + +size_t SharingLog_CancelSendingAttachments::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_CancelSendingAttachments::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_CancelSendingAttachments::MergeFrom(const SharingLog_CancelSendingAttachments& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_CancelSendingAttachments::CopyFrom(const SharingLog_CancelSendingAttachments& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_CancelSendingAttachments::IsInitialized() const { + return true; +} + +void SharingLog_CancelSendingAttachments::InternalSwap(SharingLog_CancelSendingAttachments* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_CancelSendingAttachments::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments"; +} + + +// =================================================================== + +class SharingLog_CancelReceivingAttachments::_Internal { + public: +}; + +SharingLog_CancelReceivingAttachments::SharingLog_CancelReceivingAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) +} +SharingLog_CancelReceivingAttachments::SharingLog_CancelReceivingAttachments(const SharingLog_CancelReceivingAttachments& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) +} + +inline void SharingLog_CancelReceivingAttachments::SharedCtor() { +} + +SharingLog_CancelReceivingAttachments::~SharingLog_CancelReceivingAttachments() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_CancelReceivingAttachments::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_CancelReceivingAttachments::ArenaDtor(void* object) { + SharingLog_CancelReceivingAttachments* _this = reinterpret_cast< SharingLog_CancelReceivingAttachments* >(object); + (void)_this; +} +void SharingLog_CancelReceivingAttachments::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_CancelReceivingAttachments::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_CancelReceivingAttachments::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_CancelReceivingAttachments::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_CancelReceivingAttachments::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + return target; +} + +size_t SharingLog_CancelReceivingAttachments::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_CancelReceivingAttachments::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_CancelReceivingAttachments::MergeFrom(const SharingLog_CancelReceivingAttachments& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_CancelReceivingAttachments::CopyFrom(const SharingLog_CancelReceivingAttachments& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_CancelReceivingAttachments::IsInitialized() const { + return true; +} + +void SharingLog_CancelReceivingAttachments::InternalSwap(SharingLog_CancelReceivingAttachments* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_CancelReceivingAttachments::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments"; +} + + +// =================================================================== + +class SharingLog_ProcessReceivedAttachmentsEnd::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_ProcessReceivedAttachmentsEnd::SharingLog_ProcessReceivedAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) +} +SharingLog_ProcessReceivedAttachmentsEnd::SharingLog_ProcessReceivedAttachmentsEnd(const SharingLog_ProcessReceivedAttachmentsEnd& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&session_id_)) + sizeof(status_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) +} + +inline void SharingLog_ProcessReceivedAttachmentsEnd::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&session_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&session_id_)) + sizeof(status_)); +} + +SharingLog_ProcessReceivedAttachmentsEnd::~SharingLog_ProcessReceivedAttachmentsEnd() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ProcessReceivedAttachmentsEnd::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_ProcessReceivedAttachmentsEnd::ArenaDtor(void* object) { + SharingLog_ProcessReceivedAttachmentsEnd* _this = reinterpret_cast< SharingLog_ProcessReceivedAttachmentsEnd* >(object); + (void)_this; +} +void SharingLog_ProcessReceivedAttachmentsEnd::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ProcessReceivedAttachmentsEnd::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ProcessReceivedAttachmentsEnd::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&status_) - + reinterpret_cast(&session_id_)) + sizeof(status_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ProcessReceivedAttachmentsEnd::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ProcessReceivedAttachmentsStatus status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ProcessReceivedAttachmentsEnd::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional .location.nearby.proto.sharing.ProcessReceivedAttachmentsStatus status = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_status(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + return target; +} + +size_t SharingLog_ProcessReceivedAttachmentsEnd::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional .location.nearby.proto.sharing.ProcessReceivedAttachmentsStatus status = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ProcessReceivedAttachmentsEnd::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ProcessReceivedAttachmentsEnd::MergeFrom(const SharingLog_ProcessReceivedAttachmentsEnd& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000002u) { + status_ = from.status_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ProcessReceivedAttachmentsEnd::CopyFrom(const SharingLog_ProcessReceivedAttachmentsEnd& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ProcessReceivedAttachmentsEnd::IsInitialized() const { + return true; +} + +void SharingLog_ProcessReceivedAttachmentsEnd::InternalSwap(SharingLog_ProcessReceivedAttachmentsEnd* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ProcessReceivedAttachmentsEnd, status_) + + sizeof(SharingLog_ProcessReceivedAttachmentsEnd::status_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ProcessReceivedAttachmentsEnd, session_id_)>( + reinterpret_cast(&session_id_), + reinterpret_cast(&other->session_id_)); +} + +std::string SharingLog_ProcessReceivedAttachmentsEnd::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd"; +} + + +// =================================================================== + +class SharingLog_OpenReceivedAttachments::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info(const SharingLog_OpenReceivedAttachments* msg); + static void set_has_attachments_info(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& +SharingLog_OpenReceivedAttachments::_Internal::attachments_info(const SharingLog_OpenReceivedAttachments* msg) { + return *msg->attachments_info_; +} +SharingLog_OpenReceivedAttachments::SharingLog_OpenReceivedAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) +} +SharingLog_OpenReceivedAttachments::SharingLog_OpenReceivedAttachments(const SharingLog_OpenReceivedAttachments& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_attachments_info()) { + attachments_info_ = new ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo(*from.attachments_info_); + } else { + attachments_info_ = nullptr; + } + session_id_ = from.session_id_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) +} + +inline void SharingLog_OpenReceivedAttachments::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&attachments_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&session_id_) - + reinterpret_cast(&attachments_info_)) + sizeof(session_id_)); +} + +SharingLog_OpenReceivedAttachments::~SharingLog_OpenReceivedAttachments() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_OpenReceivedAttachments::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete attachments_info_; +} + +void SharingLog_OpenReceivedAttachments::ArenaDtor(void* object) { + SharingLog_OpenReceivedAttachments* _this = reinterpret_cast< SharingLog_OpenReceivedAttachments* >(object); + (void)_this; +} +void SharingLog_OpenReceivedAttachments::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_OpenReceivedAttachments::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_OpenReceivedAttachments::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(attachments_info_ != nullptr); + attachments_info_->Clear(); + } + session_id_ = int64_t{0}; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_OpenReceivedAttachments::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_attachments_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 session_id = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_OpenReceivedAttachments::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 3; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::attachments_info(this), target, stream); + } + + // optional int64 session_id = 4; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_session_id(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + return target; +} + +size_t SharingLog_OpenReceivedAttachments::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 3; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *attachments_info_); + } + + // optional int64 session_id = 4; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_OpenReceivedAttachments::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_OpenReceivedAttachments::MergeFrom(const SharingLog_OpenReceivedAttachments& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_attachments_info()->::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo::MergeFrom(from._internal_attachments_info()); + } + if (cached_has_bits & 0x00000002u) { + session_id_ = from.session_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_OpenReceivedAttachments::CopyFrom(const SharingLog_OpenReceivedAttachments& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_OpenReceivedAttachments::IsInitialized() const { + return true; +} + +void SharingLog_OpenReceivedAttachments::InternalSwap(SharingLog_OpenReceivedAttachments* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_OpenReceivedAttachments, session_id_) + + sizeof(SharingLog_OpenReceivedAttachments::session_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_OpenReceivedAttachments, attachments_info_)>( + reinterpret_cast(&attachments_info_), + reinterpret_cast(&other->attachments_info_)); +} + +std::string SharingLog_OpenReceivedAttachments::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments"; +} + + +// =================================================================== + +class SharingLog_LaunchSetupActivity::_Internal { + public: +}; + +SharingLog_LaunchSetupActivity::SharingLog_LaunchSetupActivity(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) +} +SharingLog_LaunchSetupActivity::SharingLog_LaunchSetupActivity(const SharingLog_LaunchSetupActivity& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) +} + +inline void SharingLog_LaunchSetupActivity::SharedCtor() { +} + +SharingLog_LaunchSetupActivity::~SharingLog_LaunchSetupActivity() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_LaunchSetupActivity::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_LaunchSetupActivity::ArenaDtor(void* object) { + SharingLog_LaunchSetupActivity* _this = reinterpret_cast< SharingLog_LaunchSetupActivity* >(object); + (void)_this; +} +void SharingLog_LaunchSetupActivity::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_LaunchSetupActivity::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_LaunchSetupActivity::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_LaunchSetupActivity::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_LaunchSetupActivity::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + return target; +} + +size_t SharingLog_LaunchSetupActivity::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_LaunchSetupActivity::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_LaunchSetupActivity::MergeFrom(const SharingLog_LaunchSetupActivity& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_LaunchSetupActivity::CopyFrom(const SharingLog_LaunchSetupActivity& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_LaunchSetupActivity::IsInitialized() const { + return true; +} + +void SharingLog_LaunchSetupActivity::InternalSwap(SharingLog_LaunchSetupActivity* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_LaunchSetupActivity::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity"; +} + + +// =================================================================== + +class SharingLog_AddContact::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_was_phone_added(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_was_email_added(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_AddContact::SharingLog_AddContact(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AddContact) +} +SharingLog_AddContact::SharingLog_AddContact(const SharingLog_AddContact& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&was_phone_added_, &from.was_phone_added_, + static_cast(reinterpret_cast(&was_email_added_) - + reinterpret_cast(&was_phone_added_)) + sizeof(was_email_added_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AddContact) +} + +inline void SharingLog_AddContact::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&was_phone_added_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&was_email_added_) - + reinterpret_cast(&was_phone_added_)) + sizeof(was_email_added_)); +} + +SharingLog_AddContact::~SharingLog_AddContact() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AddContact) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AddContact::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AddContact::ArenaDtor(void* object) { + SharingLog_AddContact* _this = reinterpret_cast< SharingLog_AddContact* >(object); + (void)_this; +} +void SharingLog_AddContact::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AddContact::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AddContact::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AddContact) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&was_phone_added_, 0, static_cast( + reinterpret_cast(&was_email_added_) - + reinterpret_cast(&was_phone_added_)) + sizeof(was_email_added_)); + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AddContact::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional bool was_phone_added = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_was_phone_added(&has_bits); + was_phone_added_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool was_email_added = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_was_email_added(&has_bits); + was_email_added_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AddContact::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AddContact) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional bool was_phone_added = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_was_phone_added(), target); + } + + // optional bool was_email_added = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_was_email_added(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AddContact) + return target; +} + +size_t SharingLog_AddContact::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AddContact) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional bool was_phone_added = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + 1; + } + + // optional bool was_email_added = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AddContact::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AddContact::MergeFrom(const SharingLog_AddContact& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AddContact) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + was_phone_added_ = from.was_phone_added_; + } + if (cached_has_bits & 0x00000002u) { + was_email_added_ = from.was_email_added_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AddContact::CopyFrom(const SharingLog_AddContact& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AddContact) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AddContact::IsInitialized() const { + return true; +} + +void SharingLog_AddContact::InternalSwap(SharingLog_AddContact* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_AddContact, was_email_added_) + + sizeof(SharingLog_AddContact::was_email_added_) + - PROTOBUF_FIELD_OFFSET(SharingLog_AddContact, was_phone_added_)>( + reinterpret_cast(&was_phone_added_), + reinterpret_cast(&other->was_phone_added_)); +} + +std::string SharingLog_AddContact::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AddContact"; +} + + +// =================================================================== + +class SharingLog_RemoveContact::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_was_phone_removed(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_was_email_removed(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_RemoveContact::SharingLog_RemoveContact(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.RemoveContact) +} +SharingLog_RemoveContact::SharingLog_RemoveContact(const SharingLog_RemoveContact& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&was_phone_removed_, &from.was_phone_removed_, + static_cast(reinterpret_cast(&was_email_removed_) - + reinterpret_cast(&was_phone_removed_)) + sizeof(was_email_removed_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.RemoveContact) +} + +inline void SharingLog_RemoveContact::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&was_phone_removed_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&was_email_removed_) - + reinterpret_cast(&was_phone_removed_)) + sizeof(was_email_removed_)); +} + +SharingLog_RemoveContact::~SharingLog_RemoveContact() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_RemoveContact::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_RemoveContact::ArenaDtor(void* object) { + SharingLog_RemoveContact* _this = reinterpret_cast< SharingLog_RemoveContact* >(object); + (void)_this; +} +void SharingLog_RemoveContact::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_RemoveContact::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_RemoveContact::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + ::memset(&was_phone_removed_, 0, static_cast( + reinterpret_cast(&was_email_removed_) - + reinterpret_cast(&was_phone_removed_)) + sizeof(was_email_removed_)); + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_RemoveContact::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional bool was_phone_removed = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_was_phone_removed(&has_bits); + was_phone_removed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool was_email_removed = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_was_email_removed(&has_bits); + was_email_removed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_RemoveContact::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional bool was_phone_removed = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(1, this->_internal_was_phone_removed(), target); + } + + // optional bool was_email_removed = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_was_email_removed(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + return target; +} + +size_t SharingLog_RemoveContact::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional bool was_phone_removed = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + 1; + } + + // optional bool was_email_removed = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_RemoveContact::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_RemoveContact::MergeFrom(const SharingLog_RemoveContact& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + was_phone_removed_ = from.was_phone_removed_; + } + if (cached_has_bits & 0x00000002u) { + was_email_removed_ = from.was_email_removed_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_RemoveContact::CopyFrom(const SharingLog_RemoveContact& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_RemoveContact::IsInitialized() const { + return true; +} + +void SharingLog_RemoveContact::InternalSwap(SharingLog_RemoveContact* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_RemoveContact, was_email_removed_) + + sizeof(SharingLog_RemoveContact::was_email_removed_) + - PROTOBUF_FIELD_OFFSET(SharingLog_RemoveContact, was_phone_removed_)>( + reinterpret_cast(&was_phone_removed_), + reinterpret_cast(&other->was_phone_removed_)); +} + +std::string SharingLog_RemoveContact::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.RemoveContact"; +} + + +// =================================================================== + +class SharingLog_FastShareServerResponse::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_name(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_latency_millis(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_purpose(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_requester(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_device_type(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } +}; + +SharingLog_FastShareServerResponse::SharingLog_FastShareServerResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) +} +SharingLog_FastShareServerResponse::SharingLog_FastShareServerResponse(const SharingLog_FastShareServerResponse& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&status_, &from.status_, + static_cast(reinterpret_cast(&device_type_) - + reinterpret_cast(&status_)) + sizeof(device_type_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) +} + +inline void SharingLog_FastShareServerResponse::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&status_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&device_type_) - + reinterpret_cast(&status_)) + sizeof(device_type_)); +} + +SharingLog_FastShareServerResponse::~SharingLog_FastShareServerResponse() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_FastShareServerResponse::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_FastShareServerResponse::ArenaDtor(void* object) { + SharingLog_FastShareServerResponse* _this = reinterpret_cast< SharingLog_FastShareServerResponse* >(object); + (void)_this; +} +void SharingLog_FastShareServerResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_FastShareServerResponse::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_FastShareServerResponse::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000003fu) { + ::memset(&status_, 0, static_cast( + reinterpret_cast(&device_type_) - + reinterpret_cast(&status_)) + sizeof(device_type_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_FastShareServerResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ServerResponseState status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ServerResponseState_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::ServerResponseState>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ServerActionName name = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ServerActionName_IsValid(val))) { + _internal_set_name(static_cast<::location::nearby::proto::sharing::ServerActionName>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 latency_millis = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_latency_millis(&has_bits); + latency_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.SyncPurpose purpose = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::SyncPurpose_IsValid(val))) { + _internal_set_purpose(static_cast<::location::nearby::proto::sharing::SyncPurpose>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ClientRole requester = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ClientRole_IsValid(val))) { + _internal_set_requester(static_cast<::location::nearby::proto::sharing::ClientRole>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(5, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.DeviceType device_type = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DeviceType_IsValid(val))) { + _internal_set_device_type(static_cast<::location::nearby::proto::sharing::DeviceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(6, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_FastShareServerResponse::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ServerResponseState status = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_status(), target); + } + + // optional .location.nearby.proto.sharing.ServerActionName name = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_name(), target); + } + + // optional int64 latency_millis = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_latency_millis(), target); + } + + // optional .location.nearby.proto.sharing.SyncPurpose purpose = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_purpose(), target); + } + + // optional .location.nearby.proto.sharing.ClientRole requester = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 5, this->_internal_requester(), target); + } + + // optional .location.nearby.proto.sharing.DeviceType device_type = 6; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 6, this->_internal_device_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + return target; +} + +size_t SharingLog_FastShareServerResponse::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000003fu) { + // optional .location.nearby.proto.sharing.ServerResponseState status = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + // optional .location.nearby.proto.sharing.ServerActionName name = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_name()); + } + + // optional int64 latency_millis = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_latency_millis()); + } + + // optional .location.nearby.proto.sharing.SyncPurpose purpose = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_purpose()); + } + + // optional .location.nearby.proto.sharing.ClientRole requester = 5; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_requester()); + } + + // optional .location.nearby.proto.sharing.DeviceType device_type = 6; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_device_type()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_FastShareServerResponse::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_FastShareServerResponse::MergeFrom(const SharingLog_FastShareServerResponse& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x00000001u) { + status_ = from.status_; + } + if (cached_has_bits & 0x00000002u) { + name_ = from.name_; + } + if (cached_has_bits & 0x00000004u) { + latency_millis_ = from.latency_millis_; + } + if (cached_has_bits & 0x00000008u) { + purpose_ = from.purpose_; + } + if (cached_has_bits & 0x00000010u) { + requester_ = from.requester_; + } + if (cached_has_bits & 0x00000020u) { + device_type_ = from.device_type_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_FastShareServerResponse::CopyFrom(const SharingLog_FastShareServerResponse& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_FastShareServerResponse::IsInitialized() const { + return true; +} + +void SharingLog_FastShareServerResponse::InternalSwap(SharingLog_FastShareServerResponse* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_FastShareServerResponse, device_type_) + + sizeof(SharingLog_FastShareServerResponse::device_type_) + - PROTOBUF_FIELD_OFFSET(SharingLog_FastShareServerResponse, status_)>( + reinterpret_cast(&status_), + reinterpret_cast(&other->status_)); +} + +std::string SharingLog_FastShareServerResponse::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse"; +} + + +// =================================================================== + +class SharingLog_SendStart::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_session_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_transfer_position(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_concurrent_connections(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info(const SharingLog_SendStart* msg); + static void set_has_share_target_info(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& +SharingLog_SendStart::_Internal::share_target_info(const SharingLog_SendStart* msg) { + return *msg->share_target_info_; +} +SharingLog_SendStart::SharingLog_SendStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendStart) +} +SharingLog_SendStart::SharingLog_SendStart(const SharingLog_SendStart& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + if (from._internal_has_share_target_info()) { + share_target_info_ = new ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo(*from.share_target_info_); + } else { + share_target_info_ = nullptr; + } + ::memcpy(&session_id_, &from.session_id_, + static_cast(reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendStart) +} + +inline void SharingLog_SendStart::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&share_target_info_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&share_target_info_)) + sizeof(concurrent_connections_)); +} + +SharingLog_SendStart::~SharingLog_SendStart() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendStart) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendStart::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (this != internal_default_instance()) delete share_target_info_; +} + +void SharingLog_SendStart::ArenaDtor(void* object) { + SharingLog_SendStart* _this = reinterpret_cast< SharingLog_SendStart* >(object); + (void)_this; +} +void SharingLog_SendStart::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendStart::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendStart::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendStart) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(share_target_info_ != nullptr); + share_target_info_->Clear(); + } + if (cached_has_bits & 0x0000000eu) { + ::memset(&session_id_, 0, static_cast( + reinterpret_cast(&concurrent_connections_) - + reinterpret_cast(&session_id_)) + sizeof(concurrent_connections_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendStart::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int64 session_id = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_session_id(&has_bits); + session_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 transfer_position = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_transfer_position(&has_bits); + transfer_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int32 concurrent_connections = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_concurrent_connections(&has_bits); + concurrent_connections_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_share_target_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendStart::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendStart) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(1, this->_internal_session_id(), target); + } + + // optional int32 transfer_position = 2; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_transfer_position(), target); + } + + // optional int32 concurrent_connections = 3; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_concurrent_connections(), target); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 4; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 4, _Internal::share_target_info(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendStart) + return target; +} + +size_t SharingLog_SendStart::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendStart) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 4; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *share_target_info_); + } + + // optional int64 session_id = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_session_id()); + } + + // optional int32 transfer_position = 2; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_transfer_position()); + } + + // optional int32 concurrent_connections = 3; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_concurrent_connections()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendStart::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendStart::MergeFrom(const SharingLog_SendStart& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendStart) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_share_target_info()->::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo::MergeFrom(from._internal_share_target_info()); + } + if (cached_has_bits & 0x00000002u) { + session_id_ = from.session_id_; + } + if (cached_has_bits & 0x00000004u) { + transfer_position_ = from.transfer_position_; + } + if (cached_has_bits & 0x00000008u) { + concurrent_connections_ = from.concurrent_connections_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendStart::CopyFrom(const SharingLog_SendStart& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendStart) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendStart::IsInitialized() const { + return true; +} + +void SharingLog_SendStart::InternalSwap(SharingLog_SendStart* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_SendStart, concurrent_connections_) + + sizeof(SharingLog_SendStart::concurrent_connections_) + - PROTOBUF_FIELD_OFFSET(SharingLog_SendStart, share_target_info_)>( + reinterpret_cast(&share_target_info_), + reinterpret_cast(&other->share_target_info_)); +} + +std::string SharingLog_SendStart::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendStart"; +} + + +// =================================================================== + +class SharingLog_AcceptFastInitialization::_Internal { + public: +}; + +SharingLog_AcceptFastInitialization::SharingLog_AcceptFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) +} +SharingLog_AcceptFastInitialization::SharingLog_AcceptFastInitialization(const SharingLog_AcceptFastInitialization& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) +} + +inline void SharingLog_AcceptFastInitialization::SharedCtor() { +} + +SharingLog_AcceptFastInitialization::~SharingLog_AcceptFastInitialization() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AcceptFastInitialization::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AcceptFastInitialization::ArenaDtor(void* object) { + SharingLog_AcceptFastInitialization* _this = reinterpret_cast< SharingLog_AcceptFastInitialization* >(object); + (void)_this; +} +void SharingLog_AcceptFastInitialization::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AcceptFastInitialization::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AcceptFastInitialization::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_AcceptFastInitialization::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AcceptFastInitialization::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + return target; +} + +size_t SharingLog_AcceptFastInitialization::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AcceptFastInitialization::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AcceptFastInitialization::MergeFrom(const SharingLog_AcceptFastInitialization& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AcceptFastInitialization::CopyFrom(const SharingLog_AcceptFastInitialization& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AcceptFastInitialization::IsInitialized() const { + return true; +} + +void SharingLog_AcceptFastInitialization::InternalSwap(SharingLog_AcceptFastInitialization* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_AcceptFastInitialization::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization"; +} + + +// =================================================================== + +class SharingLog_LaunchActivity::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_activity_name(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_duration_millis(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_referrer_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_previous_transfer_in_progress(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_has_opted_in(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_source_activity_name(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static void set_has_is_finishing(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } +}; + +SharingLog_LaunchActivity::SharingLog_LaunchActivity(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) +} +SharingLog_LaunchActivity::SharingLog_LaunchActivity(const SharingLog_LaunchActivity& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_referrer_name()) { + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_referrer_name(), + GetArenaForAllocation()); + } + ::memcpy(&duration_millis_, &from.duration_millis_, + static_cast(reinterpret_cast(&source_activity_name_) - + reinterpret_cast(&duration_millis_)) + sizeof(source_activity_name_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) +} + +inline void SharingLog_LaunchActivity::SharedCtor() { +referrer_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&duration_millis_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&source_activity_name_) - + reinterpret_cast(&duration_millis_)) + sizeof(source_activity_name_)); +} + +SharingLog_LaunchActivity::~SharingLog_LaunchActivity() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_LaunchActivity::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + referrer_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_LaunchActivity::ArenaDtor(void* object) { + SharingLog_LaunchActivity* _this = reinterpret_cast< SharingLog_LaunchActivity* >(object); + (void)_this; +} +void SharingLog_LaunchActivity::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_LaunchActivity::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_LaunchActivity::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + referrer_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x0000007eu) { + ::memset(&duration_millis_, 0, static_cast( + reinterpret_cast(&source_activity_name_) - + reinterpret_cast(&duration_millis_)) + sizeof(source_activity_name_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_LaunchActivity::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ActivityName_IsValid(val))) { + _internal_set_activity_name(static_cast<::location::nearby::proto::sharing::ActivityName>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 duration_millis = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_duration_millis(&has_bits); + duration_millis_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string referrer_name = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_referrer_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool previous_transfer_in_progress = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_previous_transfer_in_progress(&has_bits); + previous_transfer_in_progress_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool has_opted_in = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_has_opted_in(&has_bits); + has_opted_in_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ActivityName_IsValid(val))) { + _internal_set_source_activity_name(static_cast<::location::nearby::proto::sharing::ActivityName>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(6, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional bool is_finishing = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_is_finishing(&has_bits); + is_finishing_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_LaunchActivity::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_activity_name(), target); + } + + // optional int64 duration_millis = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_duration_millis(), target); + } + + // optional string referrer_name = 3; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_referrer_name(), target); + } + + // optional bool previous_transfer_in_progress = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_previous_transfer_in_progress(), target); + } + + // optional bool has_opted_in = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(5, this->_internal_has_opted_in(), target); + } + + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 6; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 6, this->_internal_source_activity_name(), target); + } + + // optional bool is_finishing = 7; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(7, this->_internal_is_finishing(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + return target; +} + +size_t SharingLog_LaunchActivity::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + // optional string referrer_name = 3; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_referrer_name()); + } + + // optional int64 duration_millis = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_duration_millis()); + } + + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_activity_name()); + } + + // optional bool previous_transfer_in_progress = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + 1; + } + + // optional bool has_opted_in = 5; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + 1; + } + + // optional bool is_finishing = 7; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + 1; + } + + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 6; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_activity_name()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_LaunchActivity::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_LaunchActivity::MergeFrom(const SharingLog_LaunchActivity& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_referrer_name(from._internal_referrer_name()); + } + if (cached_has_bits & 0x00000002u) { + duration_millis_ = from.duration_millis_; + } + if (cached_has_bits & 0x00000004u) { + activity_name_ = from.activity_name_; + } + if (cached_has_bits & 0x00000008u) { + previous_transfer_in_progress_ = from.previous_transfer_in_progress_; + } + if (cached_has_bits & 0x00000010u) { + has_opted_in_ = from.has_opted_in_; + } + if (cached_has_bits & 0x00000020u) { + is_finishing_ = from.is_finishing_; + } + if (cached_has_bits & 0x00000040u) { + source_activity_name_ = from.source_activity_name_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_LaunchActivity::CopyFrom(const SharingLog_LaunchActivity& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_LaunchActivity::IsInitialized() const { + return true; +} + +void SharingLog_LaunchActivity::InternalSwap(SharingLog_LaunchActivity* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &referrer_name_, lhs_arena, + &other->referrer_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_LaunchActivity, source_activity_name_) + + sizeof(SharingLog_LaunchActivity::source_activity_name_) + - PROTOBUF_FIELD_OFFSET(SharingLog_LaunchActivity, duration_millis_)>( + reinterpret_cast(&duration_millis_), + reinterpret_cast(&other->duration_millis_)); +} + +std::string SharingLog_LaunchActivity::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.LaunchActivity"; +} + + +// =================================================================== + +class SharingLog_DismissPrivacyNotification::_Internal { + public: +}; + +SharingLog_DismissPrivacyNotification::SharingLog_DismissPrivacyNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) +} +SharingLog_DismissPrivacyNotification::SharingLog_DismissPrivacyNotification(const SharingLog_DismissPrivacyNotification& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) +} + +inline void SharingLog_DismissPrivacyNotification::SharedCtor() { +} + +SharingLog_DismissPrivacyNotification::~SharingLog_DismissPrivacyNotification() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DismissPrivacyNotification::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DismissPrivacyNotification::ArenaDtor(void* object) { + SharingLog_DismissPrivacyNotification* _this = reinterpret_cast< SharingLog_DismissPrivacyNotification* >(object); + (void)_this; +} +void SharingLog_DismissPrivacyNotification::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DismissPrivacyNotification::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DismissPrivacyNotification::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_DismissPrivacyNotification::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DismissPrivacyNotification::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + return target; +} + +size_t SharingLog_DismissPrivacyNotification::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DismissPrivacyNotification::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DismissPrivacyNotification::MergeFrom(const SharingLog_DismissPrivacyNotification& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DismissPrivacyNotification::CopyFrom(const SharingLog_DismissPrivacyNotification& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DismissPrivacyNotification::IsInitialized() const { + return true; +} + +void SharingLog_DismissPrivacyNotification::InternalSwap(SharingLog_DismissPrivacyNotification* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_DismissPrivacyNotification::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification"; +} + + +// =================================================================== + +class SharingLog_TapPrivacyNotification::_Internal { + public: +}; + +SharingLog_TapPrivacyNotification::SharingLog_TapPrivacyNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) +} +SharingLog_TapPrivacyNotification::SharingLog_TapPrivacyNotification(const SharingLog_TapPrivacyNotification& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) +} + +inline void SharingLog_TapPrivacyNotification::SharedCtor() { +} + +SharingLog_TapPrivacyNotification::~SharingLog_TapPrivacyNotification() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TapPrivacyNotification::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TapPrivacyNotification::ArenaDtor(void* object) { + SharingLog_TapPrivacyNotification* _this = reinterpret_cast< SharingLog_TapPrivacyNotification* >(object); + (void)_this; +} +void SharingLog_TapPrivacyNotification::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TapPrivacyNotification::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TapPrivacyNotification::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_TapPrivacyNotification::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TapPrivacyNotification::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + return target; +} + +size_t SharingLog_TapPrivacyNotification::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TapPrivacyNotification::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TapPrivacyNotification::MergeFrom(const SharingLog_TapPrivacyNotification& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TapPrivacyNotification::CopyFrom(const SharingLog_TapPrivacyNotification& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TapPrivacyNotification::IsInitialized() const { + return true; +} + +void SharingLog_TapPrivacyNotification::InternalSwap(SharingLog_TapPrivacyNotification* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_TapPrivacyNotification::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification"; +} + + +// =================================================================== + +class SharingLog_TapHelp::_Internal { + public: +}; + +SharingLog_TapHelp::SharingLog_TapHelp(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TapHelp) +} +SharingLog_TapHelp::SharingLog_TapHelp(const SharingLog_TapHelp& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TapHelp) +} + +inline void SharingLog_TapHelp::SharedCtor() { +} + +SharingLog_TapHelp::~SharingLog_TapHelp() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TapHelp) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TapHelp::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TapHelp::ArenaDtor(void* object) { + SharingLog_TapHelp* _this = reinterpret_cast< SharingLog_TapHelp* >(object); + (void)_this; +} +void SharingLog_TapHelp::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TapHelp::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TapHelp::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TapHelp) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_TapHelp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TapHelp::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TapHelp) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TapHelp) + return target; +} + +size_t SharingLog_TapHelp::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TapHelp) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TapHelp::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TapHelp::MergeFrom(const SharingLog_TapHelp& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TapHelp) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TapHelp::CopyFrom(const SharingLog_TapHelp& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TapHelp) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TapHelp::IsInitialized() const { + return true; +} + +void SharingLog_TapHelp::InternalSwap(SharingLog_TapHelp* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_TapHelp::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TapHelp"; +} + + +// =================================================================== + +class SharingLog_TapFeedback::_Internal { + public: +}; + +SharingLog_TapFeedback::SharingLog_TapFeedback(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TapFeedback) +} +SharingLog_TapFeedback::SharingLog_TapFeedback(const SharingLog_TapFeedback& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TapFeedback) +} + +inline void SharingLog_TapFeedback::SharedCtor() { +} + +SharingLog_TapFeedback::~SharingLog_TapFeedback() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TapFeedback::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TapFeedback::ArenaDtor(void* object) { + SharingLog_TapFeedback* _this = reinterpret_cast< SharingLog_TapFeedback* >(object); + (void)_this; +} +void SharingLog_TapFeedback::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TapFeedback::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TapFeedback::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_TapFeedback::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TapFeedback::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + return target; +} + +size_t SharingLog_TapFeedback::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TapFeedback::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TapFeedback::MergeFrom(const SharingLog_TapFeedback& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TapFeedback::CopyFrom(const SharingLog_TapFeedback& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TapFeedback::IsInitialized() const { + return true; +} + +void SharingLog_TapFeedback::InternalSwap(SharingLog_TapFeedback* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_TapFeedback::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TapFeedback"; +} + + +// =================================================================== + +class SharingLog_AddQuickSettingsTile::_Internal { + public: +}; + +SharingLog_AddQuickSettingsTile::SharingLog_AddQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) +} +SharingLog_AddQuickSettingsTile::SharingLog_AddQuickSettingsTile(const SharingLog_AddQuickSettingsTile& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) +} + +inline void SharingLog_AddQuickSettingsTile::SharedCtor() { +} + +SharingLog_AddQuickSettingsTile::~SharingLog_AddQuickSettingsTile() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AddQuickSettingsTile::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AddQuickSettingsTile::ArenaDtor(void* object) { + SharingLog_AddQuickSettingsTile* _this = reinterpret_cast< SharingLog_AddQuickSettingsTile* >(object); + (void)_this; +} +void SharingLog_AddQuickSettingsTile::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AddQuickSettingsTile::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AddQuickSettingsTile::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_AddQuickSettingsTile::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AddQuickSettingsTile::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + return target; +} + +size_t SharingLog_AddQuickSettingsTile::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AddQuickSettingsTile::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AddQuickSettingsTile::MergeFrom(const SharingLog_AddQuickSettingsTile& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AddQuickSettingsTile::CopyFrom(const SharingLog_AddQuickSettingsTile& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AddQuickSettingsTile::IsInitialized() const { + return true; +} + +void SharingLog_AddQuickSettingsTile::InternalSwap(SharingLog_AddQuickSettingsTile* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_AddQuickSettingsTile::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile"; +} + + +// =================================================================== + +class SharingLog_RemoveQuickSettingsTile::_Internal { + public: +}; + +SharingLog_RemoveQuickSettingsTile::SharingLog_RemoveQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) +} +SharingLog_RemoveQuickSettingsTile::SharingLog_RemoveQuickSettingsTile(const SharingLog_RemoveQuickSettingsTile& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) +} + +inline void SharingLog_RemoveQuickSettingsTile::SharedCtor() { +} + +SharingLog_RemoveQuickSettingsTile::~SharingLog_RemoveQuickSettingsTile() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_RemoveQuickSettingsTile::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_RemoveQuickSettingsTile::ArenaDtor(void* object) { + SharingLog_RemoveQuickSettingsTile* _this = reinterpret_cast< SharingLog_RemoveQuickSettingsTile* >(object); + (void)_this; +} +void SharingLog_RemoveQuickSettingsTile::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_RemoveQuickSettingsTile::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_RemoveQuickSettingsTile::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_RemoveQuickSettingsTile::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_RemoveQuickSettingsTile::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + return target; +} + +size_t SharingLog_RemoveQuickSettingsTile::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_RemoveQuickSettingsTile::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_RemoveQuickSettingsTile::MergeFrom(const SharingLog_RemoveQuickSettingsTile& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_RemoveQuickSettingsTile::CopyFrom(const SharingLog_RemoveQuickSettingsTile& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_RemoveQuickSettingsTile::IsInitialized() const { + return true; +} + +void SharingLog_RemoveQuickSettingsTile::InternalSwap(SharingLog_RemoveQuickSettingsTile* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_RemoveQuickSettingsTile::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile"; +} + + +// =================================================================== + +class SharingLog_LaunchPhoneConsent::_Internal { + public: +}; + +SharingLog_LaunchPhoneConsent::SharingLog_LaunchPhoneConsent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) +} +SharingLog_LaunchPhoneConsent::SharingLog_LaunchPhoneConsent(const SharingLog_LaunchPhoneConsent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) +} + +inline void SharingLog_LaunchPhoneConsent::SharedCtor() { +} + +SharingLog_LaunchPhoneConsent::~SharingLog_LaunchPhoneConsent() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_LaunchPhoneConsent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_LaunchPhoneConsent::ArenaDtor(void* object) { + SharingLog_LaunchPhoneConsent* _this = reinterpret_cast< SharingLog_LaunchPhoneConsent* >(object); + (void)_this; +} +void SharingLog_LaunchPhoneConsent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_LaunchPhoneConsent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_LaunchPhoneConsent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_LaunchPhoneConsent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_LaunchPhoneConsent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + return target; +} + +size_t SharingLog_LaunchPhoneConsent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_LaunchPhoneConsent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_LaunchPhoneConsent::MergeFrom(const SharingLog_LaunchPhoneConsent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_LaunchPhoneConsent::CopyFrom(const SharingLog_LaunchPhoneConsent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_LaunchPhoneConsent::IsInitialized() const { + return true; +} + +void SharingLog_LaunchPhoneConsent::InternalSwap(SharingLog_LaunchPhoneConsent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_LaunchPhoneConsent::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent"; +} + + +// =================================================================== + +class SharingLog_DisplayPhoneConsent::_Internal { + public: +}; + +SharingLog_DisplayPhoneConsent::SharingLog_DisplayPhoneConsent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) +} +SharingLog_DisplayPhoneConsent::SharingLog_DisplayPhoneConsent(const SharingLog_DisplayPhoneConsent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) +} + +inline void SharingLog_DisplayPhoneConsent::SharedCtor() { +} + +SharingLog_DisplayPhoneConsent::~SharingLog_DisplayPhoneConsent() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DisplayPhoneConsent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DisplayPhoneConsent::ArenaDtor(void* object) { + SharingLog_DisplayPhoneConsent* _this = reinterpret_cast< SharingLog_DisplayPhoneConsent* >(object); + (void)_this; +} +void SharingLog_DisplayPhoneConsent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DisplayPhoneConsent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DisplayPhoneConsent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_DisplayPhoneConsent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DisplayPhoneConsent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + return target; +} + +size_t SharingLog_DisplayPhoneConsent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DisplayPhoneConsent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DisplayPhoneConsent::MergeFrom(const SharingLog_DisplayPhoneConsent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DisplayPhoneConsent::CopyFrom(const SharingLog_DisplayPhoneConsent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DisplayPhoneConsent::IsInitialized() const { + return true; +} + +void SharingLog_DisplayPhoneConsent::InternalSwap(SharingLog_DisplayPhoneConsent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_DisplayPhoneConsent::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent"; +} + + +// =================================================================== + +class SharingLog_TapQuickSettingsTile::_Internal { + public: +}; + +SharingLog_TapQuickSettingsTile::SharingLog_TapQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) +} +SharingLog_TapQuickSettingsTile::SharingLog_TapQuickSettingsTile(const SharingLog_TapQuickSettingsTile& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) +} + +inline void SharingLog_TapQuickSettingsTile::SharedCtor() { +} + +SharingLog_TapQuickSettingsTile::~SharingLog_TapQuickSettingsTile() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TapQuickSettingsTile::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TapQuickSettingsTile::ArenaDtor(void* object) { + SharingLog_TapQuickSettingsTile* _this = reinterpret_cast< SharingLog_TapQuickSettingsTile* >(object); + (void)_this; +} +void SharingLog_TapQuickSettingsTile::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TapQuickSettingsTile::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TapQuickSettingsTile::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_TapQuickSettingsTile::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TapQuickSettingsTile::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + return target; +} + +size_t SharingLog_TapQuickSettingsTile::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TapQuickSettingsTile::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TapQuickSettingsTile::MergeFrom(const SharingLog_TapQuickSettingsTile& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TapQuickSettingsTile::CopyFrom(const SharingLog_TapQuickSettingsTile& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TapQuickSettingsTile::IsInitialized() const { + return true; +} + +void SharingLog_TapQuickSettingsTile::InternalSwap(SharingLog_TapQuickSettingsTile* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_TapQuickSettingsTile::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile"; +} + + +// =================================================================== + +class SharingLog_TapQuickSettingsFileShare::_Internal { + public: +}; + +SharingLog_TapQuickSettingsFileShare::SharingLog_TapQuickSettingsFileShare(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) +} +SharingLog_TapQuickSettingsFileShare::SharingLog_TapQuickSettingsFileShare(const SharingLog_TapQuickSettingsFileShare& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) +} + +inline void SharingLog_TapQuickSettingsFileShare::SharedCtor() { +} + +SharingLog_TapQuickSettingsFileShare::~SharingLog_TapQuickSettingsFileShare() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TapQuickSettingsFileShare::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TapQuickSettingsFileShare::ArenaDtor(void* object) { + SharingLog_TapQuickSettingsFileShare* _this = reinterpret_cast< SharingLog_TapQuickSettingsFileShare* >(object); + (void)_this; +} +void SharingLog_TapQuickSettingsFileShare::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TapQuickSettingsFileShare::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TapQuickSettingsFileShare::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_TapQuickSettingsFileShare::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TapQuickSettingsFileShare::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + return target; +} + +size_t SharingLog_TapQuickSettingsFileShare::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TapQuickSettingsFileShare::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TapQuickSettingsFileShare::MergeFrom(const SharingLog_TapQuickSettingsFileShare& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TapQuickSettingsFileShare::CopyFrom(const SharingLog_TapQuickSettingsFileShare& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TapQuickSettingsFileShare::IsInitialized() const { + return true; +} + +void SharingLog_TapQuickSettingsFileShare::InternalSwap(SharingLog_TapQuickSettingsFileShare* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_TapQuickSettingsFileShare::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare"; +} + + +// =================================================================== + +class SharingLog_DisplayPrivacyNotification::_Internal { + public: +}; + +SharingLog_DisplayPrivacyNotification::SharingLog_DisplayPrivacyNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) +} +SharingLog_DisplayPrivacyNotification::SharingLog_DisplayPrivacyNotification(const SharingLog_DisplayPrivacyNotification& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) +} + +inline void SharingLog_DisplayPrivacyNotification::SharedCtor() { +} + +SharingLog_DisplayPrivacyNotification::~SharingLog_DisplayPrivacyNotification() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DisplayPrivacyNotification::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DisplayPrivacyNotification::ArenaDtor(void* object) { + SharingLog_DisplayPrivacyNotification* _this = reinterpret_cast< SharingLog_DisplayPrivacyNotification* >(object); + (void)_this; +} +void SharingLog_DisplayPrivacyNotification::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DisplayPrivacyNotification::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DisplayPrivacyNotification::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_DisplayPrivacyNotification::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DisplayPrivacyNotification::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + return target; +} + +size_t SharingLog_DisplayPrivacyNotification::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DisplayPrivacyNotification::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DisplayPrivacyNotification::MergeFrom(const SharingLog_DisplayPrivacyNotification& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DisplayPrivacyNotification::CopyFrom(const SharingLog_DisplayPrivacyNotification& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DisplayPrivacyNotification::IsInitialized() const { + return true; +} + +void SharingLog_DisplayPrivacyNotification::InternalSwap(SharingLog_DisplayPrivacyNotification* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_DisplayPrivacyNotification::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification"; +} + + +// =================================================================== + +class SharingLog_DefaultOptIn::_Internal { + public: +}; + +SharingLog_DefaultOptIn::SharingLog_DefaultOptIn(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) +} +SharingLog_DefaultOptIn::SharingLog_DefaultOptIn(const SharingLog_DefaultOptIn& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) +} + +inline void SharingLog_DefaultOptIn::SharedCtor() { +} + +SharingLog_DefaultOptIn::~SharingLog_DefaultOptIn() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DefaultOptIn::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DefaultOptIn::ArenaDtor(void* object) { + SharingLog_DefaultOptIn* _this = reinterpret_cast< SharingLog_DefaultOptIn* >(object); + (void)_this; +} +void SharingLog_DefaultOptIn::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DefaultOptIn::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DefaultOptIn::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_DefaultOptIn::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DefaultOptIn::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + return target; +} + +size_t SharingLog_DefaultOptIn::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DefaultOptIn::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DefaultOptIn::MergeFrom(const SharingLog_DefaultOptIn& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DefaultOptIn::CopyFrom(const SharingLog_DefaultOptIn& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DefaultOptIn::IsInitialized() const { + return true; +} + +void SharingLog_DefaultOptIn::InternalSwap(SharingLog_DefaultOptIn* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_DefaultOptIn::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DefaultOptIn"; +} + + +// =================================================================== + +class SharingLog_SetDeviceName::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_device_name_size(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_SetDeviceName::SharingLog_SetDeviceName(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) +} +SharingLog_SetDeviceName::SharingLog_SetDeviceName(const SharingLog_SetDeviceName& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + device_name_size_ = from.device_name_size_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) +} + +inline void SharingLog_SetDeviceName::SharedCtor() { +device_name_size_ = 0; +} + +SharingLog_SetDeviceName::~SharingLog_SetDeviceName() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SetDeviceName::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SetDeviceName::ArenaDtor(void* object) { + SharingLog_SetDeviceName* _this = reinterpret_cast< SharingLog_SetDeviceName* >(object); + (void)_this; +} +void SharingLog_SetDeviceName::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SetDeviceName::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SetDeviceName::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + device_name_size_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SetDeviceName::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 device_name_size = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_device_name_size(&has_bits); + device_name_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SetDeviceName::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 device_name_size = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_device_name_size(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + return target; +} + +size_t SharingLog_SetDeviceName::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional int32 device_name_size = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_device_name_size()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SetDeviceName::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SetDeviceName::MergeFrom(const SharingLog_SetDeviceName& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_device_name_size()) { + _internal_set_device_name_size(from._internal_device_name_size()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SetDeviceName::CopyFrom(const SharingLog_SetDeviceName& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SetDeviceName::IsInitialized() const { + return true; +} + +void SharingLog_SetDeviceName::InternalSwap(SharingLog_SetDeviceName* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(device_name_size_, other->device_name_size_); +} + +std::string SharingLog_SetDeviceName::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SetDeviceName"; +} + + +// =================================================================== + +class SharingLog_RequestSettingPermissions::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_permission_type(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_permission_request_result(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_RequestSettingPermissions::SharingLog_RequestSettingPermissions(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) +} +SharingLog_RequestSettingPermissions::SharingLog_RequestSettingPermissions(const SharingLog_RequestSettingPermissions& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&permission_type_, &from.permission_type_, + static_cast(reinterpret_cast(&permission_request_result_) - + reinterpret_cast(&permission_type_)) + sizeof(permission_request_result_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) +} + +inline void SharingLog_RequestSettingPermissions::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&permission_type_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&permission_request_result_) - + reinterpret_cast(&permission_type_)) + sizeof(permission_request_result_)); +} + +SharingLog_RequestSettingPermissions::~SharingLog_RequestSettingPermissions() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_RequestSettingPermissions::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_RequestSettingPermissions::ArenaDtor(void* object) { + SharingLog_RequestSettingPermissions* _this = reinterpret_cast< SharingLog_RequestSettingPermissions* >(object); + (void)_this; +} +void SharingLog_RequestSettingPermissions::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_RequestSettingPermissions::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_RequestSettingPermissions::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&permission_type_, 0, static_cast( + reinterpret_cast(&permission_request_result_) - + reinterpret_cast(&permission_type_)) + sizeof(permission_request_result_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_RequestSettingPermissions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.PermissionRequestType permission_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::PermissionRequestType_IsValid(val))) { + _internal_set_permission_type(static_cast<::location::nearby::proto::sharing::PermissionRequestType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.PermissionRequestResult permission_request_result = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::PermissionRequestResult_IsValid(val))) { + _internal_set_permission_request_result(static_cast<::location::nearby::proto::sharing::PermissionRequestResult>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_RequestSettingPermissions::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.PermissionRequestType permission_type = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_permission_type(), target); + } + + // optional .location.nearby.proto.sharing.PermissionRequestResult permission_request_result = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_permission_request_result(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + return target; +} + +size_t SharingLog_RequestSettingPermissions::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.sharing.PermissionRequestType permission_type = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_permission_type()); + } + + // optional .location.nearby.proto.sharing.PermissionRequestResult permission_request_result = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_permission_request_result()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_RequestSettingPermissions::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_RequestSettingPermissions::MergeFrom(const SharingLog_RequestSettingPermissions& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + permission_type_ = from.permission_type_; + } + if (cached_has_bits & 0x00000002u) { + permission_request_result_ = from.permission_request_result_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_RequestSettingPermissions::CopyFrom(const SharingLog_RequestSettingPermissions& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_RequestSettingPermissions::IsInitialized() const { + return true; +} + +void SharingLog_RequestSettingPermissions::InternalSwap(SharingLog_RequestSettingPermissions* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_RequestSettingPermissions, permission_request_result_) + + sizeof(SharingLog_RequestSettingPermissions::permission_request_result_) + - PROTOBUF_FIELD_OFFSET(SharingLog_RequestSettingPermissions, permission_type_)>( + reinterpret_cast(&permission_type_), + reinterpret_cast(&other->permission_type_)); +} + +std::string SharingLog_RequestSettingPermissions::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions"; +} + + +// =================================================================== + +class SharingLog_LaunchConsent::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_consent_type(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_LaunchConsent::SharingLog_LaunchConsent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) +} +SharingLog_LaunchConsent::SharingLog_LaunchConsent(const SharingLog_LaunchConsent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&consent_type_, &from.consent_type_, + static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&consent_type_)) + sizeof(status_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) +} + +inline void SharingLog_LaunchConsent::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&consent_type_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&status_) - + reinterpret_cast(&consent_type_)) + sizeof(status_)); +} + +SharingLog_LaunchConsent::~SharingLog_LaunchConsent() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_LaunchConsent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_LaunchConsent::ArenaDtor(void* object) { + SharingLog_LaunchConsent* _this = reinterpret_cast< SharingLog_LaunchConsent* >(object); + (void)_this; +} +void SharingLog_LaunchConsent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_LaunchConsent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_LaunchConsent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&consent_type_, 0, static_cast( + reinterpret_cast(&status_) - + reinterpret_cast(&consent_type_)) + sizeof(status_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_LaunchConsent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ConsentType consent_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ConsentType_IsValid(val))) { + _internal_set_consent_type(static_cast<::location::nearby::proto::sharing::ConsentType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ConsentAcceptanceStatus status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ConsentAcceptanceStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::ConsentAcceptanceStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_LaunchConsent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ConsentType consent_type = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_consent_type(), target); + } + + // optional .location.nearby.proto.sharing.ConsentAcceptanceStatus status = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_status(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + return target; +} + +size_t SharingLog_LaunchConsent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.sharing.ConsentType consent_type = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_consent_type()); + } + + // optional .location.nearby.proto.sharing.ConsentAcceptanceStatus status = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_LaunchConsent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_LaunchConsent::MergeFrom(const SharingLog_LaunchConsent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + consent_type_ = from.consent_type_; + } + if (cached_has_bits & 0x00000002u) { + status_ = from.status_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_LaunchConsent::CopyFrom(const SharingLog_LaunchConsent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_LaunchConsent::IsInitialized() const { + return true; +} + +void SharingLog_LaunchConsent::InternalSwap(SharingLog_LaunchConsent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_LaunchConsent, status_) + + sizeof(SharingLog_LaunchConsent::status_) + - PROTOBUF_FIELD_OFFSET(SharingLog_LaunchConsent, consent_type_)>( + reinterpret_cast(&consent_type_), + reinterpret_cast(&other->consent_type_)); +} + +std::string SharingLog_LaunchConsent::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.LaunchConsent"; +} + + +// =================================================================== + +class SharingLog_InstallAPKStatus::_Internal { + public: +}; + +SharingLog_InstallAPKStatus::SharingLog_InstallAPKStatus(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned), + status_(arena), + source_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) +} +SharingLog_InstallAPKStatus::SharingLog_InstallAPKStatus(const SharingLog_InstallAPKStatus& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + status_(from.status_), + source_(from.source_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) +} + +inline void SharingLog_InstallAPKStatus::SharedCtor() { +} + +SharingLog_InstallAPKStatus::~SharingLog_InstallAPKStatus() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_InstallAPKStatus::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_InstallAPKStatus::ArenaDtor(void* object) { + SharingLog_InstallAPKStatus* _this = reinterpret_cast< SharingLog_InstallAPKStatus* >(object); + (void)_this; +} +void SharingLog_InstallAPKStatus::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_InstallAPKStatus::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_InstallAPKStatus::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + status_.Clear(); + source_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_InstallAPKStatus::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .location.nearby.proto.sharing.InstallAPKStatus status = 1 [packed = true]; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_status(), ptr, ctx, ::location::nearby::proto::sharing::InstallAPKStatus_IsValid, &_internal_metadata_, 1); + CHK_(ptr); + } else if (static_cast(tag) == 8) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::InstallAPKStatus_IsValid(val))) { + _internal_add_status(static_cast<::location::nearby::proto::sharing::InstallAPKStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_source(), ptr, ctx, ::location::nearby::proto::sharing::ApkSource_IsValid, &_internal_metadata_, 2); + CHK_(ptr); + } else if (static_cast(tag) == 16) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ApkSource_IsValid(val))) { + _internal_add_source(static_cast<::location::nearby::proto::sharing::ApkSource>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_InstallAPKStatus::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .location.nearby.proto.sharing.InstallAPKStatus status = 1 [packed = true]; + { + int byte_size = _status_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 1, status_, byte_size, target); + } + } + + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + { + int byte_size = _source_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 2, source_, byte_size, target); + } + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + return target; +} + +size_t SharingLog_InstallAPKStatus::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .location.nearby.proto.sharing.InstallAPKStatus status = 1 [packed = true]; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_status_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_status(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _status_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_source_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_source(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _source_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_InstallAPKStatus::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_InstallAPKStatus::MergeFrom(const SharingLog_InstallAPKStatus& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + status_.MergeFrom(from.status_); + source_.MergeFrom(from.source_); + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_InstallAPKStatus::CopyFrom(const SharingLog_InstallAPKStatus& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_InstallAPKStatus::IsInitialized() const { + return true; +} + +void SharingLog_InstallAPKStatus::InternalSwap(SharingLog_InstallAPKStatus* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + status_.InternalSwap(&other->status_); + source_.InternalSwap(&other->source_); +} + +std::string SharingLog_InstallAPKStatus::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus"; +} + + +// =================================================================== + +class SharingLog_VerifyAPKStatus::_Internal { + public: +}; + +SharingLog_VerifyAPKStatus::SharingLog_VerifyAPKStatus(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned), + status_(arena), + source_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) +} +SharingLog_VerifyAPKStatus::SharingLog_VerifyAPKStatus(const SharingLog_VerifyAPKStatus& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + status_(from.status_), + source_(from.source_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) +} + +inline void SharingLog_VerifyAPKStatus::SharedCtor() { +} + +SharingLog_VerifyAPKStatus::~SharingLog_VerifyAPKStatus() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_VerifyAPKStatus::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_VerifyAPKStatus::ArenaDtor(void* object) { + SharingLog_VerifyAPKStatus* _this = reinterpret_cast< SharingLog_VerifyAPKStatus* >(object); + (void)_this; +} +void SharingLog_VerifyAPKStatus::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_VerifyAPKStatus::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_VerifyAPKStatus::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + status_.Clear(); + source_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_VerifyAPKStatus::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .location.nearby.proto.sharing.VerifyAPKStatus status = 1 [packed = true]; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_status(), ptr, ctx, ::location::nearby::proto::sharing::VerifyAPKStatus_IsValid, &_internal_metadata_, 1); + CHK_(ptr); + } else if (static_cast(tag) == 8) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::VerifyAPKStatus_IsValid(val))) { + _internal_add_status(static_cast<::location::nearby::proto::sharing::VerifyAPKStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedEnumParser(_internal_mutable_source(), ptr, ctx, ::location::nearby::proto::sharing::ApkSource_IsValid, &_internal_metadata_, 2); + CHK_(ptr); + } else if (static_cast(tag) == 16) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ApkSource_IsValid(val))) { + _internal_add_source(static_cast<::location::nearby::proto::sharing::ApkSource>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_VerifyAPKStatus::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .location.nearby.proto.sharing.VerifyAPKStatus status = 1 [packed = true]; + { + int byte_size = _status_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 1, status_, byte_size, target); + } + } + + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + { + int byte_size = _source_cached_byte_size_.load(std::memory_order_relaxed); + if (byte_size > 0) { + target = stream->WriteEnumPacked( + 2, source_, byte_size, target); + } + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + return target; +} + +size_t SharingLog_VerifyAPKStatus::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .location.nearby.proto.sharing.VerifyAPKStatus status = 1 [packed = true]; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_status_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_status(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _status_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + { + size_t data_size = 0; + unsigned int count = static_cast(this->_internal_source_size());for (unsigned int i = 0; i < count; i++) { + data_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize( + this->_internal_source(static_cast(i))); + } + if (data_size > 0) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size( + static_cast(data_size)); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size); + _source_cached_byte_size_.store(cached_size, + std::memory_order_relaxed); + total_size += data_size; + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_VerifyAPKStatus::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_VerifyAPKStatus::MergeFrom(const SharingLog_VerifyAPKStatus& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + status_.MergeFrom(from.status_); + source_.MergeFrom(from.source_); + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_VerifyAPKStatus::CopyFrom(const SharingLog_VerifyAPKStatus& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_VerifyAPKStatus::IsInitialized() const { + return true; +} + +void SharingLog_VerifyAPKStatus::InternalSwap(SharingLog_VerifyAPKStatus* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + status_.InternalSwap(&other->status_); + source_.InternalSwap(&other->source_); +} + +std::string SharingLog_VerifyAPKStatus::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus"; +} + + +// =================================================================== + +class SharingLog_ToggleShowNotification::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_previous_status(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_current_status(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_ToggleShowNotification::SharingLog_ToggleShowNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) +} +SharingLog_ToggleShowNotification::SharingLog_ToggleShowNotification(const SharingLog_ToggleShowNotification& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&previous_status_, &from.previous_status_, + static_cast(reinterpret_cast(¤t_status_) - + reinterpret_cast(&previous_status_)) + sizeof(current_status_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) +} + +inline void SharingLog_ToggleShowNotification::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&previous_status_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(¤t_status_) - + reinterpret_cast(&previous_status_)) + sizeof(current_status_)); +} + +SharingLog_ToggleShowNotification::~SharingLog_ToggleShowNotification() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ToggleShowNotification::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_ToggleShowNotification::ArenaDtor(void* object) { + SharingLog_ToggleShowNotification* _this = reinterpret_cast< SharingLog_ToggleShowNotification* >(object); + (void)_this; +} +void SharingLog_ToggleShowNotification::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ToggleShowNotification::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ToggleShowNotification::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&previous_status_, 0, static_cast( + reinterpret_cast(¤t_status_) - + reinterpret_cast(&previous_status_)) + sizeof(current_status_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ToggleShowNotification::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ShowNotificationStatus previous_status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ShowNotificationStatus_IsValid(val))) { + _internal_set_previous_status(static_cast<::location::nearby::proto::sharing::ShowNotificationStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.ShowNotificationStatus current_status = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ShowNotificationStatus_IsValid(val))) { + _internal_set_current_status(static_cast<::location::nearby::proto::sharing::ShowNotificationStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ToggleShowNotification::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ShowNotificationStatus previous_status = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_previous_status(), target); + } + + // optional .location.nearby.proto.sharing.ShowNotificationStatus current_status = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_current_status(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + return target; +} + +size_t SharingLog_ToggleShowNotification::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.sharing.ShowNotificationStatus previous_status = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_previous_status()); + } + + // optional .location.nearby.proto.sharing.ShowNotificationStatus current_status = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_current_status()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ToggleShowNotification::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ToggleShowNotification::MergeFrom(const SharingLog_ToggleShowNotification& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + previous_status_ = from.previous_status_; + } + if (cached_has_bits & 0x00000002u) { + current_status_ = from.current_status_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ToggleShowNotification::CopyFrom(const SharingLog_ToggleShowNotification& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ToggleShowNotification::IsInitialized() const { + return true; +} + +void SharingLog_ToggleShowNotification::InternalSwap(SharingLog_ToggleShowNotification* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ToggleShowNotification, current_status_) + + sizeof(SharingLog_ToggleShowNotification::current_status_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ToggleShowNotification, previous_status_)>( + reinterpret_cast(&previous_status_), + reinterpret_cast(&other->previous_status_)); +} + +std::string SharingLog_ToggleShowNotification::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification"; +} + + +// =================================================================== + +class SharingLog_DecryptCertificateFailure::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_status(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_DecryptCertificateFailure::SharingLog_DecryptCertificateFailure(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) +} +SharingLog_DecryptCertificateFailure::SharingLog_DecryptCertificateFailure(const SharingLog_DecryptCertificateFailure& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + status_ = from.status_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) +} + +inline void SharingLog_DecryptCertificateFailure::SharedCtor() { +status_ = 0; +} + +SharingLog_DecryptCertificateFailure::~SharingLog_DecryptCertificateFailure() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_DecryptCertificateFailure::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_DecryptCertificateFailure::ArenaDtor(void* object) { + SharingLog_DecryptCertificateFailure* _this = reinterpret_cast< SharingLog_DecryptCertificateFailure* >(object); + (void)_this; +} +void SharingLog_DecryptCertificateFailure::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_DecryptCertificateFailure::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_DecryptCertificateFailure::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + status_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_DecryptCertificateFailure::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.DecryptCertificateFailureStatus status = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DecryptCertificateFailureStatus_IsValid(val))) { + _internal_set_status(static_cast<::location::nearby::proto::sharing::DecryptCertificateFailureStatus>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_DecryptCertificateFailure::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.DecryptCertificateFailureStatus status = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_status(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + return target; +} + +size_t SharingLog_DecryptCertificateFailure::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.proto.sharing.DecryptCertificateFailureStatus status = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_status()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_DecryptCertificateFailure::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_DecryptCertificateFailure::MergeFrom(const SharingLog_DecryptCertificateFailure& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_status()) { + _internal_set_status(from._internal_status()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_DecryptCertificateFailure::CopyFrom(const SharingLog_DecryptCertificateFailure& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_DecryptCertificateFailure::IsInitialized() const { + return true; +} + +void SharingLog_DecryptCertificateFailure::InternalSwap(SharingLog_DecryptCertificateFailure* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(status_, other->status_); +} + +std::string SharingLog_DecryptCertificateFailure::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure"; +} + + +// =================================================================== + +class SharingLog_ShowAllowPermissionAutoAccess::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_activity_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_allowed_auto_access(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_is_wifi_missing(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_is_bt_missing(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +SharingLog_ShowAllowPermissionAutoAccess::SharingLog_ShowAllowPermissionAutoAccess(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) +} +SharingLog_ShowAllowPermissionAutoAccess::SharingLog_ShowAllowPermissionAutoAccess(const SharingLog_ShowAllowPermissionAutoAccess& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&activity_name_, &from.activity_name_, + static_cast(reinterpret_cast(&is_bt_missing_) - + reinterpret_cast(&activity_name_)) + sizeof(is_bt_missing_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) +} + +inline void SharingLog_ShowAllowPermissionAutoAccess::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&activity_name_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&is_bt_missing_) - + reinterpret_cast(&activity_name_)) + sizeof(is_bt_missing_)); +} + +SharingLog_ShowAllowPermissionAutoAccess::~SharingLog_ShowAllowPermissionAutoAccess() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ShowAllowPermissionAutoAccess::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_ShowAllowPermissionAutoAccess::ArenaDtor(void* object) { + SharingLog_ShowAllowPermissionAutoAccess* _this = reinterpret_cast< SharingLog_ShowAllowPermissionAutoAccess* >(object); + (void)_this; +} +void SharingLog_ShowAllowPermissionAutoAccess::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ShowAllowPermissionAutoAccess::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ShowAllowPermissionAutoAccess::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + ::memset(&activity_name_, 0, static_cast( + reinterpret_cast(&is_bt_missing_) - + reinterpret_cast(&activity_name_)) + sizeof(is_bt_missing_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ShowAllowPermissionAutoAccess::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::ActivityName_IsValid(val))) { + _internal_set_activity_name(static_cast<::location::nearby::proto::sharing::ActivityName>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional bool allowed_auto_access = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_allowed_auto_access(&has_bits); + allowed_auto_access_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_wifi_missing = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_is_wifi_missing(&has_bits); + is_wifi_missing_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional bool is_bt_missing = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_is_bt_missing(&has_bits); + is_bt_missing_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ShowAllowPermissionAutoAccess::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_activity_name(), target); + } + + // optional bool allowed_auto_access = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(2, this->_internal_allowed_auto_access(), target); + } + + // optional bool is_wifi_missing = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(3, this->_internal_is_wifi_missing(), target); + } + + // optional bool is_bt_missing = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(4, this->_internal_is_bt_missing(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + return target; +} + +size_t SharingLog_ShowAllowPermissionAutoAccess::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_activity_name()); + } + + // optional bool allowed_auto_access = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + 1; + } + + // optional bool is_wifi_missing = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + 1; + } + + // optional bool is_bt_missing = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + 1; + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ShowAllowPermissionAutoAccess::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ShowAllowPermissionAutoAccess::MergeFrom(const SharingLog_ShowAllowPermissionAutoAccess& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + activity_name_ = from.activity_name_; + } + if (cached_has_bits & 0x00000002u) { + allowed_auto_access_ = from.allowed_auto_access_; + } + if (cached_has_bits & 0x00000004u) { + is_wifi_missing_ = from.is_wifi_missing_; + } + if (cached_has_bits & 0x00000008u) { + is_bt_missing_ = from.is_bt_missing_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ShowAllowPermissionAutoAccess::CopyFrom(const SharingLog_ShowAllowPermissionAutoAccess& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ShowAllowPermissionAutoAccess::IsInitialized() const { + return true; +} + +void SharingLog_ShowAllowPermissionAutoAccess::InternalSwap(SharingLog_ShowAllowPermissionAutoAccess* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ShowAllowPermissionAutoAccess, is_bt_missing_) + + sizeof(SharingLog_ShowAllowPermissionAutoAccess::is_bt_missing_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ShowAllowPermissionAutoAccess, activity_name_)>( + reinterpret_cast(&activity_name_), + reinterpret_cast(&other->activity_name_)); +} + +std::string SharingLog_ShowAllowPermissionAutoAccess::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess"; +} + + +// =================================================================== + +class SharingLog_TapQrCode::_Internal { + public: +}; + +SharingLog_TapQrCode::SharingLog_TapQrCode(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TapQrCode) +} +SharingLog_TapQrCode::SharingLog_TapQrCode(const SharingLog_TapQrCode& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TapQrCode) +} + +inline void SharingLog_TapQrCode::SharedCtor() { +} + +SharingLog_TapQrCode::~SharingLog_TapQrCode() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TapQrCode::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TapQrCode::ArenaDtor(void* object) { + SharingLog_TapQrCode* _this = reinterpret_cast< SharingLog_TapQrCode* >(object); + (void)_this; +} +void SharingLog_TapQrCode::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TapQrCode::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TapQrCode::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_TapQrCode::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TapQrCode::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + return target; +} + +size_t SharingLog_TapQrCode::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TapQrCode::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TapQrCode::MergeFrom(const SharingLog_TapQrCode& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TapQrCode::CopyFrom(const SharingLog_TapQrCode& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TapQrCode::IsInitialized() const { + return true; +} + +void SharingLog_TapQrCode::InternalSwap(SharingLog_TapQrCode* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_TapQrCode::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TapQrCode"; +} + + +// =================================================================== + +class SharingLog_QrCodeLinkShown::_Internal { + public: +}; + +SharingLog_QrCodeLinkShown::SharingLog_QrCodeLinkShown(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) +} +SharingLog_QrCodeLinkShown::SharingLog_QrCodeLinkShown(const SharingLog_QrCodeLinkShown& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite() { + _internal_metadata_.MergeFrom(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) +} + +inline void SharingLog_QrCodeLinkShown::SharedCtor() { +} + +SharingLog_QrCodeLinkShown::~SharingLog_QrCodeLinkShown() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_QrCodeLinkShown::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_QrCodeLinkShown::ArenaDtor(void* object) { + SharingLog_QrCodeLinkShown* _this = reinterpret_cast< SharingLog_QrCodeLinkShown* >(object); + (void)_this; +} +void SharingLog_QrCodeLinkShown::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_QrCodeLinkShown::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_QrCodeLinkShown::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _internal_metadata_.Clear(); +} + +const char* SharingLog_QrCodeLinkShown::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_QrCodeLinkShown::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + return target; +} + +size_t SharingLog_QrCodeLinkShown::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_QrCodeLinkShown::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_QrCodeLinkShown::MergeFrom(const SharingLog_QrCodeLinkShown& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_QrCodeLinkShown::CopyFrom(const SharingLog_QrCodeLinkShown& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_QrCodeLinkShown::IsInitialized() const { + return true; +} + +void SharingLog_QrCodeLinkShown::InternalSwap(SharingLog_QrCodeLinkShown* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); +} + +std::string SharingLog_QrCodeLinkShown::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown"; +} + + +// =================================================================== + +class SharingLog_FastInitDiscoverDevice::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_fast_init_type(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_fast_init_state(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } +}; + +SharingLog_FastInitDiscoverDevice::SharingLog_FastInitDiscoverDevice(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) +} +SharingLog_FastInitDiscoverDevice::SharingLog_FastInitDiscoverDevice(const SharingLog_FastInitDiscoverDevice& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&fast_init_type_, &from.fast_init_type_, + static_cast(reinterpret_cast(&fast_init_state_) - + reinterpret_cast(&fast_init_type_)) + sizeof(fast_init_state_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) +} + +inline void SharingLog_FastInitDiscoverDevice::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&fast_init_type_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&fast_init_state_) - + reinterpret_cast(&fast_init_type_)) + sizeof(fast_init_state_)); +} + +SharingLog_FastInitDiscoverDevice::~SharingLog_FastInitDiscoverDevice() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_FastInitDiscoverDevice::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_FastInitDiscoverDevice::ArenaDtor(void* object) { + SharingLog_FastInitDiscoverDevice* _this = reinterpret_cast< SharingLog_FastInitDiscoverDevice* >(object); + (void)_this; +} +void SharingLog_FastInitDiscoverDevice::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_FastInitDiscoverDevice::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_FastInitDiscoverDevice::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + ::memset(&fast_init_type_, 0, static_cast( + reinterpret_cast(&fast_init_state_) - + reinterpret_cast(&fast_init_type_)) + sizeof(fast_init_state_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_FastInitDiscoverDevice::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.FastInitType fast_init_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::FastInitType_IsValid(val))) { + _internal_set_fast_init_type(static_cast<::location::nearby::proto::sharing::FastInitType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.FastInitState fast_init_state = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::FastInitState_IsValid(val))) { + _internal_set_fast_init_state(static_cast<::location::nearby::proto::sharing::FastInitState>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_FastInitDiscoverDevice::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.FastInitType fast_init_type = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_fast_init_type(), target); + } + + // optional .location.nearby.proto.sharing.FastInitState fast_init_state = 3; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_fast_init_state(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + return target; +} + +size_t SharingLog_FastInitDiscoverDevice::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + // optional .location.nearby.proto.sharing.FastInitType fast_init_type = 2; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_fast_init_type()); + } + + // optional .location.nearby.proto.sharing.FastInitState fast_init_state = 3; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_fast_init_state()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_FastInitDiscoverDevice::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_FastInitDiscoverDevice::MergeFrom(const SharingLog_FastInitDiscoverDevice& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000003u) { + if (cached_has_bits & 0x00000001u) { + fast_init_type_ = from.fast_init_type_; + } + if (cached_has_bits & 0x00000002u) { + fast_init_state_ = from.fast_init_state_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_FastInitDiscoverDevice::CopyFrom(const SharingLog_FastInitDiscoverDevice& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_FastInitDiscoverDevice::IsInitialized() const { + return true; +} + +void SharingLog_FastInitDiscoverDevice::InternalSwap(SharingLog_FastInitDiscoverDevice* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_FastInitDiscoverDevice, fast_init_state_) + + sizeof(SharingLog_FastInitDiscoverDevice::fast_init_state_) + - PROTOBUF_FIELD_OFFSET(SharingLog_FastInitDiscoverDevice, fast_init_type_)>( + reinterpret_cast(&fast_init_type_), + reinterpret_cast(&other->fast_init_type_)); +} + +std::string SharingLog_FastInitDiscoverDevice::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice"; +} + + +// =================================================================== + +class SharingLog_ShareTargetInfo::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_device_type(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_os_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_device_relationship(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_ShareTargetInfo::SharingLog_ShareTargetInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) +} +SharingLog_ShareTargetInfo::SharingLog_ShareTargetInfo(const SharingLog_ShareTargetInfo& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&device_type_, &from.device_type_, + static_cast(reinterpret_cast(&device_relationship_) - + reinterpret_cast(&device_type_)) + sizeof(device_relationship_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) +} + +inline void SharingLog_ShareTargetInfo::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&device_type_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&device_relationship_) - + reinterpret_cast(&device_type_)) + sizeof(device_relationship_)); +} + +SharingLog_ShareTargetInfo::~SharingLog_ShareTargetInfo() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_ShareTargetInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_ShareTargetInfo::ArenaDtor(void* object) { + SharingLog_ShareTargetInfo* _this = reinterpret_cast< SharingLog_ShareTargetInfo* >(object); + (void)_this; +} +void SharingLog_ShareTargetInfo::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_ShareTargetInfo::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_ShareTargetInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + ::memset(&device_type_, 0, static_cast( + reinterpret_cast(&device_relationship_) - + reinterpret_cast(&device_type_)) + sizeof(device_relationship_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_ShareTargetInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.DeviceType device_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DeviceType_IsValid(val))) { + _internal_set_device_type(static_cast<::location::nearby::proto::sharing::DeviceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.OSType os_type = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::OSType_IsValid(val))) { + _internal_set_os_type(static_cast<::location::nearby::proto::sharing::OSType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.DeviceRelationship device_relationship = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DeviceRelationship_IsValid(val))) { + _internal_set_device_relationship(static_cast<::location::nearby::proto::sharing::DeviceRelationship>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_ShareTargetInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.DeviceType device_type = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_device_type(), target); + } + + // optional .location.nearby.proto.sharing.OSType os_type = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 2, this->_internal_os_type(), target); + } + + // optional .location.nearby.proto.sharing.DeviceRelationship device_relationship = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_device_relationship(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + return target; +} + +size_t SharingLog_ShareTargetInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional .location.nearby.proto.sharing.DeviceType device_type = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_device_type()); + } + + // optional .location.nearby.proto.sharing.OSType os_type = 2; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_os_type()); + } + + // optional .location.nearby.proto.sharing.DeviceRelationship device_relationship = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_device_relationship()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_ShareTargetInfo::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_ShareTargetInfo::MergeFrom(const SharingLog_ShareTargetInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + device_type_ = from.device_type_; + } + if (cached_has_bits & 0x00000002u) { + os_type_ = from.os_type_; + } + if (cached_has_bits & 0x00000004u) { + device_relationship_ = from.device_relationship_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_ShareTargetInfo::CopyFrom(const SharingLog_ShareTargetInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_ShareTargetInfo::IsInitialized() const { + return true; +} + +void SharingLog_ShareTargetInfo::InternalSwap(SharingLog_ShareTargetInfo* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_ShareTargetInfo, device_relationship_) + + sizeof(SharingLog_ShareTargetInfo::device_relationship_) + - PROTOBUF_FIELD_OFFSET(SharingLog_ShareTargetInfo, device_type_)>( + reinterpret_cast(&device_type_), + reinterpret_cast(&other->device_type_)); +} + +std::string SharingLog_ShareTargetInfo::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo"; +} + + +// =================================================================== + +class SharingLog_AttachmentsInfo::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_required_app(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_AttachmentsInfo::SharingLog_AttachmentsInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned), + text_attachment_(arena), + file_attachment_(arena), + wifi_credentials_attachment_(arena), + app_attachment_(arena), + stream_attachment_(arena) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) +} +SharingLog_AttachmentsInfo::SharingLog_AttachmentsInfo(const SharingLog_AttachmentsInfo& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_), + text_attachment_(from.text_attachment_), + file_attachment_(from.file_attachment_), + wifi_credentials_attachment_(from.wifi_credentials_attachment_), + app_attachment_(from.app_attachment_), + stream_attachment_(from.stream_attachment_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + required_app_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + required_app_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_required_app()) { + required_app_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_required_app(), + GetArenaForAllocation()); + } + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) +} + +inline void SharingLog_AttachmentsInfo::SharedCtor() { +required_app_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + required_app_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +SharingLog_AttachmentsInfo::~SharingLog_AttachmentsInfo() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AttachmentsInfo::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + required_app_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_AttachmentsInfo::ArenaDtor(void* object) { + SharingLog_AttachmentsInfo* _this = reinterpret_cast< SharingLog_AttachmentsInfo* >(object); + (void)_this; +} +void SharingLog_AttachmentsInfo::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AttachmentsInfo::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AttachmentsInfo::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + text_attachment_.Clear(); + file_attachment_.Clear(); + wifi_credentials_attachment_.Clear(); + app_attachment_.Clear(); + stream_attachment_.Clear(); + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + required_app_.ClearNonDefaultToEmpty(); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AttachmentsInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .nearby.sharing.analytics.proto.SharingLog.TextAttachment text_attachment = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_text_attachment(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else + goto handle_unusual; + continue; + // repeated .nearby.sharing.analytics.proto.SharingLog.FileAttachment file_attachment = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_file_attachment(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr)); + } else + goto handle_unusual; + continue; + // optional string required_app = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + auto str = _internal_mutable_required_app(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // repeated .nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment wifi_credentials_attachment = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_wifi_credentials_attachment(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<34>(ptr)); + } else + goto handle_unusual; + continue; + // repeated .nearby.sharing.analytics.proto.SharingLog.AppAttachment app_attachment = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_app_attachment(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr)); + } else + goto handle_unusual; + continue; + // repeated .nearby.sharing.analytics.proto.SharingLog.StreamAttachment stream_attachment = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_stream_attachment(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AttachmentsInfo::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .nearby.sharing.analytics.proto.SharingLog.TextAttachment text_attachment = 1; + for (unsigned int i = 0, + n = static_cast(this->_internal_text_attachment_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, this->_internal_text_attachment(i), target, stream); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.FileAttachment file_attachment = 2; + for (unsigned int i = 0, + n = static_cast(this->_internal_file_attachment_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(2, this->_internal_file_attachment(i), target, stream); + } + + cached_has_bits = _has_bits_[0]; + // optional string required_app = 3; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 3, this->_internal_required_app(), target); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment wifi_credentials_attachment = 4; + for (unsigned int i = 0, + n = static_cast(this->_internal_wifi_credentials_attachment_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(4, this->_internal_wifi_credentials_attachment(i), target, stream); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.AppAttachment app_attachment = 5; + for (unsigned int i = 0, + n = static_cast(this->_internal_app_attachment_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(5, this->_internal_app_attachment(i), target, stream); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.StreamAttachment stream_attachment = 6; + for (unsigned int i = 0, + n = static_cast(this->_internal_stream_attachment_size()); i < n; i++) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(6, this->_internal_stream_attachment(i), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + return target; +} + +size_t SharingLog_AttachmentsInfo::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .nearby.sharing.analytics.proto.SharingLog.TextAttachment text_attachment = 1; + total_size += 1UL * this->_internal_text_attachment_size(); + for (const auto& msg : this->text_attachment_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.FileAttachment file_attachment = 2; + total_size += 1UL * this->_internal_file_attachment_size(); + for (const auto& msg : this->file_attachment_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment wifi_credentials_attachment = 4; + total_size += 1UL * this->_internal_wifi_credentials_attachment_size(); + for (const auto& msg : this->wifi_credentials_attachment_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.AppAttachment app_attachment = 5; + total_size += 1UL * this->_internal_app_attachment_size(); + for (const auto& msg : this->app_attachment_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // repeated .nearby.sharing.analytics.proto.SharingLog.StreamAttachment stream_attachment = 6; + total_size += 1UL * this->_internal_stream_attachment_size(); + for (const auto& msg : this->stream_attachment_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + // optional string required_app = 3; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_required_app()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AttachmentsInfo::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AttachmentsInfo::MergeFrom(const SharingLog_AttachmentsInfo& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + text_attachment_.MergeFrom(from.text_attachment_); + file_attachment_.MergeFrom(from.file_attachment_); + wifi_credentials_attachment_.MergeFrom(from.wifi_credentials_attachment_); + app_attachment_.MergeFrom(from.app_attachment_); + stream_attachment_.MergeFrom(from.stream_attachment_); + if (from._internal_has_required_app()) { + _internal_set_required_app(from._internal_required_app()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AttachmentsInfo::CopyFrom(const SharingLog_AttachmentsInfo& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AttachmentsInfo::IsInitialized() const { + return true; +} + +void SharingLog_AttachmentsInfo::InternalSwap(SharingLog_AttachmentsInfo* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + text_attachment_.InternalSwap(&other->text_attachment_); + file_attachment_.InternalSwap(&other->file_attachment_); + wifi_credentials_attachment_.InternalSwap(&other->wifi_credentials_attachment_); + app_attachment_.InternalSwap(&other->app_attachment_); + stream_attachment_.InternalSwap(&other->stream_attachment_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &required_app_, lhs_arena, + &other->required_app_, rhs_arena + ); +} + +std::string SharingLog_AttachmentsInfo::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo"; +} + + +// =================================================================== + +class SharingLog_TextAttachment::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_size_bytes(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_batch_id(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_source_type(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_TextAttachment::SharingLog_TextAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.TextAttachment) +} +SharingLog_TextAttachment::SharingLog_TextAttachment(const SharingLog_TextAttachment& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&size_bytes_, &from.size_bytes_, + static_cast(reinterpret_cast(&batch_id_) - + reinterpret_cast(&size_bytes_)) + sizeof(batch_id_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.TextAttachment) +} + +inline void SharingLog_TextAttachment::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&size_bytes_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&batch_id_) - + reinterpret_cast(&size_bytes_)) + sizeof(batch_id_)); +} + +SharingLog_TextAttachment::~SharingLog_TextAttachment() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_TextAttachment::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_TextAttachment::ArenaDtor(void* object) { + SharingLog_TextAttachment* _this = reinterpret_cast< SharingLog_TextAttachment* >(object); + (void)_this; +} +void SharingLog_TextAttachment::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_TextAttachment::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_TextAttachment::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + ::memset(&size_bytes_, 0, static_cast( + reinterpret_cast(&batch_id_) - + reinterpret_cast(&size_bytes_)) + sizeof(batch_id_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_TextAttachment::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.sharing.analytics.proto.SharingLog.TextAttachment.Type type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type_IsValid(val))) { + _internal_set_type(static_cast<::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 size_bytes = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_size_bytes(&has_bits); + size_bytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 batch_id = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_batch_id(&has_bits); + batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(val))) { + _internal_set_source_type(static_cast<::location::nearby::proto::sharing::AttachmentSourceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_TextAttachment::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.TextAttachment.Type type = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_type(), target); + } + + // optional int64 size_bytes = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_size_bytes(), target); + } + + // optional int64 batch_id = 3; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_batch_id(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_source_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + return target; +} + +size_t SharingLog_TextAttachment::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional int64 size_bytes = 2; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_size_bytes()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TextAttachment.Type type = 1; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_type()); + } + + // optional int64 batch_id = 3; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_batch_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_TextAttachment::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_TextAttachment::MergeFrom(const SharingLog_TextAttachment& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + size_bytes_ = from.size_bytes_; + } + if (cached_has_bits & 0x00000002u) { + type_ = from.type_; + } + if (cached_has_bits & 0x00000004u) { + source_type_ = from.source_type_; + } + if (cached_has_bits & 0x00000008u) { + batch_id_ = from.batch_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_TextAttachment::CopyFrom(const SharingLog_TextAttachment& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_TextAttachment::IsInitialized() const { + return true; +} + +void SharingLog_TextAttachment::InternalSwap(SharingLog_TextAttachment* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_TextAttachment, batch_id_) + + sizeof(SharingLog_TextAttachment::batch_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_TextAttachment, size_bytes_)>( + reinterpret_cast(&size_bytes_), + reinterpret_cast(&other->size_bytes_)); +} + +std::string SharingLog_TextAttachment::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.TextAttachment"; +} + + +// =================================================================== + +class SharingLog_FileAttachment::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_size_bytes(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_offset_bytes(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static void set_has_batch_id(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static void set_has_source_type(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_FileAttachment::SharingLog_FileAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.FileAttachment) +} +SharingLog_FileAttachment::SharingLog_FileAttachment(const SharingLog_FileAttachment& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&size_bytes_, &from.size_bytes_, + static_cast(reinterpret_cast(&batch_id_) - + reinterpret_cast(&size_bytes_)) + sizeof(batch_id_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.FileAttachment) +} + +inline void SharingLog_FileAttachment::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&size_bytes_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&batch_id_) - + reinterpret_cast(&size_bytes_)) + sizeof(batch_id_)); +} + +SharingLog_FileAttachment::~SharingLog_FileAttachment() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_FileAttachment::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_FileAttachment::ArenaDtor(void* object) { + SharingLog_FileAttachment* _this = reinterpret_cast< SharingLog_FileAttachment* >(object); + (void)_this; +} +void SharingLog_FileAttachment::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_FileAttachment::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_FileAttachment::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + ::memset(&size_bytes_, 0, static_cast( + reinterpret_cast(&batch_id_) - + reinterpret_cast(&size_bytes_)) + sizeof(batch_id_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_FileAttachment::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .nearby.sharing.analytics.proto.SharingLog.FileAttachment.Type type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type_IsValid(val))) { + _internal_set_type(static_cast<::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional int64 size_bytes = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_size_bytes(&has_bits); + size_bytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 offset_bytes = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + _Internal::set_has_offset_bytes(&has_bits); + offset_bytes_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 batch_id = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 40)) { + _Internal::set_has_batch_id(&has_bits); + batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(val))) { + _internal_set_source_type(static_cast<::location::nearby::proto::sharing::AttachmentSourceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(6, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_FileAttachment::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.FileAttachment.Type type = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_type(), target); + } + + // optional int64 size_bytes = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_size_bytes(), target); + } + + // optional int64 offset_bytes = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(4, this->_internal_offset_bytes(), target); + } + + // optional int64 batch_id = 5; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(5, this->_internal_batch_id(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 6; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 6, this->_internal_source_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + return target; +} + +size_t SharingLog_FileAttachment::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + // optional int64 size_bytes = 2; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_size_bytes()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.FileAttachment.Type type = 1; + if (cached_has_bits & 0x00000002u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_type()); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 6; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_type()); + } + + // optional int64 offset_bytes = 4; + if (cached_has_bits & 0x00000008u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_offset_bytes()); + } + + // optional int64 batch_id = 5; + if (cached_has_bits & 0x00000010u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_batch_id()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_FileAttachment::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_FileAttachment::MergeFrom(const SharingLog_FileAttachment& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000001fu) { + if (cached_has_bits & 0x00000001u) { + size_bytes_ = from.size_bytes_; + } + if (cached_has_bits & 0x00000002u) { + type_ = from.type_; + } + if (cached_has_bits & 0x00000004u) { + source_type_ = from.source_type_; + } + if (cached_has_bits & 0x00000008u) { + offset_bytes_ = from.offset_bytes_; + } + if (cached_has_bits & 0x00000010u) { + batch_id_ = from.batch_id_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_FileAttachment::CopyFrom(const SharingLog_FileAttachment& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_FileAttachment::IsInitialized() const { + return true; +} + +void SharingLog_FileAttachment::InternalSwap(SharingLog_FileAttachment* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_FileAttachment, batch_id_) + + sizeof(SharingLog_FileAttachment::batch_id_) + - PROTOBUF_FIELD_OFFSET(SharingLog_FileAttachment, size_bytes_)>( + reinterpret_cast(&size_bytes_), + reinterpret_cast(&other->size_bytes_)); +} + +std::string SharingLog_FileAttachment::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.FileAttachment"; +} + + +// =================================================================== + +class SharingLog_WifiCredentialsAttachment::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_security_type(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_batch_id(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_source_type(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_WifiCredentialsAttachment::SharingLog_WifiCredentialsAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) +} +SharingLog_WifiCredentialsAttachment::SharingLog_WifiCredentialsAttachment(const SharingLog_WifiCredentialsAttachment& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + ::memcpy(&batch_id_, &from.batch_id_, + static_cast(reinterpret_cast(&source_type_) - + reinterpret_cast(&batch_id_)) + sizeof(source_type_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) +} + +inline void SharingLog_WifiCredentialsAttachment::SharedCtor() { +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&batch_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&source_type_) - + reinterpret_cast(&batch_id_)) + sizeof(source_type_)); +} + +SharingLog_WifiCredentialsAttachment::~SharingLog_WifiCredentialsAttachment() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_WifiCredentialsAttachment::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_WifiCredentialsAttachment::ArenaDtor(void* object) { + SharingLog_WifiCredentialsAttachment* _this = reinterpret_cast< SharingLog_WifiCredentialsAttachment* >(object); + (void)_this; +} +void SharingLog_WifiCredentialsAttachment::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_WifiCredentialsAttachment::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_WifiCredentialsAttachment::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + ::memset(&batch_id_, 0, static_cast( + reinterpret_cast(&source_type_) - + reinterpret_cast(&batch_id_)) + sizeof(source_type_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_WifiCredentialsAttachment::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional int32 security_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + _Internal::set_has_security_type(&has_bits); + security_type_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 batch_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_batch_id(&has_bits); + batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(val))) { + _internal_set_source_type(static_cast<::location::nearby::proto::sharing::AttachmentSourceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_WifiCredentialsAttachment::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional int32 security_type = 1; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_security_type(), target); + } + + // optional int64 batch_id = 2; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_batch_id(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_source_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + return target; +} + +size_t SharingLog_WifiCredentialsAttachment::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional int64 batch_id = 2; + if (cached_has_bits & 0x00000001u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_batch_id()); + } + + // optional int32 security_type = 1; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32SizePlusOne(this->_internal_security_type()); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_type()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_WifiCredentialsAttachment::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_WifiCredentialsAttachment::MergeFrom(const SharingLog_WifiCredentialsAttachment& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + batch_id_ = from.batch_id_; + } + if (cached_has_bits & 0x00000002u) { + security_type_ = from.security_type_; + } + if (cached_has_bits & 0x00000004u) { + source_type_ = from.source_type_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_WifiCredentialsAttachment::CopyFrom(const SharingLog_WifiCredentialsAttachment& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_WifiCredentialsAttachment::IsInitialized() const { + return true; +} + +void SharingLog_WifiCredentialsAttachment::InternalSwap(SharingLog_WifiCredentialsAttachment* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_WifiCredentialsAttachment, source_type_) + + sizeof(SharingLog_WifiCredentialsAttachment::source_type_) + - PROTOBUF_FIELD_OFFSET(SharingLog_WifiCredentialsAttachment, batch_id_)>( + reinterpret_cast(&batch_id_), + reinterpret_cast(&other->batch_id_)); +} + +std::string SharingLog_WifiCredentialsAttachment::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment"; +} + + +// =================================================================== + +class SharingLog_AppAttachment::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_package_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_size(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_batch_id(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static void set_has_source_type(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } +}; + +SharingLog_AppAttachment::SharingLog_AppAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AppAttachment) +} +SharingLog_AppAttachment::SharingLog_AppAttachment(const SharingLog_AppAttachment& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + package_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_package_name()) { + package_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package_name(), + GetArenaForAllocation()); + } + ::memcpy(&size_, &from.size_, + static_cast(reinterpret_cast(&source_type_) - + reinterpret_cast(&size_)) + sizeof(source_type_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AppAttachment) +} + +inline void SharingLog_AppAttachment::SharedCtor() { +package_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&size_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&source_type_) - + reinterpret_cast(&size_)) + sizeof(source_type_)); +} + +SharingLog_AppAttachment::~SharingLog_AppAttachment() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AppAttachment::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + package_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_AppAttachment::ArenaDtor(void* object) { + SharingLog_AppAttachment* _this = reinterpret_cast< SharingLog_AppAttachment* >(object); + (void)_this; +} +void SharingLog_AppAttachment::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AppAttachment::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AppAttachment::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + package_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x0000000eu) { + ::memset(&size_, 0, static_cast( + reinterpret_cast(&source_type_) - + reinterpret_cast(&size_)) + sizeof(source_type_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AppAttachment::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string package_name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_package_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 size = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_size(&has_bits); + size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 batch_id = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + _Internal::set_has_batch_id(&has_bits); + batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 32)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(val))) { + _internal_set_source_type(static_cast<::location::nearby::proto::sharing::AttachmentSourceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(4, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AppAttachment::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional string package_name = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_package_name(), target); + } + + // optional int64 size = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_size(), target); + } + + // optional int64 batch_id = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(3, this->_internal_batch_id(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 4, this->_internal_source_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + return target; +} + +size_t SharingLog_AppAttachment::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + // optional string package_name = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_package_name()); + } + + // optional int64 size = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_size()); + } + + // optional int64 batch_id = 3; + if (cached_has_bits & 0x00000004u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_batch_id()); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_type()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AppAttachment::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AppAttachment::MergeFrom(const SharingLog_AppAttachment& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x0000000fu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_package_name(from._internal_package_name()); + } + if (cached_has_bits & 0x00000002u) { + size_ = from.size_; + } + if (cached_has_bits & 0x00000004u) { + batch_id_ = from.batch_id_; + } + if (cached_has_bits & 0x00000008u) { + source_type_ = from.source_type_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AppAttachment::CopyFrom(const SharingLog_AppAttachment& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AppAttachment::IsInitialized() const { + return true; +} + +void SharingLog_AppAttachment::InternalSwap(SharingLog_AppAttachment* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &package_name_, lhs_arena, + &other->package_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_AppAttachment, source_type_) + + sizeof(SharingLog_AppAttachment::source_type_) + - PROTOBUF_FIELD_OFFSET(SharingLog_AppAttachment, size_)>( + reinterpret_cast(&size_), + reinterpret_cast(&other->size_)); +} + +std::string SharingLog_AppAttachment::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AppAttachment"; +} + + +// =================================================================== + +class SharingLog_StreamAttachment::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_package_name(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_batch_id(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static void set_has_source_type(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } +}; + +SharingLog_StreamAttachment::SharingLog_StreamAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) +} +SharingLog_StreamAttachment::SharingLog_StreamAttachment(const SharingLog_StreamAttachment& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + package_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_package_name()) { + package_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package_name(), + GetArenaForAllocation()); + } + ::memcpy(&batch_id_, &from.batch_id_, + static_cast(reinterpret_cast(&source_type_) - + reinterpret_cast(&batch_id_)) + sizeof(source_type_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) +} + +inline void SharingLog_StreamAttachment::SharedCtor() { +package_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&batch_id_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&source_type_) - + reinterpret_cast(&batch_id_)) + sizeof(source_type_)); +} + +SharingLog_StreamAttachment::~SharingLog_StreamAttachment() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_StreamAttachment::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + package_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +} + +void SharingLog_StreamAttachment::ArenaDtor(void* object) { + SharingLog_StreamAttachment* _this = reinterpret_cast< SharingLog_StreamAttachment* >(object); + (void)_this; +} +void SharingLog_StreamAttachment::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_StreamAttachment::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_StreamAttachment::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + package_name_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000006u) { + ::memset(&batch_id_, 0, static_cast( + reinterpret_cast(&source_type_) - + reinterpret_cast(&batch_id_)) + sizeof(source_type_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_StreamAttachment::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional string package_name = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_package_name(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional int64 batch_id = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _Internal::set_has_batch_id(&has_bits); + batch_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 24)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(val))) { + _internal_set_source_type(static_cast<::location::nearby::proto::sharing::AttachmentSourceType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_StreamAttachment::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional string package_name = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 1, this->_internal_package_name(), target); + } + + // optional int64 batch_id = 2; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt64ToArray(2, this->_internal_batch_id(), target); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 3, this->_internal_source_type(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + return target; +} + +size_t SharingLog_StreamAttachment::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + // optional string package_name = 1; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_package_name()); + } + + // optional int64 batch_id = 2; + if (cached_has_bits & 0x00000002u) { + total_size += ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int64SizePlusOne(this->_internal_batch_id()); + } + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + if (cached_has_bits & 0x00000004u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_source_type()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_StreamAttachment::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_StreamAttachment::MergeFrom(const SharingLog_StreamAttachment& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x00000007u) { + if (cached_has_bits & 0x00000001u) { + _internal_set_package_name(from._internal_package_name()); + } + if (cached_has_bits & 0x00000002u) { + batch_id_ = from.batch_id_; + } + if (cached_has_bits & 0x00000004u) { + source_type_ = from.source_type_; + } + _has_bits_[0] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_StreamAttachment::CopyFrom(const SharingLog_StreamAttachment& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_StreamAttachment::IsInitialized() const { + return true; +} + +void SharingLog_StreamAttachment::InternalSwap(SharingLog_StreamAttachment* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &package_name_, lhs_arena, + &other->package_name_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog_StreamAttachment, source_type_) + + sizeof(SharingLog_StreamAttachment::source_type_) + - PROTOBUF_FIELD_OFFSET(SharingLog_StreamAttachment, batch_id_)>( + reinterpret_cast(&batch_id_), + reinterpret_cast(&other->batch_id_)); +} + +std::string SharingLog_StreamAttachment::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.StreamAttachment"; +} + + +// =================================================================== + +class SharingLog_AppCrash::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_crash_reason(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_AppCrash::SharingLog_AppCrash(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.AppCrash) +} +SharingLog_AppCrash::SharingLog_AppCrash(const SharingLog_AppCrash& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + crash_reason_ = from.crash_reason_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.AppCrash) +} + +inline void SharingLog_AppCrash::SharedCtor() { +crash_reason_ = 0; +} + +SharingLog_AppCrash::~SharingLog_AppCrash() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.AppCrash) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_AppCrash::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_AppCrash::ArenaDtor(void* object) { + SharingLog_AppCrash* _this = reinterpret_cast< SharingLog_AppCrash* >(object); + (void)_this; +} +void SharingLog_AppCrash::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_AppCrash::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_AppCrash::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.AppCrash) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + crash_reason_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_AppCrash::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.AppCrashReason crash_reason = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::AppCrashReason_IsValid(val))) { + _internal_set_crash_reason(static_cast<::location::nearby::proto::sharing::AppCrashReason>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_AppCrash::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.AppCrash) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.AppCrashReason crash_reason = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_crash_reason(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.AppCrash) + return target; +} + +size_t SharingLog_AppCrash::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.AppCrash) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.proto.sharing.AppCrashReason crash_reason = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_crash_reason()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_AppCrash::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_AppCrash::MergeFrom(const SharingLog_AppCrash& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.AppCrash) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_crash_reason()) { + _internal_set_crash_reason(from._internal_crash_reason()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_AppCrash::CopyFrom(const SharingLog_AppCrash& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.AppCrash) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_AppCrash::IsInitialized() const { + return true; +} + +void SharingLog_AppCrash::InternalSwap(SharingLog_AppCrash* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(crash_reason_, other->crash_reason_); +} + +std::string SharingLog_AppCrash::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.AppCrash"; +} + + +// =================================================================== + +class SharingLog_SetupWizard::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_visibility(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_SetupWizard::SharingLog_SetupWizard(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SetupWizard) +} +SharingLog_SetupWizard::SharingLog_SetupWizard(const SharingLog_SetupWizard& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + visibility_ = from.visibility_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SetupWizard) +} + +inline void SharingLog_SetupWizard::SharedCtor() { +visibility_ = 0; +} + +SharingLog_SetupWizard::~SharingLog_SetupWizard() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SetupWizard::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SetupWizard::ArenaDtor(void* object) { + SharingLog_SetupWizard* _this = reinterpret_cast< SharingLog_SetupWizard* >(object); + (void)_this; +} +void SharingLog_SetupWizard::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SetupWizard::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SetupWizard::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + visibility_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SetupWizard::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::Visibility_IsValid(val))) { + _internal_set_visibility(static_cast<::location::nearby::proto::sharing::Visibility>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SetupWizard::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_visibility(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + return target; +} + +size_t SharingLog_SetupWizard::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_visibility()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SetupWizard::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SetupWizard::MergeFrom(const SharingLog_SetupWizard& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_visibility()) { + _internal_set_visibility(from._internal_visibility()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SetupWizard::CopyFrom(const SharingLog_SetupWizard& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SetupWizard::IsInitialized() const { + return true; +} + +void SharingLog_SetupWizard::InternalSwap(SharingLog_SetupWizard* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(visibility_, other->visibility_); +} + +std::string SharingLog_SetupWizard::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SetupWizard"; +} + + +// =================================================================== + +class SharingLog_SendDesktopNotification::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_event(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_SendDesktopNotification::SharingLog_SendDesktopNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) +} +SharingLog_SendDesktopNotification::SharingLog_SendDesktopNotification(const SharingLog_SendDesktopNotification& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + event_ = from.event_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) +} + +inline void SharingLog_SendDesktopNotification::SharedCtor() { +event_ = 0; +} + +SharingLog_SendDesktopNotification::~SharingLog_SendDesktopNotification() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendDesktopNotification::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SendDesktopNotification::ArenaDtor(void* object) { + SharingLog_SendDesktopNotification* _this = reinterpret_cast< SharingLog_SendDesktopNotification* >(object); + (void)_this; +} +void SharingLog_SendDesktopNotification::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendDesktopNotification::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendDesktopNotification::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + event_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendDesktopNotification::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.DesktopNotification event = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DesktopNotification_IsValid(val))) { + _internal_set_event(static_cast<::location::nearby::proto::sharing::DesktopNotification>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendDesktopNotification::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.DesktopNotification event = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_event(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + return target; +} + +size_t SharingLog_SendDesktopNotification::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.proto.sharing.DesktopNotification event = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_event()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendDesktopNotification::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendDesktopNotification::MergeFrom(const SharingLog_SendDesktopNotification& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_event()) { + _internal_set_event(from._internal_event()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendDesktopNotification::CopyFrom(const SharingLog_SendDesktopNotification& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendDesktopNotification::IsInitialized() const { + return true; +} + +void SharingLog_SendDesktopNotification::InternalSwap(SharingLog_SendDesktopNotification* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(event_, other->event_); +} + +std::string SharingLog_SendDesktopNotification::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification"; +} + + +// =================================================================== + +class SharingLog_SendDesktopTransferEvent::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_event(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } +}; + +SharingLog_SendDesktopTransferEvent::SharingLog_SendDesktopTransferEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) +} +SharingLog_SendDesktopTransferEvent::SharingLog_SendDesktopTransferEvent(const SharingLog_SendDesktopTransferEvent& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + event_ = from.event_; + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) +} + +inline void SharingLog_SendDesktopTransferEvent::SharedCtor() { +event_ = 0; +} + +SharingLog_SendDesktopTransferEvent::~SharingLog_SendDesktopTransferEvent() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog_SendDesktopTransferEvent::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); +} + +void SharingLog_SendDesktopTransferEvent::ArenaDtor(void* object) { + SharingLog_SendDesktopTransferEvent* _this = reinterpret_cast< SharingLog_SendDesktopTransferEvent* >(object); + (void)_this; +} +void SharingLog_SendDesktopTransferEvent::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog_SendDesktopTransferEvent::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog_SendDesktopTransferEvent::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + event_ = 0; + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog_SendDesktopTransferEvent::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + _Internal::HasBits has_bits{}; + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.DesktopTransferEventType event = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::DesktopTransferEventType_IsValid(val))) { + _internal_set_event(static_cast<::location::nearby::proto::sharing::DesktopTransferEventType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + _has_bits_.Or(has_bits); + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog_SendDesktopTransferEvent::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + // optional .location.nearby.proto.sharing.DesktopTransferEventType event = 1; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_event(), target); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + return target; +} + +size_t SharingLog_SendDesktopTransferEvent::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // optional .location.nearby.proto.sharing.DesktopTransferEventType event = 1; + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x00000001u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_event()); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog_SendDesktopTransferEvent::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog_SendDesktopTransferEvent::MergeFrom(const SharingLog_SendDesktopTransferEvent& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (from._internal_has_event()) { + _internal_set_event(from._internal_event()); + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog_SendDesktopTransferEvent::CopyFrom(const SharingLog_SendDesktopTransferEvent& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog_SendDesktopTransferEvent::IsInitialized() const { + return true; +} + +void SharingLog_SendDesktopTransferEvent::InternalSwap(SharingLog_SendDesktopTransferEvent* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(event_, other->event_); +} + +std::string SharingLog_SendDesktopTransferEvent::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent"; +} + + +// =================================================================== + +class SharingLog::_Internal { + public: + using HasBits = decltype(std::declval()._has_bits_); + static void set_has_event_type(HasBits* has_bits) { + (*has_bits)[2] |= 128u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent& unknown_event(const SharingLog* msg); + static void set_has_unknown_event(HasBits* has_bits) { + (*has_bits)[0] |= 8u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements& accept_agreements(const SharingLog* msg); + static void set_has_accept_agreements(HasBits* has_bits) { + (*has_bits)[0] |= 16u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing& enable_nearby_sharing(const SharingLog* msg); + static void set_has_enable_nearby_sharing(HasBits* has_bits) { + (*has_bits)[0] |= 32u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility& set_visibility(const SharingLog* msg); + static void set_has_set_visibility(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments& describe_attachments(const SharingLog* msg); + static void set_has_describe_attachments(HasBits* has_bits) { + (*has_bits)[0] |= 128u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart& scan_for_share_targets_start(const SharingLog* msg); + static void set_has_scan_for_share_targets_start(HasBits* has_bits) { + (*has_bits)[0] |= 256u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd& scan_for_share_targets_end(const SharingLog* msg); + static void set_has_scan_for_share_targets_end(HasBits* has_bits) { + (*has_bits)[0] |= 512u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart& advertise_device_presence_start(const SharingLog* msg); + static void set_has_advertise_device_presence_start(HasBits* has_bits) { + (*has_bits)[0] |= 1024u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd& advertise_device_presence_end(const SharingLog* msg); + static void set_has_advertise_device_presence_end(HasBits* has_bits) { + (*has_bits)[0] |= 2048u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization& send_initialization(const SharingLog* msg); + static void set_has_send_initialization(HasBits* has_bits) { + (*has_bits)[0] |= 4096u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization& receive_initialization(const SharingLog* msg); + static void set_has_receive_initialization(HasBits* has_bits) { + (*has_bits)[0] |= 8192u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget& discover_share_target(const SharingLog* msg); + static void set_has_discover_share_target(HasBits* has_bits) { + (*has_bits)[0] |= 16384u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction& send_introduction(const SharingLog* msg); + static void set_has_send_introduction(HasBits* has_bits) { + (*has_bits)[0] |= 32768u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction& receive_introduction(const SharingLog* msg); + static void set_has_receive_introduction(HasBits* has_bits) { + (*has_bits)[0] |= 65536u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction& respond_introduction(const SharingLog* msg); + static void set_has_respond_introduction(HasBits* has_bits) { + (*has_bits)[0] |= 131072u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart& send_attachments_start(const SharingLog* msg); + static void set_has_send_attachments_start(HasBits* has_bits) { + (*has_bits)[0] |= 262144u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd& send_attachments_end(const SharingLog* msg); + static void set_has_send_attachments_end(HasBits* has_bits) { + (*has_bits)[0] |= 524288u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart& receive_attachments_start(const SharingLog* msg); + static void set_has_receive_attachments_start(HasBits* has_bits) { + (*has_bits)[0] |= 1048576u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd& receive_attachments_end(const SharingLog* msg); + static void set_has_receive_attachments_end(HasBits* has_bits) { + (*has_bits)[0] |= 2097152u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments& cancel_sending_attachments(const SharingLog* msg); + static void set_has_cancel_sending_attachments(HasBits* has_bits) { + (*has_bits)[0] |= 4194304u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments& cancel_receiving_attachments(const SharingLog* msg); + static void set_has_cancel_receiving_attachments(HasBits* has_bits) { + (*has_bits)[0] |= 8388608u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments& open_received_attachments(const SharingLog* msg); + static void set_has_open_received_attachments(HasBits* has_bits) { + (*has_bits)[0] |= 16777216u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity& launch_activity(const SharingLog* msg); + static void set_has_launch_activity(HasBits* has_bits) { + (*has_bits)[0] |= 33554432u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AddContact& add_contact(const SharingLog* msg); + static void set_has_add_contact(HasBits* has_bits) { + (*has_bits)[0] |= 67108864u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact& remove_contact(const SharingLog* msg); + static void set_has_remove_contact(HasBits* has_bits) { + (*has_bits)[0] |= 134217728u; + } + static void set_has_log_source(HasBits* has_bits) { + (*has_bits)[2] |= 256u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse& fast_share_server_response(const SharingLog* msg); + static void set_has_fast_share_server_response(HasBits* has_bits) { + (*has_bits)[0] |= 268435456u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendStart& send_start(const SharingLog* msg); + static void set_has_send_start(HasBits* has_bits) { + (*has_bits)[0] |= 536870912u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization& accept_fast_initialization(const SharingLog* msg); + static void set_has_accept_fast_initialization(HasBits* has_bits) { + (*has_bits)[0] |= 1073741824u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage& set_data_usage(const SharingLog* msg); + static void set_has_set_data_usage(HasBits* has_bits) { + (*has_bits)[0] |= 2147483648u; + } + static void set_has_version(HasBits* has_bits) { + (*has_bits)[0] |= 1u; + } + static void set_has_event_category(HasBits* has_bits) { + (*has_bits)[2] |= 512u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization& dismiss_fast_initialization(const SharingLog* msg); + static void set_has_dismiss_fast_initialization(HasBits* has_bits) { + (*has_bits)[1] |= 1u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection& cancel_connection(const SharingLog* msg); + static void set_has_cancel_connection(HasBits* has_bits) { + (*has_bits)[1] |= 2u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification& dismiss_privacy_notification(const SharingLog* msg); + static void set_has_dismiss_privacy_notification(HasBits* has_bits) { + (*has_bits)[1] |= 4u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification& tap_privacy_notification(const SharingLog* msg); + static void set_has_tap_privacy_notification(HasBits* has_bits) { + (*has_bits)[1] |= 8u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_TapHelp& tap_help(const SharingLog* msg); + static void set_has_tap_help(HasBits* has_bits) { + (*has_bits)[1] |= 16u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback& tap_feedback(const SharingLog* msg); + static void set_has_tap_feedback(HasBits* has_bits) { + (*has_bits)[1] |= 32u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile& add_quick_settings_tile(const SharingLog* msg); + static void set_has_add_quick_settings_tile(HasBits* has_bits) { + (*has_bits)[1] |= 64u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile& remove_quick_settings_tile(const SharingLog* msg); + static void set_has_remove_quick_settings_tile(HasBits* has_bits) { + (*has_bits)[1] |= 128u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent& launch_phone_consent(const SharingLog* msg); + static void set_has_launch_phone_consent(HasBits* has_bits) { + (*has_bits)[1] |= 256u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile& tap_quick_settings_tile(const SharingLog* msg); + static void set_has_tap_quick_settings_tile(HasBits* has_bits) { + (*has_bits)[1] |= 512u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus& install_apk_status(const SharingLog* msg); + static void set_has_install_apk_status(HasBits* has_bits) { + (*has_bits)[1] |= 1024u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus& verify_apk_status(const SharingLog* msg); + static void set_has_verify_apk_status(HasBits* has_bits) { + (*has_bits)[1] |= 2048u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent& launch_consent(const SharingLog* msg); + static void set_has_launch_consent(HasBits* has_bits) { + (*has_bits)[1] |= 4096u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd& process_received_attachments_end(const SharingLog* msg); + static void set_has_process_received_attachments_end(HasBits* has_bits) { + (*has_bits)[1] |= 8192u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification& toggle_show_notification(const SharingLog* msg); + static void set_has_toggle_show_notification(HasBits* has_bits) { + (*has_bits)[1] |= 16384u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName& set_device_name(const SharingLog* msg); + static void set_has_set_device_name(HasBits* has_bits) { + (*has_bits)[1] |= 32768u; + } + static void set_has_files_migration_phase(HasBits* has_bits) { + (*has_bits)[0] |= 2u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements& decline_agreements(const SharingLog* msg); + static void set_has_decline_agreements(HasBits* has_bits) { + (*has_bits)[1] |= 65536u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions& request_setting_permissions(const SharingLog* msg); + static void set_has_request_setting_permissions(HasBits* has_bits) { + (*has_bits)[1] |= 131072u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings& device_settings(const SharingLog* msg); + static void set_has_device_settings(HasBits* has_bits) { + (*has_bits)[1] |= 262144u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection& establish_connection(const SharingLog* msg); + static void set_has_establish_connection(HasBits* has_bits) { + (*has_bits)[1] |= 524288u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization& auto_dismiss_fast_initialization(const SharingLog* msg); + static void set_has_auto_dismiss_fast_initialization(HasBits* has_bits) { + (*has_bits)[1] |= 1048576u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata& event_metadata(const SharingLog* msg); + static void set_has_event_metadata(HasBits* has_bits) { + (*has_bits)[1] |= 2097152u; + } + static void set_has_app_version(HasBits* has_bits) { + (*has_bits)[0] |= 4u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AppCrash& app_crash(const SharingLog* msg); + static void set_has_app_crash(HasBits* has_bits) { + (*has_bits)[1] |= 4194304u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare& tap_quick_settings_file_share(const SharingLog* msg); + static void set_has_tap_quick_settings_file_share(HasBits* has_bits) { + (*has_bits)[1] |= 8388608u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_AppInfo& app_info(const SharingLog* msg); + static void set_has_app_info(HasBits* has_bits) { + (*has_bits)[1] |= 16777216u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification& display_privacy_notification(const SharingLog* msg); + static void set_has_display_privacy_notification(HasBits* has_bits) { + (*has_bits)[1] |= 33554432u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent& display_phone_consent(const SharingLog* msg); + static void set_has_display_phone_consent(HasBits* has_bits) { + (*has_bits)[1] |= 67108864u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage& preferences_usage(const SharingLog* msg); + static void set_has_preferences_usage(HasBits* has_bits) { + (*has_bits)[1] |= 134217728u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn& default_opt_in(const SharingLog* msg); + static void set_has_default_opt_in(HasBits* has_bits) { + (*has_bits)[1] |= 268435456u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard& setup_wizard(const SharingLog* msg); + static void set_has_setup_wizard(HasBits* has_bits) { + (*has_bits)[1] |= 536870912u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode& tap_qr_code(const SharingLog* msg); + static void set_has_tap_qr_code(HasBits* has_bits) { + (*has_bits)[1] |= 1073741824u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown& qr_code_link_shown(const SharingLog* msg); + static void set_has_qr_code_link_shown(HasBits* has_bits) { + (*has_bits)[1] |= 2147483648u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId& parsing_failed_endpoint_id(const SharingLog* msg); + static void set_has_parsing_failed_endpoint_id(HasBits* has_bits) { + (*has_bits)[2] |= 1u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice& fast_init_discover_device(const SharingLog* msg); + static void set_has_fast_init_discover_device(HasBits* has_bits) { + (*has_bits)[2] |= 2u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification& send_desktop_notification(const SharingLog* msg); + static void set_has_send_desktop_notification(HasBits* has_bits) { + (*has_bits)[2] |= 4u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent& send_desktop_transfer_event(const SharingLog* msg); + static void set_has_send_desktop_transfer_event(HasBits* has_bits) { + (*has_bits)[2] |= 8u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_SetAccount& set_account(const SharingLog* msg); + static void set_has_set_account(HasBits* has_bits) { + (*has_bits)[2] |= 16u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure& decrypt_certificate_failure(const SharingLog* msg); + static void set_has_decrypt_certificate_failure(HasBits* has_bits) { + (*has_bits)[2] |= 32u; + } + static const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess& show_allow_permission_auto_access(const SharingLog* msg); + static void set_has_show_allow_permission_auto_access(HasBits* has_bits) { + (*has_bits)[2] |= 64u; + } +}; + +const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent& +SharingLog::_Internal::unknown_event(const SharingLog* msg) { + return *msg->unknown_event_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements& +SharingLog::_Internal::accept_agreements(const SharingLog* msg) { + return *msg->accept_agreements_; +} +const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing& +SharingLog::_Internal::enable_nearby_sharing(const SharingLog* msg) { + return *msg->enable_nearby_sharing_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility& +SharingLog::_Internal::set_visibility(const SharingLog* msg) { + return *msg->set_visibility_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments& +SharingLog::_Internal::describe_attachments(const SharingLog* msg) { + return *msg->describe_attachments_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart& +SharingLog::_Internal::scan_for_share_targets_start(const SharingLog* msg) { + return *msg->scan_for_share_targets_start_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd& +SharingLog::_Internal::scan_for_share_targets_end(const SharingLog* msg) { + return *msg->scan_for_share_targets_end_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart& +SharingLog::_Internal::advertise_device_presence_start(const SharingLog* msg) { + return *msg->advertise_device_presence_start_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd& +SharingLog::_Internal::advertise_device_presence_end(const SharingLog* msg) { + return *msg->advertise_device_presence_end_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization& +SharingLog::_Internal::send_initialization(const SharingLog* msg) { + return *msg->send_initialization_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization& +SharingLog::_Internal::receive_initialization(const SharingLog* msg) { + return *msg->receive_initialization_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget& +SharingLog::_Internal::discover_share_target(const SharingLog* msg) { + return *msg->discover_share_target_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction& +SharingLog::_Internal::send_introduction(const SharingLog* msg) { + return *msg->send_introduction_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction& +SharingLog::_Internal::receive_introduction(const SharingLog* msg) { + return *msg->receive_introduction_; +} +const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction& +SharingLog::_Internal::respond_introduction(const SharingLog* msg) { + return *msg->respond_introduction_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart& +SharingLog::_Internal::send_attachments_start(const SharingLog* msg) { + return *msg->send_attachments_start_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd& +SharingLog::_Internal::send_attachments_end(const SharingLog* msg) { + return *msg->send_attachments_end_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart& +SharingLog::_Internal::receive_attachments_start(const SharingLog* msg) { + return *msg->receive_attachments_start_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd& +SharingLog::_Internal::receive_attachments_end(const SharingLog* msg) { + return *msg->receive_attachments_end_; +} +const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments& +SharingLog::_Internal::cancel_sending_attachments(const SharingLog* msg) { + return *msg->cancel_sending_attachments_; +} +const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments& +SharingLog::_Internal::cancel_receiving_attachments(const SharingLog* msg) { + return *msg->cancel_receiving_attachments_; +} +const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments& +SharingLog::_Internal::open_received_attachments(const SharingLog* msg) { + return *msg->open_received_attachments_; +} +const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity& +SharingLog::_Internal::launch_activity(const SharingLog* msg) { + return *msg->launch_activity_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AddContact& +SharingLog::_Internal::add_contact(const SharingLog* msg) { + return *msg->add_contact_; +} +const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact& +SharingLog::_Internal::remove_contact(const SharingLog* msg) { + return *msg->remove_contact_; +} +const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse& +SharingLog::_Internal::fast_share_server_response(const SharingLog* msg) { + return *msg->fast_share_server_response_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendStart& +SharingLog::_Internal::send_start(const SharingLog* msg) { + return *msg->send_start_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization& +SharingLog::_Internal::accept_fast_initialization(const SharingLog* msg) { + return *msg->accept_fast_initialization_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage& +SharingLog::_Internal::set_data_usage(const SharingLog* msg) { + return *msg->set_data_usage_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization& +SharingLog::_Internal::dismiss_fast_initialization(const SharingLog* msg) { + return *msg->dismiss_fast_initialization_; +} +const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection& +SharingLog::_Internal::cancel_connection(const SharingLog* msg) { + return *msg->cancel_connection_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification& +SharingLog::_Internal::dismiss_privacy_notification(const SharingLog* msg) { + return *msg->dismiss_privacy_notification_; +} +const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification& +SharingLog::_Internal::tap_privacy_notification(const SharingLog* msg) { + return *msg->tap_privacy_notification_; +} +const ::nearby::sharing::analytics::proto::SharingLog_TapHelp& +SharingLog::_Internal::tap_help(const SharingLog* msg) { + return *msg->tap_help_; +} +const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback& +SharingLog::_Internal::tap_feedback(const SharingLog* msg) { + return *msg->tap_feedback_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile& +SharingLog::_Internal::add_quick_settings_tile(const SharingLog* msg) { + return *msg->add_quick_settings_tile_; +} +const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile& +SharingLog::_Internal::remove_quick_settings_tile(const SharingLog* msg) { + return *msg->remove_quick_settings_tile_; +} +const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent& +SharingLog::_Internal::launch_phone_consent(const SharingLog* msg) { + return *msg->launch_phone_consent_; +} +const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile& +SharingLog::_Internal::tap_quick_settings_tile(const SharingLog* msg) { + return *msg->tap_quick_settings_tile_; +} +const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus& +SharingLog::_Internal::install_apk_status(const SharingLog* msg) { + return *msg->install_apk_status_; +} +const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus& +SharingLog::_Internal::verify_apk_status(const SharingLog* msg) { + return *msg->verify_apk_status_; +} +const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent& +SharingLog::_Internal::launch_consent(const SharingLog* msg) { + return *msg->launch_consent_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd& +SharingLog::_Internal::process_received_attachments_end(const SharingLog* msg) { + return *msg->process_received_attachments_end_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification& +SharingLog::_Internal::toggle_show_notification(const SharingLog* msg) { + return *msg->toggle_show_notification_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName& +SharingLog::_Internal::set_device_name(const SharingLog* msg) { + return *msg->set_device_name_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements& +SharingLog::_Internal::decline_agreements(const SharingLog* msg) { + return *msg->decline_agreements_; +} +const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions& +SharingLog::_Internal::request_setting_permissions(const SharingLog* msg) { + return *msg->request_setting_permissions_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings& +SharingLog::_Internal::device_settings(const SharingLog* msg) { + return *msg->device_settings_; +} +const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection& +SharingLog::_Internal::establish_connection(const SharingLog* msg) { + return *msg->establish_connection_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization& +SharingLog::_Internal::auto_dismiss_fast_initialization(const SharingLog* msg) { + return *msg->auto_dismiss_fast_initialization_; +} +const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata& +SharingLog::_Internal::event_metadata(const SharingLog* msg) { + return *msg->event_metadata_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AppCrash& +SharingLog::_Internal::app_crash(const SharingLog* msg) { + return *msg->app_crash_; +} +const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare& +SharingLog::_Internal::tap_quick_settings_file_share(const SharingLog* msg) { + return *msg->tap_quick_settings_file_share_; +} +const ::nearby::sharing::analytics::proto::SharingLog_AppInfo& +SharingLog::_Internal::app_info(const SharingLog* msg) { + return *msg->app_info_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification& +SharingLog::_Internal::display_privacy_notification(const SharingLog* msg) { + return *msg->display_privacy_notification_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent& +SharingLog::_Internal::display_phone_consent(const SharingLog* msg) { + return *msg->display_phone_consent_; +} +const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage& +SharingLog::_Internal::preferences_usage(const SharingLog* msg) { + return *msg->preferences_usage_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn& +SharingLog::_Internal::default_opt_in(const SharingLog* msg) { + return *msg->default_opt_in_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard& +SharingLog::_Internal::setup_wizard(const SharingLog* msg) { + return *msg->setup_wizard_; +} +const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode& +SharingLog::_Internal::tap_qr_code(const SharingLog* msg) { + return *msg->tap_qr_code_; +} +const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown& +SharingLog::_Internal::qr_code_link_shown(const SharingLog* msg) { + return *msg->qr_code_link_shown_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId& +SharingLog::_Internal::parsing_failed_endpoint_id(const SharingLog* msg) { + return *msg->parsing_failed_endpoint_id_; +} +const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice& +SharingLog::_Internal::fast_init_discover_device(const SharingLog* msg) { + return *msg->fast_init_discover_device_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification& +SharingLog::_Internal::send_desktop_notification(const SharingLog* msg) { + return *msg->send_desktop_notification_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent& +SharingLog::_Internal::send_desktop_transfer_event(const SharingLog* msg) { + return *msg->send_desktop_transfer_event_; +} +const ::nearby::sharing::analytics::proto::SharingLog_SetAccount& +SharingLog::_Internal::set_account(const SharingLog* msg) { + return *msg->set_account_; +} +const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure& +SharingLog::_Internal::decrypt_certificate_failure(const SharingLog* msg) { + return *msg->decrypt_certificate_failure_; +} +const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess& +SharingLog::_Internal::show_allow_permission_auto_access(const SharingLog* msg) { + return *msg->show_allow_permission_auto_access_; +} +SharingLog::SharingLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) { + SharedCtor(); + if (!is_message_owned) { + RegisterArenaDtor(arena); + } + // @@protoc_insertion_point(arena_constructor:nearby.sharing.analytics.proto.SharingLog) +} +SharingLog::SharingLog(const SharingLog& from) + : ::PROTOBUF_NAMESPACE_ID::MessageLite(), + _has_bits_(from._has_bits_) { + _internal_metadata_.MergeFrom(from._internal_metadata_); + version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_version()) { + version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(), + GetArenaForAllocation()); + } + files_migration_phase_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + files_migration_phase_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_files_migration_phase()) { + files_migration_phase_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_files_migration_phase(), + GetArenaForAllocation()); + } + app_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (from._internal_has_app_version()) { + app_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_app_version(), + GetArenaForAllocation()); + } + if (from._internal_has_unknown_event()) { + unknown_event_ = new ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent(*from.unknown_event_); + } else { + unknown_event_ = nullptr; + } + if (from._internal_has_accept_agreements()) { + accept_agreements_ = new ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements(*from.accept_agreements_); + } else { + accept_agreements_ = nullptr; + } + if (from._internal_has_enable_nearby_sharing()) { + enable_nearby_sharing_ = new ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing(*from.enable_nearby_sharing_); + } else { + enable_nearby_sharing_ = nullptr; + } + if (from._internal_has_set_visibility()) { + set_visibility_ = new ::nearby::sharing::analytics::proto::SharingLog_SetVisibility(*from.set_visibility_); + } else { + set_visibility_ = nullptr; + } + if (from._internal_has_describe_attachments()) { + describe_attachments_ = new ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments(*from.describe_attachments_); + } else { + describe_attachments_ = nullptr; + } + if (from._internal_has_scan_for_share_targets_start()) { + scan_for_share_targets_start_ = new ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart(*from.scan_for_share_targets_start_); + } else { + scan_for_share_targets_start_ = nullptr; + } + if (from._internal_has_scan_for_share_targets_end()) { + scan_for_share_targets_end_ = new ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd(*from.scan_for_share_targets_end_); + } else { + scan_for_share_targets_end_ = nullptr; + } + if (from._internal_has_advertise_device_presence_start()) { + advertise_device_presence_start_ = new ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart(*from.advertise_device_presence_start_); + } else { + advertise_device_presence_start_ = nullptr; + } + if (from._internal_has_advertise_device_presence_end()) { + advertise_device_presence_end_ = new ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd(*from.advertise_device_presence_end_); + } else { + advertise_device_presence_end_ = nullptr; + } + if (from._internal_has_send_initialization()) { + send_initialization_ = new ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization(*from.send_initialization_); + } else { + send_initialization_ = nullptr; + } + if (from._internal_has_receive_initialization()) { + receive_initialization_ = new ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization(*from.receive_initialization_); + } else { + receive_initialization_ = nullptr; + } + if (from._internal_has_discover_share_target()) { + discover_share_target_ = new ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget(*from.discover_share_target_); + } else { + discover_share_target_ = nullptr; + } + if (from._internal_has_send_introduction()) { + send_introduction_ = new ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction(*from.send_introduction_); + } else { + send_introduction_ = nullptr; + } + if (from._internal_has_receive_introduction()) { + receive_introduction_ = new ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction(*from.receive_introduction_); + } else { + receive_introduction_ = nullptr; + } + if (from._internal_has_respond_introduction()) { + respond_introduction_ = new ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction(*from.respond_introduction_); + } else { + respond_introduction_ = nullptr; + } + if (from._internal_has_send_attachments_start()) { + send_attachments_start_ = new ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart(*from.send_attachments_start_); + } else { + send_attachments_start_ = nullptr; + } + if (from._internal_has_send_attachments_end()) { + send_attachments_end_ = new ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd(*from.send_attachments_end_); + } else { + send_attachments_end_ = nullptr; + } + if (from._internal_has_receive_attachments_start()) { + receive_attachments_start_ = new ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart(*from.receive_attachments_start_); + } else { + receive_attachments_start_ = nullptr; + } + if (from._internal_has_receive_attachments_end()) { + receive_attachments_end_ = new ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd(*from.receive_attachments_end_); + } else { + receive_attachments_end_ = nullptr; + } + if (from._internal_has_cancel_sending_attachments()) { + cancel_sending_attachments_ = new ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments(*from.cancel_sending_attachments_); + } else { + cancel_sending_attachments_ = nullptr; + } + if (from._internal_has_cancel_receiving_attachments()) { + cancel_receiving_attachments_ = new ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments(*from.cancel_receiving_attachments_); + } else { + cancel_receiving_attachments_ = nullptr; + } + if (from._internal_has_open_received_attachments()) { + open_received_attachments_ = new ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments(*from.open_received_attachments_); + } else { + open_received_attachments_ = nullptr; + } + if (from._internal_has_launch_activity()) { + launch_activity_ = new ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity(*from.launch_activity_); + } else { + launch_activity_ = nullptr; + } + if (from._internal_has_add_contact()) { + add_contact_ = new ::nearby::sharing::analytics::proto::SharingLog_AddContact(*from.add_contact_); + } else { + add_contact_ = nullptr; + } + if (from._internal_has_remove_contact()) { + remove_contact_ = new ::nearby::sharing::analytics::proto::SharingLog_RemoveContact(*from.remove_contact_); + } else { + remove_contact_ = nullptr; + } + if (from._internal_has_fast_share_server_response()) { + fast_share_server_response_ = new ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse(*from.fast_share_server_response_); + } else { + fast_share_server_response_ = nullptr; + } + if (from._internal_has_send_start()) { + send_start_ = new ::nearby::sharing::analytics::proto::SharingLog_SendStart(*from.send_start_); + } else { + send_start_ = nullptr; + } + if (from._internal_has_accept_fast_initialization()) { + accept_fast_initialization_ = new ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization(*from.accept_fast_initialization_); + } else { + accept_fast_initialization_ = nullptr; + } + if (from._internal_has_set_data_usage()) { + set_data_usage_ = new ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage(*from.set_data_usage_); + } else { + set_data_usage_ = nullptr; + } + if (from._internal_has_dismiss_fast_initialization()) { + dismiss_fast_initialization_ = new ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization(*from.dismiss_fast_initialization_); + } else { + dismiss_fast_initialization_ = nullptr; + } + if (from._internal_has_cancel_connection()) { + cancel_connection_ = new ::nearby::sharing::analytics::proto::SharingLog_CancelConnection(*from.cancel_connection_); + } else { + cancel_connection_ = nullptr; + } + if (from._internal_has_dismiss_privacy_notification()) { + dismiss_privacy_notification_ = new ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification(*from.dismiss_privacy_notification_); + } else { + dismiss_privacy_notification_ = nullptr; + } + if (from._internal_has_tap_privacy_notification()) { + tap_privacy_notification_ = new ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification(*from.tap_privacy_notification_); + } else { + tap_privacy_notification_ = nullptr; + } + if (from._internal_has_tap_help()) { + tap_help_ = new ::nearby::sharing::analytics::proto::SharingLog_TapHelp(*from.tap_help_); + } else { + tap_help_ = nullptr; + } + if (from._internal_has_tap_feedback()) { + tap_feedback_ = new ::nearby::sharing::analytics::proto::SharingLog_TapFeedback(*from.tap_feedback_); + } else { + tap_feedback_ = nullptr; + } + if (from._internal_has_add_quick_settings_tile()) { + add_quick_settings_tile_ = new ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile(*from.add_quick_settings_tile_); + } else { + add_quick_settings_tile_ = nullptr; + } + if (from._internal_has_remove_quick_settings_tile()) { + remove_quick_settings_tile_ = new ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile(*from.remove_quick_settings_tile_); + } else { + remove_quick_settings_tile_ = nullptr; + } + if (from._internal_has_launch_phone_consent()) { + launch_phone_consent_ = new ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent(*from.launch_phone_consent_); + } else { + launch_phone_consent_ = nullptr; + } + if (from._internal_has_tap_quick_settings_tile()) { + tap_quick_settings_tile_ = new ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile(*from.tap_quick_settings_tile_); + } else { + tap_quick_settings_tile_ = nullptr; + } + if (from._internal_has_install_apk_status()) { + install_apk_status_ = new ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus(*from.install_apk_status_); + } else { + install_apk_status_ = nullptr; + } + if (from._internal_has_verify_apk_status()) { + verify_apk_status_ = new ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus(*from.verify_apk_status_); + } else { + verify_apk_status_ = nullptr; + } + if (from._internal_has_launch_consent()) { + launch_consent_ = new ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent(*from.launch_consent_); + } else { + launch_consent_ = nullptr; + } + if (from._internal_has_process_received_attachments_end()) { + process_received_attachments_end_ = new ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd(*from.process_received_attachments_end_); + } else { + process_received_attachments_end_ = nullptr; + } + if (from._internal_has_toggle_show_notification()) { + toggle_show_notification_ = new ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification(*from.toggle_show_notification_); + } else { + toggle_show_notification_ = nullptr; + } + if (from._internal_has_set_device_name()) { + set_device_name_ = new ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName(*from.set_device_name_); + } else { + set_device_name_ = nullptr; + } + if (from._internal_has_decline_agreements()) { + decline_agreements_ = new ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements(*from.decline_agreements_); + } else { + decline_agreements_ = nullptr; + } + if (from._internal_has_request_setting_permissions()) { + request_setting_permissions_ = new ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions(*from.request_setting_permissions_); + } else { + request_setting_permissions_ = nullptr; + } + if (from._internal_has_device_settings()) { + device_settings_ = new ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings(*from.device_settings_); + } else { + device_settings_ = nullptr; + } + if (from._internal_has_establish_connection()) { + establish_connection_ = new ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection(*from.establish_connection_); + } else { + establish_connection_ = nullptr; + } + if (from._internal_has_auto_dismiss_fast_initialization()) { + auto_dismiss_fast_initialization_ = new ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization(*from.auto_dismiss_fast_initialization_); + } else { + auto_dismiss_fast_initialization_ = nullptr; + } + if (from._internal_has_event_metadata()) { + event_metadata_ = new ::nearby::sharing::analytics::proto::SharingLog_EventMetadata(*from.event_metadata_); + } else { + event_metadata_ = nullptr; + } + if (from._internal_has_app_crash()) { + app_crash_ = new ::nearby::sharing::analytics::proto::SharingLog_AppCrash(*from.app_crash_); + } else { + app_crash_ = nullptr; + } + if (from._internal_has_tap_quick_settings_file_share()) { + tap_quick_settings_file_share_ = new ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare(*from.tap_quick_settings_file_share_); + } else { + tap_quick_settings_file_share_ = nullptr; + } + if (from._internal_has_app_info()) { + app_info_ = new ::nearby::sharing::analytics::proto::SharingLog_AppInfo(*from.app_info_); + } else { + app_info_ = nullptr; + } + if (from._internal_has_display_privacy_notification()) { + display_privacy_notification_ = new ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification(*from.display_privacy_notification_); + } else { + display_privacy_notification_ = nullptr; + } + if (from._internal_has_display_phone_consent()) { + display_phone_consent_ = new ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent(*from.display_phone_consent_); + } else { + display_phone_consent_ = nullptr; + } + if (from._internal_has_preferences_usage()) { + preferences_usage_ = new ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage(*from.preferences_usage_); + } else { + preferences_usage_ = nullptr; + } + if (from._internal_has_default_opt_in()) { + default_opt_in_ = new ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn(*from.default_opt_in_); + } else { + default_opt_in_ = nullptr; + } + if (from._internal_has_setup_wizard()) { + setup_wizard_ = new ::nearby::sharing::analytics::proto::SharingLog_SetupWizard(*from.setup_wizard_); + } else { + setup_wizard_ = nullptr; + } + if (from._internal_has_tap_qr_code()) { + tap_qr_code_ = new ::nearby::sharing::analytics::proto::SharingLog_TapQrCode(*from.tap_qr_code_); + } else { + tap_qr_code_ = nullptr; + } + if (from._internal_has_qr_code_link_shown()) { + qr_code_link_shown_ = new ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown(*from.qr_code_link_shown_); + } else { + qr_code_link_shown_ = nullptr; + } + if (from._internal_has_parsing_failed_endpoint_id()) { + parsing_failed_endpoint_id_ = new ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId(*from.parsing_failed_endpoint_id_); + } else { + parsing_failed_endpoint_id_ = nullptr; + } + if (from._internal_has_fast_init_discover_device()) { + fast_init_discover_device_ = new ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice(*from.fast_init_discover_device_); + } else { + fast_init_discover_device_ = nullptr; + } + if (from._internal_has_send_desktop_notification()) { + send_desktop_notification_ = new ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification(*from.send_desktop_notification_); + } else { + send_desktop_notification_ = nullptr; + } + if (from._internal_has_send_desktop_transfer_event()) { + send_desktop_transfer_event_ = new ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent(*from.send_desktop_transfer_event_); + } else { + send_desktop_transfer_event_ = nullptr; + } + if (from._internal_has_set_account()) { + set_account_ = new ::nearby::sharing::analytics::proto::SharingLog_SetAccount(*from.set_account_); + } else { + set_account_ = nullptr; + } + if (from._internal_has_decrypt_certificate_failure()) { + decrypt_certificate_failure_ = new ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure(*from.decrypt_certificate_failure_); + } else { + decrypt_certificate_failure_ = nullptr; + } + if (from._internal_has_show_allow_permission_auto_access()) { + show_allow_permission_auto_access_ = new ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess(*from.show_allow_permission_auto_access_); + } else { + show_allow_permission_auto_access_ = nullptr; + } + ::memcpy(&event_type_, &from.event_type_, + static_cast(reinterpret_cast(&event_category_) - + reinterpret_cast(&event_type_)) + sizeof(event_category_)); + // @@protoc_insertion_point(copy_constructor:nearby.sharing.analytics.proto.SharingLog) +} + +inline void SharingLog::SharedCtor() { +version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +files_migration_phase_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + files_migration_phase_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +app_version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +::memset(reinterpret_cast(this) + static_cast( + reinterpret_cast(&unknown_event_) - reinterpret_cast(this)), + 0, static_cast(reinterpret_cast(&event_category_) - + reinterpret_cast(&unknown_event_)) + sizeof(event_category_)); +} + +SharingLog::~SharingLog() { + // @@protoc_insertion_point(destructor:nearby.sharing.analytics.proto.SharingLog) + if (GetArenaForAllocation() != nullptr) return; + SharedDtor(); + _internal_metadata_.Delete(); +} + +inline void SharingLog::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + files_migration_phase_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + app_version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); + if (this != internal_default_instance()) delete unknown_event_; + if (this != internal_default_instance()) delete accept_agreements_; + if (this != internal_default_instance()) delete enable_nearby_sharing_; + if (this != internal_default_instance()) delete set_visibility_; + if (this != internal_default_instance()) delete describe_attachments_; + if (this != internal_default_instance()) delete scan_for_share_targets_start_; + if (this != internal_default_instance()) delete scan_for_share_targets_end_; + if (this != internal_default_instance()) delete advertise_device_presence_start_; + if (this != internal_default_instance()) delete advertise_device_presence_end_; + if (this != internal_default_instance()) delete send_initialization_; + if (this != internal_default_instance()) delete receive_initialization_; + if (this != internal_default_instance()) delete discover_share_target_; + if (this != internal_default_instance()) delete send_introduction_; + if (this != internal_default_instance()) delete receive_introduction_; + if (this != internal_default_instance()) delete respond_introduction_; + if (this != internal_default_instance()) delete send_attachments_start_; + if (this != internal_default_instance()) delete send_attachments_end_; + if (this != internal_default_instance()) delete receive_attachments_start_; + if (this != internal_default_instance()) delete receive_attachments_end_; + if (this != internal_default_instance()) delete cancel_sending_attachments_; + if (this != internal_default_instance()) delete cancel_receiving_attachments_; + if (this != internal_default_instance()) delete open_received_attachments_; + if (this != internal_default_instance()) delete launch_activity_; + if (this != internal_default_instance()) delete add_contact_; + if (this != internal_default_instance()) delete remove_contact_; + if (this != internal_default_instance()) delete fast_share_server_response_; + if (this != internal_default_instance()) delete send_start_; + if (this != internal_default_instance()) delete accept_fast_initialization_; + if (this != internal_default_instance()) delete set_data_usage_; + if (this != internal_default_instance()) delete dismiss_fast_initialization_; + if (this != internal_default_instance()) delete cancel_connection_; + if (this != internal_default_instance()) delete dismiss_privacy_notification_; + if (this != internal_default_instance()) delete tap_privacy_notification_; + if (this != internal_default_instance()) delete tap_help_; + if (this != internal_default_instance()) delete tap_feedback_; + if (this != internal_default_instance()) delete add_quick_settings_tile_; + if (this != internal_default_instance()) delete remove_quick_settings_tile_; + if (this != internal_default_instance()) delete launch_phone_consent_; + if (this != internal_default_instance()) delete tap_quick_settings_tile_; + if (this != internal_default_instance()) delete install_apk_status_; + if (this != internal_default_instance()) delete verify_apk_status_; + if (this != internal_default_instance()) delete launch_consent_; + if (this != internal_default_instance()) delete process_received_attachments_end_; + if (this != internal_default_instance()) delete toggle_show_notification_; + if (this != internal_default_instance()) delete set_device_name_; + if (this != internal_default_instance()) delete decline_agreements_; + if (this != internal_default_instance()) delete request_setting_permissions_; + if (this != internal_default_instance()) delete device_settings_; + if (this != internal_default_instance()) delete establish_connection_; + if (this != internal_default_instance()) delete auto_dismiss_fast_initialization_; + if (this != internal_default_instance()) delete event_metadata_; + if (this != internal_default_instance()) delete app_crash_; + if (this != internal_default_instance()) delete tap_quick_settings_file_share_; + if (this != internal_default_instance()) delete app_info_; + if (this != internal_default_instance()) delete display_privacy_notification_; + if (this != internal_default_instance()) delete display_phone_consent_; + if (this != internal_default_instance()) delete preferences_usage_; + if (this != internal_default_instance()) delete default_opt_in_; + if (this != internal_default_instance()) delete setup_wizard_; + if (this != internal_default_instance()) delete tap_qr_code_; + if (this != internal_default_instance()) delete qr_code_link_shown_; + if (this != internal_default_instance()) delete parsing_failed_endpoint_id_; + if (this != internal_default_instance()) delete fast_init_discover_device_; + if (this != internal_default_instance()) delete send_desktop_notification_; + if (this != internal_default_instance()) delete send_desktop_transfer_event_; + if (this != internal_default_instance()) delete set_account_; + if (this != internal_default_instance()) delete decrypt_certificate_failure_; + if (this != internal_default_instance()) delete show_allow_permission_auto_access_; +} + +void SharingLog::ArenaDtor(void* object) { + SharingLog* _this = reinterpret_cast< SharingLog* >(object); + (void)_this; +} +void SharingLog::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { +} +void SharingLog::SetCachedSize(int size) const { + _cached_size_.Set(size); +} + +void SharingLog::Clear() { +// @@protoc_insertion_point(message_clear_start:nearby.sharing.analytics.proto.SharingLog) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + version_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000002u) { + files_migration_phase_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000004u) { + app_version_.ClearNonDefaultToEmpty(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(unknown_event_ != nullptr); + unknown_event_->Clear(); + } + if (cached_has_bits & 0x00000010u) { + GOOGLE_DCHECK(accept_agreements_ != nullptr); + accept_agreements_->Clear(); + } + if (cached_has_bits & 0x00000020u) { + GOOGLE_DCHECK(enable_nearby_sharing_ != nullptr); + enable_nearby_sharing_->Clear(); + } + if (cached_has_bits & 0x00000040u) { + GOOGLE_DCHECK(set_visibility_ != nullptr); + set_visibility_->Clear(); + } + if (cached_has_bits & 0x00000080u) { + GOOGLE_DCHECK(describe_attachments_ != nullptr); + describe_attachments_->Clear(); + } + } + if (cached_has_bits & 0x0000ff00u) { + if (cached_has_bits & 0x00000100u) { + GOOGLE_DCHECK(scan_for_share_targets_start_ != nullptr); + scan_for_share_targets_start_->Clear(); + } + if (cached_has_bits & 0x00000200u) { + GOOGLE_DCHECK(scan_for_share_targets_end_ != nullptr); + scan_for_share_targets_end_->Clear(); + } + if (cached_has_bits & 0x00000400u) { + GOOGLE_DCHECK(advertise_device_presence_start_ != nullptr); + advertise_device_presence_start_->Clear(); + } + if (cached_has_bits & 0x00000800u) { + GOOGLE_DCHECK(advertise_device_presence_end_ != nullptr); + advertise_device_presence_end_->Clear(); + } + if (cached_has_bits & 0x00001000u) { + GOOGLE_DCHECK(send_initialization_ != nullptr); + send_initialization_->Clear(); + } + if (cached_has_bits & 0x00002000u) { + GOOGLE_DCHECK(receive_initialization_ != nullptr); + receive_initialization_->Clear(); + } + if (cached_has_bits & 0x00004000u) { + GOOGLE_DCHECK(discover_share_target_ != nullptr); + discover_share_target_->Clear(); + } + if (cached_has_bits & 0x00008000u) { + GOOGLE_DCHECK(send_introduction_ != nullptr); + send_introduction_->Clear(); + } + } + if (cached_has_bits & 0x00ff0000u) { + if (cached_has_bits & 0x00010000u) { + GOOGLE_DCHECK(receive_introduction_ != nullptr); + receive_introduction_->Clear(); + } + if (cached_has_bits & 0x00020000u) { + GOOGLE_DCHECK(respond_introduction_ != nullptr); + respond_introduction_->Clear(); + } + if (cached_has_bits & 0x00040000u) { + GOOGLE_DCHECK(send_attachments_start_ != nullptr); + send_attachments_start_->Clear(); + } + if (cached_has_bits & 0x00080000u) { + GOOGLE_DCHECK(send_attachments_end_ != nullptr); + send_attachments_end_->Clear(); + } + if (cached_has_bits & 0x00100000u) { + GOOGLE_DCHECK(receive_attachments_start_ != nullptr); + receive_attachments_start_->Clear(); + } + if (cached_has_bits & 0x00200000u) { + GOOGLE_DCHECK(receive_attachments_end_ != nullptr); + receive_attachments_end_->Clear(); + } + if (cached_has_bits & 0x00400000u) { + GOOGLE_DCHECK(cancel_sending_attachments_ != nullptr); + cancel_sending_attachments_->Clear(); + } + if (cached_has_bits & 0x00800000u) { + GOOGLE_DCHECK(cancel_receiving_attachments_ != nullptr); + cancel_receiving_attachments_->Clear(); + } + } + if (cached_has_bits & 0xff000000u) { + if (cached_has_bits & 0x01000000u) { + GOOGLE_DCHECK(open_received_attachments_ != nullptr); + open_received_attachments_->Clear(); + } + if (cached_has_bits & 0x02000000u) { + GOOGLE_DCHECK(launch_activity_ != nullptr); + launch_activity_->Clear(); + } + if (cached_has_bits & 0x04000000u) { + GOOGLE_DCHECK(add_contact_ != nullptr); + add_contact_->Clear(); + } + if (cached_has_bits & 0x08000000u) { + GOOGLE_DCHECK(remove_contact_ != nullptr); + remove_contact_->Clear(); + } + if (cached_has_bits & 0x10000000u) { + GOOGLE_DCHECK(fast_share_server_response_ != nullptr); + fast_share_server_response_->Clear(); + } + if (cached_has_bits & 0x20000000u) { + GOOGLE_DCHECK(send_start_ != nullptr); + send_start_->Clear(); + } + if (cached_has_bits & 0x40000000u) { + GOOGLE_DCHECK(accept_fast_initialization_ != nullptr); + accept_fast_initialization_->Clear(); + } + if (cached_has_bits & 0x80000000u) { + GOOGLE_DCHECK(set_data_usage_ != nullptr); + set_data_usage_->Clear(); + } + } + cached_has_bits = _has_bits_[1]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(dismiss_fast_initialization_ != nullptr); + dismiss_fast_initialization_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(cancel_connection_ != nullptr); + cancel_connection_->Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(dismiss_privacy_notification_ != nullptr); + dismiss_privacy_notification_->Clear(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(tap_privacy_notification_ != nullptr); + tap_privacy_notification_->Clear(); + } + if (cached_has_bits & 0x00000010u) { + GOOGLE_DCHECK(tap_help_ != nullptr); + tap_help_->Clear(); + } + if (cached_has_bits & 0x00000020u) { + GOOGLE_DCHECK(tap_feedback_ != nullptr); + tap_feedback_->Clear(); + } + if (cached_has_bits & 0x00000040u) { + GOOGLE_DCHECK(add_quick_settings_tile_ != nullptr); + add_quick_settings_tile_->Clear(); + } + if (cached_has_bits & 0x00000080u) { + GOOGLE_DCHECK(remove_quick_settings_tile_ != nullptr); + remove_quick_settings_tile_->Clear(); + } + } + if (cached_has_bits & 0x0000ff00u) { + if (cached_has_bits & 0x00000100u) { + GOOGLE_DCHECK(launch_phone_consent_ != nullptr); + launch_phone_consent_->Clear(); + } + if (cached_has_bits & 0x00000200u) { + GOOGLE_DCHECK(tap_quick_settings_tile_ != nullptr); + tap_quick_settings_tile_->Clear(); + } + if (cached_has_bits & 0x00000400u) { + GOOGLE_DCHECK(install_apk_status_ != nullptr); + install_apk_status_->Clear(); + } + if (cached_has_bits & 0x00000800u) { + GOOGLE_DCHECK(verify_apk_status_ != nullptr); + verify_apk_status_->Clear(); + } + if (cached_has_bits & 0x00001000u) { + GOOGLE_DCHECK(launch_consent_ != nullptr); + launch_consent_->Clear(); + } + if (cached_has_bits & 0x00002000u) { + GOOGLE_DCHECK(process_received_attachments_end_ != nullptr); + process_received_attachments_end_->Clear(); + } + if (cached_has_bits & 0x00004000u) { + GOOGLE_DCHECK(toggle_show_notification_ != nullptr); + toggle_show_notification_->Clear(); + } + if (cached_has_bits & 0x00008000u) { + GOOGLE_DCHECK(set_device_name_ != nullptr); + set_device_name_->Clear(); + } + } + if (cached_has_bits & 0x00ff0000u) { + if (cached_has_bits & 0x00010000u) { + GOOGLE_DCHECK(decline_agreements_ != nullptr); + decline_agreements_->Clear(); + } + if (cached_has_bits & 0x00020000u) { + GOOGLE_DCHECK(request_setting_permissions_ != nullptr); + request_setting_permissions_->Clear(); + } + if (cached_has_bits & 0x00040000u) { + GOOGLE_DCHECK(device_settings_ != nullptr); + device_settings_->Clear(); + } + if (cached_has_bits & 0x00080000u) { + GOOGLE_DCHECK(establish_connection_ != nullptr); + establish_connection_->Clear(); + } + if (cached_has_bits & 0x00100000u) { + GOOGLE_DCHECK(auto_dismiss_fast_initialization_ != nullptr); + auto_dismiss_fast_initialization_->Clear(); + } + if (cached_has_bits & 0x00200000u) { + GOOGLE_DCHECK(event_metadata_ != nullptr); + event_metadata_->Clear(); + } + if (cached_has_bits & 0x00400000u) { + GOOGLE_DCHECK(app_crash_ != nullptr); + app_crash_->Clear(); + } + if (cached_has_bits & 0x00800000u) { + GOOGLE_DCHECK(tap_quick_settings_file_share_ != nullptr); + tap_quick_settings_file_share_->Clear(); + } + } + if (cached_has_bits & 0xff000000u) { + if (cached_has_bits & 0x01000000u) { + GOOGLE_DCHECK(app_info_ != nullptr); + app_info_->Clear(); + } + if (cached_has_bits & 0x02000000u) { + GOOGLE_DCHECK(display_privacy_notification_ != nullptr); + display_privacy_notification_->Clear(); + } + if (cached_has_bits & 0x04000000u) { + GOOGLE_DCHECK(display_phone_consent_ != nullptr); + display_phone_consent_->Clear(); + } + if (cached_has_bits & 0x08000000u) { + GOOGLE_DCHECK(preferences_usage_ != nullptr); + preferences_usage_->Clear(); + } + if (cached_has_bits & 0x10000000u) { + GOOGLE_DCHECK(default_opt_in_ != nullptr); + default_opt_in_->Clear(); + } + if (cached_has_bits & 0x20000000u) { + GOOGLE_DCHECK(setup_wizard_ != nullptr); + setup_wizard_->Clear(); + } + if (cached_has_bits & 0x40000000u) { + GOOGLE_DCHECK(tap_qr_code_ != nullptr); + tap_qr_code_->Clear(); + } + if (cached_has_bits & 0x80000000u) { + GOOGLE_DCHECK(qr_code_link_shown_ != nullptr); + qr_code_link_shown_->Clear(); + } + } + cached_has_bits = _has_bits_[2]; + if (cached_has_bits & 0x0000007fu) { + if (cached_has_bits & 0x00000001u) { + GOOGLE_DCHECK(parsing_failed_endpoint_id_ != nullptr); + parsing_failed_endpoint_id_->Clear(); + } + if (cached_has_bits & 0x00000002u) { + GOOGLE_DCHECK(fast_init_discover_device_ != nullptr); + fast_init_discover_device_->Clear(); + } + if (cached_has_bits & 0x00000004u) { + GOOGLE_DCHECK(send_desktop_notification_ != nullptr); + send_desktop_notification_->Clear(); + } + if (cached_has_bits & 0x00000008u) { + GOOGLE_DCHECK(send_desktop_transfer_event_ != nullptr); + send_desktop_transfer_event_->Clear(); + } + if (cached_has_bits & 0x00000010u) { + GOOGLE_DCHECK(set_account_ != nullptr); + set_account_->Clear(); + } + if (cached_has_bits & 0x00000020u) { + GOOGLE_DCHECK(decrypt_certificate_failure_ != nullptr); + decrypt_certificate_failure_->Clear(); + } + if (cached_has_bits & 0x00000040u) { + GOOGLE_DCHECK(show_allow_permission_auto_access_ != nullptr); + show_allow_permission_auto_access_->Clear(); + } + } + event_type_ = 0; + if (cached_has_bits & 0x00000300u) { + ::memset(&log_source_, 0, static_cast( + reinterpret_cast(&event_category_) - + reinterpret_cast(&log_source_)) + sizeof(event_category_)); + } + _has_bits_.Clear(); + _internal_metadata_.Clear(); +} + +const char* SharingLog::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); + switch (tag >> 3) { + // optional .location.nearby.proto.sharing.EventType event_type = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::EventType_IsValid(val))) { + _internal_set_event_type(static_cast<::location::nearby::proto::sharing::EventType>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(1, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.UnknownEvent unknown_event = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_unknown_event(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptAgreements accept_agreements = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_accept_agreements(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing enable_nearby_sharing = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_enable_nearby_sharing(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SetVisibility set_visibility = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_set_visibility(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DescribeAttachments describe_attachments = 6; + case 6: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_describe_attachments(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart scan_for_share_targets_start = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) { + ptr = ctx->ParseMessage(_internal_mutable_scan_for_share_targets_start(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd scan_for_share_targets_end = 8; + case 8: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_scan_for_share_targets_end(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart advertise_device_presence_start = 9; + case 9: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + ptr = ctx->ParseMessage(_internal_mutable_advertise_device_presence_start(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd advertise_device_presence_end = 10; + case 10: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) { + ptr = ctx->ParseMessage(_internal_mutable_advertise_device_presence_end(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendFastInitialization send_initialization = 11; + case 11: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 90)) { + ptr = ctx->ParseMessage(_internal_mutable_send_initialization(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization receive_initialization = 12; + case 12: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 98)) { + ptr = ctx->ParseMessage(_internal_mutable_receive_initialization(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget discover_share_target = 13; + case 13: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 106)) { + ptr = ctx->ParseMessage(_internal_mutable_discover_share_target(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendIntroduction send_introduction = 14; + case 14: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 114)) { + ptr = ctx->ParseMessage(_internal_mutable_send_introduction(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction receive_introduction = 15; + case 15: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) { + ptr = ctx->ParseMessage(_internal_mutable_receive_introduction(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction respond_introduction = 16; + case 16: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 130)) { + ptr = ctx->ParseMessage(_internal_mutable_respond_introduction(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart send_attachments_start = 17; + case 17: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 138)) { + ptr = ctx->ParseMessage(_internal_mutable_send_attachments_start(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd send_attachments_end = 18; + case 18: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 146)) { + ptr = ctx->ParseMessage(_internal_mutable_send_attachments_end(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart receive_attachments_start = 19; + case 19: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 154)) { + ptr = ctx->ParseMessage(_internal_mutable_receive_attachments_start(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd receive_attachments_end = 20; + case 20: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 162)) { + ptr = ctx->ParseMessage(_internal_mutable_receive_attachments_end(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments cancel_sending_attachments = 21; + case 21: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 170)) { + ptr = ctx->ParseMessage(_internal_mutable_cancel_sending_attachments(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments cancel_receiving_attachments = 22; + case 22: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 178)) { + ptr = ctx->ParseMessage(_internal_mutable_cancel_receiving_attachments(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments open_received_attachments = 23; + case 23: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 186)) { + ptr = ctx->ParseMessage(_internal_mutable_open_received_attachments(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchActivity launch_activity = 24; + case 24: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 194)) { + ptr = ctx->ParseMessage(_internal_mutable_launch_activity(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AddContact add_contact = 25; + case 25: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 202)) { + ptr = ctx->ParseMessage(_internal_mutable_add_contact(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveContact remove_contact = 26; + case 26: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 210)) { + ptr = ctx->ParseMessage(_internal_mutable_remove_contact(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.LogSource log_source = 27; + case 27: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 216)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::LogSource_IsValid(val))) { + _internal_set_log_source(static_cast<::location::nearby::proto::sharing::LogSource>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(27, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse fast_share_server_response = 28; + case 28: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 226)) { + ptr = ctx->ParseMessage(_internal_mutable_fast_share_server_response(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendStart send_start = 29; + case 29: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 234)) { + ptr = ctx->ParseMessage(_internal_mutable_send_start(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization accept_fast_initialization = 30; + case 30: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 242)) { + ptr = ctx->ParseMessage(_internal_mutable_accept_fast_initialization(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SetDataUsage set_data_usage = 31; + case 31: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 250)) { + ptr = ctx->ParseMessage(_internal_mutable_set_data_usage(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string version = 32; + case 32: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 2)) { + auto str = _internal_mutable_version(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .location.nearby.proto.sharing.EventCategory event_category = 33; + case 33: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 8)) { + uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + if (PROTOBUF_PREDICT_TRUE(::location::nearby::proto::sharing::EventCategory_IsValid(val))) { + _internal_set_event_category(static_cast<::location::nearby::proto::sharing::EventCategory>(val)); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(33, val, mutable_unknown_fields()); + } + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization dismiss_fast_initialization = 34; + case 34: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_dismiss_fast_initialization(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.CancelConnection cancel_connection = 35; + case 35: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_cancel_connection(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification dismiss_privacy_notification = 36; + case 36: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_dismiss_privacy_notification(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification tap_privacy_notification = 37; + case 37: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_tap_privacy_notification(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.TapHelp tap_help = 38; + case 38: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_tap_help(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.TapFeedback tap_feedback = 39; + case 39: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 58)) { + ptr = ctx->ParseMessage(_internal_mutable_tap_feedback(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile add_quick_settings_tile = 40; + case 40: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_add_quick_settings_tile(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile remove_quick_settings_tile = 41; + case 41: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + ptr = ctx->ParseMessage(_internal_mutable_remove_quick_settings_tile(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent launch_phone_consent = 42; + case 42: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) { + ptr = ctx->ParseMessage(_internal_mutable_launch_phone_consent(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile tap_quick_settings_tile = 43; + case 43: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 90)) { + ptr = ctx->ParseMessage(_internal_mutable_tap_quick_settings_tile(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus install_apk_status = 44; + case 44: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 98)) { + ptr = ctx->ParseMessage(_internal_mutable_install_apk_status(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus verify_apk_status = 45; + case 45: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 106)) { + ptr = ctx->ParseMessage(_internal_mutable_verify_apk_status(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchConsent launch_consent = 46; + case 46: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 114)) { + ptr = ctx->ParseMessage(_internal_mutable_launch_consent(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd process_received_attachments_end = 47; + case 47: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 122)) { + ptr = ctx->ParseMessage(_internal_mutable_process_received_attachments_end(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification toggle_show_notification = 48; + case 48: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 130)) { + ptr = ctx->ParseMessage(_internal_mutable_toggle_show_notification(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SetDeviceName set_device_name = 49; + case 49: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 138)) { + ptr = ctx->ParseMessage(_internal_mutable_set_device_name(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string files_migration_phase = 50; + case 50: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 146)) { + auto str = _internal_mutable_files_migration_phase(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DeclineAgreements decline_agreements = 51; + case 51: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 154)) { + ptr = ctx->ParseMessage(_internal_mutable_decline_agreements(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions request_setting_permissions = 52; + case 52: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 162)) { + ptr = ctx->ParseMessage(_internal_mutable_request_setting_permissions(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DeviceSettings device_settings = 53; + case 53: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 170)) { + ptr = ctx->ParseMessage(_internal_mutable_device_settings(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.EstablishConnection establish_connection = 54; + case 54: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 178)) { + ptr = ctx->ParseMessage(_internal_mutable_establish_connection(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization auto_dismiss_fast_initialization = 55; + case 55: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 186)) { + ptr = ctx->ParseMessage(_internal_mutable_auto_dismiss_fast_initialization(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.EventMetadata event_metadata = 56; + case 56: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 194)) { + ptr = ctx->ParseMessage(_internal_mutable_event_metadata(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional string app_version = 57 [deprecated = true]; + case 57: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 202)) { + auto str = _internal_mutable_app_version(); + ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AppCrash app_crash = 58; + case 58: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 210)) { + ptr = ctx->ParseMessage(_internal_mutable_app_crash(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare tap_quick_settings_file_share = 59; + case 59: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 218)) { + ptr = ctx->ParseMessage(_internal_mutable_tap_quick_settings_file_share(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.AppInfo app_info = 60; + case 60: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 226)) { + ptr = ctx->ParseMessage(_internal_mutable_app_info(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification display_privacy_notification = 61; + case 61: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 234)) { + ptr = ctx->ParseMessage(_internal_mutable_display_privacy_notification(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent display_phone_consent = 62; + case 62: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 242)) { + ptr = ctx->ParseMessage(_internal_mutable_display_phone_consent(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.PreferencesUsage preferences_usage = 63; + case 63: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 250)) { + ptr = ctx->ParseMessage(_internal_mutable_preferences_usage(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DefaultOptIn default_opt_in = 64; + case 64: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 2)) { + ptr = ctx->ParseMessage(_internal_mutable_default_opt_in(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SetupWizard setup_wizard = 65; + case 65: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr = ctx->ParseMessage(_internal_mutable_setup_wizard(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.TapQrCode tap_qr_code = 66; + case 66: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_tap_qr_code(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown qr_code_link_shown = 67; + case 67: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 26)) { + ptr = ctx->ParseMessage(_internal_mutable_qr_code_link_shown(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId parsing_failed_endpoint_id = 68; + case 68: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_parsing_failed_endpoint_id(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice fast_init_discover_device = 69; + case 69: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_fast_init_discover_device(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification send_desktop_notification = 70; + case 70: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 50)) { + ptr = ctx->ParseMessage(_internal_mutable_send_desktop_notification(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent send_desktop_transfer_event = 72; + case 72: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 66)) { + ptr = ctx->ParseMessage(_internal_mutable_send_desktop_transfer_event(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.SetAccount set_account = 73; + case 73: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 74)) { + ptr = ctx->ParseMessage(_internal_mutable_set_account(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure decrypt_certificate_failure = 74; + case 74: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 82)) { + ptr = ctx->ParseMessage(_internal_mutable_decrypt_certificate_failure(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // optional .nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess show_allow_permission_auto_access = 75; + case 75: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 90)) { + ptr = ctx->ParseMessage(_internal_mutable_show_allow_permission_auto_access(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* SharingLog::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:nearby.sharing.analytics.proto.SharingLog) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = _has_bits_[2]; + // optional .location.nearby.proto.sharing.EventType event_type = 1; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 1, this->_internal_event_type(), target); + } + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.UnknownEvent unknown_event = 2; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 2, _Internal::unknown_event(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptAgreements accept_agreements = 3; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 3, _Internal::accept_agreements(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing enable_nearby_sharing = 4; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 4, _Internal::enable_nearby_sharing(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetVisibility set_visibility = 5; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 5, _Internal::set_visibility(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DescribeAttachments describe_attachments = 6; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 6, _Internal::describe_attachments(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart scan_for_share_targets_start = 7; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 7, _Internal::scan_for_share_targets_start(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd scan_for_share_targets_end = 8; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 8, _Internal::scan_for_share_targets_end(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart advertise_device_presence_start = 9; + if (cached_has_bits & 0x00000400u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 9, _Internal::advertise_device_presence_start(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd advertise_device_presence_end = 10; + if (cached_has_bits & 0x00000800u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 10, _Internal::advertise_device_presence_end(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendFastInitialization send_initialization = 11; + if (cached_has_bits & 0x00001000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 11, _Internal::send_initialization(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization receive_initialization = 12; + if (cached_has_bits & 0x00002000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 12, _Internal::receive_initialization(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget discover_share_target = 13; + if (cached_has_bits & 0x00004000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 13, _Internal::discover_share_target(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendIntroduction send_introduction = 14; + if (cached_has_bits & 0x00008000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 14, _Internal::send_introduction(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction receive_introduction = 15; + if (cached_has_bits & 0x00010000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 15, _Internal::receive_introduction(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction respond_introduction = 16; + if (cached_has_bits & 0x00020000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 16, _Internal::respond_introduction(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart send_attachments_start = 17; + if (cached_has_bits & 0x00040000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 17, _Internal::send_attachments_start(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd send_attachments_end = 18; + if (cached_has_bits & 0x00080000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 18, _Internal::send_attachments_end(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart receive_attachments_start = 19; + if (cached_has_bits & 0x00100000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 19, _Internal::receive_attachments_start(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd receive_attachments_end = 20; + if (cached_has_bits & 0x00200000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 20, _Internal::receive_attachments_end(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments cancel_sending_attachments = 21; + if (cached_has_bits & 0x00400000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 21, _Internal::cancel_sending_attachments(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments cancel_receiving_attachments = 22; + if (cached_has_bits & 0x00800000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 22, _Internal::cancel_receiving_attachments(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments open_received_attachments = 23; + if (cached_has_bits & 0x01000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 23, _Internal::open_received_attachments(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchActivity launch_activity = 24; + if (cached_has_bits & 0x02000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 24, _Internal::launch_activity(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AddContact add_contact = 25; + if (cached_has_bits & 0x04000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 25, _Internal::add_contact(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveContact remove_contact = 26; + if (cached_has_bits & 0x08000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 26, _Internal::remove_contact(this), target, stream); + } + + cached_has_bits = _has_bits_[2]; + // optional .location.nearby.proto.sharing.LogSource log_source = 27; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 27, this->_internal_log_source(), target); + } + + cached_has_bits = _has_bits_[0]; + // optional .nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse fast_share_server_response = 28; + if (cached_has_bits & 0x10000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 28, _Internal::fast_share_server_response(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendStart send_start = 29; + if (cached_has_bits & 0x20000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 29, _Internal::send_start(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization accept_fast_initialization = 30; + if (cached_has_bits & 0x40000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 30, _Internal::accept_fast_initialization(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetDataUsage set_data_usage = 31; + if (cached_has_bits & 0x80000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 31, _Internal::set_data_usage(this), target, stream); + } + + // optional string version = 32; + if (cached_has_bits & 0x00000001u) { + target = stream->WriteStringMaybeAliased( + 32, this->_internal_version(), target); + } + + cached_has_bits = _has_bits_[2]; + // optional .location.nearby.proto.sharing.EventCategory event_category = 33; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( + 33, this->_internal_event_category(), target); + } + + cached_has_bits = _has_bits_[1]; + // optional .nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization dismiss_fast_initialization = 34; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 34, _Internal::dismiss_fast_initialization(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelConnection cancel_connection = 35; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 35, _Internal::cancel_connection(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification dismiss_privacy_notification = 36; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 36, _Internal::dismiss_privacy_notification(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification tap_privacy_notification = 37; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 37, _Internal::tap_privacy_notification(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapHelp tap_help = 38; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 38, _Internal::tap_help(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapFeedback tap_feedback = 39; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 39, _Internal::tap_feedback(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile add_quick_settings_tile = 40; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 40, _Internal::add_quick_settings_tile(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile remove_quick_settings_tile = 41; + if (cached_has_bits & 0x00000080u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 41, _Internal::remove_quick_settings_tile(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent launch_phone_consent = 42; + if (cached_has_bits & 0x00000100u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 42, _Internal::launch_phone_consent(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile tap_quick_settings_tile = 43; + if (cached_has_bits & 0x00000200u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 43, _Internal::tap_quick_settings_tile(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus install_apk_status = 44; + if (cached_has_bits & 0x00000400u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 44, _Internal::install_apk_status(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus verify_apk_status = 45; + if (cached_has_bits & 0x00000800u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 45, _Internal::verify_apk_status(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchConsent launch_consent = 46; + if (cached_has_bits & 0x00001000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 46, _Internal::launch_consent(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd process_received_attachments_end = 47; + if (cached_has_bits & 0x00002000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 47, _Internal::process_received_attachments_end(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification toggle_show_notification = 48; + if (cached_has_bits & 0x00004000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 48, _Internal::toggle_show_notification(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetDeviceName set_device_name = 49; + if (cached_has_bits & 0x00008000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 49, _Internal::set_device_name(this), target, stream); + } + + cached_has_bits = _has_bits_[0]; + // optional string files_migration_phase = 50; + if (cached_has_bits & 0x00000002u) { + target = stream->WriteStringMaybeAliased( + 50, this->_internal_files_migration_phase(), target); + } + + cached_has_bits = _has_bits_[1]; + // optional .nearby.sharing.analytics.proto.SharingLog.DeclineAgreements decline_agreements = 51; + if (cached_has_bits & 0x00010000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 51, _Internal::decline_agreements(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions request_setting_permissions = 52; + if (cached_has_bits & 0x00020000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 52, _Internal::request_setting_permissions(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DeviceSettings device_settings = 53; + if (cached_has_bits & 0x00040000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 53, _Internal::device_settings(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.EstablishConnection establish_connection = 54; + if (cached_has_bits & 0x00080000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 54, _Internal::establish_connection(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization auto_dismiss_fast_initialization = 55; + if (cached_has_bits & 0x00100000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 55, _Internal::auto_dismiss_fast_initialization(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.EventMetadata event_metadata = 56; + if (cached_has_bits & 0x00200000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 56, _Internal::event_metadata(this), target, stream); + } + + cached_has_bits = _has_bits_[0]; + // optional string app_version = 57 [deprecated = true]; + if (cached_has_bits & 0x00000004u) { + target = stream->WriteStringMaybeAliased( + 57, this->_internal_app_version(), target); + } + + cached_has_bits = _has_bits_[1]; + // optional .nearby.sharing.analytics.proto.SharingLog.AppCrash app_crash = 58; + if (cached_has_bits & 0x00400000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 58, _Internal::app_crash(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare tap_quick_settings_file_share = 59; + if (cached_has_bits & 0x00800000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 59, _Internal::tap_quick_settings_file_share(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AppInfo app_info = 60; + if (cached_has_bits & 0x01000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 60, _Internal::app_info(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification display_privacy_notification = 61; + if (cached_has_bits & 0x02000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 61, _Internal::display_privacy_notification(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent display_phone_consent = 62; + if (cached_has_bits & 0x04000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 62, _Internal::display_phone_consent(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.PreferencesUsage preferences_usage = 63; + if (cached_has_bits & 0x08000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 63, _Internal::preferences_usage(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DefaultOptIn default_opt_in = 64; + if (cached_has_bits & 0x10000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 64, _Internal::default_opt_in(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetupWizard setup_wizard = 65; + if (cached_has_bits & 0x20000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 65, _Internal::setup_wizard(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQrCode tap_qr_code = 66; + if (cached_has_bits & 0x40000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 66, _Internal::tap_qr_code(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown qr_code_link_shown = 67; + if (cached_has_bits & 0x80000000u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 67, _Internal::qr_code_link_shown(this), target, stream); + } + + cached_has_bits = _has_bits_[2]; + // optional .nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId parsing_failed_endpoint_id = 68; + if (cached_has_bits & 0x00000001u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 68, _Internal::parsing_failed_endpoint_id(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice fast_init_discover_device = 69; + if (cached_has_bits & 0x00000002u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 69, _Internal::fast_init_discover_device(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification send_desktop_notification = 70; + if (cached_has_bits & 0x00000004u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 70, _Internal::send_desktop_notification(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent send_desktop_transfer_event = 72; + if (cached_has_bits & 0x00000008u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 72, _Internal::send_desktop_transfer_event(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetAccount set_account = 73; + if (cached_has_bits & 0x00000010u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 73, _Internal::set_account(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure decrypt_certificate_failure = 74; + if (cached_has_bits & 0x00000020u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 74, _Internal::decrypt_certificate_failure(this), target, stream); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess show_allow_permission_auto_access = 75; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage( + 75, _Internal::show_allow_permission_auto_access(this), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = stream->WriteRaw(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(), + static_cast(_internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target); + } + // @@protoc_insertion_point(serialize_to_array_end:nearby.sharing.analytics.proto.SharingLog) + return target; +} + +size_t SharingLog::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:nearby.sharing.analytics.proto.SharingLog) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + cached_has_bits = _has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + // optional string version = 32; + if (cached_has_bits & 0x00000001u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_version()); + } + + // optional string files_migration_phase = 50; + if (cached_has_bits & 0x00000002u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_files_migration_phase()); + } + + // optional string app_version = 57 [deprecated = true]; + if (cached_has_bits & 0x00000004u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_app_version()); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.UnknownEvent unknown_event = 2; + if (cached_has_bits & 0x00000008u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *unknown_event_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptAgreements accept_agreements = 3; + if (cached_has_bits & 0x00000010u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *accept_agreements_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing enable_nearby_sharing = 4; + if (cached_has_bits & 0x00000020u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *enable_nearby_sharing_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetVisibility set_visibility = 5; + if (cached_has_bits & 0x00000040u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *set_visibility_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DescribeAttachments describe_attachments = 6; + if (cached_has_bits & 0x00000080u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *describe_attachments_); + } + + } + if (cached_has_bits & 0x0000ff00u) { + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart scan_for_share_targets_start = 7; + if (cached_has_bits & 0x00000100u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *scan_for_share_targets_start_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd scan_for_share_targets_end = 8; + if (cached_has_bits & 0x00000200u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *scan_for_share_targets_end_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart advertise_device_presence_start = 9; + if (cached_has_bits & 0x00000400u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *advertise_device_presence_start_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd advertise_device_presence_end = 10; + if (cached_has_bits & 0x00000800u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *advertise_device_presence_end_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendFastInitialization send_initialization = 11; + if (cached_has_bits & 0x00001000u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_initialization_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization receive_initialization = 12; + if (cached_has_bits & 0x00002000u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *receive_initialization_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget discover_share_target = 13; + if (cached_has_bits & 0x00004000u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *discover_share_target_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendIntroduction send_introduction = 14; + if (cached_has_bits & 0x00008000u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_introduction_); + } + + } + if (cached_has_bits & 0x00ff0000u) { + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction receive_introduction = 15; + if (cached_has_bits & 0x00010000u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *receive_introduction_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction respond_introduction = 16; + if (cached_has_bits & 0x00020000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *respond_introduction_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart send_attachments_start = 17; + if (cached_has_bits & 0x00040000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_attachments_start_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd send_attachments_end = 18; + if (cached_has_bits & 0x00080000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_attachments_end_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart receive_attachments_start = 19; + if (cached_has_bits & 0x00100000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *receive_attachments_start_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd receive_attachments_end = 20; + if (cached_has_bits & 0x00200000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *receive_attachments_end_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments cancel_sending_attachments = 21; + if (cached_has_bits & 0x00400000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *cancel_sending_attachments_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments cancel_receiving_attachments = 22; + if (cached_has_bits & 0x00800000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *cancel_receiving_attachments_); + } + + } + if (cached_has_bits & 0xff000000u) { + // optional .nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments open_received_attachments = 23; + if (cached_has_bits & 0x01000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *open_received_attachments_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchActivity launch_activity = 24; + if (cached_has_bits & 0x02000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *launch_activity_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AddContact add_contact = 25; + if (cached_has_bits & 0x04000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *add_contact_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveContact remove_contact = 26; + if (cached_has_bits & 0x08000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *remove_contact_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse fast_share_server_response = 28; + if (cached_has_bits & 0x10000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *fast_share_server_response_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendStart send_start = 29; + if (cached_has_bits & 0x20000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_start_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization accept_fast_initialization = 30; + if (cached_has_bits & 0x40000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *accept_fast_initialization_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetDataUsage set_data_usage = 31; + if (cached_has_bits & 0x80000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *set_data_usage_); + } + + } + cached_has_bits = _has_bits_[1]; + if (cached_has_bits & 0x000000ffu) { + // optional .nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization dismiss_fast_initialization = 34; + if (cached_has_bits & 0x00000001u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *dismiss_fast_initialization_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelConnection cancel_connection = 35; + if (cached_has_bits & 0x00000002u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *cancel_connection_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification dismiss_privacy_notification = 36; + if (cached_has_bits & 0x00000004u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *dismiss_privacy_notification_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification tap_privacy_notification = 37; + if (cached_has_bits & 0x00000008u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tap_privacy_notification_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapHelp tap_help = 38; + if (cached_has_bits & 0x00000010u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tap_help_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapFeedback tap_feedback = 39; + if (cached_has_bits & 0x00000020u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tap_feedback_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile add_quick_settings_tile = 40; + if (cached_has_bits & 0x00000040u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *add_quick_settings_tile_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile remove_quick_settings_tile = 41; + if (cached_has_bits & 0x00000080u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *remove_quick_settings_tile_); + } + + } + if (cached_has_bits & 0x0000ff00u) { + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent launch_phone_consent = 42; + if (cached_has_bits & 0x00000100u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *launch_phone_consent_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile tap_quick_settings_tile = 43; + if (cached_has_bits & 0x00000200u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tap_quick_settings_tile_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus install_apk_status = 44; + if (cached_has_bits & 0x00000400u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *install_apk_status_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus verify_apk_status = 45; + if (cached_has_bits & 0x00000800u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *verify_apk_status_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchConsent launch_consent = 46; + if (cached_has_bits & 0x00001000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *launch_consent_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd process_received_attachments_end = 47; + if (cached_has_bits & 0x00002000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *process_received_attachments_end_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification toggle_show_notification = 48; + if (cached_has_bits & 0x00004000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *toggle_show_notification_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetDeviceName set_device_name = 49; + if (cached_has_bits & 0x00008000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *set_device_name_); + } + + } + if (cached_has_bits & 0x00ff0000u) { + // optional .nearby.sharing.analytics.proto.SharingLog.DeclineAgreements decline_agreements = 51; + if (cached_has_bits & 0x00010000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *decline_agreements_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions request_setting_permissions = 52; + if (cached_has_bits & 0x00020000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *request_setting_permissions_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DeviceSettings device_settings = 53; + if (cached_has_bits & 0x00040000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *device_settings_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.EstablishConnection establish_connection = 54; + if (cached_has_bits & 0x00080000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *establish_connection_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization auto_dismiss_fast_initialization = 55; + if (cached_has_bits & 0x00100000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *auto_dismiss_fast_initialization_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.EventMetadata event_metadata = 56; + if (cached_has_bits & 0x00200000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *event_metadata_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.AppCrash app_crash = 58; + if (cached_has_bits & 0x00400000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *app_crash_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare tap_quick_settings_file_share = 59; + if (cached_has_bits & 0x00800000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tap_quick_settings_file_share_); + } + + } + if (cached_has_bits & 0xff000000u) { + // optional .nearby.sharing.analytics.proto.SharingLog.AppInfo app_info = 60; + if (cached_has_bits & 0x01000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *app_info_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification display_privacy_notification = 61; + if (cached_has_bits & 0x02000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *display_privacy_notification_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent display_phone_consent = 62; + if (cached_has_bits & 0x04000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *display_phone_consent_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.PreferencesUsage preferences_usage = 63; + if (cached_has_bits & 0x08000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *preferences_usage_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DefaultOptIn default_opt_in = 64; + if (cached_has_bits & 0x10000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *default_opt_in_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetupWizard setup_wizard = 65; + if (cached_has_bits & 0x20000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *setup_wizard_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQrCode tap_qr_code = 66; + if (cached_has_bits & 0x40000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *tap_qr_code_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown qr_code_link_shown = 67; + if (cached_has_bits & 0x80000000u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *qr_code_link_shown_); + } + + } + cached_has_bits = _has_bits_[2]; + if (cached_has_bits & 0x000000ffu) { + // optional .nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId parsing_failed_endpoint_id = 68; + if (cached_has_bits & 0x00000001u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *parsing_failed_endpoint_id_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice fast_init_discover_device = 69; + if (cached_has_bits & 0x00000002u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *fast_init_discover_device_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification send_desktop_notification = 70; + if (cached_has_bits & 0x00000004u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_desktop_notification_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent send_desktop_transfer_event = 72; + if (cached_has_bits & 0x00000008u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *send_desktop_transfer_event_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.SetAccount set_account = 73; + if (cached_has_bits & 0x00000010u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *set_account_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure decrypt_certificate_failure = 74; + if (cached_has_bits & 0x00000020u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *decrypt_certificate_failure_); + } + + // optional .nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess show_allow_permission_auto_access = 75; + if (cached_has_bits & 0x00000040u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *show_allow_permission_auto_access_); + } + + // optional .location.nearby.proto.sharing.EventType event_type = 1; + if (cached_has_bits & 0x00000080u) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_event_type()); + } + + } + if (cached_has_bits & 0x00000300u) { + // optional .location.nearby.proto.sharing.LogSource log_source = 27; + if (cached_has_bits & 0x00000100u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_log_source()); + } + + // optional .location.nearby.proto.sharing.EventCategory event_category = 33; + if (cached_has_bits & 0x00000200u) { + total_size += 2 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_event_category()); + } + + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + total_size += _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size(); + } + int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); + SetCachedSize(cached_size); + return total_size; +} + +void SharingLog::CheckTypeAndMergeFrom( + const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) { + MergeFrom(*::PROTOBUF_NAMESPACE_ID::internal::DownCast( + &from)); +} + +void SharingLog::MergeFrom(const SharingLog& from) { +// @@protoc_insertion_point(class_specific_merge_from_start:nearby.sharing.analytics.proto.SharingLog) + GOOGLE_DCHECK_NE(&from, this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + cached_has_bits = from._has_bits_[0]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_set_version(from._internal_version()); + } + if (cached_has_bits & 0x00000002u) { + _internal_set_files_migration_phase(from._internal_files_migration_phase()); + } + if (cached_has_bits & 0x00000004u) { + _internal_set_app_version(from._internal_app_version()); + } + if (cached_has_bits & 0x00000008u) { + _internal_mutable_unknown_event()->::nearby::sharing::analytics::proto::SharingLog_UnknownEvent::MergeFrom(from._internal_unknown_event()); + } + if (cached_has_bits & 0x00000010u) { + _internal_mutable_accept_agreements()->::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements::MergeFrom(from._internal_accept_agreements()); + } + if (cached_has_bits & 0x00000020u) { + _internal_mutable_enable_nearby_sharing()->::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing::MergeFrom(from._internal_enable_nearby_sharing()); + } + if (cached_has_bits & 0x00000040u) { + _internal_mutable_set_visibility()->::nearby::sharing::analytics::proto::SharingLog_SetVisibility::MergeFrom(from._internal_set_visibility()); + } + if (cached_has_bits & 0x00000080u) { + _internal_mutable_describe_attachments()->::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments::MergeFrom(from._internal_describe_attachments()); + } + } + if (cached_has_bits & 0x0000ff00u) { + if (cached_has_bits & 0x00000100u) { + _internal_mutable_scan_for_share_targets_start()->::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart::MergeFrom(from._internal_scan_for_share_targets_start()); + } + if (cached_has_bits & 0x00000200u) { + _internal_mutable_scan_for_share_targets_end()->::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd::MergeFrom(from._internal_scan_for_share_targets_end()); + } + if (cached_has_bits & 0x00000400u) { + _internal_mutable_advertise_device_presence_start()->::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart::MergeFrom(from._internal_advertise_device_presence_start()); + } + if (cached_has_bits & 0x00000800u) { + _internal_mutable_advertise_device_presence_end()->::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd::MergeFrom(from._internal_advertise_device_presence_end()); + } + if (cached_has_bits & 0x00001000u) { + _internal_mutable_send_initialization()->::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization::MergeFrom(from._internal_send_initialization()); + } + if (cached_has_bits & 0x00002000u) { + _internal_mutable_receive_initialization()->::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization::MergeFrom(from._internal_receive_initialization()); + } + if (cached_has_bits & 0x00004000u) { + _internal_mutable_discover_share_target()->::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget::MergeFrom(from._internal_discover_share_target()); + } + if (cached_has_bits & 0x00008000u) { + _internal_mutable_send_introduction()->::nearby::sharing::analytics::proto::SharingLog_SendIntroduction::MergeFrom(from._internal_send_introduction()); + } + } + if (cached_has_bits & 0x00ff0000u) { + if (cached_has_bits & 0x00010000u) { + _internal_mutable_receive_introduction()->::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction::MergeFrom(from._internal_receive_introduction()); + } + if (cached_has_bits & 0x00020000u) { + _internal_mutable_respond_introduction()->::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction::MergeFrom(from._internal_respond_introduction()); + } + if (cached_has_bits & 0x00040000u) { + _internal_mutable_send_attachments_start()->::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart::MergeFrom(from._internal_send_attachments_start()); + } + if (cached_has_bits & 0x00080000u) { + _internal_mutable_send_attachments_end()->::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd::MergeFrom(from._internal_send_attachments_end()); + } + if (cached_has_bits & 0x00100000u) { + _internal_mutable_receive_attachments_start()->::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart::MergeFrom(from._internal_receive_attachments_start()); + } + if (cached_has_bits & 0x00200000u) { + _internal_mutable_receive_attachments_end()->::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd::MergeFrom(from._internal_receive_attachments_end()); + } + if (cached_has_bits & 0x00400000u) { + _internal_mutable_cancel_sending_attachments()->::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments::MergeFrom(from._internal_cancel_sending_attachments()); + } + if (cached_has_bits & 0x00800000u) { + _internal_mutable_cancel_receiving_attachments()->::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments::MergeFrom(from._internal_cancel_receiving_attachments()); + } + } + if (cached_has_bits & 0xff000000u) { + if (cached_has_bits & 0x01000000u) { + _internal_mutable_open_received_attachments()->::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments::MergeFrom(from._internal_open_received_attachments()); + } + if (cached_has_bits & 0x02000000u) { + _internal_mutable_launch_activity()->::nearby::sharing::analytics::proto::SharingLog_LaunchActivity::MergeFrom(from._internal_launch_activity()); + } + if (cached_has_bits & 0x04000000u) { + _internal_mutable_add_contact()->::nearby::sharing::analytics::proto::SharingLog_AddContact::MergeFrom(from._internal_add_contact()); + } + if (cached_has_bits & 0x08000000u) { + _internal_mutable_remove_contact()->::nearby::sharing::analytics::proto::SharingLog_RemoveContact::MergeFrom(from._internal_remove_contact()); + } + if (cached_has_bits & 0x10000000u) { + _internal_mutable_fast_share_server_response()->::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse::MergeFrom(from._internal_fast_share_server_response()); + } + if (cached_has_bits & 0x20000000u) { + _internal_mutable_send_start()->::nearby::sharing::analytics::proto::SharingLog_SendStart::MergeFrom(from._internal_send_start()); + } + if (cached_has_bits & 0x40000000u) { + _internal_mutable_accept_fast_initialization()->::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization::MergeFrom(from._internal_accept_fast_initialization()); + } + if (cached_has_bits & 0x80000000u) { + _internal_mutable_set_data_usage()->::nearby::sharing::analytics::proto::SharingLog_SetDataUsage::MergeFrom(from._internal_set_data_usage()); + } + } + cached_has_bits = from._has_bits_[1]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_dismiss_fast_initialization()->::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization::MergeFrom(from._internal_dismiss_fast_initialization()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_cancel_connection()->::nearby::sharing::analytics::proto::SharingLog_CancelConnection::MergeFrom(from._internal_cancel_connection()); + } + if (cached_has_bits & 0x00000004u) { + _internal_mutable_dismiss_privacy_notification()->::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification::MergeFrom(from._internal_dismiss_privacy_notification()); + } + if (cached_has_bits & 0x00000008u) { + _internal_mutable_tap_privacy_notification()->::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification::MergeFrom(from._internal_tap_privacy_notification()); + } + if (cached_has_bits & 0x00000010u) { + _internal_mutable_tap_help()->::nearby::sharing::analytics::proto::SharingLog_TapHelp::MergeFrom(from._internal_tap_help()); + } + if (cached_has_bits & 0x00000020u) { + _internal_mutable_tap_feedback()->::nearby::sharing::analytics::proto::SharingLog_TapFeedback::MergeFrom(from._internal_tap_feedback()); + } + if (cached_has_bits & 0x00000040u) { + _internal_mutable_add_quick_settings_tile()->::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile::MergeFrom(from._internal_add_quick_settings_tile()); + } + if (cached_has_bits & 0x00000080u) { + _internal_mutable_remove_quick_settings_tile()->::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile::MergeFrom(from._internal_remove_quick_settings_tile()); + } + } + if (cached_has_bits & 0x0000ff00u) { + if (cached_has_bits & 0x00000100u) { + _internal_mutable_launch_phone_consent()->::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent::MergeFrom(from._internal_launch_phone_consent()); + } + if (cached_has_bits & 0x00000200u) { + _internal_mutable_tap_quick_settings_tile()->::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile::MergeFrom(from._internal_tap_quick_settings_tile()); + } + if (cached_has_bits & 0x00000400u) { + _internal_mutable_install_apk_status()->::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus::MergeFrom(from._internal_install_apk_status()); + } + if (cached_has_bits & 0x00000800u) { + _internal_mutable_verify_apk_status()->::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus::MergeFrom(from._internal_verify_apk_status()); + } + if (cached_has_bits & 0x00001000u) { + _internal_mutable_launch_consent()->::nearby::sharing::analytics::proto::SharingLog_LaunchConsent::MergeFrom(from._internal_launch_consent()); + } + if (cached_has_bits & 0x00002000u) { + _internal_mutable_process_received_attachments_end()->::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd::MergeFrom(from._internal_process_received_attachments_end()); + } + if (cached_has_bits & 0x00004000u) { + _internal_mutable_toggle_show_notification()->::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification::MergeFrom(from._internal_toggle_show_notification()); + } + if (cached_has_bits & 0x00008000u) { + _internal_mutable_set_device_name()->::nearby::sharing::analytics::proto::SharingLog_SetDeviceName::MergeFrom(from._internal_set_device_name()); + } + } + if (cached_has_bits & 0x00ff0000u) { + if (cached_has_bits & 0x00010000u) { + _internal_mutable_decline_agreements()->::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements::MergeFrom(from._internal_decline_agreements()); + } + if (cached_has_bits & 0x00020000u) { + _internal_mutable_request_setting_permissions()->::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions::MergeFrom(from._internal_request_setting_permissions()); + } + if (cached_has_bits & 0x00040000u) { + _internal_mutable_device_settings()->::nearby::sharing::analytics::proto::SharingLog_DeviceSettings::MergeFrom(from._internal_device_settings()); + } + if (cached_has_bits & 0x00080000u) { + _internal_mutable_establish_connection()->::nearby::sharing::analytics::proto::SharingLog_EstablishConnection::MergeFrom(from._internal_establish_connection()); + } + if (cached_has_bits & 0x00100000u) { + _internal_mutable_auto_dismiss_fast_initialization()->::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization::MergeFrom(from._internal_auto_dismiss_fast_initialization()); + } + if (cached_has_bits & 0x00200000u) { + _internal_mutable_event_metadata()->::nearby::sharing::analytics::proto::SharingLog_EventMetadata::MergeFrom(from._internal_event_metadata()); + } + if (cached_has_bits & 0x00400000u) { + _internal_mutable_app_crash()->::nearby::sharing::analytics::proto::SharingLog_AppCrash::MergeFrom(from._internal_app_crash()); + } + if (cached_has_bits & 0x00800000u) { + _internal_mutable_tap_quick_settings_file_share()->::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare::MergeFrom(from._internal_tap_quick_settings_file_share()); + } + } + if (cached_has_bits & 0xff000000u) { + if (cached_has_bits & 0x01000000u) { + _internal_mutable_app_info()->::nearby::sharing::analytics::proto::SharingLog_AppInfo::MergeFrom(from._internal_app_info()); + } + if (cached_has_bits & 0x02000000u) { + _internal_mutable_display_privacy_notification()->::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification::MergeFrom(from._internal_display_privacy_notification()); + } + if (cached_has_bits & 0x04000000u) { + _internal_mutable_display_phone_consent()->::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent::MergeFrom(from._internal_display_phone_consent()); + } + if (cached_has_bits & 0x08000000u) { + _internal_mutable_preferences_usage()->::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage::MergeFrom(from._internal_preferences_usage()); + } + if (cached_has_bits & 0x10000000u) { + _internal_mutable_default_opt_in()->::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn::MergeFrom(from._internal_default_opt_in()); + } + if (cached_has_bits & 0x20000000u) { + _internal_mutable_setup_wizard()->::nearby::sharing::analytics::proto::SharingLog_SetupWizard::MergeFrom(from._internal_setup_wizard()); + } + if (cached_has_bits & 0x40000000u) { + _internal_mutable_tap_qr_code()->::nearby::sharing::analytics::proto::SharingLog_TapQrCode::MergeFrom(from._internal_tap_qr_code()); + } + if (cached_has_bits & 0x80000000u) { + _internal_mutable_qr_code_link_shown()->::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown::MergeFrom(from._internal_qr_code_link_shown()); + } + } + cached_has_bits = from._has_bits_[2]; + if (cached_has_bits & 0x000000ffu) { + if (cached_has_bits & 0x00000001u) { + _internal_mutable_parsing_failed_endpoint_id()->::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId::MergeFrom(from._internal_parsing_failed_endpoint_id()); + } + if (cached_has_bits & 0x00000002u) { + _internal_mutable_fast_init_discover_device()->::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice::MergeFrom(from._internal_fast_init_discover_device()); + } + if (cached_has_bits & 0x00000004u) { + _internal_mutable_send_desktop_notification()->::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification::MergeFrom(from._internal_send_desktop_notification()); + } + if (cached_has_bits & 0x00000008u) { + _internal_mutable_send_desktop_transfer_event()->::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent::MergeFrom(from._internal_send_desktop_transfer_event()); + } + if (cached_has_bits & 0x00000010u) { + _internal_mutable_set_account()->::nearby::sharing::analytics::proto::SharingLog_SetAccount::MergeFrom(from._internal_set_account()); + } + if (cached_has_bits & 0x00000020u) { + _internal_mutable_decrypt_certificate_failure()->::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure::MergeFrom(from._internal_decrypt_certificate_failure()); + } + if (cached_has_bits & 0x00000040u) { + _internal_mutable_show_allow_permission_auto_access()->::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess::MergeFrom(from._internal_show_allow_permission_auto_access()); + } + if (cached_has_bits & 0x00000080u) { + event_type_ = from.event_type_; + } + _has_bits_[2] |= cached_has_bits; + } + if (cached_has_bits & 0x00000300u) { + if (cached_has_bits & 0x00000100u) { + log_source_ = from.log_source_; + } + if (cached_has_bits & 0x00000200u) { + event_category_ = from.event_category_; + } + _has_bits_[2] |= cached_has_bits; + } + _internal_metadata_.MergeFrom(from._internal_metadata_); +} + +void SharingLog::CopyFrom(const SharingLog& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:nearby.sharing.analytics.proto.SharingLog) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool SharingLog::IsInitialized() const { + return true; +} + +void SharingLog::InternalSwap(SharingLog* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_has_bits_[0], other->_has_bits_[0]); + swap(_has_bits_[1], other->_has_bits_[1]); + swap(_has_bits_[2], other->_has_bits_[2]); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &version_, lhs_arena, + &other->version_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &files_migration_phase_, lhs_arena, + &other->files_migration_phase_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), + &app_version_, lhs_arena, + &other->app_version_, rhs_arena + ); + ::PROTOBUF_NAMESPACE_ID::internal::memswap< + PROTOBUF_FIELD_OFFSET(SharingLog, event_category_) + + sizeof(SharingLog::event_category_) + - PROTOBUF_FIELD_OFFSET(SharingLog, unknown_event_)>( + reinterpret_cast(&unknown_event_), + reinterpret_cast(&other->unknown_event_)); +} + +std::string SharingLog::GetTypeName() const { + return "nearby.sharing.analytics.proto.SharingLog"; +} + + +// @@protoc_insertion_point(namespace_scope) +} // namespace proto +} // namespace analytics +} // namespace sharing +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AppInfo* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AppInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AppInfo >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SetAccount* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SetAccount >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SetAccount >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SetVisibility >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SetVisibility >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_EventMetadata >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_EventMetadata >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_CancelConnection >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_CancelConnection >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_LaunchSetupActivity* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_LaunchSetupActivity >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_LaunchSetupActivity >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AddContact* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AddContact >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AddContact >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_RemoveContact >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_RemoveContact >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendStart* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendStart >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendStart >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TapHelp* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TapHelp >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TapHelp >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TapFeedback >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TapFeedback >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TapQrCode >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TapQrCode >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_AppCrash* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_AppCrash >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_AppCrash >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SetupWizard >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SetupWizard >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent >(arena); +} +template<> PROTOBUF_NOINLINE ::nearby::sharing::analytics::proto::SharingLog* Arena::CreateMaybeMessage< ::nearby::sharing::analytics::proto::SharingLog >(Arena* arena) { + return Arena::CreateMessageInternal< ::nearby::sharing::analytics::proto::SharingLog >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/compiled_proto/sharing/proto/analytics/nearby_sharing_log.pb.h b/compiled_proto/sharing/proto/analytics/nearby_sharing_log.pb.h new file mode 100644 index 00000000..4c6a3d6a --- /dev/null +++ b/compiled_proto/sharing/proto/analytics/nearby_sharing_log.pb.h @@ -0,0 +1,28670 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: sharing/proto/analytics/nearby_sharing_log.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3019000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +#include "proto/sharing_enums.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto { + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[77] + PROTOBUF_SECTION_VARIABLE(protodesc_cold); + static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[]; + static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[]; + static const uint32_t offsets[]; +}; +namespace nearby { +namespace sharing { +namespace analytics { +namespace proto { +class SharingLog; +struct SharingLogDefaultTypeInternal; +extern SharingLogDefaultTypeInternal _SharingLog_default_instance_; +class SharingLog_AcceptAgreements; +struct SharingLog_AcceptAgreementsDefaultTypeInternal; +extern SharingLog_AcceptAgreementsDefaultTypeInternal _SharingLog_AcceptAgreements_default_instance_; +class SharingLog_AcceptFastInitialization; +struct SharingLog_AcceptFastInitializationDefaultTypeInternal; +extern SharingLog_AcceptFastInitializationDefaultTypeInternal _SharingLog_AcceptFastInitialization_default_instance_; +class SharingLog_AddContact; +struct SharingLog_AddContactDefaultTypeInternal; +extern SharingLog_AddContactDefaultTypeInternal _SharingLog_AddContact_default_instance_; +class SharingLog_AddQuickSettingsTile; +struct SharingLog_AddQuickSettingsTileDefaultTypeInternal; +extern SharingLog_AddQuickSettingsTileDefaultTypeInternal _SharingLog_AddQuickSettingsTile_default_instance_; +class SharingLog_AdvertiseDevicePresenceEnd; +struct SharingLog_AdvertiseDevicePresenceEndDefaultTypeInternal; +extern SharingLog_AdvertiseDevicePresenceEndDefaultTypeInternal _SharingLog_AdvertiseDevicePresenceEnd_default_instance_; +class SharingLog_AdvertiseDevicePresenceStart; +struct SharingLog_AdvertiseDevicePresenceStartDefaultTypeInternal; +extern SharingLog_AdvertiseDevicePresenceStartDefaultTypeInternal _SharingLog_AdvertiseDevicePresenceStart_default_instance_; +class SharingLog_AppAttachment; +struct SharingLog_AppAttachmentDefaultTypeInternal; +extern SharingLog_AppAttachmentDefaultTypeInternal _SharingLog_AppAttachment_default_instance_; +class SharingLog_AppCrash; +struct SharingLog_AppCrashDefaultTypeInternal; +extern SharingLog_AppCrashDefaultTypeInternal _SharingLog_AppCrash_default_instance_; +class SharingLog_AppInfo; +struct SharingLog_AppInfoDefaultTypeInternal; +extern SharingLog_AppInfoDefaultTypeInternal _SharingLog_AppInfo_default_instance_; +class SharingLog_AttachmentsInfo; +struct SharingLog_AttachmentsInfoDefaultTypeInternal; +extern SharingLog_AttachmentsInfoDefaultTypeInternal _SharingLog_AttachmentsInfo_default_instance_; +class SharingLog_AutoDismissFastInitialization; +struct SharingLog_AutoDismissFastInitializationDefaultTypeInternal; +extern SharingLog_AutoDismissFastInitializationDefaultTypeInternal _SharingLog_AutoDismissFastInitialization_default_instance_; +class SharingLog_CancelConnection; +struct SharingLog_CancelConnectionDefaultTypeInternal; +extern SharingLog_CancelConnectionDefaultTypeInternal _SharingLog_CancelConnection_default_instance_; +class SharingLog_CancelReceivingAttachments; +struct SharingLog_CancelReceivingAttachmentsDefaultTypeInternal; +extern SharingLog_CancelReceivingAttachmentsDefaultTypeInternal _SharingLog_CancelReceivingAttachments_default_instance_; +class SharingLog_CancelSendingAttachments; +struct SharingLog_CancelSendingAttachmentsDefaultTypeInternal; +extern SharingLog_CancelSendingAttachmentsDefaultTypeInternal _SharingLog_CancelSendingAttachments_default_instance_; +class SharingLog_DeclineAgreements; +struct SharingLog_DeclineAgreementsDefaultTypeInternal; +extern SharingLog_DeclineAgreementsDefaultTypeInternal _SharingLog_DeclineAgreements_default_instance_; +class SharingLog_DecryptCertificateFailure; +struct SharingLog_DecryptCertificateFailureDefaultTypeInternal; +extern SharingLog_DecryptCertificateFailureDefaultTypeInternal _SharingLog_DecryptCertificateFailure_default_instance_; +class SharingLog_DefaultOptIn; +struct SharingLog_DefaultOptInDefaultTypeInternal; +extern SharingLog_DefaultOptInDefaultTypeInternal _SharingLog_DefaultOptIn_default_instance_; +class SharingLog_DescribeAttachments; +struct SharingLog_DescribeAttachmentsDefaultTypeInternal; +extern SharingLog_DescribeAttachmentsDefaultTypeInternal _SharingLog_DescribeAttachments_default_instance_; +class SharingLog_DeviceSettings; +struct SharingLog_DeviceSettingsDefaultTypeInternal; +extern SharingLog_DeviceSettingsDefaultTypeInternal _SharingLog_DeviceSettings_default_instance_; +class SharingLog_DiscoverShareTarget; +struct SharingLog_DiscoverShareTargetDefaultTypeInternal; +extern SharingLog_DiscoverShareTargetDefaultTypeInternal _SharingLog_DiscoverShareTarget_default_instance_; +class SharingLog_DismissFastInitialization; +struct SharingLog_DismissFastInitializationDefaultTypeInternal; +extern SharingLog_DismissFastInitializationDefaultTypeInternal _SharingLog_DismissFastInitialization_default_instance_; +class SharingLog_DismissPrivacyNotification; +struct SharingLog_DismissPrivacyNotificationDefaultTypeInternal; +extern SharingLog_DismissPrivacyNotificationDefaultTypeInternal _SharingLog_DismissPrivacyNotification_default_instance_; +class SharingLog_DisplayPhoneConsent; +struct SharingLog_DisplayPhoneConsentDefaultTypeInternal; +extern SharingLog_DisplayPhoneConsentDefaultTypeInternal _SharingLog_DisplayPhoneConsent_default_instance_; +class SharingLog_DisplayPrivacyNotification; +struct SharingLog_DisplayPrivacyNotificationDefaultTypeInternal; +extern SharingLog_DisplayPrivacyNotificationDefaultTypeInternal _SharingLog_DisplayPrivacyNotification_default_instance_; +class SharingLog_EnableNearbySharing; +struct SharingLog_EnableNearbySharingDefaultTypeInternal; +extern SharingLog_EnableNearbySharingDefaultTypeInternal _SharingLog_EnableNearbySharing_default_instance_; +class SharingLog_EstablishConnection; +struct SharingLog_EstablishConnectionDefaultTypeInternal; +extern SharingLog_EstablishConnectionDefaultTypeInternal _SharingLog_EstablishConnection_default_instance_; +class SharingLog_EventMetadata; +struct SharingLog_EventMetadataDefaultTypeInternal; +extern SharingLog_EventMetadataDefaultTypeInternal _SharingLog_EventMetadata_default_instance_; +class SharingLog_FastInitDiscoverDevice; +struct SharingLog_FastInitDiscoverDeviceDefaultTypeInternal; +extern SharingLog_FastInitDiscoverDeviceDefaultTypeInternal _SharingLog_FastInitDiscoverDevice_default_instance_; +class SharingLog_FastShareServerResponse; +struct SharingLog_FastShareServerResponseDefaultTypeInternal; +extern SharingLog_FastShareServerResponseDefaultTypeInternal _SharingLog_FastShareServerResponse_default_instance_; +class SharingLog_FileAttachment; +struct SharingLog_FileAttachmentDefaultTypeInternal; +extern SharingLog_FileAttachmentDefaultTypeInternal _SharingLog_FileAttachment_default_instance_; +class SharingLog_InstallAPKStatus; +struct SharingLog_InstallAPKStatusDefaultTypeInternal; +extern SharingLog_InstallAPKStatusDefaultTypeInternal _SharingLog_InstallAPKStatus_default_instance_; +class SharingLog_LaunchActivity; +struct SharingLog_LaunchActivityDefaultTypeInternal; +extern SharingLog_LaunchActivityDefaultTypeInternal _SharingLog_LaunchActivity_default_instance_; +class SharingLog_LaunchConsent; +struct SharingLog_LaunchConsentDefaultTypeInternal; +extern SharingLog_LaunchConsentDefaultTypeInternal _SharingLog_LaunchConsent_default_instance_; +class SharingLog_LaunchPhoneConsent; +struct SharingLog_LaunchPhoneConsentDefaultTypeInternal; +extern SharingLog_LaunchPhoneConsentDefaultTypeInternal _SharingLog_LaunchPhoneConsent_default_instance_; +class SharingLog_LaunchSetupActivity; +struct SharingLog_LaunchSetupActivityDefaultTypeInternal; +extern SharingLog_LaunchSetupActivityDefaultTypeInternal _SharingLog_LaunchSetupActivity_default_instance_; +class SharingLog_OpenReceivedAttachments; +struct SharingLog_OpenReceivedAttachmentsDefaultTypeInternal; +extern SharingLog_OpenReceivedAttachmentsDefaultTypeInternal _SharingLog_OpenReceivedAttachments_default_instance_; +class SharingLog_ParsingFailedEndpointId; +struct SharingLog_ParsingFailedEndpointIdDefaultTypeInternal; +extern SharingLog_ParsingFailedEndpointIdDefaultTypeInternal _SharingLog_ParsingFailedEndpointId_default_instance_; +class SharingLog_PreferencesUsage; +struct SharingLog_PreferencesUsageDefaultTypeInternal; +extern SharingLog_PreferencesUsageDefaultTypeInternal _SharingLog_PreferencesUsage_default_instance_; +class SharingLog_ProcessReceivedAttachmentsEnd; +struct SharingLog_ProcessReceivedAttachmentsEndDefaultTypeInternal; +extern SharingLog_ProcessReceivedAttachmentsEndDefaultTypeInternal _SharingLog_ProcessReceivedAttachmentsEnd_default_instance_; +class SharingLog_QrCodeLinkShown; +struct SharingLog_QrCodeLinkShownDefaultTypeInternal; +extern SharingLog_QrCodeLinkShownDefaultTypeInternal _SharingLog_QrCodeLinkShown_default_instance_; +class SharingLog_ReceiveAttachmentsEnd; +struct SharingLog_ReceiveAttachmentsEndDefaultTypeInternal; +extern SharingLog_ReceiveAttachmentsEndDefaultTypeInternal _SharingLog_ReceiveAttachmentsEnd_default_instance_; +class SharingLog_ReceiveAttachmentsStart; +struct SharingLog_ReceiveAttachmentsStartDefaultTypeInternal; +extern SharingLog_ReceiveAttachmentsStartDefaultTypeInternal _SharingLog_ReceiveAttachmentsStart_default_instance_; +class SharingLog_ReceiveFastInitialization; +struct SharingLog_ReceiveFastInitializationDefaultTypeInternal; +extern SharingLog_ReceiveFastInitializationDefaultTypeInternal _SharingLog_ReceiveFastInitialization_default_instance_; +class SharingLog_ReceiveIntroduction; +struct SharingLog_ReceiveIntroductionDefaultTypeInternal; +extern SharingLog_ReceiveIntroductionDefaultTypeInternal _SharingLog_ReceiveIntroduction_default_instance_; +class SharingLog_RemoveContact; +struct SharingLog_RemoveContactDefaultTypeInternal; +extern SharingLog_RemoveContactDefaultTypeInternal _SharingLog_RemoveContact_default_instance_; +class SharingLog_RemoveQuickSettingsTile; +struct SharingLog_RemoveQuickSettingsTileDefaultTypeInternal; +extern SharingLog_RemoveQuickSettingsTileDefaultTypeInternal _SharingLog_RemoveQuickSettingsTile_default_instance_; +class SharingLog_RequestSettingPermissions; +struct SharingLog_RequestSettingPermissionsDefaultTypeInternal; +extern SharingLog_RequestSettingPermissionsDefaultTypeInternal _SharingLog_RequestSettingPermissions_default_instance_; +class SharingLog_RespondToIntroduction; +struct SharingLog_RespondToIntroductionDefaultTypeInternal; +extern SharingLog_RespondToIntroductionDefaultTypeInternal _SharingLog_RespondToIntroduction_default_instance_; +class SharingLog_ScanForShareTargetsEnd; +struct SharingLog_ScanForShareTargetsEndDefaultTypeInternal; +extern SharingLog_ScanForShareTargetsEndDefaultTypeInternal _SharingLog_ScanForShareTargetsEnd_default_instance_; +class SharingLog_ScanForShareTargetsStart; +struct SharingLog_ScanForShareTargetsStartDefaultTypeInternal; +extern SharingLog_ScanForShareTargetsStartDefaultTypeInternal _SharingLog_ScanForShareTargetsStart_default_instance_; +class SharingLog_SendAttachmentsEnd; +struct SharingLog_SendAttachmentsEndDefaultTypeInternal; +extern SharingLog_SendAttachmentsEndDefaultTypeInternal _SharingLog_SendAttachmentsEnd_default_instance_; +class SharingLog_SendAttachmentsStart; +struct SharingLog_SendAttachmentsStartDefaultTypeInternal; +extern SharingLog_SendAttachmentsStartDefaultTypeInternal _SharingLog_SendAttachmentsStart_default_instance_; +class SharingLog_SendDesktopNotification; +struct SharingLog_SendDesktopNotificationDefaultTypeInternal; +extern SharingLog_SendDesktopNotificationDefaultTypeInternal _SharingLog_SendDesktopNotification_default_instance_; +class SharingLog_SendDesktopTransferEvent; +struct SharingLog_SendDesktopTransferEventDefaultTypeInternal; +extern SharingLog_SendDesktopTransferEventDefaultTypeInternal _SharingLog_SendDesktopTransferEvent_default_instance_; +class SharingLog_SendFastInitialization; +struct SharingLog_SendFastInitializationDefaultTypeInternal; +extern SharingLog_SendFastInitializationDefaultTypeInternal _SharingLog_SendFastInitialization_default_instance_; +class SharingLog_SendIntroduction; +struct SharingLog_SendIntroductionDefaultTypeInternal; +extern SharingLog_SendIntroductionDefaultTypeInternal _SharingLog_SendIntroduction_default_instance_; +class SharingLog_SendStart; +struct SharingLog_SendStartDefaultTypeInternal; +extern SharingLog_SendStartDefaultTypeInternal _SharingLog_SendStart_default_instance_; +class SharingLog_SetAccount; +struct SharingLog_SetAccountDefaultTypeInternal; +extern SharingLog_SetAccountDefaultTypeInternal _SharingLog_SetAccount_default_instance_; +class SharingLog_SetDataUsage; +struct SharingLog_SetDataUsageDefaultTypeInternal; +extern SharingLog_SetDataUsageDefaultTypeInternal _SharingLog_SetDataUsage_default_instance_; +class SharingLog_SetDeviceName; +struct SharingLog_SetDeviceNameDefaultTypeInternal; +extern SharingLog_SetDeviceNameDefaultTypeInternal _SharingLog_SetDeviceName_default_instance_; +class SharingLog_SetVisibility; +struct SharingLog_SetVisibilityDefaultTypeInternal; +extern SharingLog_SetVisibilityDefaultTypeInternal _SharingLog_SetVisibility_default_instance_; +class SharingLog_SetupWizard; +struct SharingLog_SetupWizardDefaultTypeInternal; +extern SharingLog_SetupWizardDefaultTypeInternal _SharingLog_SetupWizard_default_instance_; +class SharingLog_ShareTargetInfo; +struct SharingLog_ShareTargetInfoDefaultTypeInternal; +extern SharingLog_ShareTargetInfoDefaultTypeInternal _SharingLog_ShareTargetInfo_default_instance_; +class SharingLog_ShowAllowPermissionAutoAccess; +struct SharingLog_ShowAllowPermissionAutoAccessDefaultTypeInternal; +extern SharingLog_ShowAllowPermissionAutoAccessDefaultTypeInternal _SharingLog_ShowAllowPermissionAutoAccess_default_instance_; +class SharingLog_StreamAttachment; +struct SharingLog_StreamAttachmentDefaultTypeInternal; +extern SharingLog_StreamAttachmentDefaultTypeInternal _SharingLog_StreamAttachment_default_instance_; +class SharingLog_TapFeedback; +struct SharingLog_TapFeedbackDefaultTypeInternal; +extern SharingLog_TapFeedbackDefaultTypeInternal _SharingLog_TapFeedback_default_instance_; +class SharingLog_TapHelp; +struct SharingLog_TapHelpDefaultTypeInternal; +extern SharingLog_TapHelpDefaultTypeInternal _SharingLog_TapHelp_default_instance_; +class SharingLog_TapPrivacyNotification; +struct SharingLog_TapPrivacyNotificationDefaultTypeInternal; +extern SharingLog_TapPrivacyNotificationDefaultTypeInternal _SharingLog_TapPrivacyNotification_default_instance_; +class SharingLog_TapQrCode; +struct SharingLog_TapQrCodeDefaultTypeInternal; +extern SharingLog_TapQrCodeDefaultTypeInternal _SharingLog_TapQrCode_default_instance_; +class SharingLog_TapQuickSettingsFileShare; +struct SharingLog_TapQuickSettingsFileShareDefaultTypeInternal; +extern SharingLog_TapQuickSettingsFileShareDefaultTypeInternal _SharingLog_TapQuickSettingsFileShare_default_instance_; +class SharingLog_TapQuickSettingsTile; +struct SharingLog_TapQuickSettingsTileDefaultTypeInternal; +extern SharingLog_TapQuickSettingsTileDefaultTypeInternal _SharingLog_TapQuickSettingsTile_default_instance_; +class SharingLog_TextAttachment; +struct SharingLog_TextAttachmentDefaultTypeInternal; +extern SharingLog_TextAttachmentDefaultTypeInternal _SharingLog_TextAttachment_default_instance_; +class SharingLog_ToggleShowNotification; +struct SharingLog_ToggleShowNotificationDefaultTypeInternal; +extern SharingLog_ToggleShowNotificationDefaultTypeInternal _SharingLog_ToggleShowNotification_default_instance_; +class SharingLog_UnknownEvent; +struct SharingLog_UnknownEventDefaultTypeInternal; +extern SharingLog_UnknownEventDefaultTypeInternal _SharingLog_UnknownEvent_default_instance_; +class SharingLog_VerifyAPKStatus; +struct SharingLog_VerifyAPKStatusDefaultTypeInternal; +extern SharingLog_VerifyAPKStatusDefaultTypeInternal _SharingLog_VerifyAPKStatus_default_instance_; +class SharingLog_WifiCredentialsAttachment; +struct SharingLog_WifiCredentialsAttachmentDefaultTypeInternal; +extern SharingLog_WifiCredentialsAttachmentDefaultTypeInternal _SharingLog_WifiCredentialsAttachment_default_instance_; +} // namespace proto +} // namespace analytics +} // namespace sharing +} // namespace nearby +PROTOBUF_NAMESPACE_OPEN +template<> ::nearby::sharing::analytics::proto::SharingLog* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AddContact* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AddContact>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AppAttachment>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AppCrash* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AppCrash>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AppInfo* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AppInfo>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_CancelConnection>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DeviceSettings>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_EstablishConnection>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_EventMetadata>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_FileAttachment>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchActivity>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchConsent>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_LaunchSetupActivity* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchSetupActivity>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RemoveContact>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendIntroduction>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SendStart* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendStart>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SetAccount* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetAccount>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetDataUsage>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetDeviceName>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetVisibility>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetupWizard>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_StreamAttachment>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapFeedback>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TapHelp* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapHelp>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapQrCode>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TextAttachment>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_UnknownEvent>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus>(Arena*); +template<> ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* Arena::CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace nearby { +namespace sharing { +namespace analytics { +namespace proto { + +enum SharingLog_TextAttachment_Type : int { + SharingLog_TextAttachment_Type_UNKNOWN_TEXT_TYPE = 0, + SharingLog_TextAttachment_Type_URL = 1, + SharingLog_TextAttachment_Type_ADDRESS = 2, + SharingLog_TextAttachment_Type_PHONE_NUMBER = 3 +}; +bool SharingLog_TextAttachment_Type_IsValid(int value); +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment_Type_Type_MIN = SharingLog_TextAttachment_Type_UNKNOWN_TEXT_TYPE; +constexpr SharingLog_TextAttachment_Type SharingLog_TextAttachment_Type_Type_MAX = SharingLog_TextAttachment_Type_PHONE_NUMBER; +constexpr int SharingLog_TextAttachment_Type_Type_ARRAYSIZE = SharingLog_TextAttachment_Type_Type_MAX + 1; + +const std::string& SharingLog_TextAttachment_Type_Name(SharingLog_TextAttachment_Type value); +template +inline const std::string& SharingLog_TextAttachment_Type_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SharingLog_TextAttachment_Type_Name."); + return SharingLog_TextAttachment_Type_Name(static_cast(enum_t_value)); +} +bool SharingLog_TextAttachment_Type_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SharingLog_TextAttachment_Type* value); +enum SharingLog_FileAttachment_Type : int { + SharingLog_FileAttachment_Type_UNKNOWN_FILE_TYPE = 0, + SharingLog_FileAttachment_Type_IMAGE = 1, + SharingLog_FileAttachment_Type_VIDEO = 2, + SharingLog_FileAttachment_Type_ANDROID_APP = 3, + SharingLog_FileAttachment_Type_AUDIO = 4, + SharingLog_FileAttachment_Type_DOCUMENT = 5 +}; +bool SharingLog_FileAttachment_Type_IsValid(int value); +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment_Type_Type_MIN = SharingLog_FileAttachment_Type_UNKNOWN_FILE_TYPE; +constexpr SharingLog_FileAttachment_Type SharingLog_FileAttachment_Type_Type_MAX = SharingLog_FileAttachment_Type_DOCUMENT; +constexpr int SharingLog_FileAttachment_Type_Type_ARRAYSIZE = SharingLog_FileAttachment_Type_Type_MAX + 1; + +const std::string& SharingLog_FileAttachment_Type_Name(SharingLog_FileAttachment_Type value); +template +inline const std::string& SharingLog_FileAttachment_Type_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function SharingLog_FileAttachment_Type_Name."); + return SharingLog_FileAttachment_Type_Name(static_cast(enum_t_value)); +} +bool SharingLog_FileAttachment_Type_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, SharingLog_FileAttachment_Type* value); +// =================================================================== + +class SharingLog_AppInfo final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AppInfo) */ { + public: + inline SharingLog_AppInfo() : SharingLog_AppInfo(nullptr) {} + ~SharingLog_AppInfo() override; + explicit constexpr SharingLog_AppInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AppInfo(const SharingLog_AppInfo& from); + SharingLog_AppInfo(SharingLog_AppInfo&& from) noexcept + : SharingLog_AppInfo() { + *this = ::std::move(from); + } + + inline SharingLog_AppInfo& operator=(const SharingLog_AppInfo& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AppInfo& operator=(SharingLog_AppInfo&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AppInfo& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AppInfo* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AppInfo_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(SharingLog_AppInfo& a, SharingLog_AppInfo& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AppInfo* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AppInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AppInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AppInfo& from); + void MergeFrom(const SharingLog_AppInfo& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AppInfo* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AppInfo"; + } + protected: + explicit SharingLog_AppInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAppVersionFieldNumber = 1, + kAppLanguageFieldNumber = 2, + kUpdateTrackFieldNumber = 3, + }; + // optional string app_version = 1; + bool has_app_version() const; + private: + bool _internal_has_app_version() const; + public: + void clear_app_version(); + const std::string& app_version() const; + template + void set_app_version(ArgT0&& arg0, ArgT... args); + std::string* mutable_app_version(); + PROTOBUF_NODISCARD std::string* release_app_version(); + void set_allocated_app_version(std::string* app_version); + private: + const std::string& _internal_app_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_app_version(const std::string& value); + std::string* _internal_mutable_app_version(); + public: + + // optional string app_language = 2; + bool has_app_language() const; + private: + bool _internal_has_app_language() const; + public: + void clear_app_language(); + const std::string& app_language() const; + template + void set_app_language(ArgT0&& arg0, ArgT... args); + std::string* mutable_app_language(); + PROTOBUF_NODISCARD std::string* release_app_language(); + void set_allocated_app_language(std::string* app_language); + private: + const std::string& _internal_app_language() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_app_language(const std::string& value); + std::string* _internal_mutable_app_language(); + public: + + // optional string update_track = 3; + bool has_update_track() const; + private: + bool _internal_has_update_track() const; + public: + void clear_update_track(); + const std::string& update_track() const; + template + void set_update_track(ArgT0&& arg0, ArgT... args); + std::string* mutable_update_track(); + PROTOBUF_NODISCARD std::string* release_update_track(); + void set_allocated_update_track(std::string* update_track); + private: + const std::string& _internal_update_track() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_update_track(const std::string& value); + std::string* _internal_mutable_update_track(); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AppInfo) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr app_version_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr app_language_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr update_track_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DeviceSettings final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) */ { + public: + inline SharingLog_DeviceSettings() : SharingLog_DeviceSettings(nullptr) {} + ~SharingLog_DeviceSettings() override; + explicit constexpr SharingLog_DeviceSettings(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DeviceSettings(const SharingLog_DeviceSettings& from); + SharingLog_DeviceSettings(SharingLog_DeviceSettings&& from) noexcept + : SharingLog_DeviceSettings() { + *this = ::std::move(from); + } + + inline SharingLog_DeviceSettings& operator=(const SharingLog_DeviceSettings& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DeviceSettings& operator=(SharingLog_DeviceSettings&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DeviceSettings& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DeviceSettings* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DeviceSettings_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(SharingLog_DeviceSettings& a, SharingLog_DeviceSettings& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DeviceSettings* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DeviceSettings* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DeviceSettings* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DeviceSettings& from); + void MergeFrom(const SharingLog_DeviceSettings& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DeviceSettings* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DeviceSettings"; + } + protected: + explicit SharingLog_DeviceSettings(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kVisibilityFieldNumber = 1, + kDataUsageFieldNumber = 2, + kDeviceNameSizeFieldNumber = 3, + kIsShowNotificationEnabledFieldNumber = 4, + kIsBtEnabledFieldNumber = 5, + kIsLocationEnabledFieldNumber = 6, + kIsWifiEnabledFieldNumber = 7, + }; + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + bool has_visibility() const; + private: + bool _internal_has_visibility() const; + public: + void clear_visibility(); + ::location::nearby::proto::sharing::Visibility visibility() const; + void set_visibility(::location::nearby::proto::sharing::Visibility value); + private: + ::location::nearby::proto::sharing::Visibility _internal_visibility() const; + void _internal_set_visibility(::location::nearby::proto::sharing::Visibility value); + public: + + // optional .location.nearby.proto.sharing.DataUsage data_usage = 2; + bool has_data_usage() const; + private: + bool _internal_has_data_usage() const; + public: + void clear_data_usage(); + ::location::nearby::proto::sharing::DataUsage data_usage() const; + void set_data_usage(::location::nearby::proto::sharing::DataUsage value); + private: + ::location::nearby::proto::sharing::DataUsage _internal_data_usage() const; + void _internal_set_data_usage(::location::nearby::proto::sharing::DataUsage value); + public: + + // optional int32 device_name_size = 3; + bool has_device_name_size() const; + private: + bool _internal_has_device_name_size() const; + public: + void clear_device_name_size(); + int32_t device_name_size() const; + void set_device_name_size(int32_t value); + private: + int32_t _internal_device_name_size() const; + void _internal_set_device_name_size(int32_t value); + public: + + // optional bool is_show_notification_enabled = 4; + bool has_is_show_notification_enabled() const; + private: + bool _internal_has_is_show_notification_enabled() const; + public: + void clear_is_show_notification_enabled(); + bool is_show_notification_enabled() const; + void set_is_show_notification_enabled(bool value); + private: + bool _internal_is_show_notification_enabled() const; + void _internal_set_is_show_notification_enabled(bool value); + public: + + // optional bool is_bt_enabled = 5; + bool has_is_bt_enabled() const; + private: + bool _internal_has_is_bt_enabled() const; + public: + void clear_is_bt_enabled(); + bool is_bt_enabled() const; + void set_is_bt_enabled(bool value); + private: + bool _internal_is_bt_enabled() const; + void _internal_set_is_bt_enabled(bool value); + public: + + // optional bool is_location_enabled = 6; + bool has_is_location_enabled() const; + private: + bool _internal_has_is_location_enabled() const; + public: + void clear_is_location_enabled(); + bool is_location_enabled() const; + void set_is_location_enabled(bool value); + private: + bool _internal_is_location_enabled() const; + void _internal_set_is_location_enabled(bool value); + public: + + // optional bool is_wifi_enabled = 7; + bool has_is_wifi_enabled() const; + private: + bool _internal_has_is_wifi_enabled() const; + public: + void clear_is_wifi_enabled(); + bool is_wifi_enabled() const; + void set_is_wifi_enabled(bool value); + private: + bool _internal_is_wifi_enabled() const; + void _internal_set_is_wifi_enabled(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DeviceSettings) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int visibility_; + int data_usage_; + int32_t device_name_size_; + bool is_show_notification_enabled_; + bool is_bt_enabled_; + bool is_location_enabled_; + bool is_wifi_enabled_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_PreferencesUsage final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) */ { + public: + inline SharingLog_PreferencesUsage() : SharingLog_PreferencesUsage(nullptr) {} + ~SharingLog_PreferencesUsage() override; + explicit constexpr SharingLog_PreferencesUsage(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_PreferencesUsage(const SharingLog_PreferencesUsage& from); + SharingLog_PreferencesUsage(SharingLog_PreferencesUsage&& from) noexcept + : SharingLog_PreferencesUsage() { + *this = ::std::move(from); + } + + inline SharingLog_PreferencesUsage& operator=(const SharingLog_PreferencesUsage& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_PreferencesUsage& operator=(SharingLog_PreferencesUsage&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_PreferencesUsage& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_PreferencesUsage* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_PreferencesUsage_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(SharingLog_PreferencesUsage& a, SharingLog_PreferencesUsage& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_PreferencesUsage* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_PreferencesUsage* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_PreferencesUsage* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_PreferencesUsage& from); + void MergeFrom(const SharingLog_PreferencesUsage& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_PreferencesUsage* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.PreferencesUsage"; + } + protected: + explicit SharingLog_PreferencesUsage(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kActionFieldNumber = 1, + kActionStatusFieldNumber = 2, + kPrevSubActionFieldNumber = 3, + kNextSubActionFieldNumber = 4, + }; + // optional .location.nearby.proto.sharing.PreferencesAction action = 1; + bool has_action() const; + private: + bool _internal_has_action() const; + public: + void clear_action(); + ::location::nearby::proto::sharing::PreferencesAction action() const; + void set_action(::location::nearby::proto::sharing::PreferencesAction value); + private: + ::location::nearby::proto::sharing::PreferencesAction _internal_action() const; + void _internal_set_action(::location::nearby::proto::sharing::PreferencesAction value); + public: + + // optional .location.nearby.proto.sharing.PreferencesActionStatus action_status = 2; + bool has_action_status() const; + private: + bool _internal_has_action_status() const; + public: + void clear_action_status(); + ::location::nearby::proto::sharing::PreferencesActionStatus action_status() const; + void set_action_status(::location::nearby::proto::sharing::PreferencesActionStatus value); + private: + ::location::nearby::proto::sharing::PreferencesActionStatus _internal_action_status() const; + void _internal_set_action_status(::location::nearby::proto::sharing::PreferencesActionStatus value); + public: + + // optional .location.nearby.proto.sharing.PreferencesAction prev_sub_action = 3; + bool has_prev_sub_action() const; + private: + bool _internal_has_prev_sub_action() const; + public: + void clear_prev_sub_action(); + ::location::nearby::proto::sharing::PreferencesAction prev_sub_action() const; + void set_prev_sub_action(::location::nearby::proto::sharing::PreferencesAction value); + private: + ::location::nearby::proto::sharing::PreferencesAction _internal_prev_sub_action() const; + void _internal_set_prev_sub_action(::location::nearby::proto::sharing::PreferencesAction value); + public: + + // optional .location.nearby.proto.sharing.PreferencesAction next_sub_action = 4; + bool has_next_sub_action() const; + private: + bool _internal_has_next_sub_action() const; + public: + void clear_next_sub_action(); + ::location::nearby::proto::sharing::PreferencesAction next_sub_action() const; + void set_next_sub_action(::location::nearby::proto::sharing::PreferencesAction value); + private: + ::location::nearby::proto::sharing::PreferencesAction _internal_next_sub_action() const; + void _internal_set_next_sub_action(::location::nearby::proto::sharing::PreferencesAction value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int action_; + int action_status_; + int prev_sub_action_; + int next_sub_action_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_UnknownEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) */ { + public: + inline SharingLog_UnknownEvent() : SharingLog_UnknownEvent(nullptr) {} + ~SharingLog_UnknownEvent() override; + explicit constexpr SharingLog_UnknownEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_UnknownEvent(const SharingLog_UnknownEvent& from); + SharingLog_UnknownEvent(SharingLog_UnknownEvent&& from) noexcept + : SharingLog_UnknownEvent() { + *this = ::std::move(from); + } + + inline SharingLog_UnknownEvent& operator=(const SharingLog_UnknownEvent& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_UnknownEvent& operator=(SharingLog_UnknownEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_UnknownEvent& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_UnknownEvent* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_UnknownEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(SharingLog_UnknownEvent& a, SharingLog_UnknownEvent& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_UnknownEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_UnknownEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_UnknownEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_UnknownEvent& from); + void MergeFrom(const SharingLog_UnknownEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_UnknownEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.UnknownEvent"; + } + protected: + explicit SharingLog_UnknownEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.UnknownEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_EstablishConnection final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) */ { + public: + inline SharingLog_EstablishConnection() : SharingLog_EstablishConnection(nullptr) {} + ~SharingLog_EstablishConnection() override; + explicit constexpr SharingLog_EstablishConnection(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_EstablishConnection(const SharingLog_EstablishConnection& from); + SharingLog_EstablishConnection(SharingLog_EstablishConnection&& from) noexcept + : SharingLog_EstablishConnection() { + *this = ::std::move(from); + } + + inline SharingLog_EstablishConnection& operator=(const SharingLog_EstablishConnection& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_EstablishConnection& operator=(SharingLog_EstablishConnection&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_EstablishConnection& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_EstablishConnection* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_EstablishConnection_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(SharingLog_EstablishConnection& a, SharingLog_EstablishConnection& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_EstablishConnection* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_EstablishConnection* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_EstablishConnection* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_EstablishConnection& from); + void MergeFrom(const SharingLog_EstablishConnection& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_EstablishConnection* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.EstablishConnection"; + } + protected: + explicit SharingLog_EstablishConnection(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 7, + kShareTargetInfoFieldNumber = 6, + kSessionIdFieldNumber = 2, + kStatusFieldNumber = 1, + kTransferPositionFieldNumber = 3, + kDurationMillisFieldNumber = 5, + kConcurrentConnectionsFieldNumber = 4, + kQrCodeFlowFieldNumber = 8, + kIsIncomingConnectionFieldNumber = 9, + }; + // optional string referrer_name = 7; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 6; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 2; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.EstablishConnectionStatus status = 1; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::EstablishConnectionStatus status() const; + void set_status(::location::nearby::proto::sharing::EstablishConnectionStatus value); + private: + ::location::nearby::proto::sharing::EstablishConnectionStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::EstablishConnectionStatus value); + public: + + // optional int32 transfer_position = 3; + bool has_transfer_position() const; + private: + bool _internal_has_transfer_position() const; + public: + void clear_transfer_position(); + int32_t transfer_position() const; + void set_transfer_position(int32_t value); + private: + int32_t _internal_transfer_position() const; + void _internal_set_transfer_position(int32_t value); + public: + + // optional int64 duration_millis = 5; + bool has_duration_millis() const; + private: + bool _internal_has_duration_millis() const; + public: + void clear_duration_millis(); + int64_t duration_millis() const; + void set_duration_millis(int64_t value); + private: + int64_t _internal_duration_millis() const; + void _internal_set_duration_millis(int64_t value); + public: + + // optional int32 concurrent_connections = 4; + bool has_concurrent_connections() const; + private: + bool _internal_has_concurrent_connections() const; + public: + void clear_concurrent_connections(); + int32_t concurrent_connections() const; + void set_concurrent_connections(int32_t value); + private: + int32_t _internal_concurrent_connections() const; + void _internal_set_concurrent_connections(int32_t value); + public: + + // optional bool qr_code_flow = 8; + bool has_qr_code_flow() const; + private: + bool _internal_has_qr_code_flow() const; + public: + void clear_qr_code_flow(); + bool qr_code_flow() const; + void set_qr_code_flow(bool value); + private: + bool _internal_qr_code_flow() const; + void _internal_set_qr_code_flow(bool value); + public: + + // optional bool is_incoming_connection = 9; + bool has_is_incoming_connection() const; + private: + bool _internal_has_is_incoming_connection() const; + public: + void clear_is_incoming_connection(); + bool is_incoming_connection() const; + void set_is_incoming_connection(bool value); + private: + bool _internal_is_incoming_connection() const; + void _internal_set_is_incoming_connection(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.EstablishConnection) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + int status_; + int32_t transfer_position_; + int64_t duration_millis_; + int32_t concurrent_connections_; + bool qr_code_flow_; + bool is_incoming_connection_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AcceptAgreements final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) */ { + public: + inline SharingLog_AcceptAgreements() : SharingLog_AcceptAgreements(nullptr) {} + ~SharingLog_AcceptAgreements() override; + explicit constexpr SharingLog_AcceptAgreements(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AcceptAgreements(const SharingLog_AcceptAgreements& from); + SharingLog_AcceptAgreements(SharingLog_AcceptAgreements&& from) noexcept + : SharingLog_AcceptAgreements() { + *this = ::std::move(from); + } + + inline SharingLog_AcceptAgreements& operator=(const SharingLog_AcceptAgreements& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AcceptAgreements& operator=(SharingLog_AcceptAgreements&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AcceptAgreements& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AcceptAgreements* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AcceptAgreements_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(SharingLog_AcceptAgreements& a, SharingLog_AcceptAgreements& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AcceptAgreements* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AcceptAgreements* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AcceptAgreements* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AcceptAgreements& from); + void MergeFrom(const SharingLog_AcceptAgreements& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AcceptAgreements* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AcceptAgreements"; + } + protected: + explicit SharingLog_AcceptAgreements(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AcceptAgreements) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DeclineAgreements final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) */ { + public: + inline SharingLog_DeclineAgreements() : SharingLog_DeclineAgreements(nullptr) {} + ~SharingLog_DeclineAgreements() override; + explicit constexpr SharingLog_DeclineAgreements(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DeclineAgreements(const SharingLog_DeclineAgreements& from); + SharingLog_DeclineAgreements(SharingLog_DeclineAgreements&& from) noexcept + : SharingLog_DeclineAgreements() { + *this = ::std::move(from); + } + + inline SharingLog_DeclineAgreements& operator=(const SharingLog_DeclineAgreements& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DeclineAgreements& operator=(SharingLog_DeclineAgreements&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DeclineAgreements& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DeclineAgreements* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DeclineAgreements_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(SharingLog_DeclineAgreements& a, SharingLog_DeclineAgreements& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DeclineAgreements* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DeclineAgreements* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DeclineAgreements* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DeclineAgreements& from); + void MergeFrom(const SharingLog_DeclineAgreements& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DeclineAgreements* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DeclineAgreements"; + } + protected: + explicit SharingLog_DeclineAgreements(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DeclineAgreements) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_EnableNearbySharing final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) */ { + public: + inline SharingLog_EnableNearbySharing() : SharingLog_EnableNearbySharing(nullptr) {} + ~SharingLog_EnableNearbySharing() override; + explicit constexpr SharingLog_EnableNearbySharing(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_EnableNearbySharing(const SharingLog_EnableNearbySharing& from); + SharingLog_EnableNearbySharing(SharingLog_EnableNearbySharing&& from) noexcept + : SharingLog_EnableNearbySharing() { + *this = ::std::move(from); + } + + inline SharingLog_EnableNearbySharing& operator=(const SharingLog_EnableNearbySharing& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_EnableNearbySharing& operator=(SharingLog_EnableNearbySharing&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_EnableNearbySharing& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_EnableNearbySharing* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_EnableNearbySharing_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(SharingLog_EnableNearbySharing& a, SharingLog_EnableNearbySharing& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_EnableNearbySharing* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_EnableNearbySharing* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_EnableNearbySharing* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_EnableNearbySharing& from); + void MergeFrom(const SharingLog_EnableNearbySharing& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_EnableNearbySharing* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing"; + } + protected: + explicit SharingLog_EnableNearbySharing(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatusFieldNumber = 1, + kHasOptedInFieldNumber = 2, + }; + // optional .location.nearby.proto.sharing.NearbySharingStatus status = 1; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::NearbySharingStatus status() const; + void set_status(::location::nearby::proto::sharing::NearbySharingStatus value); + private: + ::location::nearby::proto::sharing::NearbySharingStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::NearbySharingStatus value); + public: + + // optional bool has_opted_in = 2; + bool has_has_opted_in() const; + private: + bool _internal_has_has_opted_in() const; + public: + void clear_has_opted_in(); + bool has_opted_in() const; + void set_has_opted_in(bool value); + private: + bool _internal_has_opted_in() const; + void _internal_set_has_opted_in(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int status_; + bool has_opted_in_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SetAccount final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SetAccount) */ { + public: + inline SharingLog_SetAccount() : SharingLog_SetAccount(nullptr) {} + ~SharingLog_SetAccount() override; + explicit constexpr SharingLog_SetAccount(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SetAccount(const SharingLog_SetAccount& from); + SharingLog_SetAccount(SharingLog_SetAccount&& from) noexcept + : SharingLog_SetAccount() { + *this = ::std::move(from); + } + + inline SharingLog_SetAccount& operator=(const SharingLog_SetAccount& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SetAccount& operator=(SharingLog_SetAccount&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SetAccount& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SetAccount* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SetAccount_default_instance_); + } + static constexpr int kIndexInFileMessages = + 8; + + friend void swap(SharingLog_SetAccount& a, SharingLog_SetAccount& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SetAccount* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SetAccount* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SetAccount* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SetAccount& from); + void MergeFrom(const SharingLog_SetAccount& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SetAccount* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SetAccount"; + } + protected: + explicit SharingLog_SetAccount(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kActivityNameFieldNumber = 1, + }; + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + bool has_activity_name() const; + private: + bool _internal_has_activity_name() const; + public: + void clear_activity_name(); + ::location::nearby::proto::sharing::ActivityName activity_name() const; + void set_activity_name(::location::nearby::proto::sharing::ActivityName value); + private: + ::location::nearby::proto::sharing::ActivityName _internal_activity_name() const; + void _internal_set_activity_name(::location::nearby::proto::sharing::ActivityName value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SetAccount) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int activity_name_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SetVisibility final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SetVisibility) */ { + public: + inline SharingLog_SetVisibility() : SharingLog_SetVisibility(nullptr) {} + ~SharingLog_SetVisibility() override; + explicit constexpr SharingLog_SetVisibility(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SetVisibility(const SharingLog_SetVisibility& from); + SharingLog_SetVisibility(SharingLog_SetVisibility&& from) noexcept + : SharingLog_SetVisibility() { + *this = ::std::move(from); + } + + inline SharingLog_SetVisibility& operator=(const SharingLog_SetVisibility& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SetVisibility& operator=(SharingLog_SetVisibility&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SetVisibility& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SetVisibility* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SetVisibility_default_instance_); + } + static constexpr int kIndexInFileMessages = + 9; + + friend void swap(SharingLog_SetVisibility& a, SharingLog_SetVisibility& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SetVisibility* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SetVisibility* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SetVisibility* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SetVisibility& from); + void MergeFrom(const SharingLog_SetVisibility& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SetVisibility* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SetVisibility"; + } + protected: + explicit SharingLog_SetVisibility(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kVisibilityFieldNumber = 1, + kSourceVisibilityFieldNumber = 2, + kDurationMillisFieldNumber = 3, + kSourceActivityNameFieldNumber = 4, + }; + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + bool has_visibility() const; + private: + bool _internal_has_visibility() const; + public: + void clear_visibility(); + ::location::nearby::proto::sharing::Visibility visibility() const; + void set_visibility(::location::nearby::proto::sharing::Visibility value); + private: + ::location::nearby::proto::sharing::Visibility _internal_visibility() const; + void _internal_set_visibility(::location::nearby::proto::sharing::Visibility value); + public: + + // optional .location.nearby.proto.sharing.Visibility source_visibility = 2; + bool has_source_visibility() const; + private: + bool _internal_has_source_visibility() const; + public: + void clear_source_visibility(); + ::location::nearby::proto::sharing::Visibility source_visibility() const; + void set_source_visibility(::location::nearby::proto::sharing::Visibility value); + private: + ::location::nearby::proto::sharing::Visibility _internal_source_visibility() const; + void _internal_set_source_visibility(::location::nearby::proto::sharing::Visibility value); + public: + + // optional int64 duration_millis = 3; + bool has_duration_millis() const; + private: + bool _internal_has_duration_millis() const; + public: + void clear_duration_millis(); + int64_t duration_millis() const; + void set_duration_millis(int64_t value); + private: + int64_t _internal_duration_millis() const; + void _internal_set_duration_millis(int64_t value); + public: + + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 4; + bool has_source_activity_name() const; + private: + bool _internal_has_source_activity_name() const; + public: + void clear_source_activity_name(); + ::location::nearby::proto::sharing::ActivityName source_activity_name() const; + void set_source_activity_name(::location::nearby::proto::sharing::ActivityName value); + private: + ::location::nearby::proto::sharing::ActivityName _internal_source_activity_name() const; + void _internal_set_source_activity_name(::location::nearby::proto::sharing::ActivityName value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SetVisibility) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int visibility_; + int source_visibility_; + int64_t duration_millis_; + int source_activity_name_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SetDataUsage final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) */ { + public: + inline SharingLog_SetDataUsage() : SharingLog_SetDataUsage(nullptr) {} + ~SharingLog_SetDataUsage() override; + explicit constexpr SharingLog_SetDataUsage(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SetDataUsage(const SharingLog_SetDataUsage& from); + SharingLog_SetDataUsage(SharingLog_SetDataUsage&& from) noexcept + : SharingLog_SetDataUsage() { + *this = ::std::move(from); + } + + inline SharingLog_SetDataUsage& operator=(const SharingLog_SetDataUsage& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SetDataUsage& operator=(SharingLog_SetDataUsage&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SetDataUsage& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SetDataUsage* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SetDataUsage_default_instance_); + } + static constexpr int kIndexInFileMessages = + 10; + + friend void swap(SharingLog_SetDataUsage& a, SharingLog_SetDataUsage& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SetDataUsage* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SetDataUsage* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SetDataUsage* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SetDataUsage& from); + void MergeFrom(const SharingLog_SetDataUsage& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SetDataUsage* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SetDataUsage"; + } + protected: + explicit SharingLog_SetDataUsage(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOriginalPreferenceFieldNumber = 1, + kPreferenceFieldNumber = 2, + }; + // optional .location.nearby.proto.sharing.DataUsage original_preference = 1; + bool has_original_preference() const; + private: + bool _internal_has_original_preference() const; + public: + void clear_original_preference(); + ::location::nearby::proto::sharing::DataUsage original_preference() const; + void set_original_preference(::location::nearby::proto::sharing::DataUsage value); + private: + ::location::nearby::proto::sharing::DataUsage _internal_original_preference() const; + void _internal_set_original_preference(::location::nearby::proto::sharing::DataUsage value); + public: + + // optional .location.nearby.proto.sharing.DataUsage preference = 2; + bool has_preference() const; + private: + bool _internal_has_preference() const; + public: + void clear_preference(); + ::location::nearby::proto::sharing::DataUsage preference() const; + void set_preference(::location::nearby::proto::sharing::DataUsage value); + private: + ::location::nearby::proto::sharing::DataUsage _internal_preference() const; + void _internal_set_preference(::location::nearby::proto::sharing::DataUsage value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SetDataUsage) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int original_preference_; + int preference_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ScanForShareTargetsStart final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) */ { + public: + inline SharingLog_ScanForShareTargetsStart() : SharingLog_ScanForShareTargetsStart(nullptr) {} + ~SharingLog_ScanForShareTargetsStart() override; + explicit constexpr SharingLog_ScanForShareTargetsStart(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ScanForShareTargetsStart(const SharingLog_ScanForShareTargetsStart& from); + SharingLog_ScanForShareTargetsStart(SharingLog_ScanForShareTargetsStart&& from) noexcept + : SharingLog_ScanForShareTargetsStart() { + *this = ::std::move(from); + } + + inline SharingLog_ScanForShareTargetsStart& operator=(const SharingLog_ScanForShareTargetsStart& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ScanForShareTargetsStart& operator=(SharingLog_ScanForShareTargetsStart&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ScanForShareTargetsStart& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ScanForShareTargetsStart* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ScanForShareTargetsStart_default_instance_); + } + static constexpr int kIndexInFileMessages = + 11; + + friend void swap(SharingLog_ScanForShareTargetsStart& a, SharingLog_ScanForShareTargetsStart& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ScanForShareTargetsStart* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ScanForShareTargetsStart* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ScanForShareTargetsStart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ScanForShareTargetsStart& from); + void MergeFrom(const SharingLog_ScanForShareTargetsStart& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ScanForShareTargetsStart* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart"; + } + protected: + explicit SharingLog_ScanForShareTargetsStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 5, + kSessionIdFieldNumber = 1, + kStatusFieldNumber = 2, + kScanTypeFieldNumber = 3, + kFlowIdFieldNumber = 4, + }; + // optional string referrer_name = 5; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.SessionStatus status = 2; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::SessionStatus status() const; + void set_status(::location::nearby::proto::sharing::SessionStatus value); + private: + ::location::nearby::proto::sharing::SessionStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::SessionStatus value); + public: + + // optional .location.nearby.proto.sharing.ScanType scan_type = 3; + bool has_scan_type() const; + private: + bool _internal_has_scan_type() const; + public: + void clear_scan_type(); + ::location::nearby::proto::sharing::ScanType scan_type() const; + void set_scan_type(::location::nearby::proto::sharing::ScanType value); + private: + ::location::nearby::proto::sharing::ScanType _internal_scan_type() const; + void _internal_set_scan_type(::location::nearby::proto::sharing::ScanType value); + public: + + // optional int64 flow_id = 4; + bool has_flow_id() const; + private: + bool _internal_has_flow_id() const; + public: + void clear_flow_id(); + int64_t flow_id() const; + void set_flow_id(int64_t value); + private: + int64_t _internal_flow_id() const; + void _internal_set_flow_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + int64_t session_id_; + int status_; + int scan_type_; + int64_t flow_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ScanForShareTargetsEnd final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) */ { + public: + inline SharingLog_ScanForShareTargetsEnd() : SharingLog_ScanForShareTargetsEnd(nullptr) {} + ~SharingLog_ScanForShareTargetsEnd() override; + explicit constexpr SharingLog_ScanForShareTargetsEnd(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ScanForShareTargetsEnd(const SharingLog_ScanForShareTargetsEnd& from); + SharingLog_ScanForShareTargetsEnd(SharingLog_ScanForShareTargetsEnd&& from) noexcept + : SharingLog_ScanForShareTargetsEnd() { + *this = ::std::move(from); + } + + inline SharingLog_ScanForShareTargetsEnd& operator=(const SharingLog_ScanForShareTargetsEnd& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ScanForShareTargetsEnd& operator=(SharingLog_ScanForShareTargetsEnd&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ScanForShareTargetsEnd& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ScanForShareTargetsEnd* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ScanForShareTargetsEnd_default_instance_); + } + static constexpr int kIndexInFileMessages = + 12; + + friend void swap(SharingLog_ScanForShareTargetsEnd& a, SharingLog_ScanForShareTargetsEnd& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ScanForShareTargetsEnd* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ScanForShareTargetsEnd* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ScanForShareTargetsEnd* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ScanForShareTargetsEnd& from); + void MergeFrom(const SharingLog_ScanForShareTargetsEnd& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ScanForShareTargetsEnd* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd"; + } + protected: + explicit SharingLog_ScanForShareTargetsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSessionIdFieldNumber = 1, + }; + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t session_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AdvertiseDevicePresenceStart final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) */ { + public: + inline SharingLog_AdvertiseDevicePresenceStart() : SharingLog_AdvertiseDevicePresenceStart(nullptr) {} + ~SharingLog_AdvertiseDevicePresenceStart() override; + explicit constexpr SharingLog_AdvertiseDevicePresenceStart(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AdvertiseDevicePresenceStart(const SharingLog_AdvertiseDevicePresenceStart& from); + SharingLog_AdvertiseDevicePresenceStart(SharingLog_AdvertiseDevicePresenceStart&& from) noexcept + : SharingLog_AdvertiseDevicePresenceStart() { + *this = ::std::move(from); + } + + inline SharingLog_AdvertiseDevicePresenceStart& operator=(const SharingLog_AdvertiseDevicePresenceStart& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AdvertiseDevicePresenceStart& operator=(SharingLog_AdvertiseDevicePresenceStart&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AdvertiseDevicePresenceStart& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AdvertiseDevicePresenceStart* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AdvertiseDevicePresenceStart_default_instance_); + } + static constexpr int kIndexInFileMessages = + 13; + + friend void swap(SharingLog_AdvertiseDevicePresenceStart& a, SharingLog_AdvertiseDevicePresenceStart& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AdvertiseDevicePresenceStart* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AdvertiseDevicePresenceStart* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AdvertiseDevicePresenceStart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AdvertiseDevicePresenceStart& from); + void MergeFrom(const SharingLog_AdvertiseDevicePresenceStart& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AdvertiseDevicePresenceStart* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart"; + } + protected: + explicit SharingLog_AdvertiseDevicePresenceStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 6, + kSessionIdFieldNumber = 1, + kVisibilityFieldNumber = 2, + kStatusFieldNumber = 3, + kDataUsageFieldNumber = 4, + kDeviceNameSizeFieldNumber = 5, + kAdvertisingModeFieldNumber = 7, + kQrCodeFlowFieldNumber = 8, + }; + // optional string referrer_name = 6; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional int64 session_id = 1 [deprecated = true]; + PROTOBUF_DEPRECATED bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + PROTOBUF_DEPRECATED void clear_session_id(); + PROTOBUF_DEPRECATED int64_t session_id() const; + PROTOBUF_DEPRECATED void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.Visibility visibility = 2; + bool has_visibility() const; + private: + bool _internal_has_visibility() const; + public: + void clear_visibility(); + ::location::nearby::proto::sharing::Visibility visibility() const; + void set_visibility(::location::nearby::proto::sharing::Visibility value); + private: + ::location::nearby::proto::sharing::Visibility _internal_visibility() const; + void _internal_set_visibility(::location::nearby::proto::sharing::Visibility value); + public: + + // optional .location.nearby.proto.sharing.SessionStatus status = 3; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::SessionStatus status() const; + void set_status(::location::nearby::proto::sharing::SessionStatus value); + private: + ::location::nearby::proto::sharing::SessionStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::SessionStatus value); + public: + + // optional .location.nearby.proto.sharing.DataUsage data_usage = 4; + bool has_data_usage() const; + private: + bool _internal_has_data_usage() const; + public: + void clear_data_usage(); + ::location::nearby::proto::sharing::DataUsage data_usage() const; + void set_data_usage(::location::nearby::proto::sharing::DataUsage value); + private: + ::location::nearby::proto::sharing::DataUsage _internal_data_usage() const; + void _internal_set_data_usage(::location::nearby::proto::sharing::DataUsage value); + public: + + // optional int32 device_name_size = 5 [deprecated = true]; + PROTOBUF_DEPRECATED bool has_device_name_size() const; + private: + bool _internal_has_device_name_size() const; + public: + PROTOBUF_DEPRECATED void clear_device_name_size(); + PROTOBUF_DEPRECATED int32_t device_name_size() const; + PROTOBUF_DEPRECATED void set_device_name_size(int32_t value); + private: + int32_t _internal_device_name_size() const; + void _internal_set_device_name_size(int32_t value); + public: + + // optional .location.nearby.proto.sharing.AdvertisingMode advertising_mode = 7; + bool has_advertising_mode() const; + private: + bool _internal_has_advertising_mode() const; + public: + void clear_advertising_mode(); + ::location::nearby::proto::sharing::AdvertisingMode advertising_mode() const; + void set_advertising_mode(::location::nearby::proto::sharing::AdvertisingMode value); + private: + ::location::nearby::proto::sharing::AdvertisingMode _internal_advertising_mode() const; + void _internal_set_advertising_mode(::location::nearby::proto::sharing::AdvertisingMode value); + public: + + // optional bool qr_code_flow = 8; + bool has_qr_code_flow() const; + private: + bool _internal_has_qr_code_flow() const; + public: + void clear_qr_code_flow(); + bool qr_code_flow() const; + void set_qr_code_flow(bool value); + private: + bool _internal_qr_code_flow() const; + void _internal_set_qr_code_flow(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + int64_t session_id_; + int visibility_; + int status_; + int data_usage_; + int32_t device_name_size_; + int advertising_mode_; + bool qr_code_flow_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AdvertiseDevicePresenceEnd final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) */ { + public: + inline SharingLog_AdvertiseDevicePresenceEnd() : SharingLog_AdvertiseDevicePresenceEnd(nullptr) {} + ~SharingLog_AdvertiseDevicePresenceEnd() override; + explicit constexpr SharingLog_AdvertiseDevicePresenceEnd(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AdvertiseDevicePresenceEnd(const SharingLog_AdvertiseDevicePresenceEnd& from); + SharingLog_AdvertiseDevicePresenceEnd(SharingLog_AdvertiseDevicePresenceEnd&& from) noexcept + : SharingLog_AdvertiseDevicePresenceEnd() { + *this = ::std::move(from); + } + + inline SharingLog_AdvertiseDevicePresenceEnd& operator=(const SharingLog_AdvertiseDevicePresenceEnd& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AdvertiseDevicePresenceEnd& operator=(SharingLog_AdvertiseDevicePresenceEnd&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AdvertiseDevicePresenceEnd& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AdvertiseDevicePresenceEnd* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AdvertiseDevicePresenceEnd_default_instance_); + } + static constexpr int kIndexInFileMessages = + 14; + + friend void swap(SharingLog_AdvertiseDevicePresenceEnd& a, SharingLog_AdvertiseDevicePresenceEnd& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AdvertiseDevicePresenceEnd* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AdvertiseDevicePresenceEnd* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AdvertiseDevicePresenceEnd* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AdvertiseDevicePresenceEnd& from); + void MergeFrom(const SharingLog_AdvertiseDevicePresenceEnd& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AdvertiseDevicePresenceEnd* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd"; + } + protected: + explicit SharingLog_AdvertiseDevicePresenceEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSessionIdFieldNumber = 1, + }; + // optional int64 session_id = 1 [deprecated = true]; + PROTOBUF_DEPRECATED bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + PROTOBUF_DEPRECATED void clear_session_id(); + PROTOBUF_DEPRECATED int64_t session_id() const; + PROTOBUF_DEPRECATED void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t session_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendFastInitialization final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) */ { + public: + inline SharingLog_SendFastInitialization() : SharingLog_SendFastInitialization(nullptr) {} + ~SharingLog_SendFastInitialization() override; + explicit constexpr SharingLog_SendFastInitialization(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendFastInitialization(const SharingLog_SendFastInitialization& from); + SharingLog_SendFastInitialization(SharingLog_SendFastInitialization&& from) noexcept + : SharingLog_SendFastInitialization() { + *this = ::std::move(from); + } + + inline SharingLog_SendFastInitialization& operator=(const SharingLog_SendFastInitialization& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendFastInitialization& operator=(SharingLog_SendFastInitialization&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendFastInitialization& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendFastInitialization* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendFastInitialization_default_instance_); + } + static constexpr int kIndexInFileMessages = + 15; + + friend void swap(SharingLog_SendFastInitialization& a, SharingLog_SendFastInitialization& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendFastInitialization* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendFastInitialization* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendFastInitialization* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendFastInitialization& from); + void MergeFrom(const SharingLog_SendFastInitialization& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendFastInitialization* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendFastInitialization"; + } + protected: + explicit SharingLog_SendFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendFastInitialization) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ReceiveFastInitialization final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) */ { + public: + inline SharingLog_ReceiveFastInitialization() : SharingLog_ReceiveFastInitialization(nullptr) {} + ~SharingLog_ReceiveFastInitialization() override; + explicit constexpr SharingLog_ReceiveFastInitialization(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ReceiveFastInitialization(const SharingLog_ReceiveFastInitialization& from); + SharingLog_ReceiveFastInitialization(SharingLog_ReceiveFastInitialization&& from) noexcept + : SharingLog_ReceiveFastInitialization() { + *this = ::std::move(from); + } + + inline SharingLog_ReceiveFastInitialization& operator=(const SharingLog_ReceiveFastInitialization& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ReceiveFastInitialization& operator=(SharingLog_ReceiveFastInitialization&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ReceiveFastInitialization& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ReceiveFastInitialization* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ReceiveFastInitialization_default_instance_); + } + static constexpr int kIndexInFileMessages = + 16; + + friend void swap(SharingLog_ReceiveFastInitialization& a, SharingLog_ReceiveFastInitialization& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ReceiveFastInitialization* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ReceiveFastInitialization* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ReceiveFastInitialization* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ReceiveFastInitialization& from); + void MergeFrom(const SharingLog_ReceiveFastInitialization& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ReceiveFastInitialization* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization"; + } + protected: + explicit SharingLog_ReceiveFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTimeElapseSinceScreenUnlockMillisFieldNumber = 1, + kNotificationsEnabledFieldNumber = 2, + kNotificationsFilteredFieldNumber = 3, + }; + // optional int64 time_elapse_since_screen_unlock_millis = 1; + bool has_time_elapse_since_screen_unlock_millis() const; + private: + bool _internal_has_time_elapse_since_screen_unlock_millis() const; + public: + void clear_time_elapse_since_screen_unlock_millis(); + int64_t time_elapse_since_screen_unlock_millis() const; + void set_time_elapse_since_screen_unlock_millis(int64_t value); + private: + int64_t _internal_time_elapse_since_screen_unlock_millis() const; + void _internal_set_time_elapse_since_screen_unlock_millis(int64_t value); + public: + + // optional bool notifications_enabled = 2; + bool has_notifications_enabled() const; + private: + bool _internal_has_notifications_enabled() const; + public: + void clear_notifications_enabled(); + bool notifications_enabled() const; + void set_notifications_enabled(bool value); + private: + bool _internal_notifications_enabled() const; + void _internal_set_notifications_enabled(bool value); + public: + + // optional bool notifications_filtered = 3; + bool has_notifications_filtered() const; + private: + bool _internal_has_notifications_filtered() const; + public: + void clear_notifications_filtered(); + bool notifications_filtered() const; + void set_notifications_filtered(bool value); + private: + bool _internal_notifications_filtered() const; + void _internal_set_notifications_filtered(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t time_elapse_since_screen_unlock_millis_; + bool notifications_enabled_; + bool notifications_filtered_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DismissFastInitialization final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) */ { + public: + inline SharingLog_DismissFastInitialization() : SharingLog_DismissFastInitialization(nullptr) {} + ~SharingLog_DismissFastInitialization() override; + explicit constexpr SharingLog_DismissFastInitialization(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DismissFastInitialization(const SharingLog_DismissFastInitialization& from); + SharingLog_DismissFastInitialization(SharingLog_DismissFastInitialization&& from) noexcept + : SharingLog_DismissFastInitialization() { + *this = ::std::move(from); + } + + inline SharingLog_DismissFastInitialization& operator=(const SharingLog_DismissFastInitialization& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DismissFastInitialization& operator=(SharingLog_DismissFastInitialization&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DismissFastInitialization& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DismissFastInitialization* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DismissFastInitialization_default_instance_); + } + static constexpr int kIndexInFileMessages = + 17; + + friend void swap(SharingLog_DismissFastInitialization& a, SharingLog_DismissFastInitialization& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DismissFastInitialization* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DismissFastInitialization* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DismissFastInitialization* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DismissFastInitialization& from); + void MergeFrom(const SharingLog_DismissFastInitialization& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DismissFastInitialization* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization"; + } + protected: + explicit SharingLog_DismissFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AutoDismissFastInitialization final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) */ { + public: + inline SharingLog_AutoDismissFastInitialization() : SharingLog_AutoDismissFastInitialization(nullptr) {} + ~SharingLog_AutoDismissFastInitialization() override; + explicit constexpr SharingLog_AutoDismissFastInitialization(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AutoDismissFastInitialization(const SharingLog_AutoDismissFastInitialization& from); + SharingLog_AutoDismissFastInitialization(SharingLog_AutoDismissFastInitialization&& from) noexcept + : SharingLog_AutoDismissFastInitialization() { + *this = ::std::move(from); + } + + inline SharingLog_AutoDismissFastInitialization& operator=(const SharingLog_AutoDismissFastInitialization& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AutoDismissFastInitialization& operator=(SharingLog_AutoDismissFastInitialization&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AutoDismissFastInitialization& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AutoDismissFastInitialization* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AutoDismissFastInitialization_default_instance_); + } + static constexpr int kIndexInFileMessages = + 18; + + friend void swap(SharingLog_AutoDismissFastInitialization& a, SharingLog_AutoDismissFastInitialization& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AutoDismissFastInitialization* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AutoDismissFastInitialization* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AutoDismissFastInitialization* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AutoDismissFastInitialization& from); + void MergeFrom(const SharingLog_AutoDismissFastInitialization& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AutoDismissFastInitialization* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization"; + } + protected: + explicit SharingLog_AutoDismissFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_EventMetadata final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.EventMetadata) */ { + public: + inline SharingLog_EventMetadata() : SharingLog_EventMetadata(nullptr) {} + ~SharingLog_EventMetadata() override; + explicit constexpr SharingLog_EventMetadata(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_EventMetadata(const SharingLog_EventMetadata& from); + SharingLog_EventMetadata(SharingLog_EventMetadata&& from) noexcept + : SharingLog_EventMetadata() { + *this = ::std::move(from); + } + + inline SharingLog_EventMetadata& operator=(const SharingLog_EventMetadata& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_EventMetadata& operator=(SharingLog_EventMetadata&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_EventMetadata& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_EventMetadata* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_EventMetadata_default_instance_); + } + static constexpr int kIndexInFileMessages = + 19; + + friend void swap(SharingLog_EventMetadata& a, SharingLog_EventMetadata& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_EventMetadata* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_EventMetadata* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_EventMetadata* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_EventMetadata& from); + void MergeFrom(const SharingLog_EventMetadata& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_EventMetadata* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.EventMetadata"; + } + protected: + explicit SharingLog_EventMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kUseCaseFieldNumber = 1, + kInitialOptInFieldNumber = 2, + kOptInFieldNumber = 3, + kInitialEnableStatusFieldNumber = 4, + kFlowIdFieldNumber = 5, + kSessionIdFieldNumber = 6, + kVendorIdFieldNumber = 7, + }; + // optional .location.nearby.proto.sharing.SharingUseCase use_case = 1; + bool has_use_case() const; + private: + bool _internal_has_use_case() const; + public: + void clear_use_case(); + ::location::nearby::proto::sharing::SharingUseCase use_case() const; + void set_use_case(::location::nearby::proto::sharing::SharingUseCase value); + private: + ::location::nearby::proto::sharing::SharingUseCase _internal_use_case() const; + void _internal_set_use_case(::location::nearby::proto::sharing::SharingUseCase value); + public: + + // optional bool initial_opt_in = 2; + bool has_initial_opt_in() const; + private: + bool _internal_has_initial_opt_in() const; + public: + void clear_initial_opt_in(); + bool initial_opt_in() const; + void set_initial_opt_in(bool value); + private: + bool _internal_initial_opt_in() const; + void _internal_set_initial_opt_in(bool value); + public: + + // optional bool opt_in = 3; + bool has_opt_in() const; + private: + bool _internal_has_opt_in() const; + public: + void clear_opt_in(); + bool opt_in() const; + void set_opt_in(bool value); + private: + bool _internal_opt_in() const; + void _internal_set_opt_in(bool value); + public: + + // optional bool initial_enable_status = 4; + bool has_initial_enable_status() const; + private: + bool _internal_has_initial_enable_status() const; + public: + void clear_initial_enable_status(); + bool initial_enable_status() const; + void set_initial_enable_status(bool value); + private: + bool _internal_initial_enable_status() const; + void _internal_set_initial_enable_status(bool value); + public: + + // optional int64 flow_id = 5; + bool has_flow_id() const; + private: + bool _internal_has_flow_id() const; + public: + void clear_flow_id(); + int64_t flow_id() const; + void set_flow_id(int64_t value); + private: + int64_t _internal_flow_id() const; + void _internal_set_flow_id(int64_t value); + public: + + // optional int64 session_id = 6; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int32 vendor_id = 7; + bool has_vendor_id() const; + private: + bool _internal_has_vendor_id() const; + public: + void clear_vendor_id(); + int32_t vendor_id() const; + void set_vendor_id(int32_t value); + private: + int32_t _internal_vendor_id() const; + void _internal_set_vendor_id(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.EventMetadata) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int use_case_; + bool initial_opt_in_; + bool opt_in_; + bool initial_enable_status_; + int64_t flow_id_; + int64_t session_id_; + int32_t vendor_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DiscoverShareTarget final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) */ { + public: + inline SharingLog_DiscoverShareTarget() : SharingLog_DiscoverShareTarget(nullptr) {} + ~SharingLog_DiscoverShareTarget() override; + explicit constexpr SharingLog_DiscoverShareTarget(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DiscoverShareTarget(const SharingLog_DiscoverShareTarget& from); + SharingLog_DiscoverShareTarget(SharingLog_DiscoverShareTarget&& from) noexcept + : SharingLog_DiscoverShareTarget() { + *this = ::std::move(from); + } + + inline SharingLog_DiscoverShareTarget& operator=(const SharingLog_DiscoverShareTarget& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DiscoverShareTarget& operator=(SharingLog_DiscoverShareTarget&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DiscoverShareTarget& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DiscoverShareTarget* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DiscoverShareTarget_default_instance_); + } + static constexpr int kIndexInFileMessages = + 20; + + friend void swap(SharingLog_DiscoverShareTarget& a, SharingLog_DiscoverShareTarget& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DiscoverShareTarget* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DiscoverShareTarget* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DiscoverShareTarget* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DiscoverShareTarget& from); + void MergeFrom(const SharingLog_DiscoverShareTarget& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DiscoverShareTarget* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget"; + } + protected: + explicit SharingLog_DiscoverShareTarget(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 5, + kShareTargetInfoFieldNumber = 1, + kDurationSinceScanningFieldNumber = 2, + kSessionIdFieldNumber = 3, + kFlowIdFieldNumber = 4, + kScanTypeFieldNumber = 7, + kLatencySinceActivityStartMillisFieldNumber = 6, + }; + // optional string referrer_name = 5; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional .google.protobuf.Duration duration_since_scanning = 2; + bool has_duration_since_scanning() const; + private: + bool _internal_has_duration_since_scanning() const; + public: + void clear_duration_since_scanning(); + const ::PROTOBUF_NAMESPACE_ID::Duration& duration_since_scanning() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Duration* release_duration_since_scanning(); + ::PROTOBUF_NAMESPACE_ID::Duration* mutable_duration_since_scanning(); + void set_allocated_duration_since_scanning(::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning); + private: + const ::PROTOBUF_NAMESPACE_ID::Duration& _internal_duration_since_scanning() const; + ::PROTOBUF_NAMESPACE_ID::Duration* _internal_mutable_duration_since_scanning(); + public: + void unsafe_arena_set_allocated_duration_since_scanning( + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning); + ::PROTOBUF_NAMESPACE_ID::Duration* unsafe_arena_release_duration_since_scanning(); + + // optional int64 session_id = 3; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int64 flow_id = 4; + bool has_flow_id() const; + private: + bool _internal_has_flow_id() const; + public: + void clear_flow_id(); + int64_t flow_id() const; + void set_flow_id(int64_t value); + private: + int64_t _internal_flow_id() const; + void _internal_set_flow_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + bool has_scan_type() const; + private: + bool _internal_has_scan_type() const; + public: + void clear_scan_type(); + ::location::nearby::proto::sharing::ScanType scan_type() const; + void set_scan_type(::location::nearby::proto::sharing::ScanType value); + private: + ::location::nearby::proto::sharing::ScanType _internal_scan_type() const; + void _internal_set_scan_type(::location::nearby::proto::sharing::ScanType value); + public: + + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + bool has_latency_since_activity_start_millis() const; + private: + bool _internal_has_latency_since_activity_start_millis() const; + public: + void clear_latency_since_activity_start_millis(); + int64_t latency_since_activity_start_millis() const; + void set_latency_since_activity_start_millis(int64_t value); + private: + int64_t _internal_latency_since_activity_start_millis() const; + void _internal_set_latency_since_activity_start_millis(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning_; + int64_t session_id_; + int64_t flow_id_; + int scan_type_; + int64_t latency_since_activity_start_millis_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ParsingFailedEndpointId final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) */ { + public: + inline SharingLog_ParsingFailedEndpointId() : SharingLog_ParsingFailedEndpointId(nullptr) {} + ~SharingLog_ParsingFailedEndpointId() override; + explicit constexpr SharingLog_ParsingFailedEndpointId(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ParsingFailedEndpointId(const SharingLog_ParsingFailedEndpointId& from); + SharingLog_ParsingFailedEndpointId(SharingLog_ParsingFailedEndpointId&& from) noexcept + : SharingLog_ParsingFailedEndpointId() { + *this = ::std::move(from); + } + + inline SharingLog_ParsingFailedEndpointId& operator=(const SharingLog_ParsingFailedEndpointId& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ParsingFailedEndpointId& operator=(SharingLog_ParsingFailedEndpointId&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ParsingFailedEndpointId& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ParsingFailedEndpointId* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ParsingFailedEndpointId_default_instance_); + } + static constexpr int kIndexInFileMessages = + 21; + + friend void swap(SharingLog_ParsingFailedEndpointId& a, SharingLog_ParsingFailedEndpointId& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ParsingFailedEndpointId* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ParsingFailedEndpointId* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ParsingFailedEndpointId* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ParsingFailedEndpointId& from); + void MergeFrom(const SharingLog_ParsingFailedEndpointId& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ParsingFailedEndpointId* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId"; + } + protected: + explicit SharingLog_ParsingFailedEndpointId(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEndpointIdFieldNumber = 1, + kReferrerNameFieldNumber = 5, + kDurationSinceScanningFieldNumber = 2, + kDurationSinceLastSyncFieldNumber = 8, + kSessionIdFieldNumber = 3, + kFlowIdFieldNumber = 4, + kScanTypeFieldNumber = 7, + kParsingFailedTypeFieldNumber = 9, + kDiscoveryModeFieldNumber = 10, + kLatencySinceActivityStartMillisFieldNumber = 6, + }; + // optional string endpoint_id = 1; + bool has_endpoint_id() const; + private: + bool _internal_has_endpoint_id() const; + public: + void clear_endpoint_id(); + const std::string& endpoint_id() const; + template + void set_endpoint_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_endpoint_id(); + PROTOBUF_NODISCARD std::string* release_endpoint_id(); + void set_allocated_endpoint_id(std::string* endpoint_id); + private: + const std::string& _internal_endpoint_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_endpoint_id(const std::string& value); + std::string* _internal_mutable_endpoint_id(); + public: + + // optional string referrer_name = 5; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional .google.protobuf.Duration duration_since_scanning = 2; + bool has_duration_since_scanning() const; + private: + bool _internal_has_duration_since_scanning() const; + public: + void clear_duration_since_scanning(); + const ::PROTOBUF_NAMESPACE_ID::Duration& duration_since_scanning() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Duration* release_duration_since_scanning(); + ::PROTOBUF_NAMESPACE_ID::Duration* mutable_duration_since_scanning(); + void set_allocated_duration_since_scanning(::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning); + private: + const ::PROTOBUF_NAMESPACE_ID::Duration& _internal_duration_since_scanning() const; + ::PROTOBUF_NAMESPACE_ID::Duration* _internal_mutable_duration_since_scanning(); + public: + void unsafe_arena_set_allocated_duration_since_scanning( + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning); + ::PROTOBUF_NAMESPACE_ID::Duration* unsafe_arena_release_duration_since_scanning(); + + // optional .google.protobuf.Duration duration_since_last_sync = 8; + bool has_duration_since_last_sync() const; + private: + bool _internal_has_duration_since_last_sync() const; + public: + void clear_duration_since_last_sync(); + const ::PROTOBUF_NAMESPACE_ID::Duration& duration_since_last_sync() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Duration* release_duration_since_last_sync(); + ::PROTOBUF_NAMESPACE_ID::Duration* mutable_duration_since_last_sync(); + void set_allocated_duration_since_last_sync(::PROTOBUF_NAMESPACE_ID::Duration* duration_since_last_sync); + private: + const ::PROTOBUF_NAMESPACE_ID::Duration& _internal_duration_since_last_sync() const; + ::PROTOBUF_NAMESPACE_ID::Duration* _internal_mutable_duration_since_last_sync(); + public: + void unsafe_arena_set_allocated_duration_since_last_sync( + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_last_sync); + ::PROTOBUF_NAMESPACE_ID::Duration* unsafe_arena_release_duration_since_last_sync(); + + // optional int64 session_id = 3; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int64 flow_id = 4; + bool has_flow_id() const; + private: + bool _internal_has_flow_id() const; + public: + void clear_flow_id(); + int64_t flow_id() const; + void set_flow_id(int64_t value); + private: + int64_t _internal_flow_id() const; + void _internal_set_flow_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.ScanType scan_type = 7; + bool has_scan_type() const; + private: + bool _internal_has_scan_type() const; + public: + void clear_scan_type(); + ::location::nearby::proto::sharing::ScanType scan_type() const; + void set_scan_type(::location::nearby::proto::sharing::ScanType value); + private: + ::location::nearby::proto::sharing::ScanType _internal_scan_type() const; + void _internal_set_scan_type(::location::nearby::proto::sharing::ScanType value); + public: + + // optional .location.nearby.proto.sharing.ParsingFailedType parsing_failed_type = 9; + bool has_parsing_failed_type() const; + private: + bool _internal_has_parsing_failed_type() const; + public: + void clear_parsing_failed_type(); + ::location::nearby::proto::sharing::ParsingFailedType parsing_failed_type() const; + void set_parsing_failed_type(::location::nearby::proto::sharing::ParsingFailedType value); + private: + ::location::nearby::proto::sharing::ParsingFailedType _internal_parsing_failed_type() const; + void _internal_set_parsing_failed_type(::location::nearby::proto::sharing::ParsingFailedType value); + public: + + // optional .location.nearby.proto.sharing.DiscoveryMode discovery_mode = 10; + bool has_discovery_mode() const; + private: + bool _internal_has_discovery_mode() const; + public: + void clear_discovery_mode(); + ::location::nearby::proto::sharing::DiscoveryMode discovery_mode() const; + void set_discovery_mode(::location::nearby::proto::sharing::DiscoveryMode value); + private: + ::location::nearby::proto::sharing::DiscoveryMode _internal_discovery_mode() const; + void _internal_set_discovery_mode(::location::nearby::proto::sharing::DiscoveryMode value); + public: + + // optional int64 latency_since_activity_start_millis = 6 [default = -1]; + bool has_latency_since_activity_start_millis() const; + private: + bool _internal_has_latency_since_activity_start_millis() const; + public: + void clear_latency_since_activity_start_millis(); + int64_t latency_since_activity_start_millis() const; + void set_latency_since_activity_start_millis(int64_t value); + private: + int64_t _internal_latency_since_activity_start_millis() const; + void _internal_set_latency_since_activity_start_millis(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr endpoint_id_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning_; + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_last_sync_; + int64_t session_id_; + int64_t flow_id_; + int scan_type_; + int parsing_failed_type_; + int discovery_mode_; + int64_t latency_since_activity_start_millis_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DescribeAttachments final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) */ { + public: + inline SharingLog_DescribeAttachments() : SharingLog_DescribeAttachments(nullptr) {} + ~SharingLog_DescribeAttachments() override; + explicit constexpr SharingLog_DescribeAttachments(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DescribeAttachments(const SharingLog_DescribeAttachments& from); + SharingLog_DescribeAttachments(SharingLog_DescribeAttachments&& from) noexcept + : SharingLog_DescribeAttachments() { + *this = ::std::move(from); + } + + inline SharingLog_DescribeAttachments& operator=(const SharingLog_DescribeAttachments& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DescribeAttachments& operator=(SharingLog_DescribeAttachments&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DescribeAttachments& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DescribeAttachments* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DescribeAttachments_default_instance_); + } + static constexpr int kIndexInFileMessages = + 22; + + friend void swap(SharingLog_DescribeAttachments& a, SharingLog_DescribeAttachments& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DescribeAttachments* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DescribeAttachments* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DescribeAttachments* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DescribeAttachments& from); + void MergeFrom(const SharingLog_DescribeAttachments& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DescribeAttachments* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DescribeAttachments"; + } + protected: + explicit SharingLog_DescribeAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAttachmentsInfoFieldNumber = 1, + }; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 1; + bool has_attachments_info() const; + private: + bool _internal_has_attachments_info() const; + public: + void clear_attachments_info(); + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* release_attachments_info(); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* mutable_attachments_info(); + void set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& _internal_attachments_info() const; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _internal_mutable_attachments_info(); + public: + void unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* unsafe_arena_release_attachments_info(); + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendIntroduction final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) */ { + public: + inline SharingLog_SendIntroduction() : SharingLog_SendIntroduction(nullptr) {} + ~SharingLog_SendIntroduction() override; + explicit constexpr SharingLog_SendIntroduction(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendIntroduction(const SharingLog_SendIntroduction& from); + SharingLog_SendIntroduction(SharingLog_SendIntroduction&& from) noexcept + : SharingLog_SendIntroduction() { + *this = ::std::move(from); + } + + inline SharingLog_SendIntroduction& operator=(const SharingLog_SendIntroduction& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendIntroduction& operator=(SharingLog_SendIntroduction&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendIntroduction& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendIntroduction* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendIntroduction_default_instance_); + } + static constexpr int kIndexInFileMessages = + 23; + + friend void swap(SharingLog_SendIntroduction& a, SharingLog_SendIntroduction& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendIntroduction* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendIntroduction* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendIntroduction* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendIntroduction& from); + void MergeFrom(const SharingLog_SendIntroduction& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendIntroduction* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendIntroduction"; + } + protected: + explicit SharingLog_SendIntroduction(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShareTargetInfoFieldNumber = 1, + kSessionIdFieldNumber = 2, + kTransferPositionFieldNumber = 3, + kConcurrentConnectionsFieldNumber = 4, + }; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 2; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int32 transfer_position = 3; + bool has_transfer_position() const; + private: + bool _internal_has_transfer_position() const; + public: + void clear_transfer_position(); + int32_t transfer_position() const; + void set_transfer_position(int32_t value); + private: + int32_t _internal_transfer_position() const; + void _internal_set_transfer_position(int32_t value); + public: + + // optional int32 concurrent_connections = 4; + bool has_concurrent_connections() const; + private: + bool _internal_has_concurrent_connections() const; + public: + void clear_concurrent_connections(); + int32_t concurrent_connections() const; + void set_concurrent_connections(int32_t value); + private: + int32_t _internal_concurrent_connections() const; + void _internal_set_concurrent_connections(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendIntroduction) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + int32_t transfer_position_; + int32_t concurrent_connections_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ReceiveIntroduction final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) */ { + public: + inline SharingLog_ReceiveIntroduction() : SharingLog_ReceiveIntroduction(nullptr) {} + ~SharingLog_ReceiveIntroduction() override; + explicit constexpr SharingLog_ReceiveIntroduction(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ReceiveIntroduction(const SharingLog_ReceiveIntroduction& from); + SharingLog_ReceiveIntroduction(SharingLog_ReceiveIntroduction&& from) noexcept + : SharingLog_ReceiveIntroduction() { + *this = ::std::move(from); + } + + inline SharingLog_ReceiveIntroduction& operator=(const SharingLog_ReceiveIntroduction& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ReceiveIntroduction& operator=(SharingLog_ReceiveIntroduction&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ReceiveIntroduction& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ReceiveIntroduction* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ReceiveIntroduction_default_instance_); + } + static constexpr int kIndexInFileMessages = + 24; + + friend void swap(SharingLog_ReceiveIntroduction& a, SharingLog_ReceiveIntroduction& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ReceiveIntroduction* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ReceiveIntroduction* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ReceiveIntroduction* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ReceiveIntroduction& from); + void MergeFrom(const SharingLog_ReceiveIntroduction& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ReceiveIntroduction* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction"; + } + protected: + explicit SharingLog_ReceiveIntroduction(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 3, + kShareTargetInfoFieldNumber = 2, + kSessionIdFieldNumber = 1, + }; + // optional string referrer_name = 3; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 2; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_RespondToIntroduction final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) */ { + public: + inline SharingLog_RespondToIntroduction() : SharingLog_RespondToIntroduction(nullptr) {} + ~SharingLog_RespondToIntroduction() override; + explicit constexpr SharingLog_RespondToIntroduction(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_RespondToIntroduction(const SharingLog_RespondToIntroduction& from); + SharingLog_RespondToIntroduction(SharingLog_RespondToIntroduction&& from) noexcept + : SharingLog_RespondToIntroduction() { + *this = ::std::move(from); + } + + inline SharingLog_RespondToIntroduction& operator=(const SharingLog_RespondToIntroduction& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_RespondToIntroduction& operator=(SharingLog_RespondToIntroduction&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_RespondToIntroduction& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_RespondToIntroduction* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_RespondToIntroduction_default_instance_); + } + static constexpr int kIndexInFileMessages = + 25; + + friend void swap(SharingLog_RespondToIntroduction& a, SharingLog_RespondToIntroduction& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_RespondToIntroduction* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_RespondToIntroduction* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_RespondToIntroduction* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_RespondToIntroduction& from); + void MergeFrom(const SharingLog_RespondToIntroduction& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_RespondToIntroduction* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction"; + } + protected: + explicit SharingLog_RespondToIntroduction(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSessionIdFieldNumber = 2, + kActionFieldNumber = 1, + kQrCodeFlowFieldNumber = 3, + }; + // optional int64 session_id = 2; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.ResponseToIntroduction action = 1; + bool has_action() const; + private: + bool _internal_has_action() const; + public: + void clear_action(); + ::location::nearby::proto::sharing::ResponseToIntroduction action() const; + void set_action(::location::nearby::proto::sharing::ResponseToIntroduction value); + private: + ::location::nearby::proto::sharing::ResponseToIntroduction _internal_action() const; + void _internal_set_action(::location::nearby::proto::sharing::ResponseToIntroduction value); + public: + + // optional bool qr_code_flow = 3; + bool has_qr_code_flow() const; + private: + bool _internal_has_qr_code_flow() const; + public: + void clear_qr_code_flow(); + bool qr_code_flow() const; + void set_qr_code_flow(bool value); + private: + bool _internal_qr_code_flow() const; + void _internal_set_qr_code_flow(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t session_id_; + int action_; + bool qr_code_flow_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendAttachmentsStart final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) */ { + public: + inline SharingLog_SendAttachmentsStart() : SharingLog_SendAttachmentsStart(nullptr) {} + ~SharingLog_SendAttachmentsStart() override; + explicit constexpr SharingLog_SendAttachmentsStart(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendAttachmentsStart(const SharingLog_SendAttachmentsStart& from); + SharingLog_SendAttachmentsStart(SharingLog_SendAttachmentsStart&& from) noexcept + : SharingLog_SendAttachmentsStart() { + *this = ::std::move(from); + } + + inline SharingLog_SendAttachmentsStart& operator=(const SharingLog_SendAttachmentsStart& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendAttachmentsStart& operator=(SharingLog_SendAttachmentsStart&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendAttachmentsStart& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendAttachmentsStart* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendAttachmentsStart_default_instance_); + } + static constexpr int kIndexInFileMessages = + 26; + + friend void swap(SharingLog_SendAttachmentsStart& a, SharingLog_SendAttachmentsStart& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendAttachmentsStart* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendAttachmentsStart* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendAttachmentsStart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendAttachmentsStart& from); + void MergeFrom(const SharingLog_SendAttachmentsStart& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendAttachmentsStart* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart"; + } + protected: + explicit SharingLog_SendAttachmentsStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAttachmentsInfoFieldNumber = 2, + kSessionIdFieldNumber = 1, + kTransferPositionFieldNumber = 3, + kConcurrentConnectionsFieldNumber = 4, + kQrCodeFlowFieldNumber = 5, + }; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + bool has_attachments_info() const; + private: + bool _internal_has_attachments_info() const; + public: + void clear_attachments_info(); + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* release_attachments_info(); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* mutable_attachments_info(); + void set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& _internal_attachments_info() const; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _internal_mutable_attachments_info(); + public: + void unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* unsafe_arena_release_attachments_info(); + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int32 transfer_position = 3; + bool has_transfer_position() const; + private: + bool _internal_has_transfer_position() const; + public: + void clear_transfer_position(); + int32_t transfer_position() const; + void set_transfer_position(int32_t value); + private: + int32_t _internal_transfer_position() const; + void _internal_set_transfer_position(int32_t value); + public: + + // optional int32 concurrent_connections = 4; + bool has_concurrent_connections() const; + private: + bool _internal_has_concurrent_connections() const; + public: + void clear_concurrent_connections(); + int32_t concurrent_connections() const; + void set_concurrent_connections(int32_t value); + private: + int32_t _internal_concurrent_connections() const; + void _internal_set_concurrent_connections(int32_t value); + public: + + // optional bool qr_code_flow = 5; + bool has_qr_code_flow() const; + private: + bool _internal_has_qr_code_flow() const; + public: + void clear_qr_code_flow(); + bool qr_code_flow() const; + void set_qr_code_flow(bool value); + private: + bool _internal_qr_code_flow() const; + void _internal_set_qr_code_flow(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info_; + int64_t session_id_; + int32_t transfer_position_; + int32_t concurrent_connections_; + bool qr_code_flow_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendAttachmentsEnd final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) */ { + public: + inline SharingLog_SendAttachmentsEnd() : SharingLog_SendAttachmentsEnd(nullptr) {} + ~SharingLog_SendAttachmentsEnd() override; + explicit constexpr SharingLog_SendAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendAttachmentsEnd(const SharingLog_SendAttachmentsEnd& from); + SharingLog_SendAttachmentsEnd(SharingLog_SendAttachmentsEnd&& from) noexcept + : SharingLog_SendAttachmentsEnd() { + *this = ::std::move(from); + } + + inline SharingLog_SendAttachmentsEnd& operator=(const SharingLog_SendAttachmentsEnd& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendAttachmentsEnd& operator=(SharingLog_SendAttachmentsEnd&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendAttachmentsEnd& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendAttachmentsEnd* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendAttachmentsEnd_default_instance_); + } + static constexpr int kIndexInFileMessages = + 27; + + friend void swap(SharingLog_SendAttachmentsEnd& a, SharingLog_SendAttachmentsEnd& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendAttachmentsEnd* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendAttachmentsEnd* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendAttachmentsEnd* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendAttachmentsEnd& from); + void MergeFrom(const SharingLog_SendAttachmentsEnd& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendAttachmentsEnd* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd"; + } + protected: + explicit SharingLog_SendAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 9, + kAttachmentsInfoFieldNumber = 6, + kShareTargetInfoFieldNumber = 8, + kSessionIdFieldNumber = 1, + kSentBytesFieldNumber = 2, + kStatusFieldNumber = 3, + kTransferPositionFieldNumber = 4, + kDurationMillisFieldNumber = 7, + kConcurrentConnectionsFieldNumber = 5, + kConnectionLayerStatusFieldNumber = 10, + }; + // optional string referrer_name = 9; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 6; + bool has_attachments_info() const; + private: + bool _internal_has_attachments_info() const; + public: + void clear_attachments_info(); + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* release_attachments_info(); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* mutable_attachments_info(); + void set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& _internal_attachments_info() const; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _internal_mutable_attachments_info(); + public: + void unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* unsafe_arena_release_attachments_info(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 8; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int64 sent_bytes = 2; + bool has_sent_bytes() const; + private: + bool _internal_has_sent_bytes() const; + public: + void clear_sent_bytes(); + int64_t sent_bytes() const; + void set_sent_bytes(int64_t value); + private: + int64_t _internal_sent_bytes() const; + void _internal_set_sent_bytes(int64_t value); + public: + + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::AttachmentTransmissionStatus status() const; + void set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value); + private: + ::location::nearby::proto::sharing::AttachmentTransmissionStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value); + public: + + // optional int32 transfer_position = 4; + bool has_transfer_position() const; + private: + bool _internal_has_transfer_position() const; + public: + void clear_transfer_position(); + int32_t transfer_position() const; + void set_transfer_position(int32_t value); + private: + int32_t _internal_transfer_position() const; + void _internal_set_transfer_position(int32_t value); + public: + + // optional int64 duration_millis = 7; + bool has_duration_millis() const; + private: + bool _internal_has_duration_millis() const; + public: + void clear_duration_millis(); + int64_t duration_millis() const; + void set_duration_millis(int64_t value); + private: + int64_t _internal_duration_millis() const; + void _internal_set_duration_millis(int64_t value); + public: + + // optional int32 concurrent_connections = 5; + bool has_concurrent_connections() const; + private: + bool _internal_has_concurrent_connections() const; + public: + void clear_concurrent_connections(); + int32_t concurrent_connections() const; + void set_concurrent_connections(int32_t value); + private: + int32_t _internal_concurrent_connections() const; + void _internal_set_concurrent_connections(int32_t value); + public: + + // optional .location.nearby.proto.sharing.ConnectionLayerStatus connection_layer_status = 10; + bool has_connection_layer_status() const; + private: + bool _internal_has_connection_layer_status() const; + public: + void clear_connection_layer_status(); + ::location::nearby::proto::sharing::ConnectionLayerStatus connection_layer_status() const; + void set_connection_layer_status(::location::nearby::proto::sharing::ConnectionLayerStatus value); + private: + ::location::nearby::proto::sharing::ConnectionLayerStatus _internal_connection_layer_status() const; + void _internal_set_connection_layer_status(::location::nearby::proto::sharing::ConnectionLayerStatus value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + int64_t sent_bytes_; + int status_; + int32_t transfer_position_; + int64_t duration_millis_; + int32_t concurrent_connections_; + int connection_layer_status_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ReceiveAttachmentsStart final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) */ { + public: + inline SharingLog_ReceiveAttachmentsStart() : SharingLog_ReceiveAttachmentsStart(nullptr) {} + ~SharingLog_ReceiveAttachmentsStart() override; + explicit constexpr SharingLog_ReceiveAttachmentsStart(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ReceiveAttachmentsStart(const SharingLog_ReceiveAttachmentsStart& from); + SharingLog_ReceiveAttachmentsStart(SharingLog_ReceiveAttachmentsStart&& from) noexcept + : SharingLog_ReceiveAttachmentsStart() { + *this = ::std::move(from); + } + + inline SharingLog_ReceiveAttachmentsStart& operator=(const SharingLog_ReceiveAttachmentsStart& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ReceiveAttachmentsStart& operator=(SharingLog_ReceiveAttachmentsStart&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ReceiveAttachmentsStart& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ReceiveAttachmentsStart* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ReceiveAttachmentsStart_default_instance_); + } + static constexpr int kIndexInFileMessages = + 28; + + friend void swap(SharingLog_ReceiveAttachmentsStart& a, SharingLog_ReceiveAttachmentsStart& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ReceiveAttachmentsStart* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ReceiveAttachmentsStart* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ReceiveAttachmentsStart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ReceiveAttachmentsStart& from); + void MergeFrom(const SharingLog_ReceiveAttachmentsStart& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ReceiveAttachmentsStart* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart"; + } + protected: + explicit SharingLog_ReceiveAttachmentsStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAttachmentsInfoFieldNumber = 2, + kShareTargetInfoFieldNumber = 3, + kSessionIdFieldNumber = 1, + }; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; + bool has_attachments_info() const; + private: + bool _internal_has_attachments_info() const; + public: + void clear_attachments_info(); + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* release_attachments_info(); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* mutable_attachments_info(); + void set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& _internal_attachments_info() const; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _internal_mutable_attachments_info(); + public: + void unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* unsafe_arena_release_attachments_info(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 3; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ReceiveAttachmentsEnd final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) */ { + public: + inline SharingLog_ReceiveAttachmentsEnd() : SharingLog_ReceiveAttachmentsEnd(nullptr) {} + ~SharingLog_ReceiveAttachmentsEnd() override; + explicit constexpr SharingLog_ReceiveAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ReceiveAttachmentsEnd(const SharingLog_ReceiveAttachmentsEnd& from); + SharingLog_ReceiveAttachmentsEnd(SharingLog_ReceiveAttachmentsEnd&& from) noexcept + : SharingLog_ReceiveAttachmentsEnd() { + *this = ::std::move(from); + } + + inline SharingLog_ReceiveAttachmentsEnd& operator=(const SharingLog_ReceiveAttachmentsEnd& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ReceiveAttachmentsEnd& operator=(SharingLog_ReceiveAttachmentsEnd&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ReceiveAttachmentsEnd& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ReceiveAttachmentsEnd* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ReceiveAttachmentsEnd_default_instance_); + } + static constexpr int kIndexInFileMessages = + 29; + + friend void swap(SharingLog_ReceiveAttachmentsEnd& a, SharingLog_ReceiveAttachmentsEnd& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ReceiveAttachmentsEnd* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ReceiveAttachmentsEnd* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ReceiveAttachmentsEnd* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ReceiveAttachmentsEnd& from); + void MergeFrom(const SharingLog_ReceiveAttachmentsEnd& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ReceiveAttachmentsEnd* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd"; + } + protected: + explicit SharingLog_ReceiveAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 4, + kShareTargetInfoFieldNumber = 5, + kSessionIdFieldNumber = 1, + kReceivedBytesFieldNumber = 2, + kStatusFieldNumber = 3, + }; + // optional string referrer_name = 4; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 5; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int64 received_bytes = 2; + bool has_received_bytes() const; + private: + bool _internal_has_received_bytes() const; + public: + void clear_received_bytes(); + int64_t received_bytes() const; + void set_received_bytes(int64_t value); + private: + int64_t _internal_received_bytes() const; + void _internal_set_received_bytes(int64_t value); + public: + + // optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::AttachmentTransmissionStatus status() const; + void set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value); + private: + ::location::nearby::proto::sharing::AttachmentTransmissionStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + int64_t received_bytes_; + int status_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_CancelConnection final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.CancelConnection) */ { + public: + inline SharingLog_CancelConnection() : SharingLog_CancelConnection(nullptr) {} + ~SharingLog_CancelConnection() override; + explicit constexpr SharingLog_CancelConnection(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_CancelConnection(const SharingLog_CancelConnection& from); + SharingLog_CancelConnection(SharingLog_CancelConnection&& from) noexcept + : SharingLog_CancelConnection() { + *this = ::std::move(from); + } + + inline SharingLog_CancelConnection& operator=(const SharingLog_CancelConnection& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_CancelConnection& operator=(SharingLog_CancelConnection&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_CancelConnection& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_CancelConnection* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_CancelConnection_default_instance_); + } + static constexpr int kIndexInFileMessages = + 30; + + friend void swap(SharingLog_CancelConnection& a, SharingLog_CancelConnection& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_CancelConnection* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_CancelConnection* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_CancelConnection* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_CancelConnection& from); + void MergeFrom(const SharingLog_CancelConnection& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_CancelConnection* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.CancelConnection"; + } + protected: + explicit SharingLog_CancelConnection(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSessionIdFieldNumber = 1, + kTransferPositionFieldNumber = 2, + kConcurrentConnectionsFieldNumber = 3, + }; + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int32 transfer_position = 2; + bool has_transfer_position() const; + private: + bool _internal_has_transfer_position() const; + public: + void clear_transfer_position(); + int32_t transfer_position() const; + void set_transfer_position(int32_t value); + private: + int32_t _internal_transfer_position() const; + void _internal_set_transfer_position(int32_t value); + public: + + // optional int32 concurrent_connections = 3; + bool has_concurrent_connections() const; + private: + bool _internal_has_concurrent_connections() const; + public: + void clear_concurrent_connections(); + int32_t concurrent_connections() const; + void set_concurrent_connections(int32_t value); + private: + int32_t _internal_concurrent_connections() const; + void _internal_set_concurrent_connections(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.CancelConnection) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t session_id_; + int32_t transfer_position_; + int32_t concurrent_connections_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_CancelSendingAttachments final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) */ { + public: + inline SharingLog_CancelSendingAttachments() : SharingLog_CancelSendingAttachments(nullptr) {} + ~SharingLog_CancelSendingAttachments() override; + explicit constexpr SharingLog_CancelSendingAttachments(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_CancelSendingAttachments(const SharingLog_CancelSendingAttachments& from); + SharingLog_CancelSendingAttachments(SharingLog_CancelSendingAttachments&& from) noexcept + : SharingLog_CancelSendingAttachments() { + *this = ::std::move(from); + } + + inline SharingLog_CancelSendingAttachments& operator=(const SharingLog_CancelSendingAttachments& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_CancelSendingAttachments& operator=(SharingLog_CancelSendingAttachments&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_CancelSendingAttachments& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_CancelSendingAttachments* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_CancelSendingAttachments_default_instance_); + } + static constexpr int kIndexInFileMessages = + 31; + + friend void swap(SharingLog_CancelSendingAttachments& a, SharingLog_CancelSendingAttachments& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_CancelSendingAttachments* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_CancelSendingAttachments* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_CancelSendingAttachments* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_CancelSendingAttachments& from); + void MergeFrom(const SharingLog_CancelSendingAttachments& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_CancelSendingAttachments* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments"; + } + protected: + explicit SharingLog_CancelSendingAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_CancelReceivingAttachments final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) */ { + public: + inline SharingLog_CancelReceivingAttachments() : SharingLog_CancelReceivingAttachments(nullptr) {} + ~SharingLog_CancelReceivingAttachments() override; + explicit constexpr SharingLog_CancelReceivingAttachments(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_CancelReceivingAttachments(const SharingLog_CancelReceivingAttachments& from); + SharingLog_CancelReceivingAttachments(SharingLog_CancelReceivingAttachments&& from) noexcept + : SharingLog_CancelReceivingAttachments() { + *this = ::std::move(from); + } + + inline SharingLog_CancelReceivingAttachments& operator=(const SharingLog_CancelReceivingAttachments& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_CancelReceivingAttachments& operator=(SharingLog_CancelReceivingAttachments&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_CancelReceivingAttachments& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_CancelReceivingAttachments* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_CancelReceivingAttachments_default_instance_); + } + static constexpr int kIndexInFileMessages = + 32; + + friend void swap(SharingLog_CancelReceivingAttachments& a, SharingLog_CancelReceivingAttachments& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_CancelReceivingAttachments* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_CancelReceivingAttachments* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_CancelReceivingAttachments* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_CancelReceivingAttachments& from); + void MergeFrom(const SharingLog_CancelReceivingAttachments& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_CancelReceivingAttachments* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments"; + } + protected: + explicit SharingLog_CancelReceivingAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ProcessReceivedAttachmentsEnd final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) */ { + public: + inline SharingLog_ProcessReceivedAttachmentsEnd() : SharingLog_ProcessReceivedAttachmentsEnd(nullptr) {} + ~SharingLog_ProcessReceivedAttachmentsEnd() override; + explicit constexpr SharingLog_ProcessReceivedAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ProcessReceivedAttachmentsEnd(const SharingLog_ProcessReceivedAttachmentsEnd& from); + SharingLog_ProcessReceivedAttachmentsEnd(SharingLog_ProcessReceivedAttachmentsEnd&& from) noexcept + : SharingLog_ProcessReceivedAttachmentsEnd() { + *this = ::std::move(from); + } + + inline SharingLog_ProcessReceivedAttachmentsEnd& operator=(const SharingLog_ProcessReceivedAttachmentsEnd& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ProcessReceivedAttachmentsEnd& operator=(SharingLog_ProcessReceivedAttachmentsEnd&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ProcessReceivedAttachmentsEnd& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ProcessReceivedAttachmentsEnd* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ProcessReceivedAttachmentsEnd_default_instance_); + } + static constexpr int kIndexInFileMessages = + 33; + + friend void swap(SharingLog_ProcessReceivedAttachmentsEnd& a, SharingLog_ProcessReceivedAttachmentsEnd& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ProcessReceivedAttachmentsEnd* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ProcessReceivedAttachmentsEnd* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ProcessReceivedAttachmentsEnd* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ProcessReceivedAttachmentsEnd& from); + void MergeFrom(const SharingLog_ProcessReceivedAttachmentsEnd& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ProcessReceivedAttachmentsEnd* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd"; + } + protected: + explicit SharingLog_ProcessReceivedAttachmentsEnd(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSessionIdFieldNumber = 1, + kStatusFieldNumber = 2, + }; + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.ProcessReceivedAttachmentsStatus status = 2; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus status() const; + void set_status(::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus value); + private: + ::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t session_id_; + int status_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_OpenReceivedAttachments final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) */ { + public: + inline SharingLog_OpenReceivedAttachments() : SharingLog_OpenReceivedAttachments(nullptr) {} + ~SharingLog_OpenReceivedAttachments() override; + explicit constexpr SharingLog_OpenReceivedAttachments(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_OpenReceivedAttachments(const SharingLog_OpenReceivedAttachments& from); + SharingLog_OpenReceivedAttachments(SharingLog_OpenReceivedAttachments&& from) noexcept + : SharingLog_OpenReceivedAttachments() { + *this = ::std::move(from); + } + + inline SharingLog_OpenReceivedAttachments& operator=(const SharingLog_OpenReceivedAttachments& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_OpenReceivedAttachments& operator=(SharingLog_OpenReceivedAttachments&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_OpenReceivedAttachments& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_OpenReceivedAttachments* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_OpenReceivedAttachments_default_instance_); + } + static constexpr int kIndexInFileMessages = + 34; + + friend void swap(SharingLog_OpenReceivedAttachments& a, SharingLog_OpenReceivedAttachments& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_OpenReceivedAttachments* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_OpenReceivedAttachments* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_OpenReceivedAttachments* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_OpenReceivedAttachments& from); + void MergeFrom(const SharingLog_OpenReceivedAttachments& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_OpenReceivedAttachments* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments"; + } + protected: + explicit SharingLog_OpenReceivedAttachments(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAttachmentsInfoFieldNumber = 3, + kSessionIdFieldNumber = 4, + }; + // optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 3; + bool has_attachments_info() const; + private: + bool _internal_has_attachments_info() const; + public: + void clear_attachments_info(); + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& attachments_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* release_attachments_info(); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* mutable_attachments_info(); + void set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& _internal_attachments_info() const; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _internal_mutable_attachments_info(); + public: + void unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info); + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* unsafe_arena_release_attachments_info(); + + // optional int64 session_id = 4; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info_; + int64_t session_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_LaunchSetupActivity final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) */ { + public: + inline SharingLog_LaunchSetupActivity() : SharingLog_LaunchSetupActivity(nullptr) {} + ~SharingLog_LaunchSetupActivity() override; + explicit constexpr SharingLog_LaunchSetupActivity(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_LaunchSetupActivity(const SharingLog_LaunchSetupActivity& from); + SharingLog_LaunchSetupActivity(SharingLog_LaunchSetupActivity&& from) noexcept + : SharingLog_LaunchSetupActivity() { + *this = ::std::move(from); + } + + inline SharingLog_LaunchSetupActivity& operator=(const SharingLog_LaunchSetupActivity& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_LaunchSetupActivity& operator=(SharingLog_LaunchSetupActivity&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_LaunchSetupActivity& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_LaunchSetupActivity* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_LaunchSetupActivity_default_instance_); + } + static constexpr int kIndexInFileMessages = + 35; + + friend void swap(SharingLog_LaunchSetupActivity& a, SharingLog_LaunchSetupActivity& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_LaunchSetupActivity* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_LaunchSetupActivity* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_LaunchSetupActivity* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_LaunchSetupActivity& from); + void MergeFrom(const SharingLog_LaunchSetupActivity& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_LaunchSetupActivity* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity"; + } + protected: + explicit SharingLog_LaunchSetupActivity(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.LaunchSetupActivity) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AddContact final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AddContact) */ { + public: + inline SharingLog_AddContact() : SharingLog_AddContact(nullptr) {} + ~SharingLog_AddContact() override; + explicit constexpr SharingLog_AddContact(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AddContact(const SharingLog_AddContact& from); + SharingLog_AddContact(SharingLog_AddContact&& from) noexcept + : SharingLog_AddContact() { + *this = ::std::move(from); + } + + inline SharingLog_AddContact& operator=(const SharingLog_AddContact& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AddContact& operator=(SharingLog_AddContact&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AddContact& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AddContact* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AddContact_default_instance_); + } + static constexpr int kIndexInFileMessages = + 36; + + friend void swap(SharingLog_AddContact& a, SharingLog_AddContact& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AddContact* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AddContact* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AddContact* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AddContact& from); + void MergeFrom(const SharingLog_AddContact& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AddContact* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AddContact"; + } + protected: + explicit SharingLog_AddContact(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kWasPhoneAddedFieldNumber = 1, + kWasEmailAddedFieldNumber = 2, + }; + // optional bool was_phone_added = 1; + bool has_was_phone_added() const; + private: + bool _internal_has_was_phone_added() const; + public: + void clear_was_phone_added(); + bool was_phone_added() const; + void set_was_phone_added(bool value); + private: + bool _internal_was_phone_added() const; + void _internal_set_was_phone_added(bool value); + public: + + // optional bool was_email_added = 2; + bool has_was_email_added() const; + private: + bool _internal_has_was_email_added() const; + public: + void clear_was_email_added(); + bool was_email_added() const; + void set_was_email_added(bool value); + private: + bool _internal_was_email_added() const; + void _internal_set_was_email_added(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AddContact) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + bool was_phone_added_; + bool was_email_added_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_RemoveContact final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.RemoveContact) */ { + public: + inline SharingLog_RemoveContact() : SharingLog_RemoveContact(nullptr) {} + ~SharingLog_RemoveContact() override; + explicit constexpr SharingLog_RemoveContact(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_RemoveContact(const SharingLog_RemoveContact& from); + SharingLog_RemoveContact(SharingLog_RemoveContact&& from) noexcept + : SharingLog_RemoveContact() { + *this = ::std::move(from); + } + + inline SharingLog_RemoveContact& operator=(const SharingLog_RemoveContact& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_RemoveContact& operator=(SharingLog_RemoveContact&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_RemoveContact& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_RemoveContact* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_RemoveContact_default_instance_); + } + static constexpr int kIndexInFileMessages = + 37; + + friend void swap(SharingLog_RemoveContact& a, SharingLog_RemoveContact& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_RemoveContact* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_RemoveContact* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_RemoveContact* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_RemoveContact& from); + void MergeFrom(const SharingLog_RemoveContact& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_RemoveContact* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.RemoveContact"; + } + protected: + explicit SharingLog_RemoveContact(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kWasPhoneRemovedFieldNumber = 1, + kWasEmailRemovedFieldNumber = 2, + }; + // optional bool was_phone_removed = 1; + bool has_was_phone_removed() const; + private: + bool _internal_has_was_phone_removed() const; + public: + void clear_was_phone_removed(); + bool was_phone_removed() const; + void set_was_phone_removed(bool value); + private: + bool _internal_was_phone_removed() const; + void _internal_set_was_phone_removed(bool value); + public: + + // optional bool was_email_removed = 2; + bool has_was_email_removed() const; + private: + bool _internal_has_was_email_removed() const; + public: + void clear_was_email_removed(); + bool was_email_removed() const; + void set_was_email_removed(bool value); + private: + bool _internal_was_email_removed() const; + void _internal_set_was_email_removed(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.RemoveContact) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + bool was_phone_removed_; + bool was_email_removed_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_FastShareServerResponse final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) */ { + public: + inline SharingLog_FastShareServerResponse() : SharingLog_FastShareServerResponse(nullptr) {} + ~SharingLog_FastShareServerResponse() override; + explicit constexpr SharingLog_FastShareServerResponse(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_FastShareServerResponse(const SharingLog_FastShareServerResponse& from); + SharingLog_FastShareServerResponse(SharingLog_FastShareServerResponse&& from) noexcept + : SharingLog_FastShareServerResponse() { + *this = ::std::move(from); + } + + inline SharingLog_FastShareServerResponse& operator=(const SharingLog_FastShareServerResponse& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_FastShareServerResponse& operator=(SharingLog_FastShareServerResponse&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_FastShareServerResponse& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_FastShareServerResponse* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_FastShareServerResponse_default_instance_); + } + static constexpr int kIndexInFileMessages = + 38; + + friend void swap(SharingLog_FastShareServerResponse& a, SharingLog_FastShareServerResponse& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_FastShareServerResponse* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_FastShareServerResponse* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_FastShareServerResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_FastShareServerResponse& from); + void MergeFrom(const SharingLog_FastShareServerResponse& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_FastShareServerResponse* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse"; + } + protected: + explicit SharingLog_FastShareServerResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatusFieldNumber = 1, + kNameFieldNumber = 2, + kLatencyMillisFieldNumber = 3, + kPurposeFieldNumber = 4, + kRequesterFieldNumber = 5, + kDeviceTypeFieldNumber = 6, + }; + // optional .location.nearby.proto.sharing.ServerResponseState status = 1; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::ServerResponseState status() const; + void set_status(::location::nearby::proto::sharing::ServerResponseState value); + private: + ::location::nearby::proto::sharing::ServerResponseState _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::ServerResponseState value); + public: + + // optional .location.nearby.proto.sharing.ServerActionName name = 2; + bool has_name() const; + private: + bool _internal_has_name() const; + public: + void clear_name(); + ::location::nearby::proto::sharing::ServerActionName name() const; + void set_name(::location::nearby::proto::sharing::ServerActionName value); + private: + ::location::nearby::proto::sharing::ServerActionName _internal_name() const; + void _internal_set_name(::location::nearby::proto::sharing::ServerActionName value); + public: + + // optional int64 latency_millis = 3; + bool has_latency_millis() const; + private: + bool _internal_has_latency_millis() const; + public: + void clear_latency_millis(); + int64_t latency_millis() const; + void set_latency_millis(int64_t value); + private: + int64_t _internal_latency_millis() const; + void _internal_set_latency_millis(int64_t value); + public: + + // optional .location.nearby.proto.sharing.SyncPurpose purpose = 4; + bool has_purpose() const; + private: + bool _internal_has_purpose() const; + public: + void clear_purpose(); + ::location::nearby::proto::sharing::SyncPurpose purpose() const; + void set_purpose(::location::nearby::proto::sharing::SyncPurpose value); + private: + ::location::nearby::proto::sharing::SyncPurpose _internal_purpose() const; + void _internal_set_purpose(::location::nearby::proto::sharing::SyncPurpose value); + public: + + // optional .location.nearby.proto.sharing.ClientRole requester = 5; + bool has_requester() const; + private: + bool _internal_has_requester() const; + public: + void clear_requester(); + ::location::nearby::proto::sharing::ClientRole requester() const; + void set_requester(::location::nearby::proto::sharing::ClientRole value); + private: + ::location::nearby::proto::sharing::ClientRole _internal_requester() const; + void _internal_set_requester(::location::nearby::proto::sharing::ClientRole value); + public: + + // optional .location.nearby.proto.sharing.DeviceType device_type = 6; + bool has_device_type() const; + private: + bool _internal_has_device_type() const; + public: + void clear_device_type(); + ::location::nearby::proto::sharing::DeviceType device_type() const; + void set_device_type(::location::nearby::proto::sharing::DeviceType value); + private: + ::location::nearby::proto::sharing::DeviceType _internal_device_type() const; + void _internal_set_device_type(::location::nearby::proto::sharing::DeviceType value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int status_; + int name_; + int64_t latency_millis_; + int purpose_; + int requester_; + int device_type_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendStart final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendStart) */ { + public: + inline SharingLog_SendStart() : SharingLog_SendStart(nullptr) {} + ~SharingLog_SendStart() override; + explicit constexpr SharingLog_SendStart(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendStart(const SharingLog_SendStart& from); + SharingLog_SendStart(SharingLog_SendStart&& from) noexcept + : SharingLog_SendStart() { + *this = ::std::move(from); + } + + inline SharingLog_SendStart& operator=(const SharingLog_SendStart& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendStart& operator=(SharingLog_SendStart&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendStart& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendStart* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendStart_default_instance_); + } + static constexpr int kIndexInFileMessages = + 39; + + friend void swap(SharingLog_SendStart& a, SharingLog_SendStart& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendStart* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendStart* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendStart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendStart& from); + void MergeFrom(const SharingLog_SendStart& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendStart* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendStart"; + } + protected: + explicit SharingLog_SendStart(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShareTargetInfoFieldNumber = 4, + kSessionIdFieldNumber = 1, + kTransferPositionFieldNumber = 2, + kConcurrentConnectionsFieldNumber = 3, + }; + // optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 4; + bool has_share_target_info() const; + private: + bool _internal_has_share_target_info() const; + public: + void clear_share_target_info(); + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& share_target_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* release_share_target_info(); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* mutable_share_target_info(); + void set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& _internal_share_target_info() const; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _internal_mutable_share_target_info(); + public: + void unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info); + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* unsafe_arena_release_share_target_info(); + + // optional int64 session_id = 1; + bool has_session_id() const; + private: + bool _internal_has_session_id() const; + public: + void clear_session_id(); + int64_t session_id() const; + void set_session_id(int64_t value); + private: + int64_t _internal_session_id() const; + void _internal_set_session_id(int64_t value); + public: + + // optional int32 transfer_position = 2; + bool has_transfer_position() const; + private: + bool _internal_has_transfer_position() const; + public: + void clear_transfer_position(); + int32_t transfer_position() const; + void set_transfer_position(int32_t value); + private: + int32_t _internal_transfer_position() const; + void _internal_set_transfer_position(int32_t value); + public: + + // optional int32 concurrent_connections = 3; + bool has_concurrent_connections() const; + private: + bool _internal_has_concurrent_connections() const; + public: + void clear_concurrent_connections(); + int32_t concurrent_connections() const; + void set_concurrent_connections(int32_t value); + private: + int32_t _internal_concurrent_connections() const; + void _internal_set_concurrent_connections(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendStart) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info_; + int64_t session_id_; + int32_t transfer_position_; + int32_t concurrent_connections_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AcceptFastInitialization final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) */ { + public: + inline SharingLog_AcceptFastInitialization() : SharingLog_AcceptFastInitialization(nullptr) {} + ~SharingLog_AcceptFastInitialization() override; + explicit constexpr SharingLog_AcceptFastInitialization(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AcceptFastInitialization(const SharingLog_AcceptFastInitialization& from); + SharingLog_AcceptFastInitialization(SharingLog_AcceptFastInitialization&& from) noexcept + : SharingLog_AcceptFastInitialization() { + *this = ::std::move(from); + } + + inline SharingLog_AcceptFastInitialization& operator=(const SharingLog_AcceptFastInitialization& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AcceptFastInitialization& operator=(SharingLog_AcceptFastInitialization&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AcceptFastInitialization& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AcceptFastInitialization* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AcceptFastInitialization_default_instance_); + } + static constexpr int kIndexInFileMessages = + 40; + + friend void swap(SharingLog_AcceptFastInitialization& a, SharingLog_AcceptFastInitialization& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AcceptFastInitialization* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AcceptFastInitialization* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AcceptFastInitialization* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AcceptFastInitialization& from); + void MergeFrom(const SharingLog_AcceptFastInitialization& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AcceptFastInitialization* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization"; + } + protected: + explicit SharingLog_AcceptFastInitialization(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_LaunchActivity final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) */ { + public: + inline SharingLog_LaunchActivity() : SharingLog_LaunchActivity(nullptr) {} + ~SharingLog_LaunchActivity() override; + explicit constexpr SharingLog_LaunchActivity(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_LaunchActivity(const SharingLog_LaunchActivity& from); + SharingLog_LaunchActivity(SharingLog_LaunchActivity&& from) noexcept + : SharingLog_LaunchActivity() { + *this = ::std::move(from); + } + + inline SharingLog_LaunchActivity& operator=(const SharingLog_LaunchActivity& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_LaunchActivity& operator=(SharingLog_LaunchActivity&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_LaunchActivity& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_LaunchActivity* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_LaunchActivity_default_instance_); + } + static constexpr int kIndexInFileMessages = + 41; + + friend void swap(SharingLog_LaunchActivity& a, SharingLog_LaunchActivity& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_LaunchActivity* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_LaunchActivity* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_LaunchActivity* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_LaunchActivity& from); + void MergeFrom(const SharingLog_LaunchActivity& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_LaunchActivity* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.LaunchActivity"; + } + protected: + explicit SharingLog_LaunchActivity(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kReferrerNameFieldNumber = 3, + kDurationMillisFieldNumber = 2, + kActivityNameFieldNumber = 1, + kPreviousTransferInProgressFieldNumber = 4, + kHasOptedInFieldNumber = 5, + kIsFinishingFieldNumber = 7, + kSourceActivityNameFieldNumber = 6, + }; + // optional string referrer_name = 3; + bool has_referrer_name() const; + private: + bool _internal_has_referrer_name() const; + public: + void clear_referrer_name(); + const std::string& referrer_name() const; + template + void set_referrer_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_referrer_name(); + PROTOBUF_NODISCARD std::string* release_referrer_name(); + void set_allocated_referrer_name(std::string* referrer_name); + private: + const std::string& _internal_referrer_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_referrer_name(const std::string& value); + std::string* _internal_mutable_referrer_name(); + public: + + // optional int64 duration_millis = 2; + bool has_duration_millis() const; + private: + bool _internal_has_duration_millis() const; + public: + void clear_duration_millis(); + int64_t duration_millis() const; + void set_duration_millis(int64_t value); + private: + int64_t _internal_duration_millis() const; + void _internal_set_duration_millis(int64_t value); + public: + + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + bool has_activity_name() const; + private: + bool _internal_has_activity_name() const; + public: + void clear_activity_name(); + ::location::nearby::proto::sharing::ActivityName activity_name() const; + void set_activity_name(::location::nearby::proto::sharing::ActivityName value); + private: + ::location::nearby::proto::sharing::ActivityName _internal_activity_name() const; + void _internal_set_activity_name(::location::nearby::proto::sharing::ActivityName value); + public: + + // optional bool previous_transfer_in_progress = 4; + bool has_previous_transfer_in_progress() const; + private: + bool _internal_has_previous_transfer_in_progress() const; + public: + void clear_previous_transfer_in_progress(); + bool previous_transfer_in_progress() const; + void set_previous_transfer_in_progress(bool value); + private: + bool _internal_previous_transfer_in_progress() const; + void _internal_set_previous_transfer_in_progress(bool value); + public: + + // optional bool has_opted_in = 5; + bool has_has_opted_in() const; + private: + bool _internal_has_has_opted_in() const; + public: + void clear_has_opted_in(); + bool has_opted_in() const; + void set_has_opted_in(bool value); + private: + bool _internal_has_opted_in() const; + void _internal_set_has_opted_in(bool value); + public: + + // optional bool is_finishing = 7; + bool has_is_finishing() const; + private: + bool _internal_has_is_finishing() const; + public: + void clear_is_finishing(); + bool is_finishing() const; + void set_is_finishing(bool value); + private: + bool _internal_is_finishing() const; + void _internal_set_is_finishing(bool value); + public: + + // optional .location.nearby.proto.sharing.ActivityName source_activity_name = 6; + bool has_source_activity_name() const; + private: + bool _internal_has_source_activity_name() const; + public: + void clear_source_activity_name(); + ::location::nearby::proto::sharing::ActivityName source_activity_name() const; + void set_source_activity_name(::location::nearby::proto::sharing::ActivityName value); + private: + ::location::nearby::proto::sharing::ActivityName _internal_source_activity_name() const; + void _internal_set_source_activity_name(::location::nearby::proto::sharing::ActivityName value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.LaunchActivity) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr referrer_name_; + int64_t duration_millis_; + int activity_name_; + bool previous_transfer_in_progress_; + bool has_opted_in_; + bool is_finishing_; + int source_activity_name_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DismissPrivacyNotification final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) */ { + public: + inline SharingLog_DismissPrivacyNotification() : SharingLog_DismissPrivacyNotification(nullptr) {} + ~SharingLog_DismissPrivacyNotification() override; + explicit constexpr SharingLog_DismissPrivacyNotification(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DismissPrivacyNotification(const SharingLog_DismissPrivacyNotification& from); + SharingLog_DismissPrivacyNotification(SharingLog_DismissPrivacyNotification&& from) noexcept + : SharingLog_DismissPrivacyNotification() { + *this = ::std::move(from); + } + + inline SharingLog_DismissPrivacyNotification& operator=(const SharingLog_DismissPrivacyNotification& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DismissPrivacyNotification& operator=(SharingLog_DismissPrivacyNotification&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DismissPrivacyNotification& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DismissPrivacyNotification* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DismissPrivacyNotification_default_instance_); + } + static constexpr int kIndexInFileMessages = + 42; + + friend void swap(SharingLog_DismissPrivacyNotification& a, SharingLog_DismissPrivacyNotification& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DismissPrivacyNotification* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DismissPrivacyNotification* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DismissPrivacyNotification* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DismissPrivacyNotification& from); + void MergeFrom(const SharingLog_DismissPrivacyNotification& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DismissPrivacyNotification* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification"; + } + protected: + explicit SharingLog_DismissPrivacyNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TapPrivacyNotification final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) */ { + public: + inline SharingLog_TapPrivacyNotification() : SharingLog_TapPrivacyNotification(nullptr) {} + ~SharingLog_TapPrivacyNotification() override; + explicit constexpr SharingLog_TapPrivacyNotification(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TapPrivacyNotification(const SharingLog_TapPrivacyNotification& from); + SharingLog_TapPrivacyNotification(SharingLog_TapPrivacyNotification&& from) noexcept + : SharingLog_TapPrivacyNotification() { + *this = ::std::move(from); + } + + inline SharingLog_TapPrivacyNotification& operator=(const SharingLog_TapPrivacyNotification& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TapPrivacyNotification& operator=(SharingLog_TapPrivacyNotification&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TapPrivacyNotification& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TapPrivacyNotification* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TapPrivacyNotification_default_instance_); + } + static constexpr int kIndexInFileMessages = + 43; + + friend void swap(SharingLog_TapPrivacyNotification& a, SharingLog_TapPrivacyNotification& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TapPrivacyNotification* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TapPrivacyNotification* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TapPrivacyNotification* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TapPrivacyNotification& from); + void MergeFrom(const SharingLog_TapPrivacyNotification& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TapPrivacyNotification* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification"; + } + protected: + explicit SharingLog_TapPrivacyNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TapHelp final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TapHelp) */ { + public: + inline SharingLog_TapHelp() : SharingLog_TapHelp(nullptr) {} + ~SharingLog_TapHelp() override; + explicit constexpr SharingLog_TapHelp(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TapHelp(const SharingLog_TapHelp& from); + SharingLog_TapHelp(SharingLog_TapHelp&& from) noexcept + : SharingLog_TapHelp() { + *this = ::std::move(from); + } + + inline SharingLog_TapHelp& operator=(const SharingLog_TapHelp& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TapHelp& operator=(SharingLog_TapHelp&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TapHelp& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TapHelp* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TapHelp_default_instance_); + } + static constexpr int kIndexInFileMessages = + 44; + + friend void swap(SharingLog_TapHelp& a, SharingLog_TapHelp& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TapHelp* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TapHelp* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TapHelp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TapHelp& from); + void MergeFrom(const SharingLog_TapHelp& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TapHelp* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TapHelp"; + } + protected: + explicit SharingLog_TapHelp(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TapHelp) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TapFeedback final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TapFeedback) */ { + public: + inline SharingLog_TapFeedback() : SharingLog_TapFeedback(nullptr) {} + ~SharingLog_TapFeedback() override; + explicit constexpr SharingLog_TapFeedback(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TapFeedback(const SharingLog_TapFeedback& from); + SharingLog_TapFeedback(SharingLog_TapFeedback&& from) noexcept + : SharingLog_TapFeedback() { + *this = ::std::move(from); + } + + inline SharingLog_TapFeedback& operator=(const SharingLog_TapFeedback& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TapFeedback& operator=(SharingLog_TapFeedback&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TapFeedback& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TapFeedback* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TapFeedback_default_instance_); + } + static constexpr int kIndexInFileMessages = + 45; + + friend void swap(SharingLog_TapFeedback& a, SharingLog_TapFeedback& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TapFeedback* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TapFeedback* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TapFeedback* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TapFeedback& from); + void MergeFrom(const SharingLog_TapFeedback& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TapFeedback* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TapFeedback"; + } + protected: + explicit SharingLog_TapFeedback(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TapFeedback) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AddQuickSettingsTile final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) */ { + public: + inline SharingLog_AddQuickSettingsTile() : SharingLog_AddQuickSettingsTile(nullptr) {} + ~SharingLog_AddQuickSettingsTile() override; + explicit constexpr SharingLog_AddQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AddQuickSettingsTile(const SharingLog_AddQuickSettingsTile& from); + SharingLog_AddQuickSettingsTile(SharingLog_AddQuickSettingsTile&& from) noexcept + : SharingLog_AddQuickSettingsTile() { + *this = ::std::move(from); + } + + inline SharingLog_AddQuickSettingsTile& operator=(const SharingLog_AddQuickSettingsTile& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AddQuickSettingsTile& operator=(SharingLog_AddQuickSettingsTile&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AddQuickSettingsTile& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AddQuickSettingsTile* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AddQuickSettingsTile_default_instance_); + } + static constexpr int kIndexInFileMessages = + 46; + + friend void swap(SharingLog_AddQuickSettingsTile& a, SharingLog_AddQuickSettingsTile& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AddQuickSettingsTile* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AddQuickSettingsTile* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AddQuickSettingsTile* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AddQuickSettingsTile& from); + void MergeFrom(const SharingLog_AddQuickSettingsTile& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AddQuickSettingsTile* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile"; + } + protected: + explicit SharingLog_AddQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_RemoveQuickSettingsTile final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) */ { + public: + inline SharingLog_RemoveQuickSettingsTile() : SharingLog_RemoveQuickSettingsTile(nullptr) {} + ~SharingLog_RemoveQuickSettingsTile() override; + explicit constexpr SharingLog_RemoveQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_RemoveQuickSettingsTile(const SharingLog_RemoveQuickSettingsTile& from); + SharingLog_RemoveQuickSettingsTile(SharingLog_RemoveQuickSettingsTile&& from) noexcept + : SharingLog_RemoveQuickSettingsTile() { + *this = ::std::move(from); + } + + inline SharingLog_RemoveQuickSettingsTile& operator=(const SharingLog_RemoveQuickSettingsTile& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_RemoveQuickSettingsTile& operator=(SharingLog_RemoveQuickSettingsTile&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_RemoveQuickSettingsTile& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_RemoveQuickSettingsTile* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_RemoveQuickSettingsTile_default_instance_); + } + static constexpr int kIndexInFileMessages = + 47; + + friend void swap(SharingLog_RemoveQuickSettingsTile& a, SharingLog_RemoveQuickSettingsTile& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_RemoveQuickSettingsTile* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_RemoveQuickSettingsTile* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_RemoveQuickSettingsTile* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_RemoveQuickSettingsTile& from); + void MergeFrom(const SharingLog_RemoveQuickSettingsTile& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_RemoveQuickSettingsTile* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile"; + } + protected: + explicit SharingLog_RemoveQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_LaunchPhoneConsent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) */ { + public: + inline SharingLog_LaunchPhoneConsent() : SharingLog_LaunchPhoneConsent(nullptr) {} + ~SharingLog_LaunchPhoneConsent() override; + explicit constexpr SharingLog_LaunchPhoneConsent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_LaunchPhoneConsent(const SharingLog_LaunchPhoneConsent& from); + SharingLog_LaunchPhoneConsent(SharingLog_LaunchPhoneConsent&& from) noexcept + : SharingLog_LaunchPhoneConsent() { + *this = ::std::move(from); + } + + inline SharingLog_LaunchPhoneConsent& operator=(const SharingLog_LaunchPhoneConsent& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_LaunchPhoneConsent& operator=(SharingLog_LaunchPhoneConsent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_LaunchPhoneConsent& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_LaunchPhoneConsent* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_LaunchPhoneConsent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 48; + + friend void swap(SharingLog_LaunchPhoneConsent& a, SharingLog_LaunchPhoneConsent& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_LaunchPhoneConsent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_LaunchPhoneConsent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_LaunchPhoneConsent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_LaunchPhoneConsent& from); + void MergeFrom(const SharingLog_LaunchPhoneConsent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_LaunchPhoneConsent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent"; + } + protected: + explicit SharingLog_LaunchPhoneConsent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DisplayPhoneConsent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) */ { + public: + inline SharingLog_DisplayPhoneConsent() : SharingLog_DisplayPhoneConsent(nullptr) {} + ~SharingLog_DisplayPhoneConsent() override; + explicit constexpr SharingLog_DisplayPhoneConsent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DisplayPhoneConsent(const SharingLog_DisplayPhoneConsent& from); + SharingLog_DisplayPhoneConsent(SharingLog_DisplayPhoneConsent&& from) noexcept + : SharingLog_DisplayPhoneConsent() { + *this = ::std::move(from); + } + + inline SharingLog_DisplayPhoneConsent& operator=(const SharingLog_DisplayPhoneConsent& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DisplayPhoneConsent& operator=(SharingLog_DisplayPhoneConsent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DisplayPhoneConsent& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DisplayPhoneConsent* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DisplayPhoneConsent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 49; + + friend void swap(SharingLog_DisplayPhoneConsent& a, SharingLog_DisplayPhoneConsent& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DisplayPhoneConsent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DisplayPhoneConsent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DisplayPhoneConsent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DisplayPhoneConsent& from); + void MergeFrom(const SharingLog_DisplayPhoneConsent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DisplayPhoneConsent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent"; + } + protected: + explicit SharingLog_DisplayPhoneConsent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TapQuickSettingsTile final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) */ { + public: + inline SharingLog_TapQuickSettingsTile() : SharingLog_TapQuickSettingsTile(nullptr) {} + ~SharingLog_TapQuickSettingsTile() override; + explicit constexpr SharingLog_TapQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TapQuickSettingsTile(const SharingLog_TapQuickSettingsTile& from); + SharingLog_TapQuickSettingsTile(SharingLog_TapQuickSettingsTile&& from) noexcept + : SharingLog_TapQuickSettingsTile() { + *this = ::std::move(from); + } + + inline SharingLog_TapQuickSettingsTile& operator=(const SharingLog_TapQuickSettingsTile& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TapQuickSettingsTile& operator=(SharingLog_TapQuickSettingsTile&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TapQuickSettingsTile& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TapQuickSettingsTile* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TapQuickSettingsTile_default_instance_); + } + static constexpr int kIndexInFileMessages = + 50; + + friend void swap(SharingLog_TapQuickSettingsTile& a, SharingLog_TapQuickSettingsTile& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TapQuickSettingsTile* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TapQuickSettingsTile* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TapQuickSettingsTile* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TapQuickSettingsTile& from); + void MergeFrom(const SharingLog_TapQuickSettingsTile& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TapQuickSettingsTile* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile"; + } + protected: + explicit SharingLog_TapQuickSettingsTile(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TapQuickSettingsFileShare final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) */ { + public: + inline SharingLog_TapQuickSettingsFileShare() : SharingLog_TapQuickSettingsFileShare(nullptr) {} + ~SharingLog_TapQuickSettingsFileShare() override; + explicit constexpr SharingLog_TapQuickSettingsFileShare(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TapQuickSettingsFileShare(const SharingLog_TapQuickSettingsFileShare& from); + SharingLog_TapQuickSettingsFileShare(SharingLog_TapQuickSettingsFileShare&& from) noexcept + : SharingLog_TapQuickSettingsFileShare() { + *this = ::std::move(from); + } + + inline SharingLog_TapQuickSettingsFileShare& operator=(const SharingLog_TapQuickSettingsFileShare& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TapQuickSettingsFileShare& operator=(SharingLog_TapQuickSettingsFileShare&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TapQuickSettingsFileShare& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TapQuickSettingsFileShare* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TapQuickSettingsFileShare_default_instance_); + } + static constexpr int kIndexInFileMessages = + 51; + + friend void swap(SharingLog_TapQuickSettingsFileShare& a, SharingLog_TapQuickSettingsFileShare& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TapQuickSettingsFileShare* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TapQuickSettingsFileShare* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TapQuickSettingsFileShare* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TapQuickSettingsFileShare& from); + void MergeFrom(const SharingLog_TapQuickSettingsFileShare& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TapQuickSettingsFileShare* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare"; + } + protected: + explicit SharingLog_TapQuickSettingsFileShare(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DisplayPrivacyNotification final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) */ { + public: + inline SharingLog_DisplayPrivacyNotification() : SharingLog_DisplayPrivacyNotification(nullptr) {} + ~SharingLog_DisplayPrivacyNotification() override; + explicit constexpr SharingLog_DisplayPrivacyNotification(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DisplayPrivacyNotification(const SharingLog_DisplayPrivacyNotification& from); + SharingLog_DisplayPrivacyNotification(SharingLog_DisplayPrivacyNotification&& from) noexcept + : SharingLog_DisplayPrivacyNotification() { + *this = ::std::move(from); + } + + inline SharingLog_DisplayPrivacyNotification& operator=(const SharingLog_DisplayPrivacyNotification& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DisplayPrivacyNotification& operator=(SharingLog_DisplayPrivacyNotification&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DisplayPrivacyNotification& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DisplayPrivacyNotification* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DisplayPrivacyNotification_default_instance_); + } + static constexpr int kIndexInFileMessages = + 52; + + friend void swap(SharingLog_DisplayPrivacyNotification& a, SharingLog_DisplayPrivacyNotification& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DisplayPrivacyNotification* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DisplayPrivacyNotification* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DisplayPrivacyNotification* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DisplayPrivacyNotification& from); + void MergeFrom(const SharingLog_DisplayPrivacyNotification& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DisplayPrivacyNotification* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification"; + } + protected: + explicit SharingLog_DisplayPrivacyNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DefaultOptIn final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) */ { + public: + inline SharingLog_DefaultOptIn() : SharingLog_DefaultOptIn(nullptr) {} + ~SharingLog_DefaultOptIn() override; + explicit constexpr SharingLog_DefaultOptIn(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DefaultOptIn(const SharingLog_DefaultOptIn& from); + SharingLog_DefaultOptIn(SharingLog_DefaultOptIn&& from) noexcept + : SharingLog_DefaultOptIn() { + *this = ::std::move(from); + } + + inline SharingLog_DefaultOptIn& operator=(const SharingLog_DefaultOptIn& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DefaultOptIn& operator=(SharingLog_DefaultOptIn&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DefaultOptIn& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DefaultOptIn* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DefaultOptIn_default_instance_); + } + static constexpr int kIndexInFileMessages = + 53; + + friend void swap(SharingLog_DefaultOptIn& a, SharingLog_DefaultOptIn& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DefaultOptIn* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DefaultOptIn* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DefaultOptIn* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DefaultOptIn& from); + void MergeFrom(const SharingLog_DefaultOptIn& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DefaultOptIn* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DefaultOptIn"; + } + protected: + explicit SharingLog_DefaultOptIn(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DefaultOptIn) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SetDeviceName final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) */ { + public: + inline SharingLog_SetDeviceName() : SharingLog_SetDeviceName(nullptr) {} + ~SharingLog_SetDeviceName() override; + explicit constexpr SharingLog_SetDeviceName(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SetDeviceName(const SharingLog_SetDeviceName& from); + SharingLog_SetDeviceName(SharingLog_SetDeviceName&& from) noexcept + : SharingLog_SetDeviceName() { + *this = ::std::move(from); + } + + inline SharingLog_SetDeviceName& operator=(const SharingLog_SetDeviceName& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SetDeviceName& operator=(SharingLog_SetDeviceName&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SetDeviceName& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SetDeviceName* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SetDeviceName_default_instance_); + } + static constexpr int kIndexInFileMessages = + 54; + + friend void swap(SharingLog_SetDeviceName& a, SharingLog_SetDeviceName& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SetDeviceName* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SetDeviceName* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SetDeviceName* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SetDeviceName& from); + void MergeFrom(const SharingLog_SetDeviceName& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SetDeviceName* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SetDeviceName"; + } + protected: + explicit SharingLog_SetDeviceName(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceNameSizeFieldNumber = 1, + }; + // optional int32 device_name_size = 1; + bool has_device_name_size() const; + private: + bool _internal_has_device_name_size() const; + public: + void clear_device_name_size(); + int32_t device_name_size() const; + void set_device_name_size(int32_t value); + private: + int32_t _internal_device_name_size() const; + void _internal_set_device_name_size(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SetDeviceName) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int32_t device_name_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_RequestSettingPermissions final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) */ { + public: + inline SharingLog_RequestSettingPermissions() : SharingLog_RequestSettingPermissions(nullptr) {} + ~SharingLog_RequestSettingPermissions() override; + explicit constexpr SharingLog_RequestSettingPermissions(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_RequestSettingPermissions(const SharingLog_RequestSettingPermissions& from); + SharingLog_RequestSettingPermissions(SharingLog_RequestSettingPermissions&& from) noexcept + : SharingLog_RequestSettingPermissions() { + *this = ::std::move(from); + } + + inline SharingLog_RequestSettingPermissions& operator=(const SharingLog_RequestSettingPermissions& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_RequestSettingPermissions& operator=(SharingLog_RequestSettingPermissions&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_RequestSettingPermissions& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_RequestSettingPermissions* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_RequestSettingPermissions_default_instance_); + } + static constexpr int kIndexInFileMessages = + 55; + + friend void swap(SharingLog_RequestSettingPermissions& a, SharingLog_RequestSettingPermissions& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_RequestSettingPermissions* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_RequestSettingPermissions* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_RequestSettingPermissions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_RequestSettingPermissions& from); + void MergeFrom(const SharingLog_RequestSettingPermissions& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_RequestSettingPermissions* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions"; + } + protected: + explicit SharingLog_RequestSettingPermissions(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPermissionTypeFieldNumber = 1, + kPermissionRequestResultFieldNumber = 2, + }; + // optional .location.nearby.proto.sharing.PermissionRequestType permission_type = 1; + bool has_permission_type() const; + private: + bool _internal_has_permission_type() const; + public: + void clear_permission_type(); + ::location::nearby::proto::sharing::PermissionRequestType permission_type() const; + void set_permission_type(::location::nearby::proto::sharing::PermissionRequestType value); + private: + ::location::nearby::proto::sharing::PermissionRequestType _internal_permission_type() const; + void _internal_set_permission_type(::location::nearby::proto::sharing::PermissionRequestType value); + public: + + // optional .location.nearby.proto.sharing.PermissionRequestResult permission_request_result = 2; + bool has_permission_request_result() const; + private: + bool _internal_has_permission_request_result() const; + public: + void clear_permission_request_result(); + ::location::nearby::proto::sharing::PermissionRequestResult permission_request_result() const; + void set_permission_request_result(::location::nearby::proto::sharing::PermissionRequestResult value); + private: + ::location::nearby::proto::sharing::PermissionRequestResult _internal_permission_request_result() const; + void _internal_set_permission_request_result(::location::nearby::proto::sharing::PermissionRequestResult value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int permission_type_; + int permission_request_result_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_LaunchConsent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) */ { + public: + inline SharingLog_LaunchConsent() : SharingLog_LaunchConsent(nullptr) {} + ~SharingLog_LaunchConsent() override; + explicit constexpr SharingLog_LaunchConsent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_LaunchConsent(const SharingLog_LaunchConsent& from); + SharingLog_LaunchConsent(SharingLog_LaunchConsent&& from) noexcept + : SharingLog_LaunchConsent() { + *this = ::std::move(from); + } + + inline SharingLog_LaunchConsent& operator=(const SharingLog_LaunchConsent& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_LaunchConsent& operator=(SharingLog_LaunchConsent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_LaunchConsent& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_LaunchConsent* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_LaunchConsent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 56; + + friend void swap(SharingLog_LaunchConsent& a, SharingLog_LaunchConsent& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_LaunchConsent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_LaunchConsent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_LaunchConsent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_LaunchConsent& from); + void MergeFrom(const SharingLog_LaunchConsent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_LaunchConsent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.LaunchConsent"; + } + protected: + explicit SharingLog_LaunchConsent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kConsentTypeFieldNumber = 1, + kStatusFieldNumber = 2, + }; + // optional .location.nearby.proto.sharing.ConsentType consent_type = 1; + bool has_consent_type() const; + private: + bool _internal_has_consent_type() const; + public: + void clear_consent_type(); + ::location::nearby::proto::sharing::ConsentType consent_type() const; + void set_consent_type(::location::nearby::proto::sharing::ConsentType value); + private: + ::location::nearby::proto::sharing::ConsentType _internal_consent_type() const; + void _internal_set_consent_type(::location::nearby::proto::sharing::ConsentType value); + public: + + // optional .location.nearby.proto.sharing.ConsentAcceptanceStatus status = 2; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::ConsentAcceptanceStatus status() const; + void set_status(::location::nearby::proto::sharing::ConsentAcceptanceStatus value); + private: + ::location::nearby::proto::sharing::ConsentAcceptanceStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::ConsentAcceptanceStatus value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.LaunchConsent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int consent_type_; + int status_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_InstallAPKStatus final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) */ { + public: + inline SharingLog_InstallAPKStatus() : SharingLog_InstallAPKStatus(nullptr) {} + ~SharingLog_InstallAPKStatus() override; + explicit constexpr SharingLog_InstallAPKStatus(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_InstallAPKStatus(const SharingLog_InstallAPKStatus& from); + SharingLog_InstallAPKStatus(SharingLog_InstallAPKStatus&& from) noexcept + : SharingLog_InstallAPKStatus() { + *this = ::std::move(from); + } + + inline SharingLog_InstallAPKStatus& operator=(const SharingLog_InstallAPKStatus& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_InstallAPKStatus& operator=(SharingLog_InstallAPKStatus&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_InstallAPKStatus& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_InstallAPKStatus* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_InstallAPKStatus_default_instance_); + } + static constexpr int kIndexInFileMessages = + 57; + + friend void swap(SharingLog_InstallAPKStatus& a, SharingLog_InstallAPKStatus& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_InstallAPKStatus* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_InstallAPKStatus* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_InstallAPKStatus* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_InstallAPKStatus& from); + void MergeFrom(const SharingLog_InstallAPKStatus& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_InstallAPKStatus* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus"; + } + protected: + explicit SharingLog_InstallAPKStatus(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatusFieldNumber = 1, + kSourceFieldNumber = 2, + }; + // repeated .location.nearby.proto.sharing.InstallAPKStatus status = 1 [packed = true]; + int status_size() const; + private: + int _internal_status_size() const; + public: + void clear_status(); + private: + ::location::nearby::proto::sharing::InstallAPKStatus _internal_status(int index) const; + void _internal_add_status(::location::nearby::proto::sharing::InstallAPKStatus value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_status(); + public: + ::location::nearby::proto::sharing::InstallAPKStatus status(int index) const; + void set_status(int index, ::location::nearby::proto::sharing::InstallAPKStatus value); + void add_status(::location::nearby::proto::sharing::InstallAPKStatus value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& status() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_status(); + + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + int source_size() const; + private: + int _internal_source_size() const; + public: + void clear_source(); + private: + ::location::nearby::proto::sharing::ApkSource _internal_source(int index) const; + void _internal_add_source(::location::nearby::proto::sharing::ApkSource value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_source(); + public: + ::location::nearby::proto::sharing::ApkSource source(int index) const; + void set_source(int index, ::location::nearby::proto::sharing::ApkSource value); + void add_source(::location::nearby::proto::sharing::ApkSource value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& source() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_source(); + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField status_; + mutable std::atomic _status_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField source_; + mutable std::atomic _source_cached_byte_size_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_VerifyAPKStatus final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) */ { + public: + inline SharingLog_VerifyAPKStatus() : SharingLog_VerifyAPKStatus(nullptr) {} + ~SharingLog_VerifyAPKStatus() override; + explicit constexpr SharingLog_VerifyAPKStatus(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_VerifyAPKStatus(const SharingLog_VerifyAPKStatus& from); + SharingLog_VerifyAPKStatus(SharingLog_VerifyAPKStatus&& from) noexcept + : SharingLog_VerifyAPKStatus() { + *this = ::std::move(from); + } + + inline SharingLog_VerifyAPKStatus& operator=(const SharingLog_VerifyAPKStatus& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_VerifyAPKStatus& operator=(SharingLog_VerifyAPKStatus&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_VerifyAPKStatus& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_VerifyAPKStatus* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_VerifyAPKStatus_default_instance_); + } + static constexpr int kIndexInFileMessages = + 58; + + friend void swap(SharingLog_VerifyAPKStatus& a, SharingLog_VerifyAPKStatus& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_VerifyAPKStatus* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_VerifyAPKStatus* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_VerifyAPKStatus* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_VerifyAPKStatus& from); + void MergeFrom(const SharingLog_VerifyAPKStatus& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_VerifyAPKStatus* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus"; + } + protected: + explicit SharingLog_VerifyAPKStatus(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatusFieldNumber = 1, + kSourceFieldNumber = 2, + }; + // repeated .location.nearby.proto.sharing.VerifyAPKStatus status = 1 [packed = true]; + int status_size() const; + private: + int _internal_status_size() const; + public: + void clear_status(); + private: + ::location::nearby::proto::sharing::VerifyAPKStatus _internal_status(int index) const; + void _internal_add_status(::location::nearby::proto::sharing::VerifyAPKStatus value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_status(); + public: + ::location::nearby::proto::sharing::VerifyAPKStatus status(int index) const; + void set_status(int index, ::location::nearby::proto::sharing::VerifyAPKStatus value); + void add_status(::location::nearby::proto::sharing::VerifyAPKStatus value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& status() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_status(); + + // repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; + int source_size() const; + private: + int _internal_source_size() const; + public: + void clear_source(); + private: + ::location::nearby::proto::sharing::ApkSource _internal_source(int index) const; + void _internal_add_source(::location::nearby::proto::sharing::ApkSource value); + ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_source(); + public: + ::location::nearby::proto::sharing::ApkSource source(int index) const; + void set_source(int index, ::location::nearby::proto::sharing::ApkSource value); + void add_source(::location::nearby::proto::sharing::ApkSource value); + const ::PROTOBUF_NAMESPACE_ID::RepeatedField& source() const; + ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_source(); + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField status_; + mutable std::atomic _status_cached_byte_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedField source_; + mutable std::atomic _source_cached_byte_size_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ToggleShowNotification final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) */ { + public: + inline SharingLog_ToggleShowNotification() : SharingLog_ToggleShowNotification(nullptr) {} + ~SharingLog_ToggleShowNotification() override; + explicit constexpr SharingLog_ToggleShowNotification(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ToggleShowNotification(const SharingLog_ToggleShowNotification& from); + SharingLog_ToggleShowNotification(SharingLog_ToggleShowNotification&& from) noexcept + : SharingLog_ToggleShowNotification() { + *this = ::std::move(from); + } + + inline SharingLog_ToggleShowNotification& operator=(const SharingLog_ToggleShowNotification& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ToggleShowNotification& operator=(SharingLog_ToggleShowNotification&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ToggleShowNotification& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ToggleShowNotification* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ToggleShowNotification_default_instance_); + } + static constexpr int kIndexInFileMessages = + 59; + + friend void swap(SharingLog_ToggleShowNotification& a, SharingLog_ToggleShowNotification& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ToggleShowNotification* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ToggleShowNotification* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ToggleShowNotification* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ToggleShowNotification& from); + void MergeFrom(const SharingLog_ToggleShowNotification& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ToggleShowNotification* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification"; + } + protected: + explicit SharingLog_ToggleShowNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPreviousStatusFieldNumber = 1, + kCurrentStatusFieldNumber = 2, + }; + // optional .location.nearby.proto.sharing.ShowNotificationStatus previous_status = 1; + bool has_previous_status() const; + private: + bool _internal_has_previous_status() const; + public: + void clear_previous_status(); + ::location::nearby::proto::sharing::ShowNotificationStatus previous_status() const; + void set_previous_status(::location::nearby::proto::sharing::ShowNotificationStatus value); + private: + ::location::nearby::proto::sharing::ShowNotificationStatus _internal_previous_status() const; + void _internal_set_previous_status(::location::nearby::proto::sharing::ShowNotificationStatus value); + public: + + // optional .location.nearby.proto.sharing.ShowNotificationStatus current_status = 2; + bool has_current_status() const; + private: + bool _internal_has_current_status() const; + public: + void clear_current_status(); + ::location::nearby::proto::sharing::ShowNotificationStatus current_status() const; + void set_current_status(::location::nearby::proto::sharing::ShowNotificationStatus value); + private: + ::location::nearby::proto::sharing::ShowNotificationStatus _internal_current_status() const; + void _internal_set_current_status(::location::nearby::proto::sharing::ShowNotificationStatus value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int previous_status_; + int current_status_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_DecryptCertificateFailure final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) */ { + public: + inline SharingLog_DecryptCertificateFailure() : SharingLog_DecryptCertificateFailure(nullptr) {} + ~SharingLog_DecryptCertificateFailure() override; + explicit constexpr SharingLog_DecryptCertificateFailure(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_DecryptCertificateFailure(const SharingLog_DecryptCertificateFailure& from); + SharingLog_DecryptCertificateFailure(SharingLog_DecryptCertificateFailure&& from) noexcept + : SharingLog_DecryptCertificateFailure() { + *this = ::std::move(from); + } + + inline SharingLog_DecryptCertificateFailure& operator=(const SharingLog_DecryptCertificateFailure& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_DecryptCertificateFailure& operator=(SharingLog_DecryptCertificateFailure&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_DecryptCertificateFailure& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_DecryptCertificateFailure* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_DecryptCertificateFailure_default_instance_); + } + static constexpr int kIndexInFileMessages = + 60; + + friend void swap(SharingLog_DecryptCertificateFailure& a, SharingLog_DecryptCertificateFailure& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_DecryptCertificateFailure* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_DecryptCertificateFailure* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_DecryptCertificateFailure* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_DecryptCertificateFailure& from); + void MergeFrom(const SharingLog_DecryptCertificateFailure& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_DecryptCertificateFailure* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure"; + } + protected: + explicit SharingLog_DecryptCertificateFailure(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStatusFieldNumber = 1, + }; + // optional .location.nearby.proto.sharing.DecryptCertificateFailureStatus status = 1; + bool has_status() const; + private: + bool _internal_has_status() const; + public: + void clear_status(); + ::location::nearby::proto::sharing::DecryptCertificateFailureStatus status() const; + void set_status(::location::nearby::proto::sharing::DecryptCertificateFailureStatus value); + private: + ::location::nearby::proto::sharing::DecryptCertificateFailureStatus _internal_status() const; + void _internal_set_status(::location::nearby::proto::sharing::DecryptCertificateFailureStatus value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int status_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ShowAllowPermissionAutoAccess final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) */ { + public: + inline SharingLog_ShowAllowPermissionAutoAccess() : SharingLog_ShowAllowPermissionAutoAccess(nullptr) {} + ~SharingLog_ShowAllowPermissionAutoAccess() override; + explicit constexpr SharingLog_ShowAllowPermissionAutoAccess(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ShowAllowPermissionAutoAccess(const SharingLog_ShowAllowPermissionAutoAccess& from); + SharingLog_ShowAllowPermissionAutoAccess(SharingLog_ShowAllowPermissionAutoAccess&& from) noexcept + : SharingLog_ShowAllowPermissionAutoAccess() { + *this = ::std::move(from); + } + + inline SharingLog_ShowAllowPermissionAutoAccess& operator=(const SharingLog_ShowAllowPermissionAutoAccess& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ShowAllowPermissionAutoAccess& operator=(SharingLog_ShowAllowPermissionAutoAccess&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ShowAllowPermissionAutoAccess& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ShowAllowPermissionAutoAccess* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ShowAllowPermissionAutoAccess_default_instance_); + } + static constexpr int kIndexInFileMessages = + 61; + + friend void swap(SharingLog_ShowAllowPermissionAutoAccess& a, SharingLog_ShowAllowPermissionAutoAccess& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ShowAllowPermissionAutoAccess* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ShowAllowPermissionAutoAccess* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ShowAllowPermissionAutoAccess* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ShowAllowPermissionAutoAccess& from); + void MergeFrom(const SharingLog_ShowAllowPermissionAutoAccess& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ShowAllowPermissionAutoAccess* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess"; + } + protected: + explicit SharingLog_ShowAllowPermissionAutoAccess(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kActivityNameFieldNumber = 1, + kAllowedAutoAccessFieldNumber = 2, + kIsWifiMissingFieldNumber = 3, + kIsBtMissingFieldNumber = 4, + }; + // optional .location.nearby.proto.sharing.ActivityName activity_name = 1; + bool has_activity_name() const; + private: + bool _internal_has_activity_name() const; + public: + void clear_activity_name(); + ::location::nearby::proto::sharing::ActivityName activity_name() const; + void set_activity_name(::location::nearby::proto::sharing::ActivityName value); + private: + ::location::nearby::proto::sharing::ActivityName _internal_activity_name() const; + void _internal_set_activity_name(::location::nearby::proto::sharing::ActivityName value); + public: + + // optional bool allowed_auto_access = 2; + bool has_allowed_auto_access() const; + private: + bool _internal_has_allowed_auto_access() const; + public: + void clear_allowed_auto_access(); + bool allowed_auto_access() const; + void set_allowed_auto_access(bool value); + private: + bool _internal_allowed_auto_access() const; + void _internal_set_allowed_auto_access(bool value); + public: + + // optional bool is_wifi_missing = 3; + bool has_is_wifi_missing() const; + private: + bool _internal_has_is_wifi_missing() const; + public: + void clear_is_wifi_missing(); + bool is_wifi_missing() const; + void set_is_wifi_missing(bool value); + private: + bool _internal_is_wifi_missing() const; + void _internal_set_is_wifi_missing(bool value); + public: + + // optional bool is_bt_missing = 4; + bool has_is_bt_missing() const; + private: + bool _internal_has_is_bt_missing() const; + public: + void clear_is_bt_missing(); + bool is_bt_missing() const; + void set_is_bt_missing(bool value); + private: + bool _internal_is_bt_missing() const; + void _internal_set_is_bt_missing(bool value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int activity_name_; + bool allowed_auto_access_; + bool is_wifi_missing_; + bool is_bt_missing_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TapQrCode final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TapQrCode) */ { + public: + inline SharingLog_TapQrCode() : SharingLog_TapQrCode(nullptr) {} + ~SharingLog_TapQrCode() override; + explicit constexpr SharingLog_TapQrCode(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TapQrCode(const SharingLog_TapQrCode& from); + SharingLog_TapQrCode(SharingLog_TapQrCode&& from) noexcept + : SharingLog_TapQrCode() { + *this = ::std::move(from); + } + + inline SharingLog_TapQrCode& operator=(const SharingLog_TapQrCode& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TapQrCode& operator=(SharingLog_TapQrCode&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TapQrCode& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TapQrCode* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TapQrCode_default_instance_); + } + static constexpr int kIndexInFileMessages = + 62; + + friend void swap(SharingLog_TapQrCode& a, SharingLog_TapQrCode& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TapQrCode* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TapQrCode* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TapQrCode* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TapQrCode& from); + void MergeFrom(const SharingLog_TapQrCode& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TapQrCode* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TapQrCode"; + } + protected: + explicit SharingLog_TapQrCode(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TapQrCode) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_QrCodeLinkShown final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) */ { + public: + inline SharingLog_QrCodeLinkShown() : SharingLog_QrCodeLinkShown(nullptr) {} + ~SharingLog_QrCodeLinkShown() override; + explicit constexpr SharingLog_QrCodeLinkShown(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_QrCodeLinkShown(const SharingLog_QrCodeLinkShown& from); + SharingLog_QrCodeLinkShown(SharingLog_QrCodeLinkShown&& from) noexcept + : SharingLog_QrCodeLinkShown() { + *this = ::std::move(from); + } + + inline SharingLog_QrCodeLinkShown& operator=(const SharingLog_QrCodeLinkShown& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_QrCodeLinkShown& operator=(SharingLog_QrCodeLinkShown&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_QrCodeLinkShown& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_QrCodeLinkShown* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_QrCodeLinkShown_default_instance_); + } + static constexpr int kIndexInFileMessages = + 63; + + friend void swap(SharingLog_QrCodeLinkShown& a, SharingLog_QrCodeLinkShown& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_QrCodeLinkShown* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_QrCodeLinkShown* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_QrCodeLinkShown* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_QrCodeLinkShown& from); + void MergeFrom(const SharingLog_QrCodeLinkShown& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_QrCodeLinkShown* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown"; + } + protected: + explicit SharingLog_QrCodeLinkShown(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_FastInitDiscoverDevice final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) */ { + public: + inline SharingLog_FastInitDiscoverDevice() : SharingLog_FastInitDiscoverDevice(nullptr) {} + ~SharingLog_FastInitDiscoverDevice() override; + explicit constexpr SharingLog_FastInitDiscoverDevice(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_FastInitDiscoverDevice(const SharingLog_FastInitDiscoverDevice& from); + SharingLog_FastInitDiscoverDevice(SharingLog_FastInitDiscoverDevice&& from) noexcept + : SharingLog_FastInitDiscoverDevice() { + *this = ::std::move(from); + } + + inline SharingLog_FastInitDiscoverDevice& operator=(const SharingLog_FastInitDiscoverDevice& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_FastInitDiscoverDevice& operator=(SharingLog_FastInitDiscoverDevice&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_FastInitDiscoverDevice& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_FastInitDiscoverDevice* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_FastInitDiscoverDevice_default_instance_); + } + static constexpr int kIndexInFileMessages = + 64; + + friend void swap(SharingLog_FastInitDiscoverDevice& a, SharingLog_FastInitDiscoverDevice& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_FastInitDiscoverDevice* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_FastInitDiscoverDevice* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_FastInitDiscoverDevice* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_FastInitDiscoverDevice& from); + void MergeFrom(const SharingLog_FastInitDiscoverDevice& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_FastInitDiscoverDevice* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice"; + } + protected: + explicit SharingLog_FastInitDiscoverDevice(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFastInitTypeFieldNumber = 2, + kFastInitStateFieldNumber = 3, + }; + // optional .location.nearby.proto.sharing.FastInitType fast_init_type = 2; + bool has_fast_init_type() const; + private: + bool _internal_has_fast_init_type() const; + public: + void clear_fast_init_type(); + ::location::nearby::proto::sharing::FastInitType fast_init_type() const; + void set_fast_init_type(::location::nearby::proto::sharing::FastInitType value); + private: + ::location::nearby::proto::sharing::FastInitType _internal_fast_init_type() const; + void _internal_set_fast_init_type(::location::nearby::proto::sharing::FastInitType value); + public: + + // optional .location.nearby.proto.sharing.FastInitState fast_init_state = 3; + bool has_fast_init_state() const; + private: + bool _internal_has_fast_init_state() const; + public: + void clear_fast_init_state(); + ::location::nearby::proto::sharing::FastInitState fast_init_state() const; + void set_fast_init_state(::location::nearby::proto::sharing::FastInitState value); + private: + ::location::nearby::proto::sharing::FastInitState _internal_fast_init_state() const; + void _internal_set_fast_init_state(::location::nearby::proto::sharing::FastInitState value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int fast_init_type_; + int fast_init_state_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_ShareTargetInfo final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) */ { + public: + inline SharingLog_ShareTargetInfo() : SharingLog_ShareTargetInfo(nullptr) {} + ~SharingLog_ShareTargetInfo() override; + explicit constexpr SharingLog_ShareTargetInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_ShareTargetInfo(const SharingLog_ShareTargetInfo& from); + SharingLog_ShareTargetInfo(SharingLog_ShareTargetInfo&& from) noexcept + : SharingLog_ShareTargetInfo() { + *this = ::std::move(from); + } + + inline SharingLog_ShareTargetInfo& operator=(const SharingLog_ShareTargetInfo& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_ShareTargetInfo& operator=(SharingLog_ShareTargetInfo&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_ShareTargetInfo& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_ShareTargetInfo* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_ShareTargetInfo_default_instance_); + } + static constexpr int kIndexInFileMessages = + 65; + + friend void swap(SharingLog_ShareTargetInfo& a, SharingLog_ShareTargetInfo& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_ShareTargetInfo* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_ShareTargetInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_ShareTargetInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_ShareTargetInfo& from); + void MergeFrom(const SharingLog_ShareTargetInfo& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_ShareTargetInfo* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo"; + } + protected: + explicit SharingLog_ShareTargetInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceTypeFieldNumber = 1, + kOsTypeFieldNumber = 2, + kDeviceRelationshipFieldNumber = 3, + }; + // optional .location.nearby.proto.sharing.DeviceType device_type = 1; + bool has_device_type() const; + private: + bool _internal_has_device_type() const; + public: + void clear_device_type(); + ::location::nearby::proto::sharing::DeviceType device_type() const; + void set_device_type(::location::nearby::proto::sharing::DeviceType value); + private: + ::location::nearby::proto::sharing::DeviceType _internal_device_type() const; + void _internal_set_device_type(::location::nearby::proto::sharing::DeviceType value); + public: + + // optional .location.nearby.proto.sharing.OSType os_type = 2; + bool has_os_type() const; + private: + bool _internal_has_os_type() const; + public: + void clear_os_type(); + ::location::nearby::proto::sharing::OSType os_type() const; + void set_os_type(::location::nearby::proto::sharing::OSType value); + private: + ::location::nearby::proto::sharing::OSType _internal_os_type() const; + void _internal_set_os_type(::location::nearby::proto::sharing::OSType value); + public: + + // optional .location.nearby.proto.sharing.DeviceRelationship device_relationship = 3; + bool has_device_relationship() const; + private: + bool _internal_has_device_relationship() const; + public: + void clear_device_relationship(); + ::location::nearby::proto::sharing::DeviceRelationship device_relationship() const; + void set_device_relationship(::location::nearby::proto::sharing::DeviceRelationship value); + private: + ::location::nearby::proto::sharing::DeviceRelationship _internal_device_relationship() const; + void _internal_set_device_relationship(::location::nearby::proto::sharing::DeviceRelationship value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int device_type_; + int os_type_; + int device_relationship_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AttachmentsInfo final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) */ { + public: + inline SharingLog_AttachmentsInfo() : SharingLog_AttachmentsInfo(nullptr) {} + ~SharingLog_AttachmentsInfo() override; + explicit constexpr SharingLog_AttachmentsInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AttachmentsInfo(const SharingLog_AttachmentsInfo& from); + SharingLog_AttachmentsInfo(SharingLog_AttachmentsInfo&& from) noexcept + : SharingLog_AttachmentsInfo() { + *this = ::std::move(from); + } + + inline SharingLog_AttachmentsInfo& operator=(const SharingLog_AttachmentsInfo& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AttachmentsInfo& operator=(SharingLog_AttachmentsInfo&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AttachmentsInfo& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AttachmentsInfo* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AttachmentsInfo_default_instance_); + } + static constexpr int kIndexInFileMessages = + 66; + + friend void swap(SharingLog_AttachmentsInfo& a, SharingLog_AttachmentsInfo& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AttachmentsInfo* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AttachmentsInfo* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AttachmentsInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AttachmentsInfo& from); + void MergeFrom(const SharingLog_AttachmentsInfo& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AttachmentsInfo* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo"; + } + protected: + explicit SharingLog_AttachmentsInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kTextAttachmentFieldNumber = 1, + kFileAttachmentFieldNumber = 2, + kWifiCredentialsAttachmentFieldNumber = 4, + kAppAttachmentFieldNumber = 5, + kStreamAttachmentFieldNumber = 6, + kRequiredAppFieldNumber = 3, + }; + // repeated .nearby.sharing.analytics.proto.SharingLog.TextAttachment text_attachment = 1; + int text_attachment_size() const; + private: + int _internal_text_attachment_size() const; + public: + void clear_text_attachment(); + ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* mutable_text_attachment(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment >* + mutable_text_attachment(); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TextAttachment& _internal_text_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* _internal_add_text_attachment(); + public: + const ::nearby::sharing::analytics::proto::SharingLog_TextAttachment& text_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* add_text_attachment(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment >& + text_attachment() const; + + // repeated .nearby.sharing.analytics.proto.SharingLog.FileAttachment file_attachment = 2; + int file_attachment_size() const; + private: + int _internal_file_attachment_size() const; + public: + void clear_file_attachment(); + ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* mutable_file_attachment(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment >* + mutable_file_attachment(); + private: + const ::nearby::sharing::analytics::proto::SharingLog_FileAttachment& _internal_file_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* _internal_add_file_attachment(); + public: + const ::nearby::sharing::analytics::proto::SharingLog_FileAttachment& file_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* add_file_attachment(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment >& + file_attachment() const; + + // repeated .nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment wifi_credentials_attachment = 4; + int wifi_credentials_attachment_size() const; + private: + int _internal_wifi_credentials_attachment_size() const; + public: + void clear_wifi_credentials_attachment(); + ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* mutable_wifi_credentials_attachment(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment >* + mutable_wifi_credentials_attachment(); + private: + const ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment& _internal_wifi_credentials_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* _internal_add_wifi_credentials_attachment(); + public: + const ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment& wifi_credentials_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* add_wifi_credentials_attachment(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment >& + wifi_credentials_attachment() const; + + // repeated .nearby.sharing.analytics.proto.SharingLog.AppAttachment app_attachment = 5; + int app_attachment_size() const; + private: + int _internal_app_attachment_size() const; + public: + void clear_app_attachment(); + ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* mutable_app_attachment(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment >* + mutable_app_attachment(); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AppAttachment& _internal_app_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* _internal_add_app_attachment(); + public: + const ::nearby::sharing::analytics::proto::SharingLog_AppAttachment& app_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* add_app_attachment(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment >& + app_attachment() const; + + // repeated .nearby.sharing.analytics.proto.SharingLog.StreamAttachment stream_attachment = 6; + int stream_attachment_size() const; + private: + int _internal_stream_attachment_size() const; + public: + void clear_stream_attachment(); + ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* mutable_stream_attachment(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment >* + mutable_stream_attachment(); + private: + const ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment& _internal_stream_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* _internal_add_stream_attachment(); + public: + const ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment& stream_attachment(int index) const; + ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* add_stream_attachment(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment >& + stream_attachment() const; + + // optional string required_app = 3; + bool has_required_app() const; + private: + bool _internal_has_required_app() const; + public: + void clear_required_app(); + const std::string& required_app() const; + template + void set_required_app(ArgT0&& arg0, ArgT... args); + std::string* mutable_required_app(); + PROTOBUF_NODISCARD std::string* release_required_app(); + void set_allocated_required_app(std::string* required_app); + private: + const std::string& _internal_required_app() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_required_app(const std::string& value); + std::string* _internal_mutable_required_app(); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment > text_attachment_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment > file_attachment_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment > wifi_credentials_attachment_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment > app_attachment_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment > stream_attachment_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr required_app_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_TextAttachment final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.TextAttachment) */ { + public: + inline SharingLog_TextAttachment() : SharingLog_TextAttachment(nullptr) {} + ~SharingLog_TextAttachment() override; + explicit constexpr SharingLog_TextAttachment(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_TextAttachment(const SharingLog_TextAttachment& from); + SharingLog_TextAttachment(SharingLog_TextAttachment&& from) noexcept + : SharingLog_TextAttachment() { + *this = ::std::move(from); + } + + inline SharingLog_TextAttachment& operator=(const SharingLog_TextAttachment& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_TextAttachment& operator=(SharingLog_TextAttachment&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_TextAttachment& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_TextAttachment* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_TextAttachment_default_instance_); + } + static constexpr int kIndexInFileMessages = + 67; + + friend void swap(SharingLog_TextAttachment& a, SharingLog_TextAttachment& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_TextAttachment* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_TextAttachment* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_TextAttachment* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_TextAttachment& from); + void MergeFrom(const SharingLog_TextAttachment& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_TextAttachment* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.TextAttachment"; + } + protected: + explicit SharingLog_TextAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef SharingLog_TextAttachment_Type Type; + static constexpr Type UNKNOWN_TEXT_TYPE = + SharingLog_TextAttachment_Type_UNKNOWN_TEXT_TYPE; + static constexpr Type URL = + SharingLog_TextAttachment_Type_URL; + static constexpr Type ADDRESS = + SharingLog_TextAttachment_Type_ADDRESS; + static constexpr Type PHONE_NUMBER = + SharingLog_TextAttachment_Type_PHONE_NUMBER; + static inline bool Type_IsValid(int value) { + return SharingLog_TextAttachment_Type_IsValid(value); + } + static constexpr Type Type_MIN = + SharingLog_TextAttachment_Type_Type_MIN; + static constexpr Type Type_MAX = + SharingLog_TextAttachment_Type_Type_MAX; + static constexpr int Type_ARRAYSIZE = + SharingLog_TextAttachment_Type_Type_ARRAYSIZE; + template + static inline const std::string& Type_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Type_Name."); + return SharingLog_TextAttachment_Type_Name(enum_t_value); + } + static inline bool Type_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Type* value) { + return SharingLog_TextAttachment_Type_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kSizeBytesFieldNumber = 2, + kTypeFieldNumber = 1, + kSourceTypeFieldNumber = 4, + kBatchIdFieldNumber = 3, + }; + // optional int64 size_bytes = 2; + bool has_size_bytes() const; + private: + bool _internal_has_size_bytes() const; + public: + void clear_size_bytes(); + int64_t size_bytes() const; + void set_size_bytes(int64_t value); + private: + int64_t _internal_size_bytes() const; + void _internal_set_size_bytes(int64_t value); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.TextAttachment.Type type = 1; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + ::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type type() const; + void set_type(::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type value); + private: + ::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type _internal_type() const; + void _internal_set_type(::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type value); + public: + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + bool has_source_type() const; + private: + bool _internal_has_source_type() const; + public: + void clear_source_type(); + ::location::nearby::proto::sharing::AttachmentSourceType source_type() const; + void set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + private: + ::location::nearby::proto::sharing::AttachmentSourceType _internal_source_type() const; + void _internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + public: + + // optional int64 batch_id = 3; + bool has_batch_id() const; + private: + bool _internal_has_batch_id() const; + public: + void clear_batch_id(); + int64_t batch_id() const; + void set_batch_id(int64_t value); + private: + int64_t _internal_batch_id() const; + void _internal_set_batch_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.TextAttachment) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t size_bytes_; + int type_; + int source_type_; + int64_t batch_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_FileAttachment final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.FileAttachment) */ { + public: + inline SharingLog_FileAttachment() : SharingLog_FileAttachment(nullptr) {} + ~SharingLog_FileAttachment() override; + explicit constexpr SharingLog_FileAttachment(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_FileAttachment(const SharingLog_FileAttachment& from); + SharingLog_FileAttachment(SharingLog_FileAttachment&& from) noexcept + : SharingLog_FileAttachment() { + *this = ::std::move(from); + } + + inline SharingLog_FileAttachment& operator=(const SharingLog_FileAttachment& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_FileAttachment& operator=(SharingLog_FileAttachment&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_FileAttachment& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_FileAttachment* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_FileAttachment_default_instance_); + } + static constexpr int kIndexInFileMessages = + 68; + + friend void swap(SharingLog_FileAttachment& a, SharingLog_FileAttachment& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_FileAttachment* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_FileAttachment* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_FileAttachment* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_FileAttachment& from); + void MergeFrom(const SharingLog_FileAttachment& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_FileAttachment* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.FileAttachment"; + } + protected: + explicit SharingLog_FileAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef SharingLog_FileAttachment_Type Type; + static constexpr Type UNKNOWN_FILE_TYPE = + SharingLog_FileAttachment_Type_UNKNOWN_FILE_TYPE; + static constexpr Type IMAGE = + SharingLog_FileAttachment_Type_IMAGE; + static constexpr Type VIDEO = + SharingLog_FileAttachment_Type_VIDEO; + static constexpr Type ANDROID_APP = + SharingLog_FileAttachment_Type_ANDROID_APP; + static constexpr Type AUDIO = + SharingLog_FileAttachment_Type_AUDIO; + static constexpr Type DOCUMENT = + SharingLog_FileAttachment_Type_DOCUMENT; + static inline bool Type_IsValid(int value) { + return SharingLog_FileAttachment_Type_IsValid(value); + } + static constexpr Type Type_MIN = + SharingLog_FileAttachment_Type_Type_MIN; + static constexpr Type Type_MAX = + SharingLog_FileAttachment_Type_Type_MAX; + static constexpr int Type_ARRAYSIZE = + SharingLog_FileAttachment_Type_Type_ARRAYSIZE; + template + static inline const std::string& Type_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Type_Name."); + return SharingLog_FileAttachment_Type_Name(enum_t_value); + } + static inline bool Type_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Type* value) { + return SharingLog_FileAttachment_Type_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kSizeBytesFieldNumber = 2, + kTypeFieldNumber = 1, + kSourceTypeFieldNumber = 6, + kOffsetBytesFieldNumber = 4, + kBatchIdFieldNumber = 5, + }; + // optional int64 size_bytes = 2; + bool has_size_bytes() const; + private: + bool _internal_has_size_bytes() const; + public: + void clear_size_bytes(); + int64_t size_bytes() const; + void set_size_bytes(int64_t value); + private: + int64_t _internal_size_bytes() const; + void _internal_set_size_bytes(int64_t value); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.FileAttachment.Type type = 1; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + ::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type type() const; + void set_type(::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type value); + private: + ::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type _internal_type() const; + void _internal_set_type(::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type value); + public: + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 6; + bool has_source_type() const; + private: + bool _internal_has_source_type() const; + public: + void clear_source_type(); + ::location::nearby::proto::sharing::AttachmentSourceType source_type() const; + void set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + private: + ::location::nearby::proto::sharing::AttachmentSourceType _internal_source_type() const; + void _internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + public: + + // optional int64 offset_bytes = 4; + bool has_offset_bytes() const; + private: + bool _internal_has_offset_bytes() const; + public: + void clear_offset_bytes(); + int64_t offset_bytes() const; + void set_offset_bytes(int64_t value); + private: + int64_t _internal_offset_bytes() const; + void _internal_set_offset_bytes(int64_t value); + public: + + // optional int64 batch_id = 5; + bool has_batch_id() const; + private: + bool _internal_has_batch_id() const; + public: + void clear_batch_id(); + int64_t batch_id() const; + void set_batch_id(int64_t value); + private: + int64_t _internal_batch_id() const; + void _internal_set_batch_id(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.FileAttachment) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t size_bytes_; + int type_; + int source_type_; + int64_t offset_bytes_; + int64_t batch_id_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_WifiCredentialsAttachment final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) */ { + public: + inline SharingLog_WifiCredentialsAttachment() : SharingLog_WifiCredentialsAttachment(nullptr) {} + ~SharingLog_WifiCredentialsAttachment() override; + explicit constexpr SharingLog_WifiCredentialsAttachment(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_WifiCredentialsAttachment(const SharingLog_WifiCredentialsAttachment& from); + SharingLog_WifiCredentialsAttachment(SharingLog_WifiCredentialsAttachment&& from) noexcept + : SharingLog_WifiCredentialsAttachment() { + *this = ::std::move(from); + } + + inline SharingLog_WifiCredentialsAttachment& operator=(const SharingLog_WifiCredentialsAttachment& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_WifiCredentialsAttachment& operator=(SharingLog_WifiCredentialsAttachment&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_WifiCredentialsAttachment& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_WifiCredentialsAttachment* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_WifiCredentialsAttachment_default_instance_); + } + static constexpr int kIndexInFileMessages = + 69; + + friend void swap(SharingLog_WifiCredentialsAttachment& a, SharingLog_WifiCredentialsAttachment& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_WifiCredentialsAttachment* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_WifiCredentialsAttachment* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_WifiCredentialsAttachment* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_WifiCredentialsAttachment& from); + void MergeFrom(const SharingLog_WifiCredentialsAttachment& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_WifiCredentialsAttachment* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment"; + } + protected: + explicit SharingLog_WifiCredentialsAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBatchIdFieldNumber = 2, + kSecurityTypeFieldNumber = 1, + kSourceTypeFieldNumber = 3, + }; + // optional int64 batch_id = 2; + bool has_batch_id() const; + private: + bool _internal_has_batch_id() const; + public: + void clear_batch_id(); + int64_t batch_id() const; + void set_batch_id(int64_t value); + private: + int64_t _internal_batch_id() const; + void _internal_set_batch_id(int64_t value); + public: + + // optional int32 security_type = 1; + bool has_security_type() const; + private: + bool _internal_has_security_type() const; + public: + void clear_security_type(); + int32_t security_type() const; + void set_security_type(int32_t value); + private: + int32_t _internal_security_type() const; + void _internal_set_security_type(int32_t value); + public: + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + bool has_source_type() const; + private: + bool _internal_has_source_type() const; + public: + void clear_source_type(); + ::location::nearby::proto::sharing::AttachmentSourceType source_type() const; + void set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + private: + ::location::nearby::proto::sharing::AttachmentSourceType _internal_source_type() const; + void _internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int64_t batch_id_; + int32_t security_type_; + int source_type_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AppAttachment final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AppAttachment) */ { + public: + inline SharingLog_AppAttachment() : SharingLog_AppAttachment(nullptr) {} + ~SharingLog_AppAttachment() override; + explicit constexpr SharingLog_AppAttachment(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AppAttachment(const SharingLog_AppAttachment& from); + SharingLog_AppAttachment(SharingLog_AppAttachment&& from) noexcept + : SharingLog_AppAttachment() { + *this = ::std::move(from); + } + + inline SharingLog_AppAttachment& operator=(const SharingLog_AppAttachment& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AppAttachment& operator=(SharingLog_AppAttachment&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AppAttachment& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AppAttachment* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AppAttachment_default_instance_); + } + static constexpr int kIndexInFileMessages = + 70; + + friend void swap(SharingLog_AppAttachment& a, SharingLog_AppAttachment& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AppAttachment* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AppAttachment* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AppAttachment* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AppAttachment& from); + void MergeFrom(const SharingLog_AppAttachment& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AppAttachment* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AppAttachment"; + } + protected: + explicit SharingLog_AppAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPackageNameFieldNumber = 1, + kSizeFieldNumber = 2, + kBatchIdFieldNumber = 3, + kSourceTypeFieldNumber = 4, + }; + // optional string package_name = 1; + bool has_package_name() const; + private: + bool _internal_has_package_name() const; + public: + void clear_package_name(); + const std::string& package_name() const; + template + void set_package_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_package_name(); + PROTOBUF_NODISCARD std::string* release_package_name(); + void set_allocated_package_name(std::string* package_name); + private: + const std::string& _internal_package_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_package_name(const std::string& value); + std::string* _internal_mutable_package_name(); + public: + + // optional int64 size = 2; + bool has_size() const; + private: + bool _internal_has_size() const; + public: + void clear_size(); + int64_t size() const; + void set_size(int64_t value); + private: + int64_t _internal_size() const; + void _internal_set_size(int64_t value); + public: + + // optional int64 batch_id = 3; + bool has_batch_id() const; + private: + bool _internal_has_batch_id() const; + public: + void clear_batch_id(); + int64_t batch_id() const; + void set_batch_id(int64_t value); + private: + int64_t _internal_batch_id() const; + void _internal_set_batch_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; + bool has_source_type() const; + private: + bool _internal_has_source_type() const; + public: + void clear_source_type(); + ::location::nearby::proto::sharing::AttachmentSourceType source_type() const; + void set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + private: + ::location::nearby::proto::sharing::AttachmentSourceType _internal_source_type() const; + void _internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AppAttachment) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr package_name_; + int64_t size_; + int64_t batch_id_; + int source_type_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_StreamAttachment final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) */ { + public: + inline SharingLog_StreamAttachment() : SharingLog_StreamAttachment(nullptr) {} + ~SharingLog_StreamAttachment() override; + explicit constexpr SharingLog_StreamAttachment(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_StreamAttachment(const SharingLog_StreamAttachment& from); + SharingLog_StreamAttachment(SharingLog_StreamAttachment&& from) noexcept + : SharingLog_StreamAttachment() { + *this = ::std::move(from); + } + + inline SharingLog_StreamAttachment& operator=(const SharingLog_StreamAttachment& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_StreamAttachment& operator=(SharingLog_StreamAttachment&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_StreamAttachment& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_StreamAttachment* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_StreamAttachment_default_instance_); + } + static constexpr int kIndexInFileMessages = + 71; + + friend void swap(SharingLog_StreamAttachment& a, SharingLog_StreamAttachment& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_StreamAttachment* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_StreamAttachment* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_StreamAttachment* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_StreamAttachment& from); + void MergeFrom(const SharingLog_StreamAttachment& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_StreamAttachment* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.StreamAttachment"; + } + protected: + explicit SharingLog_StreamAttachment(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kPackageNameFieldNumber = 1, + kBatchIdFieldNumber = 2, + kSourceTypeFieldNumber = 3, + }; + // optional string package_name = 1; + bool has_package_name() const; + private: + bool _internal_has_package_name() const; + public: + void clear_package_name(); + const std::string& package_name() const; + template + void set_package_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_package_name(); + PROTOBUF_NODISCARD std::string* release_package_name(); + void set_allocated_package_name(std::string* package_name); + private: + const std::string& _internal_package_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_package_name(const std::string& value); + std::string* _internal_mutable_package_name(); + public: + + // optional int64 batch_id = 2; + bool has_batch_id() const; + private: + bool _internal_has_batch_id() const; + public: + void clear_batch_id(); + int64_t batch_id() const; + void set_batch_id(int64_t value); + private: + int64_t _internal_batch_id() const; + void _internal_set_batch_id(int64_t value); + public: + + // optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; + bool has_source_type() const; + private: + bool _internal_has_source_type() const; + public: + void clear_source_type(); + ::location::nearby::proto::sharing::AttachmentSourceType source_type() const; + void set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + private: + ::location::nearby::proto::sharing::AttachmentSourceType _internal_source_type() const; + void _internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.StreamAttachment) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr package_name_; + int64_t batch_id_; + int source_type_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_AppCrash final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.AppCrash) */ { + public: + inline SharingLog_AppCrash() : SharingLog_AppCrash(nullptr) {} + ~SharingLog_AppCrash() override; + explicit constexpr SharingLog_AppCrash(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_AppCrash(const SharingLog_AppCrash& from); + SharingLog_AppCrash(SharingLog_AppCrash&& from) noexcept + : SharingLog_AppCrash() { + *this = ::std::move(from); + } + + inline SharingLog_AppCrash& operator=(const SharingLog_AppCrash& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_AppCrash& operator=(SharingLog_AppCrash&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_AppCrash& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_AppCrash* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_AppCrash_default_instance_); + } + static constexpr int kIndexInFileMessages = + 72; + + friend void swap(SharingLog_AppCrash& a, SharingLog_AppCrash& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_AppCrash* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_AppCrash* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_AppCrash* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_AppCrash& from); + void MergeFrom(const SharingLog_AppCrash& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_AppCrash* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.AppCrash"; + } + protected: + explicit SharingLog_AppCrash(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kCrashReasonFieldNumber = 1, + }; + // optional .location.nearby.proto.sharing.AppCrashReason crash_reason = 1; + bool has_crash_reason() const; + private: + bool _internal_has_crash_reason() const; + public: + void clear_crash_reason(); + ::location::nearby::proto::sharing::AppCrashReason crash_reason() const; + void set_crash_reason(::location::nearby::proto::sharing::AppCrashReason value); + private: + ::location::nearby::proto::sharing::AppCrashReason _internal_crash_reason() const; + void _internal_set_crash_reason(::location::nearby::proto::sharing::AppCrashReason value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.AppCrash) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int crash_reason_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SetupWizard final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SetupWizard) */ { + public: + inline SharingLog_SetupWizard() : SharingLog_SetupWizard(nullptr) {} + ~SharingLog_SetupWizard() override; + explicit constexpr SharingLog_SetupWizard(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SetupWizard(const SharingLog_SetupWizard& from); + SharingLog_SetupWizard(SharingLog_SetupWizard&& from) noexcept + : SharingLog_SetupWizard() { + *this = ::std::move(from); + } + + inline SharingLog_SetupWizard& operator=(const SharingLog_SetupWizard& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SetupWizard& operator=(SharingLog_SetupWizard&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SetupWizard& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SetupWizard* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SetupWizard_default_instance_); + } + static constexpr int kIndexInFileMessages = + 73; + + friend void swap(SharingLog_SetupWizard& a, SharingLog_SetupWizard& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SetupWizard* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SetupWizard* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SetupWizard* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SetupWizard& from); + void MergeFrom(const SharingLog_SetupWizard& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SetupWizard* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SetupWizard"; + } + protected: + explicit SharingLog_SetupWizard(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kVisibilityFieldNumber = 1, + }; + // optional .location.nearby.proto.sharing.Visibility visibility = 1; + bool has_visibility() const; + private: + bool _internal_has_visibility() const; + public: + void clear_visibility(); + ::location::nearby::proto::sharing::Visibility visibility() const; + void set_visibility(::location::nearby::proto::sharing::Visibility value); + private: + ::location::nearby::proto::sharing::Visibility _internal_visibility() const; + void _internal_set_visibility(::location::nearby::proto::sharing::Visibility value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SetupWizard) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int visibility_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendDesktopNotification final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) */ { + public: + inline SharingLog_SendDesktopNotification() : SharingLog_SendDesktopNotification(nullptr) {} + ~SharingLog_SendDesktopNotification() override; + explicit constexpr SharingLog_SendDesktopNotification(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendDesktopNotification(const SharingLog_SendDesktopNotification& from); + SharingLog_SendDesktopNotification(SharingLog_SendDesktopNotification&& from) noexcept + : SharingLog_SendDesktopNotification() { + *this = ::std::move(from); + } + + inline SharingLog_SendDesktopNotification& operator=(const SharingLog_SendDesktopNotification& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendDesktopNotification& operator=(SharingLog_SendDesktopNotification&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendDesktopNotification& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendDesktopNotification* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendDesktopNotification_default_instance_); + } + static constexpr int kIndexInFileMessages = + 74; + + friend void swap(SharingLog_SendDesktopNotification& a, SharingLog_SendDesktopNotification& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendDesktopNotification* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendDesktopNotification* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendDesktopNotification* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendDesktopNotification& from); + void MergeFrom(const SharingLog_SendDesktopNotification& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendDesktopNotification* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification"; + } + protected: + explicit SharingLog_SendDesktopNotification(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEventFieldNumber = 1, + }; + // optional .location.nearby.proto.sharing.DesktopNotification event = 1; + bool has_event() const; + private: + bool _internal_has_event() const; + public: + void clear_event(); + ::location::nearby::proto::sharing::DesktopNotification event() const; + void set_event(::location::nearby::proto::sharing::DesktopNotification value); + private: + ::location::nearby::proto::sharing::DesktopNotification _internal_event() const; + void _internal_set_event(::location::nearby::proto::sharing::DesktopNotification value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int event_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog_SendDesktopTransferEvent final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) */ { + public: + inline SharingLog_SendDesktopTransferEvent() : SharingLog_SendDesktopTransferEvent(nullptr) {} + ~SharingLog_SendDesktopTransferEvent() override; + explicit constexpr SharingLog_SendDesktopTransferEvent(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog_SendDesktopTransferEvent(const SharingLog_SendDesktopTransferEvent& from); + SharingLog_SendDesktopTransferEvent(SharingLog_SendDesktopTransferEvent&& from) noexcept + : SharingLog_SendDesktopTransferEvent() { + *this = ::std::move(from); + } + + inline SharingLog_SendDesktopTransferEvent& operator=(const SharingLog_SendDesktopTransferEvent& from) { + CopyFrom(from); + return *this; + } + inline SharingLog_SendDesktopTransferEvent& operator=(SharingLog_SendDesktopTransferEvent&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog_SendDesktopTransferEvent& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog_SendDesktopTransferEvent* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_SendDesktopTransferEvent_default_instance_); + } + static constexpr int kIndexInFileMessages = + 75; + + friend void swap(SharingLog_SendDesktopTransferEvent& a, SharingLog_SendDesktopTransferEvent& b) { + a.Swap(&b); + } + inline void Swap(SharingLog_SendDesktopTransferEvent* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog_SendDesktopTransferEvent* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog_SendDesktopTransferEvent* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog_SendDesktopTransferEvent& from); + void MergeFrom(const SharingLog_SendDesktopTransferEvent& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog_SendDesktopTransferEvent* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent"; + } + protected: + explicit SharingLog_SendDesktopTransferEvent(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kEventFieldNumber = 1, + }; + // optional .location.nearby.proto.sharing.DesktopTransferEventType event = 1; + bool has_event() const; + private: + bool _internal_has_event() const; + public: + void clear_event(); + ::location::nearby::proto::sharing::DesktopTransferEventType event() const; + void set_event(::location::nearby::proto::sharing::DesktopTransferEventType value); + private: + ::location::nearby::proto::sharing::DesktopTransferEventType _internal_event() const; + void _internal_set_event(::location::nearby::proto::sharing::DesktopTransferEventType value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + int event_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// ------------------------------------------------------------------- + +class SharingLog final : + public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:nearby.sharing.analytics.proto.SharingLog) */ { + public: + inline SharingLog() : SharingLog(nullptr) {} + ~SharingLog() override; + explicit constexpr SharingLog(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + SharingLog(const SharingLog& from); + SharingLog(SharingLog&& from) noexcept + : SharingLog() { + *this = ::std::move(from); + } + + inline SharingLog& operator=(const SharingLog& from) { + CopyFrom(from); + return *this; + } + inline SharingLog& operator=(SharingLog&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const std::string& unknown_fields() const { + return _internal_metadata_.unknown_fields(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString); + } + inline std::string* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const SharingLog& default_instance() { + return *internal_default_instance(); + } + static inline const SharingLog* internal_default_instance() { + return reinterpret_cast( + &_SharingLog_default_instance_); + } + static constexpr int kIndexInFileMessages = + 76; + + friend void swap(SharingLog& a, SharingLog& b) { + a.Swap(&b); + } + inline void Swap(SharingLog* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(SharingLog* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + SharingLog* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final; + void CopyFrom(const SharingLog& from); + void MergeFrom(const SharingLog& from); + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _cached_size_.Get(); } + + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(SharingLog* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "nearby.sharing.analytics.proto.SharingLog"; + } + protected: + explicit SharingLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + private: + static void ArenaDtor(void* object); + inline void RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena); + public: + + std::string GetTypeName() const final; + + // nested types ---------------------------------------------------- + + typedef SharingLog_AppInfo AppInfo; + typedef SharingLog_DeviceSettings DeviceSettings; + typedef SharingLog_PreferencesUsage PreferencesUsage; + typedef SharingLog_UnknownEvent UnknownEvent; + typedef SharingLog_EstablishConnection EstablishConnection; + typedef SharingLog_AcceptAgreements AcceptAgreements; + typedef SharingLog_DeclineAgreements DeclineAgreements; + typedef SharingLog_EnableNearbySharing EnableNearbySharing; + typedef SharingLog_SetAccount SetAccount; + typedef SharingLog_SetVisibility SetVisibility; + typedef SharingLog_SetDataUsage SetDataUsage; + typedef SharingLog_ScanForShareTargetsStart ScanForShareTargetsStart; + typedef SharingLog_ScanForShareTargetsEnd ScanForShareTargetsEnd; + typedef SharingLog_AdvertiseDevicePresenceStart AdvertiseDevicePresenceStart; + typedef SharingLog_AdvertiseDevicePresenceEnd AdvertiseDevicePresenceEnd; + typedef SharingLog_SendFastInitialization SendFastInitialization; + typedef SharingLog_ReceiveFastInitialization ReceiveFastInitialization; + typedef SharingLog_DismissFastInitialization DismissFastInitialization; + typedef SharingLog_AutoDismissFastInitialization AutoDismissFastInitialization; + typedef SharingLog_EventMetadata EventMetadata; + typedef SharingLog_DiscoverShareTarget DiscoverShareTarget; + typedef SharingLog_ParsingFailedEndpointId ParsingFailedEndpointId; + typedef SharingLog_DescribeAttachments DescribeAttachments; + typedef SharingLog_SendIntroduction SendIntroduction; + typedef SharingLog_ReceiveIntroduction ReceiveIntroduction; + typedef SharingLog_RespondToIntroduction RespondToIntroduction; + typedef SharingLog_SendAttachmentsStart SendAttachmentsStart; + typedef SharingLog_SendAttachmentsEnd SendAttachmentsEnd; + typedef SharingLog_ReceiveAttachmentsStart ReceiveAttachmentsStart; + typedef SharingLog_ReceiveAttachmentsEnd ReceiveAttachmentsEnd; + typedef SharingLog_CancelConnection CancelConnection; + typedef SharingLog_CancelSendingAttachments CancelSendingAttachments; + typedef SharingLog_CancelReceivingAttachments CancelReceivingAttachments; + typedef SharingLog_ProcessReceivedAttachmentsEnd ProcessReceivedAttachmentsEnd; + typedef SharingLog_OpenReceivedAttachments OpenReceivedAttachments; + typedef SharingLog_LaunchSetupActivity LaunchSetupActivity; + typedef SharingLog_AddContact AddContact; + typedef SharingLog_RemoveContact RemoveContact; + typedef SharingLog_FastShareServerResponse FastShareServerResponse; + typedef SharingLog_SendStart SendStart; + typedef SharingLog_AcceptFastInitialization AcceptFastInitialization; + typedef SharingLog_LaunchActivity LaunchActivity; + typedef SharingLog_DismissPrivacyNotification DismissPrivacyNotification; + typedef SharingLog_TapPrivacyNotification TapPrivacyNotification; + typedef SharingLog_TapHelp TapHelp; + typedef SharingLog_TapFeedback TapFeedback; + typedef SharingLog_AddQuickSettingsTile AddQuickSettingsTile; + typedef SharingLog_RemoveQuickSettingsTile RemoveQuickSettingsTile; + typedef SharingLog_LaunchPhoneConsent LaunchPhoneConsent; + typedef SharingLog_DisplayPhoneConsent DisplayPhoneConsent; + typedef SharingLog_TapQuickSettingsTile TapQuickSettingsTile; + typedef SharingLog_TapQuickSettingsFileShare TapQuickSettingsFileShare; + typedef SharingLog_DisplayPrivacyNotification DisplayPrivacyNotification; + typedef SharingLog_DefaultOptIn DefaultOptIn; + typedef SharingLog_SetDeviceName SetDeviceName; + typedef SharingLog_RequestSettingPermissions RequestSettingPermissions; + typedef SharingLog_LaunchConsent LaunchConsent; + typedef SharingLog_InstallAPKStatus InstallAPKStatus; + typedef SharingLog_VerifyAPKStatus VerifyAPKStatus; + typedef SharingLog_ToggleShowNotification ToggleShowNotification; + typedef SharingLog_DecryptCertificateFailure DecryptCertificateFailure; + typedef SharingLog_ShowAllowPermissionAutoAccess ShowAllowPermissionAutoAccess; + typedef SharingLog_TapQrCode TapQrCode; + typedef SharingLog_QrCodeLinkShown QrCodeLinkShown; + typedef SharingLog_FastInitDiscoverDevice FastInitDiscoverDevice; + typedef SharingLog_ShareTargetInfo ShareTargetInfo; + typedef SharingLog_AttachmentsInfo AttachmentsInfo; + typedef SharingLog_TextAttachment TextAttachment; + typedef SharingLog_FileAttachment FileAttachment; + typedef SharingLog_WifiCredentialsAttachment WifiCredentialsAttachment; + typedef SharingLog_AppAttachment AppAttachment; + typedef SharingLog_StreamAttachment StreamAttachment; + typedef SharingLog_AppCrash AppCrash; + typedef SharingLog_SetupWizard SetupWizard; + typedef SharingLog_SendDesktopNotification SendDesktopNotification; + typedef SharingLog_SendDesktopTransferEvent SendDesktopTransferEvent; + + // accessors ------------------------------------------------------- + + enum : int { + kVersionFieldNumber = 32, + kFilesMigrationPhaseFieldNumber = 50, + kAppVersionFieldNumber = 57, + kUnknownEventFieldNumber = 2, + kAcceptAgreementsFieldNumber = 3, + kEnableNearbySharingFieldNumber = 4, + kSetVisibilityFieldNumber = 5, + kDescribeAttachmentsFieldNumber = 6, + kScanForShareTargetsStartFieldNumber = 7, + kScanForShareTargetsEndFieldNumber = 8, + kAdvertiseDevicePresenceStartFieldNumber = 9, + kAdvertiseDevicePresenceEndFieldNumber = 10, + kSendInitializationFieldNumber = 11, + kReceiveInitializationFieldNumber = 12, + kDiscoverShareTargetFieldNumber = 13, + kSendIntroductionFieldNumber = 14, + kReceiveIntroductionFieldNumber = 15, + kRespondIntroductionFieldNumber = 16, + kSendAttachmentsStartFieldNumber = 17, + kSendAttachmentsEndFieldNumber = 18, + kReceiveAttachmentsStartFieldNumber = 19, + kReceiveAttachmentsEndFieldNumber = 20, + kCancelSendingAttachmentsFieldNumber = 21, + kCancelReceivingAttachmentsFieldNumber = 22, + kOpenReceivedAttachmentsFieldNumber = 23, + kLaunchActivityFieldNumber = 24, + kAddContactFieldNumber = 25, + kRemoveContactFieldNumber = 26, + kFastShareServerResponseFieldNumber = 28, + kSendStartFieldNumber = 29, + kAcceptFastInitializationFieldNumber = 30, + kSetDataUsageFieldNumber = 31, + kDismissFastInitializationFieldNumber = 34, + kCancelConnectionFieldNumber = 35, + kDismissPrivacyNotificationFieldNumber = 36, + kTapPrivacyNotificationFieldNumber = 37, + kTapHelpFieldNumber = 38, + kTapFeedbackFieldNumber = 39, + kAddQuickSettingsTileFieldNumber = 40, + kRemoveQuickSettingsTileFieldNumber = 41, + kLaunchPhoneConsentFieldNumber = 42, + kTapQuickSettingsTileFieldNumber = 43, + kInstallApkStatusFieldNumber = 44, + kVerifyApkStatusFieldNumber = 45, + kLaunchConsentFieldNumber = 46, + kProcessReceivedAttachmentsEndFieldNumber = 47, + kToggleShowNotificationFieldNumber = 48, + kSetDeviceNameFieldNumber = 49, + kDeclineAgreementsFieldNumber = 51, + kRequestSettingPermissionsFieldNumber = 52, + kDeviceSettingsFieldNumber = 53, + kEstablishConnectionFieldNumber = 54, + kAutoDismissFastInitializationFieldNumber = 55, + kEventMetadataFieldNumber = 56, + kAppCrashFieldNumber = 58, + kTapQuickSettingsFileShareFieldNumber = 59, + kAppInfoFieldNumber = 60, + kDisplayPrivacyNotificationFieldNumber = 61, + kDisplayPhoneConsentFieldNumber = 62, + kPreferencesUsageFieldNumber = 63, + kDefaultOptInFieldNumber = 64, + kSetupWizardFieldNumber = 65, + kTapQrCodeFieldNumber = 66, + kQrCodeLinkShownFieldNumber = 67, + kParsingFailedEndpointIdFieldNumber = 68, + kFastInitDiscoverDeviceFieldNumber = 69, + kSendDesktopNotificationFieldNumber = 70, + kSendDesktopTransferEventFieldNumber = 72, + kSetAccountFieldNumber = 73, + kDecryptCertificateFailureFieldNumber = 74, + kShowAllowPermissionAutoAccessFieldNumber = 75, + kEventTypeFieldNumber = 1, + kLogSourceFieldNumber = 27, + kEventCategoryFieldNumber = 33, + }; + // optional string version = 32; + bool has_version() const; + private: + bool _internal_has_version() const; + public: + void clear_version(); + const std::string& version() const; + template + void set_version(ArgT0&& arg0, ArgT... args); + std::string* mutable_version(); + PROTOBUF_NODISCARD std::string* release_version(); + void set_allocated_version(std::string* version); + private: + const std::string& _internal_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_version(const std::string& value); + std::string* _internal_mutable_version(); + public: + + // optional string files_migration_phase = 50; + bool has_files_migration_phase() const; + private: + bool _internal_has_files_migration_phase() const; + public: + void clear_files_migration_phase(); + const std::string& files_migration_phase() const; + template + void set_files_migration_phase(ArgT0&& arg0, ArgT... args); + std::string* mutable_files_migration_phase(); + PROTOBUF_NODISCARD std::string* release_files_migration_phase(); + void set_allocated_files_migration_phase(std::string* files_migration_phase); + private: + const std::string& _internal_files_migration_phase() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_files_migration_phase(const std::string& value); + std::string* _internal_mutable_files_migration_phase(); + public: + + // optional string app_version = 57 [deprecated = true]; + PROTOBUF_DEPRECATED bool has_app_version() const; + private: + bool _internal_has_app_version() const; + public: + PROTOBUF_DEPRECATED void clear_app_version(); + PROTOBUF_DEPRECATED const std::string& app_version() const; + template + PROTOBUF_DEPRECATED void set_app_version(ArgT0&& arg0, ArgT... args); + PROTOBUF_DEPRECATED std::string* mutable_app_version(); + PROTOBUF_NODISCARD PROTOBUF_DEPRECATED std::string* release_app_version(); + PROTOBUF_DEPRECATED void set_allocated_app_version(std::string* app_version); + private: + const std::string& _internal_app_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_app_version(const std::string& value); + std::string* _internal_mutable_app_version(); + public: + + // optional .nearby.sharing.analytics.proto.SharingLog.UnknownEvent unknown_event = 2; + bool has_unknown_event() const; + private: + bool _internal_has_unknown_event() const; + public: + void clear_unknown_event(); + const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent& unknown_event() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* release_unknown_event(); + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* mutable_unknown_event(); + void set_allocated_unknown_event(::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* unknown_event); + private: + const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent& _internal_unknown_event() const; + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* _internal_mutable_unknown_event(); + public: + void unsafe_arena_set_allocated_unknown_event( + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* unknown_event); + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* unsafe_arena_release_unknown_event(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptAgreements accept_agreements = 3; + bool has_accept_agreements() const; + private: + bool _internal_has_accept_agreements() const; + public: + void clear_accept_agreements(); + const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements& accept_agreements() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* release_accept_agreements(); + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* mutable_accept_agreements(); + void set_allocated_accept_agreements(::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* accept_agreements); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements& _internal_accept_agreements() const; + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* _internal_mutable_accept_agreements(); + public: + void unsafe_arena_set_allocated_accept_agreements( + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* accept_agreements); + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* unsafe_arena_release_accept_agreements(); + + // optional .nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing enable_nearby_sharing = 4; + bool has_enable_nearby_sharing() const; + private: + bool _internal_has_enable_nearby_sharing() const; + public: + void clear_enable_nearby_sharing(); + const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing& enable_nearby_sharing() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* release_enable_nearby_sharing(); + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* mutable_enable_nearby_sharing(); + void set_allocated_enable_nearby_sharing(::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* enable_nearby_sharing); + private: + const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing& _internal_enable_nearby_sharing() const; + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* _internal_mutable_enable_nearby_sharing(); + public: + void unsafe_arena_set_allocated_enable_nearby_sharing( + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* enable_nearby_sharing); + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* unsafe_arena_release_enable_nearby_sharing(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SetVisibility set_visibility = 5; + bool has_set_visibility() const; + private: + bool _internal_has_set_visibility() const; + public: + void clear_set_visibility(); + const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility& set_visibility() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* release_set_visibility(); + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* mutable_set_visibility(); + void set_allocated_set_visibility(::nearby::sharing::analytics::proto::SharingLog_SetVisibility* set_visibility); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility& _internal_set_visibility() const; + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* _internal_mutable_set_visibility(); + public: + void unsafe_arena_set_allocated_set_visibility( + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* set_visibility); + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* unsafe_arena_release_set_visibility(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DescribeAttachments describe_attachments = 6; + bool has_describe_attachments() const; + private: + bool _internal_has_describe_attachments() const; + public: + void clear_describe_attachments(); + const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments& describe_attachments() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* release_describe_attachments(); + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* mutable_describe_attachments(); + void set_allocated_describe_attachments(::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* describe_attachments); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments& _internal_describe_attachments() const; + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* _internal_mutable_describe_attachments(); + public: + void unsafe_arena_set_allocated_describe_attachments( + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* describe_attachments); + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* unsafe_arena_release_describe_attachments(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart scan_for_share_targets_start = 7; + bool has_scan_for_share_targets_start() const; + private: + bool _internal_has_scan_for_share_targets_start() const; + public: + void clear_scan_for_share_targets_start(); + const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart& scan_for_share_targets_start() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* release_scan_for_share_targets_start(); + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* mutable_scan_for_share_targets_start(); + void set_allocated_scan_for_share_targets_start(::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* scan_for_share_targets_start); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart& _internal_scan_for_share_targets_start() const; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* _internal_mutable_scan_for_share_targets_start(); + public: + void unsafe_arena_set_allocated_scan_for_share_targets_start( + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* scan_for_share_targets_start); + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* unsafe_arena_release_scan_for_share_targets_start(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd scan_for_share_targets_end = 8; + bool has_scan_for_share_targets_end() const; + private: + bool _internal_has_scan_for_share_targets_end() const; + public: + void clear_scan_for_share_targets_end(); + const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd& scan_for_share_targets_end() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* release_scan_for_share_targets_end(); + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* mutable_scan_for_share_targets_end(); + void set_allocated_scan_for_share_targets_end(::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* scan_for_share_targets_end); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd& _internal_scan_for_share_targets_end() const; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* _internal_mutable_scan_for_share_targets_end(); + public: + void unsafe_arena_set_allocated_scan_for_share_targets_end( + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* scan_for_share_targets_end); + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* unsafe_arena_release_scan_for_share_targets_end(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart advertise_device_presence_start = 9; + bool has_advertise_device_presence_start() const; + private: + bool _internal_has_advertise_device_presence_start() const; + public: + void clear_advertise_device_presence_start(); + const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart& advertise_device_presence_start() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* release_advertise_device_presence_start(); + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* mutable_advertise_device_presence_start(); + void set_allocated_advertise_device_presence_start(::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* advertise_device_presence_start); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart& _internal_advertise_device_presence_start() const; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* _internal_mutable_advertise_device_presence_start(); + public: + void unsafe_arena_set_allocated_advertise_device_presence_start( + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* advertise_device_presence_start); + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* unsafe_arena_release_advertise_device_presence_start(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd advertise_device_presence_end = 10; + bool has_advertise_device_presence_end() const; + private: + bool _internal_has_advertise_device_presence_end() const; + public: + void clear_advertise_device_presence_end(); + const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd& advertise_device_presence_end() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* release_advertise_device_presence_end(); + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* mutable_advertise_device_presence_end(); + void set_allocated_advertise_device_presence_end(::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* advertise_device_presence_end); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd& _internal_advertise_device_presence_end() const; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* _internal_mutable_advertise_device_presence_end(); + public: + void unsafe_arena_set_allocated_advertise_device_presence_end( + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* advertise_device_presence_end); + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* unsafe_arena_release_advertise_device_presence_end(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendFastInitialization send_initialization = 11; + bool has_send_initialization() const; + private: + bool _internal_has_send_initialization() const; + public: + void clear_send_initialization(); + const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization& send_initialization() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* release_send_initialization(); + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* mutable_send_initialization(); + void set_allocated_send_initialization(::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* send_initialization); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization& _internal_send_initialization() const; + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* _internal_mutable_send_initialization(); + public: + void unsafe_arena_set_allocated_send_initialization( + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* send_initialization); + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* unsafe_arena_release_send_initialization(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization receive_initialization = 12; + bool has_receive_initialization() const; + private: + bool _internal_has_receive_initialization() const; + public: + void clear_receive_initialization(); + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization& receive_initialization() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* release_receive_initialization(); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* mutable_receive_initialization(); + void set_allocated_receive_initialization(::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* receive_initialization); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization& _internal_receive_initialization() const; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* _internal_mutable_receive_initialization(); + public: + void unsafe_arena_set_allocated_receive_initialization( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* receive_initialization); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* unsafe_arena_release_receive_initialization(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget discover_share_target = 13; + bool has_discover_share_target() const; + private: + bool _internal_has_discover_share_target() const; + public: + void clear_discover_share_target(); + const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget& discover_share_target() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* release_discover_share_target(); + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* mutable_discover_share_target(); + void set_allocated_discover_share_target(::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* discover_share_target); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget& _internal_discover_share_target() const; + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* _internal_mutable_discover_share_target(); + public: + void unsafe_arena_set_allocated_discover_share_target( + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* discover_share_target); + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* unsafe_arena_release_discover_share_target(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendIntroduction send_introduction = 14; + bool has_send_introduction() const; + private: + bool _internal_has_send_introduction() const; + public: + void clear_send_introduction(); + const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction& send_introduction() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* release_send_introduction(); + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* mutable_send_introduction(); + void set_allocated_send_introduction(::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* send_introduction); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction& _internal_send_introduction() const; + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* _internal_mutable_send_introduction(); + public: + void unsafe_arena_set_allocated_send_introduction( + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* send_introduction); + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* unsafe_arena_release_send_introduction(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction receive_introduction = 15; + bool has_receive_introduction() const; + private: + bool _internal_has_receive_introduction() const; + public: + void clear_receive_introduction(); + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction& receive_introduction() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* release_receive_introduction(); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* mutable_receive_introduction(); + void set_allocated_receive_introduction(::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* receive_introduction); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction& _internal_receive_introduction() const; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* _internal_mutable_receive_introduction(); + public: + void unsafe_arena_set_allocated_receive_introduction( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* receive_introduction); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* unsafe_arena_release_receive_introduction(); + + // optional .nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction respond_introduction = 16; + bool has_respond_introduction() const; + private: + bool _internal_has_respond_introduction() const; + public: + void clear_respond_introduction(); + const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction& respond_introduction() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* release_respond_introduction(); + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* mutable_respond_introduction(); + void set_allocated_respond_introduction(::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* respond_introduction); + private: + const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction& _internal_respond_introduction() const; + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* _internal_mutable_respond_introduction(); + public: + void unsafe_arena_set_allocated_respond_introduction( + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* respond_introduction); + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* unsafe_arena_release_respond_introduction(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart send_attachments_start = 17; + bool has_send_attachments_start() const; + private: + bool _internal_has_send_attachments_start() const; + public: + void clear_send_attachments_start(); + const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart& send_attachments_start() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* release_send_attachments_start(); + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* mutable_send_attachments_start(); + void set_allocated_send_attachments_start(::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* send_attachments_start); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart& _internal_send_attachments_start() const; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* _internal_mutable_send_attachments_start(); + public: + void unsafe_arena_set_allocated_send_attachments_start( + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* send_attachments_start); + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* unsafe_arena_release_send_attachments_start(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd send_attachments_end = 18; + bool has_send_attachments_end() const; + private: + bool _internal_has_send_attachments_end() const; + public: + void clear_send_attachments_end(); + const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd& send_attachments_end() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* release_send_attachments_end(); + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* mutable_send_attachments_end(); + void set_allocated_send_attachments_end(::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* send_attachments_end); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd& _internal_send_attachments_end() const; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* _internal_mutable_send_attachments_end(); + public: + void unsafe_arena_set_allocated_send_attachments_end( + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* send_attachments_end); + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* unsafe_arena_release_send_attachments_end(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart receive_attachments_start = 19; + bool has_receive_attachments_start() const; + private: + bool _internal_has_receive_attachments_start() const; + public: + void clear_receive_attachments_start(); + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart& receive_attachments_start() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* release_receive_attachments_start(); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* mutable_receive_attachments_start(); + void set_allocated_receive_attachments_start(::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* receive_attachments_start); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart& _internal_receive_attachments_start() const; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* _internal_mutable_receive_attachments_start(); + public: + void unsafe_arena_set_allocated_receive_attachments_start( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* receive_attachments_start); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* unsafe_arena_release_receive_attachments_start(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd receive_attachments_end = 20; + bool has_receive_attachments_end() const; + private: + bool _internal_has_receive_attachments_end() const; + public: + void clear_receive_attachments_end(); + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd& receive_attachments_end() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* release_receive_attachments_end(); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* mutable_receive_attachments_end(); + void set_allocated_receive_attachments_end(::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* receive_attachments_end); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd& _internal_receive_attachments_end() const; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* _internal_mutable_receive_attachments_end(); + public: + void unsafe_arena_set_allocated_receive_attachments_end( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* receive_attachments_end); + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* unsafe_arena_release_receive_attachments_end(); + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments cancel_sending_attachments = 21; + bool has_cancel_sending_attachments() const; + private: + bool _internal_has_cancel_sending_attachments() const; + public: + void clear_cancel_sending_attachments(); + const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments& cancel_sending_attachments() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* release_cancel_sending_attachments(); + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* mutable_cancel_sending_attachments(); + void set_allocated_cancel_sending_attachments(::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* cancel_sending_attachments); + private: + const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments& _internal_cancel_sending_attachments() const; + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* _internal_mutable_cancel_sending_attachments(); + public: + void unsafe_arena_set_allocated_cancel_sending_attachments( + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* cancel_sending_attachments); + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* unsafe_arena_release_cancel_sending_attachments(); + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments cancel_receiving_attachments = 22; + bool has_cancel_receiving_attachments() const; + private: + bool _internal_has_cancel_receiving_attachments() const; + public: + void clear_cancel_receiving_attachments(); + const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments& cancel_receiving_attachments() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* release_cancel_receiving_attachments(); + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* mutable_cancel_receiving_attachments(); + void set_allocated_cancel_receiving_attachments(::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* cancel_receiving_attachments); + private: + const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments& _internal_cancel_receiving_attachments() const; + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* _internal_mutable_cancel_receiving_attachments(); + public: + void unsafe_arena_set_allocated_cancel_receiving_attachments( + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* cancel_receiving_attachments); + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* unsafe_arena_release_cancel_receiving_attachments(); + + // optional .nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments open_received_attachments = 23; + bool has_open_received_attachments() const; + private: + bool _internal_has_open_received_attachments() const; + public: + void clear_open_received_attachments(); + const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments& open_received_attachments() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* release_open_received_attachments(); + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* mutable_open_received_attachments(); + void set_allocated_open_received_attachments(::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* open_received_attachments); + private: + const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments& _internal_open_received_attachments() const; + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* _internal_mutable_open_received_attachments(); + public: + void unsafe_arena_set_allocated_open_received_attachments( + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* open_received_attachments); + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* unsafe_arena_release_open_received_attachments(); + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchActivity launch_activity = 24; + bool has_launch_activity() const; + private: + bool _internal_has_launch_activity() const; + public: + void clear_launch_activity(); + const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity& launch_activity() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* release_launch_activity(); + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* mutable_launch_activity(); + void set_allocated_launch_activity(::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* launch_activity); + private: + const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity& _internal_launch_activity() const; + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* _internal_mutable_launch_activity(); + public: + void unsafe_arena_set_allocated_launch_activity( + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* launch_activity); + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* unsafe_arena_release_launch_activity(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AddContact add_contact = 25; + bool has_add_contact() const; + private: + bool _internal_has_add_contact() const; + public: + void clear_add_contact(); + const ::nearby::sharing::analytics::proto::SharingLog_AddContact& add_contact() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AddContact* release_add_contact(); + ::nearby::sharing::analytics::proto::SharingLog_AddContact* mutable_add_contact(); + void set_allocated_add_contact(::nearby::sharing::analytics::proto::SharingLog_AddContact* add_contact); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AddContact& _internal_add_contact() const; + ::nearby::sharing::analytics::proto::SharingLog_AddContact* _internal_mutable_add_contact(); + public: + void unsafe_arena_set_allocated_add_contact( + ::nearby::sharing::analytics::proto::SharingLog_AddContact* add_contact); + ::nearby::sharing::analytics::proto::SharingLog_AddContact* unsafe_arena_release_add_contact(); + + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveContact remove_contact = 26; + bool has_remove_contact() const; + private: + bool _internal_has_remove_contact() const; + public: + void clear_remove_contact(); + const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact& remove_contact() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* release_remove_contact(); + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* mutable_remove_contact(); + void set_allocated_remove_contact(::nearby::sharing::analytics::proto::SharingLog_RemoveContact* remove_contact); + private: + const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact& _internal_remove_contact() const; + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* _internal_mutable_remove_contact(); + public: + void unsafe_arena_set_allocated_remove_contact( + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* remove_contact); + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* unsafe_arena_release_remove_contact(); + + // optional .nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse fast_share_server_response = 28; + bool has_fast_share_server_response() const; + private: + bool _internal_has_fast_share_server_response() const; + public: + void clear_fast_share_server_response(); + const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse& fast_share_server_response() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* release_fast_share_server_response(); + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* mutable_fast_share_server_response(); + void set_allocated_fast_share_server_response(::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* fast_share_server_response); + private: + const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse& _internal_fast_share_server_response() const; + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* _internal_mutable_fast_share_server_response(); + public: + void unsafe_arena_set_allocated_fast_share_server_response( + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* fast_share_server_response); + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* unsafe_arena_release_fast_share_server_response(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendStart send_start = 29; + bool has_send_start() const; + private: + bool _internal_has_send_start() const; + public: + void clear_send_start(); + const ::nearby::sharing::analytics::proto::SharingLog_SendStart& send_start() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendStart* release_send_start(); + ::nearby::sharing::analytics::proto::SharingLog_SendStart* mutable_send_start(); + void set_allocated_send_start(::nearby::sharing::analytics::proto::SharingLog_SendStart* send_start); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendStart& _internal_send_start() const; + ::nearby::sharing::analytics::proto::SharingLog_SendStart* _internal_mutable_send_start(); + public: + void unsafe_arena_set_allocated_send_start( + ::nearby::sharing::analytics::proto::SharingLog_SendStart* send_start); + ::nearby::sharing::analytics::proto::SharingLog_SendStart* unsafe_arena_release_send_start(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization accept_fast_initialization = 30; + bool has_accept_fast_initialization() const; + private: + bool _internal_has_accept_fast_initialization() const; + public: + void clear_accept_fast_initialization(); + const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization& accept_fast_initialization() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* release_accept_fast_initialization(); + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* mutable_accept_fast_initialization(); + void set_allocated_accept_fast_initialization(::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* accept_fast_initialization); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization& _internal_accept_fast_initialization() const; + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* _internal_mutable_accept_fast_initialization(); + public: + void unsafe_arena_set_allocated_accept_fast_initialization( + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* accept_fast_initialization); + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* unsafe_arena_release_accept_fast_initialization(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SetDataUsage set_data_usage = 31; + bool has_set_data_usage() const; + private: + bool _internal_has_set_data_usage() const; + public: + void clear_set_data_usage(); + const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage& set_data_usage() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* release_set_data_usage(); + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* mutable_set_data_usage(); + void set_allocated_set_data_usage(::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* set_data_usage); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage& _internal_set_data_usage() const; + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* _internal_mutable_set_data_usage(); + public: + void unsafe_arena_set_allocated_set_data_usage( + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* set_data_usage); + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* unsafe_arena_release_set_data_usage(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization dismiss_fast_initialization = 34; + bool has_dismiss_fast_initialization() const; + private: + bool _internal_has_dismiss_fast_initialization() const; + public: + void clear_dismiss_fast_initialization(); + const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization& dismiss_fast_initialization() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* release_dismiss_fast_initialization(); + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* mutable_dismiss_fast_initialization(); + void set_allocated_dismiss_fast_initialization(::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* dismiss_fast_initialization); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization& _internal_dismiss_fast_initialization() const; + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* _internal_mutable_dismiss_fast_initialization(); + public: + void unsafe_arena_set_allocated_dismiss_fast_initialization( + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* dismiss_fast_initialization); + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* unsafe_arena_release_dismiss_fast_initialization(); + + // optional .nearby.sharing.analytics.proto.SharingLog.CancelConnection cancel_connection = 35; + bool has_cancel_connection() const; + private: + bool _internal_has_cancel_connection() const; + public: + void clear_cancel_connection(); + const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection& cancel_connection() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* release_cancel_connection(); + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* mutable_cancel_connection(); + void set_allocated_cancel_connection(::nearby::sharing::analytics::proto::SharingLog_CancelConnection* cancel_connection); + private: + const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection& _internal_cancel_connection() const; + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* _internal_mutable_cancel_connection(); + public: + void unsafe_arena_set_allocated_cancel_connection( + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* cancel_connection); + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* unsafe_arena_release_cancel_connection(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification dismiss_privacy_notification = 36; + bool has_dismiss_privacy_notification() const; + private: + bool _internal_has_dismiss_privacy_notification() const; + public: + void clear_dismiss_privacy_notification(); + const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification& dismiss_privacy_notification() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* release_dismiss_privacy_notification(); + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* mutable_dismiss_privacy_notification(); + void set_allocated_dismiss_privacy_notification(::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* dismiss_privacy_notification); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification& _internal_dismiss_privacy_notification() const; + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* _internal_mutable_dismiss_privacy_notification(); + public: + void unsafe_arena_set_allocated_dismiss_privacy_notification( + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* dismiss_privacy_notification); + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* unsafe_arena_release_dismiss_privacy_notification(); + + // optional .nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification tap_privacy_notification = 37; + bool has_tap_privacy_notification() const; + private: + bool _internal_has_tap_privacy_notification() const; + public: + void clear_tap_privacy_notification(); + const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification& tap_privacy_notification() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* release_tap_privacy_notification(); + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* mutable_tap_privacy_notification(); + void set_allocated_tap_privacy_notification(::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* tap_privacy_notification); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification& _internal_tap_privacy_notification() const; + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* _internal_mutable_tap_privacy_notification(); + public: + void unsafe_arena_set_allocated_tap_privacy_notification( + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* tap_privacy_notification); + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* unsafe_arena_release_tap_privacy_notification(); + + // optional .nearby.sharing.analytics.proto.SharingLog.TapHelp tap_help = 38; + bool has_tap_help() const; + private: + bool _internal_has_tap_help() const; + public: + void clear_tap_help(); + const ::nearby::sharing::analytics::proto::SharingLog_TapHelp& tap_help() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_TapHelp* release_tap_help(); + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* mutable_tap_help(); + void set_allocated_tap_help(::nearby::sharing::analytics::proto::SharingLog_TapHelp* tap_help); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TapHelp& _internal_tap_help() const; + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* _internal_mutable_tap_help(); + public: + void unsafe_arena_set_allocated_tap_help( + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* tap_help); + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* unsafe_arena_release_tap_help(); + + // optional .nearby.sharing.analytics.proto.SharingLog.TapFeedback tap_feedback = 39; + bool has_tap_feedback() const; + private: + bool _internal_has_tap_feedback() const; + public: + void clear_tap_feedback(); + const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback& tap_feedback() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* release_tap_feedback(); + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* mutable_tap_feedback(); + void set_allocated_tap_feedback(::nearby::sharing::analytics::proto::SharingLog_TapFeedback* tap_feedback); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback& _internal_tap_feedback() const; + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* _internal_mutable_tap_feedback(); + public: + void unsafe_arena_set_allocated_tap_feedback( + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* tap_feedback); + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* unsafe_arena_release_tap_feedback(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile add_quick_settings_tile = 40; + bool has_add_quick_settings_tile() const; + private: + bool _internal_has_add_quick_settings_tile() const; + public: + void clear_add_quick_settings_tile(); + const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile& add_quick_settings_tile() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* release_add_quick_settings_tile(); + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* mutable_add_quick_settings_tile(); + void set_allocated_add_quick_settings_tile(::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* add_quick_settings_tile); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile& _internal_add_quick_settings_tile() const; + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* _internal_mutable_add_quick_settings_tile(); + public: + void unsafe_arena_set_allocated_add_quick_settings_tile( + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* add_quick_settings_tile); + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* unsafe_arena_release_add_quick_settings_tile(); + + // optional .nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile remove_quick_settings_tile = 41; + bool has_remove_quick_settings_tile() const; + private: + bool _internal_has_remove_quick_settings_tile() const; + public: + void clear_remove_quick_settings_tile(); + const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile& remove_quick_settings_tile() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* release_remove_quick_settings_tile(); + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* mutable_remove_quick_settings_tile(); + void set_allocated_remove_quick_settings_tile(::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* remove_quick_settings_tile); + private: + const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile& _internal_remove_quick_settings_tile() const; + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* _internal_mutable_remove_quick_settings_tile(); + public: + void unsafe_arena_set_allocated_remove_quick_settings_tile( + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* remove_quick_settings_tile); + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* unsafe_arena_release_remove_quick_settings_tile(); + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent launch_phone_consent = 42; + bool has_launch_phone_consent() const; + private: + bool _internal_has_launch_phone_consent() const; + public: + void clear_launch_phone_consent(); + const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent& launch_phone_consent() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* release_launch_phone_consent(); + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* mutable_launch_phone_consent(); + void set_allocated_launch_phone_consent(::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* launch_phone_consent); + private: + const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent& _internal_launch_phone_consent() const; + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* _internal_mutable_launch_phone_consent(); + public: + void unsafe_arena_set_allocated_launch_phone_consent( + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* launch_phone_consent); + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* unsafe_arena_release_launch_phone_consent(); + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile tap_quick_settings_tile = 43; + bool has_tap_quick_settings_tile() const; + private: + bool _internal_has_tap_quick_settings_tile() const; + public: + void clear_tap_quick_settings_tile(); + const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile& tap_quick_settings_tile() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* release_tap_quick_settings_tile(); + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* mutable_tap_quick_settings_tile(); + void set_allocated_tap_quick_settings_tile(::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* tap_quick_settings_tile); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile& _internal_tap_quick_settings_tile() const; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* _internal_mutable_tap_quick_settings_tile(); + public: + void unsafe_arena_set_allocated_tap_quick_settings_tile( + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* tap_quick_settings_tile); + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* unsafe_arena_release_tap_quick_settings_tile(); + + // optional .nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus install_apk_status = 44; + bool has_install_apk_status() const; + private: + bool _internal_has_install_apk_status() const; + public: + void clear_install_apk_status(); + const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus& install_apk_status() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* release_install_apk_status(); + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* mutable_install_apk_status(); + void set_allocated_install_apk_status(::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* install_apk_status); + private: + const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus& _internal_install_apk_status() const; + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* _internal_mutable_install_apk_status(); + public: + void unsafe_arena_set_allocated_install_apk_status( + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* install_apk_status); + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* unsafe_arena_release_install_apk_status(); + + // optional .nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus verify_apk_status = 45; + bool has_verify_apk_status() const; + private: + bool _internal_has_verify_apk_status() const; + public: + void clear_verify_apk_status(); + const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus& verify_apk_status() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* release_verify_apk_status(); + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* mutable_verify_apk_status(); + void set_allocated_verify_apk_status(::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* verify_apk_status); + private: + const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus& _internal_verify_apk_status() const; + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* _internal_mutable_verify_apk_status(); + public: + void unsafe_arena_set_allocated_verify_apk_status( + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* verify_apk_status); + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* unsafe_arena_release_verify_apk_status(); + + // optional .nearby.sharing.analytics.proto.SharingLog.LaunchConsent launch_consent = 46; + bool has_launch_consent() const; + private: + bool _internal_has_launch_consent() const; + public: + void clear_launch_consent(); + const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent& launch_consent() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* release_launch_consent(); + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* mutable_launch_consent(); + void set_allocated_launch_consent(::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* launch_consent); + private: + const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent& _internal_launch_consent() const; + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* _internal_mutable_launch_consent(); + public: + void unsafe_arena_set_allocated_launch_consent( + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* launch_consent); + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* unsafe_arena_release_launch_consent(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd process_received_attachments_end = 47; + bool has_process_received_attachments_end() const; + private: + bool _internal_has_process_received_attachments_end() const; + public: + void clear_process_received_attachments_end(); + const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd& process_received_attachments_end() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* release_process_received_attachments_end(); + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* mutable_process_received_attachments_end(); + void set_allocated_process_received_attachments_end(::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* process_received_attachments_end); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd& _internal_process_received_attachments_end() const; + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* _internal_mutable_process_received_attachments_end(); + public: + void unsafe_arena_set_allocated_process_received_attachments_end( + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* process_received_attachments_end); + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* unsafe_arena_release_process_received_attachments_end(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification toggle_show_notification = 48; + bool has_toggle_show_notification() const; + private: + bool _internal_has_toggle_show_notification() const; + public: + void clear_toggle_show_notification(); + const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification& toggle_show_notification() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* release_toggle_show_notification(); + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* mutable_toggle_show_notification(); + void set_allocated_toggle_show_notification(::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* toggle_show_notification); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification& _internal_toggle_show_notification() const; + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* _internal_mutable_toggle_show_notification(); + public: + void unsafe_arena_set_allocated_toggle_show_notification( + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* toggle_show_notification); + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* unsafe_arena_release_toggle_show_notification(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SetDeviceName set_device_name = 49; + bool has_set_device_name() const; + private: + bool _internal_has_set_device_name() const; + public: + void clear_set_device_name(); + const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName& set_device_name() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* release_set_device_name(); + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* mutable_set_device_name(); + void set_allocated_set_device_name(::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* set_device_name); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName& _internal_set_device_name() const; + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* _internal_mutable_set_device_name(); + public: + void unsafe_arena_set_allocated_set_device_name( + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* set_device_name); + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* unsafe_arena_release_set_device_name(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DeclineAgreements decline_agreements = 51; + bool has_decline_agreements() const; + private: + bool _internal_has_decline_agreements() const; + public: + void clear_decline_agreements(); + const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements& decline_agreements() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* release_decline_agreements(); + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* mutable_decline_agreements(); + void set_allocated_decline_agreements(::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* decline_agreements); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements& _internal_decline_agreements() const; + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* _internal_mutable_decline_agreements(); + public: + void unsafe_arena_set_allocated_decline_agreements( + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* decline_agreements); + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* unsafe_arena_release_decline_agreements(); + + // optional .nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions request_setting_permissions = 52; + bool has_request_setting_permissions() const; + private: + bool _internal_has_request_setting_permissions() const; + public: + void clear_request_setting_permissions(); + const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions& request_setting_permissions() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* release_request_setting_permissions(); + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* mutable_request_setting_permissions(); + void set_allocated_request_setting_permissions(::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* request_setting_permissions); + private: + const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions& _internal_request_setting_permissions() const; + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* _internal_mutable_request_setting_permissions(); + public: + void unsafe_arena_set_allocated_request_setting_permissions( + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* request_setting_permissions); + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* unsafe_arena_release_request_setting_permissions(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DeviceSettings device_settings = 53; + bool has_device_settings() const; + private: + bool _internal_has_device_settings() const; + public: + void clear_device_settings(); + const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings& device_settings() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* release_device_settings(); + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* mutable_device_settings(); + void set_allocated_device_settings(::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* device_settings); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings& _internal_device_settings() const; + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* _internal_mutable_device_settings(); + public: + void unsafe_arena_set_allocated_device_settings( + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* device_settings); + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* unsafe_arena_release_device_settings(); + + // optional .nearby.sharing.analytics.proto.SharingLog.EstablishConnection establish_connection = 54; + bool has_establish_connection() const; + private: + bool _internal_has_establish_connection() const; + public: + void clear_establish_connection(); + const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection& establish_connection() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* release_establish_connection(); + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* mutable_establish_connection(); + void set_allocated_establish_connection(::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* establish_connection); + private: + const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection& _internal_establish_connection() const; + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* _internal_mutable_establish_connection(); + public: + void unsafe_arena_set_allocated_establish_connection( + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* establish_connection); + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* unsafe_arena_release_establish_connection(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization auto_dismiss_fast_initialization = 55; + bool has_auto_dismiss_fast_initialization() const; + private: + bool _internal_has_auto_dismiss_fast_initialization() const; + public: + void clear_auto_dismiss_fast_initialization(); + const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization& auto_dismiss_fast_initialization() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* release_auto_dismiss_fast_initialization(); + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* mutable_auto_dismiss_fast_initialization(); + void set_allocated_auto_dismiss_fast_initialization(::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* auto_dismiss_fast_initialization); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization& _internal_auto_dismiss_fast_initialization() const; + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* _internal_mutable_auto_dismiss_fast_initialization(); + public: + void unsafe_arena_set_allocated_auto_dismiss_fast_initialization( + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* auto_dismiss_fast_initialization); + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* unsafe_arena_release_auto_dismiss_fast_initialization(); + + // optional .nearby.sharing.analytics.proto.SharingLog.EventMetadata event_metadata = 56; + bool has_event_metadata() const; + private: + bool _internal_has_event_metadata() const; + public: + void clear_event_metadata(); + const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata& event_metadata() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* release_event_metadata(); + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* mutable_event_metadata(); + void set_allocated_event_metadata(::nearby::sharing::analytics::proto::SharingLog_EventMetadata* event_metadata); + private: + const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata& _internal_event_metadata() const; + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* _internal_mutable_event_metadata(); + public: + void unsafe_arena_set_allocated_event_metadata( + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* event_metadata); + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* unsafe_arena_release_event_metadata(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AppCrash app_crash = 58; + bool has_app_crash() const; + private: + bool _internal_has_app_crash() const; + public: + void clear_app_crash(); + const ::nearby::sharing::analytics::proto::SharingLog_AppCrash& app_crash() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AppCrash* release_app_crash(); + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* mutable_app_crash(); + void set_allocated_app_crash(::nearby::sharing::analytics::proto::SharingLog_AppCrash* app_crash); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AppCrash& _internal_app_crash() const; + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* _internal_mutable_app_crash(); + public: + void unsafe_arena_set_allocated_app_crash( + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* app_crash); + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* unsafe_arena_release_app_crash(); + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare tap_quick_settings_file_share = 59; + bool has_tap_quick_settings_file_share() const; + private: + bool _internal_has_tap_quick_settings_file_share() const; + public: + void clear_tap_quick_settings_file_share(); + const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare& tap_quick_settings_file_share() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* release_tap_quick_settings_file_share(); + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* mutable_tap_quick_settings_file_share(); + void set_allocated_tap_quick_settings_file_share(::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* tap_quick_settings_file_share); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare& _internal_tap_quick_settings_file_share() const; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* _internal_mutable_tap_quick_settings_file_share(); + public: + void unsafe_arena_set_allocated_tap_quick_settings_file_share( + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* tap_quick_settings_file_share); + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* unsafe_arena_release_tap_quick_settings_file_share(); + + // optional .nearby.sharing.analytics.proto.SharingLog.AppInfo app_info = 60; + bool has_app_info() const; + private: + bool _internal_has_app_info() const; + public: + void clear_app_info(); + const ::nearby::sharing::analytics::proto::SharingLog_AppInfo& app_info() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_AppInfo* release_app_info(); + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* mutable_app_info(); + void set_allocated_app_info(::nearby::sharing::analytics::proto::SharingLog_AppInfo* app_info); + private: + const ::nearby::sharing::analytics::proto::SharingLog_AppInfo& _internal_app_info() const; + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* _internal_mutable_app_info(); + public: + void unsafe_arena_set_allocated_app_info( + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* app_info); + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* unsafe_arena_release_app_info(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification display_privacy_notification = 61; + bool has_display_privacy_notification() const; + private: + bool _internal_has_display_privacy_notification() const; + public: + void clear_display_privacy_notification(); + const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification& display_privacy_notification() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* release_display_privacy_notification(); + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* mutable_display_privacy_notification(); + void set_allocated_display_privacy_notification(::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* display_privacy_notification); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification& _internal_display_privacy_notification() const; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* _internal_mutable_display_privacy_notification(); + public: + void unsafe_arena_set_allocated_display_privacy_notification( + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* display_privacy_notification); + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* unsafe_arena_release_display_privacy_notification(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent display_phone_consent = 62; + bool has_display_phone_consent() const; + private: + bool _internal_has_display_phone_consent() const; + public: + void clear_display_phone_consent(); + const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent& display_phone_consent() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* release_display_phone_consent(); + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* mutable_display_phone_consent(); + void set_allocated_display_phone_consent(::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* display_phone_consent); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent& _internal_display_phone_consent() const; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* _internal_mutable_display_phone_consent(); + public: + void unsafe_arena_set_allocated_display_phone_consent( + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* display_phone_consent); + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* unsafe_arena_release_display_phone_consent(); + + // optional .nearby.sharing.analytics.proto.SharingLog.PreferencesUsage preferences_usage = 63; + bool has_preferences_usage() const; + private: + bool _internal_has_preferences_usage() const; + public: + void clear_preferences_usage(); + const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage& preferences_usage() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* release_preferences_usage(); + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* mutable_preferences_usage(); + void set_allocated_preferences_usage(::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* preferences_usage); + private: + const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage& _internal_preferences_usage() const; + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* _internal_mutable_preferences_usage(); + public: + void unsafe_arena_set_allocated_preferences_usage( + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* preferences_usage); + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* unsafe_arena_release_preferences_usage(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DefaultOptIn default_opt_in = 64; + bool has_default_opt_in() const; + private: + bool _internal_has_default_opt_in() const; + public: + void clear_default_opt_in(); + const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn& default_opt_in() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* release_default_opt_in(); + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* mutable_default_opt_in(); + void set_allocated_default_opt_in(::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* default_opt_in); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn& _internal_default_opt_in() const; + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* _internal_mutable_default_opt_in(); + public: + void unsafe_arena_set_allocated_default_opt_in( + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* default_opt_in); + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* unsafe_arena_release_default_opt_in(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SetupWizard setup_wizard = 65; + bool has_setup_wizard() const; + private: + bool _internal_has_setup_wizard() const; + public: + void clear_setup_wizard(); + const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard& setup_wizard() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* release_setup_wizard(); + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* mutable_setup_wizard(); + void set_allocated_setup_wizard(::nearby::sharing::analytics::proto::SharingLog_SetupWizard* setup_wizard); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard& _internal_setup_wizard() const; + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* _internal_mutable_setup_wizard(); + public: + void unsafe_arena_set_allocated_setup_wizard( + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* setup_wizard); + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* unsafe_arena_release_setup_wizard(); + + // optional .nearby.sharing.analytics.proto.SharingLog.TapQrCode tap_qr_code = 66; + bool has_tap_qr_code() const; + private: + bool _internal_has_tap_qr_code() const; + public: + void clear_tap_qr_code(); + const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode& tap_qr_code() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* release_tap_qr_code(); + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* mutable_tap_qr_code(); + void set_allocated_tap_qr_code(::nearby::sharing::analytics::proto::SharingLog_TapQrCode* tap_qr_code); + private: + const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode& _internal_tap_qr_code() const; + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* _internal_mutable_tap_qr_code(); + public: + void unsafe_arena_set_allocated_tap_qr_code( + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* tap_qr_code); + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* unsafe_arena_release_tap_qr_code(); + + // optional .nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown qr_code_link_shown = 67; + bool has_qr_code_link_shown() const; + private: + bool _internal_has_qr_code_link_shown() const; + public: + void clear_qr_code_link_shown(); + const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown& qr_code_link_shown() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* release_qr_code_link_shown(); + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* mutable_qr_code_link_shown(); + void set_allocated_qr_code_link_shown(::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* qr_code_link_shown); + private: + const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown& _internal_qr_code_link_shown() const; + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* _internal_mutable_qr_code_link_shown(); + public: + void unsafe_arena_set_allocated_qr_code_link_shown( + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* qr_code_link_shown); + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* unsafe_arena_release_qr_code_link_shown(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId parsing_failed_endpoint_id = 68; + bool has_parsing_failed_endpoint_id() const; + private: + bool _internal_has_parsing_failed_endpoint_id() const; + public: + void clear_parsing_failed_endpoint_id(); + const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId& parsing_failed_endpoint_id() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* release_parsing_failed_endpoint_id(); + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* mutable_parsing_failed_endpoint_id(); + void set_allocated_parsing_failed_endpoint_id(::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* parsing_failed_endpoint_id); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId& _internal_parsing_failed_endpoint_id() const; + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* _internal_mutable_parsing_failed_endpoint_id(); + public: + void unsafe_arena_set_allocated_parsing_failed_endpoint_id( + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* parsing_failed_endpoint_id); + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* unsafe_arena_release_parsing_failed_endpoint_id(); + + // optional .nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice fast_init_discover_device = 69; + bool has_fast_init_discover_device() const; + private: + bool _internal_has_fast_init_discover_device() const; + public: + void clear_fast_init_discover_device(); + const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice& fast_init_discover_device() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* release_fast_init_discover_device(); + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* mutable_fast_init_discover_device(); + void set_allocated_fast_init_discover_device(::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* fast_init_discover_device); + private: + const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice& _internal_fast_init_discover_device() const; + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* _internal_mutable_fast_init_discover_device(); + public: + void unsafe_arena_set_allocated_fast_init_discover_device( + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* fast_init_discover_device); + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* unsafe_arena_release_fast_init_discover_device(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification send_desktop_notification = 70; + bool has_send_desktop_notification() const; + private: + bool _internal_has_send_desktop_notification() const; + public: + void clear_send_desktop_notification(); + const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification& send_desktop_notification() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* release_send_desktop_notification(); + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* mutable_send_desktop_notification(); + void set_allocated_send_desktop_notification(::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* send_desktop_notification); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification& _internal_send_desktop_notification() const; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* _internal_mutable_send_desktop_notification(); + public: + void unsafe_arena_set_allocated_send_desktop_notification( + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* send_desktop_notification); + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* unsafe_arena_release_send_desktop_notification(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent send_desktop_transfer_event = 72; + bool has_send_desktop_transfer_event() const; + private: + bool _internal_has_send_desktop_transfer_event() const; + public: + void clear_send_desktop_transfer_event(); + const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent& send_desktop_transfer_event() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* release_send_desktop_transfer_event(); + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* mutable_send_desktop_transfer_event(); + void set_allocated_send_desktop_transfer_event(::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* send_desktop_transfer_event); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent& _internal_send_desktop_transfer_event() const; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* _internal_mutable_send_desktop_transfer_event(); + public: + void unsafe_arena_set_allocated_send_desktop_transfer_event( + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* send_desktop_transfer_event); + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* unsafe_arena_release_send_desktop_transfer_event(); + + // optional .nearby.sharing.analytics.proto.SharingLog.SetAccount set_account = 73; + bool has_set_account() const; + private: + bool _internal_has_set_account() const; + public: + void clear_set_account(); + const ::nearby::sharing::analytics::proto::SharingLog_SetAccount& set_account() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_SetAccount* release_set_account(); + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* mutable_set_account(); + void set_allocated_set_account(::nearby::sharing::analytics::proto::SharingLog_SetAccount* set_account); + private: + const ::nearby::sharing::analytics::proto::SharingLog_SetAccount& _internal_set_account() const; + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* _internal_mutable_set_account(); + public: + void unsafe_arena_set_allocated_set_account( + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* set_account); + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* unsafe_arena_release_set_account(); + + // optional .nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure decrypt_certificate_failure = 74; + bool has_decrypt_certificate_failure() const; + private: + bool _internal_has_decrypt_certificate_failure() const; + public: + void clear_decrypt_certificate_failure(); + const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure& decrypt_certificate_failure() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* release_decrypt_certificate_failure(); + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* mutable_decrypt_certificate_failure(); + void set_allocated_decrypt_certificate_failure(::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* decrypt_certificate_failure); + private: + const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure& _internal_decrypt_certificate_failure() const; + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* _internal_mutable_decrypt_certificate_failure(); + public: + void unsafe_arena_set_allocated_decrypt_certificate_failure( + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* decrypt_certificate_failure); + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* unsafe_arena_release_decrypt_certificate_failure(); + + // optional .nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess show_allow_permission_auto_access = 75; + bool has_show_allow_permission_auto_access() const; + private: + bool _internal_has_show_allow_permission_auto_access() const; + public: + void clear_show_allow_permission_auto_access(); + const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess& show_allow_permission_auto_access() const; + PROTOBUF_NODISCARD ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* release_show_allow_permission_auto_access(); + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* mutable_show_allow_permission_auto_access(); + void set_allocated_show_allow_permission_auto_access(::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* show_allow_permission_auto_access); + private: + const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess& _internal_show_allow_permission_auto_access() const; + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* _internal_mutable_show_allow_permission_auto_access(); + public: + void unsafe_arena_set_allocated_show_allow_permission_auto_access( + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* show_allow_permission_auto_access); + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* unsafe_arena_release_show_allow_permission_auto_access(); + + // optional .location.nearby.proto.sharing.EventType event_type = 1; + bool has_event_type() const; + private: + bool _internal_has_event_type() const; + public: + void clear_event_type(); + ::location::nearby::proto::sharing::EventType event_type() const; + void set_event_type(::location::nearby::proto::sharing::EventType value); + private: + ::location::nearby::proto::sharing::EventType _internal_event_type() const; + void _internal_set_event_type(::location::nearby::proto::sharing::EventType value); + public: + + // optional .location.nearby.proto.sharing.LogSource log_source = 27; + bool has_log_source() const; + private: + bool _internal_has_log_source() const; + public: + void clear_log_source(); + ::location::nearby::proto::sharing::LogSource log_source() const; + void set_log_source(::location::nearby::proto::sharing::LogSource value); + private: + ::location::nearby::proto::sharing::LogSource _internal_log_source() const; + void _internal_set_log_source(::location::nearby::proto::sharing::LogSource value); + public: + + // optional .location.nearby.proto.sharing.EventCategory event_category = 33; + bool has_event_category() const; + private: + bool _internal_has_event_category() const; + public: + void clear_event_category(); + ::location::nearby::proto::sharing::EventCategory event_category() const; + void set_event_category(::location::nearby::proto::sharing::EventCategory value); + private: + ::location::nearby::proto::sharing::EventCategory _internal_event_category() const; + void _internal_set_event_category(::location::nearby::proto::sharing::EventCategory value); + public: + + // @@protoc_insertion_point(class_scope:nearby.sharing.analytics.proto.SharingLog) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<3> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr version_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr files_migration_phase_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr app_version_; + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* unknown_event_; + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* accept_agreements_; + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* enable_nearby_sharing_; + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* set_visibility_; + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* describe_attachments_; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* scan_for_share_targets_start_; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* scan_for_share_targets_end_; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* advertise_device_presence_start_; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* advertise_device_presence_end_; + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* send_initialization_; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* receive_initialization_; + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* discover_share_target_; + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* send_introduction_; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* receive_introduction_; + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* respond_introduction_; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* send_attachments_start_; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* send_attachments_end_; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* receive_attachments_start_; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* receive_attachments_end_; + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* cancel_sending_attachments_; + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* cancel_receiving_attachments_; + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* open_received_attachments_; + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* launch_activity_; + ::nearby::sharing::analytics::proto::SharingLog_AddContact* add_contact_; + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* remove_contact_; + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* fast_share_server_response_; + ::nearby::sharing::analytics::proto::SharingLog_SendStart* send_start_; + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* accept_fast_initialization_; + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* set_data_usage_; + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* dismiss_fast_initialization_; + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* cancel_connection_; + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* dismiss_privacy_notification_; + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* tap_privacy_notification_; + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* tap_help_; + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* tap_feedback_; + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* add_quick_settings_tile_; + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* remove_quick_settings_tile_; + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* launch_phone_consent_; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* tap_quick_settings_tile_; + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* install_apk_status_; + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* verify_apk_status_; + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* launch_consent_; + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* process_received_attachments_end_; + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* toggle_show_notification_; + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* set_device_name_; + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* decline_agreements_; + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* request_setting_permissions_; + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* device_settings_; + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* establish_connection_; + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* auto_dismiss_fast_initialization_; + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* event_metadata_; + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* app_crash_; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* tap_quick_settings_file_share_; + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* app_info_; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* display_privacy_notification_; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* display_phone_consent_; + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* preferences_usage_; + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* default_opt_in_; + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* setup_wizard_; + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* tap_qr_code_; + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* qr_code_link_shown_; + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* parsing_failed_endpoint_id_; + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* fast_init_discover_device_; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* send_desktop_notification_; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* send_desktop_transfer_event_; + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* set_account_; + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* decrypt_certificate_failure_; + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* show_allow_permission_auto_access_; + int event_type_; + int log_source_; + int event_category_; + friend struct ::TableStruct_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// SharingLog_AppInfo + +// optional string app_version = 1; +inline bool SharingLog_AppInfo::_internal_has_app_version() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AppInfo::has_app_version() const { + return _internal_has_app_version(); +} +inline void SharingLog_AppInfo::clear_app_version() { + app_version_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_AppInfo::app_version() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_version) + return _internal_app_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_AppInfo::set_app_version(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + app_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_version) +} +inline std::string* SharingLog_AppInfo::mutable_app_version() { + std::string* _s = _internal_mutable_app_version(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_version) + return _s; +} +inline const std::string& SharingLog_AppInfo::_internal_app_version() const { + return app_version_.Get(); +} +inline void SharingLog_AppInfo::_internal_set_app_version(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + app_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppInfo::_internal_mutable_app_version() { + _has_bits_[0] |= 0x00000001u; + return app_version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppInfo::release_app_version() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_version) + if (!_internal_has_app_version()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = app_version_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (app_version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_AppInfo::set_allocated_app_version(std::string* app_version) { + if (app_version != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + app_version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), app_version, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (app_version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_version) +} + +// optional string app_language = 2; +inline bool SharingLog_AppInfo::_internal_has_app_language() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_AppInfo::has_app_language() const { + return _internal_has_app_language(); +} +inline void SharingLog_AppInfo::clear_app_language() { + app_language_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& SharingLog_AppInfo::app_language() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_language) + return _internal_app_language(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_AppInfo::set_app_language(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000002u; + app_language_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_language) +} +inline std::string* SharingLog_AppInfo::mutable_app_language() { + std::string* _s = _internal_mutable_app_language(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_language) + return _s; +} +inline const std::string& SharingLog_AppInfo::_internal_app_language() const { + return app_language_.Get(); +} +inline void SharingLog_AppInfo::_internal_set_app_language(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + app_language_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppInfo::_internal_mutable_app_language() { + _has_bits_[0] |= 0x00000002u; + return app_language_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppInfo::release_app_language() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_language) + if (!_internal_has_app_language()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + auto* p = app_language_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (app_language_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + app_language_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_AppInfo::set_allocated_app_language(std::string* app_language) { + if (app_language != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + app_language_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), app_language, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (app_language_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + app_language_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.AppInfo.app_language) +} + +// optional string update_track = 3; +inline bool SharingLog_AppInfo::_internal_has_update_track() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_AppInfo::has_update_track() const { + return _internal_has_update_track(); +} +inline void SharingLog_AppInfo::clear_update_track() { + update_track_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& SharingLog_AppInfo::update_track() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppInfo.update_track) + return _internal_update_track(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_AppInfo::set_update_track(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000004u; + update_track_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppInfo.update_track) +} +inline std::string* SharingLog_AppInfo::mutable_update_track() { + std::string* _s = _internal_mutable_update_track(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AppInfo.update_track) + return _s; +} +inline const std::string& SharingLog_AppInfo::_internal_update_track() const { + return update_track_.Get(); +} +inline void SharingLog_AppInfo::_internal_set_update_track(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + update_track_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppInfo::_internal_mutable_update_track() { + _has_bits_[0] |= 0x00000004u; + return update_track_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppInfo::release_update_track() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.AppInfo.update_track) + if (!_internal_has_update_track()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + auto* p = update_track_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (update_track_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + update_track_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_AppInfo::set_allocated_update_track(std::string* update_track) { + if (update_track != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + update_track_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), update_track, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (update_track_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + update_track_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.AppInfo.update_track) +} + +// ------------------------------------------------------------------- + +// SharingLog_DeviceSettings + +// optional .location.nearby.proto.sharing.Visibility visibility = 1; +inline bool SharingLog_DeviceSettings::_internal_has_visibility() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_visibility() const { + return _internal_has_visibility(); +} +inline void SharingLog_DeviceSettings::clear_visibility() { + visibility_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_DeviceSettings::_internal_visibility() const { + return static_cast< ::location::nearby::proto::sharing::Visibility >(visibility_); +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_DeviceSettings::visibility() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.visibility) + return _internal_visibility(); +} +inline void SharingLog_DeviceSettings::_internal_set_visibility(::location::nearby::proto::sharing::Visibility value) { + assert(::location::nearby::proto::sharing::Visibility_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + visibility_ = value; +} +inline void SharingLog_DeviceSettings::set_visibility(::location::nearby::proto::sharing::Visibility value) { + _internal_set_visibility(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.visibility) +} + +// optional .location.nearby.proto.sharing.DataUsage data_usage = 2; +inline bool SharingLog_DeviceSettings::_internal_has_data_usage() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_data_usage() const { + return _internal_has_data_usage(); +} +inline void SharingLog_DeviceSettings::clear_data_usage() { + data_usage_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_DeviceSettings::_internal_data_usage() const { + return static_cast< ::location::nearby::proto::sharing::DataUsage >(data_usage_); +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_DeviceSettings::data_usage() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.data_usage) + return _internal_data_usage(); +} +inline void SharingLog_DeviceSettings::_internal_set_data_usage(::location::nearby::proto::sharing::DataUsage value) { + assert(::location::nearby::proto::sharing::DataUsage_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + data_usage_ = value; +} +inline void SharingLog_DeviceSettings::set_data_usage(::location::nearby::proto::sharing::DataUsage value) { + _internal_set_data_usage(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.data_usage) +} + +// optional int32 device_name_size = 3; +inline bool SharingLog_DeviceSettings::_internal_has_device_name_size() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_device_name_size() const { + return _internal_has_device_name_size(); +} +inline void SharingLog_DeviceSettings::clear_device_name_size() { + device_name_size_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline int32_t SharingLog_DeviceSettings::_internal_device_name_size() const { + return device_name_size_; +} +inline int32_t SharingLog_DeviceSettings::device_name_size() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.device_name_size) + return _internal_device_name_size(); +} +inline void SharingLog_DeviceSettings::_internal_set_device_name_size(int32_t value) { + _has_bits_[0] |= 0x00000004u; + device_name_size_ = value; +} +inline void SharingLog_DeviceSettings::set_device_name_size(int32_t value) { + _internal_set_device_name_size(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.device_name_size) +} + +// optional bool is_show_notification_enabled = 4; +inline bool SharingLog_DeviceSettings::_internal_has_is_show_notification_enabled() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_is_show_notification_enabled() const { + return _internal_has_is_show_notification_enabled(); +} +inline void SharingLog_DeviceSettings::clear_is_show_notification_enabled() { + is_show_notification_enabled_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool SharingLog_DeviceSettings::_internal_is_show_notification_enabled() const { + return is_show_notification_enabled_; +} +inline bool SharingLog_DeviceSettings::is_show_notification_enabled() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_show_notification_enabled) + return _internal_is_show_notification_enabled(); +} +inline void SharingLog_DeviceSettings::_internal_set_is_show_notification_enabled(bool value) { + _has_bits_[0] |= 0x00000008u; + is_show_notification_enabled_ = value; +} +inline void SharingLog_DeviceSettings::set_is_show_notification_enabled(bool value) { + _internal_set_is_show_notification_enabled(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_show_notification_enabled) +} + +// optional bool is_bt_enabled = 5; +inline bool SharingLog_DeviceSettings::_internal_has_is_bt_enabled() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_is_bt_enabled() const { + return _internal_has_is_bt_enabled(); +} +inline void SharingLog_DeviceSettings::clear_is_bt_enabled() { + is_bt_enabled_ = false; + _has_bits_[0] &= ~0x00000010u; +} +inline bool SharingLog_DeviceSettings::_internal_is_bt_enabled() const { + return is_bt_enabled_; +} +inline bool SharingLog_DeviceSettings::is_bt_enabled() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_bt_enabled) + return _internal_is_bt_enabled(); +} +inline void SharingLog_DeviceSettings::_internal_set_is_bt_enabled(bool value) { + _has_bits_[0] |= 0x00000010u; + is_bt_enabled_ = value; +} +inline void SharingLog_DeviceSettings::set_is_bt_enabled(bool value) { + _internal_set_is_bt_enabled(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_bt_enabled) +} + +// optional bool is_location_enabled = 6; +inline bool SharingLog_DeviceSettings::_internal_has_is_location_enabled() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_is_location_enabled() const { + return _internal_has_is_location_enabled(); +} +inline void SharingLog_DeviceSettings::clear_is_location_enabled() { + is_location_enabled_ = false; + _has_bits_[0] &= ~0x00000020u; +} +inline bool SharingLog_DeviceSettings::_internal_is_location_enabled() const { + return is_location_enabled_; +} +inline bool SharingLog_DeviceSettings::is_location_enabled() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_location_enabled) + return _internal_is_location_enabled(); +} +inline void SharingLog_DeviceSettings::_internal_set_is_location_enabled(bool value) { + _has_bits_[0] |= 0x00000020u; + is_location_enabled_ = value; +} +inline void SharingLog_DeviceSettings::set_is_location_enabled(bool value) { + _internal_set_is_location_enabled(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_location_enabled) +} + +// optional bool is_wifi_enabled = 7; +inline bool SharingLog_DeviceSettings::_internal_has_is_wifi_enabled() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_DeviceSettings::has_is_wifi_enabled() const { + return _internal_has_is_wifi_enabled(); +} +inline void SharingLog_DeviceSettings::clear_is_wifi_enabled() { + is_wifi_enabled_ = false; + _has_bits_[0] &= ~0x00000040u; +} +inline bool SharingLog_DeviceSettings::_internal_is_wifi_enabled() const { + return is_wifi_enabled_; +} +inline bool SharingLog_DeviceSettings::is_wifi_enabled() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_wifi_enabled) + return _internal_is_wifi_enabled(); +} +inline void SharingLog_DeviceSettings::_internal_set_is_wifi_enabled(bool value) { + _has_bits_[0] |= 0x00000040u; + is_wifi_enabled_ = value; +} +inline void SharingLog_DeviceSettings::set_is_wifi_enabled(bool value) { + _internal_set_is_wifi_enabled(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DeviceSettings.is_wifi_enabled) +} + +// ------------------------------------------------------------------- + +// SharingLog_PreferencesUsage + +// optional .location.nearby.proto.sharing.PreferencesAction action = 1; +inline bool SharingLog_PreferencesUsage::_internal_has_action() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_PreferencesUsage::has_action() const { + return _internal_has_action(); +} +inline void SharingLog_PreferencesUsage::clear_action() { + action_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::PreferencesAction SharingLog_PreferencesUsage::_internal_action() const { + return static_cast< ::location::nearby::proto::sharing::PreferencesAction >(action_); +} +inline ::location::nearby::proto::sharing::PreferencesAction SharingLog_PreferencesUsage::action() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.action) + return _internal_action(); +} +inline void SharingLog_PreferencesUsage::_internal_set_action(::location::nearby::proto::sharing::PreferencesAction value) { + assert(::location::nearby::proto::sharing::PreferencesAction_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + action_ = value; +} +inline void SharingLog_PreferencesUsage::set_action(::location::nearby::proto::sharing::PreferencesAction value) { + _internal_set_action(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.action) +} + +// optional .location.nearby.proto.sharing.PreferencesActionStatus action_status = 2; +inline bool SharingLog_PreferencesUsage::_internal_has_action_status() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_PreferencesUsage::has_action_status() const { + return _internal_has_action_status(); +} +inline void SharingLog_PreferencesUsage::clear_action_status() { + action_status_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::PreferencesActionStatus SharingLog_PreferencesUsage::_internal_action_status() const { + return static_cast< ::location::nearby::proto::sharing::PreferencesActionStatus >(action_status_); +} +inline ::location::nearby::proto::sharing::PreferencesActionStatus SharingLog_PreferencesUsage::action_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.action_status) + return _internal_action_status(); +} +inline void SharingLog_PreferencesUsage::_internal_set_action_status(::location::nearby::proto::sharing::PreferencesActionStatus value) { + assert(::location::nearby::proto::sharing::PreferencesActionStatus_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + action_status_ = value; +} +inline void SharingLog_PreferencesUsage::set_action_status(::location::nearby::proto::sharing::PreferencesActionStatus value) { + _internal_set_action_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.action_status) +} + +// optional .location.nearby.proto.sharing.PreferencesAction prev_sub_action = 3; +inline bool SharingLog_PreferencesUsage::_internal_has_prev_sub_action() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_PreferencesUsage::has_prev_sub_action() const { + return _internal_has_prev_sub_action(); +} +inline void SharingLog_PreferencesUsage::clear_prev_sub_action() { + prev_sub_action_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::PreferencesAction SharingLog_PreferencesUsage::_internal_prev_sub_action() const { + return static_cast< ::location::nearby::proto::sharing::PreferencesAction >(prev_sub_action_); +} +inline ::location::nearby::proto::sharing::PreferencesAction SharingLog_PreferencesUsage::prev_sub_action() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.prev_sub_action) + return _internal_prev_sub_action(); +} +inline void SharingLog_PreferencesUsage::_internal_set_prev_sub_action(::location::nearby::proto::sharing::PreferencesAction value) { + assert(::location::nearby::proto::sharing::PreferencesAction_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + prev_sub_action_ = value; +} +inline void SharingLog_PreferencesUsage::set_prev_sub_action(::location::nearby::proto::sharing::PreferencesAction value) { + _internal_set_prev_sub_action(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.prev_sub_action) +} + +// optional .location.nearby.proto.sharing.PreferencesAction next_sub_action = 4; +inline bool SharingLog_PreferencesUsage::_internal_has_next_sub_action() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_PreferencesUsage::has_next_sub_action() const { + return _internal_has_next_sub_action(); +} +inline void SharingLog_PreferencesUsage::clear_next_sub_action() { + next_sub_action_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::PreferencesAction SharingLog_PreferencesUsage::_internal_next_sub_action() const { + return static_cast< ::location::nearby::proto::sharing::PreferencesAction >(next_sub_action_); +} +inline ::location::nearby::proto::sharing::PreferencesAction SharingLog_PreferencesUsage::next_sub_action() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.next_sub_action) + return _internal_next_sub_action(); +} +inline void SharingLog_PreferencesUsage::_internal_set_next_sub_action(::location::nearby::proto::sharing::PreferencesAction value) { + assert(::location::nearby::proto::sharing::PreferencesAction_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + next_sub_action_ = value; +} +inline void SharingLog_PreferencesUsage::set_next_sub_action(::location::nearby::proto::sharing::PreferencesAction value) { + _internal_set_next_sub_action(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.PreferencesUsage.next_sub_action) +} + +// ------------------------------------------------------------------- + +// SharingLog_UnknownEvent + +// ------------------------------------------------------------------- + +// SharingLog_EstablishConnection + +// optional .location.nearby.proto.sharing.EstablishConnectionStatus status = 1; +inline bool SharingLog_EstablishConnection::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_EstablishConnection::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::EstablishConnectionStatus SharingLog_EstablishConnection::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::EstablishConnectionStatus >(status_); +} +inline ::location::nearby::proto::sharing::EstablishConnectionStatus SharingLog_EstablishConnection::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.status) + return _internal_status(); +} +inline void SharingLog_EstablishConnection::_internal_set_status(::location::nearby::proto::sharing::EstablishConnectionStatus value) { + assert(::location::nearby::proto::sharing::EstablishConnectionStatus_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + status_ = value; +} +inline void SharingLog_EstablishConnection::set_status(::location::nearby::proto::sharing::EstablishConnectionStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.status) +} + +// optional int64 session_id = 2; +inline bool SharingLog_EstablishConnection::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_EstablishConnection::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_EstablishConnection::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_EstablishConnection::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.session_id) + return _internal_session_id(); +} +inline void SharingLog_EstablishConnection::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000004u; + session_id_ = value; +} +inline void SharingLog_EstablishConnection::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.session_id) +} + +// optional int32 transfer_position = 3; +inline bool SharingLog_EstablishConnection::_internal_has_transfer_position() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_transfer_position() const { + return _internal_has_transfer_position(); +} +inline void SharingLog_EstablishConnection::clear_transfer_position() { + transfer_position_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline int32_t SharingLog_EstablishConnection::_internal_transfer_position() const { + return transfer_position_; +} +inline int32_t SharingLog_EstablishConnection::transfer_position() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.transfer_position) + return _internal_transfer_position(); +} +inline void SharingLog_EstablishConnection::_internal_set_transfer_position(int32_t value) { + _has_bits_[0] |= 0x00000010u; + transfer_position_ = value; +} +inline void SharingLog_EstablishConnection::set_transfer_position(int32_t value) { + _internal_set_transfer_position(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.transfer_position) +} + +// optional int32 concurrent_connections = 4; +inline bool SharingLog_EstablishConnection::_internal_has_concurrent_connections() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_concurrent_connections() const { + return _internal_has_concurrent_connections(); +} +inline void SharingLog_EstablishConnection::clear_concurrent_connections() { + concurrent_connections_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline int32_t SharingLog_EstablishConnection::_internal_concurrent_connections() const { + return concurrent_connections_; +} +inline int32_t SharingLog_EstablishConnection::concurrent_connections() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.concurrent_connections) + return _internal_concurrent_connections(); +} +inline void SharingLog_EstablishConnection::_internal_set_concurrent_connections(int32_t value) { + _has_bits_[0] |= 0x00000040u; + concurrent_connections_ = value; +} +inline void SharingLog_EstablishConnection::set_concurrent_connections(int32_t value) { + _internal_set_concurrent_connections(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.concurrent_connections) +} + +// optional int64 duration_millis = 5; +inline bool SharingLog_EstablishConnection::_internal_has_duration_millis() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_duration_millis() const { + return _internal_has_duration_millis(); +} +inline void SharingLog_EstablishConnection::clear_duration_millis() { + duration_millis_ = int64_t{0}; + _has_bits_[0] &= ~0x00000020u; +} +inline int64_t SharingLog_EstablishConnection::_internal_duration_millis() const { + return duration_millis_; +} +inline int64_t SharingLog_EstablishConnection::duration_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.duration_millis) + return _internal_duration_millis(); +} +inline void SharingLog_EstablishConnection::_internal_set_duration_millis(int64_t value) { + _has_bits_[0] |= 0x00000020u; + duration_millis_ = value; +} +inline void SharingLog_EstablishConnection::set_duration_millis(int64_t value) { + _internal_set_duration_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.duration_millis) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 6; +inline bool SharingLog_EstablishConnection::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_EstablishConnection::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_EstablishConnection::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_EstablishConnection::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_EstablishConnection::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_EstablishConnection::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_EstablishConnection::release_share_target_info() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_EstablishConnection::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.share_target_info) + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_EstablishConnection::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000002u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_EstablishConnection::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.share_target_info) + return _msg; +} +inline void SharingLog_EstablishConnection::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.share_target_info) +} + +// optional string referrer_name = 7; +inline bool SharingLog_EstablishConnection::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_EstablishConnection::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_EstablishConnection::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_EstablishConnection::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.referrer_name) +} +inline std::string* SharingLog_EstablishConnection::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.referrer_name) + return _s; +} +inline const std::string& SharingLog_EstablishConnection::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_EstablishConnection::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_EstablishConnection::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_EstablishConnection::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_EstablishConnection::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.referrer_name) +} + +// optional bool qr_code_flow = 8; +inline bool SharingLog_EstablishConnection::_internal_has_qr_code_flow() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_qr_code_flow() const { + return _internal_has_qr_code_flow(); +} +inline void SharingLog_EstablishConnection::clear_qr_code_flow() { + qr_code_flow_ = false; + _has_bits_[0] &= ~0x00000080u; +} +inline bool SharingLog_EstablishConnection::_internal_qr_code_flow() const { + return qr_code_flow_; +} +inline bool SharingLog_EstablishConnection::qr_code_flow() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.qr_code_flow) + return _internal_qr_code_flow(); +} +inline void SharingLog_EstablishConnection::_internal_set_qr_code_flow(bool value) { + _has_bits_[0] |= 0x00000080u; + qr_code_flow_ = value; +} +inline void SharingLog_EstablishConnection::set_qr_code_flow(bool value) { + _internal_set_qr_code_flow(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.qr_code_flow) +} + +// optional bool is_incoming_connection = 9; +inline bool SharingLog_EstablishConnection::_internal_has_is_incoming_connection() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool SharingLog_EstablishConnection::has_is_incoming_connection() const { + return _internal_has_is_incoming_connection(); +} +inline void SharingLog_EstablishConnection::clear_is_incoming_connection() { + is_incoming_connection_ = false; + _has_bits_[0] &= ~0x00000100u; +} +inline bool SharingLog_EstablishConnection::_internal_is_incoming_connection() const { + return is_incoming_connection_; +} +inline bool SharingLog_EstablishConnection::is_incoming_connection() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.is_incoming_connection) + return _internal_is_incoming_connection(); +} +inline void SharingLog_EstablishConnection::_internal_set_is_incoming_connection(bool value) { + _has_bits_[0] |= 0x00000100u; + is_incoming_connection_ = value; +} +inline void SharingLog_EstablishConnection::set_is_incoming_connection(bool value) { + _internal_set_is_incoming_connection(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EstablishConnection.is_incoming_connection) +} + +// ------------------------------------------------------------------- + +// SharingLog_AcceptAgreements + +// ------------------------------------------------------------------- + +// SharingLog_DeclineAgreements + +// ------------------------------------------------------------------- + +// SharingLog_EnableNearbySharing + +// optional .location.nearby.proto.sharing.NearbySharingStatus status = 1; +inline bool SharingLog_EnableNearbySharing::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_EnableNearbySharing::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_EnableNearbySharing::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::NearbySharingStatus SharingLog_EnableNearbySharing::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::NearbySharingStatus >(status_); +} +inline ::location::nearby::proto::sharing::NearbySharingStatus SharingLog_EnableNearbySharing::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing.status) + return _internal_status(); +} +inline void SharingLog_EnableNearbySharing::_internal_set_status(::location::nearby::proto::sharing::NearbySharingStatus value) { + assert(::location::nearby::proto::sharing::NearbySharingStatus_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + status_ = value; +} +inline void SharingLog_EnableNearbySharing::set_status(::location::nearby::proto::sharing::NearbySharingStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing.status) +} + +// optional bool has_opted_in = 2; +inline bool SharingLog_EnableNearbySharing::_internal_has_has_opted_in() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_EnableNearbySharing::has_has_opted_in() const { + return _internal_has_has_opted_in(); +} +inline void SharingLog_EnableNearbySharing::clear_has_opted_in() { + has_opted_in_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool SharingLog_EnableNearbySharing::_internal_has_opted_in() const { + return has_opted_in_; +} +inline bool SharingLog_EnableNearbySharing::has_opted_in() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing.has_opted_in) + return _internal_has_opted_in(); +} +inline void SharingLog_EnableNearbySharing::_internal_set_has_opted_in(bool value) { + _has_bits_[0] |= 0x00000002u; + has_opted_in_ = value; +} +inline void SharingLog_EnableNearbySharing::set_has_opted_in(bool value) { + _internal_set_has_opted_in(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing.has_opted_in) +} + +// ------------------------------------------------------------------- + +// SharingLog_SetAccount + +// optional .location.nearby.proto.sharing.ActivityName activity_name = 1; +inline bool SharingLog_SetAccount::_internal_has_activity_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SetAccount::has_activity_name() const { + return _internal_has_activity_name(); +} +inline void SharingLog_SetAccount::clear_activity_name() { + activity_name_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_SetAccount::_internal_activity_name() const { + return static_cast< ::location::nearby::proto::sharing::ActivityName >(activity_name_); +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_SetAccount::activity_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetAccount.activity_name) + return _internal_activity_name(); +} +inline void SharingLog_SetAccount::_internal_set_activity_name(::location::nearby::proto::sharing::ActivityName value) { + assert(::location::nearby::proto::sharing::ActivityName_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + activity_name_ = value; +} +inline void SharingLog_SetAccount::set_activity_name(::location::nearby::proto::sharing::ActivityName value) { + _internal_set_activity_name(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetAccount.activity_name) +} + +// ------------------------------------------------------------------- + +// SharingLog_SetVisibility + +// optional .location.nearby.proto.sharing.Visibility visibility = 1; +inline bool SharingLog_SetVisibility::_internal_has_visibility() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SetVisibility::has_visibility() const { + return _internal_has_visibility(); +} +inline void SharingLog_SetVisibility::clear_visibility() { + visibility_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_SetVisibility::_internal_visibility() const { + return static_cast< ::location::nearby::proto::sharing::Visibility >(visibility_); +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_SetVisibility::visibility() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetVisibility.visibility) + return _internal_visibility(); +} +inline void SharingLog_SetVisibility::_internal_set_visibility(::location::nearby::proto::sharing::Visibility value) { + assert(::location::nearby::proto::sharing::Visibility_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + visibility_ = value; +} +inline void SharingLog_SetVisibility::set_visibility(::location::nearby::proto::sharing::Visibility value) { + _internal_set_visibility(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetVisibility.visibility) +} + +// optional .location.nearby.proto.sharing.Visibility source_visibility = 2; +inline bool SharingLog_SetVisibility::_internal_has_source_visibility() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_SetVisibility::has_source_visibility() const { + return _internal_has_source_visibility(); +} +inline void SharingLog_SetVisibility::clear_source_visibility() { + source_visibility_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_SetVisibility::_internal_source_visibility() const { + return static_cast< ::location::nearby::proto::sharing::Visibility >(source_visibility_); +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_SetVisibility::source_visibility() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetVisibility.source_visibility) + return _internal_source_visibility(); +} +inline void SharingLog_SetVisibility::_internal_set_source_visibility(::location::nearby::proto::sharing::Visibility value) { + assert(::location::nearby::proto::sharing::Visibility_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + source_visibility_ = value; +} +inline void SharingLog_SetVisibility::set_source_visibility(::location::nearby::proto::sharing::Visibility value) { + _internal_set_source_visibility(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetVisibility.source_visibility) +} + +// optional int64 duration_millis = 3; +inline bool SharingLog_SetVisibility::_internal_has_duration_millis() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_SetVisibility::has_duration_millis() const { + return _internal_has_duration_millis(); +} +inline void SharingLog_SetVisibility::clear_duration_millis() { + duration_millis_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_SetVisibility::_internal_duration_millis() const { + return duration_millis_; +} +inline int64_t SharingLog_SetVisibility::duration_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetVisibility.duration_millis) + return _internal_duration_millis(); +} +inline void SharingLog_SetVisibility::_internal_set_duration_millis(int64_t value) { + _has_bits_[0] |= 0x00000004u; + duration_millis_ = value; +} +inline void SharingLog_SetVisibility::set_duration_millis(int64_t value) { + _internal_set_duration_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetVisibility.duration_millis) +} + +// optional .location.nearby.proto.sharing.ActivityName source_activity_name = 4; +inline bool SharingLog_SetVisibility::_internal_has_source_activity_name() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_SetVisibility::has_source_activity_name() const { + return _internal_has_source_activity_name(); +} +inline void SharingLog_SetVisibility::clear_source_activity_name() { + source_activity_name_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_SetVisibility::_internal_source_activity_name() const { + return static_cast< ::location::nearby::proto::sharing::ActivityName >(source_activity_name_); +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_SetVisibility::source_activity_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetVisibility.source_activity_name) + return _internal_source_activity_name(); +} +inline void SharingLog_SetVisibility::_internal_set_source_activity_name(::location::nearby::proto::sharing::ActivityName value) { + assert(::location::nearby::proto::sharing::ActivityName_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + source_activity_name_ = value; +} +inline void SharingLog_SetVisibility::set_source_activity_name(::location::nearby::proto::sharing::ActivityName value) { + _internal_set_source_activity_name(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetVisibility.source_activity_name) +} + +// ------------------------------------------------------------------- + +// SharingLog_SetDataUsage + +// optional .location.nearby.proto.sharing.DataUsage original_preference = 1; +inline bool SharingLog_SetDataUsage::_internal_has_original_preference() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SetDataUsage::has_original_preference() const { + return _internal_has_original_preference(); +} +inline void SharingLog_SetDataUsage::clear_original_preference() { + original_preference_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_SetDataUsage::_internal_original_preference() const { + return static_cast< ::location::nearby::proto::sharing::DataUsage >(original_preference_); +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_SetDataUsage::original_preference() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetDataUsage.original_preference) + return _internal_original_preference(); +} +inline void SharingLog_SetDataUsage::_internal_set_original_preference(::location::nearby::proto::sharing::DataUsage value) { + assert(::location::nearby::proto::sharing::DataUsage_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + original_preference_ = value; +} +inline void SharingLog_SetDataUsage::set_original_preference(::location::nearby::proto::sharing::DataUsage value) { + _internal_set_original_preference(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetDataUsage.original_preference) +} + +// optional .location.nearby.proto.sharing.DataUsage preference = 2; +inline bool SharingLog_SetDataUsage::_internal_has_preference() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_SetDataUsage::has_preference() const { + return _internal_has_preference(); +} +inline void SharingLog_SetDataUsage::clear_preference() { + preference_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_SetDataUsage::_internal_preference() const { + return static_cast< ::location::nearby::proto::sharing::DataUsage >(preference_); +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_SetDataUsage::preference() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetDataUsage.preference) + return _internal_preference(); +} +inline void SharingLog_SetDataUsage::_internal_set_preference(::location::nearby::proto::sharing::DataUsage value) { + assert(::location::nearby::proto::sharing::DataUsage_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + preference_ = value; +} +inline void SharingLog_SetDataUsage::set_preference(::location::nearby::proto::sharing::DataUsage value) { + _internal_set_preference(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetDataUsage.preference) +} + +// ------------------------------------------------------------------- + +// SharingLog_ScanForShareTargetsStart + +// optional int64 session_id = 1; +inline bool SharingLog_ScanForShareTargetsStart::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ScanForShareTargetsStart::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ScanForShareTargetsStart::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_ScanForShareTargetsStart::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ScanForShareTargetsStart::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.session_id) + return _internal_session_id(); +} +inline void SharingLog_ScanForShareTargetsStart::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + session_id_ = value; +} +inline void SharingLog_ScanForShareTargetsStart::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.session_id) +} + +// optional .location.nearby.proto.sharing.SessionStatus status = 2; +inline bool SharingLog_ScanForShareTargetsStart::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ScanForShareTargetsStart::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_ScanForShareTargetsStart::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::SessionStatus SharingLog_ScanForShareTargetsStart::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::SessionStatus >(status_); +} +inline ::location::nearby::proto::sharing::SessionStatus SharingLog_ScanForShareTargetsStart::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.status) + return _internal_status(); +} +inline void SharingLog_ScanForShareTargetsStart::_internal_set_status(::location::nearby::proto::sharing::SessionStatus value) { + assert(::location::nearby::proto::sharing::SessionStatus_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + status_ = value; +} +inline void SharingLog_ScanForShareTargetsStart::set_status(::location::nearby::proto::sharing::SessionStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.status) +} + +// optional .location.nearby.proto.sharing.ScanType scan_type = 3; +inline bool SharingLog_ScanForShareTargetsStart::_internal_has_scan_type() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_ScanForShareTargetsStart::has_scan_type() const { + return _internal_has_scan_type(); +} +inline void SharingLog_ScanForShareTargetsStart::clear_scan_type() { + scan_type_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::ScanType SharingLog_ScanForShareTargetsStart::_internal_scan_type() const { + return static_cast< ::location::nearby::proto::sharing::ScanType >(scan_type_); +} +inline ::location::nearby::proto::sharing::ScanType SharingLog_ScanForShareTargetsStart::scan_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.scan_type) + return _internal_scan_type(); +} +inline void SharingLog_ScanForShareTargetsStart::_internal_set_scan_type(::location::nearby::proto::sharing::ScanType value) { + assert(::location::nearby::proto::sharing::ScanType_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + scan_type_ = value; +} +inline void SharingLog_ScanForShareTargetsStart::set_scan_type(::location::nearby::proto::sharing::ScanType value) { + _internal_set_scan_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.scan_type) +} + +// optional int64 flow_id = 4; +inline bool SharingLog_ScanForShareTargetsStart::_internal_has_flow_id() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_ScanForShareTargetsStart::has_flow_id() const { + return _internal_has_flow_id(); +} +inline void SharingLog_ScanForShareTargetsStart::clear_flow_id() { + flow_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000010u; +} +inline int64_t SharingLog_ScanForShareTargetsStart::_internal_flow_id() const { + return flow_id_; +} +inline int64_t SharingLog_ScanForShareTargetsStart::flow_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.flow_id) + return _internal_flow_id(); +} +inline void SharingLog_ScanForShareTargetsStart::_internal_set_flow_id(int64_t value) { + _has_bits_[0] |= 0x00000010u; + flow_id_ = value; +} +inline void SharingLog_ScanForShareTargetsStart::set_flow_id(int64_t value) { + _internal_set_flow_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.flow_id) +} + +// optional string referrer_name = 5; +inline bool SharingLog_ScanForShareTargetsStart::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ScanForShareTargetsStart::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_ScanForShareTargetsStart::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_ScanForShareTargetsStart::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_ScanForShareTargetsStart::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.referrer_name) +} +inline std::string* SharingLog_ScanForShareTargetsStart::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.referrer_name) + return _s; +} +inline const std::string& SharingLog_ScanForShareTargetsStart::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_ScanForShareTargetsStart::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_ScanForShareTargetsStart::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_ScanForShareTargetsStart::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_ScanForShareTargetsStart::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart.referrer_name) +} + +// ------------------------------------------------------------------- + +// SharingLog_ScanForShareTargetsEnd + +// optional int64 session_id = 1; +inline bool SharingLog_ScanForShareTargetsEnd::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ScanForShareTargetsEnd::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ScanForShareTargetsEnd::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_ScanForShareTargetsEnd::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ScanForShareTargetsEnd::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd.session_id) + return _internal_session_id(); +} +inline void SharingLog_ScanForShareTargetsEnd::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000001u; + session_id_ = value; +} +inline void SharingLog_ScanForShareTargetsEnd::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd.session_id) +} + +// ------------------------------------------------------------------- + +// SharingLog_AdvertiseDevicePresenceStart + +// optional int64 session_id = 1 [deprecated = true]; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_AdvertiseDevicePresenceStart::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_AdvertiseDevicePresenceStart::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.session_id) + return _internal_session_id(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + session_id_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.session_id) +} + +// optional .location.nearby.proto.sharing.Visibility visibility = 2; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_visibility() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_visibility() const { + return _internal_has_visibility(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_visibility() { + visibility_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_AdvertiseDevicePresenceStart::_internal_visibility() const { + return static_cast< ::location::nearby::proto::sharing::Visibility >(visibility_); +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_AdvertiseDevicePresenceStart::visibility() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.visibility) + return _internal_visibility(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_visibility(::location::nearby::proto::sharing::Visibility value) { + assert(::location::nearby::proto::sharing::Visibility_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + visibility_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_visibility(::location::nearby::proto::sharing::Visibility value) { + _internal_set_visibility(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.visibility) +} + +// optional .location.nearby.proto.sharing.SessionStatus status = 3; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::SessionStatus SharingLog_AdvertiseDevicePresenceStart::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::SessionStatus >(status_); +} +inline ::location::nearby::proto::sharing::SessionStatus SharingLog_AdvertiseDevicePresenceStart::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.status) + return _internal_status(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_status(::location::nearby::proto::sharing::SessionStatus value) { + assert(::location::nearby::proto::sharing::SessionStatus_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + status_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_status(::location::nearby::proto::sharing::SessionStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.status) +} + +// optional .location.nearby.proto.sharing.DataUsage data_usage = 4; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_data_usage() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_data_usage() const { + return _internal_has_data_usage(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_data_usage() { + data_usage_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_AdvertiseDevicePresenceStart::_internal_data_usage() const { + return static_cast< ::location::nearby::proto::sharing::DataUsage >(data_usage_); +} +inline ::location::nearby::proto::sharing::DataUsage SharingLog_AdvertiseDevicePresenceStart::data_usage() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.data_usage) + return _internal_data_usage(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_data_usage(::location::nearby::proto::sharing::DataUsage value) { + assert(::location::nearby::proto::sharing::DataUsage_IsValid(value)); + _has_bits_[0] |= 0x00000010u; + data_usage_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_data_usage(::location::nearby::proto::sharing::DataUsage value) { + _internal_set_data_usage(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.data_usage) +} + +// optional int32 device_name_size = 5 [deprecated = true]; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_device_name_size() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_device_name_size() const { + return _internal_has_device_name_size(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_device_name_size() { + device_name_size_ = 0; + _has_bits_[0] &= ~0x00000020u; +} +inline int32_t SharingLog_AdvertiseDevicePresenceStart::_internal_device_name_size() const { + return device_name_size_; +} +inline int32_t SharingLog_AdvertiseDevicePresenceStart::device_name_size() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.device_name_size) + return _internal_device_name_size(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_device_name_size(int32_t value) { + _has_bits_[0] |= 0x00000020u; + device_name_size_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_device_name_size(int32_t value) { + _internal_set_device_name_size(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.device_name_size) +} + +// optional string referrer_name = 6; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_AdvertiseDevicePresenceStart::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_AdvertiseDevicePresenceStart::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.referrer_name) +} +inline std::string* SharingLog_AdvertiseDevicePresenceStart::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.referrer_name) + return _s; +} +inline const std::string& SharingLog_AdvertiseDevicePresenceStart::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_AdvertiseDevicePresenceStart::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_AdvertiseDevicePresenceStart::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.referrer_name) +} + +// optional .location.nearby.proto.sharing.AdvertisingMode advertising_mode = 7; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_advertising_mode() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_advertising_mode() const { + return _internal_has_advertising_mode(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_advertising_mode() { + advertising_mode_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline ::location::nearby::proto::sharing::AdvertisingMode SharingLog_AdvertiseDevicePresenceStart::_internal_advertising_mode() const { + return static_cast< ::location::nearby::proto::sharing::AdvertisingMode >(advertising_mode_); +} +inline ::location::nearby::proto::sharing::AdvertisingMode SharingLog_AdvertiseDevicePresenceStart::advertising_mode() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.advertising_mode) + return _internal_advertising_mode(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_advertising_mode(::location::nearby::proto::sharing::AdvertisingMode value) { + assert(::location::nearby::proto::sharing::AdvertisingMode_IsValid(value)); + _has_bits_[0] |= 0x00000040u; + advertising_mode_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_advertising_mode(::location::nearby::proto::sharing::AdvertisingMode value) { + _internal_set_advertising_mode(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.advertising_mode) +} + +// optional bool qr_code_flow = 8; +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_has_qr_code_flow() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::has_qr_code_flow() const { + return _internal_has_qr_code_flow(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::clear_qr_code_flow() { + qr_code_flow_ = false; + _has_bits_[0] &= ~0x00000080u; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::_internal_qr_code_flow() const { + return qr_code_flow_; +} +inline bool SharingLog_AdvertiseDevicePresenceStart::qr_code_flow() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.qr_code_flow) + return _internal_qr_code_flow(); +} +inline void SharingLog_AdvertiseDevicePresenceStart::_internal_set_qr_code_flow(bool value) { + _has_bits_[0] |= 0x00000080u; + qr_code_flow_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceStart::set_qr_code_flow(bool value) { + _internal_set_qr_code_flow(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart.qr_code_flow) +} + +// ------------------------------------------------------------------- + +// SharingLog_AdvertiseDevicePresenceEnd + +// optional int64 session_id = 1 [deprecated = true]; +inline bool SharingLog_AdvertiseDevicePresenceEnd::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AdvertiseDevicePresenceEnd::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_AdvertiseDevicePresenceEnd::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_AdvertiseDevicePresenceEnd::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_AdvertiseDevicePresenceEnd::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd.session_id) + return _internal_session_id(); +} +inline void SharingLog_AdvertiseDevicePresenceEnd::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000001u; + session_id_ = value; +} +inline void SharingLog_AdvertiseDevicePresenceEnd::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd.session_id) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendFastInitialization + +// ------------------------------------------------------------------- + +// SharingLog_ReceiveFastInitialization + +// optional int64 time_elapse_since_screen_unlock_millis = 1; +inline bool SharingLog_ReceiveFastInitialization::_internal_has_time_elapse_since_screen_unlock_millis() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ReceiveFastInitialization::has_time_elapse_since_screen_unlock_millis() const { + return _internal_has_time_elapse_since_screen_unlock_millis(); +} +inline void SharingLog_ReceiveFastInitialization::clear_time_elapse_since_screen_unlock_millis() { + time_elapse_since_screen_unlock_millis_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_ReceiveFastInitialization::_internal_time_elapse_since_screen_unlock_millis() const { + return time_elapse_since_screen_unlock_millis_; +} +inline int64_t SharingLog_ReceiveFastInitialization::time_elapse_since_screen_unlock_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization.time_elapse_since_screen_unlock_millis) + return _internal_time_elapse_since_screen_unlock_millis(); +} +inline void SharingLog_ReceiveFastInitialization::_internal_set_time_elapse_since_screen_unlock_millis(int64_t value) { + _has_bits_[0] |= 0x00000001u; + time_elapse_since_screen_unlock_millis_ = value; +} +inline void SharingLog_ReceiveFastInitialization::set_time_elapse_since_screen_unlock_millis(int64_t value) { + _internal_set_time_elapse_since_screen_unlock_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization.time_elapse_since_screen_unlock_millis) +} + +// optional bool notifications_enabled = 2; +inline bool SharingLog_ReceiveFastInitialization::_internal_has_notifications_enabled() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ReceiveFastInitialization::has_notifications_enabled() const { + return _internal_has_notifications_enabled(); +} +inline void SharingLog_ReceiveFastInitialization::clear_notifications_enabled() { + notifications_enabled_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool SharingLog_ReceiveFastInitialization::_internal_notifications_enabled() const { + return notifications_enabled_; +} +inline bool SharingLog_ReceiveFastInitialization::notifications_enabled() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization.notifications_enabled) + return _internal_notifications_enabled(); +} +inline void SharingLog_ReceiveFastInitialization::_internal_set_notifications_enabled(bool value) { + _has_bits_[0] |= 0x00000002u; + notifications_enabled_ = value; +} +inline void SharingLog_ReceiveFastInitialization::set_notifications_enabled(bool value) { + _internal_set_notifications_enabled(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization.notifications_enabled) +} + +// optional bool notifications_filtered = 3; +inline bool SharingLog_ReceiveFastInitialization::_internal_has_notifications_filtered() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ReceiveFastInitialization::has_notifications_filtered() const { + return _internal_has_notifications_filtered(); +} +inline void SharingLog_ReceiveFastInitialization::clear_notifications_filtered() { + notifications_filtered_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool SharingLog_ReceiveFastInitialization::_internal_notifications_filtered() const { + return notifications_filtered_; +} +inline bool SharingLog_ReceiveFastInitialization::notifications_filtered() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization.notifications_filtered) + return _internal_notifications_filtered(); +} +inline void SharingLog_ReceiveFastInitialization::_internal_set_notifications_filtered(bool value) { + _has_bits_[0] |= 0x00000004u; + notifications_filtered_ = value; +} +inline void SharingLog_ReceiveFastInitialization::set_notifications_filtered(bool value) { + _internal_set_notifications_filtered(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization.notifications_filtered) +} + +// ------------------------------------------------------------------- + +// SharingLog_DismissFastInitialization + +// ------------------------------------------------------------------- + +// SharingLog_AutoDismissFastInitialization + +// ------------------------------------------------------------------- + +// SharingLog_EventMetadata + +// optional .location.nearby.proto.sharing.SharingUseCase use_case = 1; +inline bool SharingLog_EventMetadata::_internal_has_use_case() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_use_case() const { + return _internal_has_use_case(); +} +inline void SharingLog_EventMetadata::clear_use_case() { + use_case_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::SharingUseCase SharingLog_EventMetadata::_internal_use_case() const { + return static_cast< ::location::nearby::proto::sharing::SharingUseCase >(use_case_); +} +inline ::location::nearby::proto::sharing::SharingUseCase SharingLog_EventMetadata::use_case() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.use_case) + return _internal_use_case(); +} +inline void SharingLog_EventMetadata::_internal_set_use_case(::location::nearby::proto::sharing::SharingUseCase value) { + assert(::location::nearby::proto::sharing::SharingUseCase_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + use_case_ = value; +} +inline void SharingLog_EventMetadata::set_use_case(::location::nearby::proto::sharing::SharingUseCase value) { + _internal_set_use_case(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.use_case) +} + +// optional bool initial_opt_in = 2; +inline bool SharingLog_EventMetadata::_internal_has_initial_opt_in() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_initial_opt_in() const { + return _internal_has_initial_opt_in(); +} +inline void SharingLog_EventMetadata::clear_initial_opt_in() { + initial_opt_in_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool SharingLog_EventMetadata::_internal_initial_opt_in() const { + return initial_opt_in_; +} +inline bool SharingLog_EventMetadata::initial_opt_in() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.initial_opt_in) + return _internal_initial_opt_in(); +} +inline void SharingLog_EventMetadata::_internal_set_initial_opt_in(bool value) { + _has_bits_[0] |= 0x00000002u; + initial_opt_in_ = value; +} +inline void SharingLog_EventMetadata::set_initial_opt_in(bool value) { + _internal_set_initial_opt_in(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.initial_opt_in) +} + +// optional bool opt_in = 3; +inline bool SharingLog_EventMetadata::_internal_has_opt_in() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_opt_in() const { + return _internal_has_opt_in(); +} +inline void SharingLog_EventMetadata::clear_opt_in() { + opt_in_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool SharingLog_EventMetadata::_internal_opt_in() const { + return opt_in_; +} +inline bool SharingLog_EventMetadata::opt_in() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.opt_in) + return _internal_opt_in(); +} +inline void SharingLog_EventMetadata::_internal_set_opt_in(bool value) { + _has_bits_[0] |= 0x00000004u; + opt_in_ = value; +} +inline void SharingLog_EventMetadata::set_opt_in(bool value) { + _internal_set_opt_in(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.opt_in) +} + +// optional bool initial_enable_status = 4; +inline bool SharingLog_EventMetadata::_internal_has_initial_enable_status() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_initial_enable_status() const { + return _internal_has_initial_enable_status(); +} +inline void SharingLog_EventMetadata::clear_initial_enable_status() { + initial_enable_status_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool SharingLog_EventMetadata::_internal_initial_enable_status() const { + return initial_enable_status_; +} +inline bool SharingLog_EventMetadata::initial_enable_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.initial_enable_status) + return _internal_initial_enable_status(); +} +inline void SharingLog_EventMetadata::_internal_set_initial_enable_status(bool value) { + _has_bits_[0] |= 0x00000008u; + initial_enable_status_ = value; +} +inline void SharingLog_EventMetadata::set_initial_enable_status(bool value) { + _internal_set_initial_enable_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.initial_enable_status) +} + +// optional int64 flow_id = 5; +inline bool SharingLog_EventMetadata::_internal_has_flow_id() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_flow_id() const { + return _internal_has_flow_id(); +} +inline void SharingLog_EventMetadata::clear_flow_id() { + flow_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000010u; +} +inline int64_t SharingLog_EventMetadata::_internal_flow_id() const { + return flow_id_; +} +inline int64_t SharingLog_EventMetadata::flow_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.flow_id) + return _internal_flow_id(); +} +inline void SharingLog_EventMetadata::_internal_set_flow_id(int64_t value) { + _has_bits_[0] |= 0x00000010u; + flow_id_ = value; +} +inline void SharingLog_EventMetadata::set_flow_id(int64_t value) { + _internal_set_flow_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.flow_id) +} + +// optional int64 session_id = 6; +inline bool SharingLog_EventMetadata::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_EventMetadata::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000020u; +} +inline int64_t SharingLog_EventMetadata::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_EventMetadata::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.session_id) + return _internal_session_id(); +} +inline void SharingLog_EventMetadata::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000020u; + session_id_ = value; +} +inline void SharingLog_EventMetadata::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.session_id) +} + +// optional int32 vendor_id = 7; +inline bool SharingLog_EventMetadata::_internal_has_vendor_id() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_EventMetadata::has_vendor_id() const { + return _internal_has_vendor_id(); +} +inline void SharingLog_EventMetadata::clear_vendor_id() { + vendor_id_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline int32_t SharingLog_EventMetadata::_internal_vendor_id() const { + return vendor_id_; +} +inline int32_t SharingLog_EventMetadata::vendor_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.EventMetadata.vendor_id) + return _internal_vendor_id(); +} +inline void SharingLog_EventMetadata::_internal_set_vendor_id(int32_t value) { + _has_bits_[0] |= 0x00000040u; + vendor_id_ = value; +} +inline void SharingLog_EventMetadata::set_vendor_id(int32_t value) { + _internal_set_vendor_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.EventMetadata.vendor_id) +} + +// ------------------------------------------------------------------- + +// SharingLog_DiscoverShareTarget + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; +inline bool SharingLog_DiscoverShareTarget::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_DiscoverShareTarget::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_DiscoverShareTarget::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_DiscoverShareTarget::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_DiscoverShareTarget::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_DiscoverShareTarget::release_share_target_info() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_DiscoverShareTarget::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.share_target_info) + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_DiscoverShareTarget::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000002u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_DiscoverShareTarget::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.share_target_info) + return _msg; +} +inline void SharingLog_DiscoverShareTarget::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.share_target_info) +} + +// optional .google.protobuf.Duration duration_since_scanning = 2; +inline bool SharingLog_DiscoverShareTarget::_internal_has_duration_since_scanning() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || duration_since_scanning_ != nullptr); + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_duration_since_scanning() const { + return _internal_has_duration_since_scanning(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& SharingLog_DiscoverShareTarget::_internal_duration_since_scanning() const { + const ::PROTOBUF_NAMESPACE_ID::Duration* p = duration_since_scanning_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_Duration_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& SharingLog_DiscoverShareTarget::duration_since_scanning() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.duration_since_scanning) + return _internal_duration_since_scanning(); +} +inline void SharingLog_DiscoverShareTarget::unsafe_arena_set_allocated_duration_since_scanning( + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_scanning_); + } + duration_since_scanning_ = duration_since_scanning; + if (duration_since_scanning) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.duration_since_scanning) +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_DiscoverShareTarget::release_duration_since_scanning() { + _has_bits_[0] &= ~0x00000004u; + ::PROTOBUF_NAMESPACE_ID::Duration* temp = duration_since_scanning_; + duration_since_scanning_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_DiscoverShareTarget::unsafe_arena_release_duration_since_scanning() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.duration_since_scanning) + _has_bits_[0] &= ~0x00000004u; + ::PROTOBUF_NAMESPACE_ID::Duration* temp = duration_since_scanning_; + duration_since_scanning_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_DiscoverShareTarget::_internal_mutable_duration_since_scanning() { + _has_bits_[0] |= 0x00000004u; + if (duration_since_scanning_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Duration>(GetArenaForAllocation()); + duration_since_scanning_ = p; + } + return duration_since_scanning_; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_DiscoverShareTarget::mutable_duration_since_scanning() { + ::PROTOBUF_NAMESPACE_ID::Duration* _msg = _internal_mutable_duration_since_scanning(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.duration_since_scanning) + return _msg; +} +inline void SharingLog_DiscoverShareTarget::set_allocated_duration_since_scanning(::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_scanning_); + } + if (duration_since_scanning) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper< + ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_scanning)); + if (message_arena != submessage_arena) { + duration_since_scanning = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, duration_since_scanning, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + duration_since_scanning_ = duration_since_scanning; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.duration_since_scanning) +} + +// optional int64 session_id = 3; +inline bool SharingLog_DiscoverShareTarget::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_DiscoverShareTarget::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000008u; +} +inline int64_t SharingLog_DiscoverShareTarget::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_DiscoverShareTarget::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.session_id) + return _internal_session_id(); +} +inline void SharingLog_DiscoverShareTarget::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000008u; + session_id_ = value; +} +inline void SharingLog_DiscoverShareTarget::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.session_id) +} + +// optional int64 flow_id = 4; +inline bool SharingLog_DiscoverShareTarget::_internal_has_flow_id() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_flow_id() const { + return _internal_has_flow_id(); +} +inline void SharingLog_DiscoverShareTarget::clear_flow_id() { + flow_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000010u; +} +inline int64_t SharingLog_DiscoverShareTarget::_internal_flow_id() const { + return flow_id_; +} +inline int64_t SharingLog_DiscoverShareTarget::flow_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.flow_id) + return _internal_flow_id(); +} +inline void SharingLog_DiscoverShareTarget::_internal_set_flow_id(int64_t value) { + _has_bits_[0] |= 0x00000010u; + flow_id_ = value; +} +inline void SharingLog_DiscoverShareTarget::set_flow_id(int64_t value) { + _internal_set_flow_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.flow_id) +} + +// optional string referrer_name = 5; +inline bool SharingLog_DiscoverShareTarget::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_DiscoverShareTarget::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_DiscoverShareTarget::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_DiscoverShareTarget::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.referrer_name) +} +inline std::string* SharingLog_DiscoverShareTarget::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.referrer_name) + return _s; +} +inline const std::string& SharingLog_DiscoverShareTarget::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_DiscoverShareTarget::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_DiscoverShareTarget::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_DiscoverShareTarget::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_DiscoverShareTarget::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.referrer_name) +} + +// optional int64 latency_since_activity_start_millis = 6 [default = -1]; +inline bool SharingLog_DiscoverShareTarget::_internal_has_latency_since_activity_start_millis() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_latency_since_activity_start_millis() const { + return _internal_has_latency_since_activity_start_millis(); +} +inline void SharingLog_DiscoverShareTarget::clear_latency_since_activity_start_millis() { + latency_since_activity_start_millis_ = int64_t{-1}; + _has_bits_[0] &= ~0x00000040u; +} +inline int64_t SharingLog_DiscoverShareTarget::_internal_latency_since_activity_start_millis() const { + return latency_since_activity_start_millis_; +} +inline int64_t SharingLog_DiscoverShareTarget::latency_since_activity_start_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.latency_since_activity_start_millis) + return _internal_latency_since_activity_start_millis(); +} +inline void SharingLog_DiscoverShareTarget::_internal_set_latency_since_activity_start_millis(int64_t value) { + _has_bits_[0] |= 0x00000040u; + latency_since_activity_start_millis_ = value; +} +inline void SharingLog_DiscoverShareTarget::set_latency_since_activity_start_millis(int64_t value) { + _internal_set_latency_since_activity_start_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.latency_since_activity_start_millis) +} + +// optional .location.nearby.proto.sharing.ScanType scan_type = 7; +inline bool SharingLog_DiscoverShareTarget::_internal_has_scan_type() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_DiscoverShareTarget::has_scan_type() const { + return _internal_has_scan_type(); +} +inline void SharingLog_DiscoverShareTarget::clear_scan_type() { + scan_type_ = 0; + _has_bits_[0] &= ~0x00000020u; +} +inline ::location::nearby::proto::sharing::ScanType SharingLog_DiscoverShareTarget::_internal_scan_type() const { + return static_cast< ::location::nearby::proto::sharing::ScanType >(scan_type_); +} +inline ::location::nearby::proto::sharing::ScanType SharingLog_DiscoverShareTarget::scan_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.scan_type) + return _internal_scan_type(); +} +inline void SharingLog_DiscoverShareTarget::_internal_set_scan_type(::location::nearby::proto::sharing::ScanType value) { + assert(::location::nearby::proto::sharing::ScanType_IsValid(value)); + _has_bits_[0] |= 0x00000020u; + scan_type_ = value; +} +inline void SharingLog_DiscoverShareTarget::set_scan_type(::location::nearby::proto::sharing::ScanType value) { + _internal_set_scan_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget.scan_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_ParsingFailedEndpointId + +// optional string endpoint_id = 1; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_endpoint_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_endpoint_id() const { + return _internal_has_endpoint_id(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_endpoint_id() { + endpoint_id_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_ParsingFailedEndpointId::endpoint_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.endpoint_id) + return _internal_endpoint_id(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_ParsingFailedEndpointId::set_endpoint_id(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + endpoint_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.endpoint_id) +} +inline std::string* SharingLog_ParsingFailedEndpointId::mutable_endpoint_id() { + std::string* _s = _internal_mutable_endpoint_id(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.endpoint_id) + return _s; +} +inline const std::string& SharingLog_ParsingFailedEndpointId::_internal_endpoint_id() const { + return endpoint_id_.Get(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_endpoint_id(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + endpoint_id_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_ParsingFailedEndpointId::_internal_mutable_endpoint_id() { + _has_bits_[0] |= 0x00000001u; + return endpoint_id_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_ParsingFailedEndpointId::release_endpoint_id() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.endpoint_id) + if (!_internal_has_endpoint_id()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = endpoint_id_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (endpoint_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + endpoint_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_ParsingFailedEndpointId::set_allocated_endpoint_id(std::string* endpoint_id) { + if (endpoint_id != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + endpoint_id_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), endpoint_id, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (endpoint_id_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + endpoint_id_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.endpoint_id) +} + +// optional .google.protobuf.Duration duration_since_scanning = 2; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_duration_since_scanning() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || duration_since_scanning_ != nullptr); + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_duration_since_scanning() const { + return _internal_has_duration_since_scanning(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& SharingLog_ParsingFailedEndpointId::_internal_duration_since_scanning() const { + const ::PROTOBUF_NAMESPACE_ID::Duration* p = duration_since_scanning_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_Duration_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& SharingLog_ParsingFailedEndpointId::duration_since_scanning() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_scanning) + return _internal_duration_since_scanning(); +} +inline void SharingLog_ParsingFailedEndpointId::unsafe_arena_set_allocated_duration_since_scanning( + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_scanning_); + } + duration_since_scanning_ = duration_since_scanning; + if (duration_since_scanning) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_scanning) +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::release_duration_since_scanning() { + _has_bits_[0] &= ~0x00000004u; + ::PROTOBUF_NAMESPACE_ID::Duration* temp = duration_since_scanning_; + duration_since_scanning_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::unsafe_arena_release_duration_since_scanning() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_scanning) + _has_bits_[0] &= ~0x00000004u; + ::PROTOBUF_NAMESPACE_ID::Duration* temp = duration_since_scanning_; + duration_since_scanning_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::_internal_mutable_duration_since_scanning() { + _has_bits_[0] |= 0x00000004u; + if (duration_since_scanning_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Duration>(GetArenaForAllocation()); + duration_since_scanning_ = p; + } + return duration_since_scanning_; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::mutable_duration_since_scanning() { + ::PROTOBUF_NAMESPACE_ID::Duration* _msg = _internal_mutable_duration_since_scanning(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_scanning) + return _msg; +} +inline void SharingLog_ParsingFailedEndpointId::set_allocated_duration_since_scanning(::PROTOBUF_NAMESPACE_ID::Duration* duration_since_scanning) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_scanning_); + } + if (duration_since_scanning) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper< + ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_scanning)); + if (message_arena != submessage_arena) { + duration_since_scanning = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, duration_since_scanning, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + duration_since_scanning_ = duration_since_scanning; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_scanning) +} + +// optional int64 session_id = 3; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000010u; +} +inline int64_t SharingLog_ParsingFailedEndpointId::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ParsingFailedEndpointId::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.session_id) + return _internal_session_id(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000010u; + session_id_ = value; +} +inline void SharingLog_ParsingFailedEndpointId::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.session_id) +} + +// optional int64 flow_id = 4; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_flow_id() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_flow_id() const { + return _internal_has_flow_id(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_flow_id() { + flow_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000020u; +} +inline int64_t SharingLog_ParsingFailedEndpointId::_internal_flow_id() const { + return flow_id_; +} +inline int64_t SharingLog_ParsingFailedEndpointId::flow_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.flow_id) + return _internal_flow_id(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_flow_id(int64_t value) { + _has_bits_[0] |= 0x00000020u; + flow_id_ = value; +} +inline void SharingLog_ParsingFailedEndpointId::set_flow_id(int64_t value) { + _internal_set_flow_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.flow_id) +} + +// optional string referrer_name = 5; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& SharingLog_ParsingFailedEndpointId::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_ParsingFailedEndpointId::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000002u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.referrer_name) +} +inline std::string* SharingLog_ParsingFailedEndpointId::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.referrer_name) + return _s; +} +inline const std::string& SharingLog_ParsingFailedEndpointId::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_ParsingFailedEndpointId::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000002u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_ParsingFailedEndpointId::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_ParsingFailedEndpointId::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.referrer_name) +} + +// optional int64 latency_since_activity_start_millis = 6 [default = -1]; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_latency_since_activity_start_millis() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_latency_since_activity_start_millis() const { + return _internal_has_latency_since_activity_start_millis(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_latency_since_activity_start_millis() { + latency_since_activity_start_millis_ = int64_t{-1}; + _has_bits_[0] &= ~0x00000200u; +} +inline int64_t SharingLog_ParsingFailedEndpointId::_internal_latency_since_activity_start_millis() const { + return latency_since_activity_start_millis_; +} +inline int64_t SharingLog_ParsingFailedEndpointId::latency_since_activity_start_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.latency_since_activity_start_millis) + return _internal_latency_since_activity_start_millis(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_latency_since_activity_start_millis(int64_t value) { + _has_bits_[0] |= 0x00000200u; + latency_since_activity_start_millis_ = value; +} +inline void SharingLog_ParsingFailedEndpointId::set_latency_since_activity_start_millis(int64_t value) { + _internal_set_latency_since_activity_start_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.latency_since_activity_start_millis) +} + +// optional .location.nearby.proto.sharing.ScanType scan_type = 7; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_scan_type() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_scan_type() const { + return _internal_has_scan_type(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_scan_type() { + scan_type_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline ::location::nearby::proto::sharing::ScanType SharingLog_ParsingFailedEndpointId::_internal_scan_type() const { + return static_cast< ::location::nearby::proto::sharing::ScanType >(scan_type_); +} +inline ::location::nearby::proto::sharing::ScanType SharingLog_ParsingFailedEndpointId::scan_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.scan_type) + return _internal_scan_type(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_scan_type(::location::nearby::proto::sharing::ScanType value) { + assert(::location::nearby::proto::sharing::ScanType_IsValid(value)); + _has_bits_[0] |= 0x00000040u; + scan_type_ = value; +} +inline void SharingLog_ParsingFailedEndpointId::set_scan_type(::location::nearby::proto::sharing::ScanType value) { + _internal_set_scan_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.scan_type) +} + +// optional .google.protobuf.Duration duration_since_last_sync = 8; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_duration_since_last_sync() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || duration_since_last_sync_ != nullptr); + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_duration_since_last_sync() const { + return _internal_has_duration_since_last_sync(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& SharingLog_ParsingFailedEndpointId::_internal_duration_since_last_sync() const { + const ::PROTOBUF_NAMESPACE_ID::Duration* p = duration_since_last_sync_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_Duration_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& SharingLog_ParsingFailedEndpointId::duration_since_last_sync() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_last_sync) + return _internal_duration_since_last_sync(); +} +inline void SharingLog_ParsingFailedEndpointId::unsafe_arena_set_allocated_duration_since_last_sync( + ::PROTOBUF_NAMESPACE_ID::Duration* duration_since_last_sync) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_last_sync_); + } + duration_since_last_sync_ = duration_since_last_sync; + if (duration_since_last_sync) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_last_sync) +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::release_duration_since_last_sync() { + _has_bits_[0] &= ~0x00000008u; + ::PROTOBUF_NAMESPACE_ID::Duration* temp = duration_since_last_sync_; + duration_since_last_sync_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::unsafe_arena_release_duration_since_last_sync() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_last_sync) + _has_bits_[0] &= ~0x00000008u; + ::PROTOBUF_NAMESPACE_ID::Duration* temp = duration_since_last_sync_; + duration_since_last_sync_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::_internal_mutable_duration_since_last_sync() { + _has_bits_[0] |= 0x00000008u; + if (duration_since_last_sync_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Duration>(GetArenaForAllocation()); + duration_since_last_sync_ = p; + } + return duration_since_last_sync_; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* SharingLog_ParsingFailedEndpointId::mutable_duration_since_last_sync() { + ::PROTOBUF_NAMESPACE_ID::Duration* _msg = _internal_mutable_duration_since_last_sync(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_last_sync) + return _msg; +} +inline void SharingLog_ParsingFailedEndpointId::set_allocated_duration_since_last_sync(::PROTOBUF_NAMESPACE_ID::Duration* duration_since_last_sync) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_last_sync_); + } + if (duration_since_last_sync) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper< + ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(duration_since_last_sync)); + if (message_arena != submessage_arena) { + duration_since_last_sync = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, duration_since_last_sync, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + duration_since_last_sync_ = duration_since_last_sync; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.duration_since_last_sync) +} + +// optional .location.nearby.proto.sharing.ParsingFailedType parsing_failed_type = 9; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_parsing_failed_type() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_parsing_failed_type() const { + return _internal_has_parsing_failed_type(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_parsing_failed_type() { + parsing_failed_type_ = 0; + _has_bits_[0] &= ~0x00000080u; +} +inline ::location::nearby::proto::sharing::ParsingFailedType SharingLog_ParsingFailedEndpointId::_internal_parsing_failed_type() const { + return static_cast< ::location::nearby::proto::sharing::ParsingFailedType >(parsing_failed_type_); +} +inline ::location::nearby::proto::sharing::ParsingFailedType SharingLog_ParsingFailedEndpointId::parsing_failed_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.parsing_failed_type) + return _internal_parsing_failed_type(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_parsing_failed_type(::location::nearby::proto::sharing::ParsingFailedType value) { + assert(::location::nearby::proto::sharing::ParsingFailedType_IsValid(value)); + _has_bits_[0] |= 0x00000080u; + parsing_failed_type_ = value; +} +inline void SharingLog_ParsingFailedEndpointId::set_parsing_failed_type(::location::nearby::proto::sharing::ParsingFailedType value) { + _internal_set_parsing_failed_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.parsing_failed_type) +} + +// optional .location.nearby.proto.sharing.DiscoveryMode discovery_mode = 10; +inline bool SharingLog_ParsingFailedEndpointId::_internal_has_discovery_mode() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool SharingLog_ParsingFailedEndpointId::has_discovery_mode() const { + return _internal_has_discovery_mode(); +} +inline void SharingLog_ParsingFailedEndpointId::clear_discovery_mode() { + discovery_mode_ = 0; + _has_bits_[0] &= ~0x00000100u; +} +inline ::location::nearby::proto::sharing::DiscoveryMode SharingLog_ParsingFailedEndpointId::_internal_discovery_mode() const { + return static_cast< ::location::nearby::proto::sharing::DiscoveryMode >(discovery_mode_); +} +inline ::location::nearby::proto::sharing::DiscoveryMode SharingLog_ParsingFailedEndpointId::discovery_mode() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.discovery_mode) + return _internal_discovery_mode(); +} +inline void SharingLog_ParsingFailedEndpointId::_internal_set_discovery_mode(::location::nearby::proto::sharing::DiscoveryMode value) { + assert(::location::nearby::proto::sharing::DiscoveryMode_IsValid(value)); + _has_bits_[0] |= 0x00000100u; + discovery_mode_ = value; +} +inline void SharingLog_ParsingFailedEndpointId::set_discovery_mode(::location::nearby::proto::sharing::DiscoveryMode value) { + _internal_set_discovery_mode(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId.discovery_mode) +} + +// ------------------------------------------------------------------- + +// SharingLog_DescribeAttachments + +// optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 1; +inline bool SharingLog_DescribeAttachments::_internal_has_attachments_info() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || attachments_info_ != nullptr); + return value; +} +inline bool SharingLog_DescribeAttachments::has_attachments_info() const { + return _internal_has_attachments_info(); +} +inline void SharingLog_DescribeAttachments::clear_attachments_info() { + if (attachments_info_ != nullptr) attachments_info_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_DescribeAttachments::_internal_attachments_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* p = attachments_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AttachmentsInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_DescribeAttachments::attachments_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments.attachments_info) + return _internal_attachments_info(); +} +inline void SharingLog_DescribeAttachments::unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(attachments_info_); + } + attachments_info_ = attachments_info; + if (attachments_info) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments.attachments_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_DescribeAttachments::release_attachments_info() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_DescribeAttachments::unsafe_arena_release_attachments_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments.attachments_info) + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_DescribeAttachments::_internal_mutable_attachments_info() { + _has_bits_[0] |= 0x00000001u; + if (attachments_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>(GetArenaForAllocation()); + attachments_info_ = p; + } + return attachments_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_DescribeAttachments::mutable_attachments_info() { + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _msg = _internal_mutable_attachments_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments.attachments_info) + return _msg; +} +inline void SharingLog_DescribeAttachments::set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete attachments_info_; + } + if (attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>::GetOwningArena(attachments_info); + if (message_arena != submessage_arena) { + attachments_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, attachments_info, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + attachments_info_ = attachments_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.DescribeAttachments.attachments_info) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendIntroduction + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 1; +inline bool SharingLog_SendIntroduction::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_SendIntroduction::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_SendIntroduction::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_SendIntroduction::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_SendIntroduction::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_SendIntroduction::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendIntroduction::release_share_target_info() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendIntroduction::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.share_target_info) + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendIntroduction::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000001u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendIntroduction::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.share_target_info) + return _msg; +} +inline void SharingLog_SendIntroduction::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.share_target_info) +} + +// optional int64 session_id = 2; +inline bool SharingLog_SendIntroduction::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_SendIntroduction::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_SendIntroduction::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_SendIntroduction::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_SendIntroduction::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.session_id) + return _internal_session_id(); +} +inline void SharingLog_SendIntroduction::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + session_id_ = value; +} +inline void SharingLog_SendIntroduction::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.session_id) +} + +// optional int32 transfer_position = 3; +inline bool SharingLog_SendIntroduction::_internal_has_transfer_position() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_SendIntroduction::has_transfer_position() const { + return _internal_has_transfer_position(); +} +inline void SharingLog_SendIntroduction::clear_transfer_position() { + transfer_position_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline int32_t SharingLog_SendIntroduction::_internal_transfer_position() const { + return transfer_position_; +} +inline int32_t SharingLog_SendIntroduction::transfer_position() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.transfer_position) + return _internal_transfer_position(); +} +inline void SharingLog_SendIntroduction::_internal_set_transfer_position(int32_t value) { + _has_bits_[0] |= 0x00000004u; + transfer_position_ = value; +} +inline void SharingLog_SendIntroduction::set_transfer_position(int32_t value) { + _internal_set_transfer_position(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.transfer_position) +} + +// optional int32 concurrent_connections = 4; +inline bool SharingLog_SendIntroduction::_internal_has_concurrent_connections() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_SendIntroduction::has_concurrent_connections() const { + return _internal_has_concurrent_connections(); +} +inline void SharingLog_SendIntroduction::clear_concurrent_connections() { + concurrent_connections_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline int32_t SharingLog_SendIntroduction::_internal_concurrent_connections() const { + return concurrent_connections_; +} +inline int32_t SharingLog_SendIntroduction::concurrent_connections() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.concurrent_connections) + return _internal_concurrent_connections(); +} +inline void SharingLog_SendIntroduction::_internal_set_concurrent_connections(int32_t value) { + _has_bits_[0] |= 0x00000008u; + concurrent_connections_ = value; +} +inline void SharingLog_SendIntroduction::set_concurrent_connections(int32_t value) { + _internal_set_concurrent_connections(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendIntroduction.concurrent_connections) +} + +// ------------------------------------------------------------------- + +// SharingLog_ReceiveIntroduction + +// optional int64 session_id = 1; +inline bool SharingLog_ReceiveIntroduction::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ReceiveIntroduction::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ReceiveIntroduction::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_ReceiveIntroduction::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ReceiveIntroduction::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.session_id) + return _internal_session_id(); +} +inline void SharingLog_ReceiveIntroduction::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000004u; + session_id_ = value; +} +inline void SharingLog_ReceiveIntroduction::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.session_id) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 2; +inline bool SharingLog_ReceiveIntroduction::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_ReceiveIntroduction::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_ReceiveIntroduction::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_ReceiveIntroduction::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_ReceiveIntroduction::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_ReceiveIntroduction::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveIntroduction::release_share_target_info() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveIntroduction::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.share_target_info) + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveIntroduction::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000002u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveIntroduction::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.share_target_info) + return _msg; +} +inline void SharingLog_ReceiveIntroduction::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.share_target_info) +} + +// optional string referrer_name = 3; +inline bool SharingLog_ReceiveIntroduction::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ReceiveIntroduction::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_ReceiveIntroduction::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_ReceiveIntroduction::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_ReceiveIntroduction::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.referrer_name) +} +inline std::string* SharingLog_ReceiveIntroduction::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.referrer_name) + return _s; +} +inline const std::string& SharingLog_ReceiveIntroduction::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_ReceiveIntroduction::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_ReceiveIntroduction::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_ReceiveIntroduction::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_ReceiveIntroduction::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction.referrer_name) +} + +// ------------------------------------------------------------------- + +// SharingLog_RespondToIntroduction + +// optional .location.nearby.proto.sharing.ResponseToIntroduction action = 1; +inline bool SharingLog_RespondToIntroduction::_internal_has_action() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_RespondToIntroduction::has_action() const { + return _internal_has_action(); +} +inline void SharingLog_RespondToIntroduction::clear_action() { + action_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::ResponseToIntroduction SharingLog_RespondToIntroduction::_internal_action() const { + return static_cast< ::location::nearby::proto::sharing::ResponseToIntroduction >(action_); +} +inline ::location::nearby::proto::sharing::ResponseToIntroduction SharingLog_RespondToIntroduction::action() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction.action) + return _internal_action(); +} +inline void SharingLog_RespondToIntroduction::_internal_set_action(::location::nearby::proto::sharing::ResponseToIntroduction value) { + assert(::location::nearby::proto::sharing::ResponseToIntroduction_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + action_ = value; +} +inline void SharingLog_RespondToIntroduction::set_action(::location::nearby::proto::sharing::ResponseToIntroduction value) { + _internal_set_action(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction.action) +} + +// optional int64 session_id = 2; +inline bool SharingLog_RespondToIntroduction::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_RespondToIntroduction::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_RespondToIntroduction::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_RespondToIntroduction::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_RespondToIntroduction::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction.session_id) + return _internal_session_id(); +} +inline void SharingLog_RespondToIntroduction::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000001u; + session_id_ = value; +} +inline void SharingLog_RespondToIntroduction::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction.session_id) +} + +// optional bool qr_code_flow = 3; +inline bool SharingLog_RespondToIntroduction::_internal_has_qr_code_flow() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_RespondToIntroduction::has_qr_code_flow() const { + return _internal_has_qr_code_flow(); +} +inline void SharingLog_RespondToIntroduction::clear_qr_code_flow() { + qr_code_flow_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool SharingLog_RespondToIntroduction::_internal_qr_code_flow() const { + return qr_code_flow_; +} +inline bool SharingLog_RespondToIntroduction::qr_code_flow() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction.qr_code_flow) + return _internal_qr_code_flow(); +} +inline void SharingLog_RespondToIntroduction::_internal_set_qr_code_flow(bool value) { + _has_bits_[0] |= 0x00000004u; + qr_code_flow_ = value; +} +inline void SharingLog_RespondToIntroduction::set_qr_code_flow(bool value) { + _internal_set_qr_code_flow(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction.qr_code_flow) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendAttachmentsStart + +// optional int64 session_id = 1; +inline bool SharingLog_SendAttachmentsStart::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsStart::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_SendAttachmentsStart::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_SendAttachmentsStart::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_SendAttachmentsStart::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.session_id) + return _internal_session_id(); +} +inline void SharingLog_SendAttachmentsStart::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + session_id_ = value; +} +inline void SharingLog_SendAttachmentsStart::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.session_id) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; +inline bool SharingLog_SendAttachmentsStart::_internal_has_attachments_info() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || attachments_info_ != nullptr); + return value; +} +inline bool SharingLog_SendAttachmentsStart::has_attachments_info() const { + return _internal_has_attachments_info(); +} +inline void SharingLog_SendAttachmentsStart::clear_attachments_info() { + if (attachments_info_ != nullptr) attachments_info_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_SendAttachmentsStart::_internal_attachments_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* p = attachments_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AttachmentsInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_SendAttachmentsStart::attachments_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.attachments_info) + return _internal_attachments_info(); +} +inline void SharingLog_SendAttachmentsStart::unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(attachments_info_); + } + attachments_info_ = attachments_info; + if (attachments_info) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.attachments_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsStart::release_attachments_info() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsStart::unsafe_arena_release_attachments_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.attachments_info) + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsStart::_internal_mutable_attachments_info() { + _has_bits_[0] |= 0x00000001u; + if (attachments_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>(GetArenaForAllocation()); + attachments_info_ = p; + } + return attachments_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsStart::mutable_attachments_info() { + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _msg = _internal_mutable_attachments_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.attachments_info) + return _msg; +} +inline void SharingLog_SendAttachmentsStart::set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete attachments_info_; + } + if (attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>::GetOwningArena(attachments_info); + if (message_arena != submessage_arena) { + attachments_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, attachments_info, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + attachments_info_ = attachments_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.attachments_info) +} + +// optional int32 transfer_position = 3; +inline bool SharingLog_SendAttachmentsStart::_internal_has_transfer_position() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsStart::has_transfer_position() const { + return _internal_has_transfer_position(); +} +inline void SharingLog_SendAttachmentsStart::clear_transfer_position() { + transfer_position_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline int32_t SharingLog_SendAttachmentsStart::_internal_transfer_position() const { + return transfer_position_; +} +inline int32_t SharingLog_SendAttachmentsStart::transfer_position() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.transfer_position) + return _internal_transfer_position(); +} +inline void SharingLog_SendAttachmentsStart::_internal_set_transfer_position(int32_t value) { + _has_bits_[0] |= 0x00000004u; + transfer_position_ = value; +} +inline void SharingLog_SendAttachmentsStart::set_transfer_position(int32_t value) { + _internal_set_transfer_position(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.transfer_position) +} + +// optional int32 concurrent_connections = 4; +inline bool SharingLog_SendAttachmentsStart::_internal_has_concurrent_connections() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsStart::has_concurrent_connections() const { + return _internal_has_concurrent_connections(); +} +inline void SharingLog_SendAttachmentsStart::clear_concurrent_connections() { + concurrent_connections_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline int32_t SharingLog_SendAttachmentsStart::_internal_concurrent_connections() const { + return concurrent_connections_; +} +inline int32_t SharingLog_SendAttachmentsStart::concurrent_connections() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.concurrent_connections) + return _internal_concurrent_connections(); +} +inline void SharingLog_SendAttachmentsStart::_internal_set_concurrent_connections(int32_t value) { + _has_bits_[0] |= 0x00000008u; + concurrent_connections_ = value; +} +inline void SharingLog_SendAttachmentsStart::set_concurrent_connections(int32_t value) { + _internal_set_concurrent_connections(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.concurrent_connections) +} + +// optional bool qr_code_flow = 5; +inline bool SharingLog_SendAttachmentsStart::_internal_has_qr_code_flow() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsStart::has_qr_code_flow() const { + return _internal_has_qr_code_flow(); +} +inline void SharingLog_SendAttachmentsStart::clear_qr_code_flow() { + qr_code_flow_ = false; + _has_bits_[0] &= ~0x00000010u; +} +inline bool SharingLog_SendAttachmentsStart::_internal_qr_code_flow() const { + return qr_code_flow_; +} +inline bool SharingLog_SendAttachmentsStart::qr_code_flow() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.qr_code_flow) + return _internal_qr_code_flow(); +} +inline void SharingLog_SendAttachmentsStart::_internal_set_qr_code_flow(bool value) { + _has_bits_[0] |= 0x00000010u; + qr_code_flow_ = value; +} +inline void SharingLog_SendAttachmentsStart::set_qr_code_flow(bool value) { + _internal_set_qr_code_flow(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart.qr_code_flow) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendAttachmentsEnd + +// optional int64 session_id = 1; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_SendAttachmentsEnd::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000008u; +} +inline int64_t SharingLog_SendAttachmentsEnd::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_SendAttachmentsEnd::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.session_id) + return _internal_session_id(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000008u; + session_id_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.session_id) +} + +// optional int64 sent_bytes = 2; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_sent_bytes() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_sent_bytes() const { + return _internal_has_sent_bytes(); +} +inline void SharingLog_SendAttachmentsEnd::clear_sent_bytes() { + sent_bytes_ = int64_t{0}; + _has_bits_[0] &= ~0x00000010u; +} +inline int64_t SharingLog_SendAttachmentsEnd::_internal_sent_bytes() const { + return sent_bytes_; +} +inline int64_t SharingLog_SendAttachmentsEnd::sent_bytes() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.sent_bytes) + return _internal_sent_bytes(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_sent_bytes(int64_t value) { + _has_bits_[0] |= 0x00000010u; + sent_bytes_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_sent_bytes(int64_t value) { + _internal_set_sent_bytes(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.sent_bytes) +} + +// optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_SendAttachmentsEnd::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000020u; +} +inline ::location::nearby::proto::sharing::AttachmentTransmissionStatus SharingLog_SendAttachmentsEnd::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentTransmissionStatus >(status_); +} +inline ::location::nearby::proto::sharing::AttachmentTransmissionStatus SharingLog_SendAttachmentsEnd::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.status) + return _internal_status(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value) { + assert(::location::nearby::proto::sharing::AttachmentTransmissionStatus_IsValid(value)); + _has_bits_[0] |= 0x00000020u; + status_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.status) +} + +// optional int32 transfer_position = 4; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_transfer_position() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_transfer_position() const { + return _internal_has_transfer_position(); +} +inline void SharingLog_SendAttachmentsEnd::clear_transfer_position() { + transfer_position_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline int32_t SharingLog_SendAttachmentsEnd::_internal_transfer_position() const { + return transfer_position_; +} +inline int32_t SharingLog_SendAttachmentsEnd::transfer_position() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.transfer_position) + return _internal_transfer_position(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_transfer_position(int32_t value) { + _has_bits_[0] |= 0x00000040u; + transfer_position_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_transfer_position(int32_t value) { + _internal_set_transfer_position(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.transfer_position) +} + +// optional int32 concurrent_connections = 5; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_concurrent_connections() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_concurrent_connections() const { + return _internal_has_concurrent_connections(); +} +inline void SharingLog_SendAttachmentsEnd::clear_concurrent_connections() { + concurrent_connections_ = 0; + _has_bits_[0] &= ~0x00000100u; +} +inline int32_t SharingLog_SendAttachmentsEnd::_internal_concurrent_connections() const { + return concurrent_connections_; +} +inline int32_t SharingLog_SendAttachmentsEnd::concurrent_connections() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.concurrent_connections) + return _internal_concurrent_connections(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_concurrent_connections(int32_t value) { + _has_bits_[0] |= 0x00000100u; + concurrent_connections_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_concurrent_connections(int32_t value) { + _internal_set_concurrent_connections(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.concurrent_connections) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 6; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_attachments_info() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || attachments_info_ != nullptr); + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_attachments_info() const { + return _internal_has_attachments_info(); +} +inline void SharingLog_SendAttachmentsEnd::clear_attachments_info() { + if (attachments_info_ != nullptr) attachments_info_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_SendAttachmentsEnd::_internal_attachments_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* p = attachments_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AttachmentsInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_SendAttachmentsEnd::attachments_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.attachments_info) + return _internal_attachments_info(); +} +inline void SharingLog_SendAttachmentsEnd::unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(attachments_info_); + } + attachments_info_ = attachments_info; + if (attachments_info) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.attachments_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsEnd::release_attachments_info() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsEnd::unsafe_arena_release_attachments_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.attachments_info) + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsEnd::_internal_mutable_attachments_info() { + _has_bits_[0] |= 0x00000002u; + if (attachments_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>(GetArenaForAllocation()); + attachments_info_ = p; + } + return attachments_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_SendAttachmentsEnd::mutable_attachments_info() { + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _msg = _internal_mutable_attachments_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.attachments_info) + return _msg; +} +inline void SharingLog_SendAttachmentsEnd::set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete attachments_info_; + } + if (attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>::GetOwningArena(attachments_info); + if (message_arena != submessage_arena) { + attachments_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, attachments_info, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + attachments_info_ = attachments_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.attachments_info) +} + +// optional int64 duration_millis = 7; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_duration_millis() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_duration_millis() const { + return _internal_has_duration_millis(); +} +inline void SharingLog_SendAttachmentsEnd::clear_duration_millis() { + duration_millis_ = int64_t{0}; + _has_bits_[0] &= ~0x00000080u; +} +inline int64_t SharingLog_SendAttachmentsEnd::_internal_duration_millis() const { + return duration_millis_; +} +inline int64_t SharingLog_SendAttachmentsEnd::duration_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.duration_millis) + return _internal_duration_millis(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_duration_millis(int64_t value) { + _has_bits_[0] |= 0x00000080u; + duration_millis_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_duration_millis(int64_t value) { + _internal_set_duration_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.duration_millis) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 8; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_SendAttachmentsEnd::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000004u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_SendAttachmentsEnd::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_SendAttachmentsEnd::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_SendAttachmentsEnd::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendAttachmentsEnd::release_share_target_info() { + _has_bits_[0] &= ~0x00000004u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendAttachmentsEnd::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.share_target_info) + _has_bits_[0] &= ~0x00000004u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendAttachmentsEnd::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000004u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendAttachmentsEnd::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.share_target_info) + return _msg; +} +inline void SharingLog_SendAttachmentsEnd::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.share_target_info) +} + +// optional string referrer_name = 9; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_SendAttachmentsEnd::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_SendAttachmentsEnd::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_SendAttachmentsEnd::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.referrer_name) +} +inline std::string* SharingLog_SendAttachmentsEnd::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.referrer_name) + return _s; +} +inline const std::string& SharingLog_SendAttachmentsEnd::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_SendAttachmentsEnd::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_SendAttachmentsEnd::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_SendAttachmentsEnd::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.referrer_name) +} + +// optional .location.nearby.proto.sharing.ConnectionLayerStatus connection_layer_status = 10; +inline bool SharingLog_SendAttachmentsEnd::_internal_has_connection_layer_status() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + return value; +} +inline bool SharingLog_SendAttachmentsEnd::has_connection_layer_status() const { + return _internal_has_connection_layer_status(); +} +inline void SharingLog_SendAttachmentsEnd::clear_connection_layer_status() { + connection_layer_status_ = 0; + _has_bits_[0] &= ~0x00000200u; +} +inline ::location::nearby::proto::sharing::ConnectionLayerStatus SharingLog_SendAttachmentsEnd::_internal_connection_layer_status() const { + return static_cast< ::location::nearby::proto::sharing::ConnectionLayerStatus >(connection_layer_status_); +} +inline ::location::nearby::proto::sharing::ConnectionLayerStatus SharingLog_SendAttachmentsEnd::connection_layer_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.connection_layer_status) + return _internal_connection_layer_status(); +} +inline void SharingLog_SendAttachmentsEnd::_internal_set_connection_layer_status(::location::nearby::proto::sharing::ConnectionLayerStatus value) { + assert(::location::nearby::proto::sharing::ConnectionLayerStatus_IsValid(value)); + _has_bits_[0] |= 0x00000200u; + connection_layer_status_ = value; +} +inline void SharingLog_SendAttachmentsEnd::set_connection_layer_status(::location::nearby::proto::sharing::ConnectionLayerStatus value) { + _internal_set_connection_layer_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd.connection_layer_status) +} + +// ------------------------------------------------------------------- + +// SharingLog_ReceiveAttachmentsStart + +// optional int64 session_id = 1; +inline bool SharingLog_ReceiveAttachmentsStart::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ReceiveAttachmentsStart::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ReceiveAttachmentsStart::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_ReceiveAttachmentsStart::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ReceiveAttachmentsStart::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.session_id) + return _internal_session_id(); +} +inline void SharingLog_ReceiveAttachmentsStart::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000004u; + session_id_ = value; +} +inline void SharingLog_ReceiveAttachmentsStart::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.session_id) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 2; +inline bool SharingLog_ReceiveAttachmentsStart::_internal_has_attachments_info() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || attachments_info_ != nullptr); + return value; +} +inline bool SharingLog_ReceiveAttachmentsStart::has_attachments_info() const { + return _internal_has_attachments_info(); +} +inline void SharingLog_ReceiveAttachmentsStart::clear_attachments_info() { + if (attachments_info_ != nullptr) attachments_info_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_ReceiveAttachmentsStart::_internal_attachments_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* p = attachments_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AttachmentsInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_ReceiveAttachmentsStart::attachments_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.attachments_info) + return _internal_attachments_info(); +} +inline void SharingLog_ReceiveAttachmentsStart::unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(attachments_info_); + } + attachments_info_ = attachments_info; + if (attachments_info) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.attachments_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_ReceiveAttachmentsStart::release_attachments_info() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_ReceiveAttachmentsStart::unsafe_arena_release_attachments_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.attachments_info) + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_ReceiveAttachmentsStart::_internal_mutable_attachments_info() { + _has_bits_[0] |= 0x00000001u; + if (attachments_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>(GetArenaForAllocation()); + attachments_info_ = p; + } + return attachments_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_ReceiveAttachmentsStart::mutable_attachments_info() { + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _msg = _internal_mutable_attachments_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.attachments_info) + return _msg; +} +inline void SharingLog_ReceiveAttachmentsStart::set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete attachments_info_; + } + if (attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>::GetOwningArena(attachments_info); + if (message_arena != submessage_arena) { + attachments_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, attachments_info, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + attachments_info_ = attachments_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.attachments_info) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 3; +inline bool SharingLog_ReceiveAttachmentsStart::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_ReceiveAttachmentsStart::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_ReceiveAttachmentsStart::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_ReceiveAttachmentsStart::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_ReceiveAttachmentsStart::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_ReceiveAttachmentsStart::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsStart::release_share_target_info() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsStart::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.share_target_info) + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsStart::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000002u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsStart::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.share_target_info) + return _msg; +} +inline void SharingLog_ReceiveAttachmentsStart::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart.share_target_info) +} + +// ------------------------------------------------------------------- + +// SharingLog_ReceiveAttachmentsEnd + +// optional int64 session_id = 1; +inline bool SharingLog_ReceiveAttachmentsEnd::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ReceiveAttachmentsEnd::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ReceiveAttachmentsEnd::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_ReceiveAttachmentsEnd::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ReceiveAttachmentsEnd::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.session_id) + return _internal_session_id(); +} +inline void SharingLog_ReceiveAttachmentsEnd::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000004u; + session_id_ = value; +} +inline void SharingLog_ReceiveAttachmentsEnd::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.session_id) +} + +// optional int64 received_bytes = 2; +inline bool SharingLog_ReceiveAttachmentsEnd::_internal_has_received_bytes() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_ReceiveAttachmentsEnd::has_received_bytes() const { + return _internal_has_received_bytes(); +} +inline void SharingLog_ReceiveAttachmentsEnd::clear_received_bytes() { + received_bytes_ = int64_t{0}; + _has_bits_[0] &= ~0x00000008u; +} +inline int64_t SharingLog_ReceiveAttachmentsEnd::_internal_received_bytes() const { + return received_bytes_; +} +inline int64_t SharingLog_ReceiveAttachmentsEnd::received_bytes() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.received_bytes) + return _internal_received_bytes(); +} +inline void SharingLog_ReceiveAttachmentsEnd::_internal_set_received_bytes(int64_t value) { + _has_bits_[0] |= 0x00000008u; + received_bytes_ = value; +} +inline void SharingLog_ReceiveAttachmentsEnd::set_received_bytes(int64_t value) { + _internal_set_received_bytes(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.received_bytes) +} + +// optional .location.nearby.proto.sharing.AttachmentTransmissionStatus status = 3; +inline bool SharingLog_ReceiveAttachmentsEnd::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_ReceiveAttachmentsEnd::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_ReceiveAttachmentsEnd::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::location::nearby::proto::sharing::AttachmentTransmissionStatus SharingLog_ReceiveAttachmentsEnd::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentTransmissionStatus >(status_); +} +inline ::location::nearby::proto::sharing::AttachmentTransmissionStatus SharingLog_ReceiveAttachmentsEnd::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.status) + return _internal_status(); +} +inline void SharingLog_ReceiveAttachmentsEnd::_internal_set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value) { + assert(::location::nearby::proto::sharing::AttachmentTransmissionStatus_IsValid(value)); + _has_bits_[0] |= 0x00000010u; + status_ = value; +} +inline void SharingLog_ReceiveAttachmentsEnd::set_status(::location::nearby::proto::sharing::AttachmentTransmissionStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.status) +} + +// optional string referrer_name = 4; +inline bool SharingLog_ReceiveAttachmentsEnd::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ReceiveAttachmentsEnd::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_ReceiveAttachmentsEnd::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_ReceiveAttachmentsEnd::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_ReceiveAttachmentsEnd::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.referrer_name) +} +inline std::string* SharingLog_ReceiveAttachmentsEnd::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.referrer_name) + return _s; +} +inline const std::string& SharingLog_ReceiveAttachmentsEnd::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_ReceiveAttachmentsEnd::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_ReceiveAttachmentsEnd::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_ReceiveAttachmentsEnd::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_ReceiveAttachmentsEnd::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.referrer_name) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 5; +inline bool SharingLog_ReceiveAttachmentsEnd::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_ReceiveAttachmentsEnd::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_ReceiveAttachmentsEnd::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_ReceiveAttachmentsEnd::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_ReceiveAttachmentsEnd::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_ReceiveAttachmentsEnd::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsEnd::release_share_target_info() { + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsEnd::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.share_target_info) + _has_bits_[0] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsEnd::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000002u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_ReceiveAttachmentsEnd::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.share_target_info) + return _msg; +} +inline void SharingLog_ReceiveAttachmentsEnd::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd.share_target_info) +} + +// ------------------------------------------------------------------- + +// SharingLog_CancelConnection + +// optional int64 session_id = 1; +inline bool SharingLog_CancelConnection::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_CancelConnection::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_CancelConnection::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_CancelConnection::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_CancelConnection::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.CancelConnection.session_id) + return _internal_session_id(); +} +inline void SharingLog_CancelConnection::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000001u; + session_id_ = value; +} +inline void SharingLog_CancelConnection::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.CancelConnection.session_id) +} + +// optional int32 transfer_position = 2; +inline bool SharingLog_CancelConnection::_internal_has_transfer_position() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_CancelConnection::has_transfer_position() const { + return _internal_has_transfer_position(); +} +inline void SharingLog_CancelConnection::clear_transfer_position() { + transfer_position_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline int32_t SharingLog_CancelConnection::_internal_transfer_position() const { + return transfer_position_; +} +inline int32_t SharingLog_CancelConnection::transfer_position() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.CancelConnection.transfer_position) + return _internal_transfer_position(); +} +inline void SharingLog_CancelConnection::_internal_set_transfer_position(int32_t value) { + _has_bits_[0] |= 0x00000002u; + transfer_position_ = value; +} +inline void SharingLog_CancelConnection::set_transfer_position(int32_t value) { + _internal_set_transfer_position(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.CancelConnection.transfer_position) +} + +// optional int32 concurrent_connections = 3; +inline bool SharingLog_CancelConnection::_internal_has_concurrent_connections() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_CancelConnection::has_concurrent_connections() const { + return _internal_has_concurrent_connections(); +} +inline void SharingLog_CancelConnection::clear_concurrent_connections() { + concurrent_connections_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline int32_t SharingLog_CancelConnection::_internal_concurrent_connections() const { + return concurrent_connections_; +} +inline int32_t SharingLog_CancelConnection::concurrent_connections() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.CancelConnection.concurrent_connections) + return _internal_concurrent_connections(); +} +inline void SharingLog_CancelConnection::_internal_set_concurrent_connections(int32_t value) { + _has_bits_[0] |= 0x00000004u; + concurrent_connections_ = value; +} +inline void SharingLog_CancelConnection::set_concurrent_connections(int32_t value) { + _internal_set_concurrent_connections(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.CancelConnection.concurrent_connections) +} + +// ------------------------------------------------------------------- + +// SharingLog_CancelSendingAttachments + +// ------------------------------------------------------------------- + +// SharingLog_CancelReceivingAttachments + +// ------------------------------------------------------------------- + +// SharingLog_ProcessReceivedAttachmentsEnd + +// optional int64 session_id = 1; +inline bool SharingLog_ProcessReceivedAttachmentsEnd::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ProcessReceivedAttachmentsEnd::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_ProcessReceivedAttachmentsEnd::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_ProcessReceivedAttachmentsEnd::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_ProcessReceivedAttachmentsEnd::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd.session_id) + return _internal_session_id(); +} +inline void SharingLog_ProcessReceivedAttachmentsEnd::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000001u; + session_id_ = value; +} +inline void SharingLog_ProcessReceivedAttachmentsEnd::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd.session_id) +} + +// optional .location.nearby.proto.sharing.ProcessReceivedAttachmentsStatus status = 2; +inline bool SharingLog_ProcessReceivedAttachmentsEnd::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ProcessReceivedAttachmentsEnd::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_ProcessReceivedAttachmentsEnd::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus SharingLog_ProcessReceivedAttachmentsEnd::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus >(status_); +} +inline ::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus SharingLog_ProcessReceivedAttachmentsEnd::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd.status) + return _internal_status(); +} +inline void SharingLog_ProcessReceivedAttachmentsEnd::_internal_set_status(::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus value) { + assert(::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + status_ = value; +} +inline void SharingLog_ProcessReceivedAttachmentsEnd::set_status(::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd.status) +} + +// ------------------------------------------------------------------- + +// SharingLog_OpenReceivedAttachments + +// optional .nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo attachments_info = 3; +inline bool SharingLog_OpenReceivedAttachments::_internal_has_attachments_info() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || attachments_info_ != nullptr); + return value; +} +inline bool SharingLog_OpenReceivedAttachments::has_attachments_info() const { + return _internal_has_attachments_info(); +} +inline void SharingLog_OpenReceivedAttachments::clear_attachments_info() { + if (attachments_info_ != nullptr) attachments_info_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_OpenReceivedAttachments::_internal_attachments_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* p = attachments_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AttachmentsInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo& SharingLog_OpenReceivedAttachments::attachments_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.attachments_info) + return _internal_attachments_info(); +} +inline void SharingLog_OpenReceivedAttachments::unsafe_arena_set_allocated_attachments_info( + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(attachments_info_); + } + attachments_info_ = attachments_info; + if (attachments_info) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.attachments_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_OpenReceivedAttachments::release_attachments_info() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_OpenReceivedAttachments::unsafe_arena_release_attachments_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.attachments_info) + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* temp = attachments_info_; + attachments_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_OpenReceivedAttachments::_internal_mutable_attachments_info() { + _has_bits_[0] |= 0x00000001u; + if (attachments_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>(GetArenaForAllocation()); + attachments_info_ = p; + } + return attachments_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* SharingLog_OpenReceivedAttachments::mutable_attachments_info() { + ::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* _msg = _internal_mutable_attachments_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.attachments_info) + return _msg; +} +inline void SharingLog_OpenReceivedAttachments::set_allocated_attachments_info(::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo* attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete attachments_info_; + } + if (attachments_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AttachmentsInfo>::GetOwningArena(attachments_info); + if (message_arena != submessage_arena) { + attachments_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, attachments_info, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + attachments_info_ = attachments_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.attachments_info) +} + +// optional int64 session_id = 4; +inline bool SharingLog_OpenReceivedAttachments::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_OpenReceivedAttachments::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_OpenReceivedAttachments::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_OpenReceivedAttachments::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_OpenReceivedAttachments::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.session_id) + return _internal_session_id(); +} +inline void SharingLog_OpenReceivedAttachments::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + session_id_ = value; +} +inline void SharingLog_OpenReceivedAttachments::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments.session_id) +} + +// ------------------------------------------------------------------- + +// SharingLog_LaunchSetupActivity + +// ------------------------------------------------------------------- + +// SharingLog_AddContact + +// optional bool was_phone_added = 1; +inline bool SharingLog_AddContact::_internal_has_was_phone_added() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AddContact::has_was_phone_added() const { + return _internal_has_was_phone_added(); +} +inline void SharingLog_AddContact::clear_was_phone_added() { + was_phone_added_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool SharingLog_AddContact::_internal_was_phone_added() const { + return was_phone_added_; +} +inline bool SharingLog_AddContact::was_phone_added() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AddContact.was_phone_added) + return _internal_was_phone_added(); +} +inline void SharingLog_AddContact::_internal_set_was_phone_added(bool value) { + _has_bits_[0] |= 0x00000001u; + was_phone_added_ = value; +} +inline void SharingLog_AddContact::set_was_phone_added(bool value) { + _internal_set_was_phone_added(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AddContact.was_phone_added) +} + +// optional bool was_email_added = 2; +inline bool SharingLog_AddContact::_internal_has_was_email_added() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_AddContact::has_was_email_added() const { + return _internal_has_was_email_added(); +} +inline void SharingLog_AddContact::clear_was_email_added() { + was_email_added_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool SharingLog_AddContact::_internal_was_email_added() const { + return was_email_added_; +} +inline bool SharingLog_AddContact::was_email_added() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AddContact.was_email_added) + return _internal_was_email_added(); +} +inline void SharingLog_AddContact::_internal_set_was_email_added(bool value) { + _has_bits_[0] |= 0x00000002u; + was_email_added_ = value; +} +inline void SharingLog_AddContact::set_was_email_added(bool value) { + _internal_set_was_email_added(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AddContact.was_email_added) +} + +// ------------------------------------------------------------------- + +// SharingLog_RemoveContact + +// optional bool was_phone_removed = 1; +inline bool SharingLog_RemoveContact::_internal_has_was_phone_removed() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_RemoveContact::has_was_phone_removed() const { + return _internal_has_was_phone_removed(); +} +inline void SharingLog_RemoveContact::clear_was_phone_removed() { + was_phone_removed_ = false; + _has_bits_[0] &= ~0x00000001u; +} +inline bool SharingLog_RemoveContact::_internal_was_phone_removed() const { + return was_phone_removed_; +} +inline bool SharingLog_RemoveContact::was_phone_removed() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RemoveContact.was_phone_removed) + return _internal_was_phone_removed(); +} +inline void SharingLog_RemoveContact::_internal_set_was_phone_removed(bool value) { + _has_bits_[0] |= 0x00000001u; + was_phone_removed_ = value; +} +inline void SharingLog_RemoveContact::set_was_phone_removed(bool value) { + _internal_set_was_phone_removed(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RemoveContact.was_phone_removed) +} + +// optional bool was_email_removed = 2; +inline bool SharingLog_RemoveContact::_internal_has_was_email_removed() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_RemoveContact::has_was_email_removed() const { + return _internal_has_was_email_removed(); +} +inline void SharingLog_RemoveContact::clear_was_email_removed() { + was_email_removed_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool SharingLog_RemoveContact::_internal_was_email_removed() const { + return was_email_removed_; +} +inline bool SharingLog_RemoveContact::was_email_removed() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RemoveContact.was_email_removed) + return _internal_was_email_removed(); +} +inline void SharingLog_RemoveContact::_internal_set_was_email_removed(bool value) { + _has_bits_[0] |= 0x00000002u; + was_email_removed_ = value; +} +inline void SharingLog_RemoveContact::set_was_email_removed(bool value) { + _internal_set_was_email_removed(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RemoveContact.was_email_removed) +} + +// ------------------------------------------------------------------- + +// SharingLog_FastShareServerResponse + +// optional .location.nearby.proto.sharing.ServerResponseState status = 1; +inline bool SharingLog_FastShareServerResponse::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_FastShareServerResponse::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_FastShareServerResponse::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::ServerResponseState SharingLog_FastShareServerResponse::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::ServerResponseState >(status_); +} +inline ::location::nearby::proto::sharing::ServerResponseState SharingLog_FastShareServerResponse::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.status) + return _internal_status(); +} +inline void SharingLog_FastShareServerResponse::_internal_set_status(::location::nearby::proto::sharing::ServerResponseState value) { + assert(::location::nearby::proto::sharing::ServerResponseState_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + status_ = value; +} +inline void SharingLog_FastShareServerResponse::set_status(::location::nearby::proto::sharing::ServerResponseState value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.status) +} + +// optional .location.nearby.proto.sharing.ServerActionName name = 2; +inline bool SharingLog_FastShareServerResponse::_internal_has_name() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_FastShareServerResponse::has_name() const { + return _internal_has_name(); +} +inline void SharingLog_FastShareServerResponse::clear_name() { + name_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::ServerActionName SharingLog_FastShareServerResponse::_internal_name() const { + return static_cast< ::location::nearby::proto::sharing::ServerActionName >(name_); +} +inline ::location::nearby::proto::sharing::ServerActionName SharingLog_FastShareServerResponse::name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.name) + return _internal_name(); +} +inline void SharingLog_FastShareServerResponse::_internal_set_name(::location::nearby::proto::sharing::ServerActionName value) { + assert(::location::nearby::proto::sharing::ServerActionName_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + name_ = value; +} +inline void SharingLog_FastShareServerResponse::set_name(::location::nearby::proto::sharing::ServerActionName value) { + _internal_set_name(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.name) +} + +// optional int64 latency_millis = 3; +inline bool SharingLog_FastShareServerResponse::_internal_has_latency_millis() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_FastShareServerResponse::has_latency_millis() const { + return _internal_has_latency_millis(); +} +inline void SharingLog_FastShareServerResponse::clear_latency_millis() { + latency_millis_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_FastShareServerResponse::_internal_latency_millis() const { + return latency_millis_; +} +inline int64_t SharingLog_FastShareServerResponse::latency_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.latency_millis) + return _internal_latency_millis(); +} +inline void SharingLog_FastShareServerResponse::_internal_set_latency_millis(int64_t value) { + _has_bits_[0] |= 0x00000004u; + latency_millis_ = value; +} +inline void SharingLog_FastShareServerResponse::set_latency_millis(int64_t value) { + _internal_set_latency_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.latency_millis) +} + +// optional .location.nearby.proto.sharing.SyncPurpose purpose = 4; +inline bool SharingLog_FastShareServerResponse::_internal_has_purpose() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_FastShareServerResponse::has_purpose() const { + return _internal_has_purpose(); +} +inline void SharingLog_FastShareServerResponse::clear_purpose() { + purpose_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::SyncPurpose SharingLog_FastShareServerResponse::_internal_purpose() const { + return static_cast< ::location::nearby::proto::sharing::SyncPurpose >(purpose_); +} +inline ::location::nearby::proto::sharing::SyncPurpose SharingLog_FastShareServerResponse::purpose() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.purpose) + return _internal_purpose(); +} +inline void SharingLog_FastShareServerResponse::_internal_set_purpose(::location::nearby::proto::sharing::SyncPurpose value) { + assert(::location::nearby::proto::sharing::SyncPurpose_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + purpose_ = value; +} +inline void SharingLog_FastShareServerResponse::set_purpose(::location::nearby::proto::sharing::SyncPurpose value) { + _internal_set_purpose(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.purpose) +} + +// optional .location.nearby.proto.sharing.ClientRole requester = 5; +inline bool SharingLog_FastShareServerResponse::_internal_has_requester() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_FastShareServerResponse::has_requester() const { + return _internal_has_requester(); +} +inline void SharingLog_FastShareServerResponse::clear_requester() { + requester_ = 0; + _has_bits_[0] &= ~0x00000010u; +} +inline ::location::nearby::proto::sharing::ClientRole SharingLog_FastShareServerResponse::_internal_requester() const { + return static_cast< ::location::nearby::proto::sharing::ClientRole >(requester_); +} +inline ::location::nearby::proto::sharing::ClientRole SharingLog_FastShareServerResponse::requester() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.requester) + return _internal_requester(); +} +inline void SharingLog_FastShareServerResponse::_internal_set_requester(::location::nearby::proto::sharing::ClientRole value) { + assert(::location::nearby::proto::sharing::ClientRole_IsValid(value)); + _has_bits_[0] |= 0x00000010u; + requester_ = value; +} +inline void SharingLog_FastShareServerResponse::set_requester(::location::nearby::proto::sharing::ClientRole value) { + _internal_set_requester(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.requester) +} + +// optional .location.nearby.proto.sharing.DeviceType device_type = 6; +inline bool SharingLog_FastShareServerResponse::_internal_has_device_type() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_FastShareServerResponse::has_device_type() const { + return _internal_has_device_type(); +} +inline void SharingLog_FastShareServerResponse::clear_device_type() { + device_type_ = 0; + _has_bits_[0] &= ~0x00000020u; +} +inline ::location::nearby::proto::sharing::DeviceType SharingLog_FastShareServerResponse::_internal_device_type() const { + return static_cast< ::location::nearby::proto::sharing::DeviceType >(device_type_); +} +inline ::location::nearby::proto::sharing::DeviceType SharingLog_FastShareServerResponse::device_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.device_type) + return _internal_device_type(); +} +inline void SharingLog_FastShareServerResponse::_internal_set_device_type(::location::nearby::proto::sharing::DeviceType value) { + assert(::location::nearby::proto::sharing::DeviceType_IsValid(value)); + _has_bits_[0] |= 0x00000020u; + device_type_ = value; +} +inline void SharingLog_FastShareServerResponse::set_device_type(::location::nearby::proto::sharing::DeviceType value) { + _internal_set_device_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse.device_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendStart + +// optional int64 session_id = 1; +inline bool SharingLog_SendStart::_internal_has_session_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_SendStart::has_session_id() const { + return _internal_has_session_id(); +} +inline void SharingLog_SendStart::clear_session_id() { + session_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_SendStart::_internal_session_id() const { + return session_id_; +} +inline int64_t SharingLog_SendStart::session_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendStart.session_id) + return _internal_session_id(); +} +inline void SharingLog_SendStart::_internal_set_session_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + session_id_ = value; +} +inline void SharingLog_SendStart::set_session_id(int64_t value) { + _internal_set_session_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendStart.session_id) +} + +// optional int32 transfer_position = 2; +inline bool SharingLog_SendStart::_internal_has_transfer_position() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_SendStart::has_transfer_position() const { + return _internal_has_transfer_position(); +} +inline void SharingLog_SendStart::clear_transfer_position() { + transfer_position_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline int32_t SharingLog_SendStart::_internal_transfer_position() const { + return transfer_position_; +} +inline int32_t SharingLog_SendStart::transfer_position() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendStart.transfer_position) + return _internal_transfer_position(); +} +inline void SharingLog_SendStart::_internal_set_transfer_position(int32_t value) { + _has_bits_[0] |= 0x00000004u; + transfer_position_ = value; +} +inline void SharingLog_SendStart::set_transfer_position(int32_t value) { + _internal_set_transfer_position(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendStart.transfer_position) +} + +// optional int32 concurrent_connections = 3; +inline bool SharingLog_SendStart::_internal_has_concurrent_connections() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_SendStart::has_concurrent_connections() const { + return _internal_has_concurrent_connections(); +} +inline void SharingLog_SendStart::clear_concurrent_connections() { + concurrent_connections_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline int32_t SharingLog_SendStart::_internal_concurrent_connections() const { + return concurrent_connections_; +} +inline int32_t SharingLog_SendStart::concurrent_connections() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendStart.concurrent_connections) + return _internal_concurrent_connections(); +} +inline void SharingLog_SendStart::_internal_set_concurrent_connections(int32_t value) { + _has_bits_[0] |= 0x00000008u; + concurrent_connections_ = value; +} +inline void SharingLog_SendStart::set_concurrent_connections(int32_t value) { + _internal_set_concurrent_connections(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendStart.concurrent_connections) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo share_target_info = 4; +inline bool SharingLog_SendStart::_internal_has_share_target_info() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || share_target_info_ != nullptr); + return value; +} +inline bool SharingLog_SendStart::has_share_target_info() const { + return _internal_has_share_target_info(); +} +inline void SharingLog_SendStart::clear_share_target_info() { + if (share_target_info_ != nullptr) share_target_info_->Clear(); + _has_bits_[0] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_SendStart::_internal_share_target_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* p = share_target_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShareTargetInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo& SharingLog_SendStart::share_target_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendStart.share_target_info) + return _internal_share_target_info(); +} +inline void SharingLog_SendStart::unsafe_arena_set_allocated_share_target_info( + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(share_target_info_); + } + share_target_info_ = share_target_info; + if (share_target_info) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendStart.share_target_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendStart::release_share_target_info() { + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendStart::unsafe_arena_release_share_target_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.SendStart.share_target_info) + _has_bits_[0] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* temp = share_target_info_; + share_target_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendStart::_internal_mutable_share_target_info() { + _has_bits_[0] |= 0x00000001u; + if (share_target_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>(GetArenaForAllocation()); + share_target_info_ = p; + } + return share_target_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* SharingLog_SendStart::mutable_share_target_info() { + ::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* _msg = _internal_mutable_share_target_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.SendStart.share_target_info) + return _msg; +} +inline void SharingLog_SendStart::set_allocated_share_target_info(::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo* share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete share_target_info_; + } + if (share_target_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShareTargetInfo>::GetOwningArena(share_target_info); + if (message_arena != submessage_arena) { + share_target_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, share_target_info, submessage_arena); + } + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + share_target_info_ = share_target_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.SendStart.share_target_info) +} + +// ------------------------------------------------------------------- + +// SharingLog_AcceptFastInitialization + +// ------------------------------------------------------------------- + +// SharingLog_LaunchActivity + +// optional .location.nearby.proto.sharing.ActivityName activity_name = 1; +inline bool SharingLog_LaunchActivity::_internal_has_activity_name() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_activity_name() const { + return _internal_has_activity_name(); +} +inline void SharingLog_LaunchActivity::clear_activity_name() { + activity_name_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_LaunchActivity::_internal_activity_name() const { + return static_cast< ::location::nearby::proto::sharing::ActivityName >(activity_name_); +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_LaunchActivity::activity_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.activity_name) + return _internal_activity_name(); +} +inline void SharingLog_LaunchActivity::_internal_set_activity_name(::location::nearby::proto::sharing::ActivityName value) { + assert(::location::nearby::proto::sharing::ActivityName_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + activity_name_ = value; +} +inline void SharingLog_LaunchActivity::set_activity_name(::location::nearby::proto::sharing::ActivityName value) { + _internal_set_activity_name(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.activity_name) +} + +// optional int64 duration_millis = 2; +inline bool SharingLog_LaunchActivity::_internal_has_duration_millis() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_duration_millis() const { + return _internal_has_duration_millis(); +} +inline void SharingLog_LaunchActivity::clear_duration_millis() { + duration_millis_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_LaunchActivity::_internal_duration_millis() const { + return duration_millis_; +} +inline int64_t SharingLog_LaunchActivity::duration_millis() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.duration_millis) + return _internal_duration_millis(); +} +inline void SharingLog_LaunchActivity::_internal_set_duration_millis(int64_t value) { + _has_bits_[0] |= 0x00000002u; + duration_millis_ = value; +} +inline void SharingLog_LaunchActivity::set_duration_millis(int64_t value) { + _internal_set_duration_millis(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.duration_millis) +} + +// optional string referrer_name = 3; +inline bool SharingLog_LaunchActivity::_internal_has_referrer_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_referrer_name() const { + return _internal_has_referrer_name(); +} +inline void SharingLog_LaunchActivity::clear_referrer_name() { + referrer_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_LaunchActivity::referrer_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.referrer_name) + return _internal_referrer_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_LaunchActivity::set_referrer_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.referrer_name) +} +inline std::string* SharingLog_LaunchActivity::mutable_referrer_name() { + std::string* _s = _internal_mutable_referrer_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.referrer_name) + return _s; +} +inline const std::string& SharingLog_LaunchActivity::_internal_referrer_name() const { + return referrer_name_.Get(); +} +inline void SharingLog_LaunchActivity::_internal_set_referrer_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + referrer_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_LaunchActivity::_internal_mutable_referrer_name() { + _has_bits_[0] |= 0x00000001u; + return referrer_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_LaunchActivity::release_referrer_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.referrer_name) + if (!_internal_has_referrer_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = referrer_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_LaunchActivity::set_allocated_referrer_name(std::string* referrer_name) { + if (referrer_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + referrer_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), referrer_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (referrer_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + referrer_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.referrer_name) +} + +// optional bool previous_transfer_in_progress = 4; +inline bool SharingLog_LaunchActivity::_internal_has_previous_transfer_in_progress() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_previous_transfer_in_progress() const { + return _internal_has_previous_transfer_in_progress(); +} +inline void SharingLog_LaunchActivity::clear_previous_transfer_in_progress() { + previous_transfer_in_progress_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool SharingLog_LaunchActivity::_internal_previous_transfer_in_progress() const { + return previous_transfer_in_progress_; +} +inline bool SharingLog_LaunchActivity::previous_transfer_in_progress() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.previous_transfer_in_progress) + return _internal_previous_transfer_in_progress(); +} +inline void SharingLog_LaunchActivity::_internal_set_previous_transfer_in_progress(bool value) { + _has_bits_[0] |= 0x00000008u; + previous_transfer_in_progress_ = value; +} +inline void SharingLog_LaunchActivity::set_previous_transfer_in_progress(bool value) { + _internal_set_previous_transfer_in_progress(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.previous_transfer_in_progress) +} + +// optional bool has_opted_in = 5; +inline bool SharingLog_LaunchActivity::_internal_has_has_opted_in() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_has_opted_in() const { + return _internal_has_has_opted_in(); +} +inline void SharingLog_LaunchActivity::clear_has_opted_in() { + has_opted_in_ = false; + _has_bits_[0] &= ~0x00000010u; +} +inline bool SharingLog_LaunchActivity::_internal_has_opted_in() const { + return has_opted_in_; +} +inline bool SharingLog_LaunchActivity::has_opted_in() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.has_opted_in) + return _internal_has_opted_in(); +} +inline void SharingLog_LaunchActivity::_internal_set_has_opted_in(bool value) { + _has_bits_[0] |= 0x00000010u; + has_opted_in_ = value; +} +inline void SharingLog_LaunchActivity::set_has_opted_in(bool value) { + _internal_set_has_opted_in(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.has_opted_in) +} + +// optional .location.nearby.proto.sharing.ActivityName source_activity_name = 6; +inline bool SharingLog_LaunchActivity::_internal_has_source_activity_name() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_source_activity_name() const { + return _internal_has_source_activity_name(); +} +inline void SharingLog_LaunchActivity::clear_source_activity_name() { + source_activity_name_ = 0; + _has_bits_[0] &= ~0x00000040u; +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_LaunchActivity::_internal_source_activity_name() const { + return static_cast< ::location::nearby::proto::sharing::ActivityName >(source_activity_name_); +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_LaunchActivity::source_activity_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.source_activity_name) + return _internal_source_activity_name(); +} +inline void SharingLog_LaunchActivity::_internal_set_source_activity_name(::location::nearby::proto::sharing::ActivityName value) { + assert(::location::nearby::proto::sharing::ActivityName_IsValid(value)); + _has_bits_[0] |= 0x00000040u; + source_activity_name_ = value; +} +inline void SharingLog_LaunchActivity::set_source_activity_name(::location::nearby::proto::sharing::ActivityName value) { + _internal_set_source_activity_name(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.source_activity_name) +} + +// optional bool is_finishing = 7; +inline bool SharingLog_LaunchActivity::_internal_has_is_finishing() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + return value; +} +inline bool SharingLog_LaunchActivity::has_is_finishing() const { + return _internal_has_is_finishing(); +} +inline void SharingLog_LaunchActivity::clear_is_finishing() { + is_finishing_ = false; + _has_bits_[0] &= ~0x00000020u; +} +inline bool SharingLog_LaunchActivity::_internal_is_finishing() const { + return is_finishing_; +} +inline bool SharingLog_LaunchActivity::is_finishing() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.is_finishing) + return _internal_is_finishing(); +} +inline void SharingLog_LaunchActivity::_internal_set_is_finishing(bool value) { + _has_bits_[0] |= 0x00000020u; + is_finishing_ = value; +} +inline void SharingLog_LaunchActivity::set_is_finishing(bool value) { + _internal_set_is_finishing(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchActivity.is_finishing) +} + +// ------------------------------------------------------------------- + +// SharingLog_DismissPrivacyNotification + +// ------------------------------------------------------------------- + +// SharingLog_TapPrivacyNotification + +// ------------------------------------------------------------------- + +// SharingLog_TapHelp + +// ------------------------------------------------------------------- + +// SharingLog_TapFeedback + +// ------------------------------------------------------------------- + +// SharingLog_AddQuickSettingsTile + +// ------------------------------------------------------------------- + +// SharingLog_RemoveQuickSettingsTile + +// ------------------------------------------------------------------- + +// SharingLog_LaunchPhoneConsent + +// ------------------------------------------------------------------- + +// SharingLog_DisplayPhoneConsent + +// ------------------------------------------------------------------- + +// SharingLog_TapQuickSettingsTile + +// ------------------------------------------------------------------- + +// SharingLog_TapQuickSettingsFileShare + +// ------------------------------------------------------------------- + +// SharingLog_DisplayPrivacyNotification + +// ------------------------------------------------------------------- + +// SharingLog_DefaultOptIn + +// ------------------------------------------------------------------- + +// SharingLog_SetDeviceName + +// optional int32 device_name_size = 1; +inline bool SharingLog_SetDeviceName::_internal_has_device_name_size() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SetDeviceName::has_device_name_size() const { + return _internal_has_device_name_size(); +} +inline void SharingLog_SetDeviceName::clear_device_name_size() { + device_name_size_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline int32_t SharingLog_SetDeviceName::_internal_device_name_size() const { + return device_name_size_; +} +inline int32_t SharingLog_SetDeviceName::device_name_size() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetDeviceName.device_name_size) + return _internal_device_name_size(); +} +inline void SharingLog_SetDeviceName::_internal_set_device_name_size(int32_t value) { + _has_bits_[0] |= 0x00000001u; + device_name_size_ = value; +} +inline void SharingLog_SetDeviceName::set_device_name_size(int32_t value) { + _internal_set_device_name_size(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetDeviceName.device_name_size) +} + +// ------------------------------------------------------------------- + +// SharingLog_RequestSettingPermissions + +// optional .location.nearby.proto.sharing.PermissionRequestType permission_type = 1; +inline bool SharingLog_RequestSettingPermissions::_internal_has_permission_type() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_RequestSettingPermissions::has_permission_type() const { + return _internal_has_permission_type(); +} +inline void SharingLog_RequestSettingPermissions::clear_permission_type() { + permission_type_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::PermissionRequestType SharingLog_RequestSettingPermissions::_internal_permission_type() const { + return static_cast< ::location::nearby::proto::sharing::PermissionRequestType >(permission_type_); +} +inline ::location::nearby::proto::sharing::PermissionRequestType SharingLog_RequestSettingPermissions::permission_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions.permission_type) + return _internal_permission_type(); +} +inline void SharingLog_RequestSettingPermissions::_internal_set_permission_type(::location::nearby::proto::sharing::PermissionRequestType value) { + assert(::location::nearby::proto::sharing::PermissionRequestType_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + permission_type_ = value; +} +inline void SharingLog_RequestSettingPermissions::set_permission_type(::location::nearby::proto::sharing::PermissionRequestType value) { + _internal_set_permission_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions.permission_type) +} + +// optional .location.nearby.proto.sharing.PermissionRequestResult permission_request_result = 2; +inline bool SharingLog_RequestSettingPermissions::_internal_has_permission_request_result() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_RequestSettingPermissions::has_permission_request_result() const { + return _internal_has_permission_request_result(); +} +inline void SharingLog_RequestSettingPermissions::clear_permission_request_result() { + permission_request_result_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::PermissionRequestResult SharingLog_RequestSettingPermissions::_internal_permission_request_result() const { + return static_cast< ::location::nearby::proto::sharing::PermissionRequestResult >(permission_request_result_); +} +inline ::location::nearby::proto::sharing::PermissionRequestResult SharingLog_RequestSettingPermissions::permission_request_result() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions.permission_request_result) + return _internal_permission_request_result(); +} +inline void SharingLog_RequestSettingPermissions::_internal_set_permission_request_result(::location::nearby::proto::sharing::PermissionRequestResult value) { + assert(::location::nearby::proto::sharing::PermissionRequestResult_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + permission_request_result_ = value; +} +inline void SharingLog_RequestSettingPermissions::set_permission_request_result(::location::nearby::proto::sharing::PermissionRequestResult value) { + _internal_set_permission_request_result(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions.permission_request_result) +} + +// ------------------------------------------------------------------- + +// SharingLog_LaunchConsent + +// optional .location.nearby.proto.sharing.ConsentType consent_type = 1; +inline bool SharingLog_LaunchConsent::_internal_has_consent_type() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_LaunchConsent::has_consent_type() const { + return _internal_has_consent_type(); +} +inline void SharingLog_LaunchConsent::clear_consent_type() { + consent_type_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::ConsentType SharingLog_LaunchConsent::_internal_consent_type() const { + return static_cast< ::location::nearby::proto::sharing::ConsentType >(consent_type_); +} +inline ::location::nearby::proto::sharing::ConsentType SharingLog_LaunchConsent::consent_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchConsent.consent_type) + return _internal_consent_type(); +} +inline void SharingLog_LaunchConsent::_internal_set_consent_type(::location::nearby::proto::sharing::ConsentType value) { + assert(::location::nearby::proto::sharing::ConsentType_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + consent_type_ = value; +} +inline void SharingLog_LaunchConsent::set_consent_type(::location::nearby::proto::sharing::ConsentType value) { + _internal_set_consent_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchConsent.consent_type) +} + +// optional .location.nearby.proto.sharing.ConsentAcceptanceStatus status = 2; +inline bool SharingLog_LaunchConsent::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_LaunchConsent::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_LaunchConsent::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::ConsentAcceptanceStatus SharingLog_LaunchConsent::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::ConsentAcceptanceStatus >(status_); +} +inline ::location::nearby::proto::sharing::ConsentAcceptanceStatus SharingLog_LaunchConsent::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.LaunchConsent.status) + return _internal_status(); +} +inline void SharingLog_LaunchConsent::_internal_set_status(::location::nearby::proto::sharing::ConsentAcceptanceStatus value) { + assert(::location::nearby::proto::sharing::ConsentAcceptanceStatus_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + status_ = value; +} +inline void SharingLog_LaunchConsent::set_status(::location::nearby::proto::sharing::ConsentAcceptanceStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.LaunchConsent.status) +} + +// ------------------------------------------------------------------- + +// SharingLog_InstallAPKStatus + +// repeated .location.nearby.proto.sharing.InstallAPKStatus status = 1 [packed = true]; +inline int SharingLog_InstallAPKStatus::_internal_status_size() const { + return status_.size(); +} +inline int SharingLog_InstallAPKStatus::status_size() const { + return _internal_status_size(); +} +inline void SharingLog_InstallAPKStatus::clear_status() { + status_.Clear(); +} +inline ::location::nearby::proto::sharing::InstallAPKStatus SharingLog_InstallAPKStatus::_internal_status(int index) const { + return static_cast< ::location::nearby::proto::sharing::InstallAPKStatus >(status_.Get(index)); +} +inline ::location::nearby::proto::sharing::InstallAPKStatus SharingLog_InstallAPKStatus::status(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.status) + return _internal_status(index); +} +inline void SharingLog_InstallAPKStatus::set_status(int index, ::location::nearby::proto::sharing::InstallAPKStatus value) { + assert(::location::nearby::proto::sharing::InstallAPKStatus_IsValid(value)); + status_.Set(index, value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.status) +} +inline void SharingLog_InstallAPKStatus::_internal_add_status(::location::nearby::proto::sharing::InstallAPKStatus value) { + assert(::location::nearby::proto::sharing::InstallAPKStatus_IsValid(value)); + status_.Add(value); +} +inline void SharingLog_InstallAPKStatus::add_status(::location::nearby::proto::sharing::InstallAPKStatus value) { + _internal_add_status(value); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.status) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +SharingLog_InstallAPKStatus::status() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.status) + return status_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_InstallAPKStatus::_internal_mutable_status() { + return &status_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_InstallAPKStatus::mutable_status() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.status) + return _internal_mutable_status(); +} + +// repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; +inline int SharingLog_InstallAPKStatus::_internal_source_size() const { + return source_.size(); +} +inline int SharingLog_InstallAPKStatus::source_size() const { + return _internal_source_size(); +} +inline void SharingLog_InstallAPKStatus::clear_source() { + source_.Clear(); +} +inline ::location::nearby::proto::sharing::ApkSource SharingLog_InstallAPKStatus::_internal_source(int index) const { + return static_cast< ::location::nearby::proto::sharing::ApkSource >(source_.Get(index)); +} +inline ::location::nearby::proto::sharing::ApkSource SharingLog_InstallAPKStatus::source(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.source) + return _internal_source(index); +} +inline void SharingLog_InstallAPKStatus::set_source(int index, ::location::nearby::proto::sharing::ApkSource value) { + assert(::location::nearby::proto::sharing::ApkSource_IsValid(value)); + source_.Set(index, value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.source) +} +inline void SharingLog_InstallAPKStatus::_internal_add_source(::location::nearby::proto::sharing::ApkSource value) { + assert(::location::nearby::proto::sharing::ApkSource_IsValid(value)); + source_.Add(value); +} +inline void SharingLog_InstallAPKStatus::add_source(::location::nearby::proto::sharing::ApkSource value) { + _internal_add_source(value); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.source) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +SharingLog_InstallAPKStatus::source() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.source) + return source_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_InstallAPKStatus::_internal_mutable_source() { + return &source_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_InstallAPKStatus::mutable_source() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus.source) + return _internal_mutable_source(); +} + +// ------------------------------------------------------------------- + +// SharingLog_VerifyAPKStatus + +// repeated .location.nearby.proto.sharing.VerifyAPKStatus status = 1 [packed = true]; +inline int SharingLog_VerifyAPKStatus::_internal_status_size() const { + return status_.size(); +} +inline int SharingLog_VerifyAPKStatus::status_size() const { + return _internal_status_size(); +} +inline void SharingLog_VerifyAPKStatus::clear_status() { + status_.Clear(); +} +inline ::location::nearby::proto::sharing::VerifyAPKStatus SharingLog_VerifyAPKStatus::_internal_status(int index) const { + return static_cast< ::location::nearby::proto::sharing::VerifyAPKStatus >(status_.Get(index)); +} +inline ::location::nearby::proto::sharing::VerifyAPKStatus SharingLog_VerifyAPKStatus::status(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.status) + return _internal_status(index); +} +inline void SharingLog_VerifyAPKStatus::set_status(int index, ::location::nearby::proto::sharing::VerifyAPKStatus value) { + assert(::location::nearby::proto::sharing::VerifyAPKStatus_IsValid(value)); + status_.Set(index, value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.status) +} +inline void SharingLog_VerifyAPKStatus::_internal_add_status(::location::nearby::proto::sharing::VerifyAPKStatus value) { + assert(::location::nearby::proto::sharing::VerifyAPKStatus_IsValid(value)); + status_.Add(value); +} +inline void SharingLog_VerifyAPKStatus::add_status(::location::nearby::proto::sharing::VerifyAPKStatus value) { + _internal_add_status(value); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.status) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +SharingLog_VerifyAPKStatus::status() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.status) + return status_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_VerifyAPKStatus::_internal_mutable_status() { + return &status_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_VerifyAPKStatus::mutable_status() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.status) + return _internal_mutable_status(); +} + +// repeated .location.nearby.proto.sharing.ApkSource source = 2 [packed = true]; +inline int SharingLog_VerifyAPKStatus::_internal_source_size() const { + return source_.size(); +} +inline int SharingLog_VerifyAPKStatus::source_size() const { + return _internal_source_size(); +} +inline void SharingLog_VerifyAPKStatus::clear_source() { + source_.Clear(); +} +inline ::location::nearby::proto::sharing::ApkSource SharingLog_VerifyAPKStatus::_internal_source(int index) const { + return static_cast< ::location::nearby::proto::sharing::ApkSource >(source_.Get(index)); +} +inline ::location::nearby::proto::sharing::ApkSource SharingLog_VerifyAPKStatus::source(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.source) + return _internal_source(index); +} +inline void SharingLog_VerifyAPKStatus::set_source(int index, ::location::nearby::proto::sharing::ApkSource value) { + assert(::location::nearby::proto::sharing::ApkSource_IsValid(value)); + source_.Set(index, value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.source) +} +inline void SharingLog_VerifyAPKStatus::_internal_add_source(::location::nearby::proto::sharing::ApkSource value) { + assert(::location::nearby::proto::sharing::ApkSource_IsValid(value)); + source_.Add(value); +} +inline void SharingLog_VerifyAPKStatus::add_source(::location::nearby::proto::sharing::ApkSource value) { + _internal_add_source(value); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.source) +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& +SharingLog_VerifyAPKStatus::source() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.source) + return source_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_VerifyAPKStatus::_internal_mutable_source() { + return &source_; +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* +SharingLog_VerifyAPKStatus::mutable_source() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus.source) + return _internal_mutable_source(); +} + +// ------------------------------------------------------------------- + +// SharingLog_ToggleShowNotification + +// optional .location.nearby.proto.sharing.ShowNotificationStatus previous_status = 1; +inline bool SharingLog_ToggleShowNotification::_internal_has_previous_status() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ToggleShowNotification::has_previous_status() const { + return _internal_has_previous_status(); +} +inline void SharingLog_ToggleShowNotification::clear_previous_status() { + previous_status_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::ShowNotificationStatus SharingLog_ToggleShowNotification::_internal_previous_status() const { + return static_cast< ::location::nearby::proto::sharing::ShowNotificationStatus >(previous_status_); +} +inline ::location::nearby::proto::sharing::ShowNotificationStatus SharingLog_ToggleShowNotification::previous_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification.previous_status) + return _internal_previous_status(); +} +inline void SharingLog_ToggleShowNotification::_internal_set_previous_status(::location::nearby::proto::sharing::ShowNotificationStatus value) { + assert(::location::nearby::proto::sharing::ShowNotificationStatus_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + previous_status_ = value; +} +inline void SharingLog_ToggleShowNotification::set_previous_status(::location::nearby::proto::sharing::ShowNotificationStatus value) { + _internal_set_previous_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification.previous_status) +} + +// optional .location.nearby.proto.sharing.ShowNotificationStatus current_status = 2; +inline bool SharingLog_ToggleShowNotification::_internal_has_current_status() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ToggleShowNotification::has_current_status() const { + return _internal_has_current_status(); +} +inline void SharingLog_ToggleShowNotification::clear_current_status() { + current_status_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::ShowNotificationStatus SharingLog_ToggleShowNotification::_internal_current_status() const { + return static_cast< ::location::nearby::proto::sharing::ShowNotificationStatus >(current_status_); +} +inline ::location::nearby::proto::sharing::ShowNotificationStatus SharingLog_ToggleShowNotification::current_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification.current_status) + return _internal_current_status(); +} +inline void SharingLog_ToggleShowNotification::_internal_set_current_status(::location::nearby::proto::sharing::ShowNotificationStatus value) { + assert(::location::nearby::proto::sharing::ShowNotificationStatus_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + current_status_ = value; +} +inline void SharingLog_ToggleShowNotification::set_current_status(::location::nearby::proto::sharing::ShowNotificationStatus value) { + _internal_set_current_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification.current_status) +} + +// ------------------------------------------------------------------- + +// SharingLog_DecryptCertificateFailure + +// optional .location.nearby.proto.sharing.DecryptCertificateFailureStatus status = 1; +inline bool SharingLog_DecryptCertificateFailure::_internal_has_status() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_DecryptCertificateFailure::has_status() const { + return _internal_has_status(); +} +inline void SharingLog_DecryptCertificateFailure::clear_status() { + status_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::DecryptCertificateFailureStatus SharingLog_DecryptCertificateFailure::_internal_status() const { + return static_cast< ::location::nearby::proto::sharing::DecryptCertificateFailureStatus >(status_); +} +inline ::location::nearby::proto::sharing::DecryptCertificateFailureStatus SharingLog_DecryptCertificateFailure::status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure.status) + return _internal_status(); +} +inline void SharingLog_DecryptCertificateFailure::_internal_set_status(::location::nearby::proto::sharing::DecryptCertificateFailureStatus value) { + assert(::location::nearby::proto::sharing::DecryptCertificateFailureStatus_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + status_ = value; +} +inline void SharingLog_DecryptCertificateFailure::set_status(::location::nearby::proto::sharing::DecryptCertificateFailureStatus value) { + _internal_set_status(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure.status) +} + +// ------------------------------------------------------------------- + +// SharingLog_ShowAllowPermissionAutoAccess + +// optional .location.nearby.proto.sharing.ActivityName activity_name = 1; +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_has_activity_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::has_activity_name() const { + return _internal_has_activity_name(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::clear_activity_name() { + activity_name_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_ShowAllowPermissionAutoAccess::_internal_activity_name() const { + return static_cast< ::location::nearby::proto::sharing::ActivityName >(activity_name_); +} +inline ::location::nearby::proto::sharing::ActivityName SharingLog_ShowAllowPermissionAutoAccess::activity_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.activity_name) + return _internal_activity_name(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::_internal_set_activity_name(::location::nearby::proto::sharing::ActivityName value) { + assert(::location::nearby::proto::sharing::ActivityName_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + activity_name_ = value; +} +inline void SharingLog_ShowAllowPermissionAutoAccess::set_activity_name(::location::nearby::proto::sharing::ActivityName value) { + _internal_set_activity_name(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.activity_name) +} + +// optional bool allowed_auto_access = 2; +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_has_allowed_auto_access() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::has_allowed_auto_access() const { + return _internal_has_allowed_auto_access(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::clear_allowed_auto_access() { + allowed_auto_access_ = false; + _has_bits_[0] &= ~0x00000002u; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_allowed_auto_access() const { + return allowed_auto_access_; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::allowed_auto_access() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.allowed_auto_access) + return _internal_allowed_auto_access(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::_internal_set_allowed_auto_access(bool value) { + _has_bits_[0] |= 0x00000002u; + allowed_auto_access_ = value; +} +inline void SharingLog_ShowAllowPermissionAutoAccess::set_allowed_auto_access(bool value) { + _internal_set_allowed_auto_access(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.allowed_auto_access) +} + +// optional bool is_wifi_missing = 3; +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_has_is_wifi_missing() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::has_is_wifi_missing() const { + return _internal_has_is_wifi_missing(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::clear_is_wifi_missing() { + is_wifi_missing_ = false; + _has_bits_[0] &= ~0x00000004u; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_is_wifi_missing() const { + return is_wifi_missing_; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::is_wifi_missing() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.is_wifi_missing) + return _internal_is_wifi_missing(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::_internal_set_is_wifi_missing(bool value) { + _has_bits_[0] |= 0x00000004u; + is_wifi_missing_ = value; +} +inline void SharingLog_ShowAllowPermissionAutoAccess::set_is_wifi_missing(bool value) { + _internal_set_is_wifi_missing(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.is_wifi_missing) +} + +// optional bool is_bt_missing = 4; +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_has_is_bt_missing() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::has_is_bt_missing() const { + return _internal_has_is_bt_missing(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::clear_is_bt_missing() { + is_bt_missing_ = false; + _has_bits_[0] &= ~0x00000008u; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::_internal_is_bt_missing() const { + return is_bt_missing_; +} +inline bool SharingLog_ShowAllowPermissionAutoAccess::is_bt_missing() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.is_bt_missing) + return _internal_is_bt_missing(); +} +inline void SharingLog_ShowAllowPermissionAutoAccess::_internal_set_is_bt_missing(bool value) { + _has_bits_[0] |= 0x00000008u; + is_bt_missing_ = value; +} +inline void SharingLog_ShowAllowPermissionAutoAccess::set_is_bt_missing(bool value) { + _internal_set_is_bt_missing(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess.is_bt_missing) +} + +// ------------------------------------------------------------------- + +// SharingLog_TapQrCode + +// ------------------------------------------------------------------- + +// SharingLog_QrCodeLinkShown + +// ------------------------------------------------------------------- + +// SharingLog_FastInitDiscoverDevice + +// optional .location.nearby.proto.sharing.FastInitType fast_init_type = 2; +inline bool SharingLog_FastInitDiscoverDevice::_internal_has_fast_init_type() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_FastInitDiscoverDevice::has_fast_init_type() const { + return _internal_has_fast_init_type(); +} +inline void SharingLog_FastInitDiscoverDevice::clear_fast_init_type() { + fast_init_type_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::FastInitType SharingLog_FastInitDiscoverDevice::_internal_fast_init_type() const { + return static_cast< ::location::nearby::proto::sharing::FastInitType >(fast_init_type_); +} +inline ::location::nearby::proto::sharing::FastInitType SharingLog_FastInitDiscoverDevice::fast_init_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice.fast_init_type) + return _internal_fast_init_type(); +} +inline void SharingLog_FastInitDiscoverDevice::_internal_set_fast_init_type(::location::nearby::proto::sharing::FastInitType value) { + assert(::location::nearby::proto::sharing::FastInitType_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + fast_init_type_ = value; +} +inline void SharingLog_FastInitDiscoverDevice::set_fast_init_type(::location::nearby::proto::sharing::FastInitType value) { + _internal_set_fast_init_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice.fast_init_type) +} + +// optional .location.nearby.proto.sharing.FastInitState fast_init_state = 3; +inline bool SharingLog_FastInitDiscoverDevice::_internal_has_fast_init_state() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_FastInitDiscoverDevice::has_fast_init_state() const { + return _internal_has_fast_init_state(); +} +inline void SharingLog_FastInitDiscoverDevice::clear_fast_init_state() { + fast_init_state_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::FastInitState SharingLog_FastInitDiscoverDevice::_internal_fast_init_state() const { + return static_cast< ::location::nearby::proto::sharing::FastInitState >(fast_init_state_); +} +inline ::location::nearby::proto::sharing::FastInitState SharingLog_FastInitDiscoverDevice::fast_init_state() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice.fast_init_state) + return _internal_fast_init_state(); +} +inline void SharingLog_FastInitDiscoverDevice::_internal_set_fast_init_state(::location::nearby::proto::sharing::FastInitState value) { + assert(::location::nearby::proto::sharing::FastInitState_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + fast_init_state_ = value; +} +inline void SharingLog_FastInitDiscoverDevice::set_fast_init_state(::location::nearby::proto::sharing::FastInitState value) { + _internal_set_fast_init_state(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice.fast_init_state) +} + +// ------------------------------------------------------------------- + +// SharingLog_ShareTargetInfo + +// optional .location.nearby.proto.sharing.DeviceType device_type = 1; +inline bool SharingLog_ShareTargetInfo::_internal_has_device_type() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_ShareTargetInfo::has_device_type() const { + return _internal_has_device_type(); +} +inline void SharingLog_ShareTargetInfo::clear_device_type() { + device_type_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::DeviceType SharingLog_ShareTargetInfo::_internal_device_type() const { + return static_cast< ::location::nearby::proto::sharing::DeviceType >(device_type_); +} +inline ::location::nearby::proto::sharing::DeviceType SharingLog_ShareTargetInfo::device_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo.device_type) + return _internal_device_type(); +} +inline void SharingLog_ShareTargetInfo::_internal_set_device_type(::location::nearby::proto::sharing::DeviceType value) { + assert(::location::nearby::proto::sharing::DeviceType_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + device_type_ = value; +} +inline void SharingLog_ShareTargetInfo::set_device_type(::location::nearby::proto::sharing::DeviceType value) { + _internal_set_device_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo.device_type) +} + +// optional .location.nearby.proto.sharing.OSType os_type = 2; +inline bool SharingLog_ShareTargetInfo::_internal_has_os_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_ShareTargetInfo::has_os_type() const { + return _internal_has_os_type(); +} +inline void SharingLog_ShareTargetInfo::clear_os_type() { + os_type_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::location::nearby::proto::sharing::OSType SharingLog_ShareTargetInfo::_internal_os_type() const { + return static_cast< ::location::nearby::proto::sharing::OSType >(os_type_); +} +inline ::location::nearby::proto::sharing::OSType SharingLog_ShareTargetInfo::os_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo.os_type) + return _internal_os_type(); +} +inline void SharingLog_ShareTargetInfo::_internal_set_os_type(::location::nearby::proto::sharing::OSType value) { + assert(::location::nearby::proto::sharing::OSType_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + os_type_ = value; +} +inline void SharingLog_ShareTargetInfo::set_os_type(::location::nearby::proto::sharing::OSType value) { + _internal_set_os_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo.os_type) +} + +// optional .location.nearby.proto.sharing.DeviceRelationship device_relationship = 3; +inline bool SharingLog_ShareTargetInfo::_internal_has_device_relationship() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_ShareTargetInfo::has_device_relationship() const { + return _internal_has_device_relationship(); +} +inline void SharingLog_ShareTargetInfo::clear_device_relationship() { + device_relationship_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::DeviceRelationship SharingLog_ShareTargetInfo::_internal_device_relationship() const { + return static_cast< ::location::nearby::proto::sharing::DeviceRelationship >(device_relationship_); +} +inline ::location::nearby::proto::sharing::DeviceRelationship SharingLog_ShareTargetInfo::device_relationship() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo.device_relationship) + return _internal_device_relationship(); +} +inline void SharingLog_ShareTargetInfo::_internal_set_device_relationship(::location::nearby::proto::sharing::DeviceRelationship value) { + assert(::location::nearby::proto::sharing::DeviceRelationship_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + device_relationship_ = value; +} +inline void SharingLog_ShareTargetInfo::set_device_relationship(::location::nearby::proto::sharing::DeviceRelationship value) { + _internal_set_device_relationship(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.ShareTargetInfo.device_relationship) +} + +// ------------------------------------------------------------------- + +// SharingLog_AttachmentsInfo + +// repeated .nearby.sharing.analytics.proto.SharingLog.TextAttachment text_attachment = 1; +inline int SharingLog_AttachmentsInfo::_internal_text_attachment_size() const { + return text_attachment_.size(); +} +inline int SharingLog_AttachmentsInfo::text_attachment_size() const { + return _internal_text_attachment_size(); +} +inline void SharingLog_AttachmentsInfo::clear_text_attachment() { + text_attachment_.Clear(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* SharingLog_AttachmentsInfo::mutable_text_attachment(int index) { + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.text_attachment) + return text_attachment_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment >* +SharingLog_AttachmentsInfo::mutable_text_attachment() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.text_attachment) + return &text_attachment_; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TextAttachment& SharingLog_AttachmentsInfo::_internal_text_attachment(int index) const { + return text_attachment_.Get(index); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TextAttachment& SharingLog_AttachmentsInfo::text_attachment(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.text_attachment) + return _internal_text_attachment(index); +} +inline ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* SharingLog_AttachmentsInfo::_internal_add_text_attachment() { + return text_attachment_.Add(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* SharingLog_AttachmentsInfo::add_text_attachment() { + ::nearby::sharing::analytics::proto::SharingLog_TextAttachment* _add = _internal_add_text_attachment(); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.text_attachment) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment >& +SharingLog_AttachmentsInfo::text_attachment() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.text_attachment) + return text_attachment_; +} + +// repeated .nearby.sharing.analytics.proto.SharingLog.FileAttachment file_attachment = 2; +inline int SharingLog_AttachmentsInfo::_internal_file_attachment_size() const { + return file_attachment_.size(); +} +inline int SharingLog_AttachmentsInfo::file_attachment_size() const { + return _internal_file_attachment_size(); +} +inline void SharingLog_AttachmentsInfo::clear_file_attachment() { + file_attachment_.Clear(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* SharingLog_AttachmentsInfo::mutable_file_attachment(int index) { + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.file_attachment) + return file_attachment_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment >* +SharingLog_AttachmentsInfo::mutable_file_attachment() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.file_attachment) + return &file_attachment_; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_FileAttachment& SharingLog_AttachmentsInfo::_internal_file_attachment(int index) const { + return file_attachment_.Get(index); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_FileAttachment& SharingLog_AttachmentsInfo::file_attachment(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.file_attachment) + return _internal_file_attachment(index); +} +inline ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* SharingLog_AttachmentsInfo::_internal_add_file_attachment() { + return file_attachment_.Add(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* SharingLog_AttachmentsInfo::add_file_attachment() { + ::nearby::sharing::analytics::proto::SharingLog_FileAttachment* _add = _internal_add_file_attachment(); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.file_attachment) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment >& +SharingLog_AttachmentsInfo::file_attachment() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.file_attachment) + return file_attachment_; +} + +// optional string required_app = 3; +inline bool SharingLog_AttachmentsInfo::_internal_has_required_app() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AttachmentsInfo::has_required_app() const { + return _internal_has_required_app(); +} +inline void SharingLog_AttachmentsInfo::clear_required_app() { + required_app_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_AttachmentsInfo::required_app() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.required_app) + return _internal_required_app(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_AttachmentsInfo::set_required_app(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + required_app_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.required_app) +} +inline std::string* SharingLog_AttachmentsInfo::mutable_required_app() { + std::string* _s = _internal_mutable_required_app(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.required_app) + return _s; +} +inline const std::string& SharingLog_AttachmentsInfo::_internal_required_app() const { + return required_app_.Get(); +} +inline void SharingLog_AttachmentsInfo::_internal_set_required_app(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + required_app_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_AttachmentsInfo::_internal_mutable_required_app() { + _has_bits_[0] |= 0x00000001u; + return required_app_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_AttachmentsInfo::release_required_app() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.required_app) + if (!_internal_has_required_app()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = required_app_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (required_app_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + required_app_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_AttachmentsInfo::set_allocated_required_app(std::string* required_app) { + if (required_app != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + required_app_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), required_app, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (required_app_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + required_app_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.required_app) +} + +// repeated .nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment wifi_credentials_attachment = 4; +inline int SharingLog_AttachmentsInfo::_internal_wifi_credentials_attachment_size() const { + return wifi_credentials_attachment_.size(); +} +inline int SharingLog_AttachmentsInfo::wifi_credentials_attachment_size() const { + return _internal_wifi_credentials_attachment_size(); +} +inline void SharingLog_AttachmentsInfo::clear_wifi_credentials_attachment() { + wifi_credentials_attachment_.Clear(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* SharingLog_AttachmentsInfo::mutable_wifi_credentials_attachment(int index) { + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.wifi_credentials_attachment) + return wifi_credentials_attachment_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment >* +SharingLog_AttachmentsInfo::mutable_wifi_credentials_attachment() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.wifi_credentials_attachment) + return &wifi_credentials_attachment_; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment& SharingLog_AttachmentsInfo::_internal_wifi_credentials_attachment(int index) const { + return wifi_credentials_attachment_.Get(index); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment& SharingLog_AttachmentsInfo::wifi_credentials_attachment(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.wifi_credentials_attachment) + return _internal_wifi_credentials_attachment(index); +} +inline ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* SharingLog_AttachmentsInfo::_internal_add_wifi_credentials_attachment() { + return wifi_credentials_attachment_.Add(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* SharingLog_AttachmentsInfo::add_wifi_credentials_attachment() { + ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment* _add = _internal_add_wifi_credentials_attachment(); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.wifi_credentials_attachment) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_WifiCredentialsAttachment >& +SharingLog_AttachmentsInfo::wifi_credentials_attachment() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.wifi_credentials_attachment) + return wifi_credentials_attachment_; +} + +// repeated .nearby.sharing.analytics.proto.SharingLog.AppAttachment app_attachment = 5; +inline int SharingLog_AttachmentsInfo::_internal_app_attachment_size() const { + return app_attachment_.size(); +} +inline int SharingLog_AttachmentsInfo::app_attachment_size() const { + return _internal_app_attachment_size(); +} +inline void SharingLog_AttachmentsInfo::clear_app_attachment() { + app_attachment_.Clear(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* SharingLog_AttachmentsInfo::mutable_app_attachment(int index) { + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.app_attachment) + return app_attachment_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment >* +SharingLog_AttachmentsInfo::mutable_app_attachment() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.app_attachment) + return &app_attachment_; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AppAttachment& SharingLog_AttachmentsInfo::_internal_app_attachment(int index) const { + return app_attachment_.Get(index); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AppAttachment& SharingLog_AttachmentsInfo::app_attachment(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.app_attachment) + return _internal_app_attachment(index); +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* SharingLog_AttachmentsInfo::_internal_add_app_attachment() { + return app_attachment_.Add(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* SharingLog_AttachmentsInfo::add_app_attachment() { + ::nearby::sharing::analytics::proto::SharingLog_AppAttachment* _add = _internal_add_app_attachment(); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.app_attachment) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_AppAttachment >& +SharingLog_AttachmentsInfo::app_attachment() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.app_attachment) + return app_attachment_; +} + +// repeated .nearby.sharing.analytics.proto.SharingLog.StreamAttachment stream_attachment = 6; +inline int SharingLog_AttachmentsInfo::_internal_stream_attachment_size() const { + return stream_attachment_.size(); +} +inline int SharingLog_AttachmentsInfo::stream_attachment_size() const { + return _internal_stream_attachment_size(); +} +inline void SharingLog_AttachmentsInfo::clear_stream_attachment() { + stream_attachment_.Clear(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* SharingLog_AttachmentsInfo::mutable_stream_attachment(int index) { + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.stream_attachment) + return stream_attachment_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment >* +SharingLog_AttachmentsInfo::mutable_stream_attachment() { + // @@protoc_insertion_point(field_mutable_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.stream_attachment) + return &stream_attachment_; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment& SharingLog_AttachmentsInfo::_internal_stream_attachment(int index) const { + return stream_attachment_.Get(index); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment& SharingLog_AttachmentsInfo::stream_attachment(int index) const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.stream_attachment) + return _internal_stream_attachment(index); +} +inline ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* SharingLog_AttachmentsInfo::_internal_add_stream_attachment() { + return stream_attachment_.Add(); +} +inline ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* SharingLog_AttachmentsInfo::add_stream_attachment() { + ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment* _add = _internal_add_stream_attachment(); + // @@protoc_insertion_point(field_add:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.stream_attachment) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::nearby::sharing::analytics::proto::SharingLog_StreamAttachment >& +SharingLog_AttachmentsInfo::stream_attachment() const { + // @@protoc_insertion_point(field_list:nearby.sharing.analytics.proto.SharingLog.AttachmentsInfo.stream_attachment) + return stream_attachment_; +} + +// ------------------------------------------------------------------- + +// SharingLog_TextAttachment + +// optional .nearby.sharing.analytics.proto.SharingLog.TextAttachment.Type type = 1; +inline bool SharingLog_TextAttachment::_internal_has_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_TextAttachment::has_type() const { + return _internal_has_type(); +} +inline void SharingLog_TextAttachment::clear_type() { + type_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type SharingLog_TextAttachment::_internal_type() const { + return static_cast< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type >(type_); +} +inline ::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type SharingLog_TextAttachment::type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.TextAttachment.type) + return _internal_type(); +} +inline void SharingLog_TextAttachment::_internal_set_type(::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type value) { + assert(::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + type_ = value; +} +inline void SharingLog_TextAttachment::set_type(::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.TextAttachment.type) +} + +// optional int64 size_bytes = 2; +inline bool SharingLog_TextAttachment::_internal_has_size_bytes() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_TextAttachment::has_size_bytes() const { + return _internal_has_size_bytes(); +} +inline void SharingLog_TextAttachment::clear_size_bytes() { + size_bytes_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_TextAttachment::_internal_size_bytes() const { + return size_bytes_; +} +inline int64_t SharingLog_TextAttachment::size_bytes() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.TextAttachment.size_bytes) + return _internal_size_bytes(); +} +inline void SharingLog_TextAttachment::_internal_set_size_bytes(int64_t value) { + _has_bits_[0] |= 0x00000001u; + size_bytes_ = value; +} +inline void SharingLog_TextAttachment::set_size_bytes(int64_t value) { + _internal_set_size_bytes(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.TextAttachment.size_bytes) +} + +// optional int64 batch_id = 3; +inline bool SharingLog_TextAttachment::_internal_has_batch_id() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_TextAttachment::has_batch_id() const { + return _internal_has_batch_id(); +} +inline void SharingLog_TextAttachment::clear_batch_id() { + batch_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000008u; +} +inline int64_t SharingLog_TextAttachment::_internal_batch_id() const { + return batch_id_; +} +inline int64_t SharingLog_TextAttachment::batch_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.TextAttachment.batch_id) + return _internal_batch_id(); +} +inline void SharingLog_TextAttachment::_internal_set_batch_id(int64_t value) { + _has_bits_[0] |= 0x00000008u; + batch_id_ = value; +} +inline void SharingLog_TextAttachment::set_batch_id(int64_t value) { + _internal_set_batch_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.TextAttachment.batch_id) +} + +// optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; +inline bool SharingLog_TextAttachment::_internal_has_source_type() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_TextAttachment::has_source_type() const { + return _internal_has_source_type(); +} +inline void SharingLog_TextAttachment::clear_source_type() { + source_type_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_TextAttachment::_internal_source_type() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentSourceType >(source_type_); +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_TextAttachment::source_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.TextAttachment.source_type) + return _internal_source_type(); +} +inline void SharingLog_TextAttachment::_internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + assert(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + source_type_ = value; +} +inline void SharingLog_TextAttachment::set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + _internal_set_source_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.TextAttachment.source_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_FileAttachment + +// optional .nearby.sharing.analytics.proto.SharingLog.FileAttachment.Type type = 1; +inline bool SharingLog_FileAttachment::_internal_has_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_FileAttachment::has_type() const { + return _internal_has_type(); +} +inline void SharingLog_FileAttachment::clear_type() { + type_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type SharingLog_FileAttachment::_internal_type() const { + return static_cast< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type >(type_); +} +inline ::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type SharingLog_FileAttachment::type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FileAttachment.type) + return _internal_type(); +} +inline void SharingLog_FileAttachment::_internal_set_type(::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type value) { + assert(::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type_IsValid(value)); + _has_bits_[0] |= 0x00000002u; + type_ = value; +} +inline void SharingLog_FileAttachment::set_type(::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FileAttachment.type) +} + +// optional int64 size_bytes = 2; +inline bool SharingLog_FileAttachment::_internal_has_size_bytes() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_FileAttachment::has_size_bytes() const { + return _internal_has_size_bytes(); +} +inline void SharingLog_FileAttachment::clear_size_bytes() { + size_bytes_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_FileAttachment::_internal_size_bytes() const { + return size_bytes_; +} +inline int64_t SharingLog_FileAttachment::size_bytes() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FileAttachment.size_bytes) + return _internal_size_bytes(); +} +inline void SharingLog_FileAttachment::_internal_set_size_bytes(int64_t value) { + _has_bits_[0] |= 0x00000001u; + size_bytes_ = value; +} +inline void SharingLog_FileAttachment::set_size_bytes(int64_t value) { + _internal_set_size_bytes(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FileAttachment.size_bytes) +} + +// optional int64 offset_bytes = 4; +inline bool SharingLog_FileAttachment::_internal_has_offset_bytes() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_FileAttachment::has_offset_bytes() const { + return _internal_has_offset_bytes(); +} +inline void SharingLog_FileAttachment::clear_offset_bytes() { + offset_bytes_ = int64_t{0}; + _has_bits_[0] &= ~0x00000008u; +} +inline int64_t SharingLog_FileAttachment::_internal_offset_bytes() const { + return offset_bytes_; +} +inline int64_t SharingLog_FileAttachment::offset_bytes() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FileAttachment.offset_bytes) + return _internal_offset_bytes(); +} +inline void SharingLog_FileAttachment::_internal_set_offset_bytes(int64_t value) { + _has_bits_[0] |= 0x00000008u; + offset_bytes_ = value; +} +inline void SharingLog_FileAttachment::set_offset_bytes(int64_t value) { + _internal_set_offset_bytes(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FileAttachment.offset_bytes) +} + +// optional int64 batch_id = 5; +inline bool SharingLog_FileAttachment::_internal_has_batch_id() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + return value; +} +inline bool SharingLog_FileAttachment::has_batch_id() const { + return _internal_has_batch_id(); +} +inline void SharingLog_FileAttachment::clear_batch_id() { + batch_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000010u; +} +inline int64_t SharingLog_FileAttachment::_internal_batch_id() const { + return batch_id_; +} +inline int64_t SharingLog_FileAttachment::batch_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FileAttachment.batch_id) + return _internal_batch_id(); +} +inline void SharingLog_FileAttachment::_internal_set_batch_id(int64_t value) { + _has_bits_[0] |= 0x00000010u; + batch_id_ = value; +} +inline void SharingLog_FileAttachment::set_batch_id(int64_t value) { + _internal_set_batch_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FileAttachment.batch_id) +} + +// optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 6; +inline bool SharingLog_FileAttachment::_internal_has_source_type() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_FileAttachment::has_source_type() const { + return _internal_has_source_type(); +} +inline void SharingLog_FileAttachment::clear_source_type() { + source_type_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_FileAttachment::_internal_source_type() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentSourceType >(source_type_); +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_FileAttachment::source_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.FileAttachment.source_type) + return _internal_source_type(); +} +inline void SharingLog_FileAttachment::_internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + assert(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + source_type_ = value; +} +inline void SharingLog_FileAttachment::set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + _internal_set_source_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.FileAttachment.source_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_WifiCredentialsAttachment + +// optional int32 security_type = 1; +inline bool SharingLog_WifiCredentialsAttachment::_internal_has_security_type() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_WifiCredentialsAttachment::has_security_type() const { + return _internal_has_security_type(); +} +inline void SharingLog_WifiCredentialsAttachment::clear_security_type() { + security_type_ = 0; + _has_bits_[0] &= ~0x00000002u; +} +inline int32_t SharingLog_WifiCredentialsAttachment::_internal_security_type() const { + return security_type_; +} +inline int32_t SharingLog_WifiCredentialsAttachment::security_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment.security_type) + return _internal_security_type(); +} +inline void SharingLog_WifiCredentialsAttachment::_internal_set_security_type(int32_t value) { + _has_bits_[0] |= 0x00000002u; + security_type_ = value; +} +inline void SharingLog_WifiCredentialsAttachment::set_security_type(int32_t value) { + _internal_set_security_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment.security_type) +} + +// optional int64 batch_id = 2; +inline bool SharingLog_WifiCredentialsAttachment::_internal_has_batch_id() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_WifiCredentialsAttachment::has_batch_id() const { + return _internal_has_batch_id(); +} +inline void SharingLog_WifiCredentialsAttachment::clear_batch_id() { + batch_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000001u; +} +inline int64_t SharingLog_WifiCredentialsAttachment::_internal_batch_id() const { + return batch_id_; +} +inline int64_t SharingLog_WifiCredentialsAttachment::batch_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment.batch_id) + return _internal_batch_id(); +} +inline void SharingLog_WifiCredentialsAttachment::_internal_set_batch_id(int64_t value) { + _has_bits_[0] |= 0x00000001u; + batch_id_ = value; +} +inline void SharingLog_WifiCredentialsAttachment::set_batch_id(int64_t value) { + _internal_set_batch_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment.batch_id) +} + +// optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; +inline bool SharingLog_WifiCredentialsAttachment::_internal_has_source_type() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_WifiCredentialsAttachment::has_source_type() const { + return _internal_has_source_type(); +} +inline void SharingLog_WifiCredentialsAttachment::clear_source_type() { + source_type_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_WifiCredentialsAttachment::_internal_source_type() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentSourceType >(source_type_); +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_WifiCredentialsAttachment::source_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment.source_type) + return _internal_source_type(); +} +inline void SharingLog_WifiCredentialsAttachment::_internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + assert(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + source_type_ = value; +} +inline void SharingLog_WifiCredentialsAttachment::set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + _internal_set_source_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.WifiCredentialsAttachment.source_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_AppAttachment + +// optional string package_name = 1; +inline bool SharingLog_AppAttachment::_internal_has_package_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AppAttachment::has_package_name() const { + return _internal_has_package_name(); +} +inline void SharingLog_AppAttachment::clear_package_name() { + package_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_AppAttachment::package_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppAttachment.package_name) + return _internal_package_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_AppAttachment::set_package_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + package_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppAttachment.package_name) +} +inline std::string* SharingLog_AppAttachment::mutable_package_name() { + std::string* _s = _internal_mutable_package_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.AppAttachment.package_name) + return _s; +} +inline const std::string& SharingLog_AppAttachment::_internal_package_name() const { + return package_name_.Get(); +} +inline void SharingLog_AppAttachment::_internal_set_package_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + package_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppAttachment::_internal_mutable_package_name() { + _has_bits_[0] |= 0x00000001u; + return package_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_AppAttachment::release_package_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.AppAttachment.package_name) + if (!_internal_has_package_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = package_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (package_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_AppAttachment::set_allocated_package_name(std::string* package_name) { + if (package_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + package_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), package_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (package_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.AppAttachment.package_name) +} + +// optional int64 size = 2; +inline bool SharingLog_AppAttachment::_internal_has_size() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_AppAttachment::has_size() const { + return _internal_has_size(); +} +inline void SharingLog_AppAttachment::clear_size() { + size_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_AppAttachment::_internal_size() const { + return size_; +} +inline int64_t SharingLog_AppAttachment::size() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppAttachment.size) + return _internal_size(); +} +inline void SharingLog_AppAttachment::_internal_set_size(int64_t value) { + _has_bits_[0] |= 0x00000002u; + size_ = value; +} +inline void SharingLog_AppAttachment::set_size(int64_t value) { + _internal_set_size(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppAttachment.size) +} + +// optional int64 batch_id = 3; +inline bool SharingLog_AppAttachment::_internal_has_batch_id() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_AppAttachment::has_batch_id() const { + return _internal_has_batch_id(); +} +inline void SharingLog_AppAttachment::clear_batch_id() { + batch_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000004u; +} +inline int64_t SharingLog_AppAttachment::_internal_batch_id() const { + return batch_id_; +} +inline int64_t SharingLog_AppAttachment::batch_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppAttachment.batch_id) + return _internal_batch_id(); +} +inline void SharingLog_AppAttachment::_internal_set_batch_id(int64_t value) { + _has_bits_[0] |= 0x00000004u; + batch_id_ = value; +} +inline void SharingLog_AppAttachment::set_batch_id(int64_t value) { + _internal_set_batch_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppAttachment.batch_id) +} + +// optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 4; +inline bool SharingLog_AppAttachment::_internal_has_source_type() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + return value; +} +inline bool SharingLog_AppAttachment::has_source_type() const { + return _internal_has_source_type(); +} +inline void SharingLog_AppAttachment::clear_source_type() { + source_type_ = 0; + _has_bits_[0] &= ~0x00000008u; +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_AppAttachment::_internal_source_type() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentSourceType >(source_type_); +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_AppAttachment::source_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppAttachment.source_type) + return _internal_source_type(); +} +inline void SharingLog_AppAttachment::_internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + assert(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(value)); + _has_bits_[0] |= 0x00000008u; + source_type_ = value; +} +inline void SharingLog_AppAttachment::set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + _internal_set_source_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppAttachment.source_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_StreamAttachment + +// optional string package_name = 1; +inline bool SharingLog_StreamAttachment::_internal_has_package_name() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_StreamAttachment::has_package_name() const { + return _internal_has_package_name(); +} +inline void SharingLog_StreamAttachment::clear_package_name() { + package_name_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog_StreamAttachment::package_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.package_name) + return _internal_package_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog_StreamAttachment::set_package_name(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + package_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.package_name) +} +inline std::string* SharingLog_StreamAttachment::mutable_package_name() { + std::string* _s = _internal_mutable_package_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.package_name) + return _s; +} +inline const std::string& SharingLog_StreamAttachment::_internal_package_name() const { + return package_name_.Get(); +} +inline void SharingLog_StreamAttachment::_internal_set_package_name(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + package_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog_StreamAttachment::_internal_mutable_package_name() { + _has_bits_[0] |= 0x00000001u; + return package_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog_StreamAttachment::release_package_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.package_name) + if (!_internal_has_package_name()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = package_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (package_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog_StreamAttachment::set_allocated_package_name(std::string* package_name) { + if (package_name != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + package_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), package_name, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (package_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + package_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.package_name) +} + +// optional int64 batch_id = 2; +inline bool SharingLog_StreamAttachment::_internal_has_batch_id() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog_StreamAttachment::has_batch_id() const { + return _internal_has_batch_id(); +} +inline void SharingLog_StreamAttachment::clear_batch_id() { + batch_id_ = int64_t{0}; + _has_bits_[0] &= ~0x00000002u; +} +inline int64_t SharingLog_StreamAttachment::_internal_batch_id() const { + return batch_id_; +} +inline int64_t SharingLog_StreamAttachment::batch_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.batch_id) + return _internal_batch_id(); +} +inline void SharingLog_StreamAttachment::_internal_set_batch_id(int64_t value) { + _has_bits_[0] |= 0x00000002u; + batch_id_ = value; +} +inline void SharingLog_StreamAttachment::set_batch_id(int64_t value) { + _internal_set_batch_id(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.batch_id) +} + +// optional .location.nearby.proto.sharing.AttachmentSourceType source_type = 3; +inline bool SharingLog_StreamAttachment::_internal_has_source_type() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog_StreamAttachment::has_source_type() const { + return _internal_has_source_type(); +} +inline void SharingLog_StreamAttachment::clear_source_type() { + source_type_ = 0; + _has_bits_[0] &= ~0x00000004u; +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_StreamAttachment::_internal_source_type() const { + return static_cast< ::location::nearby::proto::sharing::AttachmentSourceType >(source_type_); +} +inline ::location::nearby::proto::sharing::AttachmentSourceType SharingLog_StreamAttachment::source_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.source_type) + return _internal_source_type(); +} +inline void SharingLog_StreamAttachment::_internal_set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + assert(::location::nearby::proto::sharing::AttachmentSourceType_IsValid(value)); + _has_bits_[0] |= 0x00000004u; + source_type_ = value; +} +inline void SharingLog_StreamAttachment::set_source_type(::location::nearby::proto::sharing::AttachmentSourceType value) { + _internal_set_source_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.StreamAttachment.source_type) +} + +// ------------------------------------------------------------------- + +// SharingLog_AppCrash + +// optional .location.nearby.proto.sharing.AppCrashReason crash_reason = 1; +inline bool SharingLog_AppCrash::_internal_has_crash_reason() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_AppCrash::has_crash_reason() const { + return _internal_has_crash_reason(); +} +inline void SharingLog_AppCrash::clear_crash_reason() { + crash_reason_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::AppCrashReason SharingLog_AppCrash::_internal_crash_reason() const { + return static_cast< ::location::nearby::proto::sharing::AppCrashReason >(crash_reason_); +} +inline ::location::nearby::proto::sharing::AppCrashReason SharingLog_AppCrash::crash_reason() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.AppCrash.crash_reason) + return _internal_crash_reason(); +} +inline void SharingLog_AppCrash::_internal_set_crash_reason(::location::nearby::proto::sharing::AppCrashReason value) { + assert(::location::nearby::proto::sharing::AppCrashReason_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + crash_reason_ = value; +} +inline void SharingLog_AppCrash::set_crash_reason(::location::nearby::proto::sharing::AppCrashReason value) { + _internal_set_crash_reason(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.AppCrash.crash_reason) +} + +// ------------------------------------------------------------------- + +// SharingLog_SetupWizard + +// optional .location.nearby.proto.sharing.Visibility visibility = 1; +inline bool SharingLog_SetupWizard::_internal_has_visibility() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SetupWizard::has_visibility() const { + return _internal_has_visibility(); +} +inline void SharingLog_SetupWizard::clear_visibility() { + visibility_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_SetupWizard::_internal_visibility() const { + return static_cast< ::location::nearby::proto::sharing::Visibility >(visibility_); +} +inline ::location::nearby::proto::sharing::Visibility SharingLog_SetupWizard::visibility() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SetupWizard.visibility) + return _internal_visibility(); +} +inline void SharingLog_SetupWizard::_internal_set_visibility(::location::nearby::proto::sharing::Visibility value) { + assert(::location::nearby::proto::sharing::Visibility_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + visibility_ = value; +} +inline void SharingLog_SetupWizard::set_visibility(::location::nearby::proto::sharing::Visibility value) { + _internal_set_visibility(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SetupWizard.visibility) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendDesktopNotification + +// optional .location.nearby.proto.sharing.DesktopNotification event = 1; +inline bool SharingLog_SendDesktopNotification::_internal_has_event() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SendDesktopNotification::has_event() const { + return _internal_has_event(); +} +inline void SharingLog_SendDesktopNotification::clear_event() { + event_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::DesktopNotification SharingLog_SendDesktopNotification::_internal_event() const { + return static_cast< ::location::nearby::proto::sharing::DesktopNotification >(event_); +} +inline ::location::nearby::proto::sharing::DesktopNotification SharingLog_SendDesktopNotification::event() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification.event) + return _internal_event(); +} +inline void SharingLog_SendDesktopNotification::_internal_set_event(::location::nearby::proto::sharing::DesktopNotification value) { + assert(::location::nearby::proto::sharing::DesktopNotification_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + event_ = value; +} +inline void SharingLog_SendDesktopNotification::set_event(::location::nearby::proto::sharing::DesktopNotification value) { + _internal_set_event(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification.event) +} + +// ------------------------------------------------------------------- + +// SharingLog_SendDesktopTransferEvent + +// optional .location.nearby.proto.sharing.DesktopTransferEventType event = 1; +inline bool SharingLog_SendDesktopTransferEvent::_internal_has_event() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog_SendDesktopTransferEvent::has_event() const { + return _internal_has_event(); +} +inline void SharingLog_SendDesktopTransferEvent::clear_event() { + event_ = 0; + _has_bits_[0] &= ~0x00000001u; +} +inline ::location::nearby::proto::sharing::DesktopTransferEventType SharingLog_SendDesktopTransferEvent::_internal_event() const { + return static_cast< ::location::nearby::proto::sharing::DesktopTransferEventType >(event_); +} +inline ::location::nearby::proto::sharing::DesktopTransferEventType SharingLog_SendDesktopTransferEvent::event() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent.event) + return _internal_event(); +} +inline void SharingLog_SendDesktopTransferEvent::_internal_set_event(::location::nearby::proto::sharing::DesktopTransferEventType value) { + assert(::location::nearby::proto::sharing::DesktopTransferEventType_IsValid(value)); + _has_bits_[0] |= 0x00000001u; + event_ = value; +} +inline void SharingLog_SendDesktopTransferEvent::set_event(::location::nearby::proto::sharing::DesktopTransferEventType value) { + _internal_set_event(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent.event) +} + +// ------------------------------------------------------------------- + +// SharingLog + +// optional .location.nearby.proto.sharing.EventType event_type = 1; +inline bool SharingLog::_internal_has_event_type() const { + bool value = (_has_bits_[2] & 0x00000080u) != 0; + return value; +} +inline bool SharingLog::has_event_type() const { + return _internal_has_event_type(); +} +inline void SharingLog::clear_event_type() { + event_type_ = 0; + _has_bits_[2] &= ~0x00000080u; +} +inline ::location::nearby::proto::sharing::EventType SharingLog::_internal_event_type() const { + return static_cast< ::location::nearby::proto::sharing::EventType >(event_type_); +} +inline ::location::nearby::proto::sharing::EventType SharingLog::event_type() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.event_type) + return _internal_event_type(); +} +inline void SharingLog::_internal_set_event_type(::location::nearby::proto::sharing::EventType value) { + assert(::location::nearby::proto::sharing::EventType_IsValid(value)); + _has_bits_[2] |= 0x00000080u; + event_type_ = value; +} +inline void SharingLog::set_event_type(::location::nearby::proto::sharing::EventType value) { + _internal_set_event_type(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.event_type) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.UnknownEvent unknown_event = 2; +inline bool SharingLog::_internal_has_unknown_event() const { + bool value = (_has_bits_[0] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || unknown_event_ != nullptr); + return value; +} +inline bool SharingLog::has_unknown_event() const { + return _internal_has_unknown_event(); +} +inline void SharingLog::clear_unknown_event() { + if (unknown_event_ != nullptr) unknown_event_->Clear(); + _has_bits_[0] &= ~0x00000008u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent& SharingLog::_internal_unknown_event() const { + const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* p = unknown_event_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_UnknownEvent_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent& SharingLog::unknown_event() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.unknown_event) + return _internal_unknown_event(); +} +inline void SharingLog::unsafe_arena_set_allocated_unknown_event( + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* unknown_event) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(unknown_event_); + } + unknown_event_ = unknown_event; + if (unknown_event) { + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.unknown_event) +} +inline ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* SharingLog::release_unknown_event() { + _has_bits_[0] &= ~0x00000008u; + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* temp = unknown_event_; + unknown_event_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* SharingLog::unsafe_arena_release_unknown_event() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.unknown_event) + _has_bits_[0] &= ~0x00000008u; + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* temp = unknown_event_; + unknown_event_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* SharingLog::_internal_mutable_unknown_event() { + _has_bits_[0] |= 0x00000008u; + if (unknown_event_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_UnknownEvent>(GetArenaForAllocation()); + unknown_event_ = p; + } + return unknown_event_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* SharingLog::mutable_unknown_event() { + ::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* _msg = _internal_mutable_unknown_event(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.unknown_event) + return _msg; +} +inline void SharingLog::set_allocated_unknown_event(::nearby::sharing::analytics::proto::SharingLog_UnknownEvent* unknown_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete unknown_event_; + } + if (unknown_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_UnknownEvent>::GetOwningArena(unknown_event); + if (message_arena != submessage_arena) { + unknown_event = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, unknown_event, submessage_arena); + } + _has_bits_[0] |= 0x00000008u; + } else { + _has_bits_[0] &= ~0x00000008u; + } + unknown_event_ = unknown_event; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.unknown_event) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AcceptAgreements accept_agreements = 3; +inline bool SharingLog::_internal_has_accept_agreements() const { + bool value = (_has_bits_[0] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || accept_agreements_ != nullptr); + return value; +} +inline bool SharingLog::has_accept_agreements() const { + return _internal_has_accept_agreements(); +} +inline void SharingLog::clear_accept_agreements() { + if (accept_agreements_ != nullptr) accept_agreements_->Clear(); + _has_bits_[0] &= ~0x00000010u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements& SharingLog::_internal_accept_agreements() const { + const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* p = accept_agreements_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AcceptAgreements_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements& SharingLog::accept_agreements() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.accept_agreements) + return _internal_accept_agreements(); +} +inline void SharingLog::unsafe_arena_set_allocated_accept_agreements( + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* accept_agreements) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(accept_agreements_); + } + accept_agreements_ = accept_agreements; + if (accept_agreements) { + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.accept_agreements) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* SharingLog::release_accept_agreements() { + _has_bits_[0] &= ~0x00000010u; + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* temp = accept_agreements_; + accept_agreements_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* SharingLog::unsafe_arena_release_accept_agreements() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.accept_agreements) + _has_bits_[0] &= ~0x00000010u; + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* temp = accept_agreements_; + accept_agreements_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* SharingLog::_internal_mutable_accept_agreements() { + _has_bits_[0] |= 0x00000010u; + if (accept_agreements_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements>(GetArenaForAllocation()); + accept_agreements_ = p; + } + return accept_agreements_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* SharingLog::mutable_accept_agreements() { + ::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* _msg = _internal_mutable_accept_agreements(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.accept_agreements) + return _msg; +} +inline void SharingLog::set_allocated_accept_agreements(::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements* accept_agreements) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete accept_agreements_; + } + if (accept_agreements) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AcceptAgreements>::GetOwningArena(accept_agreements); + if (message_arena != submessage_arena) { + accept_agreements = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, accept_agreements, submessage_arena); + } + _has_bits_[0] |= 0x00000010u; + } else { + _has_bits_[0] &= ~0x00000010u; + } + accept_agreements_ = accept_agreements; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.accept_agreements) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.EnableNearbySharing enable_nearby_sharing = 4; +inline bool SharingLog::_internal_has_enable_nearby_sharing() const { + bool value = (_has_bits_[0] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || enable_nearby_sharing_ != nullptr); + return value; +} +inline bool SharingLog::has_enable_nearby_sharing() const { + return _internal_has_enable_nearby_sharing(); +} +inline void SharingLog::clear_enable_nearby_sharing() { + if (enable_nearby_sharing_ != nullptr) enable_nearby_sharing_->Clear(); + _has_bits_[0] &= ~0x00000020u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing& SharingLog::_internal_enable_nearby_sharing() const { + const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* p = enable_nearby_sharing_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_EnableNearbySharing_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing& SharingLog::enable_nearby_sharing() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.enable_nearby_sharing) + return _internal_enable_nearby_sharing(); +} +inline void SharingLog::unsafe_arena_set_allocated_enable_nearby_sharing( + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* enable_nearby_sharing) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(enable_nearby_sharing_); + } + enable_nearby_sharing_ = enable_nearby_sharing; + if (enable_nearby_sharing) { + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.enable_nearby_sharing) +} +inline ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* SharingLog::release_enable_nearby_sharing() { + _has_bits_[0] &= ~0x00000020u; + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* temp = enable_nearby_sharing_; + enable_nearby_sharing_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* SharingLog::unsafe_arena_release_enable_nearby_sharing() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.enable_nearby_sharing) + _has_bits_[0] &= ~0x00000020u; + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* temp = enable_nearby_sharing_; + enable_nearby_sharing_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* SharingLog::_internal_mutable_enable_nearby_sharing() { + _has_bits_[0] |= 0x00000020u; + if (enable_nearby_sharing_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing>(GetArenaForAllocation()); + enable_nearby_sharing_ = p; + } + return enable_nearby_sharing_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* SharingLog::mutable_enable_nearby_sharing() { + ::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* _msg = _internal_mutable_enable_nearby_sharing(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.enable_nearby_sharing) + return _msg; +} +inline void SharingLog::set_allocated_enable_nearby_sharing(::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing* enable_nearby_sharing) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete enable_nearby_sharing_; + } + if (enable_nearby_sharing) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_EnableNearbySharing>::GetOwningArena(enable_nearby_sharing); + if (message_arena != submessage_arena) { + enable_nearby_sharing = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, enable_nearby_sharing, submessage_arena); + } + _has_bits_[0] |= 0x00000020u; + } else { + _has_bits_[0] &= ~0x00000020u; + } + enable_nearby_sharing_ = enable_nearby_sharing; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.enable_nearby_sharing) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SetVisibility set_visibility = 5; +inline bool SharingLog::_internal_has_set_visibility() const { + bool value = (_has_bits_[0] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || set_visibility_ != nullptr); + return value; +} +inline bool SharingLog::has_set_visibility() const { + return _internal_has_set_visibility(); +} +inline void SharingLog::clear_set_visibility() { + if (set_visibility_ != nullptr) set_visibility_->Clear(); + _has_bits_[0] &= ~0x00000040u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility& SharingLog::_internal_set_visibility() const { + const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* p = set_visibility_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SetVisibility_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetVisibility& SharingLog::set_visibility() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.set_visibility) + return _internal_set_visibility(); +} +inline void SharingLog::unsafe_arena_set_allocated_set_visibility( + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* set_visibility) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(set_visibility_); + } + set_visibility_ = set_visibility; + if (set_visibility) { + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_visibility) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* SharingLog::release_set_visibility() { + _has_bits_[0] &= ~0x00000040u; + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* temp = set_visibility_; + set_visibility_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* SharingLog::unsafe_arena_release_set_visibility() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.set_visibility) + _has_bits_[0] &= ~0x00000040u; + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* temp = set_visibility_; + set_visibility_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* SharingLog::_internal_mutable_set_visibility() { + _has_bits_[0] |= 0x00000040u; + if (set_visibility_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetVisibility>(GetArenaForAllocation()); + set_visibility_ = p; + } + return set_visibility_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* SharingLog::mutable_set_visibility() { + ::nearby::sharing::analytics::proto::SharingLog_SetVisibility* _msg = _internal_mutable_set_visibility(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.set_visibility) + return _msg; +} +inline void SharingLog::set_allocated_set_visibility(::nearby::sharing::analytics::proto::SharingLog_SetVisibility* set_visibility) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete set_visibility_; + } + if (set_visibility) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SetVisibility>::GetOwningArena(set_visibility); + if (message_arena != submessage_arena) { + set_visibility = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, set_visibility, submessage_arena); + } + _has_bits_[0] |= 0x00000040u; + } else { + _has_bits_[0] &= ~0x00000040u; + } + set_visibility_ = set_visibility; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_visibility) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DescribeAttachments describe_attachments = 6; +inline bool SharingLog::_internal_has_describe_attachments() const { + bool value = (_has_bits_[0] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || describe_attachments_ != nullptr); + return value; +} +inline bool SharingLog::has_describe_attachments() const { + return _internal_has_describe_attachments(); +} +inline void SharingLog::clear_describe_attachments() { + if (describe_attachments_ != nullptr) describe_attachments_->Clear(); + _has_bits_[0] &= ~0x00000080u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments& SharingLog::_internal_describe_attachments() const { + const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* p = describe_attachments_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DescribeAttachments_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments& SharingLog::describe_attachments() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.describe_attachments) + return _internal_describe_attachments(); +} +inline void SharingLog::unsafe_arena_set_allocated_describe_attachments( + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* describe_attachments) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(describe_attachments_); + } + describe_attachments_ = describe_attachments; + if (describe_attachments) { + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.describe_attachments) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* SharingLog::release_describe_attachments() { + _has_bits_[0] &= ~0x00000080u; + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* temp = describe_attachments_; + describe_attachments_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* SharingLog::unsafe_arena_release_describe_attachments() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.describe_attachments) + _has_bits_[0] &= ~0x00000080u; + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* temp = describe_attachments_; + describe_attachments_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* SharingLog::_internal_mutable_describe_attachments() { + _has_bits_[0] |= 0x00000080u; + if (describe_attachments_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments>(GetArenaForAllocation()); + describe_attachments_ = p; + } + return describe_attachments_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* SharingLog::mutable_describe_attachments() { + ::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* _msg = _internal_mutable_describe_attachments(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.describe_attachments) + return _msg; +} +inline void SharingLog::set_allocated_describe_attachments(::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments* describe_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete describe_attachments_; + } + if (describe_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DescribeAttachments>::GetOwningArena(describe_attachments); + if (message_arena != submessage_arena) { + describe_attachments = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, describe_attachments, submessage_arena); + } + _has_bits_[0] |= 0x00000080u; + } else { + _has_bits_[0] &= ~0x00000080u; + } + describe_attachments_ = describe_attachments; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.describe_attachments) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsStart scan_for_share_targets_start = 7; +inline bool SharingLog::_internal_has_scan_for_share_targets_start() const { + bool value = (_has_bits_[0] & 0x00000100u) != 0; + PROTOBUF_ASSUME(!value || scan_for_share_targets_start_ != nullptr); + return value; +} +inline bool SharingLog::has_scan_for_share_targets_start() const { + return _internal_has_scan_for_share_targets_start(); +} +inline void SharingLog::clear_scan_for_share_targets_start() { + if (scan_for_share_targets_start_ != nullptr) scan_for_share_targets_start_->Clear(); + _has_bits_[0] &= ~0x00000100u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart& SharingLog::_internal_scan_for_share_targets_start() const { + const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* p = scan_for_share_targets_start_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ScanForShareTargetsStart_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart& SharingLog::scan_for_share_targets_start() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_start) + return _internal_scan_for_share_targets_start(); +} +inline void SharingLog::unsafe_arena_set_allocated_scan_for_share_targets_start( + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* scan_for_share_targets_start) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(scan_for_share_targets_start_); + } + scan_for_share_targets_start_ = scan_for_share_targets_start; + if (scan_for_share_targets_start) { + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_start) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* SharingLog::release_scan_for_share_targets_start() { + _has_bits_[0] &= ~0x00000100u; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* temp = scan_for_share_targets_start_; + scan_for_share_targets_start_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* SharingLog::unsafe_arena_release_scan_for_share_targets_start() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_start) + _has_bits_[0] &= ~0x00000100u; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* temp = scan_for_share_targets_start_; + scan_for_share_targets_start_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* SharingLog::_internal_mutable_scan_for_share_targets_start() { + _has_bits_[0] |= 0x00000100u; + if (scan_for_share_targets_start_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart>(GetArenaForAllocation()); + scan_for_share_targets_start_ = p; + } + return scan_for_share_targets_start_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* SharingLog::mutable_scan_for_share_targets_start() { + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* _msg = _internal_mutable_scan_for_share_targets_start(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_start) + return _msg; +} +inline void SharingLog::set_allocated_scan_for_share_targets_start(::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart* scan_for_share_targets_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete scan_for_share_targets_start_; + } + if (scan_for_share_targets_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsStart>::GetOwningArena(scan_for_share_targets_start); + if (message_arena != submessage_arena) { + scan_for_share_targets_start = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, scan_for_share_targets_start, submessage_arena); + } + _has_bits_[0] |= 0x00000100u; + } else { + _has_bits_[0] &= ~0x00000100u; + } + scan_for_share_targets_start_ = scan_for_share_targets_start; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_start) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ScanForShareTargetsEnd scan_for_share_targets_end = 8; +inline bool SharingLog::_internal_has_scan_for_share_targets_end() const { + bool value = (_has_bits_[0] & 0x00000200u) != 0; + PROTOBUF_ASSUME(!value || scan_for_share_targets_end_ != nullptr); + return value; +} +inline bool SharingLog::has_scan_for_share_targets_end() const { + return _internal_has_scan_for_share_targets_end(); +} +inline void SharingLog::clear_scan_for_share_targets_end() { + if (scan_for_share_targets_end_ != nullptr) scan_for_share_targets_end_->Clear(); + _has_bits_[0] &= ~0x00000200u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd& SharingLog::_internal_scan_for_share_targets_end() const { + const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* p = scan_for_share_targets_end_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ScanForShareTargetsEnd_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd& SharingLog::scan_for_share_targets_end() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_end) + return _internal_scan_for_share_targets_end(); +} +inline void SharingLog::unsafe_arena_set_allocated_scan_for_share_targets_end( + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* scan_for_share_targets_end) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(scan_for_share_targets_end_); + } + scan_for_share_targets_end_ = scan_for_share_targets_end; + if (scan_for_share_targets_end) { + _has_bits_[0] |= 0x00000200u; + } else { + _has_bits_[0] &= ~0x00000200u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_end) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* SharingLog::release_scan_for_share_targets_end() { + _has_bits_[0] &= ~0x00000200u; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* temp = scan_for_share_targets_end_; + scan_for_share_targets_end_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* SharingLog::unsafe_arena_release_scan_for_share_targets_end() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_end) + _has_bits_[0] &= ~0x00000200u; + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* temp = scan_for_share_targets_end_; + scan_for_share_targets_end_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* SharingLog::_internal_mutable_scan_for_share_targets_end() { + _has_bits_[0] |= 0x00000200u; + if (scan_for_share_targets_end_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd>(GetArenaForAllocation()); + scan_for_share_targets_end_ = p; + } + return scan_for_share_targets_end_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* SharingLog::mutable_scan_for_share_targets_end() { + ::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* _msg = _internal_mutable_scan_for_share_targets_end(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_end) + return _msg; +} +inline void SharingLog::set_allocated_scan_for_share_targets_end(::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd* scan_for_share_targets_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete scan_for_share_targets_end_; + } + if (scan_for_share_targets_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ScanForShareTargetsEnd>::GetOwningArena(scan_for_share_targets_end); + if (message_arena != submessage_arena) { + scan_for_share_targets_end = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, scan_for_share_targets_end, submessage_arena); + } + _has_bits_[0] |= 0x00000200u; + } else { + _has_bits_[0] &= ~0x00000200u; + } + scan_for_share_targets_end_ = scan_for_share_targets_end; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.scan_for_share_targets_end) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceStart advertise_device_presence_start = 9; +inline bool SharingLog::_internal_has_advertise_device_presence_start() const { + bool value = (_has_bits_[0] & 0x00000400u) != 0; + PROTOBUF_ASSUME(!value || advertise_device_presence_start_ != nullptr); + return value; +} +inline bool SharingLog::has_advertise_device_presence_start() const { + return _internal_has_advertise_device_presence_start(); +} +inline void SharingLog::clear_advertise_device_presence_start() { + if (advertise_device_presence_start_ != nullptr) advertise_device_presence_start_->Clear(); + _has_bits_[0] &= ~0x00000400u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart& SharingLog::_internal_advertise_device_presence_start() const { + const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* p = advertise_device_presence_start_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AdvertiseDevicePresenceStart_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart& SharingLog::advertise_device_presence_start() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_start) + return _internal_advertise_device_presence_start(); +} +inline void SharingLog::unsafe_arena_set_allocated_advertise_device_presence_start( + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* advertise_device_presence_start) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(advertise_device_presence_start_); + } + advertise_device_presence_start_ = advertise_device_presence_start; + if (advertise_device_presence_start) { + _has_bits_[0] |= 0x00000400u; + } else { + _has_bits_[0] &= ~0x00000400u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_start) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* SharingLog::release_advertise_device_presence_start() { + _has_bits_[0] &= ~0x00000400u; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* temp = advertise_device_presence_start_; + advertise_device_presence_start_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* SharingLog::unsafe_arena_release_advertise_device_presence_start() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_start) + _has_bits_[0] &= ~0x00000400u; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* temp = advertise_device_presence_start_; + advertise_device_presence_start_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* SharingLog::_internal_mutable_advertise_device_presence_start() { + _has_bits_[0] |= 0x00000400u; + if (advertise_device_presence_start_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart>(GetArenaForAllocation()); + advertise_device_presence_start_ = p; + } + return advertise_device_presence_start_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* SharingLog::mutable_advertise_device_presence_start() { + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* _msg = _internal_mutable_advertise_device_presence_start(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_start) + return _msg; +} +inline void SharingLog::set_allocated_advertise_device_presence_start(::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart* advertise_device_presence_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete advertise_device_presence_start_; + } + if (advertise_device_presence_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceStart>::GetOwningArena(advertise_device_presence_start); + if (message_arena != submessage_arena) { + advertise_device_presence_start = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, advertise_device_presence_start, submessage_arena); + } + _has_bits_[0] |= 0x00000400u; + } else { + _has_bits_[0] &= ~0x00000400u; + } + advertise_device_presence_start_ = advertise_device_presence_start; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_start) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AdvertiseDevicePresenceEnd advertise_device_presence_end = 10; +inline bool SharingLog::_internal_has_advertise_device_presence_end() const { + bool value = (_has_bits_[0] & 0x00000800u) != 0; + PROTOBUF_ASSUME(!value || advertise_device_presence_end_ != nullptr); + return value; +} +inline bool SharingLog::has_advertise_device_presence_end() const { + return _internal_has_advertise_device_presence_end(); +} +inline void SharingLog::clear_advertise_device_presence_end() { + if (advertise_device_presence_end_ != nullptr) advertise_device_presence_end_->Clear(); + _has_bits_[0] &= ~0x00000800u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd& SharingLog::_internal_advertise_device_presence_end() const { + const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* p = advertise_device_presence_end_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AdvertiseDevicePresenceEnd_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd& SharingLog::advertise_device_presence_end() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_end) + return _internal_advertise_device_presence_end(); +} +inline void SharingLog::unsafe_arena_set_allocated_advertise_device_presence_end( + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* advertise_device_presence_end) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(advertise_device_presence_end_); + } + advertise_device_presence_end_ = advertise_device_presence_end; + if (advertise_device_presence_end) { + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_end) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* SharingLog::release_advertise_device_presence_end() { + _has_bits_[0] &= ~0x00000800u; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* temp = advertise_device_presence_end_; + advertise_device_presence_end_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* SharingLog::unsafe_arena_release_advertise_device_presence_end() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_end) + _has_bits_[0] &= ~0x00000800u; + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* temp = advertise_device_presence_end_; + advertise_device_presence_end_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* SharingLog::_internal_mutable_advertise_device_presence_end() { + _has_bits_[0] |= 0x00000800u; + if (advertise_device_presence_end_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd>(GetArenaForAllocation()); + advertise_device_presence_end_ = p; + } + return advertise_device_presence_end_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* SharingLog::mutable_advertise_device_presence_end() { + ::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* _msg = _internal_mutable_advertise_device_presence_end(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_end) + return _msg; +} +inline void SharingLog::set_allocated_advertise_device_presence_end(::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd* advertise_device_presence_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete advertise_device_presence_end_; + } + if (advertise_device_presence_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AdvertiseDevicePresenceEnd>::GetOwningArena(advertise_device_presence_end); + if (message_arena != submessage_arena) { + advertise_device_presence_end = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, advertise_device_presence_end, submessage_arena); + } + _has_bits_[0] |= 0x00000800u; + } else { + _has_bits_[0] &= ~0x00000800u; + } + advertise_device_presence_end_ = advertise_device_presence_end; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.advertise_device_presence_end) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendFastInitialization send_initialization = 11; +inline bool SharingLog::_internal_has_send_initialization() const { + bool value = (_has_bits_[0] & 0x00001000u) != 0; + PROTOBUF_ASSUME(!value || send_initialization_ != nullptr); + return value; +} +inline bool SharingLog::has_send_initialization() const { + return _internal_has_send_initialization(); +} +inline void SharingLog::clear_send_initialization() { + if (send_initialization_ != nullptr) send_initialization_->Clear(); + _has_bits_[0] &= ~0x00001000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization& SharingLog::_internal_send_initialization() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* p = send_initialization_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendFastInitialization_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization& SharingLog::send_initialization() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_initialization) + return _internal_send_initialization(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_initialization( + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* send_initialization) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_initialization_); + } + send_initialization_ = send_initialization; + if (send_initialization) { + _has_bits_[0] |= 0x00001000u; + } else { + _has_bits_[0] &= ~0x00001000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_initialization) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* SharingLog::release_send_initialization() { + _has_bits_[0] &= ~0x00001000u; + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* temp = send_initialization_; + send_initialization_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* SharingLog::unsafe_arena_release_send_initialization() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_initialization) + _has_bits_[0] &= ~0x00001000u; + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* temp = send_initialization_; + send_initialization_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* SharingLog::_internal_mutable_send_initialization() { + _has_bits_[0] |= 0x00001000u; + if (send_initialization_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization>(GetArenaForAllocation()); + send_initialization_ = p; + } + return send_initialization_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* SharingLog::mutable_send_initialization() { + ::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* _msg = _internal_mutable_send_initialization(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_initialization) + return _msg; +} +inline void SharingLog::set_allocated_send_initialization(::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization* send_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_initialization_; + } + if (send_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendFastInitialization>::GetOwningArena(send_initialization); + if (message_arena != submessage_arena) { + send_initialization = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_initialization, submessage_arena); + } + _has_bits_[0] |= 0x00001000u; + } else { + _has_bits_[0] &= ~0x00001000u; + } + send_initialization_ = send_initialization; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_initialization) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ReceiveFastInitialization receive_initialization = 12; +inline bool SharingLog::_internal_has_receive_initialization() const { + bool value = (_has_bits_[0] & 0x00002000u) != 0; + PROTOBUF_ASSUME(!value || receive_initialization_ != nullptr); + return value; +} +inline bool SharingLog::has_receive_initialization() const { + return _internal_has_receive_initialization(); +} +inline void SharingLog::clear_receive_initialization() { + if (receive_initialization_ != nullptr) receive_initialization_->Clear(); + _has_bits_[0] &= ~0x00002000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization& SharingLog::_internal_receive_initialization() const { + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* p = receive_initialization_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ReceiveFastInitialization_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization& SharingLog::receive_initialization() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.receive_initialization) + return _internal_receive_initialization(); +} +inline void SharingLog::unsafe_arena_set_allocated_receive_initialization( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* receive_initialization) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(receive_initialization_); + } + receive_initialization_ = receive_initialization; + if (receive_initialization) { + _has_bits_[0] |= 0x00002000u; + } else { + _has_bits_[0] &= ~0x00002000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_initialization) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* SharingLog::release_receive_initialization() { + _has_bits_[0] &= ~0x00002000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* temp = receive_initialization_; + receive_initialization_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* SharingLog::unsafe_arena_release_receive_initialization() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.receive_initialization) + _has_bits_[0] &= ~0x00002000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* temp = receive_initialization_; + receive_initialization_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* SharingLog::_internal_mutable_receive_initialization() { + _has_bits_[0] |= 0x00002000u; + if (receive_initialization_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization>(GetArenaForAllocation()); + receive_initialization_ = p; + } + return receive_initialization_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* SharingLog::mutable_receive_initialization() { + ::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* _msg = _internal_mutable_receive_initialization(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.receive_initialization) + return _msg; +} +inline void SharingLog::set_allocated_receive_initialization(::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization* receive_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete receive_initialization_; + } + if (receive_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ReceiveFastInitialization>::GetOwningArena(receive_initialization); + if (message_arena != submessage_arena) { + receive_initialization = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, receive_initialization, submessage_arena); + } + _has_bits_[0] |= 0x00002000u; + } else { + _has_bits_[0] &= ~0x00002000u; + } + receive_initialization_ = receive_initialization; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_initialization) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DiscoverShareTarget discover_share_target = 13; +inline bool SharingLog::_internal_has_discover_share_target() const { + bool value = (_has_bits_[0] & 0x00004000u) != 0; + PROTOBUF_ASSUME(!value || discover_share_target_ != nullptr); + return value; +} +inline bool SharingLog::has_discover_share_target() const { + return _internal_has_discover_share_target(); +} +inline void SharingLog::clear_discover_share_target() { + if (discover_share_target_ != nullptr) discover_share_target_->Clear(); + _has_bits_[0] &= ~0x00004000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget& SharingLog::_internal_discover_share_target() const { + const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* p = discover_share_target_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DiscoverShareTarget_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget& SharingLog::discover_share_target() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.discover_share_target) + return _internal_discover_share_target(); +} +inline void SharingLog::unsafe_arena_set_allocated_discover_share_target( + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* discover_share_target) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(discover_share_target_); + } + discover_share_target_ = discover_share_target; + if (discover_share_target) { + _has_bits_[0] |= 0x00004000u; + } else { + _has_bits_[0] &= ~0x00004000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.discover_share_target) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* SharingLog::release_discover_share_target() { + _has_bits_[0] &= ~0x00004000u; + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* temp = discover_share_target_; + discover_share_target_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* SharingLog::unsafe_arena_release_discover_share_target() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.discover_share_target) + _has_bits_[0] &= ~0x00004000u; + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* temp = discover_share_target_; + discover_share_target_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* SharingLog::_internal_mutable_discover_share_target() { + _has_bits_[0] |= 0x00004000u; + if (discover_share_target_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget>(GetArenaForAllocation()); + discover_share_target_ = p; + } + return discover_share_target_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* SharingLog::mutable_discover_share_target() { + ::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* _msg = _internal_mutable_discover_share_target(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.discover_share_target) + return _msg; +} +inline void SharingLog::set_allocated_discover_share_target(::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget* discover_share_target) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete discover_share_target_; + } + if (discover_share_target) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DiscoverShareTarget>::GetOwningArena(discover_share_target); + if (message_arena != submessage_arena) { + discover_share_target = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, discover_share_target, submessage_arena); + } + _has_bits_[0] |= 0x00004000u; + } else { + _has_bits_[0] &= ~0x00004000u; + } + discover_share_target_ = discover_share_target; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.discover_share_target) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendIntroduction send_introduction = 14; +inline bool SharingLog::_internal_has_send_introduction() const { + bool value = (_has_bits_[0] & 0x00008000u) != 0; + PROTOBUF_ASSUME(!value || send_introduction_ != nullptr); + return value; +} +inline bool SharingLog::has_send_introduction() const { + return _internal_has_send_introduction(); +} +inline void SharingLog::clear_send_introduction() { + if (send_introduction_ != nullptr) send_introduction_->Clear(); + _has_bits_[0] &= ~0x00008000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction& SharingLog::_internal_send_introduction() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* p = send_introduction_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendIntroduction_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction& SharingLog::send_introduction() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_introduction) + return _internal_send_introduction(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_introduction( + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* send_introduction) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_introduction_); + } + send_introduction_ = send_introduction; + if (send_introduction) { + _has_bits_[0] |= 0x00008000u; + } else { + _has_bits_[0] &= ~0x00008000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_introduction) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* SharingLog::release_send_introduction() { + _has_bits_[0] &= ~0x00008000u; + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* temp = send_introduction_; + send_introduction_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* SharingLog::unsafe_arena_release_send_introduction() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_introduction) + _has_bits_[0] &= ~0x00008000u; + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* temp = send_introduction_; + send_introduction_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* SharingLog::_internal_mutable_send_introduction() { + _has_bits_[0] |= 0x00008000u; + if (send_introduction_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendIntroduction>(GetArenaForAllocation()); + send_introduction_ = p; + } + return send_introduction_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* SharingLog::mutable_send_introduction() { + ::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* _msg = _internal_mutable_send_introduction(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_introduction) + return _msg; +} +inline void SharingLog::set_allocated_send_introduction(::nearby::sharing::analytics::proto::SharingLog_SendIntroduction* send_introduction) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_introduction_; + } + if (send_introduction) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendIntroduction>::GetOwningArena(send_introduction); + if (message_arena != submessage_arena) { + send_introduction = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_introduction, submessage_arena); + } + _has_bits_[0] |= 0x00008000u; + } else { + _has_bits_[0] &= ~0x00008000u; + } + send_introduction_ = send_introduction; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_introduction) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ReceiveIntroduction receive_introduction = 15; +inline bool SharingLog::_internal_has_receive_introduction() const { + bool value = (_has_bits_[0] & 0x00010000u) != 0; + PROTOBUF_ASSUME(!value || receive_introduction_ != nullptr); + return value; +} +inline bool SharingLog::has_receive_introduction() const { + return _internal_has_receive_introduction(); +} +inline void SharingLog::clear_receive_introduction() { + if (receive_introduction_ != nullptr) receive_introduction_->Clear(); + _has_bits_[0] &= ~0x00010000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction& SharingLog::_internal_receive_introduction() const { + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* p = receive_introduction_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ReceiveIntroduction_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction& SharingLog::receive_introduction() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.receive_introduction) + return _internal_receive_introduction(); +} +inline void SharingLog::unsafe_arena_set_allocated_receive_introduction( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* receive_introduction) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(receive_introduction_); + } + receive_introduction_ = receive_introduction; + if (receive_introduction) { + _has_bits_[0] |= 0x00010000u; + } else { + _has_bits_[0] &= ~0x00010000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_introduction) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* SharingLog::release_receive_introduction() { + _has_bits_[0] &= ~0x00010000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* temp = receive_introduction_; + receive_introduction_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* SharingLog::unsafe_arena_release_receive_introduction() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.receive_introduction) + _has_bits_[0] &= ~0x00010000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* temp = receive_introduction_; + receive_introduction_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* SharingLog::_internal_mutable_receive_introduction() { + _has_bits_[0] |= 0x00010000u; + if (receive_introduction_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction>(GetArenaForAllocation()); + receive_introduction_ = p; + } + return receive_introduction_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* SharingLog::mutable_receive_introduction() { + ::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* _msg = _internal_mutable_receive_introduction(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.receive_introduction) + return _msg; +} +inline void SharingLog::set_allocated_receive_introduction(::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction* receive_introduction) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete receive_introduction_; + } + if (receive_introduction) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ReceiveIntroduction>::GetOwningArena(receive_introduction); + if (message_arena != submessage_arena) { + receive_introduction = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, receive_introduction, submessage_arena); + } + _has_bits_[0] |= 0x00010000u; + } else { + _has_bits_[0] &= ~0x00010000u; + } + receive_introduction_ = receive_introduction; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_introduction) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.RespondToIntroduction respond_introduction = 16; +inline bool SharingLog::_internal_has_respond_introduction() const { + bool value = (_has_bits_[0] & 0x00020000u) != 0; + PROTOBUF_ASSUME(!value || respond_introduction_ != nullptr); + return value; +} +inline bool SharingLog::has_respond_introduction() const { + return _internal_has_respond_introduction(); +} +inline void SharingLog::clear_respond_introduction() { + if (respond_introduction_ != nullptr) respond_introduction_->Clear(); + _has_bits_[0] &= ~0x00020000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction& SharingLog::_internal_respond_introduction() const { + const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* p = respond_introduction_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_RespondToIntroduction_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction& SharingLog::respond_introduction() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.respond_introduction) + return _internal_respond_introduction(); +} +inline void SharingLog::unsafe_arena_set_allocated_respond_introduction( + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* respond_introduction) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(respond_introduction_); + } + respond_introduction_ = respond_introduction; + if (respond_introduction) { + _has_bits_[0] |= 0x00020000u; + } else { + _has_bits_[0] &= ~0x00020000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.respond_introduction) +} +inline ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* SharingLog::release_respond_introduction() { + _has_bits_[0] &= ~0x00020000u; + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* temp = respond_introduction_; + respond_introduction_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* SharingLog::unsafe_arena_release_respond_introduction() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.respond_introduction) + _has_bits_[0] &= ~0x00020000u; + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* temp = respond_introduction_; + respond_introduction_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* SharingLog::_internal_mutable_respond_introduction() { + _has_bits_[0] |= 0x00020000u; + if (respond_introduction_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction>(GetArenaForAllocation()); + respond_introduction_ = p; + } + return respond_introduction_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* SharingLog::mutable_respond_introduction() { + ::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* _msg = _internal_mutable_respond_introduction(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.respond_introduction) + return _msg; +} +inline void SharingLog::set_allocated_respond_introduction(::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction* respond_introduction) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete respond_introduction_; + } + if (respond_introduction) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_RespondToIntroduction>::GetOwningArena(respond_introduction); + if (message_arena != submessage_arena) { + respond_introduction = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, respond_introduction, submessage_arena); + } + _has_bits_[0] |= 0x00020000u; + } else { + _has_bits_[0] &= ~0x00020000u; + } + respond_introduction_ = respond_introduction; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.respond_introduction) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsStart send_attachments_start = 17; +inline bool SharingLog::_internal_has_send_attachments_start() const { + bool value = (_has_bits_[0] & 0x00040000u) != 0; + PROTOBUF_ASSUME(!value || send_attachments_start_ != nullptr); + return value; +} +inline bool SharingLog::has_send_attachments_start() const { + return _internal_has_send_attachments_start(); +} +inline void SharingLog::clear_send_attachments_start() { + if (send_attachments_start_ != nullptr) send_attachments_start_->Clear(); + _has_bits_[0] &= ~0x00040000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart& SharingLog::_internal_send_attachments_start() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* p = send_attachments_start_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendAttachmentsStart_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart& SharingLog::send_attachments_start() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_attachments_start) + return _internal_send_attachments_start(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_attachments_start( + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* send_attachments_start) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_attachments_start_); + } + send_attachments_start_ = send_attachments_start; + if (send_attachments_start) { + _has_bits_[0] |= 0x00040000u; + } else { + _has_bits_[0] &= ~0x00040000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_attachments_start) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* SharingLog::release_send_attachments_start() { + _has_bits_[0] &= ~0x00040000u; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* temp = send_attachments_start_; + send_attachments_start_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* SharingLog::unsafe_arena_release_send_attachments_start() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_attachments_start) + _has_bits_[0] &= ~0x00040000u; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* temp = send_attachments_start_; + send_attachments_start_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* SharingLog::_internal_mutable_send_attachments_start() { + _has_bits_[0] |= 0x00040000u; + if (send_attachments_start_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart>(GetArenaForAllocation()); + send_attachments_start_ = p; + } + return send_attachments_start_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* SharingLog::mutable_send_attachments_start() { + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* _msg = _internal_mutable_send_attachments_start(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_attachments_start) + return _msg; +} +inline void SharingLog::set_allocated_send_attachments_start(::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart* send_attachments_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_attachments_start_; + } + if (send_attachments_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsStart>::GetOwningArena(send_attachments_start); + if (message_arena != submessage_arena) { + send_attachments_start = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_attachments_start, submessage_arena); + } + _has_bits_[0] |= 0x00040000u; + } else { + _has_bits_[0] &= ~0x00040000u; + } + send_attachments_start_ = send_attachments_start; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_attachments_start) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendAttachmentsEnd send_attachments_end = 18; +inline bool SharingLog::_internal_has_send_attachments_end() const { + bool value = (_has_bits_[0] & 0x00080000u) != 0; + PROTOBUF_ASSUME(!value || send_attachments_end_ != nullptr); + return value; +} +inline bool SharingLog::has_send_attachments_end() const { + return _internal_has_send_attachments_end(); +} +inline void SharingLog::clear_send_attachments_end() { + if (send_attachments_end_ != nullptr) send_attachments_end_->Clear(); + _has_bits_[0] &= ~0x00080000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd& SharingLog::_internal_send_attachments_end() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* p = send_attachments_end_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendAttachmentsEnd_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd& SharingLog::send_attachments_end() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_attachments_end) + return _internal_send_attachments_end(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_attachments_end( + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* send_attachments_end) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_attachments_end_); + } + send_attachments_end_ = send_attachments_end; + if (send_attachments_end) { + _has_bits_[0] |= 0x00080000u; + } else { + _has_bits_[0] &= ~0x00080000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_attachments_end) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* SharingLog::release_send_attachments_end() { + _has_bits_[0] &= ~0x00080000u; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* temp = send_attachments_end_; + send_attachments_end_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* SharingLog::unsafe_arena_release_send_attachments_end() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_attachments_end) + _has_bits_[0] &= ~0x00080000u; + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* temp = send_attachments_end_; + send_attachments_end_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* SharingLog::_internal_mutable_send_attachments_end() { + _has_bits_[0] |= 0x00080000u; + if (send_attachments_end_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd>(GetArenaForAllocation()); + send_attachments_end_ = p; + } + return send_attachments_end_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* SharingLog::mutable_send_attachments_end() { + ::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* _msg = _internal_mutable_send_attachments_end(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_attachments_end) + return _msg; +} +inline void SharingLog::set_allocated_send_attachments_end(::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd* send_attachments_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_attachments_end_; + } + if (send_attachments_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendAttachmentsEnd>::GetOwningArena(send_attachments_end); + if (message_arena != submessage_arena) { + send_attachments_end = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_attachments_end, submessage_arena); + } + _has_bits_[0] |= 0x00080000u; + } else { + _has_bits_[0] &= ~0x00080000u; + } + send_attachments_end_ = send_attachments_end; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_attachments_end) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsStart receive_attachments_start = 19; +inline bool SharingLog::_internal_has_receive_attachments_start() const { + bool value = (_has_bits_[0] & 0x00100000u) != 0; + PROTOBUF_ASSUME(!value || receive_attachments_start_ != nullptr); + return value; +} +inline bool SharingLog::has_receive_attachments_start() const { + return _internal_has_receive_attachments_start(); +} +inline void SharingLog::clear_receive_attachments_start() { + if (receive_attachments_start_ != nullptr) receive_attachments_start_->Clear(); + _has_bits_[0] &= ~0x00100000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart& SharingLog::_internal_receive_attachments_start() const { + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* p = receive_attachments_start_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ReceiveAttachmentsStart_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart& SharingLog::receive_attachments_start() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.receive_attachments_start) + return _internal_receive_attachments_start(); +} +inline void SharingLog::unsafe_arena_set_allocated_receive_attachments_start( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* receive_attachments_start) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(receive_attachments_start_); + } + receive_attachments_start_ = receive_attachments_start; + if (receive_attachments_start) { + _has_bits_[0] |= 0x00100000u; + } else { + _has_bits_[0] &= ~0x00100000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_attachments_start) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* SharingLog::release_receive_attachments_start() { + _has_bits_[0] &= ~0x00100000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* temp = receive_attachments_start_; + receive_attachments_start_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* SharingLog::unsafe_arena_release_receive_attachments_start() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.receive_attachments_start) + _has_bits_[0] &= ~0x00100000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* temp = receive_attachments_start_; + receive_attachments_start_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* SharingLog::_internal_mutable_receive_attachments_start() { + _has_bits_[0] |= 0x00100000u; + if (receive_attachments_start_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart>(GetArenaForAllocation()); + receive_attachments_start_ = p; + } + return receive_attachments_start_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* SharingLog::mutable_receive_attachments_start() { + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* _msg = _internal_mutable_receive_attachments_start(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.receive_attachments_start) + return _msg; +} +inline void SharingLog::set_allocated_receive_attachments_start(::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart* receive_attachments_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete receive_attachments_start_; + } + if (receive_attachments_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsStart>::GetOwningArena(receive_attachments_start); + if (message_arena != submessage_arena) { + receive_attachments_start = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, receive_attachments_start, submessage_arena); + } + _has_bits_[0] |= 0x00100000u; + } else { + _has_bits_[0] &= ~0x00100000u; + } + receive_attachments_start_ = receive_attachments_start; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_attachments_start) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ReceiveAttachmentsEnd receive_attachments_end = 20; +inline bool SharingLog::_internal_has_receive_attachments_end() const { + bool value = (_has_bits_[0] & 0x00200000u) != 0; + PROTOBUF_ASSUME(!value || receive_attachments_end_ != nullptr); + return value; +} +inline bool SharingLog::has_receive_attachments_end() const { + return _internal_has_receive_attachments_end(); +} +inline void SharingLog::clear_receive_attachments_end() { + if (receive_attachments_end_ != nullptr) receive_attachments_end_->Clear(); + _has_bits_[0] &= ~0x00200000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd& SharingLog::_internal_receive_attachments_end() const { + const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* p = receive_attachments_end_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ReceiveAttachmentsEnd_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd& SharingLog::receive_attachments_end() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.receive_attachments_end) + return _internal_receive_attachments_end(); +} +inline void SharingLog::unsafe_arena_set_allocated_receive_attachments_end( + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* receive_attachments_end) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(receive_attachments_end_); + } + receive_attachments_end_ = receive_attachments_end; + if (receive_attachments_end) { + _has_bits_[0] |= 0x00200000u; + } else { + _has_bits_[0] &= ~0x00200000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_attachments_end) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* SharingLog::release_receive_attachments_end() { + _has_bits_[0] &= ~0x00200000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* temp = receive_attachments_end_; + receive_attachments_end_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* SharingLog::unsafe_arena_release_receive_attachments_end() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.receive_attachments_end) + _has_bits_[0] &= ~0x00200000u; + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* temp = receive_attachments_end_; + receive_attachments_end_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* SharingLog::_internal_mutable_receive_attachments_end() { + _has_bits_[0] |= 0x00200000u; + if (receive_attachments_end_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd>(GetArenaForAllocation()); + receive_attachments_end_ = p; + } + return receive_attachments_end_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* SharingLog::mutable_receive_attachments_end() { + ::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* _msg = _internal_mutable_receive_attachments_end(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.receive_attachments_end) + return _msg; +} +inline void SharingLog::set_allocated_receive_attachments_end(::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd* receive_attachments_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete receive_attachments_end_; + } + if (receive_attachments_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ReceiveAttachmentsEnd>::GetOwningArena(receive_attachments_end); + if (message_arena != submessage_arena) { + receive_attachments_end = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, receive_attachments_end, submessage_arena); + } + _has_bits_[0] |= 0x00200000u; + } else { + _has_bits_[0] &= ~0x00200000u; + } + receive_attachments_end_ = receive_attachments_end; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.receive_attachments_end) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.CancelSendingAttachments cancel_sending_attachments = 21; +inline bool SharingLog::_internal_has_cancel_sending_attachments() const { + bool value = (_has_bits_[0] & 0x00400000u) != 0; + PROTOBUF_ASSUME(!value || cancel_sending_attachments_ != nullptr); + return value; +} +inline bool SharingLog::has_cancel_sending_attachments() const { + return _internal_has_cancel_sending_attachments(); +} +inline void SharingLog::clear_cancel_sending_attachments() { + if (cancel_sending_attachments_ != nullptr) cancel_sending_attachments_->Clear(); + _has_bits_[0] &= ~0x00400000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments& SharingLog::_internal_cancel_sending_attachments() const { + const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* p = cancel_sending_attachments_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_CancelSendingAttachments_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments& SharingLog::cancel_sending_attachments() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.cancel_sending_attachments) + return _internal_cancel_sending_attachments(); +} +inline void SharingLog::unsafe_arena_set_allocated_cancel_sending_attachments( + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* cancel_sending_attachments) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(cancel_sending_attachments_); + } + cancel_sending_attachments_ = cancel_sending_attachments; + if (cancel_sending_attachments) { + _has_bits_[0] |= 0x00400000u; + } else { + _has_bits_[0] &= ~0x00400000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.cancel_sending_attachments) +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* SharingLog::release_cancel_sending_attachments() { + _has_bits_[0] &= ~0x00400000u; + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* temp = cancel_sending_attachments_; + cancel_sending_attachments_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* SharingLog::unsafe_arena_release_cancel_sending_attachments() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.cancel_sending_attachments) + _has_bits_[0] &= ~0x00400000u; + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* temp = cancel_sending_attachments_; + cancel_sending_attachments_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* SharingLog::_internal_mutable_cancel_sending_attachments() { + _has_bits_[0] |= 0x00400000u; + if (cancel_sending_attachments_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments>(GetArenaForAllocation()); + cancel_sending_attachments_ = p; + } + return cancel_sending_attachments_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* SharingLog::mutable_cancel_sending_attachments() { + ::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* _msg = _internal_mutable_cancel_sending_attachments(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.cancel_sending_attachments) + return _msg; +} +inline void SharingLog::set_allocated_cancel_sending_attachments(::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments* cancel_sending_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete cancel_sending_attachments_; + } + if (cancel_sending_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_CancelSendingAttachments>::GetOwningArena(cancel_sending_attachments); + if (message_arena != submessage_arena) { + cancel_sending_attachments = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, cancel_sending_attachments, submessage_arena); + } + _has_bits_[0] |= 0x00400000u; + } else { + _has_bits_[0] &= ~0x00400000u; + } + cancel_sending_attachments_ = cancel_sending_attachments; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.cancel_sending_attachments) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.CancelReceivingAttachments cancel_receiving_attachments = 22; +inline bool SharingLog::_internal_has_cancel_receiving_attachments() const { + bool value = (_has_bits_[0] & 0x00800000u) != 0; + PROTOBUF_ASSUME(!value || cancel_receiving_attachments_ != nullptr); + return value; +} +inline bool SharingLog::has_cancel_receiving_attachments() const { + return _internal_has_cancel_receiving_attachments(); +} +inline void SharingLog::clear_cancel_receiving_attachments() { + if (cancel_receiving_attachments_ != nullptr) cancel_receiving_attachments_->Clear(); + _has_bits_[0] &= ~0x00800000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments& SharingLog::_internal_cancel_receiving_attachments() const { + const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* p = cancel_receiving_attachments_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_CancelReceivingAttachments_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments& SharingLog::cancel_receiving_attachments() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.cancel_receiving_attachments) + return _internal_cancel_receiving_attachments(); +} +inline void SharingLog::unsafe_arena_set_allocated_cancel_receiving_attachments( + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* cancel_receiving_attachments) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(cancel_receiving_attachments_); + } + cancel_receiving_attachments_ = cancel_receiving_attachments; + if (cancel_receiving_attachments) { + _has_bits_[0] |= 0x00800000u; + } else { + _has_bits_[0] &= ~0x00800000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.cancel_receiving_attachments) +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* SharingLog::release_cancel_receiving_attachments() { + _has_bits_[0] &= ~0x00800000u; + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* temp = cancel_receiving_attachments_; + cancel_receiving_attachments_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* SharingLog::unsafe_arena_release_cancel_receiving_attachments() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.cancel_receiving_attachments) + _has_bits_[0] &= ~0x00800000u; + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* temp = cancel_receiving_attachments_; + cancel_receiving_attachments_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* SharingLog::_internal_mutable_cancel_receiving_attachments() { + _has_bits_[0] |= 0x00800000u; + if (cancel_receiving_attachments_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments>(GetArenaForAllocation()); + cancel_receiving_attachments_ = p; + } + return cancel_receiving_attachments_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* SharingLog::mutable_cancel_receiving_attachments() { + ::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* _msg = _internal_mutable_cancel_receiving_attachments(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.cancel_receiving_attachments) + return _msg; +} +inline void SharingLog::set_allocated_cancel_receiving_attachments(::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments* cancel_receiving_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete cancel_receiving_attachments_; + } + if (cancel_receiving_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_CancelReceivingAttachments>::GetOwningArena(cancel_receiving_attachments); + if (message_arena != submessage_arena) { + cancel_receiving_attachments = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, cancel_receiving_attachments, submessage_arena); + } + _has_bits_[0] |= 0x00800000u; + } else { + _has_bits_[0] &= ~0x00800000u; + } + cancel_receiving_attachments_ = cancel_receiving_attachments; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.cancel_receiving_attachments) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.OpenReceivedAttachments open_received_attachments = 23; +inline bool SharingLog::_internal_has_open_received_attachments() const { + bool value = (_has_bits_[0] & 0x01000000u) != 0; + PROTOBUF_ASSUME(!value || open_received_attachments_ != nullptr); + return value; +} +inline bool SharingLog::has_open_received_attachments() const { + return _internal_has_open_received_attachments(); +} +inline void SharingLog::clear_open_received_attachments() { + if (open_received_attachments_ != nullptr) open_received_attachments_->Clear(); + _has_bits_[0] &= ~0x01000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments& SharingLog::_internal_open_received_attachments() const { + const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* p = open_received_attachments_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_OpenReceivedAttachments_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments& SharingLog::open_received_attachments() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.open_received_attachments) + return _internal_open_received_attachments(); +} +inline void SharingLog::unsafe_arena_set_allocated_open_received_attachments( + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* open_received_attachments) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(open_received_attachments_); + } + open_received_attachments_ = open_received_attachments; + if (open_received_attachments) { + _has_bits_[0] |= 0x01000000u; + } else { + _has_bits_[0] &= ~0x01000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.open_received_attachments) +} +inline ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* SharingLog::release_open_received_attachments() { + _has_bits_[0] &= ~0x01000000u; + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* temp = open_received_attachments_; + open_received_attachments_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* SharingLog::unsafe_arena_release_open_received_attachments() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.open_received_attachments) + _has_bits_[0] &= ~0x01000000u; + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* temp = open_received_attachments_; + open_received_attachments_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* SharingLog::_internal_mutable_open_received_attachments() { + _has_bits_[0] |= 0x01000000u; + if (open_received_attachments_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments>(GetArenaForAllocation()); + open_received_attachments_ = p; + } + return open_received_attachments_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* SharingLog::mutable_open_received_attachments() { + ::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* _msg = _internal_mutable_open_received_attachments(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.open_received_attachments) + return _msg; +} +inline void SharingLog::set_allocated_open_received_attachments(::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments* open_received_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete open_received_attachments_; + } + if (open_received_attachments) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_OpenReceivedAttachments>::GetOwningArena(open_received_attachments); + if (message_arena != submessage_arena) { + open_received_attachments = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, open_received_attachments, submessage_arena); + } + _has_bits_[0] |= 0x01000000u; + } else { + _has_bits_[0] &= ~0x01000000u; + } + open_received_attachments_ = open_received_attachments; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.open_received_attachments) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.LaunchActivity launch_activity = 24; +inline bool SharingLog::_internal_has_launch_activity() const { + bool value = (_has_bits_[0] & 0x02000000u) != 0; + PROTOBUF_ASSUME(!value || launch_activity_ != nullptr); + return value; +} +inline bool SharingLog::has_launch_activity() const { + return _internal_has_launch_activity(); +} +inline void SharingLog::clear_launch_activity() { + if (launch_activity_ != nullptr) launch_activity_->Clear(); + _has_bits_[0] &= ~0x02000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity& SharingLog::_internal_launch_activity() const { + const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* p = launch_activity_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_LaunchActivity_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity& SharingLog::launch_activity() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.launch_activity) + return _internal_launch_activity(); +} +inline void SharingLog::unsafe_arena_set_allocated_launch_activity( + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* launch_activity) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(launch_activity_); + } + launch_activity_ = launch_activity; + if (launch_activity) { + _has_bits_[0] |= 0x02000000u; + } else { + _has_bits_[0] &= ~0x02000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.launch_activity) +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* SharingLog::release_launch_activity() { + _has_bits_[0] &= ~0x02000000u; + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* temp = launch_activity_; + launch_activity_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* SharingLog::unsafe_arena_release_launch_activity() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.launch_activity) + _has_bits_[0] &= ~0x02000000u; + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* temp = launch_activity_; + launch_activity_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* SharingLog::_internal_mutable_launch_activity() { + _has_bits_[0] |= 0x02000000u; + if (launch_activity_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchActivity>(GetArenaForAllocation()); + launch_activity_ = p; + } + return launch_activity_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* SharingLog::mutable_launch_activity() { + ::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* _msg = _internal_mutable_launch_activity(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.launch_activity) + return _msg; +} +inline void SharingLog::set_allocated_launch_activity(::nearby::sharing::analytics::proto::SharingLog_LaunchActivity* launch_activity) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete launch_activity_; + } + if (launch_activity) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_LaunchActivity>::GetOwningArena(launch_activity); + if (message_arena != submessage_arena) { + launch_activity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, launch_activity, submessage_arena); + } + _has_bits_[0] |= 0x02000000u; + } else { + _has_bits_[0] &= ~0x02000000u; + } + launch_activity_ = launch_activity; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.launch_activity) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AddContact add_contact = 25; +inline bool SharingLog::_internal_has_add_contact() const { + bool value = (_has_bits_[0] & 0x04000000u) != 0; + PROTOBUF_ASSUME(!value || add_contact_ != nullptr); + return value; +} +inline bool SharingLog::has_add_contact() const { + return _internal_has_add_contact(); +} +inline void SharingLog::clear_add_contact() { + if (add_contact_ != nullptr) add_contact_->Clear(); + _has_bits_[0] &= ~0x04000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AddContact& SharingLog::_internal_add_contact() const { + const ::nearby::sharing::analytics::proto::SharingLog_AddContact* p = add_contact_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AddContact_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AddContact& SharingLog::add_contact() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.add_contact) + return _internal_add_contact(); +} +inline void SharingLog::unsafe_arena_set_allocated_add_contact( + ::nearby::sharing::analytics::proto::SharingLog_AddContact* add_contact) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(add_contact_); + } + add_contact_ = add_contact; + if (add_contact) { + _has_bits_[0] |= 0x04000000u; + } else { + _has_bits_[0] &= ~0x04000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.add_contact) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddContact* SharingLog::release_add_contact() { + _has_bits_[0] &= ~0x04000000u; + ::nearby::sharing::analytics::proto::SharingLog_AddContact* temp = add_contact_; + add_contact_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddContact* SharingLog::unsafe_arena_release_add_contact() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.add_contact) + _has_bits_[0] &= ~0x04000000u; + ::nearby::sharing::analytics::proto::SharingLog_AddContact* temp = add_contact_; + add_contact_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddContact* SharingLog::_internal_mutable_add_contact() { + _has_bits_[0] |= 0x04000000u; + if (add_contact_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AddContact>(GetArenaForAllocation()); + add_contact_ = p; + } + return add_contact_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddContact* SharingLog::mutable_add_contact() { + ::nearby::sharing::analytics::proto::SharingLog_AddContact* _msg = _internal_mutable_add_contact(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.add_contact) + return _msg; +} +inline void SharingLog::set_allocated_add_contact(::nearby::sharing::analytics::proto::SharingLog_AddContact* add_contact) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete add_contact_; + } + if (add_contact) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AddContact>::GetOwningArena(add_contact); + if (message_arena != submessage_arena) { + add_contact = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, add_contact, submessage_arena); + } + _has_bits_[0] |= 0x04000000u; + } else { + _has_bits_[0] &= ~0x04000000u; + } + add_contact_ = add_contact; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.add_contact) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.RemoveContact remove_contact = 26; +inline bool SharingLog::_internal_has_remove_contact() const { + bool value = (_has_bits_[0] & 0x08000000u) != 0; + PROTOBUF_ASSUME(!value || remove_contact_ != nullptr); + return value; +} +inline bool SharingLog::has_remove_contact() const { + return _internal_has_remove_contact(); +} +inline void SharingLog::clear_remove_contact() { + if (remove_contact_ != nullptr) remove_contact_->Clear(); + _has_bits_[0] &= ~0x08000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact& SharingLog::_internal_remove_contact() const { + const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* p = remove_contact_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_RemoveContact_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RemoveContact& SharingLog::remove_contact() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.remove_contact) + return _internal_remove_contact(); +} +inline void SharingLog::unsafe_arena_set_allocated_remove_contact( + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* remove_contact) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(remove_contact_); + } + remove_contact_ = remove_contact; + if (remove_contact) { + _has_bits_[0] |= 0x08000000u; + } else { + _has_bits_[0] &= ~0x08000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.remove_contact) +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* SharingLog::release_remove_contact() { + _has_bits_[0] &= ~0x08000000u; + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* temp = remove_contact_; + remove_contact_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* SharingLog::unsafe_arena_release_remove_contact() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.remove_contact) + _has_bits_[0] &= ~0x08000000u; + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* temp = remove_contact_; + remove_contact_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* SharingLog::_internal_mutable_remove_contact() { + _has_bits_[0] |= 0x08000000u; + if (remove_contact_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RemoveContact>(GetArenaForAllocation()); + remove_contact_ = p; + } + return remove_contact_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* SharingLog::mutable_remove_contact() { + ::nearby::sharing::analytics::proto::SharingLog_RemoveContact* _msg = _internal_mutable_remove_contact(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.remove_contact) + return _msg; +} +inline void SharingLog::set_allocated_remove_contact(::nearby::sharing::analytics::proto::SharingLog_RemoveContact* remove_contact) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete remove_contact_; + } + if (remove_contact) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_RemoveContact>::GetOwningArena(remove_contact); + if (message_arena != submessage_arena) { + remove_contact = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, remove_contact, submessage_arena); + } + _has_bits_[0] |= 0x08000000u; + } else { + _has_bits_[0] &= ~0x08000000u; + } + remove_contact_ = remove_contact; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.remove_contact) +} + +// optional .location.nearby.proto.sharing.LogSource log_source = 27; +inline bool SharingLog::_internal_has_log_source() const { + bool value = (_has_bits_[2] & 0x00000100u) != 0; + return value; +} +inline bool SharingLog::has_log_source() const { + return _internal_has_log_source(); +} +inline void SharingLog::clear_log_source() { + log_source_ = 0; + _has_bits_[2] &= ~0x00000100u; +} +inline ::location::nearby::proto::sharing::LogSource SharingLog::_internal_log_source() const { + return static_cast< ::location::nearby::proto::sharing::LogSource >(log_source_); +} +inline ::location::nearby::proto::sharing::LogSource SharingLog::log_source() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.log_source) + return _internal_log_source(); +} +inline void SharingLog::_internal_set_log_source(::location::nearby::proto::sharing::LogSource value) { + assert(::location::nearby::proto::sharing::LogSource_IsValid(value)); + _has_bits_[2] |= 0x00000100u; + log_source_ = value; +} +inline void SharingLog::set_log_source(::location::nearby::proto::sharing::LogSource value) { + _internal_set_log_source(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.log_source) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.FastShareServerResponse fast_share_server_response = 28; +inline bool SharingLog::_internal_has_fast_share_server_response() const { + bool value = (_has_bits_[0] & 0x10000000u) != 0; + PROTOBUF_ASSUME(!value || fast_share_server_response_ != nullptr); + return value; +} +inline bool SharingLog::has_fast_share_server_response() const { + return _internal_has_fast_share_server_response(); +} +inline void SharingLog::clear_fast_share_server_response() { + if (fast_share_server_response_ != nullptr) fast_share_server_response_->Clear(); + _has_bits_[0] &= ~0x10000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse& SharingLog::_internal_fast_share_server_response() const { + const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* p = fast_share_server_response_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_FastShareServerResponse_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse& SharingLog::fast_share_server_response() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.fast_share_server_response) + return _internal_fast_share_server_response(); +} +inline void SharingLog::unsafe_arena_set_allocated_fast_share_server_response( + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* fast_share_server_response) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(fast_share_server_response_); + } + fast_share_server_response_ = fast_share_server_response; + if (fast_share_server_response) { + _has_bits_[0] |= 0x10000000u; + } else { + _has_bits_[0] &= ~0x10000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.fast_share_server_response) +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* SharingLog::release_fast_share_server_response() { + _has_bits_[0] &= ~0x10000000u; + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* temp = fast_share_server_response_; + fast_share_server_response_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* SharingLog::unsafe_arena_release_fast_share_server_response() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.fast_share_server_response) + _has_bits_[0] &= ~0x10000000u; + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* temp = fast_share_server_response_; + fast_share_server_response_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* SharingLog::_internal_mutable_fast_share_server_response() { + _has_bits_[0] |= 0x10000000u; + if (fast_share_server_response_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse>(GetArenaForAllocation()); + fast_share_server_response_ = p; + } + return fast_share_server_response_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* SharingLog::mutable_fast_share_server_response() { + ::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* _msg = _internal_mutable_fast_share_server_response(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.fast_share_server_response) + return _msg; +} +inline void SharingLog::set_allocated_fast_share_server_response(::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse* fast_share_server_response) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete fast_share_server_response_; + } + if (fast_share_server_response) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_FastShareServerResponse>::GetOwningArena(fast_share_server_response); + if (message_arena != submessage_arena) { + fast_share_server_response = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, fast_share_server_response, submessage_arena); + } + _has_bits_[0] |= 0x10000000u; + } else { + _has_bits_[0] &= ~0x10000000u; + } + fast_share_server_response_ = fast_share_server_response; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.fast_share_server_response) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendStart send_start = 29; +inline bool SharingLog::_internal_has_send_start() const { + bool value = (_has_bits_[0] & 0x20000000u) != 0; + PROTOBUF_ASSUME(!value || send_start_ != nullptr); + return value; +} +inline bool SharingLog::has_send_start() const { + return _internal_has_send_start(); +} +inline void SharingLog::clear_send_start() { + if (send_start_ != nullptr) send_start_->Clear(); + _has_bits_[0] &= ~0x20000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendStart& SharingLog::_internal_send_start() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendStart* p = send_start_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendStart_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendStart& SharingLog::send_start() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_start) + return _internal_send_start(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_start( + ::nearby::sharing::analytics::proto::SharingLog_SendStart* send_start) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_start_); + } + send_start_ = send_start; + if (send_start) { + _has_bits_[0] |= 0x20000000u; + } else { + _has_bits_[0] &= ~0x20000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_start) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendStart* SharingLog::release_send_start() { + _has_bits_[0] &= ~0x20000000u; + ::nearby::sharing::analytics::proto::SharingLog_SendStart* temp = send_start_; + send_start_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendStart* SharingLog::unsafe_arena_release_send_start() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_start) + _has_bits_[0] &= ~0x20000000u; + ::nearby::sharing::analytics::proto::SharingLog_SendStart* temp = send_start_; + send_start_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendStart* SharingLog::_internal_mutable_send_start() { + _has_bits_[0] |= 0x20000000u; + if (send_start_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendStart>(GetArenaForAllocation()); + send_start_ = p; + } + return send_start_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendStart* SharingLog::mutable_send_start() { + ::nearby::sharing::analytics::proto::SharingLog_SendStart* _msg = _internal_mutable_send_start(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_start) + return _msg; +} +inline void SharingLog::set_allocated_send_start(::nearby::sharing::analytics::proto::SharingLog_SendStart* send_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_start_; + } + if (send_start) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendStart>::GetOwningArena(send_start); + if (message_arena != submessage_arena) { + send_start = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_start, submessage_arena); + } + _has_bits_[0] |= 0x20000000u; + } else { + _has_bits_[0] &= ~0x20000000u; + } + send_start_ = send_start; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_start) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AcceptFastInitialization accept_fast_initialization = 30; +inline bool SharingLog::_internal_has_accept_fast_initialization() const { + bool value = (_has_bits_[0] & 0x40000000u) != 0; + PROTOBUF_ASSUME(!value || accept_fast_initialization_ != nullptr); + return value; +} +inline bool SharingLog::has_accept_fast_initialization() const { + return _internal_has_accept_fast_initialization(); +} +inline void SharingLog::clear_accept_fast_initialization() { + if (accept_fast_initialization_ != nullptr) accept_fast_initialization_->Clear(); + _has_bits_[0] &= ~0x40000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization& SharingLog::_internal_accept_fast_initialization() const { + const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* p = accept_fast_initialization_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AcceptFastInitialization_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization& SharingLog::accept_fast_initialization() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.accept_fast_initialization) + return _internal_accept_fast_initialization(); +} +inline void SharingLog::unsafe_arena_set_allocated_accept_fast_initialization( + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* accept_fast_initialization) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(accept_fast_initialization_); + } + accept_fast_initialization_ = accept_fast_initialization; + if (accept_fast_initialization) { + _has_bits_[0] |= 0x40000000u; + } else { + _has_bits_[0] &= ~0x40000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.accept_fast_initialization) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* SharingLog::release_accept_fast_initialization() { + _has_bits_[0] &= ~0x40000000u; + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* temp = accept_fast_initialization_; + accept_fast_initialization_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* SharingLog::unsafe_arena_release_accept_fast_initialization() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.accept_fast_initialization) + _has_bits_[0] &= ~0x40000000u; + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* temp = accept_fast_initialization_; + accept_fast_initialization_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* SharingLog::_internal_mutable_accept_fast_initialization() { + _has_bits_[0] |= 0x40000000u; + if (accept_fast_initialization_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization>(GetArenaForAllocation()); + accept_fast_initialization_ = p; + } + return accept_fast_initialization_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* SharingLog::mutable_accept_fast_initialization() { + ::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* _msg = _internal_mutable_accept_fast_initialization(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.accept_fast_initialization) + return _msg; +} +inline void SharingLog::set_allocated_accept_fast_initialization(::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization* accept_fast_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete accept_fast_initialization_; + } + if (accept_fast_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AcceptFastInitialization>::GetOwningArena(accept_fast_initialization); + if (message_arena != submessage_arena) { + accept_fast_initialization = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, accept_fast_initialization, submessage_arena); + } + _has_bits_[0] |= 0x40000000u; + } else { + _has_bits_[0] &= ~0x40000000u; + } + accept_fast_initialization_ = accept_fast_initialization; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.accept_fast_initialization) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SetDataUsage set_data_usage = 31; +inline bool SharingLog::_internal_has_set_data_usage() const { + bool value = (_has_bits_[0] & 0x80000000u) != 0; + PROTOBUF_ASSUME(!value || set_data_usage_ != nullptr); + return value; +} +inline bool SharingLog::has_set_data_usage() const { + return _internal_has_set_data_usage(); +} +inline void SharingLog::clear_set_data_usage() { + if (set_data_usage_ != nullptr) set_data_usage_->Clear(); + _has_bits_[0] &= ~0x80000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage& SharingLog::_internal_set_data_usage() const { + const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* p = set_data_usage_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SetDataUsage_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage& SharingLog::set_data_usage() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.set_data_usage) + return _internal_set_data_usage(); +} +inline void SharingLog::unsafe_arena_set_allocated_set_data_usage( + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* set_data_usage) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(set_data_usage_); + } + set_data_usage_ = set_data_usage; + if (set_data_usage) { + _has_bits_[0] |= 0x80000000u; + } else { + _has_bits_[0] &= ~0x80000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_data_usage) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* SharingLog::release_set_data_usage() { + _has_bits_[0] &= ~0x80000000u; + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* temp = set_data_usage_; + set_data_usage_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* SharingLog::unsafe_arena_release_set_data_usage() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.set_data_usage) + _has_bits_[0] &= ~0x80000000u; + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* temp = set_data_usage_; + set_data_usage_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* SharingLog::_internal_mutable_set_data_usage() { + _has_bits_[0] |= 0x80000000u; + if (set_data_usage_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetDataUsage>(GetArenaForAllocation()); + set_data_usage_ = p; + } + return set_data_usage_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* SharingLog::mutable_set_data_usage() { + ::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* _msg = _internal_mutable_set_data_usage(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.set_data_usage) + return _msg; +} +inline void SharingLog::set_allocated_set_data_usage(::nearby::sharing::analytics::proto::SharingLog_SetDataUsage* set_data_usage) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete set_data_usage_; + } + if (set_data_usage) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SetDataUsage>::GetOwningArena(set_data_usage); + if (message_arena != submessage_arena) { + set_data_usage = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, set_data_usage, submessage_arena); + } + _has_bits_[0] |= 0x80000000u; + } else { + _has_bits_[0] &= ~0x80000000u; + } + set_data_usage_ = set_data_usage; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_data_usage) +} + +// optional string version = 32; +inline bool SharingLog::_internal_has_version() const { + bool value = (_has_bits_[0] & 0x00000001u) != 0; + return value; +} +inline bool SharingLog::has_version() const { + return _internal_has_version(); +} +inline void SharingLog::clear_version() { + version_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000001u; +} +inline const std::string& SharingLog::version() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.version) + return _internal_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog::set_version(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000001u; + version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.version) +} +inline std::string* SharingLog::mutable_version() { + std::string* _s = _internal_mutable_version(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.version) + return _s; +} +inline const std::string& SharingLog::_internal_version() const { + return version_.Get(); +} +inline void SharingLog::_internal_set_version(const std::string& value) { + _has_bits_[0] |= 0x00000001u; + version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog::_internal_mutable_version() { + _has_bits_[0] |= 0x00000001u; + return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog::release_version() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.version) + if (!_internal_has_version()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000001u; + auto* p = version_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog::set_allocated_version(std::string* version) { + if (version != nullptr) { + _has_bits_[0] |= 0x00000001u; + } else { + _has_bits_[0] &= ~0x00000001u; + } + version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.version) +} + +// optional .location.nearby.proto.sharing.EventCategory event_category = 33; +inline bool SharingLog::_internal_has_event_category() const { + bool value = (_has_bits_[2] & 0x00000200u) != 0; + return value; +} +inline bool SharingLog::has_event_category() const { + return _internal_has_event_category(); +} +inline void SharingLog::clear_event_category() { + event_category_ = 0; + _has_bits_[2] &= ~0x00000200u; +} +inline ::location::nearby::proto::sharing::EventCategory SharingLog::_internal_event_category() const { + return static_cast< ::location::nearby::proto::sharing::EventCategory >(event_category_); +} +inline ::location::nearby::proto::sharing::EventCategory SharingLog::event_category() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.event_category) + return _internal_event_category(); +} +inline void SharingLog::_internal_set_event_category(::location::nearby::proto::sharing::EventCategory value) { + assert(::location::nearby::proto::sharing::EventCategory_IsValid(value)); + _has_bits_[2] |= 0x00000200u; + event_category_ = value; +} +inline void SharingLog::set_event_category(::location::nearby::proto::sharing::EventCategory value) { + _internal_set_event_category(value); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.event_category) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DismissFastInitialization dismiss_fast_initialization = 34; +inline bool SharingLog::_internal_has_dismiss_fast_initialization() const { + bool value = (_has_bits_[1] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || dismiss_fast_initialization_ != nullptr); + return value; +} +inline bool SharingLog::has_dismiss_fast_initialization() const { + return _internal_has_dismiss_fast_initialization(); +} +inline void SharingLog::clear_dismiss_fast_initialization() { + if (dismiss_fast_initialization_ != nullptr) dismiss_fast_initialization_->Clear(); + _has_bits_[1] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization& SharingLog::_internal_dismiss_fast_initialization() const { + const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* p = dismiss_fast_initialization_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DismissFastInitialization_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization& SharingLog::dismiss_fast_initialization() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.dismiss_fast_initialization) + return _internal_dismiss_fast_initialization(); +} +inline void SharingLog::unsafe_arena_set_allocated_dismiss_fast_initialization( + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* dismiss_fast_initialization) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dismiss_fast_initialization_); + } + dismiss_fast_initialization_ = dismiss_fast_initialization; + if (dismiss_fast_initialization) { + _has_bits_[1] |= 0x00000001u; + } else { + _has_bits_[1] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.dismiss_fast_initialization) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* SharingLog::release_dismiss_fast_initialization() { + _has_bits_[1] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* temp = dismiss_fast_initialization_; + dismiss_fast_initialization_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* SharingLog::unsafe_arena_release_dismiss_fast_initialization() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.dismiss_fast_initialization) + _has_bits_[1] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* temp = dismiss_fast_initialization_; + dismiss_fast_initialization_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* SharingLog::_internal_mutable_dismiss_fast_initialization() { + _has_bits_[1] |= 0x00000001u; + if (dismiss_fast_initialization_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization>(GetArenaForAllocation()); + dismiss_fast_initialization_ = p; + } + return dismiss_fast_initialization_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* SharingLog::mutable_dismiss_fast_initialization() { + ::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* _msg = _internal_mutable_dismiss_fast_initialization(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.dismiss_fast_initialization) + return _msg; +} +inline void SharingLog::set_allocated_dismiss_fast_initialization(::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization* dismiss_fast_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete dismiss_fast_initialization_; + } + if (dismiss_fast_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DismissFastInitialization>::GetOwningArena(dismiss_fast_initialization); + if (message_arena != submessage_arena) { + dismiss_fast_initialization = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, dismiss_fast_initialization, submessage_arena); + } + _has_bits_[1] |= 0x00000001u; + } else { + _has_bits_[1] &= ~0x00000001u; + } + dismiss_fast_initialization_ = dismiss_fast_initialization; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.dismiss_fast_initialization) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.CancelConnection cancel_connection = 35; +inline bool SharingLog::_internal_has_cancel_connection() const { + bool value = (_has_bits_[1] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || cancel_connection_ != nullptr); + return value; +} +inline bool SharingLog::has_cancel_connection() const { + return _internal_has_cancel_connection(); +} +inline void SharingLog::clear_cancel_connection() { + if (cancel_connection_ != nullptr) cancel_connection_->Clear(); + _has_bits_[1] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection& SharingLog::_internal_cancel_connection() const { + const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* p = cancel_connection_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_CancelConnection_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_CancelConnection& SharingLog::cancel_connection() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.cancel_connection) + return _internal_cancel_connection(); +} +inline void SharingLog::unsafe_arena_set_allocated_cancel_connection( + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* cancel_connection) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(cancel_connection_); + } + cancel_connection_ = cancel_connection; + if (cancel_connection) { + _has_bits_[1] |= 0x00000002u; + } else { + _has_bits_[1] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.cancel_connection) +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* SharingLog::release_cancel_connection() { + _has_bits_[1] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* temp = cancel_connection_; + cancel_connection_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* SharingLog::unsafe_arena_release_cancel_connection() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.cancel_connection) + _has_bits_[1] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* temp = cancel_connection_; + cancel_connection_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* SharingLog::_internal_mutable_cancel_connection() { + _has_bits_[1] |= 0x00000002u; + if (cancel_connection_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_CancelConnection>(GetArenaForAllocation()); + cancel_connection_ = p; + } + return cancel_connection_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* SharingLog::mutable_cancel_connection() { + ::nearby::sharing::analytics::proto::SharingLog_CancelConnection* _msg = _internal_mutable_cancel_connection(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.cancel_connection) + return _msg; +} +inline void SharingLog::set_allocated_cancel_connection(::nearby::sharing::analytics::proto::SharingLog_CancelConnection* cancel_connection) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete cancel_connection_; + } + if (cancel_connection) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_CancelConnection>::GetOwningArena(cancel_connection); + if (message_arena != submessage_arena) { + cancel_connection = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, cancel_connection, submessage_arena); + } + _has_bits_[1] |= 0x00000002u; + } else { + _has_bits_[1] &= ~0x00000002u; + } + cancel_connection_ = cancel_connection; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.cancel_connection) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DismissPrivacyNotification dismiss_privacy_notification = 36; +inline bool SharingLog::_internal_has_dismiss_privacy_notification() const { + bool value = (_has_bits_[1] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || dismiss_privacy_notification_ != nullptr); + return value; +} +inline bool SharingLog::has_dismiss_privacy_notification() const { + return _internal_has_dismiss_privacy_notification(); +} +inline void SharingLog::clear_dismiss_privacy_notification() { + if (dismiss_privacy_notification_ != nullptr) dismiss_privacy_notification_->Clear(); + _has_bits_[1] &= ~0x00000004u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification& SharingLog::_internal_dismiss_privacy_notification() const { + const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* p = dismiss_privacy_notification_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DismissPrivacyNotification_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification& SharingLog::dismiss_privacy_notification() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.dismiss_privacy_notification) + return _internal_dismiss_privacy_notification(); +} +inline void SharingLog::unsafe_arena_set_allocated_dismiss_privacy_notification( + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* dismiss_privacy_notification) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(dismiss_privacy_notification_); + } + dismiss_privacy_notification_ = dismiss_privacy_notification; + if (dismiss_privacy_notification) { + _has_bits_[1] |= 0x00000004u; + } else { + _has_bits_[1] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.dismiss_privacy_notification) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* SharingLog::release_dismiss_privacy_notification() { + _has_bits_[1] &= ~0x00000004u; + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* temp = dismiss_privacy_notification_; + dismiss_privacy_notification_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* SharingLog::unsafe_arena_release_dismiss_privacy_notification() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.dismiss_privacy_notification) + _has_bits_[1] &= ~0x00000004u; + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* temp = dismiss_privacy_notification_; + dismiss_privacy_notification_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* SharingLog::_internal_mutable_dismiss_privacy_notification() { + _has_bits_[1] |= 0x00000004u; + if (dismiss_privacy_notification_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification>(GetArenaForAllocation()); + dismiss_privacy_notification_ = p; + } + return dismiss_privacy_notification_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* SharingLog::mutable_dismiss_privacy_notification() { + ::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* _msg = _internal_mutable_dismiss_privacy_notification(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.dismiss_privacy_notification) + return _msg; +} +inline void SharingLog::set_allocated_dismiss_privacy_notification(::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification* dismiss_privacy_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete dismiss_privacy_notification_; + } + if (dismiss_privacy_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DismissPrivacyNotification>::GetOwningArena(dismiss_privacy_notification); + if (message_arena != submessage_arena) { + dismiss_privacy_notification = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, dismiss_privacy_notification, submessage_arena); + } + _has_bits_[1] |= 0x00000004u; + } else { + _has_bits_[1] &= ~0x00000004u; + } + dismiss_privacy_notification_ = dismiss_privacy_notification; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.dismiss_privacy_notification) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.TapPrivacyNotification tap_privacy_notification = 37; +inline bool SharingLog::_internal_has_tap_privacy_notification() const { + bool value = (_has_bits_[1] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || tap_privacy_notification_ != nullptr); + return value; +} +inline bool SharingLog::has_tap_privacy_notification() const { + return _internal_has_tap_privacy_notification(); +} +inline void SharingLog::clear_tap_privacy_notification() { + if (tap_privacy_notification_ != nullptr) tap_privacy_notification_->Clear(); + _has_bits_[1] &= ~0x00000008u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification& SharingLog::_internal_tap_privacy_notification() const { + const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* p = tap_privacy_notification_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_TapPrivacyNotification_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification& SharingLog::tap_privacy_notification() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.tap_privacy_notification) + return _internal_tap_privacy_notification(); +} +inline void SharingLog::unsafe_arena_set_allocated_tap_privacy_notification( + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* tap_privacy_notification) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tap_privacy_notification_); + } + tap_privacy_notification_ = tap_privacy_notification; + if (tap_privacy_notification) { + _has_bits_[1] |= 0x00000008u; + } else { + _has_bits_[1] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_privacy_notification) +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* SharingLog::release_tap_privacy_notification() { + _has_bits_[1] &= ~0x00000008u; + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* temp = tap_privacy_notification_; + tap_privacy_notification_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* SharingLog::unsafe_arena_release_tap_privacy_notification() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.tap_privacy_notification) + _has_bits_[1] &= ~0x00000008u; + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* temp = tap_privacy_notification_; + tap_privacy_notification_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* SharingLog::_internal_mutable_tap_privacy_notification() { + _has_bits_[1] |= 0x00000008u; + if (tap_privacy_notification_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification>(GetArenaForAllocation()); + tap_privacy_notification_ = p; + } + return tap_privacy_notification_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* SharingLog::mutable_tap_privacy_notification() { + ::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* _msg = _internal_mutable_tap_privacy_notification(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.tap_privacy_notification) + return _msg; +} +inline void SharingLog::set_allocated_tap_privacy_notification(::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification* tap_privacy_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete tap_privacy_notification_; + } + if (tap_privacy_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_TapPrivacyNotification>::GetOwningArena(tap_privacy_notification); + if (message_arena != submessage_arena) { + tap_privacy_notification = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tap_privacy_notification, submessage_arena); + } + _has_bits_[1] |= 0x00000008u; + } else { + _has_bits_[1] &= ~0x00000008u; + } + tap_privacy_notification_ = tap_privacy_notification; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_privacy_notification) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.TapHelp tap_help = 38; +inline bool SharingLog::_internal_has_tap_help() const { + bool value = (_has_bits_[1] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || tap_help_ != nullptr); + return value; +} +inline bool SharingLog::has_tap_help() const { + return _internal_has_tap_help(); +} +inline void SharingLog::clear_tap_help() { + if (tap_help_ != nullptr) tap_help_->Clear(); + _has_bits_[1] &= ~0x00000010u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapHelp& SharingLog::_internal_tap_help() const { + const ::nearby::sharing::analytics::proto::SharingLog_TapHelp* p = tap_help_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_TapHelp_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapHelp& SharingLog::tap_help() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.tap_help) + return _internal_tap_help(); +} +inline void SharingLog::unsafe_arena_set_allocated_tap_help( + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* tap_help) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tap_help_); + } + tap_help_ = tap_help; + if (tap_help) { + _has_bits_[1] |= 0x00000010u; + } else { + _has_bits_[1] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_help) +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapHelp* SharingLog::release_tap_help() { + _has_bits_[1] &= ~0x00000010u; + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* temp = tap_help_; + tap_help_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapHelp* SharingLog::unsafe_arena_release_tap_help() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.tap_help) + _has_bits_[1] &= ~0x00000010u; + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* temp = tap_help_; + tap_help_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapHelp* SharingLog::_internal_mutable_tap_help() { + _has_bits_[1] |= 0x00000010u; + if (tap_help_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapHelp>(GetArenaForAllocation()); + tap_help_ = p; + } + return tap_help_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapHelp* SharingLog::mutable_tap_help() { + ::nearby::sharing::analytics::proto::SharingLog_TapHelp* _msg = _internal_mutable_tap_help(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.tap_help) + return _msg; +} +inline void SharingLog::set_allocated_tap_help(::nearby::sharing::analytics::proto::SharingLog_TapHelp* tap_help) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete tap_help_; + } + if (tap_help) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_TapHelp>::GetOwningArena(tap_help); + if (message_arena != submessage_arena) { + tap_help = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tap_help, submessage_arena); + } + _has_bits_[1] |= 0x00000010u; + } else { + _has_bits_[1] &= ~0x00000010u; + } + tap_help_ = tap_help; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_help) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.TapFeedback tap_feedback = 39; +inline bool SharingLog::_internal_has_tap_feedback() const { + bool value = (_has_bits_[1] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || tap_feedback_ != nullptr); + return value; +} +inline bool SharingLog::has_tap_feedback() const { + return _internal_has_tap_feedback(); +} +inline void SharingLog::clear_tap_feedback() { + if (tap_feedback_ != nullptr) tap_feedback_->Clear(); + _has_bits_[1] &= ~0x00000020u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback& SharingLog::_internal_tap_feedback() const { + const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* p = tap_feedback_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_TapFeedback_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapFeedback& SharingLog::tap_feedback() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.tap_feedback) + return _internal_tap_feedback(); +} +inline void SharingLog::unsafe_arena_set_allocated_tap_feedback( + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* tap_feedback) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tap_feedback_); + } + tap_feedback_ = tap_feedback; + if (tap_feedback) { + _has_bits_[1] |= 0x00000020u; + } else { + _has_bits_[1] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_feedback) +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* SharingLog::release_tap_feedback() { + _has_bits_[1] &= ~0x00000020u; + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* temp = tap_feedback_; + tap_feedback_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* SharingLog::unsafe_arena_release_tap_feedback() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.tap_feedback) + _has_bits_[1] &= ~0x00000020u; + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* temp = tap_feedback_; + tap_feedback_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* SharingLog::_internal_mutable_tap_feedback() { + _has_bits_[1] |= 0x00000020u; + if (tap_feedback_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapFeedback>(GetArenaForAllocation()); + tap_feedback_ = p; + } + return tap_feedback_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* SharingLog::mutable_tap_feedback() { + ::nearby::sharing::analytics::proto::SharingLog_TapFeedback* _msg = _internal_mutable_tap_feedback(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.tap_feedback) + return _msg; +} +inline void SharingLog::set_allocated_tap_feedback(::nearby::sharing::analytics::proto::SharingLog_TapFeedback* tap_feedback) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete tap_feedback_; + } + if (tap_feedback) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_TapFeedback>::GetOwningArena(tap_feedback); + if (message_arena != submessage_arena) { + tap_feedback = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tap_feedback, submessage_arena); + } + _has_bits_[1] |= 0x00000020u; + } else { + _has_bits_[1] &= ~0x00000020u; + } + tap_feedback_ = tap_feedback; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_feedback) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AddQuickSettingsTile add_quick_settings_tile = 40; +inline bool SharingLog::_internal_has_add_quick_settings_tile() const { + bool value = (_has_bits_[1] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || add_quick_settings_tile_ != nullptr); + return value; +} +inline bool SharingLog::has_add_quick_settings_tile() const { + return _internal_has_add_quick_settings_tile(); +} +inline void SharingLog::clear_add_quick_settings_tile() { + if (add_quick_settings_tile_ != nullptr) add_quick_settings_tile_->Clear(); + _has_bits_[1] &= ~0x00000040u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile& SharingLog::_internal_add_quick_settings_tile() const { + const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* p = add_quick_settings_tile_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AddQuickSettingsTile_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile& SharingLog::add_quick_settings_tile() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.add_quick_settings_tile) + return _internal_add_quick_settings_tile(); +} +inline void SharingLog::unsafe_arena_set_allocated_add_quick_settings_tile( + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* add_quick_settings_tile) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(add_quick_settings_tile_); + } + add_quick_settings_tile_ = add_quick_settings_tile; + if (add_quick_settings_tile) { + _has_bits_[1] |= 0x00000040u; + } else { + _has_bits_[1] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.add_quick_settings_tile) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* SharingLog::release_add_quick_settings_tile() { + _has_bits_[1] &= ~0x00000040u; + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* temp = add_quick_settings_tile_; + add_quick_settings_tile_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* SharingLog::unsafe_arena_release_add_quick_settings_tile() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.add_quick_settings_tile) + _has_bits_[1] &= ~0x00000040u; + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* temp = add_quick_settings_tile_; + add_quick_settings_tile_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* SharingLog::_internal_mutable_add_quick_settings_tile() { + _has_bits_[1] |= 0x00000040u; + if (add_quick_settings_tile_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile>(GetArenaForAllocation()); + add_quick_settings_tile_ = p; + } + return add_quick_settings_tile_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* SharingLog::mutable_add_quick_settings_tile() { + ::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* _msg = _internal_mutable_add_quick_settings_tile(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.add_quick_settings_tile) + return _msg; +} +inline void SharingLog::set_allocated_add_quick_settings_tile(::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile* add_quick_settings_tile) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete add_quick_settings_tile_; + } + if (add_quick_settings_tile) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AddQuickSettingsTile>::GetOwningArena(add_quick_settings_tile); + if (message_arena != submessage_arena) { + add_quick_settings_tile = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, add_quick_settings_tile, submessage_arena); + } + _has_bits_[1] |= 0x00000040u; + } else { + _has_bits_[1] &= ~0x00000040u; + } + add_quick_settings_tile_ = add_quick_settings_tile; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.add_quick_settings_tile) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.RemoveQuickSettingsTile remove_quick_settings_tile = 41; +inline bool SharingLog::_internal_has_remove_quick_settings_tile() const { + bool value = (_has_bits_[1] & 0x00000080u) != 0; + PROTOBUF_ASSUME(!value || remove_quick_settings_tile_ != nullptr); + return value; +} +inline bool SharingLog::has_remove_quick_settings_tile() const { + return _internal_has_remove_quick_settings_tile(); +} +inline void SharingLog::clear_remove_quick_settings_tile() { + if (remove_quick_settings_tile_ != nullptr) remove_quick_settings_tile_->Clear(); + _has_bits_[1] &= ~0x00000080u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile& SharingLog::_internal_remove_quick_settings_tile() const { + const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* p = remove_quick_settings_tile_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_RemoveQuickSettingsTile_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile& SharingLog::remove_quick_settings_tile() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.remove_quick_settings_tile) + return _internal_remove_quick_settings_tile(); +} +inline void SharingLog::unsafe_arena_set_allocated_remove_quick_settings_tile( + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* remove_quick_settings_tile) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(remove_quick_settings_tile_); + } + remove_quick_settings_tile_ = remove_quick_settings_tile; + if (remove_quick_settings_tile) { + _has_bits_[1] |= 0x00000080u; + } else { + _has_bits_[1] &= ~0x00000080u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.remove_quick_settings_tile) +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* SharingLog::release_remove_quick_settings_tile() { + _has_bits_[1] &= ~0x00000080u; + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* temp = remove_quick_settings_tile_; + remove_quick_settings_tile_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* SharingLog::unsafe_arena_release_remove_quick_settings_tile() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.remove_quick_settings_tile) + _has_bits_[1] &= ~0x00000080u; + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* temp = remove_quick_settings_tile_; + remove_quick_settings_tile_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* SharingLog::_internal_mutable_remove_quick_settings_tile() { + _has_bits_[1] |= 0x00000080u; + if (remove_quick_settings_tile_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile>(GetArenaForAllocation()); + remove_quick_settings_tile_ = p; + } + return remove_quick_settings_tile_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* SharingLog::mutable_remove_quick_settings_tile() { + ::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* _msg = _internal_mutable_remove_quick_settings_tile(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.remove_quick_settings_tile) + return _msg; +} +inline void SharingLog::set_allocated_remove_quick_settings_tile(::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile* remove_quick_settings_tile) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete remove_quick_settings_tile_; + } + if (remove_quick_settings_tile) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_RemoveQuickSettingsTile>::GetOwningArena(remove_quick_settings_tile); + if (message_arena != submessage_arena) { + remove_quick_settings_tile = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, remove_quick_settings_tile, submessage_arena); + } + _has_bits_[1] |= 0x00000080u; + } else { + _has_bits_[1] &= ~0x00000080u; + } + remove_quick_settings_tile_ = remove_quick_settings_tile; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.remove_quick_settings_tile) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.LaunchPhoneConsent launch_phone_consent = 42; +inline bool SharingLog::_internal_has_launch_phone_consent() const { + bool value = (_has_bits_[1] & 0x00000100u) != 0; + PROTOBUF_ASSUME(!value || launch_phone_consent_ != nullptr); + return value; +} +inline bool SharingLog::has_launch_phone_consent() const { + return _internal_has_launch_phone_consent(); +} +inline void SharingLog::clear_launch_phone_consent() { + if (launch_phone_consent_ != nullptr) launch_phone_consent_->Clear(); + _has_bits_[1] &= ~0x00000100u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent& SharingLog::_internal_launch_phone_consent() const { + const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* p = launch_phone_consent_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_LaunchPhoneConsent_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent& SharingLog::launch_phone_consent() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.launch_phone_consent) + return _internal_launch_phone_consent(); +} +inline void SharingLog::unsafe_arena_set_allocated_launch_phone_consent( + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* launch_phone_consent) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(launch_phone_consent_); + } + launch_phone_consent_ = launch_phone_consent; + if (launch_phone_consent) { + _has_bits_[1] |= 0x00000100u; + } else { + _has_bits_[1] &= ~0x00000100u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.launch_phone_consent) +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* SharingLog::release_launch_phone_consent() { + _has_bits_[1] &= ~0x00000100u; + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* temp = launch_phone_consent_; + launch_phone_consent_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* SharingLog::unsafe_arena_release_launch_phone_consent() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.launch_phone_consent) + _has_bits_[1] &= ~0x00000100u; + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* temp = launch_phone_consent_; + launch_phone_consent_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* SharingLog::_internal_mutable_launch_phone_consent() { + _has_bits_[1] |= 0x00000100u; + if (launch_phone_consent_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent>(GetArenaForAllocation()); + launch_phone_consent_ = p; + } + return launch_phone_consent_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* SharingLog::mutable_launch_phone_consent() { + ::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* _msg = _internal_mutable_launch_phone_consent(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.launch_phone_consent) + return _msg; +} +inline void SharingLog::set_allocated_launch_phone_consent(::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent* launch_phone_consent) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete launch_phone_consent_; + } + if (launch_phone_consent) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_LaunchPhoneConsent>::GetOwningArena(launch_phone_consent); + if (message_arena != submessage_arena) { + launch_phone_consent = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, launch_phone_consent, submessage_arena); + } + _has_bits_[1] |= 0x00000100u; + } else { + _has_bits_[1] &= ~0x00000100u; + } + launch_phone_consent_ = launch_phone_consent; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.launch_phone_consent) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsTile tap_quick_settings_tile = 43; +inline bool SharingLog::_internal_has_tap_quick_settings_tile() const { + bool value = (_has_bits_[1] & 0x00000200u) != 0; + PROTOBUF_ASSUME(!value || tap_quick_settings_tile_ != nullptr); + return value; +} +inline bool SharingLog::has_tap_quick_settings_tile() const { + return _internal_has_tap_quick_settings_tile(); +} +inline void SharingLog::clear_tap_quick_settings_tile() { + if (tap_quick_settings_tile_ != nullptr) tap_quick_settings_tile_->Clear(); + _has_bits_[1] &= ~0x00000200u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile& SharingLog::_internal_tap_quick_settings_tile() const { + const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* p = tap_quick_settings_tile_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_TapQuickSettingsTile_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile& SharingLog::tap_quick_settings_tile() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_tile) + return _internal_tap_quick_settings_tile(); +} +inline void SharingLog::unsafe_arena_set_allocated_tap_quick_settings_tile( + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* tap_quick_settings_tile) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tap_quick_settings_tile_); + } + tap_quick_settings_tile_ = tap_quick_settings_tile; + if (tap_quick_settings_tile) { + _has_bits_[1] |= 0x00000200u; + } else { + _has_bits_[1] &= ~0x00000200u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_tile) +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* SharingLog::release_tap_quick_settings_tile() { + _has_bits_[1] &= ~0x00000200u; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* temp = tap_quick_settings_tile_; + tap_quick_settings_tile_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* SharingLog::unsafe_arena_release_tap_quick_settings_tile() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_tile) + _has_bits_[1] &= ~0x00000200u; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* temp = tap_quick_settings_tile_; + tap_quick_settings_tile_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* SharingLog::_internal_mutable_tap_quick_settings_tile() { + _has_bits_[1] |= 0x00000200u; + if (tap_quick_settings_tile_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile>(GetArenaForAllocation()); + tap_quick_settings_tile_ = p; + } + return tap_quick_settings_tile_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* SharingLog::mutable_tap_quick_settings_tile() { + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* _msg = _internal_mutable_tap_quick_settings_tile(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_tile) + return _msg; +} +inline void SharingLog::set_allocated_tap_quick_settings_tile(::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile* tap_quick_settings_tile) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete tap_quick_settings_tile_; + } + if (tap_quick_settings_tile) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsTile>::GetOwningArena(tap_quick_settings_tile); + if (message_arena != submessage_arena) { + tap_quick_settings_tile = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tap_quick_settings_tile, submessage_arena); + } + _has_bits_[1] |= 0x00000200u; + } else { + _has_bits_[1] &= ~0x00000200u; + } + tap_quick_settings_tile_ = tap_quick_settings_tile; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_tile) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.InstallAPKStatus install_apk_status = 44; +inline bool SharingLog::_internal_has_install_apk_status() const { + bool value = (_has_bits_[1] & 0x00000400u) != 0; + PROTOBUF_ASSUME(!value || install_apk_status_ != nullptr); + return value; +} +inline bool SharingLog::has_install_apk_status() const { + return _internal_has_install_apk_status(); +} +inline void SharingLog::clear_install_apk_status() { + if (install_apk_status_ != nullptr) install_apk_status_->Clear(); + _has_bits_[1] &= ~0x00000400u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus& SharingLog::_internal_install_apk_status() const { + const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* p = install_apk_status_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_InstallAPKStatus_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus& SharingLog::install_apk_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.install_apk_status) + return _internal_install_apk_status(); +} +inline void SharingLog::unsafe_arena_set_allocated_install_apk_status( + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* install_apk_status) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(install_apk_status_); + } + install_apk_status_ = install_apk_status; + if (install_apk_status) { + _has_bits_[1] |= 0x00000400u; + } else { + _has_bits_[1] &= ~0x00000400u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.install_apk_status) +} +inline ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* SharingLog::release_install_apk_status() { + _has_bits_[1] &= ~0x00000400u; + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* temp = install_apk_status_; + install_apk_status_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* SharingLog::unsafe_arena_release_install_apk_status() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.install_apk_status) + _has_bits_[1] &= ~0x00000400u; + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* temp = install_apk_status_; + install_apk_status_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* SharingLog::_internal_mutable_install_apk_status() { + _has_bits_[1] |= 0x00000400u; + if (install_apk_status_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus>(GetArenaForAllocation()); + install_apk_status_ = p; + } + return install_apk_status_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* SharingLog::mutable_install_apk_status() { + ::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* _msg = _internal_mutable_install_apk_status(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.install_apk_status) + return _msg; +} +inline void SharingLog::set_allocated_install_apk_status(::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus* install_apk_status) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete install_apk_status_; + } + if (install_apk_status) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_InstallAPKStatus>::GetOwningArena(install_apk_status); + if (message_arena != submessage_arena) { + install_apk_status = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, install_apk_status, submessage_arena); + } + _has_bits_[1] |= 0x00000400u; + } else { + _has_bits_[1] &= ~0x00000400u; + } + install_apk_status_ = install_apk_status; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.install_apk_status) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.VerifyAPKStatus verify_apk_status = 45; +inline bool SharingLog::_internal_has_verify_apk_status() const { + bool value = (_has_bits_[1] & 0x00000800u) != 0; + PROTOBUF_ASSUME(!value || verify_apk_status_ != nullptr); + return value; +} +inline bool SharingLog::has_verify_apk_status() const { + return _internal_has_verify_apk_status(); +} +inline void SharingLog::clear_verify_apk_status() { + if (verify_apk_status_ != nullptr) verify_apk_status_->Clear(); + _has_bits_[1] &= ~0x00000800u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus& SharingLog::_internal_verify_apk_status() const { + const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* p = verify_apk_status_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_VerifyAPKStatus_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus& SharingLog::verify_apk_status() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.verify_apk_status) + return _internal_verify_apk_status(); +} +inline void SharingLog::unsafe_arena_set_allocated_verify_apk_status( + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* verify_apk_status) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(verify_apk_status_); + } + verify_apk_status_ = verify_apk_status; + if (verify_apk_status) { + _has_bits_[1] |= 0x00000800u; + } else { + _has_bits_[1] &= ~0x00000800u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.verify_apk_status) +} +inline ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* SharingLog::release_verify_apk_status() { + _has_bits_[1] &= ~0x00000800u; + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* temp = verify_apk_status_; + verify_apk_status_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* SharingLog::unsafe_arena_release_verify_apk_status() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.verify_apk_status) + _has_bits_[1] &= ~0x00000800u; + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* temp = verify_apk_status_; + verify_apk_status_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* SharingLog::_internal_mutable_verify_apk_status() { + _has_bits_[1] |= 0x00000800u; + if (verify_apk_status_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus>(GetArenaForAllocation()); + verify_apk_status_ = p; + } + return verify_apk_status_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* SharingLog::mutable_verify_apk_status() { + ::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* _msg = _internal_mutable_verify_apk_status(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.verify_apk_status) + return _msg; +} +inline void SharingLog::set_allocated_verify_apk_status(::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus* verify_apk_status) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete verify_apk_status_; + } + if (verify_apk_status) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_VerifyAPKStatus>::GetOwningArena(verify_apk_status); + if (message_arena != submessage_arena) { + verify_apk_status = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, verify_apk_status, submessage_arena); + } + _has_bits_[1] |= 0x00000800u; + } else { + _has_bits_[1] &= ~0x00000800u; + } + verify_apk_status_ = verify_apk_status; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.verify_apk_status) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.LaunchConsent launch_consent = 46; +inline bool SharingLog::_internal_has_launch_consent() const { + bool value = (_has_bits_[1] & 0x00001000u) != 0; + PROTOBUF_ASSUME(!value || launch_consent_ != nullptr); + return value; +} +inline bool SharingLog::has_launch_consent() const { + return _internal_has_launch_consent(); +} +inline void SharingLog::clear_launch_consent() { + if (launch_consent_ != nullptr) launch_consent_->Clear(); + _has_bits_[1] &= ~0x00001000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent& SharingLog::_internal_launch_consent() const { + const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* p = launch_consent_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_LaunchConsent_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent& SharingLog::launch_consent() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.launch_consent) + return _internal_launch_consent(); +} +inline void SharingLog::unsafe_arena_set_allocated_launch_consent( + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* launch_consent) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(launch_consent_); + } + launch_consent_ = launch_consent; + if (launch_consent) { + _has_bits_[1] |= 0x00001000u; + } else { + _has_bits_[1] &= ~0x00001000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.launch_consent) +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* SharingLog::release_launch_consent() { + _has_bits_[1] &= ~0x00001000u; + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* temp = launch_consent_; + launch_consent_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* SharingLog::unsafe_arena_release_launch_consent() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.launch_consent) + _has_bits_[1] &= ~0x00001000u; + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* temp = launch_consent_; + launch_consent_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* SharingLog::_internal_mutable_launch_consent() { + _has_bits_[1] |= 0x00001000u; + if (launch_consent_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_LaunchConsent>(GetArenaForAllocation()); + launch_consent_ = p; + } + return launch_consent_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* SharingLog::mutable_launch_consent() { + ::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* _msg = _internal_mutable_launch_consent(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.launch_consent) + return _msg; +} +inline void SharingLog::set_allocated_launch_consent(::nearby::sharing::analytics::proto::SharingLog_LaunchConsent* launch_consent) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete launch_consent_; + } + if (launch_consent) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_LaunchConsent>::GetOwningArena(launch_consent); + if (message_arena != submessage_arena) { + launch_consent = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, launch_consent, submessage_arena); + } + _has_bits_[1] |= 0x00001000u; + } else { + _has_bits_[1] &= ~0x00001000u; + } + launch_consent_ = launch_consent; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.launch_consent) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ProcessReceivedAttachmentsEnd process_received_attachments_end = 47; +inline bool SharingLog::_internal_has_process_received_attachments_end() const { + bool value = (_has_bits_[1] & 0x00002000u) != 0; + PROTOBUF_ASSUME(!value || process_received_attachments_end_ != nullptr); + return value; +} +inline bool SharingLog::has_process_received_attachments_end() const { + return _internal_has_process_received_attachments_end(); +} +inline void SharingLog::clear_process_received_attachments_end() { + if (process_received_attachments_end_ != nullptr) process_received_attachments_end_->Clear(); + _has_bits_[1] &= ~0x00002000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd& SharingLog::_internal_process_received_attachments_end() const { + const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* p = process_received_attachments_end_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ProcessReceivedAttachmentsEnd_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd& SharingLog::process_received_attachments_end() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.process_received_attachments_end) + return _internal_process_received_attachments_end(); +} +inline void SharingLog::unsafe_arena_set_allocated_process_received_attachments_end( + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* process_received_attachments_end) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(process_received_attachments_end_); + } + process_received_attachments_end_ = process_received_attachments_end; + if (process_received_attachments_end) { + _has_bits_[1] |= 0x00002000u; + } else { + _has_bits_[1] &= ~0x00002000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.process_received_attachments_end) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* SharingLog::release_process_received_attachments_end() { + _has_bits_[1] &= ~0x00002000u; + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* temp = process_received_attachments_end_; + process_received_attachments_end_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* SharingLog::unsafe_arena_release_process_received_attachments_end() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.process_received_attachments_end) + _has_bits_[1] &= ~0x00002000u; + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* temp = process_received_attachments_end_; + process_received_attachments_end_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* SharingLog::_internal_mutable_process_received_attachments_end() { + _has_bits_[1] |= 0x00002000u; + if (process_received_attachments_end_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd>(GetArenaForAllocation()); + process_received_attachments_end_ = p; + } + return process_received_attachments_end_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* SharingLog::mutable_process_received_attachments_end() { + ::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* _msg = _internal_mutable_process_received_attachments_end(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.process_received_attachments_end) + return _msg; +} +inline void SharingLog::set_allocated_process_received_attachments_end(::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd* process_received_attachments_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete process_received_attachments_end_; + } + if (process_received_attachments_end) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ProcessReceivedAttachmentsEnd>::GetOwningArena(process_received_attachments_end); + if (message_arena != submessage_arena) { + process_received_attachments_end = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, process_received_attachments_end, submessage_arena); + } + _has_bits_[1] |= 0x00002000u; + } else { + _has_bits_[1] &= ~0x00002000u; + } + process_received_attachments_end_ = process_received_attachments_end; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.process_received_attachments_end) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ToggleShowNotification toggle_show_notification = 48; +inline bool SharingLog::_internal_has_toggle_show_notification() const { + bool value = (_has_bits_[1] & 0x00004000u) != 0; + PROTOBUF_ASSUME(!value || toggle_show_notification_ != nullptr); + return value; +} +inline bool SharingLog::has_toggle_show_notification() const { + return _internal_has_toggle_show_notification(); +} +inline void SharingLog::clear_toggle_show_notification() { + if (toggle_show_notification_ != nullptr) toggle_show_notification_->Clear(); + _has_bits_[1] &= ~0x00004000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification& SharingLog::_internal_toggle_show_notification() const { + const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* p = toggle_show_notification_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ToggleShowNotification_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification& SharingLog::toggle_show_notification() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.toggle_show_notification) + return _internal_toggle_show_notification(); +} +inline void SharingLog::unsafe_arena_set_allocated_toggle_show_notification( + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* toggle_show_notification) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(toggle_show_notification_); + } + toggle_show_notification_ = toggle_show_notification; + if (toggle_show_notification) { + _has_bits_[1] |= 0x00004000u; + } else { + _has_bits_[1] &= ~0x00004000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.toggle_show_notification) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* SharingLog::release_toggle_show_notification() { + _has_bits_[1] &= ~0x00004000u; + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* temp = toggle_show_notification_; + toggle_show_notification_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* SharingLog::unsafe_arena_release_toggle_show_notification() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.toggle_show_notification) + _has_bits_[1] &= ~0x00004000u; + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* temp = toggle_show_notification_; + toggle_show_notification_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* SharingLog::_internal_mutable_toggle_show_notification() { + _has_bits_[1] |= 0x00004000u; + if (toggle_show_notification_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification>(GetArenaForAllocation()); + toggle_show_notification_ = p; + } + return toggle_show_notification_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* SharingLog::mutable_toggle_show_notification() { + ::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* _msg = _internal_mutable_toggle_show_notification(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.toggle_show_notification) + return _msg; +} +inline void SharingLog::set_allocated_toggle_show_notification(::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification* toggle_show_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete toggle_show_notification_; + } + if (toggle_show_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ToggleShowNotification>::GetOwningArena(toggle_show_notification); + if (message_arena != submessage_arena) { + toggle_show_notification = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, toggle_show_notification, submessage_arena); + } + _has_bits_[1] |= 0x00004000u; + } else { + _has_bits_[1] &= ~0x00004000u; + } + toggle_show_notification_ = toggle_show_notification; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.toggle_show_notification) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SetDeviceName set_device_name = 49; +inline bool SharingLog::_internal_has_set_device_name() const { + bool value = (_has_bits_[1] & 0x00008000u) != 0; + PROTOBUF_ASSUME(!value || set_device_name_ != nullptr); + return value; +} +inline bool SharingLog::has_set_device_name() const { + return _internal_has_set_device_name(); +} +inline void SharingLog::clear_set_device_name() { + if (set_device_name_ != nullptr) set_device_name_->Clear(); + _has_bits_[1] &= ~0x00008000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName& SharingLog::_internal_set_device_name() const { + const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* p = set_device_name_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SetDeviceName_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName& SharingLog::set_device_name() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.set_device_name) + return _internal_set_device_name(); +} +inline void SharingLog::unsafe_arena_set_allocated_set_device_name( + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* set_device_name) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(set_device_name_); + } + set_device_name_ = set_device_name; + if (set_device_name) { + _has_bits_[1] |= 0x00008000u; + } else { + _has_bits_[1] &= ~0x00008000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_device_name) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* SharingLog::release_set_device_name() { + _has_bits_[1] &= ~0x00008000u; + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* temp = set_device_name_; + set_device_name_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* SharingLog::unsafe_arena_release_set_device_name() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.set_device_name) + _has_bits_[1] &= ~0x00008000u; + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* temp = set_device_name_; + set_device_name_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* SharingLog::_internal_mutable_set_device_name() { + _has_bits_[1] |= 0x00008000u; + if (set_device_name_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetDeviceName>(GetArenaForAllocation()); + set_device_name_ = p; + } + return set_device_name_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* SharingLog::mutable_set_device_name() { + ::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* _msg = _internal_mutable_set_device_name(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.set_device_name) + return _msg; +} +inline void SharingLog::set_allocated_set_device_name(::nearby::sharing::analytics::proto::SharingLog_SetDeviceName* set_device_name) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete set_device_name_; + } + if (set_device_name) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SetDeviceName>::GetOwningArena(set_device_name); + if (message_arena != submessage_arena) { + set_device_name = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, set_device_name, submessage_arena); + } + _has_bits_[1] |= 0x00008000u; + } else { + _has_bits_[1] &= ~0x00008000u; + } + set_device_name_ = set_device_name; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_device_name) +} + +// optional string files_migration_phase = 50; +inline bool SharingLog::_internal_has_files_migration_phase() const { + bool value = (_has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool SharingLog::has_files_migration_phase() const { + return _internal_has_files_migration_phase(); +} +inline void SharingLog::clear_files_migration_phase() { + files_migration_phase_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000002u; +} +inline const std::string& SharingLog::files_migration_phase() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.files_migration_phase) + return _internal_files_migration_phase(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog::set_files_migration_phase(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000002u; + files_migration_phase_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.files_migration_phase) +} +inline std::string* SharingLog::mutable_files_migration_phase() { + std::string* _s = _internal_mutable_files_migration_phase(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.files_migration_phase) + return _s; +} +inline const std::string& SharingLog::_internal_files_migration_phase() const { + return files_migration_phase_.Get(); +} +inline void SharingLog::_internal_set_files_migration_phase(const std::string& value) { + _has_bits_[0] |= 0x00000002u; + files_migration_phase_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog::_internal_mutable_files_migration_phase() { + _has_bits_[0] |= 0x00000002u; + return files_migration_phase_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog::release_files_migration_phase() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.files_migration_phase) + if (!_internal_has_files_migration_phase()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000002u; + auto* p = files_migration_phase_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (files_migration_phase_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + files_migration_phase_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog::set_allocated_files_migration_phase(std::string* files_migration_phase) { + if (files_migration_phase != nullptr) { + _has_bits_[0] |= 0x00000002u; + } else { + _has_bits_[0] &= ~0x00000002u; + } + files_migration_phase_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), files_migration_phase, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (files_migration_phase_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + files_migration_phase_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.files_migration_phase) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DeclineAgreements decline_agreements = 51; +inline bool SharingLog::_internal_has_decline_agreements() const { + bool value = (_has_bits_[1] & 0x00010000u) != 0; + PROTOBUF_ASSUME(!value || decline_agreements_ != nullptr); + return value; +} +inline bool SharingLog::has_decline_agreements() const { + return _internal_has_decline_agreements(); +} +inline void SharingLog::clear_decline_agreements() { + if (decline_agreements_ != nullptr) decline_agreements_->Clear(); + _has_bits_[1] &= ~0x00010000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements& SharingLog::_internal_decline_agreements() const { + const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* p = decline_agreements_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DeclineAgreements_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements& SharingLog::decline_agreements() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.decline_agreements) + return _internal_decline_agreements(); +} +inline void SharingLog::unsafe_arena_set_allocated_decline_agreements( + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* decline_agreements) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(decline_agreements_); + } + decline_agreements_ = decline_agreements; + if (decline_agreements) { + _has_bits_[1] |= 0x00010000u; + } else { + _has_bits_[1] &= ~0x00010000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.decline_agreements) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* SharingLog::release_decline_agreements() { + _has_bits_[1] &= ~0x00010000u; + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* temp = decline_agreements_; + decline_agreements_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* SharingLog::unsafe_arena_release_decline_agreements() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.decline_agreements) + _has_bits_[1] &= ~0x00010000u; + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* temp = decline_agreements_; + decline_agreements_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* SharingLog::_internal_mutable_decline_agreements() { + _has_bits_[1] |= 0x00010000u; + if (decline_agreements_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements>(GetArenaForAllocation()); + decline_agreements_ = p; + } + return decline_agreements_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* SharingLog::mutable_decline_agreements() { + ::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* _msg = _internal_mutable_decline_agreements(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.decline_agreements) + return _msg; +} +inline void SharingLog::set_allocated_decline_agreements(::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements* decline_agreements) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete decline_agreements_; + } + if (decline_agreements) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DeclineAgreements>::GetOwningArena(decline_agreements); + if (message_arena != submessage_arena) { + decline_agreements = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, decline_agreements, submessage_arena); + } + _has_bits_[1] |= 0x00010000u; + } else { + _has_bits_[1] &= ~0x00010000u; + } + decline_agreements_ = decline_agreements; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.decline_agreements) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.RequestSettingPermissions request_setting_permissions = 52; +inline bool SharingLog::_internal_has_request_setting_permissions() const { + bool value = (_has_bits_[1] & 0x00020000u) != 0; + PROTOBUF_ASSUME(!value || request_setting_permissions_ != nullptr); + return value; +} +inline bool SharingLog::has_request_setting_permissions() const { + return _internal_has_request_setting_permissions(); +} +inline void SharingLog::clear_request_setting_permissions() { + if (request_setting_permissions_ != nullptr) request_setting_permissions_->Clear(); + _has_bits_[1] &= ~0x00020000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions& SharingLog::_internal_request_setting_permissions() const { + const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* p = request_setting_permissions_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_RequestSettingPermissions_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions& SharingLog::request_setting_permissions() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.request_setting_permissions) + return _internal_request_setting_permissions(); +} +inline void SharingLog::unsafe_arena_set_allocated_request_setting_permissions( + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* request_setting_permissions) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(request_setting_permissions_); + } + request_setting_permissions_ = request_setting_permissions; + if (request_setting_permissions) { + _has_bits_[1] |= 0x00020000u; + } else { + _has_bits_[1] &= ~0x00020000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.request_setting_permissions) +} +inline ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* SharingLog::release_request_setting_permissions() { + _has_bits_[1] &= ~0x00020000u; + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* temp = request_setting_permissions_; + request_setting_permissions_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* SharingLog::unsafe_arena_release_request_setting_permissions() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.request_setting_permissions) + _has_bits_[1] &= ~0x00020000u; + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* temp = request_setting_permissions_; + request_setting_permissions_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* SharingLog::_internal_mutable_request_setting_permissions() { + _has_bits_[1] |= 0x00020000u; + if (request_setting_permissions_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions>(GetArenaForAllocation()); + request_setting_permissions_ = p; + } + return request_setting_permissions_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* SharingLog::mutable_request_setting_permissions() { + ::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* _msg = _internal_mutable_request_setting_permissions(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.request_setting_permissions) + return _msg; +} +inline void SharingLog::set_allocated_request_setting_permissions(::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions* request_setting_permissions) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete request_setting_permissions_; + } + if (request_setting_permissions) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_RequestSettingPermissions>::GetOwningArena(request_setting_permissions); + if (message_arena != submessage_arena) { + request_setting_permissions = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, request_setting_permissions, submessage_arena); + } + _has_bits_[1] |= 0x00020000u; + } else { + _has_bits_[1] &= ~0x00020000u; + } + request_setting_permissions_ = request_setting_permissions; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.request_setting_permissions) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DeviceSettings device_settings = 53; +inline bool SharingLog::_internal_has_device_settings() const { + bool value = (_has_bits_[1] & 0x00040000u) != 0; + PROTOBUF_ASSUME(!value || device_settings_ != nullptr); + return value; +} +inline bool SharingLog::has_device_settings() const { + return _internal_has_device_settings(); +} +inline void SharingLog::clear_device_settings() { + if (device_settings_ != nullptr) device_settings_->Clear(); + _has_bits_[1] &= ~0x00040000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings& SharingLog::_internal_device_settings() const { + const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* p = device_settings_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DeviceSettings_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings& SharingLog::device_settings() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.device_settings) + return _internal_device_settings(); +} +inline void SharingLog::unsafe_arena_set_allocated_device_settings( + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* device_settings) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(device_settings_); + } + device_settings_ = device_settings; + if (device_settings) { + _has_bits_[1] |= 0x00040000u; + } else { + _has_bits_[1] &= ~0x00040000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.device_settings) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* SharingLog::release_device_settings() { + _has_bits_[1] &= ~0x00040000u; + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* temp = device_settings_; + device_settings_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* SharingLog::unsafe_arena_release_device_settings() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.device_settings) + _has_bits_[1] &= ~0x00040000u; + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* temp = device_settings_; + device_settings_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* SharingLog::_internal_mutable_device_settings() { + _has_bits_[1] |= 0x00040000u; + if (device_settings_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DeviceSettings>(GetArenaForAllocation()); + device_settings_ = p; + } + return device_settings_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* SharingLog::mutable_device_settings() { + ::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* _msg = _internal_mutable_device_settings(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.device_settings) + return _msg; +} +inline void SharingLog::set_allocated_device_settings(::nearby::sharing::analytics::proto::SharingLog_DeviceSettings* device_settings) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete device_settings_; + } + if (device_settings) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DeviceSettings>::GetOwningArena(device_settings); + if (message_arena != submessage_arena) { + device_settings = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, device_settings, submessage_arena); + } + _has_bits_[1] |= 0x00040000u; + } else { + _has_bits_[1] &= ~0x00040000u; + } + device_settings_ = device_settings; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.device_settings) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.EstablishConnection establish_connection = 54; +inline bool SharingLog::_internal_has_establish_connection() const { + bool value = (_has_bits_[1] & 0x00080000u) != 0; + PROTOBUF_ASSUME(!value || establish_connection_ != nullptr); + return value; +} +inline bool SharingLog::has_establish_connection() const { + return _internal_has_establish_connection(); +} +inline void SharingLog::clear_establish_connection() { + if (establish_connection_ != nullptr) establish_connection_->Clear(); + _has_bits_[1] &= ~0x00080000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection& SharingLog::_internal_establish_connection() const { + const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* p = establish_connection_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_EstablishConnection_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection& SharingLog::establish_connection() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.establish_connection) + return _internal_establish_connection(); +} +inline void SharingLog::unsafe_arena_set_allocated_establish_connection( + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* establish_connection) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(establish_connection_); + } + establish_connection_ = establish_connection; + if (establish_connection) { + _has_bits_[1] |= 0x00080000u; + } else { + _has_bits_[1] &= ~0x00080000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.establish_connection) +} +inline ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* SharingLog::release_establish_connection() { + _has_bits_[1] &= ~0x00080000u; + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* temp = establish_connection_; + establish_connection_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* SharingLog::unsafe_arena_release_establish_connection() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.establish_connection) + _has_bits_[1] &= ~0x00080000u; + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* temp = establish_connection_; + establish_connection_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* SharingLog::_internal_mutable_establish_connection() { + _has_bits_[1] |= 0x00080000u; + if (establish_connection_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_EstablishConnection>(GetArenaForAllocation()); + establish_connection_ = p; + } + return establish_connection_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* SharingLog::mutable_establish_connection() { + ::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* _msg = _internal_mutable_establish_connection(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.establish_connection) + return _msg; +} +inline void SharingLog::set_allocated_establish_connection(::nearby::sharing::analytics::proto::SharingLog_EstablishConnection* establish_connection) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete establish_connection_; + } + if (establish_connection) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_EstablishConnection>::GetOwningArena(establish_connection); + if (message_arena != submessage_arena) { + establish_connection = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, establish_connection, submessage_arena); + } + _has_bits_[1] |= 0x00080000u; + } else { + _has_bits_[1] &= ~0x00080000u; + } + establish_connection_ = establish_connection; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.establish_connection) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AutoDismissFastInitialization auto_dismiss_fast_initialization = 55; +inline bool SharingLog::_internal_has_auto_dismiss_fast_initialization() const { + bool value = (_has_bits_[1] & 0x00100000u) != 0; + PROTOBUF_ASSUME(!value || auto_dismiss_fast_initialization_ != nullptr); + return value; +} +inline bool SharingLog::has_auto_dismiss_fast_initialization() const { + return _internal_has_auto_dismiss_fast_initialization(); +} +inline void SharingLog::clear_auto_dismiss_fast_initialization() { + if (auto_dismiss_fast_initialization_ != nullptr) auto_dismiss_fast_initialization_->Clear(); + _has_bits_[1] &= ~0x00100000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization& SharingLog::_internal_auto_dismiss_fast_initialization() const { + const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* p = auto_dismiss_fast_initialization_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AutoDismissFastInitialization_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization& SharingLog::auto_dismiss_fast_initialization() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.auto_dismiss_fast_initialization) + return _internal_auto_dismiss_fast_initialization(); +} +inline void SharingLog::unsafe_arena_set_allocated_auto_dismiss_fast_initialization( + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* auto_dismiss_fast_initialization) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(auto_dismiss_fast_initialization_); + } + auto_dismiss_fast_initialization_ = auto_dismiss_fast_initialization; + if (auto_dismiss_fast_initialization) { + _has_bits_[1] |= 0x00100000u; + } else { + _has_bits_[1] &= ~0x00100000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.auto_dismiss_fast_initialization) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* SharingLog::release_auto_dismiss_fast_initialization() { + _has_bits_[1] &= ~0x00100000u; + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* temp = auto_dismiss_fast_initialization_; + auto_dismiss_fast_initialization_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* SharingLog::unsafe_arena_release_auto_dismiss_fast_initialization() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.auto_dismiss_fast_initialization) + _has_bits_[1] &= ~0x00100000u; + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* temp = auto_dismiss_fast_initialization_; + auto_dismiss_fast_initialization_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* SharingLog::_internal_mutable_auto_dismiss_fast_initialization() { + _has_bits_[1] |= 0x00100000u; + if (auto_dismiss_fast_initialization_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization>(GetArenaForAllocation()); + auto_dismiss_fast_initialization_ = p; + } + return auto_dismiss_fast_initialization_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* SharingLog::mutable_auto_dismiss_fast_initialization() { + ::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* _msg = _internal_mutable_auto_dismiss_fast_initialization(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.auto_dismiss_fast_initialization) + return _msg; +} +inline void SharingLog::set_allocated_auto_dismiss_fast_initialization(::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization* auto_dismiss_fast_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete auto_dismiss_fast_initialization_; + } + if (auto_dismiss_fast_initialization) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AutoDismissFastInitialization>::GetOwningArena(auto_dismiss_fast_initialization); + if (message_arena != submessage_arena) { + auto_dismiss_fast_initialization = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, auto_dismiss_fast_initialization, submessage_arena); + } + _has_bits_[1] |= 0x00100000u; + } else { + _has_bits_[1] &= ~0x00100000u; + } + auto_dismiss_fast_initialization_ = auto_dismiss_fast_initialization; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.auto_dismiss_fast_initialization) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.EventMetadata event_metadata = 56; +inline bool SharingLog::_internal_has_event_metadata() const { + bool value = (_has_bits_[1] & 0x00200000u) != 0; + PROTOBUF_ASSUME(!value || event_metadata_ != nullptr); + return value; +} +inline bool SharingLog::has_event_metadata() const { + return _internal_has_event_metadata(); +} +inline void SharingLog::clear_event_metadata() { + if (event_metadata_ != nullptr) event_metadata_->Clear(); + _has_bits_[1] &= ~0x00200000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata& SharingLog::_internal_event_metadata() const { + const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* p = event_metadata_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_EventMetadata_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_EventMetadata& SharingLog::event_metadata() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.event_metadata) + return _internal_event_metadata(); +} +inline void SharingLog::unsafe_arena_set_allocated_event_metadata( + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* event_metadata) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(event_metadata_); + } + event_metadata_ = event_metadata; + if (event_metadata) { + _has_bits_[1] |= 0x00200000u; + } else { + _has_bits_[1] &= ~0x00200000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.event_metadata) +} +inline ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* SharingLog::release_event_metadata() { + _has_bits_[1] &= ~0x00200000u; + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* temp = event_metadata_; + event_metadata_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* SharingLog::unsafe_arena_release_event_metadata() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.event_metadata) + _has_bits_[1] &= ~0x00200000u; + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* temp = event_metadata_; + event_metadata_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* SharingLog::_internal_mutable_event_metadata() { + _has_bits_[1] |= 0x00200000u; + if (event_metadata_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_EventMetadata>(GetArenaForAllocation()); + event_metadata_ = p; + } + return event_metadata_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* SharingLog::mutable_event_metadata() { + ::nearby::sharing::analytics::proto::SharingLog_EventMetadata* _msg = _internal_mutable_event_metadata(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.event_metadata) + return _msg; +} +inline void SharingLog::set_allocated_event_metadata(::nearby::sharing::analytics::proto::SharingLog_EventMetadata* event_metadata) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete event_metadata_; + } + if (event_metadata) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_EventMetadata>::GetOwningArena(event_metadata); + if (message_arena != submessage_arena) { + event_metadata = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, event_metadata, submessage_arena); + } + _has_bits_[1] |= 0x00200000u; + } else { + _has_bits_[1] &= ~0x00200000u; + } + event_metadata_ = event_metadata; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.event_metadata) +} + +// optional string app_version = 57 [deprecated = true]; +inline bool SharingLog::_internal_has_app_version() const { + bool value = (_has_bits_[0] & 0x00000004u) != 0; + return value; +} +inline bool SharingLog::has_app_version() const { + return _internal_has_app_version(); +} +inline void SharingLog::clear_app_version() { + app_version_.ClearToEmpty(); + _has_bits_[0] &= ~0x00000004u; +} +inline const std::string& SharingLog::app_version() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.app_version) + return _internal_app_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void SharingLog::set_app_version(ArgT0&& arg0, ArgT... args) { + _has_bits_[0] |= 0x00000004u; + app_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:nearby.sharing.analytics.proto.SharingLog.app_version) +} +inline std::string* SharingLog::mutable_app_version() { + std::string* _s = _internal_mutable_app_version(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.app_version) + return _s; +} +inline const std::string& SharingLog::_internal_app_version() const { + return app_version_.Get(); +} +inline void SharingLog::_internal_set_app_version(const std::string& value) { + _has_bits_[0] |= 0x00000004u; + app_version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation()); +} +inline std::string* SharingLog::_internal_mutable_app_version() { + _has_bits_[0] |= 0x00000004u; + return app_version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation()); +} +inline std::string* SharingLog::release_app_version() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.app_version) + if (!_internal_has_app_version()) { + return nullptr; + } + _has_bits_[0] &= ~0x00000004u; + auto* p = app_version_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (app_version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + return p; +} +inline void SharingLog::set_allocated_app_version(std::string* app_version) { + if (app_version != nullptr) { + _has_bits_[0] |= 0x00000004u; + } else { + _has_bits_[0] &= ~0x00000004u; + } + app_version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), app_version, + GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (app_version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) { + app_version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.app_version) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AppCrash app_crash = 58; +inline bool SharingLog::_internal_has_app_crash() const { + bool value = (_has_bits_[1] & 0x00400000u) != 0; + PROTOBUF_ASSUME(!value || app_crash_ != nullptr); + return value; +} +inline bool SharingLog::has_app_crash() const { + return _internal_has_app_crash(); +} +inline void SharingLog::clear_app_crash() { + if (app_crash_ != nullptr) app_crash_->Clear(); + _has_bits_[1] &= ~0x00400000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AppCrash& SharingLog::_internal_app_crash() const { + const ::nearby::sharing::analytics::proto::SharingLog_AppCrash* p = app_crash_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AppCrash_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AppCrash& SharingLog::app_crash() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.app_crash) + return _internal_app_crash(); +} +inline void SharingLog::unsafe_arena_set_allocated_app_crash( + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* app_crash) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(app_crash_); + } + app_crash_ = app_crash; + if (app_crash) { + _has_bits_[1] |= 0x00400000u; + } else { + _has_bits_[1] &= ~0x00400000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.app_crash) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppCrash* SharingLog::release_app_crash() { + _has_bits_[1] &= ~0x00400000u; + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* temp = app_crash_; + app_crash_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppCrash* SharingLog::unsafe_arena_release_app_crash() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.app_crash) + _has_bits_[1] &= ~0x00400000u; + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* temp = app_crash_; + app_crash_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppCrash* SharingLog::_internal_mutable_app_crash() { + _has_bits_[1] |= 0x00400000u; + if (app_crash_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AppCrash>(GetArenaForAllocation()); + app_crash_ = p; + } + return app_crash_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppCrash* SharingLog::mutable_app_crash() { + ::nearby::sharing::analytics::proto::SharingLog_AppCrash* _msg = _internal_mutable_app_crash(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.app_crash) + return _msg; +} +inline void SharingLog::set_allocated_app_crash(::nearby::sharing::analytics::proto::SharingLog_AppCrash* app_crash) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete app_crash_; + } + if (app_crash) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AppCrash>::GetOwningArena(app_crash); + if (message_arena != submessage_arena) { + app_crash = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, app_crash, submessage_arena); + } + _has_bits_[1] |= 0x00400000u; + } else { + _has_bits_[1] &= ~0x00400000u; + } + app_crash_ = app_crash; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.app_crash) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.TapQuickSettingsFileShare tap_quick_settings_file_share = 59; +inline bool SharingLog::_internal_has_tap_quick_settings_file_share() const { + bool value = (_has_bits_[1] & 0x00800000u) != 0; + PROTOBUF_ASSUME(!value || tap_quick_settings_file_share_ != nullptr); + return value; +} +inline bool SharingLog::has_tap_quick_settings_file_share() const { + return _internal_has_tap_quick_settings_file_share(); +} +inline void SharingLog::clear_tap_quick_settings_file_share() { + if (tap_quick_settings_file_share_ != nullptr) tap_quick_settings_file_share_->Clear(); + _has_bits_[1] &= ~0x00800000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare& SharingLog::_internal_tap_quick_settings_file_share() const { + const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* p = tap_quick_settings_file_share_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_TapQuickSettingsFileShare_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare& SharingLog::tap_quick_settings_file_share() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_file_share) + return _internal_tap_quick_settings_file_share(); +} +inline void SharingLog::unsafe_arena_set_allocated_tap_quick_settings_file_share( + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* tap_quick_settings_file_share) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tap_quick_settings_file_share_); + } + tap_quick_settings_file_share_ = tap_quick_settings_file_share; + if (tap_quick_settings_file_share) { + _has_bits_[1] |= 0x00800000u; + } else { + _has_bits_[1] &= ~0x00800000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_file_share) +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* SharingLog::release_tap_quick_settings_file_share() { + _has_bits_[1] &= ~0x00800000u; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* temp = tap_quick_settings_file_share_; + tap_quick_settings_file_share_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* SharingLog::unsafe_arena_release_tap_quick_settings_file_share() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_file_share) + _has_bits_[1] &= ~0x00800000u; + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* temp = tap_quick_settings_file_share_; + tap_quick_settings_file_share_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* SharingLog::_internal_mutable_tap_quick_settings_file_share() { + _has_bits_[1] |= 0x00800000u; + if (tap_quick_settings_file_share_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare>(GetArenaForAllocation()); + tap_quick_settings_file_share_ = p; + } + return tap_quick_settings_file_share_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* SharingLog::mutable_tap_quick_settings_file_share() { + ::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* _msg = _internal_mutable_tap_quick_settings_file_share(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_file_share) + return _msg; +} +inline void SharingLog::set_allocated_tap_quick_settings_file_share(::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare* tap_quick_settings_file_share) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete tap_quick_settings_file_share_; + } + if (tap_quick_settings_file_share) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_TapQuickSettingsFileShare>::GetOwningArena(tap_quick_settings_file_share); + if (message_arena != submessage_arena) { + tap_quick_settings_file_share = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tap_quick_settings_file_share, submessage_arena); + } + _has_bits_[1] |= 0x00800000u; + } else { + _has_bits_[1] &= ~0x00800000u; + } + tap_quick_settings_file_share_ = tap_quick_settings_file_share; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_quick_settings_file_share) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.AppInfo app_info = 60; +inline bool SharingLog::_internal_has_app_info() const { + bool value = (_has_bits_[1] & 0x01000000u) != 0; + PROTOBUF_ASSUME(!value || app_info_ != nullptr); + return value; +} +inline bool SharingLog::has_app_info() const { + return _internal_has_app_info(); +} +inline void SharingLog::clear_app_info() { + if (app_info_ != nullptr) app_info_->Clear(); + _has_bits_[1] &= ~0x01000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AppInfo& SharingLog::_internal_app_info() const { + const ::nearby::sharing::analytics::proto::SharingLog_AppInfo* p = app_info_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_AppInfo_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_AppInfo& SharingLog::app_info() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.app_info) + return _internal_app_info(); +} +inline void SharingLog::unsafe_arena_set_allocated_app_info( + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* app_info) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(app_info_); + } + app_info_ = app_info; + if (app_info) { + _has_bits_[1] |= 0x01000000u; + } else { + _has_bits_[1] &= ~0x01000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.app_info) +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppInfo* SharingLog::release_app_info() { + _has_bits_[1] &= ~0x01000000u; + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* temp = app_info_; + app_info_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppInfo* SharingLog::unsafe_arena_release_app_info() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.app_info) + _has_bits_[1] &= ~0x01000000u; + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* temp = app_info_; + app_info_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppInfo* SharingLog::_internal_mutable_app_info() { + _has_bits_[1] |= 0x01000000u; + if (app_info_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_AppInfo>(GetArenaForAllocation()); + app_info_ = p; + } + return app_info_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_AppInfo* SharingLog::mutable_app_info() { + ::nearby::sharing::analytics::proto::SharingLog_AppInfo* _msg = _internal_mutable_app_info(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.app_info) + return _msg; +} +inline void SharingLog::set_allocated_app_info(::nearby::sharing::analytics::proto::SharingLog_AppInfo* app_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete app_info_; + } + if (app_info) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_AppInfo>::GetOwningArena(app_info); + if (message_arena != submessage_arena) { + app_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, app_info, submessage_arena); + } + _has_bits_[1] |= 0x01000000u; + } else { + _has_bits_[1] &= ~0x01000000u; + } + app_info_ = app_info; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.app_info) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DisplayPrivacyNotification display_privacy_notification = 61; +inline bool SharingLog::_internal_has_display_privacy_notification() const { + bool value = (_has_bits_[1] & 0x02000000u) != 0; + PROTOBUF_ASSUME(!value || display_privacy_notification_ != nullptr); + return value; +} +inline bool SharingLog::has_display_privacy_notification() const { + return _internal_has_display_privacy_notification(); +} +inline void SharingLog::clear_display_privacy_notification() { + if (display_privacy_notification_ != nullptr) display_privacy_notification_->Clear(); + _has_bits_[1] &= ~0x02000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification& SharingLog::_internal_display_privacy_notification() const { + const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* p = display_privacy_notification_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DisplayPrivacyNotification_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification& SharingLog::display_privacy_notification() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.display_privacy_notification) + return _internal_display_privacy_notification(); +} +inline void SharingLog::unsafe_arena_set_allocated_display_privacy_notification( + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* display_privacy_notification) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(display_privacy_notification_); + } + display_privacy_notification_ = display_privacy_notification; + if (display_privacy_notification) { + _has_bits_[1] |= 0x02000000u; + } else { + _has_bits_[1] &= ~0x02000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.display_privacy_notification) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* SharingLog::release_display_privacy_notification() { + _has_bits_[1] &= ~0x02000000u; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* temp = display_privacy_notification_; + display_privacy_notification_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* SharingLog::unsafe_arena_release_display_privacy_notification() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.display_privacy_notification) + _has_bits_[1] &= ~0x02000000u; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* temp = display_privacy_notification_; + display_privacy_notification_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* SharingLog::_internal_mutable_display_privacy_notification() { + _has_bits_[1] |= 0x02000000u; + if (display_privacy_notification_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification>(GetArenaForAllocation()); + display_privacy_notification_ = p; + } + return display_privacy_notification_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* SharingLog::mutable_display_privacy_notification() { + ::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* _msg = _internal_mutable_display_privacy_notification(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.display_privacy_notification) + return _msg; +} +inline void SharingLog::set_allocated_display_privacy_notification(::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification* display_privacy_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete display_privacy_notification_; + } + if (display_privacy_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DisplayPrivacyNotification>::GetOwningArena(display_privacy_notification); + if (message_arena != submessage_arena) { + display_privacy_notification = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, display_privacy_notification, submessage_arena); + } + _has_bits_[1] |= 0x02000000u; + } else { + _has_bits_[1] &= ~0x02000000u; + } + display_privacy_notification_ = display_privacy_notification; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.display_privacy_notification) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DisplayPhoneConsent display_phone_consent = 62; +inline bool SharingLog::_internal_has_display_phone_consent() const { + bool value = (_has_bits_[1] & 0x04000000u) != 0; + PROTOBUF_ASSUME(!value || display_phone_consent_ != nullptr); + return value; +} +inline bool SharingLog::has_display_phone_consent() const { + return _internal_has_display_phone_consent(); +} +inline void SharingLog::clear_display_phone_consent() { + if (display_phone_consent_ != nullptr) display_phone_consent_->Clear(); + _has_bits_[1] &= ~0x04000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent& SharingLog::_internal_display_phone_consent() const { + const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* p = display_phone_consent_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DisplayPhoneConsent_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent& SharingLog::display_phone_consent() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.display_phone_consent) + return _internal_display_phone_consent(); +} +inline void SharingLog::unsafe_arena_set_allocated_display_phone_consent( + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* display_phone_consent) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(display_phone_consent_); + } + display_phone_consent_ = display_phone_consent; + if (display_phone_consent) { + _has_bits_[1] |= 0x04000000u; + } else { + _has_bits_[1] &= ~0x04000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.display_phone_consent) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* SharingLog::release_display_phone_consent() { + _has_bits_[1] &= ~0x04000000u; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* temp = display_phone_consent_; + display_phone_consent_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* SharingLog::unsafe_arena_release_display_phone_consent() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.display_phone_consent) + _has_bits_[1] &= ~0x04000000u; + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* temp = display_phone_consent_; + display_phone_consent_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* SharingLog::_internal_mutable_display_phone_consent() { + _has_bits_[1] |= 0x04000000u; + if (display_phone_consent_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent>(GetArenaForAllocation()); + display_phone_consent_ = p; + } + return display_phone_consent_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* SharingLog::mutable_display_phone_consent() { + ::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* _msg = _internal_mutable_display_phone_consent(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.display_phone_consent) + return _msg; +} +inline void SharingLog::set_allocated_display_phone_consent(::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent* display_phone_consent) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete display_phone_consent_; + } + if (display_phone_consent) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DisplayPhoneConsent>::GetOwningArena(display_phone_consent); + if (message_arena != submessage_arena) { + display_phone_consent = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, display_phone_consent, submessage_arena); + } + _has_bits_[1] |= 0x04000000u; + } else { + _has_bits_[1] &= ~0x04000000u; + } + display_phone_consent_ = display_phone_consent; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.display_phone_consent) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.PreferencesUsage preferences_usage = 63; +inline bool SharingLog::_internal_has_preferences_usage() const { + bool value = (_has_bits_[1] & 0x08000000u) != 0; + PROTOBUF_ASSUME(!value || preferences_usage_ != nullptr); + return value; +} +inline bool SharingLog::has_preferences_usage() const { + return _internal_has_preferences_usage(); +} +inline void SharingLog::clear_preferences_usage() { + if (preferences_usage_ != nullptr) preferences_usage_->Clear(); + _has_bits_[1] &= ~0x08000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage& SharingLog::_internal_preferences_usage() const { + const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* p = preferences_usage_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_PreferencesUsage_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage& SharingLog::preferences_usage() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.preferences_usage) + return _internal_preferences_usage(); +} +inline void SharingLog::unsafe_arena_set_allocated_preferences_usage( + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* preferences_usage) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(preferences_usage_); + } + preferences_usage_ = preferences_usage; + if (preferences_usage) { + _has_bits_[1] |= 0x08000000u; + } else { + _has_bits_[1] &= ~0x08000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.preferences_usage) +} +inline ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* SharingLog::release_preferences_usage() { + _has_bits_[1] &= ~0x08000000u; + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* temp = preferences_usage_; + preferences_usage_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* SharingLog::unsafe_arena_release_preferences_usage() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.preferences_usage) + _has_bits_[1] &= ~0x08000000u; + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* temp = preferences_usage_; + preferences_usage_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* SharingLog::_internal_mutable_preferences_usage() { + _has_bits_[1] |= 0x08000000u; + if (preferences_usage_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage>(GetArenaForAllocation()); + preferences_usage_ = p; + } + return preferences_usage_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* SharingLog::mutable_preferences_usage() { + ::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* _msg = _internal_mutable_preferences_usage(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.preferences_usage) + return _msg; +} +inline void SharingLog::set_allocated_preferences_usage(::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage* preferences_usage) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete preferences_usage_; + } + if (preferences_usage) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_PreferencesUsage>::GetOwningArena(preferences_usage); + if (message_arena != submessage_arena) { + preferences_usage = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, preferences_usage, submessage_arena); + } + _has_bits_[1] |= 0x08000000u; + } else { + _has_bits_[1] &= ~0x08000000u; + } + preferences_usage_ = preferences_usage; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.preferences_usage) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DefaultOptIn default_opt_in = 64; +inline bool SharingLog::_internal_has_default_opt_in() const { + bool value = (_has_bits_[1] & 0x10000000u) != 0; + PROTOBUF_ASSUME(!value || default_opt_in_ != nullptr); + return value; +} +inline bool SharingLog::has_default_opt_in() const { + return _internal_has_default_opt_in(); +} +inline void SharingLog::clear_default_opt_in() { + if (default_opt_in_ != nullptr) default_opt_in_->Clear(); + _has_bits_[1] &= ~0x10000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn& SharingLog::_internal_default_opt_in() const { + const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* p = default_opt_in_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DefaultOptIn_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn& SharingLog::default_opt_in() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.default_opt_in) + return _internal_default_opt_in(); +} +inline void SharingLog::unsafe_arena_set_allocated_default_opt_in( + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* default_opt_in) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(default_opt_in_); + } + default_opt_in_ = default_opt_in; + if (default_opt_in) { + _has_bits_[1] |= 0x10000000u; + } else { + _has_bits_[1] &= ~0x10000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.default_opt_in) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* SharingLog::release_default_opt_in() { + _has_bits_[1] &= ~0x10000000u; + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* temp = default_opt_in_; + default_opt_in_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* SharingLog::unsafe_arena_release_default_opt_in() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.default_opt_in) + _has_bits_[1] &= ~0x10000000u; + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* temp = default_opt_in_; + default_opt_in_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* SharingLog::_internal_mutable_default_opt_in() { + _has_bits_[1] |= 0x10000000u; + if (default_opt_in_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn>(GetArenaForAllocation()); + default_opt_in_ = p; + } + return default_opt_in_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* SharingLog::mutable_default_opt_in() { + ::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* _msg = _internal_mutable_default_opt_in(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.default_opt_in) + return _msg; +} +inline void SharingLog::set_allocated_default_opt_in(::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn* default_opt_in) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete default_opt_in_; + } + if (default_opt_in) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DefaultOptIn>::GetOwningArena(default_opt_in); + if (message_arena != submessage_arena) { + default_opt_in = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, default_opt_in, submessage_arena); + } + _has_bits_[1] |= 0x10000000u; + } else { + _has_bits_[1] &= ~0x10000000u; + } + default_opt_in_ = default_opt_in; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.default_opt_in) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SetupWizard setup_wizard = 65; +inline bool SharingLog::_internal_has_setup_wizard() const { + bool value = (_has_bits_[1] & 0x20000000u) != 0; + PROTOBUF_ASSUME(!value || setup_wizard_ != nullptr); + return value; +} +inline bool SharingLog::has_setup_wizard() const { + return _internal_has_setup_wizard(); +} +inline void SharingLog::clear_setup_wizard() { + if (setup_wizard_ != nullptr) setup_wizard_->Clear(); + _has_bits_[1] &= ~0x20000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard& SharingLog::_internal_setup_wizard() const { + const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* p = setup_wizard_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SetupWizard_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetupWizard& SharingLog::setup_wizard() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.setup_wizard) + return _internal_setup_wizard(); +} +inline void SharingLog::unsafe_arena_set_allocated_setup_wizard( + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* setup_wizard) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(setup_wizard_); + } + setup_wizard_ = setup_wizard; + if (setup_wizard) { + _has_bits_[1] |= 0x20000000u; + } else { + _has_bits_[1] &= ~0x20000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.setup_wizard) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* SharingLog::release_setup_wizard() { + _has_bits_[1] &= ~0x20000000u; + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* temp = setup_wizard_; + setup_wizard_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* SharingLog::unsafe_arena_release_setup_wizard() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.setup_wizard) + _has_bits_[1] &= ~0x20000000u; + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* temp = setup_wizard_; + setup_wizard_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* SharingLog::_internal_mutable_setup_wizard() { + _has_bits_[1] |= 0x20000000u; + if (setup_wizard_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetupWizard>(GetArenaForAllocation()); + setup_wizard_ = p; + } + return setup_wizard_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* SharingLog::mutable_setup_wizard() { + ::nearby::sharing::analytics::proto::SharingLog_SetupWizard* _msg = _internal_mutable_setup_wizard(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.setup_wizard) + return _msg; +} +inline void SharingLog::set_allocated_setup_wizard(::nearby::sharing::analytics::proto::SharingLog_SetupWizard* setup_wizard) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete setup_wizard_; + } + if (setup_wizard) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SetupWizard>::GetOwningArena(setup_wizard); + if (message_arena != submessage_arena) { + setup_wizard = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, setup_wizard, submessage_arena); + } + _has_bits_[1] |= 0x20000000u; + } else { + _has_bits_[1] &= ~0x20000000u; + } + setup_wizard_ = setup_wizard; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.setup_wizard) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.TapQrCode tap_qr_code = 66; +inline bool SharingLog::_internal_has_tap_qr_code() const { + bool value = (_has_bits_[1] & 0x40000000u) != 0; + PROTOBUF_ASSUME(!value || tap_qr_code_ != nullptr); + return value; +} +inline bool SharingLog::has_tap_qr_code() const { + return _internal_has_tap_qr_code(); +} +inline void SharingLog::clear_tap_qr_code() { + if (tap_qr_code_ != nullptr) tap_qr_code_->Clear(); + _has_bits_[1] &= ~0x40000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode& SharingLog::_internal_tap_qr_code() const { + const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* p = tap_qr_code_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_TapQrCode_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_TapQrCode& SharingLog::tap_qr_code() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.tap_qr_code) + return _internal_tap_qr_code(); +} +inline void SharingLog::unsafe_arena_set_allocated_tap_qr_code( + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* tap_qr_code) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(tap_qr_code_); + } + tap_qr_code_ = tap_qr_code; + if (tap_qr_code) { + _has_bits_[1] |= 0x40000000u; + } else { + _has_bits_[1] &= ~0x40000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_qr_code) +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* SharingLog::release_tap_qr_code() { + _has_bits_[1] &= ~0x40000000u; + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* temp = tap_qr_code_; + tap_qr_code_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* SharingLog::unsafe_arena_release_tap_qr_code() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.tap_qr_code) + _has_bits_[1] &= ~0x40000000u; + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* temp = tap_qr_code_; + tap_qr_code_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* SharingLog::_internal_mutable_tap_qr_code() { + _has_bits_[1] |= 0x40000000u; + if (tap_qr_code_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_TapQrCode>(GetArenaForAllocation()); + tap_qr_code_ = p; + } + return tap_qr_code_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* SharingLog::mutable_tap_qr_code() { + ::nearby::sharing::analytics::proto::SharingLog_TapQrCode* _msg = _internal_mutable_tap_qr_code(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.tap_qr_code) + return _msg; +} +inline void SharingLog::set_allocated_tap_qr_code(::nearby::sharing::analytics::proto::SharingLog_TapQrCode* tap_qr_code) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete tap_qr_code_; + } + if (tap_qr_code) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_TapQrCode>::GetOwningArena(tap_qr_code); + if (message_arena != submessage_arena) { + tap_qr_code = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, tap_qr_code, submessage_arena); + } + _has_bits_[1] |= 0x40000000u; + } else { + _has_bits_[1] &= ~0x40000000u; + } + tap_qr_code_ = tap_qr_code; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.tap_qr_code) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.QrCodeLinkShown qr_code_link_shown = 67; +inline bool SharingLog::_internal_has_qr_code_link_shown() const { + bool value = (_has_bits_[1] & 0x80000000u) != 0; + PROTOBUF_ASSUME(!value || qr_code_link_shown_ != nullptr); + return value; +} +inline bool SharingLog::has_qr_code_link_shown() const { + return _internal_has_qr_code_link_shown(); +} +inline void SharingLog::clear_qr_code_link_shown() { + if (qr_code_link_shown_ != nullptr) qr_code_link_shown_->Clear(); + _has_bits_[1] &= ~0x80000000u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown& SharingLog::_internal_qr_code_link_shown() const { + const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* p = qr_code_link_shown_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_QrCodeLinkShown_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown& SharingLog::qr_code_link_shown() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.qr_code_link_shown) + return _internal_qr_code_link_shown(); +} +inline void SharingLog::unsafe_arena_set_allocated_qr_code_link_shown( + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* qr_code_link_shown) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(qr_code_link_shown_); + } + qr_code_link_shown_ = qr_code_link_shown; + if (qr_code_link_shown) { + _has_bits_[1] |= 0x80000000u; + } else { + _has_bits_[1] &= ~0x80000000u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.qr_code_link_shown) +} +inline ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* SharingLog::release_qr_code_link_shown() { + _has_bits_[1] &= ~0x80000000u; + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* temp = qr_code_link_shown_; + qr_code_link_shown_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* SharingLog::unsafe_arena_release_qr_code_link_shown() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.qr_code_link_shown) + _has_bits_[1] &= ~0x80000000u; + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* temp = qr_code_link_shown_; + qr_code_link_shown_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* SharingLog::_internal_mutable_qr_code_link_shown() { + _has_bits_[1] |= 0x80000000u; + if (qr_code_link_shown_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown>(GetArenaForAllocation()); + qr_code_link_shown_ = p; + } + return qr_code_link_shown_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* SharingLog::mutable_qr_code_link_shown() { + ::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* _msg = _internal_mutable_qr_code_link_shown(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.qr_code_link_shown) + return _msg; +} +inline void SharingLog::set_allocated_qr_code_link_shown(::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown* qr_code_link_shown) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete qr_code_link_shown_; + } + if (qr_code_link_shown) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_QrCodeLinkShown>::GetOwningArena(qr_code_link_shown); + if (message_arena != submessage_arena) { + qr_code_link_shown = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, qr_code_link_shown, submessage_arena); + } + _has_bits_[1] |= 0x80000000u; + } else { + _has_bits_[1] &= ~0x80000000u; + } + qr_code_link_shown_ = qr_code_link_shown; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.qr_code_link_shown) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ParsingFailedEndpointId parsing_failed_endpoint_id = 68; +inline bool SharingLog::_internal_has_parsing_failed_endpoint_id() const { + bool value = (_has_bits_[2] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || parsing_failed_endpoint_id_ != nullptr); + return value; +} +inline bool SharingLog::has_parsing_failed_endpoint_id() const { + return _internal_has_parsing_failed_endpoint_id(); +} +inline void SharingLog::clear_parsing_failed_endpoint_id() { + if (parsing_failed_endpoint_id_ != nullptr) parsing_failed_endpoint_id_->Clear(); + _has_bits_[2] &= ~0x00000001u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId& SharingLog::_internal_parsing_failed_endpoint_id() const { + const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* p = parsing_failed_endpoint_id_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ParsingFailedEndpointId_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId& SharingLog::parsing_failed_endpoint_id() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.parsing_failed_endpoint_id) + return _internal_parsing_failed_endpoint_id(); +} +inline void SharingLog::unsafe_arena_set_allocated_parsing_failed_endpoint_id( + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* parsing_failed_endpoint_id) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(parsing_failed_endpoint_id_); + } + parsing_failed_endpoint_id_ = parsing_failed_endpoint_id; + if (parsing_failed_endpoint_id) { + _has_bits_[2] |= 0x00000001u; + } else { + _has_bits_[2] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.parsing_failed_endpoint_id) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* SharingLog::release_parsing_failed_endpoint_id() { + _has_bits_[2] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* temp = parsing_failed_endpoint_id_; + parsing_failed_endpoint_id_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* SharingLog::unsafe_arena_release_parsing_failed_endpoint_id() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.parsing_failed_endpoint_id) + _has_bits_[2] &= ~0x00000001u; + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* temp = parsing_failed_endpoint_id_; + parsing_failed_endpoint_id_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* SharingLog::_internal_mutable_parsing_failed_endpoint_id() { + _has_bits_[2] |= 0x00000001u; + if (parsing_failed_endpoint_id_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId>(GetArenaForAllocation()); + parsing_failed_endpoint_id_ = p; + } + return parsing_failed_endpoint_id_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* SharingLog::mutable_parsing_failed_endpoint_id() { + ::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* _msg = _internal_mutable_parsing_failed_endpoint_id(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.parsing_failed_endpoint_id) + return _msg; +} +inline void SharingLog::set_allocated_parsing_failed_endpoint_id(::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId* parsing_failed_endpoint_id) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete parsing_failed_endpoint_id_; + } + if (parsing_failed_endpoint_id) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ParsingFailedEndpointId>::GetOwningArena(parsing_failed_endpoint_id); + if (message_arena != submessage_arena) { + parsing_failed_endpoint_id = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, parsing_failed_endpoint_id, submessage_arena); + } + _has_bits_[2] |= 0x00000001u; + } else { + _has_bits_[2] &= ~0x00000001u; + } + parsing_failed_endpoint_id_ = parsing_failed_endpoint_id; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.parsing_failed_endpoint_id) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.FastInitDiscoverDevice fast_init_discover_device = 69; +inline bool SharingLog::_internal_has_fast_init_discover_device() const { + bool value = (_has_bits_[2] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || fast_init_discover_device_ != nullptr); + return value; +} +inline bool SharingLog::has_fast_init_discover_device() const { + return _internal_has_fast_init_discover_device(); +} +inline void SharingLog::clear_fast_init_discover_device() { + if (fast_init_discover_device_ != nullptr) fast_init_discover_device_->Clear(); + _has_bits_[2] &= ~0x00000002u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice& SharingLog::_internal_fast_init_discover_device() const { + const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* p = fast_init_discover_device_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_FastInitDiscoverDevice_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice& SharingLog::fast_init_discover_device() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.fast_init_discover_device) + return _internal_fast_init_discover_device(); +} +inline void SharingLog::unsafe_arena_set_allocated_fast_init_discover_device( + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* fast_init_discover_device) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(fast_init_discover_device_); + } + fast_init_discover_device_ = fast_init_discover_device; + if (fast_init_discover_device) { + _has_bits_[2] |= 0x00000002u; + } else { + _has_bits_[2] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.fast_init_discover_device) +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* SharingLog::release_fast_init_discover_device() { + _has_bits_[2] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* temp = fast_init_discover_device_; + fast_init_discover_device_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* SharingLog::unsafe_arena_release_fast_init_discover_device() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.fast_init_discover_device) + _has_bits_[2] &= ~0x00000002u; + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* temp = fast_init_discover_device_; + fast_init_discover_device_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* SharingLog::_internal_mutable_fast_init_discover_device() { + _has_bits_[2] |= 0x00000002u; + if (fast_init_discover_device_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice>(GetArenaForAllocation()); + fast_init_discover_device_ = p; + } + return fast_init_discover_device_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* SharingLog::mutable_fast_init_discover_device() { + ::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* _msg = _internal_mutable_fast_init_discover_device(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.fast_init_discover_device) + return _msg; +} +inline void SharingLog::set_allocated_fast_init_discover_device(::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice* fast_init_discover_device) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete fast_init_discover_device_; + } + if (fast_init_discover_device) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_FastInitDiscoverDevice>::GetOwningArena(fast_init_discover_device); + if (message_arena != submessage_arena) { + fast_init_discover_device = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, fast_init_discover_device, submessage_arena); + } + _has_bits_[2] |= 0x00000002u; + } else { + _has_bits_[2] &= ~0x00000002u; + } + fast_init_discover_device_ = fast_init_discover_device; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.fast_init_discover_device) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopNotification send_desktop_notification = 70; +inline bool SharingLog::_internal_has_send_desktop_notification() const { + bool value = (_has_bits_[2] & 0x00000004u) != 0; + PROTOBUF_ASSUME(!value || send_desktop_notification_ != nullptr); + return value; +} +inline bool SharingLog::has_send_desktop_notification() const { + return _internal_has_send_desktop_notification(); +} +inline void SharingLog::clear_send_desktop_notification() { + if (send_desktop_notification_ != nullptr) send_desktop_notification_->Clear(); + _has_bits_[2] &= ~0x00000004u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification& SharingLog::_internal_send_desktop_notification() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* p = send_desktop_notification_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendDesktopNotification_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification& SharingLog::send_desktop_notification() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_desktop_notification) + return _internal_send_desktop_notification(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_desktop_notification( + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* send_desktop_notification) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_desktop_notification_); + } + send_desktop_notification_ = send_desktop_notification; + if (send_desktop_notification) { + _has_bits_[2] |= 0x00000004u; + } else { + _has_bits_[2] &= ~0x00000004u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_desktop_notification) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* SharingLog::release_send_desktop_notification() { + _has_bits_[2] &= ~0x00000004u; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* temp = send_desktop_notification_; + send_desktop_notification_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* SharingLog::unsafe_arena_release_send_desktop_notification() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_desktop_notification) + _has_bits_[2] &= ~0x00000004u; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* temp = send_desktop_notification_; + send_desktop_notification_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* SharingLog::_internal_mutable_send_desktop_notification() { + _has_bits_[2] |= 0x00000004u; + if (send_desktop_notification_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification>(GetArenaForAllocation()); + send_desktop_notification_ = p; + } + return send_desktop_notification_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* SharingLog::mutable_send_desktop_notification() { + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* _msg = _internal_mutable_send_desktop_notification(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_desktop_notification) + return _msg; +} +inline void SharingLog::set_allocated_send_desktop_notification(::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification* send_desktop_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_desktop_notification_; + } + if (send_desktop_notification) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendDesktopNotification>::GetOwningArena(send_desktop_notification); + if (message_arena != submessage_arena) { + send_desktop_notification = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_desktop_notification, submessage_arena); + } + _has_bits_[2] |= 0x00000004u; + } else { + _has_bits_[2] &= ~0x00000004u; + } + send_desktop_notification_ = send_desktop_notification; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_desktop_notification) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SendDesktopTransferEvent send_desktop_transfer_event = 72; +inline bool SharingLog::_internal_has_send_desktop_transfer_event() const { + bool value = (_has_bits_[2] & 0x00000008u) != 0; + PROTOBUF_ASSUME(!value || send_desktop_transfer_event_ != nullptr); + return value; +} +inline bool SharingLog::has_send_desktop_transfer_event() const { + return _internal_has_send_desktop_transfer_event(); +} +inline void SharingLog::clear_send_desktop_transfer_event() { + if (send_desktop_transfer_event_ != nullptr) send_desktop_transfer_event_->Clear(); + _has_bits_[2] &= ~0x00000008u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent& SharingLog::_internal_send_desktop_transfer_event() const { + const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* p = send_desktop_transfer_event_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SendDesktopTransferEvent_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent& SharingLog::send_desktop_transfer_event() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.send_desktop_transfer_event) + return _internal_send_desktop_transfer_event(); +} +inline void SharingLog::unsafe_arena_set_allocated_send_desktop_transfer_event( + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* send_desktop_transfer_event) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(send_desktop_transfer_event_); + } + send_desktop_transfer_event_ = send_desktop_transfer_event; + if (send_desktop_transfer_event) { + _has_bits_[2] |= 0x00000008u; + } else { + _has_bits_[2] &= ~0x00000008u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_desktop_transfer_event) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* SharingLog::release_send_desktop_transfer_event() { + _has_bits_[2] &= ~0x00000008u; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* temp = send_desktop_transfer_event_; + send_desktop_transfer_event_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* SharingLog::unsafe_arena_release_send_desktop_transfer_event() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.send_desktop_transfer_event) + _has_bits_[2] &= ~0x00000008u; + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* temp = send_desktop_transfer_event_; + send_desktop_transfer_event_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* SharingLog::_internal_mutable_send_desktop_transfer_event() { + _has_bits_[2] |= 0x00000008u; + if (send_desktop_transfer_event_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent>(GetArenaForAllocation()); + send_desktop_transfer_event_ = p; + } + return send_desktop_transfer_event_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* SharingLog::mutable_send_desktop_transfer_event() { + ::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* _msg = _internal_mutable_send_desktop_transfer_event(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.send_desktop_transfer_event) + return _msg; +} +inline void SharingLog::set_allocated_send_desktop_transfer_event(::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent* send_desktop_transfer_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete send_desktop_transfer_event_; + } + if (send_desktop_transfer_event) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SendDesktopTransferEvent>::GetOwningArena(send_desktop_transfer_event); + if (message_arena != submessage_arena) { + send_desktop_transfer_event = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, send_desktop_transfer_event, submessage_arena); + } + _has_bits_[2] |= 0x00000008u; + } else { + _has_bits_[2] &= ~0x00000008u; + } + send_desktop_transfer_event_ = send_desktop_transfer_event; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.send_desktop_transfer_event) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.SetAccount set_account = 73; +inline bool SharingLog::_internal_has_set_account() const { + bool value = (_has_bits_[2] & 0x00000010u) != 0; + PROTOBUF_ASSUME(!value || set_account_ != nullptr); + return value; +} +inline bool SharingLog::has_set_account() const { + return _internal_has_set_account(); +} +inline void SharingLog::clear_set_account() { + if (set_account_ != nullptr) set_account_->Clear(); + _has_bits_[2] &= ~0x00000010u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetAccount& SharingLog::_internal_set_account() const { + const ::nearby::sharing::analytics::proto::SharingLog_SetAccount* p = set_account_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_SetAccount_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_SetAccount& SharingLog::set_account() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.set_account) + return _internal_set_account(); +} +inline void SharingLog::unsafe_arena_set_allocated_set_account( + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* set_account) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(set_account_); + } + set_account_ = set_account; + if (set_account) { + _has_bits_[2] |= 0x00000010u; + } else { + _has_bits_[2] &= ~0x00000010u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_account) +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetAccount* SharingLog::release_set_account() { + _has_bits_[2] &= ~0x00000010u; + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* temp = set_account_; + set_account_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetAccount* SharingLog::unsafe_arena_release_set_account() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.set_account) + _has_bits_[2] &= ~0x00000010u; + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* temp = set_account_; + set_account_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetAccount* SharingLog::_internal_mutable_set_account() { + _has_bits_[2] |= 0x00000010u; + if (set_account_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_SetAccount>(GetArenaForAllocation()); + set_account_ = p; + } + return set_account_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_SetAccount* SharingLog::mutable_set_account() { + ::nearby::sharing::analytics::proto::SharingLog_SetAccount* _msg = _internal_mutable_set_account(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.set_account) + return _msg; +} +inline void SharingLog::set_allocated_set_account(::nearby::sharing::analytics::proto::SharingLog_SetAccount* set_account) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete set_account_; + } + if (set_account) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_SetAccount>::GetOwningArena(set_account); + if (message_arena != submessage_arena) { + set_account = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, set_account, submessage_arena); + } + _has_bits_[2] |= 0x00000010u; + } else { + _has_bits_[2] &= ~0x00000010u; + } + set_account_ = set_account; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.set_account) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.DecryptCertificateFailure decrypt_certificate_failure = 74; +inline bool SharingLog::_internal_has_decrypt_certificate_failure() const { + bool value = (_has_bits_[2] & 0x00000020u) != 0; + PROTOBUF_ASSUME(!value || decrypt_certificate_failure_ != nullptr); + return value; +} +inline bool SharingLog::has_decrypt_certificate_failure() const { + return _internal_has_decrypt_certificate_failure(); +} +inline void SharingLog::clear_decrypt_certificate_failure() { + if (decrypt_certificate_failure_ != nullptr) decrypt_certificate_failure_->Clear(); + _has_bits_[2] &= ~0x00000020u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure& SharingLog::_internal_decrypt_certificate_failure() const { + const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* p = decrypt_certificate_failure_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_DecryptCertificateFailure_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure& SharingLog::decrypt_certificate_failure() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.decrypt_certificate_failure) + return _internal_decrypt_certificate_failure(); +} +inline void SharingLog::unsafe_arena_set_allocated_decrypt_certificate_failure( + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* decrypt_certificate_failure) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(decrypt_certificate_failure_); + } + decrypt_certificate_failure_ = decrypt_certificate_failure; + if (decrypt_certificate_failure) { + _has_bits_[2] |= 0x00000020u; + } else { + _has_bits_[2] &= ~0x00000020u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.decrypt_certificate_failure) +} +inline ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* SharingLog::release_decrypt_certificate_failure() { + _has_bits_[2] &= ~0x00000020u; + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* temp = decrypt_certificate_failure_; + decrypt_certificate_failure_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* SharingLog::unsafe_arena_release_decrypt_certificate_failure() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.decrypt_certificate_failure) + _has_bits_[2] &= ~0x00000020u; + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* temp = decrypt_certificate_failure_; + decrypt_certificate_failure_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* SharingLog::_internal_mutable_decrypt_certificate_failure() { + _has_bits_[2] |= 0x00000020u; + if (decrypt_certificate_failure_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure>(GetArenaForAllocation()); + decrypt_certificate_failure_ = p; + } + return decrypt_certificate_failure_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* SharingLog::mutable_decrypt_certificate_failure() { + ::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* _msg = _internal_mutable_decrypt_certificate_failure(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.decrypt_certificate_failure) + return _msg; +} +inline void SharingLog::set_allocated_decrypt_certificate_failure(::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure* decrypt_certificate_failure) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete decrypt_certificate_failure_; + } + if (decrypt_certificate_failure) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_DecryptCertificateFailure>::GetOwningArena(decrypt_certificate_failure); + if (message_arena != submessage_arena) { + decrypt_certificate_failure = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, decrypt_certificate_failure, submessage_arena); + } + _has_bits_[2] |= 0x00000020u; + } else { + _has_bits_[2] &= ~0x00000020u; + } + decrypt_certificate_failure_ = decrypt_certificate_failure; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.decrypt_certificate_failure) +} + +// optional .nearby.sharing.analytics.proto.SharingLog.ShowAllowPermissionAutoAccess show_allow_permission_auto_access = 75; +inline bool SharingLog::_internal_has_show_allow_permission_auto_access() const { + bool value = (_has_bits_[2] & 0x00000040u) != 0; + PROTOBUF_ASSUME(!value || show_allow_permission_auto_access_ != nullptr); + return value; +} +inline bool SharingLog::has_show_allow_permission_auto_access() const { + return _internal_has_show_allow_permission_auto_access(); +} +inline void SharingLog::clear_show_allow_permission_auto_access() { + if (show_allow_permission_auto_access_ != nullptr) show_allow_permission_auto_access_->Clear(); + _has_bits_[2] &= ~0x00000040u; +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess& SharingLog::_internal_show_allow_permission_auto_access() const { + const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* p = show_allow_permission_auto_access_; + return p != nullptr ? *p : reinterpret_cast( + ::nearby::sharing::analytics::proto::_SharingLog_ShowAllowPermissionAutoAccess_default_instance_); +} +inline const ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess& SharingLog::show_allow_permission_auto_access() const { + // @@protoc_insertion_point(field_get:nearby.sharing.analytics.proto.SharingLog.show_allow_permission_auto_access) + return _internal_show_allow_permission_auto_access(); +} +inline void SharingLog::unsafe_arena_set_allocated_show_allow_permission_auto_access( + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* show_allow_permission_auto_access) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(show_allow_permission_auto_access_); + } + show_allow_permission_auto_access_ = show_allow_permission_auto_access; + if (show_allow_permission_auto_access) { + _has_bits_[2] |= 0x00000040u; + } else { + _has_bits_[2] &= ~0x00000040u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:nearby.sharing.analytics.proto.SharingLog.show_allow_permission_auto_access) +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* SharingLog::release_show_allow_permission_auto_access() { + _has_bits_[2] &= ~0x00000040u; + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* temp = show_allow_permission_auto_access_; + show_allow_permission_auto_access_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* SharingLog::unsafe_arena_release_show_allow_permission_auto_access() { + // @@protoc_insertion_point(field_release:nearby.sharing.analytics.proto.SharingLog.show_allow_permission_auto_access) + _has_bits_[2] &= ~0x00000040u; + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* temp = show_allow_permission_auto_access_; + show_allow_permission_auto_access_ = nullptr; + return temp; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* SharingLog::_internal_mutable_show_allow_permission_auto_access() { + _has_bits_[2] |= 0x00000040u; + if (show_allow_permission_auto_access_ == nullptr) { + auto* p = CreateMaybeMessage<::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess>(GetArenaForAllocation()); + show_allow_permission_auto_access_ = p; + } + return show_allow_permission_auto_access_; +} +inline ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* SharingLog::mutable_show_allow_permission_auto_access() { + ::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* _msg = _internal_mutable_show_allow_permission_auto_access(); + // @@protoc_insertion_point(field_mutable:nearby.sharing.analytics.proto.SharingLog.show_allow_permission_auto_access) + return _msg; +} +inline void SharingLog::set_allocated_show_allow_permission_auto_access(::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess* show_allow_permission_auto_access) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete show_allow_permission_auto_access_; + } + if (show_allow_permission_auto_access) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<::nearby::sharing::analytics::proto::SharingLog_ShowAllowPermissionAutoAccess>::GetOwningArena(show_allow_permission_auto_access); + if (message_arena != submessage_arena) { + show_allow_permission_auto_access = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, show_allow_permission_auto_access, submessage_arena); + } + _has_bits_[2] |= 0x00000040u; + } else { + _has_bits_[2] &= ~0x00000040u; + } + show_allow_permission_auto_access_ = show_allow_permission_auto_access; + // @@protoc_insertion_point(field_set_allocated:nearby.sharing.analytics.proto.SharingLog.show_allow_permission_auto_access) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace proto +} // namespace analytics +} // namespace sharing +} // namespace nearby + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::nearby::sharing::analytics::proto::SharingLog_TextAttachment_Type> : ::std::true_type {}; +template <> struct is_proto_enum< ::nearby::sharing::analytics::proto::SharingLog_FileAttachment_Type> : ::std::true_type {}; + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_sharing_2fproto_2fanalytics_2fnearby_5fsharing_5flog_2eproto diff --git a/connections/BUILD b/connections/BUILD index a8f9d09d..90cc11f3 100644 --- a/connections/BUILD +++ b/connections/BUILD @@ -23,10 +23,10 @@ cc_library( ], copts = ["-DCORE_ADAPTER_DLL"], visibility = [ + "//chrome/chromeos/assistant/data_migration/lib:__pkg__", "//connections:__subpackages__", - "//location/nearby/cpp/sharing:__subpackages__", "//location/nearby/testing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ ":core_types", @@ -69,17 +69,19 @@ cc_library( ], copts = ["-DCORE_ADAPTER_DLL"], visibility = [ + "//chrome/chromeos/assistant/data_migration/lib:__pkg__", "//connections:__subpackages__", - "//location/nearby/cpp/sharing:__subpackages__", "//location/nearby/testing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ + "//internal/interop:authentication_status", "//internal/platform:base", "//internal/platform:types", "//internal/platform:util", "//proto:connections_enums_cc_proto", "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/random", "@com_google_absl//absl/types:variant", ], ) diff --git a/connections/README.md b/connections/README.md index 95c8c2ba..e32ca9bd 100644 --- a/connections/README.md +++ b/connections/README.md @@ -1,10 +1,10 @@ # Nearby Connection -Nearby Connections is a high level protocol on top of Bluetooth/WiFi that acts +Nearby Connections is a high level protocol on top of Bluetooth/Wi-Fi that acts as a medium-agnostic socket. Devices are able to advertise, scan, and connect with one another over any shared medium (eg. BT <-> BT). Once connected, the two devices share a list of all supported mediums and -attempt to upgrade to the one with the highest bandwidth (eg. BT -> WiFi). +attempt to upgrade to the one with the highest bandwidth (eg. BT -> Wi-Fi). The connection is encrypted, reliable, and fully duplex. BYTE, FILE, and STREAM payloads are all supported and will be chunked & transferred internally and recombined on the receiving device. @@ -27,7 +27,7 @@ We support multiple platforms including Linux, iOS & Windows. > **NOTE:** Linux has no mediums implemented. -Currently we support building from source using [bazel] (https://bazel.build). Other BUILD system such as cmake may be added later. +Currently we support building from source using [bazel](https://bazel.build). Other BUILD system such as cmake may be added later. ### Prerequisites: @@ -59,3 +59,96 @@ To build the Nearby Connection library: ```shell swift build ``` + +# Supported Mediums + + + + + + + + + + + + + + + + + + + + + +
Legend
  • [x]
Supported.
  • [ ]
Support is possible, but not implemented.
Support is not possible or does not make sense.
+ + +## Android +| Mediums | Advertising | Scanning | Data | +| :---------------- | :--------------------: | :--------------------: | :--------------------: | +| Bluetooth Classic |
  • [x]
|
  • [x]
|
  • [x]
| +| BLE (Fast) |
  • [x]
|
  • [x]
| | +| BLE (GATT) |
  • [x]
|
  • [x]
|
  • [x]
| +| BLE (Extended) |
  • [x]
|
  • [x]
| | +| BLE (L2CAP) | | |
  • [x]
| +| Wi-Fi LAN |
  • [x]
|
  • [x]
|
  • [x]
| +| Wi-Fi Hotspot | | |
  • [x]
| +| Wi-Fi Direct | | |
  • [x]
| +| Wi-Fi Aware |
  • [x]
|
  • [x]
|
  • [x]
| +| WebRTC | | |
  • [x]
| +| NFC |
  • [x]
|
  • [x]
|
  • [x]
| +| USB |
  • [x]
|
  • [x]
|
  • [x]
| +| AWDL | | | | + +## ChromeOS +| Mediums | Advertising | Scanning | Data | +| :---------------- | :--------------------: | :--------------------: | :--------------------: | +| Bluetooth Classic |
  • [x]
|
  • [x]
|
  • [x]
| +| BLE (Fast) |
  • [x]
|
  • [x]
| | +| BLE (GATT) |
  • [ ]
|
  • [ ]
|
  • [ ]
| +| BLE (Extended) |
  • [ ]
|
  • [ ]
| | +| BLE (L2CAP) | | | | +| Wi-Fi LAN |
  • [ ]
|
  • [ ]
|
  • [x]
| +| Wi-Fi Hotspot | | |
  • [ ]
| +| Wi-Fi Direct | | |
  • [ ]
| +| Wi-Fi Aware | | | | +| WebRTC | | |
  • [x]
| +| NFC | | | | +| USB |
  • [ ]
|
  • [ ]
|
  • [ ]
| +| AWDL | | | | + +## Windows +| Mediums | Advertising | Scanning | Data | +| :---------------- | :--------------------: | :--------------------: | :--------------------: | +| Bluetooth Classic | |
  • [x]
|
  • [x]
| +| BLE (Fast) |
  • [x]
|
  • [x]
| | +| BLE (GATT) |
  • [x]
|
  • [x]
|
  • [ ]
| +| BLE (Extended) |
  • [x]
|
  • [x]
| | +| BLE (L2CAP) | | | | +| Wi-Fi LAN |
  • [x]
|
  • [x]
|
  • [x]
| +| Wi-Fi Hotspot | | |
  • [x]
| +| Wi-Fi Direct | | |
  • [ ]
| +| Wi-Fi Aware | | | | +| WebRTC | | |
  • [ ]
| +| NFC | | | | +| USB |
  • [ ]
|
  • [ ]
|
  • [ ]
| +| AWDL | | | | + +## iOS/macOS +| Mediums | Advertising | Scanning | Data | +| :---------------- | :--------------------: | :--------------------: | :--------------------: | +| Bluetooth Classic | |
  • [ ]
|
  • [ ]
| +| BLE (Fast) |
  • [ ]
|
  • [ ]
| | +| BLE (GATT) |
  • [ ]
|
  • [ ]
|
  • [ ]
| +| BLE (Extended) | |
  • [ ]
| | +| BLE (L2CAP) | | |
  • [ ]
| +| Wi-Fi LAN |
  • [x]
|
  • [x]
|
  • [x]
| +| Wi-Fi Hotspot | | |
  • [ ]
| +| Wi-Fi Direct | | | | +| Wi-Fi Aware | | | | +| WebRTC | | |
  • [ ]
| +| NFC | |
  • [ ]
| | +| USB | | | | +| AWDL |
  • [ ]
|
  • [ ]
|
  • [ ]
| diff --git a/connections/advertising_options.h b/connections/advertising_options.h index 1f87960f..d7408d16 100644 --- a/connections/advertising_options.h +++ b/connections/advertising_options.h @@ -33,6 +33,8 @@ struct AdvertisingOptions : public OptionsBase { bool low_power; bool enable_bluetooth_listening; bool enable_webrtc_listening; + // Indicates whether the endpoint id should be stable. + bool use_stable_endpoint_id = false; // Whether this is intended to be used in conjunction with InjectEndpoint(). bool is_out_of_band_connection = false; diff --git a/connections/c/BUILD b/connections/c/BUILD index 17db7c4f..ca715b06 100644 --- a/connections/c/BUILD +++ b/connections/c/BUILD @@ -12,9 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//third_party/lexan/build_defs:lexan.bzl", "lexan") -load("expand_version_template.bzl", "expand_version_template") -load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("//third_party/cpptoolchains/windows_llvm/build_defs:windows.bzl", "windows") package(default_visibility = [ "//connections:__subpackages__", @@ -24,104 +22,48 @@ package(default_visibility = [ licenses(["notice"]) cc_library( - name = "types", + name = "nc_types", hdrs = [ - "dll_config.h", - ], - defines = ["CORE_ADAPTER_DLL"], - visibility = ["//visibility:private"], - deps = ["@com_google_absl//absl/strings"], -) - -bzl_library( - name = "expand_version_template_bzl", - srcs = ["expand_version_template.bzl"], - parse_tests = False, - visibility = ["//visibility:private"], -) - -# Default version if none is provided. -vardef("VERSION", "1.0.0.0") - -# When built with rapid, a version value will be passed down from the build config via blaze -# When built manually, invoke blaze with --define=VERSION=1.2.3.4 -# If VERSION is not passed from blaze, the default value defined above will be used. -expand_version_template( - name = "version_expanded", - out = "version.rc", - template = "version.rc.tpl", - version = varref("VERSION"), -) - -lexan.resource_files( - name = "resources", - rc_files = [ - ":version_expanded", + "nc.h", + "nc_def.h", + "nc_types.h", ], + compatible_with = ["//buildenv/target:non_prod"], ) cc_library( - name = "c", + name = "nc", srcs = [ - "advertising_options_w.cc", - "connection_options_w.cc", - "core_adapter.cc", - "discovery_options_w.cc", - "file_w.cc", - "listeners_w.cc", - "payload_w.cc", - "strategy_w.cc", - ], - hdrs = [ - "advertising_options_w.h", - "connection_options_w.h", - "core_adapter.h", - "discovery_options_w.h", - "file_w.h", - "listeners_w.h", - "medium_selector_w.h", - "options_base_w.h", - "out_of_band_connection_metadata_w.h", - "params_w.h", - "payload_w.h", - "strategy_w.h", + "nc.cc", ], + compatible_with = ["//buildenv/target:non_prod"], + copts = ["-DNC_DLL"], deps = [ - ":types", + ":nc_types", "//connections:core", "//connections:core_types", + "//connections/implementation/flags:connections_flags", + "//internal/flags:nearby_flags", "//internal/platform:base", "//internal/platform:types", "//proto:connections_enums_cc_proto", + "@com_google_absl//absl/base:no_destructor", + "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/types:span", ], ) -# Build with --config=lexan -lexan.cc_windows_dll( - name = "nearby_connections", +windows.cc_windows_dll( + name = "nc_windows", + srcs = [], + compatible_with = ["//buildenv/target:non_prod"], + copts = ["-DNC_DLL"], tags = ["windows-dll"], deps = [ - ":c", - ":types", + ":nc", "//internal/platform/implementation/windows", "@com_google_absl//absl/strings", ], ) - -cc_test( - name = "connections_test", - size = "small", - srcs = [ - "bluetooth_classic_server_socket_test.cc", - ], - deps = [ - "//connections:core", - "//internal/platform:types", - "//internal/platform/implementation/windows", - "@com_github_protobuf_matchers//protobuf-matchers", - "@com_google_googletest//:gtest_main", - ], -) diff --git a/connections/c/advertising_options_w.cc b/connections/c/advertising_options_w.cc deleted file mode 100644 index 22d83c0f..00000000 --- a/connections/c/advertising_options_w.cc +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022 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. - -#include "connections/c/advertising_options_w.h" - -#include - -namespace nearby::windows { - -// Returns a copy and normalizes allowed mediums: -// (1) If is_out_of_band_connection is true, verifies that there is only one -// medium allowed, defaulting to only Bluetooth if unspecified. -// (2) If no mediums are allowed, allow all mediums. -AdvertisingOptionsW AdvertisingOptionsW::CompatibleOptions() const { - AdvertisingOptionsW result = *this; - - // Out-of-band connections initiate connections via an injected endpoint - // rather than through the normal discovery flow. These types of connections - // can only be injected via a single medium. - if (is_out_of_band_connection) { - int num_enabled = result.allowed.Count(true); - - // Default to allow only Bluetooth if no single medium is specified. - if (num_enabled != 1) { - result.allowed.SetAll(false); - result.allowed.bluetooth = true; - } - return result; - } - - // Normal connections (i.e., not out-of-band) connections can specify - // multiple mediums. If none are specified, default to allowing all mediums. - if (!allowed.Any(true)) result.allowed.SetAll(true); - return result; -} - -} // namespace nearby::windows diff --git a/connections/c/advertising_options_w.h b/connections/c/advertising_options_w.h deleted file mode 100644 index 984b53a9..00000000 --- a/connections/c/advertising_options_w.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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_C_ADVERTISING_OPTIONS_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_ADVERTISING_OPTIONS_W_H_ - -#include "connections/c/options_base_w.h" - -namespace nearby::windows { - -extern "C" { - -// Advertising Options: used for Advertising. -// All fields are mutable, to make the type copy-assignable. -struct DLL_API AdvertisingOptionsW : public OptionsBaseW { - bool auto_upgrade_bandwidth = true; - bool enforce_topology_constraints; - bool low_power; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - bool is_out_of_band_connection = false; - const char* fast_advertisement_service_uuid; - - // The information about this device (eg. name, device type), - // to appear on the remote device. - // Defined by client/application. - const char* device_info; - - // Returns a copy and normalizes allowed mediums: - // (1) If is_out_of_band_connection is true, verifies that there is only one - // medium allowed, defaulting to only Bluetooth if unspecified. - // (2) If no mediums are allowed, allow all mediums. - AdvertisingOptionsW CompatibleOptions() const; -}; - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_ADVERTISING_OPTIONS_W_H_ diff --git a/connections/c/bluetooth_classic_server_socket_test.cc b/connections/c/bluetooth_classic_server_socket_test.cc deleted file mode 100644 index 2b0e1394..00000000 --- a/connections/c/bluetooth_classic_server_socket_test.cc +++ /dev/null @@ -1,612 +0,0 @@ -// Copyright 2022 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. - -#include - -#include -#include - -#include "gtest/gtest.h" -#include "absl/synchronization/notification.h" -#include "connections/advertising_options.h" -#include "connections/core.h" -#include "connections/implementation/service_controller_router.h" -#include "connections/listeners.h" -#include "connections/status.h" -#include "connections/strategy.h" -#include "internal/platform/byte_array.h" -#include "internal/platform/count_down_latch.h" - -namespace nearby::windows { - -using ::nearby::ByteArray; -using ::nearby::connections::AdvertisingOptions; -using ::nearby::connections::ConnectionListener; -using ::nearby::connections::ConnectionRequestInfo; -using ::nearby::connections::Core; -using ::nearby::connections::ServiceControllerRouter; -using ::nearby::connections::Status; -using ::nearby::connections::Strategy; - -constexpr absl::string_view SERVICE_ID = - "com.google.location.nearby.apps.helloconnections"; - -constexpr int TimeoutSeconds = 3; -constexpr int LoopCount = 10; -constexpr absl::string_view device_name = "12345678901"; - -AdvertisingOptions AdvertiseOptions{ - { - // Strategy - { - Strategy::kP2pPointToPoint, - }, - // Allowed: - { - true, // bluetooth - true, // ble - true, // webrtc - true, // wifi_lan - true, // wifi_hotspot - }, - }, - true, // auto_upgrade_bandwidth - true, // enforce_topology_constraints - false, // low_power - false, // enable_bluetooth_listening - false, // enable_webrtc_listening - false, // is_out_of_band_connection - "", // fast_advertisement_service_uuid -}; - -class PerformanceTimer { - public: - static void start() { - QueryPerformanceFrequency(&frequency_); - QueryPerformanceCounter(&starting_time_); - } - static void stop() { - QueryPerformanceCounter(&ending_time_); - elapsed_microseconds_.QuadPart = - ending_time_.QuadPart - starting_time_.QuadPart; - elapsed_milliseconds_ = elapsed_microseconds_.QuadPart / 100; - } - - static uint64_t ElapsedMilliseconds() { return elapsed_milliseconds_; } - - private: - static uint64_t elapsed_milliseconds_; - static LARGE_INTEGER starting_time_; - static LARGE_INTEGER ending_time_; - static LARGE_INTEGER elapsed_microseconds_; - static LARGE_INTEGER frequency_; -}; - -uint64_t PerformanceTimer::elapsed_milliseconds_; -LARGE_INTEGER PerformanceTimer::starting_time_; -LARGE_INTEGER PerformanceTimer::ending_time_; -LARGE_INTEGER PerformanceTimer::elapsed_microseconds_; -LARGE_INTEGER PerformanceTimer::frequency_; - -TEST(BluetoothClassicServerSocketTest, - DISABLED_SingleRunWithTimeoutReproStuck) { - ServiceControllerRouter router; - Core core(&router); - - ConnectionListener listener; - - ConnectionRequestInfo request_info; - - request_info.endpoint_info = ByteArray(std::string(device_name)); - request_info.listener = listener; - - Status request_result; - absl::Notification notification; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification.Notify(); - }); - - if (notification.WaitForNotificationWithTimeout( - absl::Seconds(TimeoutSeconds))) { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Started advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StartAdvertising started once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started once:" - << request_result.ToString(); - } else { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on starting advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - EXPECT_TRUE(false) << "Timeout on starting advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - std::cout << "StartAdvertising failed to start once:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising failed to start once:" - << request_result.ToString(); - } - - absl::Notification notification2; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification2.Notify(); - }); - - if (notification2.WaitForNotificationWithTimeout( - absl::Seconds(TimeoutSeconds))) { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Started advertising second time elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StartAdvertising started twice:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started twice:" - << request_result.ToString(); - } else { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) - << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on starting advertising the second time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - - EXPECT_TRUE(false) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout for started advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - std::cout << "StartAdvertising failed to start twice:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising failed to start twice:" - << request_result.ToString(); - } - - absl::Notification notification3; - - PerformanceTimer::start(); - - core.StopAdvertising([&](Status status) { - request_result = status; - notification3.Notify(); - }); - - if (notification3.WaitForNotificationWithTimeout( - absl::Seconds(TimeoutSeconds))) { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Stopped advertising first time elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time: " - << std::to_string(elapsed_microseconds); -#endif - - std::cout << "StopAdvertising called once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StopAdvertising called once:" - << request_result.ToString(); - } else { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) - << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on stopping advertising the first time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - - EXPECT_TRUE(false) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on stop advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - std::cout << "StopAdvertising failed to stop once:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StopAdvertising failed to stop once:" - << request_result.ToString(); - } - - std::cout << "Test completed." << std::endl; - NEARBY_LOGS(INFO) << "Test completed."; -} - -TEST(BluetoothClassicServerSocketTest, DISABLED_MultiRunWithTimeoutReproStuck) { - ServiceControllerRouter router; - Core core(&router); - - ConnectionListener listener; - - ConnectionRequestInfo request_info; - - request_info.endpoint_info = ByteArray(std::string(device_name)); - request_info.listener = listener; - - for (int loop_count = 0; loop_count < LoopCount; ++loop_count) { - Status request_result; - absl::Notification notification; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification.Notify(); - }); - - if (notification.WaitForNotificationWithTimeout( - absl::Seconds(TimeoutSeconds))) { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Started advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time : " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StartAdvertising started once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started once:" - << request_result.ToString(); - } else { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on starting advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - EXPECT_TRUE(false) << "Timeout on starting advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - std::cout << "StartAdvertising failed to start once:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising failed to start once:" - << request_result.ToString(); - } - - absl::Notification notification2; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification2.Notify(); - }); - - if (notification2.WaitForNotificationWithTimeout( - absl::Seconds(TimeoutSeconds))) { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Started advertising second time elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - // EXPECT_TRUE(false) - // << "Started advertising elapsed time: " - // << std::to_string(ElapsedMilliseconds); - std::cout << "StartAdvertising started twice:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started twice:" - << request_result.ToString(); - } else { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) - << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on starting advertising the second time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - - EXPECT_TRUE(false) - << "Timeout on starting advertising the second time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - - std::cout << "StartAdvertising failed to start twice:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising failed to start twice:" - << request_result.ToString(); - } - - absl::Notification notification3; - - PerformanceTimer::start(); - - core.StopAdvertising([&](Status status) { - request_result = status; - notification3.Notify(); - }); - - if (notification3.WaitForNotificationWithTimeout( - absl::Seconds(TimeoutSeconds))) { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Stopped advertising first time elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StopAdvertising called once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StopAdvertising called once:" - << request_result.ToString(); - } else { - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) - << "SingleRunWithTimeoutReproStuck Line: " << __LINE__ - << " Timeout on stopping advertising the first time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - - EXPECT_TRUE(false) << "Timeout on started advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - - std::cout << "StopAdvertising failed to stop once:" - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StopAdvertising failed to stop once:" - << request_result.ToString(); - } - } - - std::cout << "Test completed." << std::endl; - NEARBY_LOGS(INFO) << "Test completed."; -} - -TEST(BluetoothClassicServerSocketTest, DISABLED_SingleRunNoTimeoutReproStuck) { - ServiceControllerRouter router; - Core core(&router); - - ConnectionListener listener; - - ConnectionRequestInfo request_info; - - request_info.endpoint_info = ByteArray(std::string(device_name)); - request_info.listener = listener; - - Status request_result; - absl::Notification notification; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification.Notify(); - }); - - notification.WaitForNotification(); - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunNoTimeoutReproStuck Line: " << __LINE__ - << " Started advertising first time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising first time elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StartAdvertising started once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started once:" - << request_result.ToString(); - - absl::Notification notification2; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification2.Notify(); - }); - - notification2.WaitForNotification(); - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunNoTimeoutReproStuck Line: " << __LINE__ - << " Started advertising first time elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising first time elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StartAdvertising started twice:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started twice:" - << request_result.ToString(); - - absl::Notification notification3; - - PerformanceTimer::start(); - - core.StopAdvertising([&](Status status) { - request_result = status; - notification3.Notify(); - }); - - notification3.WaitForNotification(); - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "SingleRunNoTimeoutReproStuck " << __LINE__ - << "Stopped advertising elapsed time: " - << std::to_string(PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Stopped advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StopAdvertising called once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "StopAdvertising called once:" - << request_result.ToString(); - - std::cout << "Test completed." << std::endl; - NEARBY_LOGS(INFO) << "Test completed."; -} - -TEST(BluetoothClassicServerSocketTest, DISABLED_MultiRunNoTimeoutReproStuck) { - ServiceControllerRouter router; - Core core(&router); - - ConnectionListener listener; - - ConnectionRequestInfo request_info; - - request_info.endpoint_info = ByteArray(std::string(device_name)); - request_info.listener = listener; - - for (int loop_count = 0; loop_count < LoopCount; ++loop_count) { - Status request_result; - absl::Notification notification; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification.Notify(); - }); - - notification.WaitForNotification(); - - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "MultiRunNoTimeoutReproStuck " << __LINE__ - << "Started advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "MultiRunNoTimeoutReproStuck " << __LINE__ - << " : StartAdvertising started once: " - << request_result.ToString() << std::endl; - NEARBY_LOGS(INFO) << "StartAdvertising started once:" - << request_result.ToString(); - - absl::Notification notification2; - - PerformanceTimer::start(); - - core.StartAdvertising(SERVICE_ID, AdvertiseOptions, request_info, - [&](Status status) { - request_result = status; - notification2.Notify(); - }); - - notification2.WaitForNotification(); - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "MultiRunNoTimeoutReproStuck " << __LINE__ - << "Started advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Started advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "MultiRunNoTimeoutReproStuck " << __LINE__ - << "StartAdvertising started twice:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "MultiRunNoTimeoutReproStuck " << __LINE__ - << "StartAdvertising started twice:" - << request_result.ToString(); - - absl::Notification notification3; - - PerformanceTimer::start(); - - core.StopAdvertising([&](Status status) { - request_result = status; - notification3.Notify(); - }); - - notification3.WaitForNotification(); - PerformanceTimer::stop(); - - NEARBY_LOGS(INFO) << "MultiRunNoTimeoutReproStuck " << __LINE__ - << "Stopped advertising elapsed time: " - << std::to_string( - PerformanceTimer::ElapsedMilliseconds()); - -#ifdef TEST_OUTPUT - EXPECT_TRUE(false) << "Stop advertising elapsed time: " - << std::to_string(ElapsedMilliseconds); -#endif - - std::cout << "StopAdvertising called once:" << request_result.ToString() - << std::endl; - NEARBY_LOGS(INFO) << "MultiRunNoTimeoutReproStuck " << __LINE__ - << "StopAdvertising called once:" - << request_result.ToString(); - } - - std::cout << "Test completed." << std::endl; - NEARBY_LOGS(INFO) << "Test completed."; -} - -} // namespace nearby::windows diff --git a/connections/c/connection_options_w.cc b/connections/c/connection_options_w.cc deleted file mode 100644 index 96559460..00000000 --- a/connections/c/connection_options_w.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2021-2022 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. - -#include "connections/c/connection_options_w.h" - -#include - -namespace nearby::windows { - -void ConnectionOptionsW::GetMediums(const MediumW* mediums, - size_t mediums_size) const { - // Create a collection of enabled mediums - auto allowedMediums = allowed.GetMediums(true); - auto iter = allowedMediums.begin(); - int index = 0; - // There is a fixed buffer of 5 for these, fill it up and leave. - while (iter != allowedMediums.end() && index < MAX_MEDIUMS) { - *mediums_[index++] = iter[index]; - } - mediums_size = allowed.GetMediums(true).size(); - return; -} - -} // namespace nearby::windows diff --git a/connections/c/connection_options_w.h b/connections/c/connection_options_w.h deleted file mode 100644 index 9a2f7497..00000000 --- a/connections/c/connection_options_w.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2021-2022 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_C_CONNECTION_OPTIONS_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_CONNECTION_OPTIONS_W_H_ -#include - -#include "connections/c/dll_config.h" -#include "connections/c/medium_selector_w.h" -#include "connections/c/options_base_w.h" - -namespace nearby::windows { - -extern "C" { - -#define MAX_MEDIUMS 6 - -// Connection Options: used for both Advertising and Discovery. -// All fields are mutable, to make the type copy-assignable. -struct DLL_API ConnectionOptionsW : public OptionsBaseW { - bool auto_upgrade_bandwidth = true; - bool enforce_topology_constraints; - bool low_power; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - bool is_out_of_band_connection = false; - const char* remote_bluetooth_mac_address; - const char* fast_advertisement_service_uuid; - int keep_alive_interval_millis = 0; - int keep_alive_timeout_millis = 0; - - void GetMediums(const MediumW*, size_t) const; - - private: - MediumW* mediums_[MAX_MEDIUMS]; - size_t mediums_size; -}; - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_CONNECTION_OPTIONS_W_H_ diff --git a/connections/c/core_adapter.cc b/connections/c/core_adapter.cc deleted file mode 100644 index f8521f6d..00000000 --- a/connections/c/core_adapter.cc +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright 2021-2022 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. - -#include "connections/c/core_adapter.h" - -#include "absl/strings/str_format.h" -#include "connections/core.h" -#include "internal/platform/bluetooth_utils.h" -#include "internal/platform/logging.h" - -namespace nearby::windows { - -Core *InitCore(connections::ServiceControllerRouter *router) { -#if defined(LOG_SEVERITY_VERBOSE) - NEARBY_LOG_SET_SEVERITY(VERBOSE); -#endif // LOG_SEVERITY_VERBOSE; - return new nearby::connections::Core(router); -} - -void CloseCore(Core *pCore) { - if (pCore == nullptr) { - return; - } - pCore->StopAllEndpoints([](Status) {}); - delete pCore; -} - -void StartAdvertising(Core *pCore, const char *service_id, - AdvertisingOptionsW advertising_options_w, - ConnectionRequestInfoW info, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - connections::ConnectionRequestInfo crInfo; - - crInfo.endpoint_info = ByteArray(info.endpoint_info); - crInfo.listener = std::move(*(info.listener.GetImpl())); - - connections::AdvertisingOptions advertising_options; - - advertising_options.allowed.bluetooth = - advertising_options_w.allowed.bluetooth; - advertising_options.allowed.ble = advertising_options_w.allowed.ble; - advertising_options.allowed.wifi_lan = advertising_options_w.allowed.wifi_lan; - advertising_options.allowed.web_rtc = advertising_options_w.allowed.web_rtc; - advertising_options.allowed.wifi_hotspot = - advertising_options_w.allowed.wifi_hotspot; - advertising_options.enable_bluetooth_listening = false; - advertising_options.enable_webrtc_listening = false; - advertising_options.auto_upgrade_bandwidth = - advertising_options_w.auto_upgrade_bandwidth; - advertising_options.enforce_topology_constraints = - advertising_options_w.enforce_topology_constraints; - if (advertising_options_w.fast_advertisement_service_uuid != nullptr) { - advertising_options.fast_advertisement_service_uuid = - std::string(advertising_options_w.fast_advertisement_service_uuid); - } - advertising_options.is_out_of_band_connection = - advertising_options_w.is_out_of_band_connection; - advertising_options.low_power = advertising_options_w.low_power; - if (advertising_options_w.strategy == StrategyW::kNone) - advertising_options.strategy = connections::Strategy::kNone; - if (advertising_options_w.strategy == StrategyW::kP2pCluster) - advertising_options.strategy = connections::Strategy::kP2pCluster; - if (advertising_options_w.strategy == StrategyW::kP2pPointToPoint) - advertising_options.strategy = connections::Strategy::kP2pPointToPoint; - if (advertising_options_w.strategy == StrategyW::kP2pStar) - advertising_options.strategy = connections::Strategy::kP2pStar; - - pCore->StartAdvertising(service_id, advertising_options, crInfo, - std::move(*callback.GetImpl())); -} - -void StopAdvertising(connections::Core *pCore, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->StopAdvertising(std::move(*callback.GetImpl())); -} - -void StartDiscovery(connections::Core *pCore, const char *service_id, - DiscoveryOptionsW discovery_options_w, - DiscoveryListenerW listener, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - connections::DiscoveryListener discoveryListener = - std::move(*listener.GetImpl()); - - connections::DiscoveryOptions discovery_options; - - if (discovery_options_w.strategy == StrategyW::kNone) - discovery_options.strategy = connections::Strategy::kNone; - if (discovery_options_w.strategy == StrategyW::kP2pCluster) - discovery_options.strategy = connections::Strategy::kP2pCluster; - if (discovery_options_w.strategy == StrategyW::kP2pPointToPoint) - discovery_options.strategy = connections::Strategy::kP2pPointToPoint; - if (discovery_options_w.strategy == StrategyW::kP2pStar) - discovery_options.strategy = connections::Strategy::kP2pStar; - discovery_options.auto_upgrade_bandwidth = - discovery_options_w.auto_upgrade_bandwidth; - discovery_options.enforce_topology_constraints = - discovery_options_w.enforce_topology_constraints; - discovery_options.is_out_of_band_connection = - discovery_options_w.is_out_of_band_connection; - if (discovery_options_w.fast_advertisement_service_uuid) { - discovery_options.fast_advertisement_service_uuid = - std::string(discovery_options_w.fast_advertisement_service_uuid); - } - discovery_options.allowed.bluetooth = discovery_options_w.allowed.bluetooth; - discovery_options.allowed.ble = discovery_options_w.allowed.ble; - discovery_options.allowed.wifi_lan = discovery_options_w.allowed.wifi_lan; - discovery_options.allowed.wifi_hotspot = - discovery_options_w.allowed.wifi_hotspot; - discovery_options.allowed.web_rtc = discovery_options_w.allowed.web_rtc; - - pCore->StartDiscovery(service_id, discovery_options, discoveryListener, - std::move(*callback.GetImpl())); -} - -void StopDiscovery(connections::Core *pCore, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->StopDiscovery(std::move(*callback.GetImpl())); -} - -void InjectEndpoint(connections::Core *pCore, char *service_id, - OutOfBandConnectionMetadataW metadata, - ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - connections::OutOfBandConnectionMetadata outOfBandConnectionMetadata; - outOfBandConnectionMetadata.endpoint_id = metadata.endpoint_id; - outOfBandConnectionMetadata.endpoint_info = {metadata.endpoint_info, - metadata.endpoint_info_size}; - outOfBandConnectionMetadata.medium = metadata.medium; - outOfBandConnectionMetadata.remote_bluetooth_mac_address = { - metadata.remote_bluetooth_mac_address, - metadata.remote_bluetooth_mac_address_size}; - - pCore->InjectEndpoint(service_id, outOfBandConnectionMetadata, - std::move(*callback.GetImpl())); -} - -void RequestConnection(connections::Core *pCore, const char *endpoint_id, - ConnectionRequestInfoW info, - ConnectionOptionsW connection_options_w, - ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - connections::ConnectionRequestInfo connectionRequestInfo = - connections::ConnectionRequestInfo(); - connectionRequestInfo.endpoint_info = ByteArray(info.endpoint_info); - connectionRequestInfo.listener = std::move(*info.listener.GetImpl()); - - connections::ConnectionOptions connection_options; - connection_options.allowed.ble = connection_options_w.allowed.ble; - connection_options.allowed.bluetooth = connection_options_w.allowed.bluetooth; - connection_options.allowed.web_rtc = connection_options_w.allowed.web_rtc; - connection_options.allowed.wifi_lan = connection_options_w.allowed.wifi_lan; - connection_options.auto_upgrade_bandwidth = - connection_options_w.auto_upgrade_bandwidth; - connection_options.enforce_topology_constraints = - connection_options_w.enforce_topology_constraints; - if (connection_options_w.fast_advertisement_service_uuid) { - connection_options.fast_advertisement_service_uuid = - std::string(connection_options_w.fast_advertisement_service_uuid); - } - connection_options.is_out_of_band_connection = - connection_options_w.is_out_of_band_connection; - connection_options.keep_alive_interval_millis = - connection_options_w.keep_alive_interval_millis; - connection_options.keep_alive_timeout_millis = - connection_options_w.keep_alive_timeout_millis; - connection_options.low_power = connection_options_w.low_power; - if (connection_options_w.remote_bluetooth_mac_address) { - connection_options.remote_bluetooth_mac_address = - BluetoothUtils::FromString( - connection_options_w.remote_bluetooth_mac_address); - } - if (connection_options_w.strategy == StrategyW::kNone) - connection_options.strategy = connections::Strategy::kNone; - if (connection_options_w.strategy == StrategyW::kP2pCluster) - connection_options.strategy = connections::Strategy::kP2pCluster; - if (connection_options_w.strategy == StrategyW::kP2pPointToPoint) - connection_options.strategy = connections::Strategy::kP2pPointToPoint; - if (connection_options_w.strategy == StrategyW::kP2pStar) - connection_options.strategy = connections::Strategy::kP2pStar; - - pCore->RequestConnection(endpoint_id, connectionRequestInfo, - connection_options, std::move(*callback.GetImpl())); -} - -void AcceptConnection(connections::Core *pCore, const char *endpoint_id, - PayloadListenerW listener, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - connections::PayloadListener payload_listener = - std::move(*listener.GetImpl()); - pCore->AcceptConnection(endpoint_id, std::move(payload_listener), - std::move(*callback.GetImpl())); -} - -void RejectConnection(connections::Core *pCore, const char *endpoint_id, - ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->RejectConnection(endpoint_id, std::move(*callback.GetImpl())); -} - -void SendPayload(connections::Core *pCore, - // todo(jfcarroll) this is being exported, needs to be - // refactored to return a plain old c type - const char **endpoint_ids, size_t endpoint_ids_size, - PayloadW payloadw, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - std::string payloadData = std::string(*endpoint_ids); - absl::Span span{&payloadData, 1}; - pCore->SendPayload(span, std::move(*payloadw.GetImpl()), - std::move(*callback.GetImpl())); -} - -void CancelPayload(connections::Core *pCore, std::int64_t payload_id, - ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->CancelPayload(payload_id, std::move(*callback.GetImpl())); -} - -void DisconnectFromEndpoint(connections::Core *pCore, const char *endpoint_id, - ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->DisconnectFromEndpoint(endpoint_id, std::move(*callback.GetImpl())); -} - -void StopAllEndpoints(connections::Core *pCore, ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->StopAllEndpoints(std::move(*callback.GetImpl())); -} - -void InitiateBandwidthUpgrade(connections::Core *pCore, char *endpoint_id, - ResultCallbackW callback) { - if (pCore == nullptr) { - return; - } - pCore->InitiateBandwidthUpgrade(endpoint_id, std::move(*callback.GetImpl())); -} - -const char *GetLocalEndpointId(connections::Core *pCore) { - if (pCore == nullptr) { - return "Null-Core"; - } - std::string endpoint_id = pCore->GetLocalEndpointId(); - char *result = new char[endpoint_id.length() + 1]; - absl::SNPrintF(result, endpoint_id.length() + 1, "%s", endpoint_id); - return result; -} - -connections::ServiceControllerRouter *InitServiceControllerRouter() { - return new connections::ServiceControllerRouter(); -} - -void CloseServiceControllerRouter( - connections::ServiceControllerRouter *pRouter) { - if (pRouter != nullptr) { - delete pRouter; - } -} - -} // namespace nearby::windows diff --git a/connections/c/core_adapter.h b/connections/c/core_adapter.h deleted file mode 100644 index b2152521..00000000 --- a/connections/c/core_adapter.h +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright 2021-2022 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_C_CORE_ADAPTER_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_CORE_ADAPTER_H_ - -#include "absl/strings/string_view.h" -#include "absl/types/span.h" -#include "connections/c/advertising_options_w.h" -#include "connections/c/connection_options_w.h" -#include "connections/c/discovery_options_w.h" -#include "connections/c/listeners_w.h" -#include "connections/c/out_of_band_connection_metadata_w.h" -#include "connections/c/params_w.h" -#include "connections/c/payload_w.h" - -namespace nearby::connections { -class Core; -class ServiceController; -class ServiceControllerRouter; -class OfflineServiceController; -} // namespace nearby::connections -namespace nearby::windows { - -extern "C" { - -using Core = connections::Core; -using ServiceControllerRouter = connections::ServiceControllerRouter; - -// Initializes a Core instance, providing the ServiceController factory from -// app side. If no factory is provided, it will initialize a new -// factory creating OfflineServiceController. -// Returns the instance handle to c# client. -// TODO(jfcarroll): Is this method needed? The trouble is we can't -// new up a forward declared class (OfflineServiceController). If this -// is necessary, must find another way to implement it. -// DLL_API Core *__stdcall InitCoreWithServiceControllerFactory( -// std::function factory = []() { -// return new OfflineServiceController; -// }); - -// Initializes a default Core instance. -// Returns the instance handle to c# client. -DLL_API Core* __stdcall InitCore(ServiceControllerRouter*); - -// Closes the core with stopping all endpoints, then free the memory. -DLL_API void __stdcall CloseCore(Core*); - -// Starts advertising an endpoint for a local app. -// -// service_id - An identifier to advertise your app to other endpoints. -// This can be an arbitrary string, so long as it uniquely -// identifies your service. A good default is to use your -// app's package name. -// advertising_options - The options for advertising. -// info - Connection parameters: -// > name - A human readable name for this endpoint, to appear on -// other devices. -// > listener - A callback notified when remote endpoints request a -// connection to this endpoint. -// callback - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if advertising started successfully. -// Status::STATUS_ALREADY_ADVERTISING if the app is already advertising. -// Status::STATUS_OUT_OF_ORDER_API_CALL if the app is currently -// connected to remote endpoints; call StopAllEndpoints first. -DLL_API void __stdcall StartAdvertising(Core*, const char*, AdvertisingOptionsW, - ConnectionRequestInfoW, - ResultCallbackW); - -// Stops advertising a local endpoint. Should be called after calling -// StartAdvertising, as soon as the application no longer needs to advertise -// itself or goes inactive. Payloads can still be sent to connected -// endpoints after advertising ends. -// -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if none of the above errors occurred. -DLL_API void __stdcall StopAdvertising(Core*, ResultCallbackW); - -// Starts discovery for remote endpoints with the specified service ID. -// -// service_id - The ID for the service to be discovered, as specified in -// the corresponding call to StartAdvertising. -// listener - A callback notified when a remote endpoint is discovered. -// discovery_options - The options for discovery. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if discovery started successfully. -// Status::STATUS_ALREADY_DISCOVERING if the app is already -// discovering the specified service. -// Status::STATUS_OUT_OF_ORDER_API_CALL if the app is currently -// connected to remote endpoints; call StopAllEndpoints first. -DLL_API void __stdcall StartDiscovery(Core*, const char*, DiscoveryOptionsW, - DiscoveryListenerW, ResultCallbackW); - -// Stops discovery for remote endpoints, after a previous call to -// StartDiscovery, when the client no longer needs to discover endpoints or -// goes inactive. Payloads can still be sent to connected endpoints after -// discovery ends. -// -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if none of the above errors occurred. -DLL_API void __stdcall StopDiscovery(Core*, ResultCallbackW); - -// Invokes the discovery callback from a previous call to StartDiscovery() -// with the given endpoint info. The previous call to StartDiscovery() must -// have been passed ConnectionOptions with is_out_of_band_connection == true. -// -// service_id - The ID for the service to be discovered, as -// specified in the corresponding call to -// StartDiscovery(). -// metadata - Metadata used in order to inject the endpoint. -// result_cb - to access the status of the operation when -// available. -// Possible status codes include: -// Status::kSuccess if endpoint injection was attempted. -// Status::kError if endpoint_id, endpoint_info, or -// remote_bluetooth_mac_address are malformed. -// Status::kOutOfOrderApiCall if the app is not discovering. -DLL_API void __stdcall InjectEndpoint(Core*, char*, - OutOfBandConnectionMetadataW, - ResultCallbackW); - -// Sends a request to connect to a remote endpoint. -// -// endpoint_id - The identifier for the remote endpoint to which a -// connection request will be sent. Should match the value -// provided in a call to -// DiscoveryListener::endpoint_found_cb() -// info - Connection parameters: -// > name - A human readable name for the local endpoint, to appear on -// the remote endpoint. -// > listener - A callback notified when the remote endpoint sends a -// response to the connection request. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if the connection request was sent. -// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT if the app already -// has a connection to the specified endpoint. -// Status::STATUS_RADIO_ERROR if we failed to connect because of an -// issue with Bluetooth/WiFi. -// Status::STATUS_ERROR if we failed to connect for any other reason. -DLL_API void __stdcall RequestConnection(Core*, const char*, - ConnectionRequestInfoW, - ConnectionOptionsW, ResultCallbackW); - -// Accepts a connection to a remote endpoint. This method must be called -// before Payloads can be exchanged with the remote endpoint. -// -// endpoint_id - The identifier for the remote endpoint. Should match the -// value provided in a call to -// ConnectionListener::onConnectionInitiated. -// listener - A callback for payloads exchanged with the remote endpoint. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if the connection request was accepted. -// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT if the app already. -// has a connection to the specified endpoint. -DLL_API void __stdcall AcceptConnection(Core*, const char*, PayloadListenerW, - ResultCallbackW); - -// Rejects a connection to a remote endpoint. -// -// endpoint_id - The identifier for the remote endpoint. Should match the -// value provided in a call to -// ConnectionListener::onConnectionInitiated(). -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK} if the connection request was rejected. -// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT} if the app already -// has a connection to the specified endpoint. -DLL_API void __stdcall RejectConnection(Core*, const char*, ResultCallbackW); - -// Sends a Payload to a remote endpoint. Payloads can only be sent to remote -// endpoints once a notice of connection acceptance has been delivered via -// ConnectionListener::onConnectionResult(). -// -// endpoint_ids - Array of remote endpoint identifiers for the to which the -// payload should be sent. -// payload - The Payload to be sent. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OUT_OF_ORDER_API_CALL if the device has not first -// performed advertisement or discovery (to set the Strategy.) -// Status::STATUS_ENDPOINT_UNKNOWN if there's no active (or pending) -// connection to the remote endpoint. -// Status::STATUS_OK if none of the above errors occurred. Note that this -// indicates that Nearby Connections will attempt to send the Payload, -// but not that the send has successfully completed yet. Errors might -// still occur during transmission (and at different times for -// different endpoints), and will be delivered via -// PayloadCallback#onPayloadTransferUpdate. -DLL_API void __stdcall SendPayload(Core*, const char**, size_t, PayloadW, - ResultCallbackW); - -// Cancels a Payload currently in-flight to or from remote endpoint(s). -// -// payload_id - The identifier for the Payload to be canceled. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if none of the above errors occurred. -DLL_API void __stdcall CancelPayload(Core*, int64_t, ResultCallbackW); - -// Disconnects from a remote endpoint. {@link Payload}s can no longer be sent -// to or received from the endpoint after this method is called. -// -// endpoint_id - The identifier for the remote endpoint to disconnect from. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK - finished successfully. -DLL_API void __stdcall DisconnectFromEndpoint(Core*, const char*, - ResultCallbackW); - -// Disconnects from, and removes all traces of, all connected and/or -// discovered endpoints. This call also stops advertising and discovery. After -// calling StopAllEndpoints, no further operations with remote endpoints will be -// possible until a new call to one of StartAdvertising() or StartDiscovery(). -// -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK - finished successfully. -DLL_API void __stdcall StopAllEndpoints(Core*, ResultCallbackW); - -// Sends a request to initiate connection bandwidth upgrade. -// -// endpoint_id - The identifier for the remote endpoint which will be -// switching to a higher connection data rate and possibly -// different wireless protocol. On success, calls -// ConnectionListener::bandwidth_changed_cb(). -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK - finished successfully. -DLL_API void __stdcall InitiateBandwidthUpgrade(Core*, char*, ResultCallbackW); - -// Gets the local endpoint generated by Nearby Connections. -DLL_API const char* __stdcall GetLocalEndpointId(Core*); - -// Initializes a default ServiceControllerRouter instance. -// Returns the instance handle to c# client. -DLL_API ServiceControllerRouter* __stdcall InitServiceControllerRouter(); - -// Close a ServiceControllerRouter instance. -DLL_API void __stdcall CloseServiceControllerRouter(ServiceControllerRouter*); - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_CORE_ADAPTER_H_ diff --git a/connections/c/discovery_options_w.cc b/connections/c/discovery_options_w.cc deleted file mode 100644 index e60b07a6..00000000 --- a/connections/c/discovery_options_w.cc +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2022 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. - -#include "connections/c/discovery_options_w.h" - -#include - -namespace nearby::windows { - -// Returns a copy and normalizes allowed mediums: -// (1) If is_out_of_band_connection is true, verifies that there is only one -// medium allowed, defaulting to only Bluetooth if unspecified. -// (2) If no mediums are allowed, allow all mediums. -DiscoveryOptionsW DiscoveryOptionsW::CompatibleOptions() const { - DiscoveryOptionsW result = *this; - - // Out-of-band connections initiate connections via an injected endpoint - // rather than through the normal discovery flow. These types of connections - // can only be injected via a single medium. - if (is_out_of_band_connection) { - int num_enabled = result.allowed.Count(true); - - // Default to allow only Bluetooth if no single medium is specified. - if (num_enabled != 1) { - result.allowed.SetAll(false); - result.allowed.bluetooth = true; - } - return result; - } - - // Normal connections (i.e., not out-of-band) connections can specify - // multiple mediums. If none are specified, default to allowing all mediums. - if (!allowed.Any(true)) result.allowed.SetAll(true); - return result; -} - -} // namespace nearby::windows diff --git a/connections/c/discovery_options_w.h b/connections/c/discovery_options_w.h deleted file mode 100644 index 266fc7cd..00000000 --- a/connections/c/discovery_options_w.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2022 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_C_DISCOVERY_OPTIONS_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_DISCOVERY_OPTIONS_W_H_ -#include - -#include "connections/c/options_base_w.h" - -namespace nearby::windows { - -extern "C" { - -// Connection Options: used for both Advertising and Discovery. -// All fields are mutable, to make the type copy-assignable. -struct DLL_API DiscoveryOptionsW : public OptionsBaseW { - bool auto_upgrade_bandwidth = true; - bool enforce_topology_constraints; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - bool is_out_of_band_connection = false; - const char* fast_advertisement_service_uuid; - - // Returns a copy and normalizes allowed mediums: - // (1) If is_out_of_band_connection is true, verifies that there is only one - // medium allowed, defaulting to only Bluetooth if unspecified. - // (2) If no mediums are allowed, allow all mediums. - DiscoveryOptionsW CompatibleOptions() const; -}; - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_DISCOVERY_OPTIONS_W_H_ diff --git a/connections/c/dll_config.h b/connections/c/dll_config.h deleted file mode 100644 index 345e0ed1..00000000 --- a/connections/c/dll_config.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2022 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_C_CONFIG_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_CONFIG_H_ - -namespace nearby::windows { - -#ifdef _WIN32 // These storage class specifiers only matter to win32 dll - // builds. -#ifdef CORE_ADAPTER_DLL -#define DLL_API \ - __declspec(dllexport) // If we're building the core, we're exporting. -#else // !CORE_ADAPTER_DLL -#define DLL_API \ - __declspec(dllimport) // If we're not building the core, we're importing. -#endif // CORE_ADAPTER_DLL -#else // !_WIN32 -#define DLL_API // We're not building a win32 dll, leave the source unchanged. -#endif // _WIN32 - -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_CONFIG_H_ diff --git a/connections/c/expand_version_template.bzl b/connections/c/expand_version_template.bzl deleted file mode 100644 index b7184905..00000000 --- a/connections/c/expand_version_template.bzl +++ /dev/null @@ -1,44 +0,0 @@ -"""Rule for specialized expansion of template files. This performs a simple search over the template -file for the keys $VERSION and $VS_VERSION and replaces them with the corresponding values, derived -from the version provided. Supports make variables. - -Typical usage: - load("expand_version_template.bzl", "expand_version_template") - expand_version_template( - name = "ExpandMyTemplate", - out = "my.txt", - template = "my.template", - version = varref("VERSION"), - ) - -Args: - name: The name of the rule. - out: The destination of the expanded file - template: The template file to expand - version: A string containing the version number. Supports make variables. -""" - -def expand_version_template_impl(ctx): - version = ctx.expand_make_variables( - "expand_version_template", - ctx.attr.version, - {}, - ) - vs_version = version.replace(".", ",") - ctx.actions.expand_template( - template = ctx.file.template, - output = ctx.outputs.out, - substitutions = { - "$VERSION": version, - "$VS_VERSION": vs_version, - }, - ) - -expand_version_template = rule( - implementation = expand_version_template_impl, - attrs = { - "template": attr.label(mandatory = True, allow_single_file = True), - "version": attr.string(mandatory = False), - "out": attr.output(mandatory = True), - }, -) diff --git a/connections/c/file_w.cc b/connections/c/file_w.cc deleted file mode 100644 index 0573515c..00000000 --- a/connections/c/file_w.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 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. -#include "connections/c/file_w.h" - -#include - -#include "internal/platform/file.h" - -namespace nearby { -void InputFileDeleter::operator()(nearby::InputFile* p) { delete p; } -void OutputFileDeleter::operator()(nearby::OutputFile* p) { delete p; } - -namespace windows { -InputFileW::InputFileW(InputFile* input_file) - : impl_(std::unique_ptr( - new nearby::InputFile(std::move(*input_file)))) {} -InputFileW::InputFileW(PayloadId payload_id, size_t size) - : impl_(std::unique_ptr( - new nearby::InputFile(payload_id, size))) {} -InputFileW::InputFileW(const char* file_path, size_t size) - : impl_(std::unique_ptr( - new nearby::InputFile(file_path, size))) {} -InputFileW::InputFileW(InputFileW&& other) noexcept - : impl_(std::move(other.impl_)) {} - -// Returns a string that uniquely identifies this file. -// Caller allocates buffer[MAX_PATH] and is responsible -// for freeing. -void InputFileW::GetFilePath(char* file_path) const { - std::string fp = impl_->GetFilePath(); - strncpy(file_path, fp.c_str(), fp.length()); -} - -// Returns total size of this file in bytes. -size_t InputFileW::GetTotalSize() const { return impl_->GetTotalSize(); } - -std::unique_ptr -InputFileW::GetImpl() { - return std::move(impl_); -} - -OutputFileW::OutputFileW(PayloadId payload_id) {} -OutputFileW::OutputFileW(const char* file_path) {} -OutputFileW::OutputFileW(OutputFileW&&) noexcept {} -OutputFileW& OutputFileW::operator=(OutputFileW&& other) noexcept { - impl_ = std::move(other.impl_); - return *this; -} - -std::unique_ptr -OutputFileW::GetImpl() { - return std::move(impl_); -} - -} // namespace windows -} // namespace nearby diff --git a/connections/c/file_w.h b/connections/c/file_w.h deleted file mode 100644 index 791de45f..00000000 --- a/connections/c/file_w.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 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_C_FILE_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_FILE_W_H_ - -#include -#include - -#include "connections/c/dll_config.h" -#include "internal/platform/payload_id.h" - -namespace nearby { -class InputFile; -struct DLL_API InputFileDeleter { - void operator()(InputFile* p); -}; - -class OutputFile; -struct DLL_API OutputFileDeleter { - void operator()(OutputFile* p); -}; - -} // namespace nearby - -namespace nearby { -namespace windows { - -class DLL_API InputFileW { - public: - explicit InputFileW(nearby::InputFile* input_file); - InputFileW(nearby::PayloadId payload_id, size_t size); - InputFileW(const char* file_path, size_t size); - InputFileW(InputFileW&&) noexcept; - - // Returns a string that uniquely identifies this file. - void GetFilePath(char* file_path) const; - - // Returns total size of this file in bytes. - size_t GetTotalSize() const; - - std::unique_ptr GetImpl(); - - private: - std::unique_ptr impl_; -}; - -class DLL_API OutputFileW { - public: - explicit OutputFileW(nearby::PayloadId payload_id); - explicit OutputFileW(const char* file_path); - OutputFileW(OutputFileW&&) noexcept; - OutputFileW& operator=(OutputFileW&&) noexcept; - - std::unique_ptr GetImpl(); - - private: - std::unique_ptr impl_; -}; - -} // namespace windows -} // namespace nearby - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_FILE_W_H_ diff --git a/connections/c/input_stream_w.cc b/connections/c/input_stream_w.cc deleted file mode 100644 index 1d656591..00000000 --- a/connections/c/input_stream_w.cc +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2022 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. -#include "connections/c/input_stream_w.h" - -#include "internal/platform/input_stream.h" - -namespace nearby { -void InputStreamDeleter::operator()(nearby::InputStream* p) { delete p; } -} // namespace nearby - -namespace nearby { -namespace windows { - -char* InputStreamW::Read(size_t size) { - auto result = impl_->Read(size); - if (result.ok()) { - return result.GetResult().data(); - } - return nullptr; -} - -int64_t InputStreamW::Skip(size_t offset) { - auto result = impl_->Skip(offset); - if (result.ok()) { - return result.GetResult(); - } - return -1; -} - -int64_t InputStreamW::Close() { - auto result = impl_->Close(); - if (result.Ok()) { - return 0; - } - return -1; -} - -} // namespace windows -} // namespace nearby diff --git a/connections/c/listeners_w.cc b/connections/c/listeners_w.cc deleted file mode 100644 index cfed3fac..00000000 --- a/connections/c/listeners_w.cc +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright 2022 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. - -#include -#include - -#include "connections/c/listeners_w.h" - -#include "connections/listeners.h" - -namespace nearby { -// Must implement Deleters, since the connections classes weren't -// fully defined in the header -namespace connections { -void ConnectionListenerDeleter::operator()(connections::ConnectionListener *p) { - delete p; -} -void DiscoveryListenerDeleter::operator()(connections::DiscoveryListener *p) { - delete p; -} -void PayloadListenerDeleter::operator()(connections::PayloadListener *p) { - delete p; -} -} // namespace connections - -namespace windows { - -static ResultCallbackW *ResultCallbackImpl; - -void ResultCB(Status status) { ResultCallbackImpl->result_cb(status); } - -ResultCallbackW::ResultCallbackW() - : impl(std::make_unique(ResultCB)) { - ResultCallbackImpl = this; -} - -ResultCallbackW::~ResultCallbackW() {} - -ResultCallbackW::ResultCallbackW(ResultCallbackW &other) { - impl = std::move(other.impl); -} - -ResultCallbackW::ResultCallbackW(ResultCallbackW &&other) noexcept { - impl = std::move(other.impl); -} - -ConnectionListenerW::ConnectionListenerW(InitiatedCB initiatedCB, - AcceptedCB acceptedCB, - RejectedCB rejectedCB, - DisconnectedCB disconnectedCB, - BandwidthChangedCB bandwidthChangedCB) - : initiated_cb(initiatedCB), - accepted_cb(acceptedCB), - rejected_cb(rejectedCB), - disconnected_cb(disconnectedCB), - bandwidth_changed_cb(bandwidthChangedCB), - impl_(std::unique_ptr( - new connections::ConnectionListener())) { - CHECK(initiated_cb != nullptr); - auto i = initiated_cb; - impl_->initiated_cb = - [i](const std::string &endpoint_id, - const connections::ConnectionResponseInfo connection_response_info) { - ConnectionResponseInfoW connection_response_info_w{ - connection_response_info.remote_endpoint_info.data(), - connection_response_info.remote_endpoint_info.size(), - connection_response_info.authentication_token.c_str(), - connection_response_info.raw_authentication_token.data(), - connection_response_info.raw_authentication_token.size(), - connection_response_info.is_incoming_connection, - connection_response_info.is_connection_verified}; - i(endpoint_id.c_str(), connection_response_info_w); - }; - - CHECK(accepted_cb != nullptr); - auto a = accepted_cb; - impl_->accepted_cb = [a](const std::string &endpoint_id) { - a(endpoint_id.c_str()); - }; - - CHECK(rejected_cb != nullptr); - auto r = rejected_cb; - impl_->rejected_cb = [r](const std::string &endpoint_id, Status status) { - r(endpoint_id.c_str(), status); - }; - - CHECK(disconnected_cb != nullptr); - auto d = disconnected_cb; - impl_->disconnected_cb = [d](const std::string &endpoint_id) { - d(endpoint_id.c_str()); - }; - - CHECK(bandwidth_changed_cb != nullptr); - auto bwc = bandwidth_changed_cb; - impl_->bandwidth_changed_cb = [bwc](const std::string &endpoint_id, - connections::Medium medium) { - bwc(endpoint_id.c_str(), medium); - }; -} - -ConnectionListenerW::ConnectionListenerW(ConnectionListenerW &other) { - impl_ = std::move(other.impl_); - accepted_cb = other.accepted_cb; - bandwidth_changed_cb = other.bandwidth_changed_cb; - disconnected_cb = other.disconnected_cb; - initiated_cb = other.initiated_cb; - rejected_cb = other.rejected_cb; -} - -ConnectionListenerW::ConnectionListenerW(ConnectionListenerW &&other) noexcept = - default; - -DiscoveryListenerW::DiscoveryListenerW( - EndpointFoundCB endpointFoundCB, EndpointLostCB endpointLostCB, - EndpointDistanceChangedCB endpointDistanceChangedCB) - : endpoint_found_cb(endpointFoundCB), - endpoint_lost_cb(endpointLostCB), - endpoint_distance_changed_cb(endpointDistanceChangedCB), - impl_(new connections::DiscoveryListener()) { - CHECK(endpoint_distance_changed_cb != nullptr); - auto epdc = endpoint_distance_changed_cb; - impl_->endpoint_distance_changed_cb = - [epdc](const std::string &endpoint_id, - connections::DistanceInfo distance_info) { - DistanceInfoW distanceInfoW = DistanceInfoW::kUnknown; - switch (distance_info) { - case connections::DistanceInfo::kFar: - distanceInfoW = DistanceInfoW::kFar; - break; - case connections::DistanceInfo::kClose: - distanceInfoW = DistanceInfoW::kFar; - break; - case connections::DistanceInfo::kVeryClose: - distanceInfoW = DistanceInfoW::kVeryClose; - break; - case connections::DistanceInfo::kUnknown: - break; - } - epdc(endpoint_id.c_str(), distanceInfoW); - }; - - CHECK(endpoint_found_cb != nullptr); - auto epf = endpoint_found_cb; - impl_->endpoint_found_cb = [epf](const std::string &endpoint_id, - ByteArray endpoint_info, - const std::string &service_id) { - epf(endpoint_id.c_str(), endpoint_info.data(), endpoint_info.size(), - service_id.c_str()); - }; - - CHECK(endpoint_lost_cb != nullptr); - auto epl = endpoint_lost_cb; - impl_->endpoint_lost_cb = [epl](const std::string &endpoint_id) { - epl(endpoint_id.c_str()); - }; -} - -DiscoveryListenerW::DiscoveryListenerW(DiscoveryListenerW &other) { - endpoint_distance_changed_cb = other.endpoint_distance_changed_cb; - endpoint_found_cb = other.endpoint_found_cb; - endpoint_lost_cb = other.endpoint_lost_cb; - impl_ = std::move(other.impl_); -} - -DiscoveryListenerW::DiscoveryListenerW(DiscoveryListenerW &&other) noexcept { - endpoint_distance_changed_cb = other.endpoint_distance_changed_cb; - endpoint_found_cb = other.endpoint_found_cb; - endpoint_lost_cb = other.endpoint_lost_cb; - impl_ = std::move(other.impl_); -} - -PayloadListenerW::PayloadListenerW(PayloadCB payloadCB, - PayloadProgressCB payloadProgressCB) - : payload_cb(payloadCB), - payload_progress_cb(payloadProgressCB), - impl_(std::unique_ptr( - new connections::PayloadListener())) { - CHECK(payload_cb != nullptr); - auto pcb = payload_cb; - impl_->payload_cb = [pcb](absl::string_view endpoint_id, - connections::Payload payload) { - PayloadW payloadW; - - switch (payload.GetType()) { - case connections::PayloadType::kBytes: { - payloadW = PayloadW(payload.GetId(), payload.AsBytes().data(), - payload.AsBytes().size()); - break; - } - case connections::PayloadType::kFile: { - InputFileW file(std::move(payload.AsFile())); - payloadW = PayloadW(payload.GetId(), std::move(file)); - } break; - - // TODO(jfcarroll): Figure out how to capture type kStream. - // case connections::PayloadType::kStream: { - // payloadW = PayloadW(payload.AsStream()); - //} - case connections::PayloadType::kStream: { - InputFileW file(std::move(payload.AsFile())); - payloadW = PayloadW(payload.GetId(), std::move(file)); - } break; - case connections::PayloadType::kUnknown: { - // Throw exception here? - break; - } - } - pcb(std::string(endpoint_id).c_str(), payloadW); - }; - - CHECK(payload_progress_cb != nullptr); - auto ppcb = payload_progress_cb; - impl_->payload_progress_cb = - [ppcb](absl::string_view endpoint_id, - connections::PayloadProgressInfo payload_progress_info) { - PayloadProgressInfoW payload_progress_info_w; - payload_progress_info_w.payload_id = payload_progress_info.payload_id; - payload_progress_info_w.total_bytes = payload_progress_info.total_bytes; - payload_progress_info_w.bytes_transferred = - payload_progress_info.bytes_transferred; - - switch (payload_progress_info.status) { - case connections::PayloadProgressInfo::Status::kCanceled: - payload_progress_info_w.status = - PayloadProgressInfoW::Status::kCanceled; - break; - case connections::PayloadProgressInfo::Status::kFailure: - payload_progress_info_w.status = - PayloadProgressInfoW::Status::kFailure; - break; - case connections::PayloadProgressInfo::Status::kInProgress: - payload_progress_info_w.status = - PayloadProgressInfoW::Status::kInProgress; - break; - case connections::PayloadProgressInfo::Status::kSuccess: - payload_progress_info_w.status = - PayloadProgressInfoW::Status::kSuccess; - break; - } - - ppcb(std::string(endpoint_id).c_str(), payload_progress_info_w); - }; -} - -PayloadListenerW::PayloadListenerW(PayloadListenerW &other) { - impl_ = std::move(other.impl_); -} - -PayloadListenerW::PayloadListenerW(PayloadListenerW &&other) noexcept { - impl_ = std::move(other.impl_); -} - -} // namespace windows -} // namespace nearby diff --git a/connections/c/listeners_w.h b/connections/c/listeners_w.h deleted file mode 100644 index 5d69acfd..00000000 --- a/connections/c/listeners_w.h +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright 2022 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_C_LISTENERS_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_LISTENERS_W_H_ - -#include -#include - -// This file defines all the protocol listeners and their parameter structures. -// Listeners are defined as collections of std::function instances, which is -// more flexible than a virtual function: -// - a subset of listener callbacks may be overridden, while others may remain -// default-initialized. -// - callbacks may be initialized with lambdas; lambda definitions are concize. - -#include "connections/c/medium_selector_w.h" -#include "connections/c/payload_w.h" -#include "connections/status.h" -#include "internal/platform/payload_id.h" - -namespace nearby { -// Forward declarations -namespace connections { -struct ConnectionListener; -struct DLL_API ConnectionListenerDeleter { - void operator()(connections::ConnectionListener* p); -}; - -struct DiscoveryListener; -struct DLL_API DiscoveryListenerDeleter { - void operator()(connections::DiscoveryListener* p); -}; - -struct PayloadListener; -struct DLL_API PayloadListenerDeleter { - void operator()(connections::PayloadListener* p); -}; - -using ResultCallback = absl::AnyInvocable; - -struct ConnectionResponseInfo; -struct PayloadProgressInfo; -} // namespace connections - -namespace windows { - -using ::nearby::connections::Status; - -template -T DefaultConstructor() { - return T(); -} -template -void DefaultConstructor(T t) {} -template -void DefaultConstructor(T t, C c) {} -template -void DefaultConstructor(T t, C c, size_t size, D d) {} - -extern "C" { - -// Common callback for asynchronously invoked methods. -// Called after a job scheduled for execution is completed. -// This is not the same as completion of the associated process, -// which may have many states, and multiple async jobs, and be still ongoing. -// Progress on the overall process is reported by the associated listener. -struct DLL_API ResultCallbackW { - // Callback to access the status of the operation when available. - // status - result of job execution; - // Status::kSuccess, if successful; anything else indicates failure. - ResultCallbackW(); - ~ResultCallbackW(); - ResultCallbackW(ResultCallbackW& other); - ResultCallbackW(ResultCallbackW&& other) noexcept; - - void (*result_cb)(Status status) = DefaultConstructor; - - std::unique_ptr GetImpl() { - return std::move(impl); - } - - private: - std::unique_ptr impl; -}; - -struct DLL_API ConnectionResponseInfoW { - const char* remote_endpoint_info; - size_t remote_endpoint_info_size; - const char* authentication_token; - const char* raw_authentication_token; - size_t raw_authentication_token_size; - bool is_incoming_connection = false; - bool is_connection_verified = false; -}; - -struct DLL_API PayloadProgressInfoW { - PayloadId payload_id = 0; - enum class Status { - kSuccess, - kFailure, - kInProgress, - kCanceled, - } status = Status::kSuccess; - size_t total_bytes = 0; - size_t bytes_transferred = 0; -}; - -enum class DLL_API DistanceInfoW { - kUnknown = 1, - kVeryClose = 2, - kClose = 3, - kFar = 4, -}; - -struct DLL_API ConnectionListenerW { - typedef void (*InitiatedCB)(const char* endpoint_id, - const ConnectionResponseInfoW& info); - - typedef void (*AcceptedCB)(const char* endpoint_id); - typedef void (*RejectedCB)(const char* endpoint_id, Status status); - - typedef void (*DisconnectedCB)(const char* endpoint_id); - typedef void (*BandwidthChangedCB)(const char* endpoint_id, MediumW medium); - - ConnectionListenerW(InitiatedCB, AcceptedCB, RejectedCB, DisconnectedCB, - BandwidthChangedCB); - ConnectionListenerW(ConnectionListenerW& other); - ConnectionListenerW(ConnectionListenerW&& other) noexcept; - - // A basic encrypted channel has been created between you and the endpoint. - // Both sides are now asked if they wish to accept or reject the connection - // before any data can be sent over this channel. - // - // This is your chance, before you accept the connection, to confirm that you - // connected to the correct device. Both devices are given an identical token; - // it's up to you to decide how to verify it before proceeding. Typically this - // involves showing the token on both devices and having the users manually - // compare and confirm; however, this is only required if you desire a secure - // connection between the devices. - // - // Whichever route you decide to take (including not authenticating the other - // device), call Core::AcceptConnection() when you're ready to talk, or - // Core::RejectConnection() to close the connection. - // - // endpoint_id - The identifier for the remote endpoint. - // info - Other relevant information about the connection. - InitiatedCB initiated_cb = DefaultConstructor; - - // Called after both sides have accepted the connection. - // Both sides may now send Payloads to each other. - // Call Core::SendPayload() or wait for incoming PayloadListener::OnPayload(). - // - // endpoint_id - The identifier for the remote endpoint. - AcceptedCB accepted_cb = DefaultConstructor; - - // Called when either side rejected the connection. - // Payloads can not be exchanged. Call Core::DisconnectFromEndpoint() - // to terminate connection. - // - // endpoint_id - The identifier for the remote endpoint. - RejectedCB rejected_cb = DefaultConstructor; - - // Called when a remote endpoint is disconnected or has become unreachable. - // At this point service (re-)discovery may start again. - // - // endpoint_id - The identifier for the remote endpoint. - DisconnectedCB disconnected_cb = DefaultConstructor; - - // Called when the connection's available bandwidth has changed. - // - // endpoint_id - The identifier for the remote endpoint. - // medium - Medium we upgraded to. - BandwidthChangedCB bandwidth_changed_cb = DefaultConstructor; - - std::unique_ptr - GetImpl() { - return std::move(impl_); - } - - private: - std::unique_ptr - impl_; -}; - -struct DLL_API DiscoveryListenerW { - typedef void (*EndpointFoundCB)(const char* endpoint_id, - const char* endpoint_info, - size_t endpoint_info_size, - const char* service_id); - typedef void (*EndpointLostCB)(const char* endpoint_id); - typedef void (*EndpointDistanceChangedCB)(const char* endpoint_id, - DistanceInfoW info); - - DiscoveryListenerW(EndpointFoundCB endpointFoundCB, - EndpointLostCB endpointLostCB, - EndpointDistanceChangedCB endpointDistanceChangedCB); - DiscoveryListenerW(DiscoveryListenerW& other); - DiscoveryListenerW(DiscoveryListenerW&& other) noexcept; - - // Called when a remote endpoint is discovered. - // - // endpoint_id - The ID of the remote endpoint that was discovered. - // endpoint_info - The info of the remote endpoint represented by ByteArray. - // service_id - The ID of the service advertised by the remote endpoint. - EndpointFoundCB endpoint_found_cb = DefaultConstructor; - - // Called when a remote endpoint is no longer discoverable; only called for - // endpoints that previously had been passed to {@link - // #onEndpointFound(String, DiscoveredEndpointInfo)}. - // - // endpoint_id - The ID of the remote endpoint that was lost. - EndpointLostCB endpoint_lost_cb = DefaultConstructor; - - // Called when a remote endpoint is found with an updated distance. - // - // arguments: - // endpoint_id - The ID of the remote endpoint that was lost. - // info - The distance info, encoded as enum value. - EndpointDistanceChangedCB endpoint_distance_changed_cb = DefaultConstructor; - - std::unique_ptr - GetImpl() { - return std::move(impl_); - } - - private: - std::unique_ptr - impl_; -}; - -struct DLL_API PayloadListenerW { - typedef void (*PayloadCB)(const char* endpoint_id, PayloadW& payload); - typedef void (*PayloadProgressCB)(const char* endpoint_id, - const PayloadProgressInfoW& info); - - PayloadListenerW(PayloadCB, PayloadProgressCB); - PayloadListenerW(PayloadListenerW& other); - PayloadListenerW(PayloadListenerW&& other) noexcept; - - // Called when a Payload is received from a remote endpoint. Depending - // on the type of the Payload, all of the data may or may not have been - // received at the time of this call. Use OnPayloadProgress() to - // get updates on the status of the data received. - // - // endpoint_id - The identifier for the remote endpoint that sent the - // payload. - // payload - The Payload object received. - PayloadCB payload_cb = DefaultConstructor; - - // Called with progress information about an active Payload transfer, either - // incoming or outgoing. - // - // endpoint_id - The identifier for the remote endpoint that is sending or - // receiving this payload. - // info - The PayloadProgressInfo structure describing the status of - // the transfer. - PayloadProgressCB payload_progress_cb = DefaultConstructor; - - std::unique_ptr - GetImpl() { - return std::move(impl_); - } - - private: - std::unique_ptr - impl_; -}; - -} // extern "C" -} // namespace windows -} // namespace nearby - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_LISTENERS_W_H_ diff --git a/connections/c/medium_selector_w.h b/connections/c/medium_selector_w.h deleted file mode 100644 index 555cad0e..00000000 --- a/connections/c/medium_selector_w.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 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_C_MEDIUM_SELECTOR_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_MEDIUM_SELECTOR_W_H_ - -#include - -#include "proto/connections_enums.pb.h" - -namespace nearby::windows { - -using MediumW = ::location::nearby::proto::connections::Medium; - -// Feature On/Off switch for mediums. -struct BooleanMediumSelectorW { - bool bluetooth; - bool ble; - bool web_rtc; - bool wifi_lan; - bool wifi_hotspot; - bool wifi_direct; - - BooleanMediumSelectorW() = default; - constexpr BooleanMediumSelectorW(const BooleanMediumSelectorW&) = default; - constexpr BooleanMediumSelectorW& operator=(const BooleanMediumSelectorW&) = - default; - constexpr bool Any(const bool value) const { - return bluetooth == value || ble == value || web_rtc == value || - wifi_lan == value || wifi_hotspot == value || wifi_direct == value; - } - - constexpr bool All(const bool value) const { - return bluetooth == value && ble == value && web_rtc == value && - wifi_lan == value && wifi_hotspot == value && wifi_direct == value; - } - - constexpr int Count(const bool value) const { - int count = 0; - if (bluetooth == value) ++count; - if (ble == value) ++count; - if (wifi_lan == value) ++count; - if (wifi_hotspot == value) ++count; - if (wifi_direct == value) ++count; - if (web_rtc == value) ++count; - return count; - } - - constexpr BooleanMediumSelectorW& SetAll(const bool value) { - bluetooth = value; - ble = value; - web_rtc = value; - wifi_lan = value; - wifi_hotspot = value; - wifi_direct = value; - return *this; - } - - std::vector GetMediums(const bool value) const { - std::vector mediums; - // Mediums are sorted in order of decreasing preference. - if (wifi_lan == value) mediums.push_back(MediumW::WIFI_LAN); - if (wifi_direct == value) mediums.push_back(MediumW::WIFI_DIRECT); - if (wifi_hotspot == value) mediums.push_back(MediumW::WIFI_HOTSPOT); - if (web_rtc == value) mediums.push_back(MediumW::WEB_RTC); - if (bluetooth == value) mediums.push_back(MediumW::BLUETOOTH); - if (ble == value) mediums.push_back(MediumW::BLE); - return mediums; - } -}; - -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_MEDIUM_SELECTOR_W_H_ diff --git a/connections/c/nc.cc b/connections/c/nc.cc new file mode 100644 index 00000000..5ce6ca01 --- /dev/null +++ b/connections/c/nc.cc @@ -0,0 +1,671 @@ +// Copyright 2024 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. + +#include "connections/c/nc.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "absl/base/no_destructor.h" +#include "absl/container/flat_hash_map.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "connections/advertising_options.h" +#include "connections/c/nc_types.h" +#include "connections/connection_options.h" +#include "connections/core.h" +#include "connections/discovery_options.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/params.h" +#include "connections/payload.h" +#include "connections/status.h" +#include "connections/strategy.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/bluetooth_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/file.h" +#include "internal/platform/logging.h" + +namespace nearby::connections { +class Core; +class ServiceController; +class ServiceControllerRouter; +class OfflineServiceController; +} // namespace nearby::connections + +typedef struct NcContext { + ::nearby::connections::ServiceControllerRouter* router = nullptr; + ::nearby::connections::Core* core = nullptr; +} NcContext; + +absl::NoDestructor> kNcContextMap; + +int64_t getFileSize(const char* filename) { + struct stat file_status; + if (stat(filename, &file_status) < 0) { + return -1; + } + + return file_status.st_size; +} + +int convertStringToInt(absl::string_view data) { + if (data.size() != 4) { + return 0; + } + + return (data[0]) | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); +} + +std::string convertIntToString(int input) { + std::string result; + result.resize(4); + result[0] = input & 0xff; + result[1] = (input >> 8) & 0xff; + result[2] = (input >> 16) & 0xff; + result[3] = (input >> 24) & 0xff; + return result; +} + +NcContext* GetContext(NC_INSTANCE instance) { + auto it = kNcContextMap->find(instance); + if (it == kNcContextMap->end()) { + return nullptr; + } + return &it->second; +} + +::nearby::connections::ConnectionRequestInfo GetCppConnectionRequestInfo( + NC_INSTANCE instance, + const NC_CONNECTION_REQUEST_INFO& connection_request_info) { + ::nearby::connections::ConnectionRequestInfo cpp_connection_request_info; + cpp_connection_request_info.endpoint_info = + nearby::ByteArray(connection_request_info.endpoint_info.data, + connection_request_info.endpoint_info.size); + ::nearby::connections::ConnectionListener cpp_connection_listener; + cpp_connection_listener.accepted_cb = [=](const std::string& endpoint_id) { + connection_request_info.accepted_callback(instance, + convertStringToInt(endpoint_id)); + }; + cpp_connection_listener.bandwidth_changed_cb = + [=](const std::string& endpoint_id, + ::nearby::connections::Medium medium) { + connection_request_info.bandwidth_changed_callback( + instance, convertStringToInt(endpoint_id), + static_cast(medium)); + }; + cpp_connection_listener.disconnected_cb = + [=](const std::string& endpoint_id) { + connection_request_info.disconnected_callback( + instance, convertStringToInt(endpoint_id)); + }; + cpp_connection_listener.initiated_cb = + [=](const std::string& endpoint_id, + const ::nearby::connections::ConnectionResponseInfo& info) { + NC_CONNECTION_RESPONSE_INFO connection_response_info; + connection_response_info.is_connection_verified = + info.is_connection_verified; + connection_response_info.is_incoming_connection = + info.is_incoming_connection; + connection_response_info.remote_endpoint_info.data = + (char*)info.remote_endpoint_info.data(); + connection_response_info.remote_endpoint_info.size = + info.remote_endpoint_info.size(); + connection_response_info.authentication_token.data = + (char*)info.authentication_token.data(); + connection_response_info.authentication_token.size = + info.authentication_token.size(); + connection_response_info.raw_authentication_token.data = + (char*)info.raw_authentication_token.data(); + connection_response_info.raw_authentication_token.size = + info.raw_authentication_token.size(); + + connection_request_info.initiated_callback( + instance, convertStringToInt(endpoint_id), + &connection_response_info); + }; + + cpp_connection_listener.rejected_cb = + [=](const std::string& endpoint_id, + ::nearby::connections::Status status) { + connection_request_info.rejected_callback( + instance, convertStringToInt(endpoint_id), + static_cast(status.value)); + }; + + cpp_connection_request_info.listener = std::move(cpp_connection_listener); + return cpp_connection_request_info; +} + +NC_INSTANCE NcCreateService() { + NcContext nc_context; + nc_context.router = new ::nearby::connections::ServiceControllerRouter(); + nc_context.core = new ::nearby::connections::Core(nc_context.router); + + kNcContextMap->insert({nc_context.core, nc_context}); + return nc_context.core; +} + +void NcCloseService(NC_INSTANCE instance) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + NEARBY_LOGS(WARNING) << "Trying to close not existent service " << instance; + return; + } + + nc_context->core->StopAllEndpoints([](::nearby::connections::Status status) { + NEARBY_LOGS(INFO) << "Stopping all endpoints with status " + << status.ToString(); + }); + + kNcContextMap->erase(nc_context->core); + delete nc_context->router; + delete nc_context->core; +} + +void NcStartAdvertising( + NC_INSTANCE instance, const NC_DATA* service_id, + const NC_ADVERTISING_OPTIONS* advertising_options, + const NC_CONNECTION_REQUEST_INFO* connection_request_info, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + ::nearby::connections::ConnectionRequestInfo cpp_connection_request_info = + GetCppConnectionRequestInfo(instance, *connection_request_info); + + ::nearby::connections::AdvertisingOptions cpp_advertising_options; + cpp_advertising_options.allowed.ble = + advertising_options->common_options.allowed_mediums[NC_MEDIUM_BLE]; + cpp_advertising_options.allowed.bluetooth = + advertising_options->common_options.allowed_mediums[NC_MEDIUM_BLUETOOTH]; + cpp_advertising_options.allowed.wifi_lan = + advertising_options->common_options.allowed_mediums[NC_MEDIUM_WIFI_LAN]; + cpp_advertising_options.allowed.wifi_direct = + advertising_options->common_options + .allowed_mediums[NC_MEDIUM_WIFI_DIRECT]; + cpp_advertising_options.allowed.wifi_hotspot = + advertising_options->common_options + .allowed_mediums[NC_MEDIUM_WIFI_HOTSPOT]; + cpp_advertising_options.allowed.web_rtc = + advertising_options->common_options.allowed_mediums[NC_MEDIUM_WEB_RTC]; + cpp_advertising_options.enable_bluetooth_listening = + advertising_options->enable_bluetooth_listening; + cpp_advertising_options.enable_webrtc_listening = + advertising_options->enable_webrtc_listening; + cpp_advertising_options.auto_upgrade_bandwidth = + advertising_options->auto_upgrade_bandwidth; + cpp_advertising_options.enforce_topology_constraints = + advertising_options->enforce_topology_constraints; + if (advertising_options->fast_advertisement_service_uuid.size > 0) { + cpp_advertising_options.fast_advertisement_service_uuid = + std::string(advertising_options->fast_advertisement_service_uuid.data, + advertising_options->fast_advertisement_service_uuid.size); + } + + cpp_advertising_options.is_out_of_band_connection = + advertising_options->is_out_of_band_connection; + cpp_advertising_options.low_power = advertising_options->low_power; + + if (advertising_options->common_options.strategy.type == + NC_STRATEGY_TYPE_NONE) { + cpp_advertising_options.strategy = ::nearby::connections::Strategy::kNone; + } + if (advertising_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_CLUSTER) + cpp_advertising_options.strategy = + ::nearby::connections::Strategy::kP2pCluster; + if (advertising_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_POINT_TO_POINT) + cpp_advertising_options.strategy = + ::nearby::connections::Strategy::kP2pPointToPoint; + if (advertising_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_STAR) + cpp_advertising_options.strategy = + ::nearby::connections::Strategy::kP2pStar; + + nc_context->core->StartAdvertising( + std::string(service_id->data, service_id->size), + std::move(cpp_advertising_options), + std::move(cpp_connection_request_info), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcStopAdvertising(NC_INSTANCE instance, NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->StopAdvertising([=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcStartDiscovery(NC_INSTANCE instance, const NC_DATA* service_id, + const NC_DISCOVERY_OPTIONS* discovery_options, + const NC_DISCOVERY_LISTENER* discovery_listener, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + ::nearby::connections::DiscoveryOptions cpp_discovery_options; + + if (discovery_options->common_options.strategy.type == NC_STRATEGY_TYPE_NONE) + cpp_discovery_options.strategy = ::nearby::connections::Strategy::kNone; + if (discovery_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_CLUSTER) + cpp_discovery_options.strategy = + ::nearby::connections::Strategy::kP2pCluster; + if (discovery_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_POINT_TO_POINT) + cpp_discovery_options.strategy = + ::nearby::connections::Strategy::kP2pPointToPoint; + if (discovery_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_STAR) + cpp_discovery_options.strategy = ::nearby::connections::Strategy::kP2pStar; + cpp_discovery_options.auto_upgrade_bandwidth = + discovery_options->auto_upgrade_bandwidth; + cpp_discovery_options.enforce_topology_constraints = + discovery_options->enforce_topology_constraints; + cpp_discovery_options.is_out_of_band_connection = + discovery_options->is_out_of_band_connection; + if (discovery_options->fast_advertisement_service_uuid.size > 0) { + cpp_discovery_options.fast_advertisement_service_uuid = + std::string(discovery_options->fast_advertisement_service_uuid.data, + discovery_options->fast_advertisement_service_uuid.size); + } + cpp_discovery_options.low_power = discovery_options->low_power; + cpp_discovery_options.allowed.bluetooth = + discovery_options->common_options.allowed_mediums[NC_MEDIUM_BLUETOOTH]; + cpp_discovery_options.allowed.ble = + discovery_options->common_options.allowed_mediums[NC_MEDIUM_BLE]; + cpp_discovery_options.allowed.wifi_lan = + discovery_options->common_options.allowed_mediums[NC_MEDIUM_WIFI_LAN]; + cpp_discovery_options.allowed.wifi_hotspot = + discovery_options->common_options.allowed_mediums[NC_MEDIUM_WIFI_HOTSPOT]; + cpp_discovery_options.allowed.web_rtc = + discovery_options->common_options.allowed_mediums[NC_MEDIUM_WEB_RTC]; + + NC_DISCOVERY_LISTENER discovery_listener_copy = *discovery_listener; + ::nearby::connections::DiscoveryListener listener; + listener.endpoint_distance_changed_cb = + [=](const std::string& endpoint_id, + ::nearby::connections::DistanceInfo info) { + discovery_listener_copy.endpoint_distance_changed_callback( + instance, convertStringToInt(endpoint_id), + static_cast(info)); + }; + listener.endpoint_found_cb = [=](const std::string& endpoint_id, + const nearby::ByteArray& endpoint_info, + const std::string& service_id) { + NC_DATA endpoint_info_data = { + .size = static_cast(endpoint_info.size()), + .data = (char*)endpoint_info.data()}; + NC_DATA service_id_data = {.size = static_cast(service_id.size()), + .data = (char*)service_id.data()}; + discovery_listener_copy.endpoint_found_callback( + instance, convertStringToInt(endpoint_id), &endpoint_info_data, + &service_id_data); + }; + + listener.endpoint_lost_cb = [=](const std::string& endpoint_id) { + discovery_listener_copy.endpoint_lost_callback( + instance, convertStringToInt(endpoint_id)); + }; + nc_context->core->StartDiscovery( + std::string(service_id->data, service_id->size), + std::move(cpp_discovery_options), std::move(listener), + [result_callback = + std::move(result_callback)](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcStopDiscovery(NC_INSTANCE instance, NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->StopDiscovery([=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcInjectEndpoint(NC_INSTANCE instance, const NC_DATA* service_id, + const NC_OUT_OF_BAND_CONNECTION_METADATA* metadata, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + ::nearby::connections::OutOfBandConnectionMetadata + cpp_out_of_band_connection_metadata; + cpp_out_of_band_connection_metadata.endpoint_id = metadata->endpoint_id; + cpp_out_of_band_connection_metadata.endpoint_info = { + metadata->endpoint_info.data, + static_cast(metadata->endpoint_info.size)}; + cpp_out_of_band_connection_metadata.medium = + static_cast<::nearby::connections::Medium>(metadata->medium); + cpp_out_of_band_connection_metadata.remote_bluetooth_mac_address = { + metadata->remote_bluetooth_mac_address.data, + static_cast(metadata->remote_bluetooth_mac_address.size)}; + + nc_context->core->InjectEndpoint( + std::string(service_id->data, service_id->size), + cpp_out_of_band_connection_metadata, + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcRequestConnection( + NC_INSTANCE instance, int endpoint_id, + const NC_CONNECTION_REQUEST_INFO* connection_request_info, + const NC_CONNECTION_OPTIONS* connection_options, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + ::nearby::connections::ConnectionRequestInfo cpp_connection_request_info = + GetCppConnectionRequestInfo(instance, *connection_request_info); + + ::nearby::connections::ConnectionOptions cpp_connection_options; + cpp_connection_options.allowed.ble = + connection_options->common_options.allowed_mediums[NC_MEDIUM_BLE]; + cpp_connection_options.allowed.bluetooth = + connection_options->common_options.allowed_mediums[NC_MEDIUM_BLUETOOTH]; + cpp_connection_options.allowed.web_rtc = + connection_options->common_options.allowed_mediums[NC_MEDIUM_WEB_RTC]; + cpp_connection_options.allowed.wifi_lan = + connection_options->common_options.allowed_mediums[NC_MEDIUM_WIFI_LAN]; + cpp_connection_options.auto_upgrade_bandwidth = + connection_options->auto_upgrade_bandwidth; + cpp_connection_options.enforce_topology_constraints = + connection_options->enforce_topology_constraints; + if (connection_options->fast_advertisement_service_uuid.size > 0) { + cpp_connection_options.fast_advertisement_service_uuid = + std::string(connection_options->fast_advertisement_service_uuid.data, + connection_options->fast_advertisement_service_uuid.size); + } + cpp_connection_options.is_out_of_band_connection = + connection_options->is_out_of_band_connection; + cpp_connection_options.keep_alive_interval_millis = + connection_options->keep_alive_interval_millis; + cpp_connection_options.keep_alive_timeout_millis = + connection_options->keep_alive_timeout_millis; + cpp_connection_options.low_power = connection_options->low_power; + if (connection_options->remote_bluetooth_mac_address.size > 0) { + cpp_connection_options.remote_bluetooth_mac_address = + nearby::BluetoothUtils::FromString( + std::string(connection_options->remote_bluetooth_mac_address.data, + connection_options->remote_bluetooth_mac_address.size)); + } + if (connection_options->common_options.strategy.type == NC_STRATEGY_TYPE_NONE) + cpp_connection_options.strategy = ::nearby::connections::Strategy::kNone; + if (connection_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_CLUSTER) + cpp_connection_options.strategy = + ::nearby::connections::Strategy::kP2pCluster; + if (connection_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_POINT_TO_POINT) + cpp_connection_options.strategy = + ::nearby::connections::Strategy::kP2pPointToPoint; + if (connection_options->common_options.strategy.type == + NC_STRATEGY_TYPE_P2P_STAR) + cpp_connection_options.strategy = ::nearby::connections::Strategy::kP2pStar; + + nc_context->core->RequestConnection( + convertIntToString(endpoint_id), std::move(cpp_connection_request_info), + std::move(cpp_connection_options), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcAcceptConnection(NC_INSTANCE instance, int endpoint_id, + NC_PAYLOAD_LISTENER payload_listener, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + ::nearby::connections::PayloadListener cpp_payload_listener; + cpp_payload_listener.payload_cb = + [=](absl::string_view endpoint_id, + ::nearby::connections::Payload payload) { + NC_PAYLOAD nc_payload; + nc_payload.id = payload.GetId(); + nc_payload.direction = NC_PAYLOAD_DIRECTION_INCOMING; + nc_payload.type = static_cast(payload.GetType()); + if (nc_payload.type == NC_PAYLOAD_TYPE_BYTES) { + nearby::ByteArray bytes = payload.AsBytes(); + nc_payload.content.bytes.content.data = bytes.data(); + nc_payload.content.bytes.content.size = bytes.size(); + } else if (nc_payload.type == NC_PAYLOAD_TYPE_FILE) { + nc_payload.content.file.file_name = + (char*)payload.GetFileName().c_str(); + nc_payload.content.file.parent_folder = + (char*)payload.GetParentFolder().c_str(); + nc_payload.content.file.offset = payload.GetOffset(); + } else if (nc_payload.type == NC_PAYLOAD_TYPE_STREAM) { + // TODO(guogang): support stream later. + } + + payload_listener.received_callback( + instance, convertStringToInt(endpoint_id), &nc_payload); + }; + + cpp_payload_listener.payload_progress_cb = + [=](absl::string_view endpoint_id, + const ::nearby::connections::PayloadProgressInfo& progress) { + NC_PAYLOAD_PROGRESS_INFO nc_payload_progress_info; + nc_payload_progress_info.id = progress.payload_id; + nc_payload_progress_info.bytes_transferred = progress.bytes_transferred; + nc_payload_progress_info.total_bytes = progress.total_bytes; + nc_payload_progress_info.status = + static_cast(progress.status); + payload_listener.progress_updated_callback( + instance, convertStringToInt(endpoint_id), + &nc_payload_progress_info); + }; + + nc_context->core->AcceptConnection( + convertIntToString(endpoint_id), std::move(cpp_payload_listener), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcRejectConnection(NC_INSTANCE instance, int endpoint_id, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->RejectConnection( + convertIntToString(endpoint_id), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcSendPayload(NC_INSTANCE instance, size_t endpoint_ids_size, + const int* endpoint_ids, const NC_PAYLOAD* payload, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + std::vector endpoint_ids_vector; + for (size_t i = 0; i < endpoint_ids_size; ++i) { + endpoint_ids_vector.push_back(convertIntToString(endpoint_ids[i])); + } + + absl::Span endpoint_ids_span(endpoint_ids_vector.data(), + endpoint_ids_size); + ::nearby::connections::Payload cpp_payload; + if (payload->type == NC_PAYLOAD_TYPE_BYTES) { + cpp_payload = ::nearby::connections::Payload( + payload->id, nearby::ByteArray(payload->content.bytes.content.data, + payload->content.bytes.content.size)); + } else if (payload->type == NC_PAYLOAD_TYPE_FILE) { + // get file size + std::string full_file_name = ""; + if (payload->content.file.parent_folder == nullptr) { + full_file_name = payload->content.file.file_name; + } else { + full_file_name = absl::StrCat(payload->content.file.parent_folder, "/", + payload->content.file.file_name); + } + + nearby::InputFile input_file(full_file_name, + getFileSize(full_file_name.c_str())); + cpp_payload = + ::nearby::connections::Payload(payload->id, std::move(input_file)); + } else if (payload->type == NC_PAYLOAD_TYPE_STREAM) { + // TODO(guogang): support stream later. + } + + nc_context->core->SendPayload( + endpoint_ids_span, std::move(cpp_payload), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcCancelPayload(NC_INSTANCE instance, NC_PAYLOAD_ID payload_id, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->CancelPayload( + payload_id, [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcDisconnectFromEndpoint(NC_INSTANCE instance, int endpoint_id, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->DisconnectFromEndpoint( + convertIntToString(endpoint_id), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcStopAllEndpoints(NC_INSTANCE instance, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->StopAllEndpoints([=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +void NcInitiateBandwidthUpgrade(NC_INSTANCE instance, int endpoint_id, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->InitiateBandwidthUpgrade( + convertIntToString(endpoint_id), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} + +int NcGetLocalEndpointId(NC_INSTANCE instance) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + return 0; + } + + std::string endpoint_id = nc_context->core->GetLocalEndpointId(); + return convertStringToInt(endpoint_id); +} + +void NcEnableBleV2(NC_INSTANCE instance, bool enable, + NcCallbackResult result_callback) { + nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue( + ::nearby::connections::config_package_nearby::nearby_connections_feature:: + kEnableBleV2, + enable); + result_callback(NC_STATUS_SUCCESS); +} + +void NcSetCustomSavePath(NC_INSTANCE instance, const NC_DATA* save_path, + NcCallbackResult result_callback) { + NcContext* nc_context = GetContext(instance); + if (nc_context == nullptr) { + result_callback(NC_STATUS_ERROR); + return; + } + + nc_context->core->SetCustomSavePath( + std::string(save_path->data, save_path->size), + [=](::nearby::connections::Status status) { + result_callback(static_cast(status.value)); + }); +} diff --git a/connections/c/nc.h b/connections/c/nc.h new file mode 100644 index 00000000..6452a6eb --- /dev/null +++ b/connections/c/nc.h @@ -0,0 +1,178 @@ +// Copyright 2024 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_C_NC_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_C_NC_H_ + +#include + +#include "connections/c/nc_def.h" +#include "connections/c/nc_types.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Creates a new Nearby Connections service. +NC_API NC_INSTANCE NcCreateService(); +NC_API void NcCloseService(NC_INSTANCE instance); + +// Starts adververtising an endpoint using Nearby Connections. +// +// instance - The returned instance by NcOpenService. +// service_id - The ID for the service to be advertised. +// advertising_options - The options for advertising. +// connection_request_info - Connection parameters, including endpoint info +// and listeners. +// result_callback - The result of the API operation. +NC_API void NcStartAdvertising( + NC_INSTANCE instance, const NC_DATA* service_id, + const NC_ADVERTISING_OPTIONS* advertising_options, + const NC_CONNECTION_REQUEST_INFO* connection_request_info, + NcCallbackResult result_callback); + +// Stops advertising a local endpoint. It should be called after calling +// StartAdvertising. +// +// instance - The instance is used to start advertising. +// result_callback - The result of the API operation. +NC_API void NcStopAdvertising(NC_INSTANCE instance, + NcCallbackResult result_callback); + +// Starts to discover for remote endpoints with the specified service ID. +// +// instance - The returned instance by NcOpenService. +// service_id - The ID for the service to be discovered. +// discovery_options - The options for discovery. +// discovery_listener - The callbacks notified when a remote endpoint is +// reported. +// result_callback - The result of the API operation. +NC_API void NcStartDiscovery(NC_INSTANCE instance, const NC_DATA* service_id, + const NC_DISCOVERY_OPTIONS* discovery_options, + const NC_DISCOVERY_LISTENER* discovery_listener, + NcCallbackResult result_callback); + +// Stops discovering for a running discovery. +// +// instance - The instance is used to start discovery. +// result_callback - The result of the API operation. +NC_API void NcStopDiscovery(NC_INSTANCE instance, + NcCallbackResult result_callback); + +// Invokes the discovery callback from a previous call to NcStartDiscovery() +// with the given endpoint info. The previous call to NcStartDiscovery() must +// have been passed ConnectionOptions with is_out_of_band_connection == true. +// +// instance - The instance is used to start discovery. +// service_id - The ID for the service to be discovered, as specified in the +// corresponding call to NcStartDiscovery(). +// metadata - Metadata used in order to inject the endpoint. +// result_callback - The result of the API operation. +NC_API void NcInjectEndpoint(NC_INSTANCE instance, const NC_DATA* service_id, + const NC_OUT_OF_BAND_CONNECTION_METADATA* metadata, + NcCallbackResult result_callback); + +// Sends a request to connect to a remote endpoint. +// +// instance - The returned instance by NcOpenService. +// endpoint_id - The identifier for the remote endpoint to which a +// connection request will be sent. +// connection_request_info - Connection parameters. +// connection_options - Options to connect. +// result_callback - The result of the API operation. +NC_API void NcRequestConnection( + NC_INSTANCE instance, int endpoint_id, + const NC_CONNECTION_REQUEST_INFO* connection_request_info, + const NC_CONNECTION_OPTIONS* connection_options, + NcCallbackResult result_callback); + +// Accepts a connection to a remote endpoint. +// +// instance - The returned instance by NcOpenService. +// endpoint_id - The identifier for the remote endpoint. +// payload_listener - A callback for payloads exchanged with the remote +// endpoint. +// result_callback - The result of the API operation. +NC_API void NcAcceptConnection(NC_INSTANCE instance, int endpoint_id, + NC_PAYLOAD_LISTENER payload_listener, + NcCallbackResult result_callback); + +// Rejects a connection from a remote endpoint. +// +// instance - The returned instance by NcOpenService. +// endpoint_id - The identifier for the remote endpoint. +// result_callback - The result of the API operation. +NC_API void NcRejectConnection(NC_INSTANCE instance, int endpoint_id, + NcCallbackResult result_callback); + +// Sends a Payload to a remote endpoint. +// +// instance - The returned instance by NcOpenService. +// endpoint_ids_size - The endpoint number to receive the payload. +// endpoint_ids - The endpoint ID array. +// payload - the payload will be sent. +// result_callback - The result of the API operation. +NC_API void NcSendPayload(NC_INSTANCE instance, size_t endpoint_ids_size, + const int* endpoint_ids, const NC_PAYLOAD* payload, + NcCallbackResult result_callback); + +// Cancels a Payload currently in-flight to or from remote endpoint(s). +// +// instance - The Nearby Connections instance is called by NcSendPayload. +// payload_id - The payload ID of payload to cancel. +// result_callback - The result of the API operation. +NC_API void NcCancelPayload(NC_INSTANCE instance, NC_PAYLOAD_ID payload_id, + NcCallbackResult result_callback); + +// Disconnects from a remote endpoint. +// +// instance - The returned instance by NcOpenService. +// endpoint_id - The endpoint ID of remote device to disconnect. +// result_callback - The result of the API operation. +NC_API void NcDisconnectFromEndpoint(NC_INSTANCE instance, int endpoint_id, + NcCallbackResult result_callback); + +// Disconnects from, and removes all traces of, all connected and/or +// discovered endpoints. +// +// instance - The returned instance by NcOpenService. +// result_callback - The result of the API operation. +NC_API void NcStopAllEndpoints(NC_INSTANCE instance, + NcCallbackResult result_callback); + +// Sends a request to initiate connection bandwidth upgrade. +// +// instance - The returned instance by NcOpenService. +// endpoint_id - Requested to upgrade on the remote device with the endpoint ID. +// result_callback - The result of the API operation. +NC_API void NcInitiateBandwidthUpgrade(NC_INSTANCE instance, int endpoint_id, + NcCallbackResult result_callback); + +// Gets the local endpoint generated by Nearby Connections. +NC_API int NcGetLocalEndpointId(NC_INSTANCE instance); + +// Enable/Disable BLE V2 advertising. The method should be deprecated after +// BLE V1 deprecated. +NC_API void NcEnableBleV2(NC_INSTANCE instance, bool enable, + NcCallbackResult result_callback); + +// Sets the custom save path for Nearby Connections. +NC_API void NcSetCustomSavePath(NC_INSTANCE instance, const NC_DATA* save_path, + NcCallbackResult result_callback); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_NC_H_ diff --git a/connections/c/nc_def.h b/connections/c/nc_def.h new file mode 100644 index 00000000..7af2172a --- /dev/null +++ b/connections/c/nc_def.h @@ -0,0 +1,39 @@ +// Copyright 2024 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_C_NC_DEF_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_C_NC_DEF_H_ + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +#ifdef _WIN32 // These storage class specifiers only matter to win32 dll + // builds. +#ifdef NC_DLL +// If we're building the core, we're exporting. +#define NC_API __declspec(dllexport) +#else // !NC_DLL +// If we're not building the core, we're importing. +#define NC_API __declspec(dllimport) +#endif // NC_DLL +#else // !_WIN32 +#define NC_API // We're not building a win32 dll, leave the source unchanged. +#endif // _WIN32 + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_NC_DEF_H_ diff --git a/connections/c/nc_types.h b/connections/c/nc_types.h new file mode 100644 index 00000000..7b7bcc16 --- /dev/null +++ b/connections/c/nc_types.h @@ -0,0 +1,307 @@ +// Copyright 2024 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_C_NC_TYPES_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_C_NC_TYPES_H_ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef void* NC_INSTANCE; + +typedef int64_t NC_PAYLOAD_ID; + +// NC_DATA is used to define a byte array. Its last byte is not zero. +typedef struct NC_DATA { + int64_t size; + char* data; +} NC_DATA, *PNC_DATA; + +// Supported mediums by Nearby Connections. +typedef enum NC_MEDIUM { + NC_MEDIUM_UNKNOWN = 0, + NC_MEDIUM_MDNS = 1, // deprecated + NC_MEDIUM_BLUETOOTH = 2, + NC_MEDIUM_WIFI_HOTSPOT = 3, + NC_MEDIUM_BLE = 4, + NC_MEDIUM_WIFI_LAN = 5, + NC_MEDIUM_WIFI_AWARE = 6, + NC_MEDIUM_NFC = 7, + NC_MEDIUM_WIFI_DIRECT = 8, + NC_MEDIUM_WEB_RTC = 9, + NC_MEDIUM_BLE_L2CAP = 10, + NC_MEDIUM_USB = 11, + NC_MEDIUM_MAX = 12 +} NC_MEDIUM; + +typedef enum NC_CONNECTION_TYPE { + NC_CONNECTION_TYPE_NONE = 0, + NC_CONNECTION_TYPE_POINT_TO_POINT = 1, +} NC_CONNECTION_TYPE; + +typedef enum NC_TOPOLOGY_TYPE { + NC_TOPOLOGY_TYPE_UNKNOWN = 0, + NC_TOPOLOGY_TYPE_ONE_TO_ONE = 1, + NC_TOPOLOGY_TYPE_ONE_TO_MANY = 2, + NC_TOPOLOGY_TYPE_MANY_TO_MANY = 3, +} NC_TOPOLOGY_TYPE; + +typedef enum NC_STRATEGY_TYPE { + NC_STRATEGY_TYPE_NONE, + NC_STRATEGY_TYPE_P2P_CLUSTER, + NC_STRATEGY_TYPE_P2P_STAR, + NC_STRATEGY_TYPE_P2P_POINT_TO_POINT +} NC_STRATEGY_TYPE; + +typedef enum NC_DISTANCE_INFO { + NC_DISTANCE_INFO_UNKNOWN = 1, + NC_DISTANCE_INFO_VERYCLOSE = 2, + NC_DISTANCE_INFO_CLOSE = 3, + NC_DISTANCE_INFO_FAR = 4, +} NC_DISTANCE_INFO; + +typedef enum NC_STATUS { + NC_STATUS_SUCCESS, + NC_STATUS_ERROR, + NC_STATUS_OUTOFORDERAPICALL, + NC_STATUS_ALREADYHAVEACTIVESTRATEGY, + NC_STATUS_ALREADYADVERTISING, + NC_STATUS_ALREADYDISCOVERING, + NC_STATUS_ALREADYLISTENING, + NC_STATUS_ENDPOINTIOERROR, + NC_STATUS_ENDPOINTUNKNOWN, + NC_STATUS_CONNECTIONREJECTED, + NC_STATUS_ALREADYCONNECTEDTOENDPOINT, + NC_STATUS_NOTCONNECTEDTOENDPOINT, + NC_STATUS_BLUETOOTHERROR, + NC_STATUS_BLEERROR, + NC_STATUS_WIFILANERROR, + NC_STATUS_PAYLOADUNKNOWN, + NC_STATUS_RESET, + NC_STATUS_TIMEOUT, + NC_STATUS_UNKNOWN, + NC_STATUS_NEXTVALUE, +} NC_STATUS; + +typedef enum NC_PAYLOAD_TYPE { + NC_PAYLOAD_TYPE_UNKNOWN = 0, + NC_PAYLOAD_TYPE_BYTES = 1, + NC_PAYLOAD_TYPE_STREAM = 2, + NC_PAYLOAD_TYPE_FILE = 3 +} NC_PAYLOAD_TYPE; + +typedef enum NC_PAYLOAD_DIRECTION { + NC_PAYLOAD_DIRECTION_UNKNOWN = 0, + NC_PAYLOAD_DIRECTION_INCOMING = 1, + NC_PAYLOAD_DIRECTION_OUTGOING = 2, +} NC_PAYLOAD_DIRECTION; + +typedef enum NC_IO_EXCEPTION { + NC_IO_EXCEPTION_FAILED = -1, + NC_IO_EXCEPTION_SUCCESS = 0, + NC_IO_EXCEPTION_IO = 1, + NC_IO_EXCEPTION_INTERRUPTED = 2, + NC_IO_EXCEPTION_INVALID_PROTOCOL_BUFFER = 3, + NC_IO_EXCEPTION_EXECUTION = 4, + NC_IO_EXCEPTION_TIMEOUT = 5, + NC_IO_EXCEPTION_ILLEGALCHARACTERS = 6, +} NC_IO_EXCEPTION; + +// Defines struct types in Nearby connections. + +typedef struct NC_STRATEGY { + NC_STRATEGY_TYPE type; + NC_CONNECTION_TYPE connection_type; + NC_TOPOLOGY_TYPE topology_type; +} NC_STRATEGY; + +typedef struct NC_COMMON_OPTIONS { + NC_STRATEGY strategy; + bool allowed_mediums[NC_MEDIUM_MAX]; +} NC_COMMON_OPTIONS; + +typedef struct NC_ADVERTISING_OPTIONS { + NC_COMMON_OPTIONS common_options; + bool auto_upgrade_bandwidth; + bool enforce_topology_constraints; + bool enable_bluetooth_listening; + bool enable_webrtc_listening; + bool low_power; + bool is_out_of_band_connection; + NC_DATA fast_advertisement_service_uuid; + NC_DATA device_info; +} NC_ADVERTISING_OPTIONS, *PNC_ADVERTISING_OPTIONS; + +typedef struct NC_CONNECTION_OPTIONS { + NC_COMMON_OPTIONS common_options; + bool auto_upgrade_bandwidth; + bool enforce_topology_constraints; + bool low_power; + bool is_out_of_band_connection; + NC_DATA remote_bluetooth_mac_address; + NC_DATA fast_advertisement_service_uuid; + int keep_alive_interval_millis; + int keep_alive_timeout_millis; +} NC_CONNECTION_OPTIONS, *PNC_CONNECTION_OPTIONS; + +typedef struct NC_DISCOVERY_OPTIONS { + NC_COMMON_OPTIONS common_options; + bool auto_upgrade_bandwidth; + bool enforce_topology_constraints; + + // Whether this is intended to be used in conjunction with InjectEndpoint(). + bool is_out_of_band_connection; + NC_DATA fast_advertisement_service_uuid; + bool low_power; +} NC_DISCOVERY_OPTIONS, *PNC_DISCOVERY_OPTIONS; + +typedef struct NC_CONNECTION_RESPONSE_INFO { + NC_DATA remote_endpoint_info; + NC_DATA authentication_token; + NC_DATA raw_authentication_token; + bool is_incoming_connection; + bool is_connection_verified; +} NC_CONNECTION_RESPONSE_INFO, *PNC_CONNECTION_RESPONSE_INFO; + +// Defines callbacks in Nearby Connections. + +typedef void (*NcCallbackResult)(NC_STATUS status); + +typedef void (*NcCallbackConnectionInitiated)( + NC_INSTANCE instance, int endpoint_id, + const NC_CONNECTION_RESPONSE_INFO* info); +typedef void (*NcCallbackConnectionAccepted)(NC_INSTANCE instance, + int endpoint_id); +typedef void (*NcCallbackConnectionRejected)(NC_INSTANCE instance, + int endpoint_id, NC_STATUS status); +typedef void (*NcCallbackConnectionDisconnected)(NC_INSTANCE instance, + int endpoint_id); +typedef void (*NcCallbackConnectionBandwidthChanged)(NC_INSTANCE instance, + int endpoint_id, + NC_MEDIUM medium); + +typedef struct NC_CONNECTION_REQUEST_INFO { + NC_DATA endpoint_info; + NcCallbackConnectionInitiated initiated_callback; + NcCallbackConnectionAccepted accepted_callback; + NcCallbackConnectionRejected rejected_callback; + NcCallbackConnectionDisconnected disconnected_callback; + NcCallbackConnectionBandwidthChanged bandwidth_changed_callback; +} NC_CONNECTION_REQUEST_INFO; + +typedef void (*NcCallbackDiscoveryEndpointFound)(NC_INSTANCE instance, + int endpoint_id, + const NC_DATA* endpoint_info, + const NC_DATA* service_id); +typedef void (*NcCallbackDiscoveryEndpointLost)(NC_INSTANCE instance, + int endpoint_id); +typedef void (*NcCallbackDiscoveryEndpointDistanceChanged)( + NC_INSTANCE instance, int endpoint_id, NC_DISTANCE_INFO info); + +typedef struct NC_DISCOVERY_LISTENER { + NcCallbackDiscoveryEndpointFound endpoint_found_callback; + NcCallbackDiscoveryEndpointLost endpoint_lost_callback; + NcCallbackDiscoveryEndpointDistanceChanged endpoint_distance_changed_callback; +} NC_DISCOVERY_LISTENER; + +typedef struct NC_BYTES_PAYLOAD { + NC_DATA content; +} NC_BYTES_PAYLOAD; + +typedef int (*NcCallbackStreamRead)(NC_INSTANCE stream, char* buffer, + int64_t size); +typedef int (*NcCallbackStreamClose)(NC_INSTANCE stream); +typedef int (*NcCallbackStreamSkip)(NC_INSTANCE stream, int64_t skip); + +typedef struct NC_STREAM_PAYLOAD { + NC_INSTANCE stream; + NcCallbackStreamRead read_callback; + NcCallbackStreamSkip skip_callback; + NcCallbackStreamClose close_callback; +} NC_STREAM_PAYLOAD; + +typedef struct NC_FILE_PAYLOAD { + int64_t offset; + char* file_name; + char* parent_folder; +} NC_FILE_PAYLOAD; + +typedef union NC_PAYLOAD_CONTENT { + NC_BYTES_PAYLOAD bytes; + NC_STREAM_PAYLOAD stream; + NC_FILE_PAYLOAD file; +} NC_PAYLOAD_CONTENT; + +typedef struct NC_PAYLOAD { + NC_PAYLOAD_ID id; + NC_PAYLOAD_TYPE type; + NC_PAYLOAD_DIRECTION direction; + NC_PAYLOAD_CONTENT content; +} NC_PAYLOAD; + +typedef enum NC_PAYLOAD_PROGRESS_INFO_STATUS { + NC_PAYLOAD_PROGRESS_INFO_STATUS_SUCCESS, + NC_PAYLOAD_PROGRESS_INFO_STATUS_FAILURE, + NC_PAYLOAD_PROGRESS_INFO_STATUS_INPROGRESS, + NC_PAYLOAD_PROGRESS_INFO_STATUS_CANCELED, +} NC_PAYLOAD_PROGRESS_INFO_STATUS; + +typedef struct NC_PAYLOAD_PROGRESS_INFO { + NC_PAYLOAD_ID id; + NC_PAYLOAD_PROGRESS_INFO_STATUS status; + size_t total_bytes; + size_t bytes_transferred; +} NC_PAYLOAD_PROGRESS_INFO; + +typedef void (*NcCallbackPayloadReceived)(NC_INSTANCE instance, int endpoint_id, + const NC_PAYLOAD* payload); +typedef void (*NcCallbackPayloadProgressUpdated)( + NC_INSTANCE instance, int endpoint_id, + const NC_PAYLOAD_PROGRESS_INFO* info); + +typedef struct NC_PAYLOAD_LISTENER { + NcCallbackPayloadReceived received_callback; + NcCallbackPayloadProgressUpdated progress_updated_callback; +} NC_PAYLOAD_LISTENER; + +typedef struct NC_OUT_OF_BAND_CONNECTION_METADATA { + // Medium to use for the out-of-band connection. + NC_MEDIUM medium; + + // Endpoint ID to use for the injected connection; will be included in the + // endpoint_found_cb callback. Must be exactly 4 bytes and should be randomly- + // generated such that no two IDs are identical. + int endpoint_id; + + // Endpoint info to use for the injected connection; will be included in the + // endpoint_found_cb callback. Should uniquely identify the InjectEndpoint() + // call so that the client which made the call can verify the endpoint + // that was found is the one that was injected. + // + // Cannot be empty, and must be <131 bytes. + NC_DATA endpoint_info; + + // Used for Bluetooth connections. + NC_DATA remote_bluetooth_mac_address; +} NC_OUT_OF_BAND_CONNECTION_METADATA, *PNC_OUT_OF_BAND_CONNECTION_METADATA; + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_NC_TYPES_H_ diff --git a/connections/c/options_base_w.h b/connections/c/options_base_w.h deleted file mode 100644 index 605af7cf..00000000 --- a/connections/c/options_base_w.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2022 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_C_OPTIONS_BASE_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_OPTIONS_BASE_W_H_ - -#include "connections/c/medium_selector_w.h" -#include "connections/c/strategy_w.h" - -namespace nearby::windows { - -extern "C" { - -// Connection Options: used for both Advertising and Discovery. -// All fields are mutable, to make the type copy-assignable. -struct OptionsBaseW { - nearby::windows::StrategyW strategy; - BooleanMediumSelectorW allowed{BooleanMediumSelectorW().SetAll(true)}; -}; - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_OPTIONS_BASE_W_H_ diff --git a/connections/c/out_of_band_connection_metadata_w.h b/connections/c/out_of_band_connection_metadata_w.h deleted file mode 100644 index a29305d8..00000000 --- a/connections/c/out_of_band_connection_metadata_w.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 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_C_OUT_OF_BAND_CONNECTION_METADATA_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_OUT_OF_BAND_CONNECTION_METADATA_H_ - -#include - -#include "connections/c/medium_selector_w.h" -#include "connections/c/strategy_w.h" -#include "internal/platform/byte_array.h" -#include "proto/connections_enums.pb.h" - -namespace nearby::windows { - -extern "C" { - -// Metadata injected to facilitate out-of-band connections. The medium field is -// required, and the other fields are only specified for a specific medium. -// Currently, Bluetooth is the only supported medium for out-of-band -// connections. -struct DLL_API OutOfBandConnectionMetadataW { - // Medium to use for the out-of-band connection. - MediumW medium; - - // Endpoint ID to use for the injected connection; will be included in the - // endpoint_found_cb callback. Must be exactly 4 bytes and should be randomly- - // generated such that no two IDs are identical. - const char* endpoint_id; - - // Endpoint info to use for the injected connection; will be included in the - // endpoint_found_cb callback. Should uniquely identify the InjectEndpoint() - // call so that the client which made the call can verify the endpoint - // that was found is the one that was injected. - // - // Cannot be empty, and must be <131 bytes. - const char* endpoint_info; - size_t endpoint_info_size; - - // Used for Bluetooth connections. - const char* remote_bluetooth_mac_address; - size_t remote_bluetooth_mac_address_size; -}; - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_OUT_OF_BAND_CONNECTION_METADATA_H_ diff --git a/connections/c/params_w.h b/connections/c/params_w.h deleted file mode 100644 index 5c5b825a..00000000 --- a/connections/c/params_w.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2022 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_C_PARAMS_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_PARAMS_W_H_ - -#include - -#include "connections/c/listeners_w.h" - -namespace nearby::windows { - -extern "C" { - -// Used by Discovery in Core::RequestConnection(). -// Used by Advertising in Core::StartAdvertising(). -struct DLL_API ConnectionRequestInfoW { - // endpoint_info - Identifying information about this endpoint (eg. name, - // device type). - // listener - A set of callbacks notified when remote endpoints request a - // connection to this endpoint. - // ByteArray endpoint_info; - const char* endpoint_info; - size_t endpoint_info_size; - ConnectionListenerW& listener; -}; - -} // extern "C" -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_PARAMS_W_H_ diff --git a/connections/c/payload_w.cc b/connections/c/payload_w.cc deleted file mode 100644 index 5faf69c0..00000000 --- a/connections/c/payload_w.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2022 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. -#include "connections/c/payload_w.h" - -#include -#include -#include -#include - -#include "connections/c/file_w.h" -#include "connections/payload.h" -#include "connections/payload_type.h" -#include "internal/platform/byte_array.h" -#include "internal/platform/input_stream.h" -#include "internal/platform/payload_id.h" - -namespace nearby { -// Must implement Deleter since Payload wasn't fully defined in -// the header -namespace connections { -class Payload; -void PayloadDeleter::operator()(connections::Payload *p) { delete p; } - -} // namespace connections -namespace windows { - -PayloadW::PayloadW() - : impl_(std::unique_ptr( - new connections::Payload())) {} - -PayloadW::~PayloadW() = default; -PayloadW::PayloadW(PayloadW &&other) noexcept : impl_(std::move(other.impl_)) {} - -PayloadW &PayloadW::operator=(PayloadW &&other) noexcept { - impl_ = std::move(other.impl_); - return *this; -} - -// Constructors for outgoing payloads. -PayloadW::PayloadW(const char *bytes, const size_t bytes_size) - : impl_(std::unique_ptr( - new connections::Payload(ByteArray(bytes, bytes_size)))) {} - -PayloadW::PayloadW(InputFileW &file) - : impl_(std::unique_ptr( - new connections::Payload(InputFile(std::move(*file.GetImpl()))))) {} - -PayloadW::PayloadW(std::unique_ptr stream) - : impl_(std::unique_ptr( - new connections::Payload(std::move(stream)))) {} - -// Constructors for incoming payloads. -PayloadW::PayloadW(PayloadId id, const char *bytes, const size_t bytes_size) - : impl_(std::unique_ptr( - new connections::Payload(id, ByteArray(bytes, bytes_size)))) {} - -PayloadW::PayloadW(PayloadId id, InputFileW file) - : impl_(std::unique_ptr( - new connections::Payload(id, std::move(*file.GetImpl())))) {} - -PayloadW::PayloadW(const char *parent_folder, const char *file_name, - InputFileW file) - : impl_(std::unique_ptr( - new connections::Payload(parent_folder, file_name, - std::move(*file.GetImpl())))) {} - -PayloadW::PayloadW(PayloadId id, std::unique_ptr stream) - : impl_(std::unique_ptr( - new connections::Payload(id, std::move(stream)))) {} - -// Returns ByteArray payload, if it has been defined, or empty ByteArray. -bool PayloadW::AsBytes(const char *&bytes, size_t &bytes_size) const & { - auto byteArray = impl_->AsBytes(); - if (bytes_size < byteArray.size()) { - bytes_size = byteArray.size(); - bytes = nullptr; - return false; - } - - bytes_size = byteArray.size(); - bytes = byteArray.data(); - return true; -} -bool PayloadW::AsBytes(const char *&bytes, size_t &bytes_size) && { - auto byteArray = impl_->AsBytes(); - if (bytes_size < byteArray.size()) { - bytes_size = byteArray.size(); - bytes = nullptr; - return false; - } - - bytes_size = byteArray.size(); - bytes = byteArray.data(); - return true; -} -// Returns InputStream* payload, if it has been defined, or nullptr. -InputStream *PayloadW::AsStream() { return impl_->AsStream(); } -// Returns InputFile* payload, if it has been defined, or nullptr. -InputFile *PayloadW::AsFile() const { return impl_->AsFile(); } - -// Returns Payload unique ID. -int64_t PayloadW::GetId() const { return impl_->GetId(); } - -// Returns Payload type. -const connections::PayloadType PayloadW::GetType() const { - return static_cast(impl_->GetType()); -} - -// Sets the payload offset in bytes -void PayloadW::SetOffset(size_t offset) { impl_->SetOffset(offset); } - -size_t PayloadW::GetOffset() { return impl_->GetOffset(); } - -// Generate Payload Id; to be passed to outgoing file constructor. -PayloadId PayloadW::GenerateId() { return connections::Payload::GenerateId(); } - -const char *PayloadW::GetParentFolder() const { return nullptr; } - -const char *PayloadW::GetFileName() const { return nullptr; } - -std::unique_ptr -PayloadW::GetImpl() { - return std::move(impl_); -} - -} // namespace windows -} // namespace nearby diff --git a/connections/c/payload_w.h b/connections/c/payload_w.h deleted file mode 100644 index 17972e6e..00000000 --- a/connections/c/payload_w.h +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2022 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_C_PAYLOAD_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_PAYLOAD_W_H_ - -#include -#include -#include -#include - -#include "connections/c/dll_config.h" -#include "connections/c/file_w.h" -#include "connections/payload_type.h" -#include "internal/platform/payload_id.h" - -namespace nearby { -namespace connections { - -class Payload; -struct PayloadDeleter { - void operator()(Payload* p); -}; -} // namespace connections -} // namespace nearby - -namespace nearby { - -class InputFile; -class InputStream; - -} // namespace nearby - -namespace nearby { -namespace windows { - -extern "C" { - -// Payload is default-constructible, and moveable, but not copyable container -// that holds at most one instance of one of: -// ByteArray, InputStream, or InputFile. -class DLL_API PayloadW { - public: - PayloadW(PayloadW&& other) noexcept; - PayloadW& operator=(PayloadW&& other) noexcept; - - // Default (invalid) payload. - PayloadW(); - ~PayloadW(); - - // Constructors for outgoing payloads. - explicit PayloadW(const char* bytes, size_t size); - - explicit PayloadW(InputFileW& file); - explicit PayloadW(std::unique_ptr stream); - - // Constructors for incoming payloads. - PayloadW(PayloadId id, const char* bytes, size_t size); - PayloadW(PayloadId id, InputFileW file); - explicit PayloadW(const char* parent_folder, const char* file_name, - InputFileW file); - - PayloadW(PayloadId id, std::unique_ptr stream); - // Returns ByteArray payload, if it has - // been defined, or empty ByteArray. - bool AsBytes(const char*& bytes, size_t& bytes_size) const&; - bool AsBytes(const char*& bytes, size_t& bytes_size) &&; - // Returns InputStream* payload, if it has been defined, or nullptr. - InputStream* AsStream(); - // Returns InputFile* payload, if it has been defined, or nullptr. - InputFile* AsFile() const; - - // Returns Payload unique ID. - int64_t GetId() const; - - // Returns Payload type. - const nearby::connections::PayloadType GetType() const; - - // Sets the payload offset in bytes - void SetOffset(size_t offset); - - size_t GetOffset(); - - // Generate Payload Id; to be passed to outgoing file constructor. - static PayloadId GenerateId(); - - const char* GetFileName() const; - const char* GetParentFolder() const; - - std::unique_ptr GetImpl(); - - private: - std::unique_ptr impl_; -}; - -} // extern "C" - -} // namespace windows -} // namespace nearby - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_PAYLOAD_W_H_ diff --git a/connections/c/strategy_w.cc b/connections/c/strategy_w.cc deleted file mode 100644 index 08e10f45..00000000 --- a/connections/c/strategy_w.cc +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2022 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. - -#include "connections/c/strategy_w.h" - -#include - -namespace nearby::windows { - -const StrategyW StrategyW::kNone = {StrategyW::ConnectionType::kNone, - StrategyW::TopologyType::kUnknown}; -const StrategyW StrategyW::kP2pCluster{StrategyW::ConnectionType::kPointToPoint, - StrategyW::TopologyType::kManyToMany}; -const StrategyW StrategyW::kP2pStar{StrategyW::ConnectionType::kPointToPoint, - StrategyW::TopologyType::kOneToMany}; -const StrategyW StrategyW::kP2pPointToPoint{ - StrategyW::ConnectionType::kPointToPoint, - StrategyW::TopologyType::kOneToOne}; - -// static -const StrategyW& StrategyW::GetStrategyNone() { return StrategyW::kNone; } - -// static -const StrategyW& StrategyW::GetStrategyP2pCluster() { - return StrategyW::kP2pCluster; -} - -// static -const StrategyW& StrategyW::GetStrategyP2pStar() { return StrategyW::kP2pStar; } - -// static -const StrategyW& StrategyW::GetStrategyPointToPoint() { - return StrategyW::kP2pPointToPoint; -} - -bool StrategyW::IsNone() const { return *this == kNone; } - -bool StrategyW::IsValid() const { - return *this == kP2pStar || *this == kP2pCluster || *this == kP2pPointToPoint; -} - -std::string StrategyW::GetName() const { - if (*this == StrategyW::kP2pCluster) { - return "P2P_CLUSTER"; - } - if (*this == StrategyW::kP2pStar) { - return "P2P_STAR"; - } - if (*this == StrategyW::kP2pPointToPoint) { - return "P2P_POINT_TO_POINT"; - } - return "UNKNOWN"; -} - -void StrategyW::Clear() { *this = kNone; } - -bool operator==(const StrategyW& lhs, const StrategyW& rhs) { - return lhs.connection_type_ == rhs.connection_type_ && - lhs.topology_type_ == rhs.topology_type_; -} - -bool operator!=(const StrategyW& lhs, const StrategyW& rhs) { - return !(lhs == rhs); -} - -} // namespace nearby::windows diff --git a/connections/c/strategy_w.h b/connections/c/strategy_w.h deleted file mode 100644 index 008a94ba..00000000 --- a/connections/c/strategy_w.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 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_C_STRATEGY_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_STRATEGY_W_H_ - -#include - -#include "connections/c/dll_config.h" - -namespace nearby::windows { - -// Defines a copyable, comparable connection strategy type. -// It is one of: kP2pCluster, kP2pStar, kP2pPointToPoint. -class DLL_API StrategyW { - public: - static const StrategyW kNone; - static const StrategyW kP2pCluster; - static const StrategyW kP2pStar; - static const StrategyW kP2pPointToPoint; - constexpr StrategyW() : StrategyW(kNone) {} - constexpr StrategyW(const StrategyW&) = default; - constexpr StrategyW& operator=(const StrategyW&) = default; - - // Helper functions for exe to access static member variables in the dll. - static const StrategyW& GetStrategyNone(); - static const StrategyW& GetStrategyP2pCluster(); - static const StrategyW& GetStrategyP2pStar(); - static const StrategyW& GetStrategyPointToPoint(); - - // Returns true, if strategy is kNone, false otherwise. - bool IsNone() const; - - // Returns true, if a strategy is one of the supported strategies, - // false otherwise. - bool IsValid() const; - - // Returns a string representing given strategy, for every valid strategy. - std::string GetName() const; - - // Undefined strategy. - void Clear(); - friend bool operator==(const StrategyW& lhs, const StrategyW& rhs); - friend bool operator!=(const StrategyW& lhs, const StrategyW& rhs); - - private: - enum class ConnectionType { - kNone = 0, - kPointToPoint = 1, - }; - enum class TopologyType { - kUnknown = 0, - kOneToOne = 1, - kOneToMany = 2, - kManyToMany = 3, - }; - constexpr StrategyW(ConnectionType connection_type, - TopologyType topology_type) - : connection_type_(connection_type), topology_type_(topology_type) {} - ConnectionType connection_type_; - TopologyType topology_type_; -}; - -} // namespace nearby::windows - -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_STRATEGY_W_H_ diff --git a/connections/c/version.rc.tpl b/connections/c/version.rc.tpl deleted file mode 100644 index 1b938f7b..00000000 --- a/connections/c/version.rc.tpl +++ /dev/null @@ -1,32 +0,0 @@ -#include "winres.h" - -VS_VERSION_INFO VERSIONINFO - FILEVERSION $VS_VERSION - PRODUCTVERSION $VS_VERSION - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Google LLC" - VALUE "FileDescription", "Nearby Connections" - VALUE "FileVersion", "$VERSION" - VALUE "LegalCopyright", "Copyright (C) 2022 Google. All rights reserved." "\0" - VALUE "ProductName", "Nearby Connections" - VALUE "ProductVersion", "$VERSION" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END \ No newline at end of file diff --git a/connections/connection_options.h b/connections/connection_options.h index e2b382a0..6f25604a 100644 --- a/connections/connection_options.h +++ b/connections/connection_options.h @@ -52,6 +52,10 @@ struct ConnectionOptions : public OptionsBase { int keep_alive_interval_millis = 0; int keep_alive_timeout_millis = 0; + // If true, only use WiFi Hotspot for connection when Wifi LAN is not + // connected. + bool non_disruptive_hotspot_mode = false; + std::vector GetMediums() const; ConnectionInfo connection_info; }; diff --git a/connections/core.cc b/connections/core.cc index 2dbb44a2..c710961e 100644 --- a/connections/core.cc +++ b/connections/core.cc @@ -14,6 +14,7 @@ #include "connections/core.h" +#include #include #include #include @@ -73,7 +74,7 @@ Core::~Core() { CountDownLatch latch(1); router_->StopAllEndpoints(&client_, [&latch](Status) { latch.CountDown(); }); if (!latch.Await(kWaitForDisconnect).result()) { - NEARBY_LOG(FATAL, "Unable to shutdown"); + NEARBY_LOGS(FATAL) << "Unable to shutdown"; } } @@ -102,8 +103,8 @@ void Core::StartDiscovery(absl::string_view service_id, CheckServiceId(service_id); CHECK(discovery_options.strategy.IsValid()); - router_->StartDiscovery(&client_, service_id, discovery_options, listener, - std::move(callback)); + router_->StartDiscovery(&client_, service_id, discovery_options, + std::move(listener), std::move(callback)); } void Core::InjectEndpoint(absl::string_view service_id, @@ -121,7 +122,10 @@ void Core::RequestConnection(absl::string_view endpoint_id, ConnectionRequestInfo info, ConnectionOptions connection_options, ResultCallback callback) { - CHECK(!endpoint_id.empty()); + if (endpoint_id.empty()) { + callback(Status{.value = Status::kEndpointUnknown}); + return; + } // Assign the default from feature flags for the keep-alive frame interval and // timeout values if client don't mind them or has the unexpected ones. @@ -129,14 +133,13 @@ void Core::RequestConnection(absl::string_view endpoint_id, connection_options.keep_alive_timeout_millis == 0 || connection_options.keep_alive_interval_millis >= connection_options.keep_alive_timeout_millis) { - NEARBY_LOG( - WARNING, - "Client request connection with keep-alive frame as interval=%d, " - "timeout=%d, which is un-expected. Change to default.", - connection_options.keep_alive_interval_millis, - connection_options.keep_alive_timeout_millis); - connection_options.keep_alive_interval_millis = - FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis; + NEARBY_LOGS(WARNING) + << "Client request connection with keep-alive frame as interval=" + << connection_options.keep_alive_interval_millis + << ", timeout=" << connection_options.keep_alive_timeout_millis + << ", which is un-expected. Change to default.", + connection_options.keep_alive_interval_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis; connection_options.keep_alive_timeout_millis = FeatureFlags::GetInstance().GetFlags().keep_alive_timeout_millis; } @@ -147,7 +150,10 @@ void Core::RequestConnection(absl::string_view endpoint_id, void Core::AcceptConnection(absl::string_view endpoint_id, PayloadListener listener, ResultCallback callback) { - CHECK(!endpoint_id.empty()); + if (endpoint_id.empty()) { + callback(Status{.value = Status::kEndpointUnknown}); + return; + } router_->AcceptConnection(&client_, endpoint_id, std::move(listener), std::move(callback)); @@ -155,7 +161,10 @@ void Core::AcceptConnection(absl::string_view endpoint_id, void Core::RejectConnection(absl::string_view endpoint_id, ResultCallback callback) { - CHECK(!endpoint_id.empty()); + if (endpoint_id.empty()) { + callback(Status{.value = Status::kEndpointUnknown}); + return; + } router_->RejectConnection(&client_, endpoint_id, std::move(callback)); } @@ -182,7 +191,10 @@ void Core::CancelPayload(std::int64_t payload_id, ResultCallback callback) { void Core::DisconnectFromEndpoint(absl::string_view endpoint_id, ResultCallback callback) { - CHECK(!endpoint_id.empty()); + if (endpoint_id.empty()) { + callback(Status{.value = Status::kEndpointUnknown}); + return; + } router_->DisconnectFromEndpoint(&client_, endpoint_id, std::move(callback)); } @@ -258,21 +270,26 @@ void Core::StartAdvertisingV3(absl::string_view service_id, CheckServiceId(service_id); CHECK(advertising_options.strategy.IsValid()); - AdvertisingOptions old_advertising_options = { - { - advertising_options.strategy, - advertising_options.advertising_mediums, - }, - advertising_options.auto_upgrade_bandwidth, - advertising_options.enforce_topology_constraints, - advertising_options.power_level == PowerLevel::kLowPower, // low_power - advertising_options.enable_bluetooth_listening, - advertising_options.advertising_mediums.web_rtc, - false, // is_out_of_band_connection - advertising_options.fast_advertisement_service_uuid, - "" // device_info - }; // TODO(b/291295755): Refactor deeper to use v3 options throughout. + AdvertisingOptions old_advertising_options = { + /*OptionsBase=*/ + { + /*strategy=*/advertising_options.strategy, + /*allowed=*/advertising_options.advertising_mediums, + }, + /*auto_upgrade_bandwidth=*/advertising_options.auto_upgrade_bandwidth, + /*enforce_topology_constraints=*/ + advertising_options.enforce_topology_constraints, + /*low_power=*/advertising_options.power_level == PowerLevel::kLowPower, + /*enable_bluetooth_listening=*/ + advertising_options.enable_bluetooth_listening, + /*enable_webrtc_listening=*/ + advertising_options.advertising_mediums.web_rtc, + /*use_stable_endpoint_id=*/advertising_options.use_stable_endpoint_id, + /*is_out_of_band_connection=*/false, + /*fast_advertisement_service_uuid=*/ + advertising_options.fast_advertisement_service_uuid, + /*device_info=*/""}; router_->StartAdvertising(&client_, service_id, old_advertising_options, old_info, std::move(callback)); } @@ -302,23 +319,26 @@ void Core::StartDiscoveryV3(absl::string_view service_id, ResultCallback callback) { DiscoveryListener old_listener = { .endpoint_found_cb = - [&listener](const std::string& endpoint_id, - const ByteArray& endpoint_info, - const std::string& service_id) { + [endpoint_found_cb = std::move(listener.endpoint_found_cb)]( + const std::string& endpoint_id, const ByteArray& endpoint_info, + const std::string& service_id) mutable { auto remote_device = v3::ConnectionsDevice( endpoint_id, endpoint_info.AsStringView(), {}); - listener.endpoint_found_cb(remote_device, service_id); + endpoint_found_cb(remote_device, service_id); }, .endpoint_lost_cb = - [&listener](const std::string& endpoint_id) { + [endpoint_lost_cb = std::move(listener.endpoint_lost_cb)]( + const std::string& endpoint_id) mutable { auto remote_device = v3::ConnectionsDevice(endpoint_id, "", {}); - listener.endpoint_lost_cb(remote_device); + endpoint_lost_cb(remote_device); }, .endpoint_distance_changed_cb = - [&listener](const std::string& endpoint_id, - DistanceInfo distance_info) { + [endpoint_distance_changed_cb = + std::move(listener.endpoint_distance_changed_cb)]( + const std::string& endpoint_id, + DistanceInfo distance_info) mutable { auto remote = v3::ConnectionsDevice(endpoint_id, "", {}); - listener.endpoint_distance_changed_cb(remote, distance_info); + endpoint_distance_changed_cb(remote, distance_info); }, }; DiscoveryOptions old_discovery_options = { @@ -333,7 +353,7 @@ void Core::StartDiscoveryV3(absl::string_view service_id, discovery_options.power_level == PowerLevel::kLowPower, }; // TODO(b/291295755): Deeper refactor to use v3 options throughout. - StartDiscovery(service_id, old_discovery_options, old_listener, + StartDiscovery(service_id, old_discovery_options, std::move(old_listener), std::move(callback)); } @@ -373,12 +393,11 @@ void Core::RequestConnectionV3(const NearbyDevice& local_device, connection_options.keep_alive_timeout_millis == 0 || connection_options.keep_alive_interval_millis >= connection_options.keep_alive_timeout_millis) { - NEARBY_LOG( - WARNING, - "Client request connection with keep-alive frame as interval=%d, " - "timeout=%d, which is un-expected. Change to default.", - connection_options.keep_alive_interval_millis, - connection_options.keep_alive_timeout_millis); + NEARBY_LOGS(WARNING) + << "Client request connection with keep-alive frame as interval=" + << connection_options.keep_alive_interval_millis + << ", timeout=" << connection_options.keep_alive_timeout_millis + << ", which is un-expected. Change to default."; connection_options.keep_alive_interval_millis = FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis; connection_options.keep_alive_timeout_millis = @@ -396,7 +415,10 @@ void Core::RequestConnectionV3(const NearbyDevice& remote_device, .local_device = const_cast(*(client_.GetLocalDevice())), .listener = std::move(connection_cb), }; - CHECK(!remote_device.GetEndpointId().empty()); + if (remote_device.GetEndpointId().empty()) { + result_cb(Status{.value = Status::kEndpointUnknown}); + return; + } // Assign the default from feature flags for the keep-alive frame interval and // timeout values if client don't mind them or has the unexpected ones. @@ -404,12 +426,11 @@ void Core::RequestConnectionV3(const NearbyDevice& remote_device, connection_options.keep_alive_timeout_millis == 0 || connection_options.keep_alive_interval_millis >= connection_options.keep_alive_timeout_millis) { - NEARBY_LOG( - WARNING, - "Client request connection with keep-alive frame as interval=%d, " - "timeout=%d, which is un-expected. Change to default.", - connection_options.keep_alive_interval_millis, - connection_options.keep_alive_timeout_millis); + NEARBY_LOGS(WARNING) + << "Client request connection with keep-alive frame as interval=" + << connection_options.keep_alive_interval_millis + << ", timeout=" << connection_options.keep_alive_timeout_millis + << ", which is un-expected. Change to default."; connection_options.keep_alive_interval_millis = FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis; connection_options.keep_alive_timeout_millis = @@ -422,7 +443,10 @@ void Core::RequestConnectionV3(const NearbyDevice& remote_device, void Core::AcceptConnectionV3(const NearbyDevice& remote_device, v3::PayloadListener listener_cb, ResultCallback result_cb) { - CHECK(!remote_device.GetEndpointId().empty()); + if (remote_device.GetEndpointId().empty()) { + result_cb(Status{.value = Status::kEndpointUnknown}); + return; + } router_->AcceptConnectionV3(&client_, remote_device, std::move(listener_cb), std::move(result_cb)); @@ -430,7 +454,10 @@ void Core::AcceptConnectionV3(const NearbyDevice& remote_device, void Core::RejectConnectionV3(const NearbyDevice& remote_device, ResultCallback result_cb) { - CHECK(!remote_device.GetEndpointId().empty()); + if (remote_device.GetEndpointId().empty()) { + result_cb(Status{.value = Status::kEndpointUnknown}); + return; + } router_->RejectConnectionV3(&client_, remote_device, std::move(result_cb)); } @@ -438,7 +465,10 @@ void Core::RejectConnectionV3(const NearbyDevice& remote_device, void Core::SendPayloadV3(const NearbyDevice& remote_device, Payload payload, ResultCallback result_cb) { CHECK(payload.GetType() != PayloadType::kUnknown); - CHECK(!remote_device.GetEndpointId().empty()); + if (remote_device.GetEndpointId().empty()) { + result_cb(Status{.value = Status::kEndpointUnknown}); + return; + } router_->SendPayloadV3(&client_, remote_device, std::move(payload), std::move(result_cb)); @@ -454,7 +484,10 @@ void Core::CancelPayloadV3(const NearbyDevice& remote_device, void Core::DisconnectFromDeviceV3(const NearbyDevice& remote_device, ResultCallback result_cb) { - CHECK(!remote_device.GetEndpointId().empty()); + if (remote_device.GetEndpointId().empty()) { + result_cb(Status{.value = Status::kEndpointUnknown}); + return; + } router_->DisconnectFromDeviceV3(&client_, remote_device, std::move(result_cb)); @@ -475,19 +508,24 @@ void Core::UpdateAdvertisingOptionsV3( ResultCallback result_cb) { // TODO(b/291295755): Deeper refactor to use new advertising options. AdvertisingOptions old_advertising_options = { + /*OptionsBase=*/ { - advertising_options.strategy, - advertising_options.advertising_mediums, + /*strategy=*/advertising_options.strategy, + /*allowed=*/advertising_options.advertising_mediums, }, - advertising_options.auto_upgrade_bandwidth, + /*auto_upgrade_bandwidth=*/advertising_options.auto_upgrade_bandwidth, + /*enforce_topology_constraints=*/ advertising_options.enforce_topology_constraints, - advertising_options.power_level == PowerLevel::kLowPower, // low_power + /*low_power=*/advertising_options.power_level == PowerLevel::kLowPower, + /*enable_bluetooth_listening=*/ advertising_options.enable_bluetooth_listening, + /*enable_webrtc_listening=*/ advertising_options.advertising_mediums.web_rtc, - false, // is_out_of_band_connection + /*use_stable_endpoint_id=*/advertising_options.use_stable_endpoint_id, + /*is_out_of_band_connection=*/false, + /*fast_advertisement_service_uuid=*/ advertising_options.fast_advertisement_service_uuid, - "" // device_info - }; + /*device_info=*/""}; router_->UpdateAdvertisingOptionsV3( &client_, service_id, old_advertising_options, std::move(result_cb)); } diff --git a/connections/core.h b/connections/core.h index 7cf6fcc8..d159767a 100644 --- a/connections/core.h +++ b/connections/core.h @@ -15,21 +15,27 @@ #ifndef CORE_CORE_H_ #define CORE_CORE_H_ +#include #include #include #include +#include #include "absl/strings/string_view.h" #include "absl/types/span.h" +#include "connections/advertising_options.h" #include "connections/connection_options.h" +#include "connections/discovery_options.h" #include "connections/implementation/client_proxy.h" -#include "connections/implementation/service_controller.h" #include "connections/implementation/service_controller_router.h" #include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" #include "connections/params.h" #include "connections/payload.h" #include "connections/v3/advertising_options.h" #include "connections/v3/connection_listening_options.h" +#include "connections/v3/connections_device_provider.h" #include "connections/v3/discovery_options.h" #include "connections/v3/listeners.h" #include "connections/v3/listening_result.h" diff --git a/connections/core_test.cc b/connections/core_test.cc index 5456963c..f995ab92 100644 --- a/connections/core_test.cc +++ b/connections/core_test.cc @@ -49,10 +49,10 @@ class FakeNearbyDevice : public NearbyDevice { NearbyDevice::Type GetType() const override { return NearbyDevice::Type::kUnknownDevice; } - MOCK_METHOD(std::string, GetEndpointId, (), (const override)); + MOCK_METHOD(std::string, GetEndpointId, (), (const, override)); MOCK_METHOD(std::vector, GetConnectionInfos, (), - (const override)); - MOCK_METHOD(std::string, ToProtoBytes, (), (const override)); + (const, override)); + MOCK_METHOD(std::string, ToProtoBytes, (), (const, override)); }; class FakeNearbyDeviceProvider : public NearbyDeviceProvider { @@ -64,70 +64,130 @@ class FakeNearbyDeviceProvider : public NearbyDeviceProvider { }; TEST(CoreTest, ConstructorDestructorWorks) { - MockServiceControllerRouter mock; + MockServiceControllerRouter mock_controller; // Called when Core is destroyed. - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { callback({Status::kSuccess}); }); - Core core{&mock}; + Core core{&mock_controller}; } TEST(CoreTest, DestructorReportsFatalFailure) { ASSERT_DEATH( { - MockServiceControllerRouter mock; + MockServiceControllerRouter mock_controller; // Never invoke the result callback so ~Core will time out. - EXPECT_CALL(mock, StopAllEndpoints); - Core core{&mock}; + EXPECT_CALL(mock_controller, StopAllEndpoints); + Core core{&mock_controller}; }, "Unable to shutdown"); } TEST(CoreTest, RequestConnectionCallsScRouter) { - MockServiceControllerRouter mock; + MockServiceControllerRouter mock_controller; // Called when Core is destroyed. - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { callback({Status::kSuccess}); }); - EXPECT_CALL(mock, RequestConnection); - Core core{&mock}; + EXPECT_CALL(mock_controller, RequestConnection); + Core core{&mock_controller}; core.RequestConnection("TEST", {}, {}, {}); } -TEST(CoreTest, AcceptConnectionCallsScRouter) { - MockServiceControllerRouter mock; +TEST(CoreTest, RequestConnectionFailsWithEmptyEndpoint) { + MockServiceControllerRouter mock_controller; // Called when Core is destroyed. - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { callback({Status::kSuccess}); }); - EXPECT_CALL(mock, AcceptConnection); - Core core{&mock}; + Status final_status; + Core core{&mock_controller}; + core.RequestConnection( + "", {}, {}, [&](Status result_status) { final_status = result_status; }); + EXPECT_EQ(final_status.value, Status::kEndpointUnknown); +} + +TEST(CoreTest, AcceptConnectionCallsScRouter) { + MockServiceControllerRouter mock_controller; + // Called when Core is destroyed. + EXPECT_CALL(mock_controller, StopAllEndpoints) + .WillOnce([&](ClientProxy* client, ResultCallback callback) { + callback({Status::kSuccess}); + }); + EXPECT_CALL(mock_controller, AcceptConnection); + Core core{&mock_controller}; core.AcceptConnection("TEST", {}, {}); } -TEST(CoreTest, SendPayloadCallsScRouter) { - MockServiceControllerRouter mock; +TEST(CoreTest, AcceptConnectionFailsWithEmptyEndpoint) { + MockServiceControllerRouter mock_controller; // Called when Core is destroyed. - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { callback({Status::kSuccess}); }); - EXPECT_CALL(mock, SendPayload); - Core core{&mock}; + Status final_status; + Core core{&mock_controller}; + core.AcceptConnection( + "", {}, [&](Status result_status) { final_status = result_status; }); + + EXPECT_EQ(final_status.value, Status::kEndpointUnknown); +} + +TEST(CoreTest, RejectConnectionFailsWithEmptyEndpoint) { + MockServiceControllerRouter mock_controller; + // Called when Core is destroyed. + EXPECT_CALL(mock_controller, StopAllEndpoints) + .WillOnce([&](ClientProxy* client, ResultCallback callback) { + callback({Status::kSuccess}); + }); + Status final_status; + Core core{&mock_controller}; + core.RejectConnection( + "", [&](Status result_status) { final_status = result_status; }); + + EXPECT_EQ(final_status.value, Status::kEndpointUnknown); +} + +TEST(CoreTest, DisconnectFailsWithEmptyEndpoint) { + MockServiceControllerRouter mock_controller; + // Called when Core is destroyed. + EXPECT_CALL(mock_controller, StopAllEndpoints) + .WillOnce([&](ClientProxy* client, ResultCallback callback) { + callback({Status::kSuccess}); + }); + Status final_status; + Core core{&mock_controller}; + core.DisconnectFromEndpoint( + "", [&](Status result_status) { final_status = result_status; }); + + EXPECT_EQ(final_status.value, Status::kEndpointUnknown); +} + + +TEST(CoreTest, SendPayloadCallsScRouter) { + MockServiceControllerRouter mock_controller; + // Called when Core is destroyed. + EXPECT_CALL(mock_controller, StopAllEndpoints) + .WillOnce([&](ClientProxy* client, ResultCallback callback) { + callback({Status::kSuccess}); + }); + EXPECT_CALL(mock_controller, SendPayload); + Core core{&mock_controller}; core.SendPayload({"TEST"}, Payload(ByteArray("Hello world")), {}); } TEST(CoreV3Test, TestAdvertisingOptionsConversionWorks) { - MockServiceControllerRouter mock; + MockServiceControllerRouter mock_controller; // Called when Core is destroyed. - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { callback({Status::kSuccess}); }); - EXPECT_CALL(mock, StartAdvertising) + EXPECT_CALL(mock_controller, StartAdvertising) .WillOnce([](ClientProxy*, absl::string_view, const AdvertisingOptions& options, const ConnectionRequestInfo& info, ResultCallback) { @@ -137,7 +197,7 @@ TEST(CoreV3Test, TestAdvertisingOptionsConversionWorks) { EXPECT_FALSE(options.auto_upgrade_bandwidth); EXPECT_EQ(options.fast_advertisement_service_uuid, "NearbyConnections"); }); - Core core{&mock}; + Core core{&mock_controller}; v3::AdvertisingOptions advertising_options = { .strategy = Strategy::kP2pCluster, .power_level = PowerLevel::kHighPower, @@ -150,22 +210,22 @@ TEST(CoreV3Test, TestAdvertisingOptionsConversionWorks) { } TEST(CoreV3Test, TestDiscoveryOptionsConversionWorks) { - MockServiceControllerRouter mock; + MockServiceControllerRouter mock_controller; // Called when Core is destroyed. - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { callback({Status::kSuccess}); }); - EXPECT_CALL(mock, StartDiscovery) + EXPECT_CALL(mock_controller, StartDiscovery) .WillOnce([](ClientProxy*, absl::string_view, - const DiscoveryOptions& options, - const DiscoveryListener& info, ResultCallback) { + const DiscoveryOptions& options, DiscoveryListener, + ResultCallback) { EXPECT_EQ(options.strategy, Strategy::kP2pCluster); EXPECT_FALSE(options.low_power); EXPECT_TRUE(options.auto_upgrade_bandwidth); EXPECT_EQ(options.fast_advertisement_service_uuid, "NearbyConnections"); }); - Core core{&mock}; + Core core{&mock_controller}; v3::DiscoveryOptions discovery_options = { .strategy = Strategy::kP2pCluster, .power_level = PowerLevel::kHighPower, @@ -176,8 +236,8 @@ TEST(CoreV3Test, TestDiscoveryOptionsConversionWorks) { } TEST(CoreV3Test, TestCallbackWrapWorksStartAdvertisingV3FourArgs) { - MockServiceControllerRouter mock; - EXPECT_CALL(mock, StartAdvertising) + MockServiceControllerRouter mock_controller; + EXPECT_CALL(mock_controller, StartAdvertising) .WillOnce([&](ClientProxy*, absl::string_view, const AdvertisingOptions&, const ConnectionRequestInfo& info, const ResultCallback&) { NEARBY_LOGS(INFO) << "StartAdvertising called"; @@ -189,12 +249,12 @@ TEST(CoreV3Test, TestCallbackWrapWorksStartAdvertisingV3FourArgs) { info.listener.bandwidth_changed_cb("FAKE", Medium::BLUETOOTH); info.listener.disconnected_cb("FAKE"); }); - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { NEARBY_LOGS(INFO) << "StopAllEndpoints called"; callback({Status::kSuccess}); }); - Core core{&mock}; + Core core{&mock_controller}; CountDownLatch result_latch(2); CountDownLatch bandwidth_changed_latch(1); CountDownLatch disconnected_latch(1); @@ -233,8 +293,8 @@ TEST(CoreV3Test, TestCallbackWrapWorksStartAdvertisingV3FourArgs) { } TEST(CoreV3Test, TestStartAdvertisingV3NonConnectionsDeviceProvider) { - MockServiceControllerRouter mock; - EXPECT_CALL(mock, StartAdvertising) + MockServiceControllerRouter mock_controller; + EXPECT_CALL(mock_controller, StartAdvertising) .WillOnce([&](ClientProxy*, absl::string_view, const AdvertisingOptions&, const ConnectionRequestInfo& info, ResultCallback) { NEARBY_LOGS(INFO) << "StartAdvertising called"; @@ -246,12 +306,12 @@ TEST(CoreV3Test, TestStartAdvertisingV3NonConnectionsDeviceProvider) { info.listener.bandwidth_changed_cb("FAKE", Medium::BLUETOOTH); info.listener.disconnected_cb("FAKE"); }); - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { NEARBY_LOGS(INFO) << "StopAllEndpoints called"; callback({Status::kSuccess}); }); - Core core{&mock}; + Core core{&mock_controller}; CountDownLatch result_latch(2); CountDownLatch bandwidth_changed_latch(1); CountDownLatch disconnected_latch(1); @@ -292,8 +352,8 @@ TEST(CoreV3Test, TestStartAdvertisingV3NonConnectionsDeviceProvider) { } TEST(CoreV3Test, TestStartAdvertisingV3NonConnectionsDevice) { - MockServiceControllerRouter mock; - EXPECT_CALL(mock, StartAdvertising) + MockServiceControllerRouter mock_controller; + EXPECT_CALL(mock_controller, StartAdvertising) .WillOnce([&](ClientProxy*, absl::string_view, const AdvertisingOptions&, const ConnectionRequestInfo& info, const ResultCallback&) { NEARBY_LOGS(INFO) << "StartAdvertising called"; @@ -305,12 +365,12 @@ TEST(CoreV3Test, TestStartAdvertisingV3NonConnectionsDevice) { info.listener.bandwidth_changed_cb("FAKE", Medium::BLUETOOTH); info.listener.disconnected_cb("FAKE"); }); - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { NEARBY_LOGS(INFO) << "StopAllEndpoints called"; callback({Status::kSuccess}); }); - Core core{&mock}; + Core core{&mock_controller}; CountDownLatch result_latch(2); CountDownLatch bandwidth_changed_latch(1); CountDownLatch disconnected_latch(1); @@ -350,8 +410,8 @@ TEST(CoreV3Test, TestStartAdvertisingV3NonConnectionsDevice) { } TEST(CoreV3Test, TestCallbackWrapWorksStartAdvertisingV3FiveArgs) { - MockServiceControllerRouter mock; - EXPECT_CALL(mock, StartAdvertising) + MockServiceControllerRouter mock_controller; + EXPECT_CALL(mock_controller, StartAdvertising) .WillOnce([&](ClientProxy*, absl::string_view, const AdvertisingOptions&, const ConnectionRequestInfo& info, const ResultCallback&) { NEARBY_LOGS(INFO) << "StartAdvertising called"; @@ -363,12 +423,12 @@ TEST(CoreV3Test, TestCallbackWrapWorksStartAdvertisingV3FiveArgs) { info.listener.bandwidth_changed_cb("FAKE", Medium::BLUETOOTH); info.listener.disconnected_cb("FAKE"); }); - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { NEARBY_LOGS(INFO) << "StopAllEndpoints called"; callback({Status::kSuccess}); }); - Core core{&mock}; + Core core{&mock_controller}; CountDownLatch result_latch(2); CountDownLatch bandwidth_changed_latch(1); CountDownLatch disconnected_latch(1); @@ -408,24 +468,24 @@ TEST(CoreV3Test, TestCallbackWrapWorksStartAdvertisingV3FiveArgs) { } TEST(CoreV3Test, TestCallbackWrapWorksStartDiscoveryV3) { - MockServiceControllerRouter mock; - EXPECT_CALL(mock, StartDiscovery) + MockServiceControllerRouter mock_controller; + EXPECT_CALL(mock_controller, StartDiscovery) .WillOnce([&](ClientProxy*, absl::string_view, const DiscoveryOptions&, - const DiscoveryListener& info, const ResultCallback&) { + DiscoveryListener listener, const ResultCallback&) { // call all callbacks to make sure it all gets called correctly. NEARBY_LOGS(INFO) << "StartDiscovery called"; - info.endpoint_distance_changed_cb("FAKE", {}); - info.endpoint_found_cb("FAKE", ByteArray(), ""); - info.endpoint_lost_cb("FAKE"); + listener.endpoint_distance_changed_cb("FAKE", {}); + listener.endpoint_found_cb("FAKE", ByteArray(), ""); + listener.endpoint_lost_cb("FAKE"); }); - EXPECT_CALL(mock, StopAllEndpoints) + EXPECT_CALL(mock_controller, StopAllEndpoints) .WillOnce([&](ClientProxy* client, ResultCallback callback) { NEARBY_LOGS(INFO) << "StopAllEndpoints called"; callback({Status::kSuccess}); }); v3::DiscoveryOptions options; options.strategy = Strategy::kP2pCluster; - Core core{&mock}; + Core core{&mock_controller}; CountDownLatch endpoint_distance_latch(1); CountDownLatch endpoint_found_latch(1); CountDownLatch endpoint_lost_latch(1); diff --git a/connections/dart/BUILD b/connections/dart/BUILD index beacb91b..79e23760 100644 --- a/connections/dart/BUILD +++ b/connections/dart/BUILD @@ -12,49 +12,69 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//third_party/lexan/build_defs:lexan.bzl", "lexan") +load("//third_party/cpptoolchains/windows_llvm/build_defs:windows.bzl", "windows") package(default_visibility = ["//location/nearby:__subpackages__"]) licenses(["notice"]) -# Build with --config=lexan -lexan.cc_windows_dll( - name = "nearby_connections_dart", +# Build with --config=windows +windows.cc_windows_dll( + name = "nc_windows_dart", srcs = [ - "core_adapter_dart.cc", + "nc_adapter_dart.cc", + "nearby_connections_client_state.cc", ], hdrs = [ - "core_adapter_dart.h", + "nc_adapter_dart.h", + "nc_adapter_def.h", + "nc_adapter_types.h", + "nearby_connections_client_state.h", ], + copts = ["-DNC_DART_DLL"], tags = ["windows-dll"], deps = [ - "//connections:core", - "//connections/c", - "//connections/implementation/flags:connections_flags", - "//internal/flags:nearby_flags", + "//connections/c:nc_types", + "//connections/c:nc_windows", + "//internal/platform:types", "//internal/platform/implementation/windows", "//third_party/dart_lang/v2:dart_api_dl", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/base:no_destructor", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/synchronization", ], ) objc_library( name = "nearby_connections_objc", srcs = [ - "core_adapter_dart.cc", + "nc_adapter_dart.cc", + "nearby_connections_client_state.cc", ], hdrs = [ - "core_adapter_dart.h", + "nc_adapter_dart.h", + "nc_adapter_def.h", + "nc_adapter_types.h", + "nearby_connections_client_state.h", ], deps = [ - "//connections:core", - "//connections:core_types", - "//connections/c", + "//connections/c:nc", + "//connections/c:nc_types", "//connections/implementation/flags:connections_flags", "//internal/flags:nearby_flags", + "//internal/platform:base", "//internal/platform:types", "//internal/platform/implementation/apple", # buildcleaner: keep "//third_party/dart_lang/v2:dart_api_dl", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/base:no_destructor", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/synchronization", ], alwayslink = 1, ) diff --git a/connections/dart/core_adapter_dart.cc b/connections/dart/core_adapter_dart.cc deleted file mode 100644 index 149b9f1f..00000000 --- a/connections/dart/core_adapter_dart.cc +++ /dev/null @@ -1,709 +0,0 @@ -// Copyright 2021-2022 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. - -#include "connections/dart/core_adapter_dart.h" - -#include -#include - -#include "connections/core.h" -#include "connections/implementation/flags/nearby_connections_feature_flags.h" -#include "connections/payload.h" -#include "internal/flags/nearby_flags.h" -#include "internal/platform/count_down_latch.h" -#include "internal/platform/logging.h" - -namespace nearby::windows { - -static CountDownLatch *adapter_finished; - -StrategyW GetStrategy(StrategyDart strategy) { - switch (strategy) { - case StrategyDart::P2P_CLUSTER: - return StrategyW::kP2pCluster; - case StrategyDart::P2P_POINT_TO_POINT: - return StrategyW::kP2pPointToPoint; - case StrategyDart::P2P_STAR: - return StrategyW::kP2pStar; - } - return StrategyW::kNone; -} - -ByteArray ConvertBluetoothMacAddress(absl::string_view address) { - return ByteArray(address.data()); -} - -static Dart_Port port; -static DiscoveryListenerDart current_discovery_listener_dart; -static ConnectionListenerDart current_connection_listener_dart; -static PayloadListenerDart current_payload_listener_dart; - -void ResultCB(Status status) { - (void)status; // Avoid unused parameter warning - Dart_CObject dart_object_result_callback; - dart_object_result_callback.type = Dart_CObject_kInt64; - dart_object_result_callback.value.as_int64 = status.value; - const bool result = Dart_PostCObject_DL(port, &dart_object_result_callback); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } - adapter_finished->CountDown(); -} - -void ListenerInitiatedCB( - const char *endpoint_id, - const ConnectionResponseInfoW &connection_response_info) { - NEARBY_LOG(INFO, "Advertising initiated: id=%s", endpoint_id); - - Dart_CObject dart_object_endpoint_id; - dart_object_endpoint_id.type = Dart_CObject_kString; - dart_object_endpoint_id.value.as_string = const_cast(endpoint_id); - - Dart_CObject dart_object_endpoint_info; - dart_object_endpoint_info.type = Dart_CObject_kString; - dart_object_endpoint_info.value.as_string = - const_cast(connection_response_info.remote_endpoint_info); - - Dart_CObject *elements[2]; - elements[0] = &dart_object_endpoint_id; - elements[1] = &dart_object_endpoint_info; - - Dart_CObject dart_object_initiated; - dart_object_initiated.type = Dart_CObject_kArray; - dart_object_initiated.value.as_array.length = 2; - dart_object_initiated.value.as_array.values = elements; - - const bool result = - Dart_PostCObject_DL(current_connection_listener_dart.initiated_dart_port, - &dart_object_initiated); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerAcceptedCB(const char *endpoint_id) { - NEARBY_LOG(INFO, "Advertising accepted: id=%s", endpoint_id); - Dart_CObject dart_object_accepted; - dart_object_accepted.type = Dart_CObject_kString; - dart_object_accepted.value.as_string = const_cast(endpoint_id); - const bool result = - Dart_PostCObject_DL(current_connection_listener_dart.accepted_dart_port, - &dart_object_accepted); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerRejectedCB(const char *endpoint_id, connections::Status status) { - NEARBY_LOG(INFO, "Advertising rejected: id=%s", endpoint_id); - Dart_CObject dart_object_rejected; - dart_object_rejected.type = Dart_CObject_kString; - dart_object_rejected.value.as_string = const_cast(endpoint_id); - const bool result = - Dart_PostCObject_DL(current_connection_listener_dart.rejected_dart_port, - &dart_object_rejected); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerDisconnectedCB(const char *endpoint_id) { - NEARBY_LOG(INFO, "Advertising disconnected: id=%s", endpoint_id); - Dart_CObject dart_object_disconnected; - dart_object_disconnected.type = Dart_CObject_kString; - dart_object_disconnected.value.as_string = const_cast(endpoint_id); - const bool result = Dart_PostCObject_DL( - current_connection_listener_dart.disconnected_dart_port, - &dart_object_disconnected); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerBandwidthChangedCB(const char *endpoint_id, MediumW medium) { - NEARBY_LOG(INFO, "Advertising bandwidth changed: id=%s", endpoint_id); - Dart_CObject dart_object_bandwidth_changed; - - dart_object_bandwidth_changed.type = Dart_CObject_kString; - dart_object_bandwidth_changed.value.as_string = - const_cast(endpoint_id); - const bool result = Dart_PostCObject_DL( - current_connection_listener_dart.bandwidth_changed_dart_port, - &dart_object_bandwidth_changed); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerEndpointFoundCB(const char *endpoint_id, const char *endpoint_info, - size_t endpoint_info_size, - const char *str_service_id) { - NEARBY_LOG(INFO, "Device discovered: id=%s", endpoint_id); - NEARBY_LOG(INFO, "Device discovered: service_id=%s", str_service_id); - NEARBY_LOG(INFO, "Device discovered: info=%s", endpoint_info); - - Dart_CObject dart_object_endpoint_id; - dart_object_endpoint_id.type = Dart_CObject_kString; - dart_object_endpoint_id.value.as_string = const_cast(endpoint_id); - - Dart_CObject dart_object_endpoint_info; - dart_object_endpoint_info.type = Dart_CObject_kString; - dart_object_endpoint_info.value.as_string = const_cast(endpoint_info); - - Dart_CObject *elements[2]; - elements[0] = &dart_object_endpoint_id; - elements[1] = &dart_object_endpoint_info; - - Dart_CObject dart_object_found; - dart_object_found.type = Dart_CObject_kArray; - dart_object_found.value.as_array.length = 2; - dart_object_found.value.as_array.values = elements; - const bool result = Dart_PostCObject_DL( - current_discovery_listener_dart.found_dart_port, &dart_object_found); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} -void ListenerEndpointLostCB(const char *endpoint_id) { - NEARBY_LOG(INFO, "Device lost: id=%s", endpoint_id); - Dart_CObject dart_object_lost; - dart_object_lost.type = Dart_CObject_kString; - dart_object_lost.value.as_string = const_cast(endpoint_id); - const bool result = Dart_PostCObject_DL( - current_discovery_listener_dart.lost_dart_port, &dart_object_lost); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerEndpointDistanceChangedCB(const char *endpoint_id, - DistanceInfoW distance_info) { - (void)distance_info; // Avoid unused parameter warning - NEARBY_LOG(INFO, "Device distance changed: id=%s", endpoint_id); - Dart_CObject dart_object_distance_changed; - dart_object_distance_changed.type = Dart_CObject_kString; - dart_object_distance_changed.value.as_string = - const_cast(endpoint_id); - const bool result = Dart_PostCObject_DL( - current_discovery_listener_dart.distance_changed_dart_port, - &dart_object_distance_changed); - if (!result) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void ListenerPayloadCB(const char *endpoint_id, PayloadW &payload) { - NEARBY_LOG(INFO, - "Payload callback called. id: %s, " - "payload_id: %d, type: %d, offset: %d", - endpoint_id, payload.GetId(), payload.GetType(), - payload.GetOffset()); - - Dart_CObject dart_object_endpoint_id; - dart_object_endpoint_id.type = Dart_CObject_kString; - dart_object_endpoint_id.value.as_string = const_cast(endpoint_id); - - Dart_CObject dart_object_payload_id; - dart_object_payload_id.type = Dart_CObject_kInt64; - dart_object_payload_id.value.as_int64 = payload.GetId(); - - switch (payload.GetType()) { - case nearby::connections::PayloadType::kBytes: { - const char *bytes = nullptr; - size_t bytes_size; - - if (!payload.AsBytes(bytes, bytes_size)) { - NEARBY_LOG(INFO, "Failed to get the payload as bytes."); - return; - } - - Dart_CObject dart_object_bytes; - dart_object_bytes.type = Dart_CObject_kTypedData; - dart_object_bytes.value.as_typed_data = { - .type = Dart_TypedData_kUint8, - .length = static_cast(bytes_size), - .values = reinterpret_cast(bytes), - }; - - Dart_CObject *elements[] = { - &dart_object_endpoint_id, - &dart_object_payload_id, - &dart_object_bytes, - }; - - Dart_CObject dart_object_payload; - dart_object_payload.type = Dart_CObject_kArray; - dart_object_payload.value.as_array.length = 3; - dart_object_payload.value.as_array.values = elements; - if (!Dart_PostCObject_DL( - current_payload_listener_dart.initial_byte_info_port, - &dart_object_payload)) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } - return; - } - case nearby::connections::PayloadType::kStream: { - Dart_CObject *elements[] = { - &dart_object_endpoint_id, - &dart_object_payload_id, - }; - - Dart_CObject dart_object_payload; - dart_object_payload.type = Dart_CObject_kArray; - dart_object_payload.value.as_array.length = 2; - dart_object_payload.value.as_array.values = elements; - if (!Dart_PostCObject_DL( - current_payload_listener_dart.initial_stream_info_port, - &dart_object_payload)) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } - return; - } - case nearby::connections::PayloadType::kFile: { - Dart_CObject dart_object_offset; - dart_object_offset.type = Dart_CObject_kInt64; - dart_object_offset.value.as_int64 = payload.GetOffset(); - - std::string path = payload.AsFile()->GetFilePath(); - Dart_CObject dart_object_path; - dart_object_path.type = Dart_CObject_kString; - dart_object_path.value.as_string = const_cast(path.c_str()); - - Dart_CObject *elements[] = { - &dart_object_endpoint_id, - &dart_object_payload_id, - &dart_object_offset, - &dart_object_path, - }; - - Dart_CObject dart_object_payload; - dart_object_payload.type = Dart_CObject_kArray; - dart_object_payload.value.as_array.length = 4; - dart_object_payload.value.as_array.values = elements; - if (!Dart_PostCObject_DL( - current_payload_listener_dart.initial_file_info_port, - &dart_object_payload)) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } - return; - } - default: - NEARBY_LOG(INFO, "Invalid payload type."); - return; - } -} - -void ListenerPayloadProgressCB( - const char *endpoint_id, - const PayloadProgressInfoW &payload_progress_info) { - NEARBY_LOG(INFO, - "Payload progress callback called. id: %s, " - "payload_id: %d, bytes transferred: %d, total: %d, status: %d", - endpoint_id, payload_progress_info.payload_id, - payload_progress_info.bytes_transferred, - payload_progress_info.total_bytes, payload_progress_info.status); - Dart_CObject dart_object_endpoint_id; - dart_object_endpoint_id.type = Dart_CObject_kString; - dart_object_endpoint_id.value.as_string = const_cast(endpoint_id); - - Dart_CObject dart_object_payload_id; - dart_object_payload_id.type = Dart_CObject_kInt64; - dart_object_payload_id.value.as_int64 = payload_progress_info.payload_id; - - Dart_CObject dart_object_bytes_transferred; - dart_object_bytes_transferred.type = Dart_CObject_kInt64; - dart_object_bytes_transferred.value.as_int64 = - payload_progress_info.bytes_transferred; - - Dart_CObject dart_object_total_bytes; - dart_object_total_bytes.type = Dart_CObject_kInt64; - dart_object_total_bytes.value.as_int64 = payload_progress_info.total_bytes; - - Dart_CObject dart_object_status; - dart_object_status.type = Dart_CObject_kInt64; - dart_object_status.value.as_int64 = (int64_t)payload_progress_info.status; - - Dart_CObject *elements[5]; - elements[0] = &dart_object_endpoint_id; - elements[1] = &dart_object_payload_id; - elements[2] = &dart_object_bytes_transferred; - elements[3] = &dart_object_total_bytes; - elements[4] = &dart_object_status; - - Dart_CObject dart_object_payload_progress; - dart_object_payload_progress.type = Dart_CObject_kArray; - dart_object_payload_progress.value.as_array.length = 5; - dart_object_payload_progress.value.as_array.values = elements; - - if (!Dart_PostCObject_DL( - current_payload_listener_dart.payload_progress_dart_port, - &dart_object_payload_progress)) { - NEARBY_LOG(INFO, "Posting message to port failed."); - } -} - -void SetResultCallback(ResultCallbackW &result_callback, Dart_Port &dart_port) { - port = dart_port; - result_callback.result_cb = ResultCB; -} - -void PostResult(Dart_Port &result_cb, Status::Value value) { - port = result_cb; - Dart_CObject dart_object_result_callback; - dart_object_result_callback.type = Dart_CObject_kInt64; - dart_object_result_callback.value.as_int64 = value; - const bool result = - Dart_PostCObject_DL(result_cb, &dart_object_result_callback); - if (!result) { - NEARBY_LOG(INFO, "Returning error to port failed."); - } -} - -void EnableBleV2Dart(Core *pCore, int64_t enable, Dart_Port result_cb) { - if (!pCore) { - PostResult(result_cb, Status::Value::kError); - return; - } - port = result_cb; - - NearbyFlags::GetInstance().OverrideBoolFlagValue( - connections::config_package_nearby::nearby_connections_feature:: - kEnableBleV2, - enable); - PostResult(result_cb, Status::kSuccess); -} - -void StartAdvertisingDart( - Core *pCore, const char *service_id, - AdvertisingOptionsDart connection_options_dart, - ConnectionRequestInfoDart connection_request_info_dart, - Dart_Port result_cb) { - if (!pCore) { - PostResult(result_cb, Status::Value::kError); - return; - } - - port = result_cb; - current_connection_listener_dart = - connection_request_info_dart.connection_listener; - - AdvertisingOptionsW advertising_options; - advertising_options.strategy = GetStrategy(connection_options_dart.strategy); - advertising_options.auto_upgrade_bandwidth = - connection_options_dart.auto_upgrade_bandwidth; - advertising_options.enforce_topology_constraints = - connection_options_dart.enforce_topology_constraints; - - advertising_options.low_power = connection_options_dart.low_power; - advertising_options.fast_advertisement_service_uuid = - connection_options_dart.fast_advertisement_service_uuid; - - advertising_options.allowed.bluetooth = - connection_options_dart.mediums.bluetooth; - advertising_options.allowed.ble = connection_options_dart.mediums.ble; - advertising_options.allowed.wifi_lan = - connection_options_dart.mediums.wifi_lan; - advertising_options.allowed.wifi_hotspot = - connection_options_dart.mediums.wifi_hotspot; - advertising_options.allowed.web_rtc = connection_options_dart.mediums.web_rtc; - - ConnectionListenerW listener(ListenerInitiatedCB, ListenerAcceptedCB, - ListenerRejectedCB, ListenerDisconnectedCB, - ListenerBandwidthChangedCB); - - ConnectionRequestInfoW info{ - connection_request_info_dart.endpoint_info, - strlen(connection_request_info_dart.endpoint_info), listener}; - - ResultCallbackW callback; - SetResultCallback(callback, result_cb); - - CountDownLatch finished(1); - adapter_finished = &finished; - - StartAdvertising(pCore, service_id, advertising_options, info, callback); - - finished.Await(); -} - -void StopAdvertisingDart(Core *pCore, Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - StopAdvertising(pCore, callback); - - finished.Await(); -} - -void StartDiscoveryDart(Core *pCore, const char *service_id, - DiscoveryOptionsDart discovery_options_dart, - DiscoveryListenerDart discovery_listener_dart, - Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - current_discovery_listener_dart = discovery_listener_dart; - - DiscoveryOptionsW discovery_options; - discovery_options.strategy = GetStrategy(discovery_options_dart.strategy); - discovery_options.allowed.web_rtc = false; - discovery_options.enforce_topology_constraints = true; - // This needs to be passed in by the UI. If it's null, then no - // fast_advertisement_service. Otherwise this interface will always - // and forever be locked into 0000FE2C-0000-1000-8000-00805F9B34FB - // whenever fast advertisement service is requested. - discovery_options.fast_advertisement_service_uuid = - discovery_options_dart.fast_advertisement_service_uuid; - - discovery_options.allowed.bluetooth = - discovery_options_dart.mediums.bluetooth; - discovery_options.allowed.ble = discovery_options_dart.mediums.ble; - discovery_options.allowed.wifi_lan = discovery_options_dart.mediums.wifi_lan; - discovery_options.allowed.wifi_hotspot = - discovery_options_dart.mediums.wifi_hotspot; - discovery_options.allowed.web_rtc = discovery_options_dart.mediums.web_rtc; - - DiscoveryListenerW listener(ListenerEndpointFoundCB, ListenerEndpointLostCB, - ListenerEndpointDistanceChangedCB); - - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - StartDiscovery(pCore, service_id, discovery_options, listener, callback); - - finished.Await(); -} - -void StopDiscoveryDart(Core *pCore, Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - StopDiscovery(pCore, callback); - - adapter_finished->Await(); -} - -void RequestConnectionDart( - Core *pCore, const char *endpoint_id, - ConnectionOptionsDart connection_options_dart, - ConnectionRequestInfoDart connection_request_info_dart, - Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - current_connection_listener_dart = - connection_request_info_dart.connection_listener; - - ConnectionOptionsW connection_options; - connection_options.enforce_topology_constraints = false; - connection_options.remote_bluetooth_mac_address = - connection_options_dart.remote_bluetooth_mac_address; - connection_options.fast_advertisement_service_uuid = - connection_options_dart.fast_advertisement_service_uuid; - connection_options.keep_alive_interval_millis = - connection_options_dart.keep_alive_interval_millis; - connection_options.keep_alive_timeout_millis = - connection_options_dart.keep_alive_timeout_millis; - connection_options.allowed.bluetooth = - connection_options_dart.mediums.bluetooth; - connection_options.allowed.ble = connection_options_dart.mediums.ble; - connection_options.allowed.wifi_lan = - connection_options_dart.mediums.wifi_lan; - connection_options.allowed.wifi_hotspot = - connection_options_dart.mediums.wifi_hotspot; - connection_options.allowed.web_rtc = connection_options_dart.mediums.web_rtc; - - ConnectionListenerW listener(ListenerInitiatedCB, ListenerAcceptedCB, - ListenerRejectedCB, ListenerDisconnectedCB, - ListenerBandwidthChangedCB); - - ConnectionRequestInfoW info{ - connection_request_info_dart.endpoint_info, - strlen(connection_request_info_dart.endpoint_info), listener}; - - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - RequestConnection(pCore, endpoint_id, info, connection_options, callback); - - adapter_finished->Await(); -} - -void AcceptConnectionDart(Core *pCore, const char *endpoint_id, - PayloadListenerDart payload_listener_dart, - Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - current_payload_listener_dart = payload_listener_dart; - - PayloadListenerW listener(ListenerPayloadCB, ListenerPayloadProgressCB); - - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - AcceptConnection(pCore, endpoint_id, listener, callback); - - finished.Await(); -} - -void RejectConnectionDart(Core *pCore, const char *endpoint_id, - Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - RejectConnection(pCore, endpoint_id, callback); - - finished.Await(); -} -void DisconnectFromEndpointDart(Core *pCore, char *endpoint_id, - Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - ResultCallbackW callback; - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - DisconnectFromEndpoint(pCore, endpoint_id, callback); - - finished.Await(); -} - -void SendPayloadDart(Core *pCore, const char *endpoint_id, - PayloadDart payload_dart, Dart_Port dart_port) { - if (!pCore) { - PostResult(dart_port, Status::Value::kError); - return; - } - - port = dart_port; - - ResultCallbackW callback; - std::vector endpoint_ids = {std::string(endpoint_id)}; - - NEARBY_LOG(INFO, "Payload type: %d", payload_dart.type); - switch (payload_dart.type) { - case UNKNOWN: - case STREAM: - NEARBY_LOG(INFO, "Payload type not supported yet"); - PostResult(dart_port, Status::Value::kPayloadUnknown); - break; - case BYTE: { - PayloadW payload(PayloadW::GenerateId(), payload_dart.data, - payload_dart.size); - - std::vector c_string_array; - - std::transform(endpoint_ids.begin(), endpoint_ids.end(), - std::back_inserter(c_string_array), - [](const std::string &s) { - char *pc = new char[s.size() + 1]; - strncpy(pc, s.c_str(), s.size() + 1); - return pc; - }); - - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - SendPayload(pCore, c_string_array.data(), c_string_array.size(), - std::move(payload), callback); - - adapter_finished->Await(); - } break; - case FILE: - NEARBY_LOG(INFO, "File name: %s, size %d", payload_dart.data, - payload_dart.size); - std::string file_name_str(payload_dart.data); - InputFileW input_file(file_name_str.c_str(), payload_dart.size); - PayloadW payload(input_file); - - std::vector c_string_array; - - std::transform(endpoint_ids.begin(), endpoint_ids.end(), - std::back_inserter(c_string_array), - [](const std::string &s) { - char *pc = new char[s.size() + 1]; - strncpy(pc, s.c_str(), s.size() + 1); - return pc; - }); - - SetResultCallback(callback, dart_port); - - CountDownLatch finished(1); - adapter_finished = &finished; - - SendPayload(pCore, c_string_array.data(), c_string_array.size(), - std::move(payload), callback); - - adapter_finished->Await(); - - break; - } -} - -} // namespace nearby::windows diff --git a/connections/dart/core_adapter_dart.h b/connections/dart/core_adapter_dart.h deleted file mode 100644 index 63d7aa64..00000000 --- a/connections/dart/core_adapter_dart.h +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright 2021-2022 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 LOCATION_NEARBY_CONNECTIONS_DART_CORE_ADAPTER_DART_H_ -#define LOCATION_NEARBY_CONNECTIONS_DART_CORE_ADAPTER_DART_H_ - -#include "third_party/dart_lang/v2/runtime/include/dart_api_dl.h" -#include "third_party/dart_lang/v2/runtime/include/dart_native_api.h" -#include "connections/c/core_adapter.h" - -namespace nearby::windows { - -enum class StrategyDart { - P2P_CLUSTER = 0, - P2P_STAR, - P2P_POINT_TO_POINT, -}; - -enum PayloadType { - // LINT.IfChange - UNKNOWN = 0, - BYTE, - STREAM, - FILE, - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/payload.dart) -}; - -struct Mediums { - // LINT.IfChange - int64_t bluetooth; - int64_t ble; - int64_t wifi_lan; - int64_t wifi_hotspot; - int64_t web_rtc; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/mediums.dart) -}; - -extern "C" { - -struct AdvertisingOptionsDart { - // LINT.IfChange - StrategyDart strategy; - int64_t auto_upgrade_bandwidth; - int64_t enforce_topology_constraints; - int64_t low_power; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - int64_t is_out_of_band_connection = false; - const char *fast_advertisement_service_uuid; - - // The information about this device (eg. name, device type), - // to appear on the remote device. - // Defined by client/application. - const char *device_info; - - Mediums mediums; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/advertising_options.dart) -}; - -struct ConnectionOptionsDart { - // LINT.IfChange - StrategyDart strategy; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - int64_t auto_upgrade_bandwidth; - int64_t enforce_topology_constraints; - int64_t low_power; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - int64_t is_out_of_band_connection = false; - char *remote_bluetooth_mac_address; - char *fast_advertisement_service_uuid; - int64_t keep_alive_interval_millis; - int64_t keep_alive_timeout_millis; - - Mediums mediums; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/connection_options.dart) -}; - -struct DiscoveryOptionsDart { - // LINT.IfChange - StrategyDart strategy; - int64_t auto_upgrade_bandwidth; - int64_t enforce_topology_constraints; - - // Whether this is intended to be used in conjunction with InjectEndpoint(). - int64_t is_out_of_band_connection = false; - const char *fast_advertisement_service_uuid; - const char *remote_bluetooth_mac_address; - - Mediums mediums; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/discovery_options.dart) -}; - -struct DiscoveryListenerDart { - // LINT.IfChange - int64_t found_dart_port; - int64_t lost_dart_port; - int64_t distance_changed_dart_port; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/discovery_listener.dart) -}; - -struct PayloadListenerDart { - // LINT.IfChange - int64_t initial_byte_info_port; - int64_t initial_stream_info_port; - int64_t initial_file_info_port; - int64_t payload_progress_dart_port; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/payload_listener.dart) -}; - -struct ConnectionListenerDart { - // LINT.IfChange - int64_t initiated_dart_port; - int64_t accepted_dart_port; - int64_t rejected_dart_port; - int64_t disconnected_dart_port; - int64_t bandwidth_changed_dart_port; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/connection_listener.dart) -}; - -struct ConnectionRequestInfoDart { - // LINT.IfChange - char *endpoint_info; - ConnectionListenerDart connection_listener; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/connection_request_info.dart) -}; - -struct PayloadDart { - // LINT.IfChange - int64_t id; - PayloadType type; - int64_t size; - char *data; - // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/payload.dart) -}; - -static void ResultCB(Status status); - -static void ListenerInitiatedCB(const char *endpoint_id, - const ConnectionResponseInfoW &connection_info); -static void ListenerAcceptedCB(const char *endpoint_id); -static void ListenerRejectedCB(const char *endpoint_id, - connections::Status status); -static void ListenerDisconnectedCB(const char *endpoint_id); -static void ListenerBandwidthChangedCB(const char *endpoint_id, MediumW medium); -static void ListenerEndpointFoundCB(const char *endpoint_id, - const char *endpoint_info, - size_t endpoint_info_size, - const char *str_service_id); -static void ListenerEndpointLostCB(const char *endpoint_id); -static void ListenerEndpointDistanceChangedCB(const char *endpoint_id, - DistanceInfoW info); -static void ListenerPayloadCB(const char *endpoint_id, PayloadW &payload); -static void ListenerPayloadProgressCB(const char *endpoint_id, - const PayloadProgressInfoW &info); - -DLL_API void __stdcall EnableBleV2Dart(Core *pCore, int64_t enable, - Dart_Port result_cb); - -// Starts advertising an endpoint for a local app. -// -// service_id - An identifier to advertise your app to other endpoints. -// This can be an arbitrary string, so long as it uniquely -// identifies your service. A good default is to use your -// app's package name. -// options_dart - options for advertising -// info_dart - Including callbacks notified when remote -// endpoints request a connection to this endpoint. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if advertising started successfully. -// Status::STATUS_ALREADY_ADVERTISING if the app is already advertising. -// Status::STATUS_OUT_OF_ORDER_API_CALL if the app is currently -// connected to remote endpoints; call StopAllEndpoints first. -DLL_API void __stdcall StartAdvertisingDart(Core *pCore, const char *service_id, - AdvertisingOptionsDart options_dart, - ConnectionRequestInfoDart info_dart, - Dart_Port result_cb); - -// Stops advertising a local endpoint. Should be called after calling -// StartAdvertising, as soon as the application no longer needs to advertise -// itself or goes inactive. Payloads can still be sent to connected -// endpoints after advertising ends. -// -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if none of the above errors occurred. -DLL_API void __stdcall StopAdvertisingDart(Core *pCore, Dart_Port result_cb); - -// Starts discovery for remote endpoints with the specified service ID. -// -// service_id - The ID for the service to be discovered, as specified in -// the corresponding call to StartAdvertising. -// options - The options for discovery. -// listener - Callbacks notified when a remote endpoint is discovered. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if discovery started successfully. -// Status::STATUS_ALREADY_DISCOVERING if the app is already -// discovering the specified service. -// Status::STATUS_OUT_OF_ORDER_API_CALL if the app is currently -// connected to remote endpoints; call StopAllEndpoints first. -DLL_API void __stdcall StartDiscoveryDart(Core *pCore, const char *service_id, - DiscoveryOptionsDart options_dart, - DiscoveryListenerDart listener_dart, - Dart_Port result_cb); - -// Stops discovery for remote endpoints, after a previous call to -// StartDiscovery, when the client no longer needs to discover endpoints or -// goes inactive. Payloads can still be sent to connected endpoints after -// discovery ends. -// -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if none of the above errors occurred. -DLL_API void __stdcall StopDiscoveryDart(Core *pCore, Dart_Port result_cb); - -// Sends a request to connect to a remote endpoint. -// -// endpoint_id - The identifier for the remote endpoint to which a -// connection request will be sent. Should match the value -// provided in a call to -// DiscoveryListener::endpoint_found_cb() -// options_dart - The options for connection. -// info_dart - Connection parameters: -// > name - A human readable name for the local endpoint, to appear on -// the remote endpoint. -// > listener - Callbacks notified when the remote endpoint sends a -// response to the connection request. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if the connection request was sent. -// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT if the app already -// has a connection to the specified endpoint. -// Status::STATUS_RADIO_ERROR if we failed to connect because of an -// issue with Bluetooth/WiFi. -// Status::STATUS_ERROR if we failed to connect for any other reason. -DLL_API void __stdcall RequestConnectionDart( - Core *pCore, const char *endpoint_id, ConnectionOptionsDart options_dart, - ConnectionRequestInfoDart info_dart, Dart_Port result_cb); - -// Accepts a connection to a remote endpoint. This method must be called -// before Payloads can be exchanged with the remote endpoint. -// -// endpoint_id - The identifier for the remote endpoint. Should match the -// value provided in a call to -// ConnectionListener::onConnectionInitiated. -// listener_dart - A callback for payloads exchanged with the remote endpoint. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK if the connection request was accepted. -// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT if the app already. -// has a connection to the specified endpoint. -DLL_API void __stdcall AcceptConnectionDart(Core *pCore, - const char *endpoint_id, - PayloadListenerDart listener_dart, - Dart_Port result_cb); - -DLL_API void __stdcall RejectConnectionDart(Core *pCore, - const char *endpoint_id, - Dart_Port result_cb); - -// Disconnects from a remote endpoint. {@link Payload}s can no longer be sent -// to or received from the endpoint after this method is called. -// endpoint_id - The identifier for the remote endpoint to disconnect from. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OK - finished successfully. -DLL_API void __stdcall DisconnectFromEndpointDart(Core *pCore, - char *endpoint_id, - Dart_Port result_cb); - -// Sends a Payload to a remote endpoint. Payloads can only be sent to remote -// endpoints once a notice of connection acceptance has been delivered via -// ConnectionListener::onConnectionResult(). -// -// endpoint_id - Remote endpoint identifier for the to which the -// payload should be sent. -// payload - The Payload to be sent. -// result_cb - to access the status of the operation when available. -// Possible status codes include: -// Status::STATUS_OUT_OF_ORDER_API_CALL if the device has not first -// performed advertisement or discovery (to set the Strategy.) -// Status::STATUS_ENDPOINT_UNKNOWN if there's no active (or pending) -// connection to the remote endpoint. -// Status::STATUS_OK if none of the above errors occurred. Note that this -// indicates that Nearby Connections will attempt to send the Payload, -// but not that the send has successfully completed yet. Errors might -// still occur during transmission (and at different times for -// different endpoints), and will be delivered via -// PayloadCallback#onPayloadTransferUpdate. -DLL_API void __stdcall SendPayloadDart(Core *pCore, const char *endpoint_id, - PayloadDart payload_dart, - Dart_Port result_cb); -} // extern "C" -} // namespace nearby::windows - -#endif // LOCATION_NEARBY_CONNECTIONS_DART_CORE_ADAPTER_DART_H_ diff --git a/connections/dart/nc_adapter_dart.cc b/connections/dart/nc_adapter_dart.cc new file mode 100644 index 00000000..40add14d --- /dev/null +++ b/connections/dart/nc_adapter_dart.cc @@ -0,0 +1,774 @@ +// Copyright 2024 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. + +#include "connections/dart/nc_adapter_dart.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/base/no_destructor.h" +#include "absl/strings/escaping.h" +#include "absl/strings/string_view.h" +#include "third_party/dart_lang/v2/runtime/include/dart_api.h" +#include "third_party/dart_lang/v2/runtime/include/dart_api_dl.h" +#include "third_party/dart_lang/v2/runtime/include/dart_native_api.h" +#include "connections/c/nc.h" +#include "connections/c/nc_types.h" +#include "connections/dart/nc_adapter_types.h" +#include "connections/dart/nearby_connections_client_state.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/logging.h" +#include "internal/platform/prng.h" + +using nearby::connections::dart::NearbyConnectionsClientState; +using NearbyConnectionsApi = nearby::connections::dart:: + NearbyConnectionsClientState::NearbyConnectionsApi; + +static absl::NoDestructor kClientState; + +NC_STRATEGY_TYPE GetStrategy(StrategyDart strategy) { + switch (strategy) { + case STRATEGY_P2P_CLUSTER: + return NC_STRATEGY_TYPE_P2P_CLUSTER; + case STRATEGY_P2P_POINT_TO_POINT: + return NC_STRATEGY_TYPE_P2P_POINT_TO_POINT; + case STRATEGY_P2P_STAR: + return NC_STRATEGY_TYPE_P2P_STAR; + default: + break; + } + return NC_STRATEGY_TYPE_NONE; +} + +nearby::ByteArray ConvertBluetoothMacAddress(absl::string_view address) { + return nearby::ByteArray(std::string(address)); +} + +NC_PAYLOAD_ID GeneratePayloadId() { return nearby::Prng().NextInt64(); } + +void ResultCB(std::optional port, NC_STATUS status) { + (void)status; // Avoid unused parameter warning + if (!port.has_value()) { + NEARBY_LOGS(ERROR) << "ResultCB called with invalid port."; + return; + } + + Dart_CObject dart_object_result_callback; + dart_object_result_callback.type = Dart_CObject_kInt64; + dart_object_result_callback.value.as_int64 = static_cast(status); + const bool result = Dart_PostCObject_DL(*port, &dart_object_result_callback); + if (!result) { + NEARBY_LOGS(WARNING) << "Posting message to port failed."; + } +} + +std::string GetEndpointIdString(int endpoint_id) { + std::string endpoint_id_str; + endpoint_id_str.resize(4); + endpoint_id_str[0] = endpoint_id & 0xff; + endpoint_id_str[1] = (endpoint_id >> 8) & 0xff; + endpoint_id_str[2] = (endpoint_id >> 16) & 0xff; + endpoint_id_str[3] = (endpoint_id >> 24) & 0xff; + return endpoint_id_str; +} + +void ListenerInitiatedCB( + NC_INSTANCE instance, int endpoint_id, + const NC_CONNECTION_RESPONSE_INFO *connection_response_info) { + NEARBY_LOGS(INFO) << "Advertising initiated: id=" + << GetEndpointIdString(endpoint_id); + + Dart_CObject dart_object_endpoint_id = { + .type = Dart_CObject_Type::Dart_CObject_kInt32, + .value = {.as_int32 = endpoint_id}}; + + Dart_CObject dart_object_endpoint_info = { + .type = Dart_CObject_Type::Dart_CObject_kTypedData, + .value = {.as_typed_data{ + .type = Dart_TypedData_Type::Dart_TypedData_kUint8, + .length = + (intptr_t)connection_response_info->remote_endpoint_info.size, + .values = + (uint8_t *)connection_response_info->remote_endpoint_info.data}}}; + + Dart_CObject *elements[2]; + elements[0] = &dart_object_endpoint_id; + elements[1] = &dart_object_endpoint_info; + + Dart_CObject dart_object_initiated; + dart_object_initiated.type = Dart_CObject_kArray; + dart_object_initiated.value.as_array.length = 2; + dart_object_initiated.value.as_array.values = elements; + + const bool result = Dart_PostCObject_DL( + kClientState->GetConnectionListenerDart()->initiated_dart_port, + &dart_object_initiated); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerAcceptedCB(NC_INSTANCE instance, int endpoint_id) { + NEARBY_LOGS(INFO) << "Advertising accepted: id=" + << GetEndpointIdString(endpoint_id); + Dart_CObject dart_object_accepted; + dart_object_accepted.type = Dart_CObject_kInt32; + dart_object_accepted.value.as_int32 = endpoint_id; + const bool result = Dart_PostCObject_DL( + kClientState->GetConnectionListenerDart()->accepted_dart_port, + &dart_object_accepted); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerRejectedCB(NC_INSTANCE instance, int endpoint_id, + NC_STATUS status) { + NEARBY_LOGS(INFO) << "Advertising rejected: id=" + << GetEndpointIdString(endpoint_id); + Dart_CObject dart_object_rejected; + dart_object_rejected.type = Dart_CObject_kInt32; + dart_object_rejected.value.as_int32 = endpoint_id; + const bool result = Dart_PostCObject_DL( + kClientState->GetConnectionListenerDart()->rejected_dart_port, + &dart_object_rejected); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerDisconnectedCB(NC_INSTANCE instance, int endpoint_id) { + NEARBY_LOGS(INFO) << "Advertising disconnected: id=" + << GetEndpointIdString(endpoint_id); + Dart_CObject dart_object_disconnected; + dart_object_disconnected.type = Dart_CObject_kInt32; + dart_object_disconnected.value.as_int32 = endpoint_id; + const bool result = Dart_PostCObject_DL( + kClientState->GetConnectionListenerDart()->disconnected_dart_port, + &dart_object_disconnected); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerBandwidthChangedCB(NC_INSTANCE instance, int endpoint_id, + NC_MEDIUM medium) { + NEARBY_LOGS(INFO) << "Advertising bandwidth changed: id=" + << GetEndpointIdString(endpoint_id); + Dart_CObject dart_object_bandwidth_changed; + + dart_object_bandwidth_changed.type = Dart_CObject_kInt32; + dart_object_bandwidth_changed.value.as_int32 = endpoint_id; + const bool result = Dart_PostCObject_DL( + kClientState->GetConnectionListenerDart()->bandwidth_changed_dart_port, + &dart_object_bandwidth_changed); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerEndpointFoundCB(NC_INSTANCE instance, int endpoint_id, + const NC_DATA *endpoint_info, + const NC_DATA *service_id) { + NEARBY_LOGS(INFO) << "Device discovered: id=" + << GetEndpointIdString(endpoint_id); + NEARBY_LOGS(INFO) << "Device discovered: service_id=" + << std::string(service_id->data, service_id->size); + + std::string endpoint_info_str = absl::BytesToHexString( + absl::string_view(endpoint_info->data, endpoint_info->size)); + NEARBY_LOGS(INFO) << "Device discovered: info=" << endpoint_info_str; + + Dart_CObject dart_object_endpoint_id = { + .type = Dart_CObject_Type::Dart_CObject_kInt32, + .value = {.as_int32 = endpoint_id}}; + + Dart_CObject dart_object_endpoint_info = { + .type = Dart_CObject_Type::Dart_CObject_kTypedData, + .value = { + .as_typed_data{.type = Dart_TypedData_Type::Dart_TypedData_kUint8, + .length = (intptr_t)endpoint_info->size, + .values = (uint8_t *)endpoint_info->data}}}; + + Dart_CObject *elements[2]; + elements[0] = &dart_object_endpoint_id; + elements[1] = &dart_object_endpoint_info; + + Dart_CObject dart_object_found; + dart_object_found.type = Dart_CObject_kArray; + dart_object_found.value.as_array.length = 2; + dart_object_found.value.as_array.values = elements; + const bool result = Dart_PostCObject_DL( + kClientState->GetDiscoveryListenerDart()->found_dart_port, + &dart_object_found); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerEndpointLostCB(NC_INSTANCE instance, int endpoint_id) { + NEARBY_LOGS(INFO) << "Device lost: id=" << GetEndpointIdString(endpoint_id); + Dart_CObject dart_object_lost; + dart_object_lost.type = Dart_CObject_kInt32; + dart_object_lost.value.as_int32 = endpoint_id; + const bool result = Dart_PostCObject_DL( + kClientState->GetDiscoveryListenerDart()->lost_dart_port, + &dart_object_lost); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerEndpointDistanceChangedCB(NC_INSTANCE instance, int endpoint_id, + NC_DISTANCE_INFO distance_info) { + (void)distance_info; // Avoid unused parameter warning + NEARBY_LOGS(INFO) << "Device distance changed: id=" + << GetEndpointIdString(endpoint_id); + Dart_CObject dart_object_distance_changed; + dart_object_distance_changed.type = Dart_CObject_kInt32; + dart_object_distance_changed.value.as_int32 = endpoint_id; + const bool result = Dart_PostCObject_DL( + kClientState->GetDiscoveryListenerDart()->distance_changed_dart_port, + &dart_object_distance_changed); + if (!result) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void ListenerPayloadCB(NC_INSTANCE instance, int endpoint_id, + const NC_PAYLOAD *payload) { + NEARBY_LOGS(INFO) << "Payload callback called. id: " + << GetEndpointIdString(endpoint_id) + << ", payload_id: " << payload->id + << ", type: " << payload->type; + + Dart_CObject dart_object_endpoint_id; + dart_object_endpoint_id.type = Dart_CObject_kInt32; + dart_object_endpoint_id.value.as_int32 = endpoint_id; + + Dart_CObject dart_object_payload_id; + dart_object_payload_id.type = Dart_CObject_kInt64; + dart_object_payload_id.value.as_int64 = payload->id; + + switch (payload->type) { + case NC_PAYLOAD_TYPE_BYTES: { + const char *bytes = payload->content.bytes.content.data; + size_t bytes_size = payload->content.bytes.content.size; + + if (bytes_size == 0) { + NEARBY_LOGS(INFO) << "Failed to get the payload as bytes."; + return; + } + + Dart_CObject dart_object_bytes; + dart_object_bytes.type = Dart_CObject_kTypedData; + dart_object_bytes.value.as_typed_data = { + .type = Dart_TypedData_kUint8, + .length = static_cast(bytes_size), + .values = reinterpret_cast(bytes), + }; + + Dart_CObject *elements[] = { + &dart_object_endpoint_id, + &dart_object_payload_id, + &dart_object_bytes, + }; + + Dart_CObject dart_object_payload; + dart_object_payload.type = Dart_CObject_kArray; + dart_object_payload.value.as_array.length = 3; + dart_object_payload.value.as_array.values = elements; + if (!Dart_PostCObject_DL( + kClientState->GetPayloadListenerDart()->initial_byte_info_port, + &dart_object_payload)) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } + return; + } + case NC_PAYLOAD_TYPE_STREAM: { + Dart_CObject *elements[] = { + &dart_object_endpoint_id, + &dart_object_payload_id, + }; + + Dart_CObject dart_object_payload; + dart_object_payload.type = Dart_CObject_kArray; + dart_object_payload.value.as_array.length = 2; + dart_object_payload.value.as_array.values = elements; + if (!Dart_PostCObject_DL( + kClientState->GetPayloadListenerDart()->initial_stream_info_port, + &dart_object_payload)) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } + return; + } + case NC_PAYLOAD_TYPE_FILE: { + Dart_CObject dart_object_offset; + dart_object_offset.type = Dart_CObject_kInt64; + dart_object_offset.value.as_int64 = payload->content.file.offset; + + std::string path = payload->content.file.file_name; + Dart_CObject dart_object_path; + dart_object_path.type = Dart_CObject_kString; + dart_object_path.value.as_string = const_cast(path.c_str()); + + Dart_CObject *elements[] = { + &dart_object_endpoint_id, + &dart_object_payload_id, + &dart_object_offset, + &dart_object_path, + }; + + Dart_CObject dart_object_payload; + dart_object_payload.type = Dart_CObject_kArray; + dart_object_payload.value.as_array.length = 4; + dart_object_payload.value.as_array.values = elements; + if (!Dart_PostCObject_DL( + kClientState->GetPayloadListenerDart()->initial_file_info_port, + &dart_object_payload)) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } + return; + } + default: + NEARBY_LOGS(INFO) << "Invalid payload type."; + return; + } +} + +void ListenerPayloadProgressCB( + NC_INSTANCE instance, int endpoint_id, + const NC_PAYLOAD_PROGRESS_INFO *payload_progress_info) { + NEARBY_LOGS(INFO) << "Payload progress callback called. id: " + << GetEndpointIdString(endpoint_id) + << ", payload_id: " << payload_progress_info->id + << ", bytes transferred: " + << payload_progress_info->bytes_transferred + << ", total: " << payload_progress_info->total_bytes + << ", status: " << payload_progress_info->status; + Dart_CObject dart_object_endpoint_id; + dart_object_endpoint_id.type = Dart_CObject_kInt32; + dart_object_endpoint_id.value.as_int32 = endpoint_id; + + Dart_CObject dart_object_payload_id; + dart_object_payload_id.type = Dart_CObject_kInt64; + dart_object_payload_id.value.as_int64 = payload_progress_info->id; + + Dart_CObject dart_object_bytes_transferred; + dart_object_bytes_transferred.type = Dart_CObject_kInt64; + dart_object_bytes_transferred.value.as_int64 = + payload_progress_info->bytes_transferred; + + Dart_CObject dart_object_total_bytes; + dart_object_total_bytes.type = Dart_CObject_kInt64; + dart_object_total_bytes.value.as_int64 = payload_progress_info->total_bytes; + + Dart_CObject dart_object_status; + dart_object_status.type = Dart_CObject_kInt64; + dart_object_status.value.as_int64 = (int64_t)payload_progress_info->status; + + Dart_CObject *elements[5]; + elements[0] = &dart_object_endpoint_id; + elements[1] = &dart_object_payload_id; + elements[2] = &dart_object_bytes_transferred; + elements[3] = &dart_object_total_bytes; + elements[4] = &dart_object_status; + + Dart_CObject dart_object_payload_progress; + dart_object_payload_progress.type = Dart_CObject_kArray; + dart_object_payload_progress.value.as_array.length = 5; + dart_object_payload_progress.value.as_array.values = elements; + + if (!Dart_PostCObject_DL( + kClientState->GetPayloadListenerDart()->payload_progress_dart_port, + &dart_object_payload_progress)) { + NEARBY_LOGS(INFO) << "Posting message to port failed."; + } +} + +void PostResult(Dart_Port &result_cb, NC_STATUS value) { + Dart_CObject dart_object_result_callback; + dart_object_result_callback.type = Dart_CObject_kInt64; + dart_object_result_callback.value.as_int64 = static_cast(value); + const bool result = + Dart_PostCObject_DL(result_cb, &dart_object_result_callback); + if (!result) { + NEARBY_LOGS(INFO) << "Returning error to port failed."; + } +} + +NC_INSTANCE CreateServiceDart() { + NC_INSTANCE instance = kClientState->GetOpennedService(); + if (instance == nullptr) { + instance = NcCreateService(); + kClientState->SetOpennedService(instance); + } + + return instance; +} + +void CloseServiceDart(NC_INSTANCE instance) { + NcCloseService(instance); + kClientState->reset(); +} + +int GetLocalEndpointIdDart(NC_INSTANCE instance) { + return NcGetLocalEndpointId(instance); +} + +void EnableBleV2Dart(NC_INSTANCE instance, int64_t enable, + Dart_Port result_cb) { + kClientState->PushNearbyConnectionsApiPort(NearbyConnectionsApi::kEnableBleV2, + result_cb); + NcEnableBleV2(instance, enable, [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kEnableBleV2), + status); + }); + NEARBY_LOGS(INFO) << "EnableBleV2Dart callback is called with enable=" + << enable; +} + +void StartAdvertisingDart(NC_INSTANCE instance, DataDart service_id, + AdvertisingOptionsDart options_dart, + ConnectionRequestInfoDart info_dart, + Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kStartAdvertising, result_cb); + kClientState->SetConnectionListenerDart( + std::make_unique(info_dart.connection_listener)); + + NC_ADVERTISING_OPTIONS advertising_options{}; + advertising_options.common_options.strategy.type = + GetStrategy(options_dart.strategy); + advertising_options.auto_upgrade_bandwidth = + options_dart.auto_upgrade_bandwidth; + advertising_options.enforce_topology_constraints = + options_dart.enforce_topology_constraints; + + advertising_options.low_power = options_dart.low_power; + advertising_options.fast_advertisement_service_uuid.data = + const_cast(options_dart.fast_advertisement_service_uuid.data); + advertising_options.fast_advertisement_service_uuid.size = + options_dart.fast_advertisement_service_uuid.size; + + advertising_options.common_options.allowed_mediums[NC_MEDIUM_BLUETOOTH] = + options_dart.mediums.bluetooth != 0; + advertising_options.common_options.allowed_mediums[NC_MEDIUM_BLE] = + options_dart.mediums.ble != 0; + advertising_options.common_options.allowed_mediums[NC_MEDIUM_WIFI_LAN] = + options_dart.mediums.wifi_lan != 0; + advertising_options.common_options.allowed_mediums[NC_MEDIUM_WIFI_HOTSPOT] = + options_dart.mediums.wifi_hotspot; + advertising_options.common_options.allowed_mediums[NC_MEDIUM_WEB_RTC] = + options_dart.mediums.web_rtc; + + NC_CONNECTION_REQUEST_INFO request_info{}; + + request_info.endpoint_info.data = info_dart.endpoint_info.data; + request_info.endpoint_info.size = info_dart.endpoint_info.size; + request_info.initiated_callback = &ListenerInitiatedCB; + request_info.accepted_callback = ListenerAcceptedCB; + request_info.rejected_callback = ListenerRejectedCB; + request_info.disconnected_callback = ListenerDisconnectedCB; + request_info.bandwidth_changed_callback = ListenerBandwidthChangedCB; + + NC_DATA service_id_data = + NC_DATA{.size = service_id.size, .data = service_id.data}; + NcStartAdvertising(instance, &service_id_data, &advertising_options, + &request_info, [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kStartAdvertising), + status); + }); +} + +void StopAdvertisingDart(NC_INSTANCE instance, Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kStopAdvertising, result_cb); + + NcStopAdvertising(instance, [](NC_STATUS status) { + kClientState->SetConnectionListenerDart(nullptr); + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kStopAdvertising), + status); + }); +} + +void StartDiscoveryDart(NC_INSTANCE instance, DataDart service_id, + DiscoveryOptionsDart options_dart, + DiscoveryListenerDart listener_dart, + Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kStartDiscovery, result_cb); + kClientState->SetDiscoveryListenerDart( + std::make_unique(listener_dart)); + + NC_DISCOVERY_OPTIONS discovery_options{}; + discovery_options.common_options.strategy.type = + GetStrategy(options_dart.strategy); + discovery_options.enforce_topology_constraints = true; + // This needs to be passed in by the UI. If it's null, then no + // fast_advertisement_service. Otherwise this interface will always + // and forever be locked into 0000FE2C-0000-1000-8000-00805F9B34FB + // whenever fast advertisement service is requested. + discovery_options.fast_advertisement_service_uuid.data = + const_cast(options_dart.fast_advertisement_service_uuid.data); + discovery_options.fast_advertisement_service_uuid.size = + options_dart.fast_advertisement_service_uuid.size; + + discovery_options.common_options.allowed_mediums[NC_MEDIUM_BLUETOOTH] = + options_dart.mediums.bluetooth != 0; + discovery_options.common_options.allowed_mediums[NC_MEDIUM_BLE] = + options_dart.mediums.ble != 0; + discovery_options.common_options.allowed_mediums[NC_MEDIUM_WIFI_LAN] = + options_dart.mediums.wifi_lan != 0; + discovery_options.common_options.allowed_mediums[NC_MEDIUM_WIFI_HOTSPOT] = + options_dart.mediums.wifi_hotspot; + discovery_options.common_options.allowed_mediums[NC_MEDIUM_WEB_RTC] = + options_dart.mediums.web_rtc; + discovery_options.low_power = options_dart.low_power; + + NC_DISCOVERY_LISTENER listener{}; + listener.endpoint_distance_changed_callback = + ListenerEndpointDistanceChangedCB; + listener.endpoint_found_callback = &ListenerEndpointFoundCB; + listener.endpoint_lost_callback = &ListenerEndpointLostCB; + + NC_DATA service_id_data = + NC_DATA{.size = service_id.size, .data = service_id.data}; + NcStartDiscovery(instance, &service_id_data, &discovery_options, &listener, + [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kStartDiscovery), + status); + }); +} + +void StopDiscoveryDart(NC_INSTANCE instance, Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kStopDiscovery, result_cb); + + NcStopDiscovery(instance, [](NC_STATUS status) { + kClientState->SetDiscoveryListenerDart(nullptr); + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kStopDiscovery), + status); + }); +} + +void RequestConnectionDart(NC_INSTANCE instance, int endpoint_id, + ConnectionOptionsDart options_dart, + ConnectionRequestInfoDart info_dart, + Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kRequestConnection, result_cb); + kClientState->SetConnectionListenerDart( + std::make_unique(info_dart.connection_listener)); + + NC_CONNECTION_OPTIONS connection_options; + connection_options.enforce_topology_constraints = + options_dart.enforce_topology_constraints; + connection_options.remote_bluetooth_mac_address.data = + options_dart.remote_bluetooth_mac_address.data; + connection_options.remote_bluetooth_mac_address.size = + options_dart.remote_bluetooth_mac_address.size; + connection_options.fast_advertisement_service_uuid.data = + options_dart.fast_advertisement_service_uuid.data; + connection_options.fast_advertisement_service_uuid.size = + options_dart.fast_advertisement_service_uuid.size; + connection_options.keep_alive_interval_millis = + options_dart.keep_alive_interval_millis; + connection_options.keep_alive_timeout_millis = + options_dart.keep_alive_timeout_millis; + + connection_options.common_options.allowed_mediums[NC_MEDIUM_BLUETOOTH] = + options_dart.mediums.bluetooth != 0; + connection_options.common_options.allowed_mediums[NC_MEDIUM_BLE] = + options_dart.mediums.ble != 0; + connection_options.common_options.allowed_mediums[NC_MEDIUM_WIFI_LAN] = + options_dart.mediums.wifi_lan != 0; + connection_options.common_options.allowed_mediums[NC_MEDIUM_WIFI_HOTSPOT] = + options_dart.mediums.wifi_hotspot; + connection_options.common_options.allowed_mediums[NC_MEDIUM_WEB_RTC] = + options_dart.mediums.web_rtc; + + NC_CONNECTION_REQUEST_INFO request_info{}; + + request_info.endpoint_info.data = info_dart.endpoint_info.data; + request_info.endpoint_info.size = info_dart.endpoint_info.size; + request_info.initiated_callback = ListenerInitiatedCB; + request_info.accepted_callback = ListenerAcceptedCB; + request_info.rejected_callback = ListenerRejectedCB; + request_info.disconnected_callback = ListenerDisconnectedCB; + request_info.bandwidth_changed_callback = ListenerBandwidthChangedCB; + + NcRequestConnection(instance, endpoint_id, &request_info, &connection_options, + [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kRequestConnection), + status); + }); +} + +void AcceptConnectionDart(NC_INSTANCE instance, int endpoint_id, + PayloadListenerDart listener_dart, + Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kAcceptConnection, result_cb); + kClientState->SetPayloadListenerDart( + std::make_unique(listener_dart)); + + NC_PAYLOAD_LISTENER listener{}; + listener.received_callback = &ListenerPayloadCB; + listener.progress_updated_callback = &ListenerPayloadProgressCB; + + NcAcceptConnection(instance, endpoint_id, listener, [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kAcceptConnection), + status); + }); +} + +void RejectConnectionDart(NC_INSTANCE instance, int endpoint_id, + Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kRejectConnection, result_cb); + + NcRejectConnection(instance, endpoint_id, [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kRejectConnection), + status); + }); +} + +void DisconnectFromEndpointDart(NC_INSTANCE instance, int endpoint_id, + Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort( + NearbyConnectionsApi::kDisconnectFromEndpoint, result_cb); + + NcDisconnectFromEndpoint(instance, endpoint_id, [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kDisconnectFromEndpoint), + status); + }); +} + +void SendPayloadDart(NC_INSTANCE instance, int endpoint_id, + PayloadDart payload_dart, Dart_Port result_cb) { + if (instance == nullptr) { + PostResult(result_cb, NC_STATUS_ERROR); + return; + } + + kClientState->PushNearbyConnectionsApiPort(NearbyConnectionsApi::kSendPayload, + result_cb); + std::vector endpoint_ids = {endpoint_id}; + + NEARBY_LOGS(INFO) << "Payload type: " << payload_dart.type; + switch (payload_dart.type) { + case PAYLOAD_TYPE_UNKNOWN: + case PAYLOAD_TYPE_STREAM: + NEARBY_LOGS(INFO) << "Payload type not supported yet"; + PostResult(result_cb, NC_STATUS_PAYLOADUNKNOWN); + break; + case PAYLOAD_TYPE_BYTE: { + NC_PAYLOAD payload{}; + payload.id = GeneratePayloadId(); + payload.type = NC_PAYLOAD_TYPE_BYTES; + payload.direction = NC_PAYLOAD_DIRECTION_INCOMING; + payload.content.bytes.content.data = payload_dart.data.data; + payload.content.bytes.content.size = payload_dart.data.size; + + const int *endpoint_ids_ptr = endpoint_ids.data(); + NcSendPayload(instance, endpoint_ids.size(), endpoint_ids_ptr, &payload, + [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kSendPayload), + status); + }); + break; + } + case PAYLOAD_TYPE_FILE: + NEARBY_LOGS(INFO) << "File name: " + << std::string(payload_dart.data.data, + payload_dart.data.size) + << ", size " << payload_dart.size; + std::string file_name_str(payload_dart.data.data, payload_dart.data.size); + + NC_PAYLOAD payload{}; + payload.id = GeneratePayloadId(); + payload.type = NC_PAYLOAD_TYPE_FILE; + payload.direction = NC_PAYLOAD_DIRECTION_OUTGOING; + payload.content.file.file_name = + const_cast(file_name_str.c_str()); + payload.content.file.parent_folder = nullptr; + const int *endpoint_ids_ptr = endpoint_ids.data(); + NC_PAYLOAD moved_payload = std::move(payload); + NcSendPayload(instance, endpoint_ids.size(), endpoint_ids_ptr, + &moved_payload, [](NC_STATUS status) { + ResultCB(kClientState->PopNearbyConnectionsApiPort( + NearbyConnectionsApi::kSendPayload), + status); + }); + + break; + } +} diff --git a/connections/dart/nc_adapter_dart.h b/connections/dart/nc_adapter_dart.h new file mode 100644 index 00000000..fc756f97 --- /dev/null +++ b/connections/dart/nc_adapter_dart.h @@ -0,0 +1,198 @@ +// Copyright 2024 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_DART_NC_ADAPTER_DART_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_DART_NC_ADAPTER_DART_H_ + +#include "third_party/dart_lang/v2/runtime/include/dart_api_dl.h" +#include "third_party/dart_lang/v2/runtime/include/dart_native_api.h" +#include "connections/c/nc.h" +#include "connections/c/nc_types.h" +#include "connections/dart/nc_adapter_def.h" +#include "connections/dart/nc_adapter_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static void ResultCB(NC_STATUS status); + +static void ListenerInitiatedCB( + NC_INSTANCE instance, int endpoint_id, + const NC_CONNECTION_RESPONSE_INFO &connection_response_info); +static void ListenerAcceptedCB(NC_INSTANCE instance, int endpoint_id); +static void ListenerRejectedCB(NC_INSTANCE instance, int endpoint_id, + NC_STATUS status); +static void ListenerDisconnectedCB(NC_INSTANCE instance, int endpoint_id); +static void ListenerBandwidthChangedCB(NC_INSTANCE instance, int endpoint_id, + NC_MEDIUM medium); +static void ListenerEndpointFoundCB(NC_INSTANCE instance, int endpoint_id, + const NC_DATA &endpoint_info, + const NC_DATA &service_id); +static void ListenerEndpointLostCB(NC_INSTANCE instance, int endpoint_id); +static void ListenerEndpointDistanceChangedCB(NC_INSTANCE instance, + int endpoint_id, + NC_DISTANCE_INFO distance_info); +static void ListenerPayloadCB(NC_INSTANCE instance, int endpoint_id, + const NC_PAYLOAD &payload); +static void ListenerPayloadProgressCB( + NC_INSTANCE instance, int endpoint_id, + const NC_PAYLOAD_PROGRESS_INFO &payload_progress_info); + +DART_API NC_INSTANCE CreateServiceDart(); +DART_API void CloseServiceDart(NC_INSTANCE instance); + +DART_API int GetLocalEndpointIdDart(NC_INSTANCE instance); + +DART_API void EnableBleV2Dart(NC_INSTANCE instance, int64_t enable, + Dart_Port result_cb); + +// Starts advertising an endpoint for a local app. +// +// service_id - An identifier to advertise your app to other endpoints. +// This can be an arbitrary string, so long as it uniquely +// identifies your service. A good default is to use your +// app's package name. +// options_dart - options for advertising +// info_dart - Including callbacks notified when remote +// endpoints request a connection to this endpoint. +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK if advertising started successfully. +// Status::STATUS_ALREADY_ADVERTISING if the app is already advertising. +// Status::STATUS_OUT_OF_ORDER_API_CALL if the app is currently +// connected to remote endpoints; call StopAllEndpoints first. +DART_API void StartAdvertisingDart(NC_INSTANCE instance, DataDart service_id, + AdvertisingOptionsDart options_dart, + ConnectionRequestInfoDart info_dart, + Dart_Port result_cb); + +// Stops advertising a local endpoint. Should be called after calling +// StartAdvertising, as soon as the application no longer needs to advertise +// itself or goes inactive. Payloads can still be sent to connected +// endpoints after advertising ends. +// +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK if none of the above errors occurred. +DART_API void StopAdvertisingDart(NC_INSTANCE instance, Dart_Port result_cb); + +// Starts discovery for remote endpoints with the specified service ID. +// +// service_id - The ID for the service to be discovered, as specified in +// the corresponding call to StartAdvertising. +// options - The options for discovery. +// listener - Callbacks notified when a remote endpoint is discovered. +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK if discovery started successfully. +// Status::STATUS_ALREADY_DISCOVERING if the app is already +// discovering the specified service. +// Status::STATUS_OUT_OF_ORDER_API_CALL if the app is currently +// connected to remote endpoints; call StopAllEndpoints first. +DART_API void StartDiscoveryDart(NC_INSTANCE instance, DataDart service_id, + DiscoveryOptionsDart options_dart, + DiscoveryListenerDart listener_dart, + Dart_Port result_cb); + +// Stops discovery for remote endpoints, after a previous call to +// StartDiscovery, when the client no longer needs to discover endpoints or +// goes inactive. Payloads can still be sent to connected endpoints after +// discovery ends. +// +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK if none of the above errors occurred. +DART_API void StopDiscoveryDart(NC_INSTANCE instance, Dart_Port result_cb); + +// Sends a request to connect to a remote endpoint. +// +// endpoint_id - The identifier for the remote endpoint to which a +// connection request will be sent. Should match the value +// provided in a call to +// DiscoveryListener::endpoint_found_cb() +// options_dart - The options for connection. +// info_dart - Connection parameters: +// > name - A human readable name for the local endpoint, to appear on +// the remote endpoint. +// > listener - Callbacks notified when the remote endpoint sends a +// response to the connection request. +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK if the connection request was sent. +// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT if the app already +// has a connection to the specified endpoint. +// Status::STATUS_RADIO_ERROR if we failed to connect because of an +// issue with Bluetooth/WiFi. +// Status::STATUS_ERROR if we failed to connect for any other reason. +DART_API void RequestConnectionDart(NC_INSTANCE instance, int endpoint_id, + ConnectionOptionsDart options_dart, + ConnectionRequestInfoDart info_dart, + Dart_Port result_cb); + +// Accepts a connection to a remote endpoint. This method must be called +// before Payloads can be exchanged with the remote endpoint. +// +// endpoint_id - The identifier for the remote endpoint. Should match the +// value provided in a call to +// ConnectionListener::onConnectionInitiated. +// listener_dart - A callback for payloads exchanged with the remote endpoint. +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK if the connection request was accepted. +// Status::STATUS_ALREADY_CONNECTED_TO_ENDPOINT if the app already. +// has a connection to the specified endpoint. +DART_API void AcceptConnectionDart(NC_INSTANCE instance, int endpoint_id, + PayloadListenerDart listener_dart, + Dart_Port result_cb); + +DART_API void RejectConnectionDart(NC_INSTANCE instance, int endpoint_id, + Dart_Port result_cb); + +// Disconnects from a remote endpoint. {@link Payload}s can no longer be sent +// to or received from the endpoint after this method is called. +// endpoint_id - The identifier for the remote endpoint to disconnect from. +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OK - finished successfully. +DART_API void DisconnectFromEndpointDart(NC_INSTANCE instance, int endpoint_id, + Dart_Port result_cb); + +// Sends a Payload to a remote endpoint. Payloads can only be sent to remote +// endpoints once a notice of connection acceptance has been delivered via +// ConnectionListener::onConnectionResult(). +// +// endpoint_id - Remote endpoint identifier for the to which the +// payload should be sent. +// payload - The Payload to be sent. +// result_cb - to access the status of the operation when available. +// Possible status codes include: +// Status::STATUS_OUT_OF_ORDER_API_CALL if the device has not first +// performed advertisement or discovery (to set the Strategy.) +// Status::STATUS_ENDPOINT_UNKNOWN if there's no active (or pending) +// connection to the remote endpoint. +// Status::STATUS_OK if none of the above errors occurred. Note that this +// indicates that Nearby Connections will attempt to send the Payload, +// but not that the send has successfully completed yet. Errors might +// still occur during transmission (and at different times for +// different endpoints), and will be delivered via +// PayloadCallback#onPayloadTransferUpdate. +DART_API void SendPayloadDart(NC_INSTANCE instance, int endpoint_id, + PayloadDart payload_dart, Dart_Port result_cb); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_DART_NC_ADAPTER_DART_H_ diff --git a/connections/dart/nc_adapter_def.h b/connections/dart/nc_adapter_def.h new file mode 100644 index 00000000..059d6a43 --- /dev/null +++ b/connections/dart/nc_adapter_def.h @@ -0,0 +1,31 @@ +// Copyright 2024 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_DART_NC_ADAPTER_DEF_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_DART_NC_ADAPTER_DEF_H_ + +#ifdef _WIN32 // These storage class specifiers only matter to win32 dll + // builds. +#ifdef NC_DART_DLL +// If we're building the core, we're exporting. +#define DART_API __declspec(dllexport) +#else // !NC_DLL +// If we're not building the core, we're importing. +#define DART_API __declspec(dllimport) +#endif // NC_DLL +#else // !_WIN32 +#define DART_API // We're not building a win32 dll, leave the source unchanged. +#endif // _WIN32 + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_DART_NC_ADAPTER_DEF_H_ diff --git a/connections/dart/nc_adapter_types.h b/connections/dart/nc_adapter_types.h new file mode 100644 index 00000000..15cac067 --- /dev/null +++ b/connections/dart/nc_adapter_types.h @@ -0,0 +1,161 @@ +// Copyright 2024 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_DART_NC_ADAPTER_TYPES_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_DART_NC_ADAPTER_TYPES_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum StrategyDart { + // LINT.IfChange + STRATEGY_UNKNOWN = -1, + STRATEGY_P2P_CLUSTER = 0, + STRATEGY_P2P_STAR, + STRATEGY_P2P_POINT_TO_POINT, + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/strategy.dart) +}; + +enum PayloadTypeDart { + // LINT.IfChange + PAYLOAD_TYPE_UNKNOWN = 0, + PAYLOAD_TYPE_BYTE, + PAYLOAD_TYPE_STREAM, + PAYLOAD_TYPE_FILE, + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/payload.dart) +}; + +struct MediumsDart { + // LINT.IfChange + int64_t bluetooth; + int64_t ble; + int64_t wifi_lan; + int64_t wifi_hotspot; + int64_t web_rtc; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/mediums.dart) +}; + +struct DataDart { + // LINT.IfChange + int64_t size; + char *data; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/data.dart) +}; + +struct AdvertisingOptionsDart { + // LINT.IfChange + StrategyDart strategy; + int64_t auto_upgrade_bandwidth; + int64_t enforce_topology_constraints; + int64_t low_power; + + // Whether this is intended to be used in conjunction with InjectEndpoint(). + int64_t is_out_of_band_connection = false; + DataDart fast_advertisement_service_uuid; + + // The information about this device (eg. name, device type), + // to appear on the remote device. + // Defined by client/application. + DataDart device_info; + + MediumsDart mediums; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/advertising_options.dart) +}; + +struct ConnectionOptionsDart { + // LINT.IfChange + StrategyDart strategy; + + // Whether this is intended to be used in conjunction with InjectEndpoint(). + int64_t auto_upgrade_bandwidth; + int64_t enforce_topology_constraints; + int64_t low_power; + + // Whether this is intended to be used in conjunction with InjectEndpoint(). + int64_t is_out_of_band_connection = false; + DataDart remote_bluetooth_mac_address; + DataDart fast_advertisement_service_uuid; + int64_t keep_alive_interval_millis; + int64_t keep_alive_timeout_millis; + + MediumsDart mediums; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/connection_options.dart) +}; + +struct DiscoveryOptionsDart { + // LINT.IfChange + StrategyDart strategy; + int64_t auto_upgrade_bandwidth; + int64_t enforce_topology_constraints; + + // Whether this is intended to be used in conjunction with InjectEndpoint(). + int64_t is_out_of_band_connection = false; + DataDart fast_advertisement_service_uuid; + DataDart remote_bluetooth_mac_address; + int64_t low_power; + MediumsDart mediums; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/discovery_options.dart) +}; + +struct DiscoveryListenerDart { + // LINT.IfChange + int64_t found_dart_port; + int64_t lost_dart_port; + int64_t distance_changed_dart_port; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/discovery_listener.dart) +}; + +struct PayloadListenerDart { + // LINT.IfChange + int64_t initial_byte_info_port; + int64_t initial_stream_info_port; + int64_t initial_file_info_port; + int64_t payload_progress_dart_port; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/payload_listener.dart) +}; + +struct ConnectionListenerDart { + // LINT.IfChange + int64_t initiated_dart_port; + int64_t accepted_dart_port; + int64_t rejected_dart_port; + int64_t disconnected_dart_port; + int64_t bandwidth_changed_dart_port; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/connection_listener.dart) +}; + +struct ConnectionRequestInfoDart { + // LINT.IfChange + DataDart endpoint_info; + ConnectionListenerDart connection_listener; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/connection_request_info.dart) +}; + +struct PayloadDart { + // LINT.IfChange + int64_t id; + PayloadTypeDart type; + int64_t size; + DataDart data; + // LINT.ThenChange(//depot/google3/location/nearby/apps/helloconnections/plugins/nearby_connections/platform/lib/types/payload.dart) +}; + +#ifdef __cplusplus +} +#endif + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_DART_NC_ADAPTER_TYPES_H_ diff --git a/connections/dart/nearby_connections_client_state.cc b/connections/dart/nearby_connections_client_state.cc new file mode 100644 index 00000000..2aef752b --- /dev/null +++ b/connections/dart/nearby_connections_client_state.cc @@ -0,0 +1,104 @@ +// Copyright 2024 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. + +#include "connections/dart/nearby_connections_client_state.h" + +#include +#include +#include +#include + +#include "absl/synchronization/mutex.h" +#include "third_party/dart_lang/v2/runtime/include/dart_api.h" +#include "connections/c/nc_types.h" +#include "connections/dart/nc_adapter_types.h" + +namespace nearby::connections::dart { + +NC_INSTANCE NearbyConnectionsClientState::GetOpennedService() const { + absl::MutexLock lock(&mutex_); + return opened_instance_; +} + +void NearbyConnectionsClientState::SetOpennedService(NC_INSTANCE nc_instance) { + absl::MutexLock lock(&mutex_); + opened_instance_ = nc_instance; +} + +DiscoveryListenerDart* +NearbyConnectionsClientState::GetDiscoveryListenerDart() { + absl::MutexLock lock(&mutex_); + return discovery_listener_dart_.get(); +} + +void NearbyConnectionsClientState::SetDiscoveryListenerDart( + std::unique_ptr discovery_listener_dart) { + absl::MutexLock lock(&mutex_); + discovery_listener_dart_ = std::move(discovery_listener_dart); +} + +ConnectionListenerDart* +NearbyConnectionsClientState::GetConnectionListenerDart() { + absl::MutexLock lock(&mutex_); + return connection_listener_dart_.get(); +} + +void NearbyConnectionsClientState::SetConnectionListenerDart( + std::unique_ptr connection_listener_dart) { + absl::MutexLock lock(&mutex_); + connection_listener_dart_ = std::move(connection_listener_dart); +} + +PayloadListenerDart* NearbyConnectionsClientState::GetPayloadListenerDart() { + absl::MutexLock lock(&mutex_); + return payload_listener_dart_.get(); +} + +void NearbyConnectionsClientState::SetPayloadListenerDart( + std::unique_ptr payload_listener_dart) { + absl::MutexLock lock(&mutex_); + payload_listener_dart_ = std::move(payload_listener_dart); +} + +std::optional +NearbyConnectionsClientState::PopNearbyConnectionsApiPort( + NearbyConnectionsApi api) { + absl::MutexLock lock(&mutex_); + std::deque& port_list = nearby_connections_api_ports_[api]; + if (port_list.empty()) { + return std::nullopt; + } + + Dart_Port port = port_list.front(); + port_list.pop_front(); + return port; +} + +void NearbyConnectionsClientState::PushNearbyConnectionsApiPort( + NearbyConnectionsApi api, Dart_Port dart_port) { + absl::MutexLock lock(&mutex_); + std::deque& port_list = nearby_connections_api_ports_[api]; + port_list.push_back(dart_port); +} + +void NearbyConnectionsClientState::reset() { + absl::MutexLock lock(&mutex_); + opened_instance_ = nullptr; + nearby_connections_api_ports_.clear(); + discovery_listener_dart_.reset(); + connection_listener_dart_.reset(); + payload_listener_dart_.reset(); +} + +} // namespace nearby::connections::dart diff --git a/connections/dart/nearby_connections_client_state.h b/connections/dart/nearby_connections_client_state.h new file mode 100644 index 00000000..5d846853 --- /dev/null +++ b/connections/dart/nearby_connections_client_state.h @@ -0,0 +1,95 @@ +// Copyright 2024 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_DART_NEARBY_CONNECTIONS_CLIENT_STATE_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_DART_NEARBY_CONNECTIONS_CLIENT_STATE_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/synchronization/mutex.h" +#include "third_party/dart_lang/v2/runtime/include/dart_api.h" +#include "connections/c/nc.h" +#include "connections/dart/nc_adapter_types.h" + +namespace nearby::connections::dart { + +// This class maintains the client state of Nearby Connections. An applicaiton +// should only maintain one client. +class NearbyConnectionsClientState { + public: + enum class NearbyConnectionsApi { + kStartAdvertising, + kStopAdvertising, + kStartDiscovery, + kStopDiscovery, + kRequestConnection, + kAcceptConnection, + kRejectConnection, + kDisconnectFromEndpoint, + kSendPayload, + kEnableBleV2 + }; + + NearbyConnectionsClientState() = default; + NearbyConnectionsClientState(const NearbyConnectionsClientState&) = delete; + NearbyConnectionsClientState& operator=(const NearbyConnectionsClientState&) = + delete; + + NC_INSTANCE GetOpennedService() const ABSL_LOCKS_EXCLUDED(mutex_); + void SetOpennedService(NC_INSTANCE nc_instance) ABSL_LOCKS_EXCLUDED(mutex_); + + DiscoveryListenerDart* GetDiscoveryListenerDart() ABSL_LOCKS_EXCLUDED(mutex_); + void SetDiscoveryListenerDart( + std::unique_ptr discovery_listener_dart) + ABSL_LOCKS_EXCLUDED(mutex_); + + ConnectionListenerDart* GetConnectionListenerDart() + ABSL_LOCKS_EXCLUDED(mutex_); + void SetConnectionListenerDart( + std::unique_ptr connection_listener_dart) + ABSL_LOCKS_EXCLUDED(mutex_); + + PayloadListenerDart* GetPayloadListenerDart() ABSL_LOCKS_EXCLUDED(mutex_); + void SetPayloadListenerDart( + std::unique_ptr payload_listener_dart) + ABSL_LOCKS_EXCLUDED(mutex_); + + std::optional PopNearbyConnectionsApiPort(NearbyConnectionsApi api) + ABSL_LOCKS_EXCLUDED(mutex_); + void PushNearbyConnectionsApiPort(NearbyConnectionsApi api, + Dart_Port dart_port) + ABSL_LOCKS_EXCLUDED(mutex_); + + void reset() ABSL_LOCKS_EXCLUDED(mutex_); + + private: + mutable absl::Mutex mutex_; + + NC_INSTANCE opened_instance_ ABSL_GUARDED_BY(mutex_) = nullptr; + absl::flat_hash_map> + nearby_connections_api_ports_ ABSL_GUARDED_BY(mutex_); + std::unique_ptr discovery_listener_dart_ + ABSL_GUARDED_BY(mutex_); + std::unique_ptr connection_listener_dart_ + ABSL_GUARDED_BY(mutex_); + std::unique_ptr payload_listener_dart_ + ABSL_GUARDED_BY(mutex_); +}; + +} // namespace nearby::connections::dart + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_DART_NEARBY_CONNECTIONS_CLIENT_STATE_H_ diff --git a/connections/implementation/BUILD b/connections/implementation/BUILD index 649b57f2..c5c8fb56 100644 --- a/connections/implementation/BUILD +++ b/connections/implementation/BUILD @@ -42,6 +42,7 @@ cc_library( "p2p_star_pcp_handler.cc", "payload_manager.cc", "pcp_manager.cc", + "reconnect_manager.cc", "service_controller_router.cc", "webrtc_bwu_handler.cc", "webrtc_bwu_handler_stub.cc", @@ -85,6 +86,7 @@ cc_library( "pcp.h", "pcp_handler.h", "pcp_manager.h", + "reconnect_manager.h", "service_controller.h", "service_controller_router.h", "service_id_constants.h", @@ -104,10 +106,11 @@ cc_library( "-DNO_WEBRTC", ], visibility = [ + "//chrome/chromeos/assistant/data_migration/lib:__pkg__", "//connections:__pkg__", "//connections/implementation/fuzzers:__pkg__", - "//location/nearby/cpp/sharing/implementation:__pkg__", - "//third_party/nearby/sharing:__subpackages__", + "//connections/implementation/mediums/multiplex:__pkg__", + "//sharing:__subpackages__", ], deps = [ "//connections:core_types", @@ -119,6 +122,7 @@ cc_library( "//connections/v3:v3_types", "//internal/analytics:event_logger", "//internal/flags:nearby_flags", + "//internal/interop:authentication_status", "//internal/interop:authentication_transport_interface", "//internal/interop:device", "//internal/platform:base", @@ -130,7 +134,8 @@ cc_library( "//internal/platform:util", "//internal/platform/implementation:comm", "//internal/platform/implementation:platform", - "//internal/platform/implementation/shared:file", + "//internal/platform/implementation:types", + "//internal/platform/implementation:wifi_utils", "//internal/proto/analytics:connections_log_cc_proto", "//proto:connections_enums_cc_proto", "@com_google_absl//absl/base:core_headers", @@ -140,7 +145,8 @@ cc_library( "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/functional:bind_front", "@com_google_absl//absl/log:check", - "@com_google_absl//absl/memory", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", @@ -172,6 +178,7 @@ cc_library( hdrs = [ "fake_bwu_handler.h", "fake_endpoint_channel.h", + "mock_device.h", "mock_service_controller.h", "mock_service_controller_router.h", "offline_simulation_user.h", @@ -186,8 +193,8 @@ cc_library( "//connections/implementation/flags:connections_flags", "//connections/v3:v3_types", "//internal/flags:nearby_flags", + "//internal/interop:device", "//internal/platform:base", - "//internal/platform:test_util", "//internal/platform:types", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/functional:bind_front", @@ -197,35 +204,61 @@ cc_library( ) cc_test( - name = "core_internal_test", - size = "small", - timeout = "moderate", + name = "bwu_test", srcs = [ "base_bwu_handler_test.cc", - "base_endpoint_channel_test.cc", - "base_pcp_handler_test.cc", - "ble_advertisement_test.cc", - "bluetooth_device_name_test.cc", + "bluetooth_bwu_test.cc", "bwu_manager_test.cc", - "client_proxy_test.cc", - "connections_authentication_transport_test.cc", - "encryption_runner_test.cc", - "endpoint_channel_manager_test.cc", - "endpoint_manager_test.cc", - "injected_bluetooth_device_store_test.cc", - "internal_payload_factory_test.cc", - "offline_frames_validator_test.cc", - "offline_service_controller_test.cc", + "wifi_direct_bwu_test.cc", + "wifi_hotspot_bwu_test.cc", + ], + deps = [ + ":internal", + ":internal_test", + "//connections:core_types", + "//connections/implementation/flags:connections_flags", + "//connections/implementation/mediums", + "//internal/flags:nearby_flags", + "//internal/platform:base", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//internal/proto/analytics:connections_log_cc_proto", + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "pcp_manager_test", + srcs = ["pcp_manager_test.cc"], + deps = [ + ":internal", + ":internal_test", + "//connections:core_types", + "//connections/v3:v3_types", + "//internal/platform:base", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "pcp_handler_test", + timeout = "moderate", + srcs = [ + "base_pcp_handler_test.cc", "p2p_cluster_pcp_handler_test.cc", "p2p_point_to_point_pcp_handler_test.cc", - "payload_manager_test.cc", - "pcp_manager_test.cc", - "service_controller_router_test.cc", - "wifi_direct_bwu_test.cc", - "wifi_hotspot_test.cc", - "wifi_lan_service_info_test.cc", ], - shard_count = 16, + shard_count = 8, deps = [ ":internal", ":internal_test", @@ -235,27 +268,264 @@ cc_test( "//connections/implementation/mediums", "//connections/implementation/proto:offline_wire_formats_cc_proto", "//connections/v3:v3_types", - "//internal/analytics:event_logger", "//internal/flags:nearby_flags", + "//internal/interop:authentication_status", + "//internal/interop:authentication_transport_interface", "//internal/interop:device", "//internal/platform:base", - "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep - "//internal/proto/analytics:connections_log_cc_proto", - "//internal/test", "//proto:connections_enums_cc_proto", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "advertisement_test", + srcs = [ + "ble_advertisement_test.cc", + "bluetooth_device_name_test.cc", + "wifi_lan_service_info_test.cc", + ], + deps = [ + ":internal", + "//internal/platform:base", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/status", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "offline_frames_test", + srcs = ["offline_frames_validator_test.cc"], + deps = [ + ":internal", + "//connections/implementation/flags:connections_flags", + "//connections/implementation/proto:offline_wire_formats_cc_proto", + "//internal/flags:nearby_flags", + "//internal/platform:base", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "client_proxy_test", + srcs = [ + "client_proxy_test.cc", + ], + deps = [ + ":internal", + "//base:casts", + "//connections:core_types", + "//connections/implementation/flags:connections_flags", + "//connections/v3:v3_types", + "//internal/analytics:mock_event_logger", + "//internal/flags:nearby_flags", + "//internal/interop:device", + "//internal/platform:base", + "//internal/platform:cancellation_flag", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:span", - "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "encryption_runner_test", + srcs = [ + "encryption_runner_test.cc", + ], + deps = [ + ":internal", + "//connections/implementation/analytics", + "//internal/platform:base", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", "@com_google_ukey2//:ukey2", ], ) + +cc_test( + name = "endpoint_manager_test", + srcs = [ + "endpoint_manager_test.cc", + ], + deps = [ + ":internal", + "//connections:core_types", + "//connections/implementation/analytics", + "//connections/implementation/flags:connections_flags", + "//internal/flags:nearby_flags", + "//internal/platform:base", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//internal/test", + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "endpoint_channel_test", + srcs = [ + "base_endpoint_channel_test.cc", + "endpoint_channel_manager_test.cc", + ], + deps = [ + ":internal", + "//internal/platform:base", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//internal/proto/analytics:connections_log_cc_proto", + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + "@com_google_ukey2//:ukey2", + ], +) + +cc_test( + name = "connections_authentication_transport_test", + srcs = [ + "connections_authentication_transport_test.cc", + ], + deps = [ + ":internal", + "//connections/implementation/analytics", + "//internal/platform:base", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "payload_manager_test", + srcs = [ + "payload_manager_test.cc", + ], + deps = [ + ":internal", + ":internal_test", + "//connections:core_types", + "//connections/implementation/analytics", + "//connections/implementation/flags:connections_flags", + "//internal/flags:nearby_flags", + "//internal/platform:base", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "reconnect_manager_test", + srcs = [ + "reconnect_manager_test.cc", + ], + deps = [ + ":internal", + ":internal_test", + "//connections:core_types", + "//connections/implementation/mediums", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "service_controller_test", + srcs = [ + "offline_service_controller_test.cc", + "service_controller_router_test.cc", + ], + deps = [ + ":internal", + ":internal_test", + "//connections:core_types", + "//connections/implementation/flags:connections_flags", + "//connections/v3:v3_types", + "//internal/flags:nearby_flags", + "//internal/interop:authentication_status", + "//internal/platform:base", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "injected_bluetooth_device_store_test", + srcs = [ + "injected_bluetooth_device_store_test.cc", + ], + deps = [ + ":internal", + "//internal/platform:base", + "//internal/platform:comm", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "internal_payload_factory_test", + srcs = [ + "internal_payload_factory_test.cc", + ], + deps = [ + ":internal", + "//connections:core_types", + "//connections/implementation/proto:offline_wire_formats_cc_proto", + "//internal/platform:base", + "//internal/platform:types", + "//internal/platform/implementation/g3", # build_cleaner: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/connections/implementation/analytics/BUILD b/connections/implementation/analytics/BUILD index 022bb0cd..2f9435e9 100644 --- a/connections/implementation/analytics/BUILD +++ b/connections/implementation/analytics/BUILD @@ -43,6 +43,7 @@ cc_library( "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", + "@com_google_protobuf//:protobuf_lite", ], ) @@ -56,16 +57,14 @@ cc_test( shard_count = 16, deps = [ ":analytics", - "//internal/analytics:event_logger", + "//internal/analytics:mock_event_logger", "//internal/platform:base", - "//internal/platform:comm", "//internal/platform:error_code_recorder", "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep "//internal/proto/analytics:connections_log_cc_proto", "//net/proto2/contrib/parse_proto:parse_text_proto", "//proto:connections_enums_cc_proto", - "//third_party/protobuf:protobuf_lite", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", diff --git a/connections/implementation/analytics/analytics_recorder.cc b/connections/implementation/analytics/analytics_recorder.cc index cb50febf..daa7bc21 100644 --- a/connections/implementation/analytics/analytics_recorder.cc +++ b/connections/implementation/analytics/analytics_recorder.cc @@ -27,6 +27,9 @@ #include "absl/container/btree_map.h" #include "absl/strings/string_view.h" #include "absl/time/time.h" +#include "connections/implementation/analytics/connection_attempt_metadata_params.h" +#include "connections/payload_type.h" +#include "connections/strategy.h" #include "internal/analytics/event_logger.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/error_code_params.h" @@ -36,6 +39,7 @@ #include "internal/platform/single_thread_executor.h" #include "internal/proto/analytics/connections_log.pb.h" #include "proto/connections_enums.pb.h" +#include "google/protobuf/repeated_ptr_field.h" namespace nearby { namespace analytics { @@ -43,6 +47,7 @@ namespace analytics { namespace { const char kVersion[] = "v1.0.0"; constexpr absl::string_view kOnStartClientSession = "OnStartClientSession"; +const absl::Duration kConnectionTokenMaxLife = absl::Hours(24); } // namespace using ::location::nearby::analytics::proto::ConnectionsLog; @@ -95,6 +100,8 @@ using ::location::nearby::proto::connections::UPGRADE_SUCCESS; using ::location::nearby::proto::connections::UPGRADE_UNFINISHED; using ::location::nearby::proto::connections::UPGRADED; using ::nearby::analytics::EventLogger; +using SafeDisconnectionResult = ::location::nearby::analytics::proto:: + ConnectionsLog::EstablishedConnection::SafeDisconnectionResult; AnalyticsRecorder::AnalyticsRecorder(EventLogger *event_logger) : event_logger_(event_logger) { @@ -475,21 +482,23 @@ void AnalyticsRecorder::OnConnectionEstablished( void AnalyticsRecorder::OnConnectionClosed(const std::string &endpoint_id, Medium medium, - DisconnectionReason reason) { + DisconnectionReason reason, + SafeDisconnectionResult result) { MutexLock lock(&mutex_); NEARBY_LOGS(INFO) << __func__ << ": OnConnectionClosed is called with endpoint_id:" << endpoint_id << ", medium:" << Medium_Name(medium) - << ", reason:" << DisconnectionReason_Name(reason); + << ", reason:" << DisconnectionReason_Name(reason) + << ", result:" << result; if (!CanRecordAnalyticsLocked("OnConnectionClosed")) { return; } if (current_strategy_session_ == nullptr) { - NEARBY_LOGS(VERBOSE) - << "AnalyticsRecorder CanRecordAnalytics Unexpected call " << __func__ - << " since current_strategy_session_ is required."; + NEARBY_VLOG(1) << "AnalyticsRecorder CanRecordAnalytics Unexpected call " + << __func__ + << " since current_strategy_session_ is required."; return; } @@ -498,7 +507,7 @@ void AnalyticsRecorder::OnConnectionClosed(const std::string &endpoint_id, return; } const std::unique_ptr &logical_connection = it->second; - logical_connection->PhysicalConnectionClosed(medium, reason); + logical_connection->PhysicalConnectionClosed(medium, reason, result); if (reason != UPGRADED) { // Unless this is an upgraded connection, remove this from our active // connections. Any future communication with an endpoint will need to be @@ -703,9 +712,8 @@ void AnalyticsRecorder::OnErrorCode(const ErrorCodeParams ¶ms) { connections_log.set_version(kVersion); connections_log.set_allocated_error_code(error_code); - NEARBY_LOGS(VERBOSE) - << "AnalyticsRecorder LogErrorCode connections_log=" - << connections_log.DebugString(); + NEARBY_VLOG(1) << "AnalyticsRecorder LogErrorCode connections_log=" + << connections_log.DebugString(); // NOLINT event_logger_->Log(connections_log); }); @@ -767,16 +775,15 @@ AnalyticsRecorder::BuildConnectionAttemptMetadataParams( bool AnalyticsRecorder::CanRecordAnalyticsLocked( absl::string_view method_name) { - NEARBY_LOGS(VERBOSE) << "AnalyticsRecorder LogEvent " << method_name - << " is calling."; + NEARBY_VLOG(1) << "AnalyticsRecorder LogEvent " << method_name + << " is calling."; if (event_logger_ == nullptr) { return false; } if (session_was_logged_) { - NEARBY_LOGS(VERBOSE) - << "AnalyticsRecorder CanRecordAnalytics Unexpected call " - << method_name << " after session has already been logged."; + NEARBY_VLOG(1) << "AnalyticsRecorder CanRecordAnalytics Unexpected call " + << method_name << " after session has already been logged."; return false; } @@ -792,9 +799,8 @@ void AnalyticsRecorder::LogClientSessionLocked() { connections_log.set_allocated_client_session(client_session.release()); connections_log.set_version(kVersion); - NEARBY_LOGS(VERBOSE) - << "AnalyticsRecorder LogClientSession connections_log=" - << connections_log.DebugString(); + NEARBY_VLOG(1) << "AnalyticsRecorder LogClientSession connections_log=" + << connections_log.DebugString(); // NOLINT event_logger_->Log(connections_log); }); @@ -807,8 +813,8 @@ void AnalyticsRecorder::LogEvent(EventType event_type) { connections_log.set_event_type(event_type); connections_log.set_version(kVersion); - NEARBY_LOGS(VERBOSE) << "AnalyticsRecorder LogEvent connections_log=" - << connections_log.DebugString(); + NEARBY_VLOG(1) << "AnalyticsRecorder LogEvent connections_log=" + << connections_log.DebugString(); // NOLINT event_logger_->Log(connections_log); }); @@ -1127,7 +1133,7 @@ void AnalyticsRecorder::LogicalConnection::PhysicalConnectionEstablished( } void AnalyticsRecorder::LogicalConnection::PhysicalConnectionClosed( - Medium medium, DisconnectionReason reason) { + Medium medium, DisconnectionReason reason, SafeDisconnectionResult result) { if (current_medium_ == UNKNOWN_MEDIUM) { NEARBY_LOGS(WARNING) << "Unexpected call to PhysicalConnectionClosed() for medium " @@ -1159,7 +1165,7 @@ void AnalyticsRecorder::LogicalConnection::PhysicalConnectionClosed( established_connection->disconnection_reason()); return; } - FinishPhysicalConnection(established_connection, reason); + FinishPhysicalConnection(established_connection, reason, result); if (medium == current_medium_) { // If the EstablishedConnection we just closed was the one that we have @@ -1173,7 +1179,9 @@ void AnalyticsRecorder::LogicalConnection::CloseAllPhysicalConnections() { ConnectionsLog::EstablishedConnection *established_connection = physical_connection.second.get(); if (!established_connection->has_disconnection_reason()) { - FinishPhysicalConnection(established_connection, UNFINISHED); + FinishPhysicalConnection( + established_connection, UNFINISHED, + ConnectionsLog::EstablishedConnection::SAFE_DISCONNECTION); } } current_medium_ = UNKNOWN_MEDIUM; @@ -1192,6 +1200,15 @@ AnalyticsRecorder::LogicalConnection::GetEstablisedConnections() { std::back_inserter(established_connections), [](auto &kv) { return *kv.second; }); physical_connections_.clear(); + + for (auto &established_connection : established_connections) { + if (absl::Milliseconds(established_connection.duration_millis()) >= + kConnectionTokenMaxLife) { + NEARBY_LOGS(INFO) << "connection token exceed TTL, drop token."; + established_connection.set_connection_token(""); + } + } + return established_connections; } @@ -1269,8 +1286,9 @@ void AnalyticsRecorder::LogicalConnection::OutgoingPayloadDone( void AnalyticsRecorder::LogicalConnection::FinishPhysicalConnection( ConnectionsLog::EstablishedConnection *established_connection, - DisconnectionReason reason) { + DisconnectionReason reason, SafeDisconnectionResult result) { established_connection->set_disconnection_reason(reason); + established_connection->set_safe_disconnection_result(result); established_connection->set_duration_millis( absl::ToUnixMillis(SystemClock::ElapsedRealtime()) - established_connection->duration_millis()); diff --git a/connections/implementation/analytics/analytics_recorder.h b/connections/implementation/analytics/analytics_recorder.h index 141022af..7145f1ac 100644 --- a/connections/implementation/analytics/analytics_recorder.h +++ b/connections/implementation/analytics/analytics_recorder.h @@ -119,7 +119,7 @@ class AnalyticsRecorder { bool wifi_hotspot_enabled = false, int max_wifi_tx_speed = 0, int max_wifi_rx_speed = 0, int channel_width = -1); - // Connection established + // Connection establishedSafeDisconnectionResult void OnConnectionEstablished( const std::string &endpoint_id, location::nearby::proto::connections::Medium medium, @@ -127,7 +127,9 @@ class AnalyticsRecorder { void OnConnectionClosed( const std::string &endpoint_id, location::nearby::proto::connections::Medium medium, - location::nearby::proto::connections ::DisconnectionReason reason) + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result) ABSL_LOCKS_EXCLUDED(mutex_); // Payload @@ -246,7 +248,9 @@ class AnalyticsRecorder { const std::string &connection_token); void PhysicalConnectionClosed( location::nearby::proto::connections::Medium medium, - location::nearby::proto::connections::DisconnectionReason reason); + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result); void CloseAllPhysicalConnections(); void IncomingPayloadStarted( @@ -274,7 +278,9 @@ class AnalyticsRecorder { void FinishPhysicalConnection( location::nearby::analytics::proto::ConnectionsLog:: EstablishedConnection *established_connection, - location::nearby::proto::connections::DisconnectionReason reason); + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result); std::vector ResolvePendingPayloads( absl::btree_map> diff --git a/connections/implementation/analytics/analytics_recorder_test.cc b/connections/implementation/analytics/analytics_recorder_test.cc index c1d5fb39..a2bc091e 100644 --- a/connections/implementation/analytics/analytics_recorder_test.cc +++ b/connections/implementation/analytics/analytics_recorder_test.cc @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -25,16 +24,14 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" -#include "absl/time/clock.h" #include "absl/time/time.h" -#include "internal/analytics/event_logger.h" +#include "internal/analytics/mock_event_logger.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/error_code_params.h" #include "internal/platform/error_code_recorder.h" #include "internal/platform/exception.h" #include "internal/proto/analytics/connections_log.proto.h" #include "proto/connections_enums.proto.h" -#include "third_party/protobuf/message_lite.h" namespace nearby { namespace analytics { @@ -70,7 +67,7 @@ using ::location::nearby::proto::connections::WEB_RTC; using ::location::nearby::proto::connections::WIFI_LAN; using ::location::nearby::proto::connections::WIFI_LAN_MEDIUM_ERROR; using ::location::nearby::proto::connections::WIFI_LAN_SOCKET_CREATION; -using ::nearby::analytics::EventLogger; +using ::nearby::analytics::MockEventLogger; using ::proto2::contrib::parse_proto::ParseTextProtoOrDie; using ::testing::Contains; using ::protobuf_matchers::EqualsProto; @@ -79,7 +76,7 @@ using ::testing::proto::Partially; constexpr absl::Duration kDefaultTimeout = absl::Milliseconds(1000); -class FakeEventLogger : public EventLogger { +class FakeEventLogger : public MockEventLogger { public: explicit FakeEventLogger(CountDownLatch& client_session_done_latch) : client_session_done_latch_(client_session_done_latch) {} @@ -90,20 +87,15 @@ class FakeEventLogger : public EventLogger { start_client_session_done_latch_ptr_( start_client_session_done_latch_ptr) {} - void Log(const ::google::protobuf::MessageLite& message) override { - auto connections_log = dynamic_cast(&message); - if (connections_log == nullptr) { - return; - } - - EventType event_type = connections_log->event_type(); + void Log(const ConnectionsLog& message) override { + EventType event_type = message.event_type(); logged_event_types_.push_back(event_type); if (event_type == CLIENT_SESSION) { logged_client_session_count_++; - logged_client_session_ = connections_log->client_session(); + logged_client_session_ = message.client_session(); } if (event_type == ERROR_CODE) { - error_code_ = connections_log->error_code(); + error_code_ = message.error_code(); } if (event_type == STOP_CLIENT_SESSION) { client_session_done_latch_.CountDown(); @@ -742,7 +734,9 @@ TEST(AnalyticsRecorderTest, UnfinishedEstablishedConnectionsAddedAsUnfinished) { /*mediums=*/{BLE, BLUETOOTH}); analytics_recorder.OnConnectionEstablished(endpoint_id, BLUETOOTH, connection_token); - analytics_recorder.OnConnectionClosed(endpoint_id, BLUETOOTH, UPGRADED); + analytics_recorder.OnConnectionClosed( + endpoint_id, BLUETOOTH, UPGRADED, ConnectionsLog::EstablishedConnection:: + UNKNOWN_SAFE_DISCONNECTION_RESULT); analytics_recorder.OnConnectionEstablished(endpoint_id, WIFI_LAN, connection_token); @@ -796,7 +790,9 @@ TEST(AnalyticsRecorderTest, OutgoingPayloadUpgraded) { {endpoint_id}, payload_id, connections::PayloadType::kFile, 50); analytics_recorder.OnPayloadChunkSent(endpoint_id, payload_id, 10); analytics_recorder.OnPayloadChunkSent(endpoint_id, payload_id, 10); - analytics_recorder.OnConnectionClosed(endpoint_id, BLUETOOTH, UPGRADED); + analytics_recorder.OnConnectionClosed( + endpoint_id, BLUETOOTH, UPGRADED, + ConnectionsLog::EstablishedConnection::SAFE_DISCONNECTION); analytics_recorder.OnConnectionEstablished(endpoint_id, WIFI_LAN, connection_token); analytics_recorder.OnPayloadChunkSent(endpoint_id, payload_id, 10); @@ -804,7 +800,9 @@ TEST(AnalyticsRecorderTest, OutgoingPayloadUpgraded) { analytics_recorder.OnPayloadChunkSent(endpoint_id, payload_id, 10); analytics_recorder.OnOutgoingPayloadDone(endpoint_id, payload_id, SUCCESS); analytics_recorder.OnConnectionClosed(endpoint_id, WIFI_LAN, - LOCAL_DISCONNECTION); + LOCAL_DISCONNECTION, + ConnectionsLog::EstablishedConnection:: + SAFE_DISCONNECTION); analytics_recorder.LogSession(); ASSERT_TRUE(client_session_done_latch.Await(kDefaultTimeout).result()); @@ -1907,7 +1905,9 @@ TEST(AnalyticsRecorderOnConnectionClosedTest, // current_strategy_session_. analytics_recorder.OnConnectionEstablished(endpoint_id, BLUETOOTH, /*connection_token=*/""); - analytics_recorder.OnConnectionClosed(endpoint_id, BLUETOOTH, UPGRADED); + analytics_recorder.OnConnectionClosed( + endpoint_id, BLUETOOTH, UPGRADED, + ConnectionsLog::EstablishedConnection::SAFE_DISCONNECTION); analytics_recorder.LogSession(); diff --git a/connections/implementation/base_endpoint_channel.cc b/connections/implementation/base_endpoint_channel.cc index d404d7aa..4e142839 100644 --- a/connections/implementation/base_endpoint_channel.cc +++ b/connections/implementation/base_endpoint_channel.cc @@ -20,6 +20,7 @@ #include #include "absl/strings/str_cat.h" +#include "connections/implementation/endpoint_channel_manager.h" #include "connections/implementation/offline_frames.h" #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" @@ -31,6 +32,9 @@ namespace nearby { namespace connections { namespace { +using ::location::nearby::analytics::proto::ConnectionsLog; +using DisconnectionReason = + ::location::nearby::proto::connections::DisconnectionReason; std::int32_t BytesToInt(const ByteArray& bytes) { const char* int_bytes = bytes.data(); @@ -135,6 +139,7 @@ ExceptionOr BaseEndpointChannel::Read( { MutexLock crypto_lock(&crypto_mutex_); + Exception message_exception{Exception::kInvalidProtocolBuffer}; if (IsEncryptionEnabledLocked()) { // If encryption is enabled, decode the message. std::string input(std::move(result)); @@ -165,6 +170,7 @@ ExceptionOr BaseEndpointChannel::Read( << parser::GetFrameType(parsed.result()); } } else { + message_exception.value = parsed.exception(); NEARBY_LOGS(WARNING) << __func__ << ": Unable to parse data as unencrypted message."; } @@ -172,7 +178,7 @@ ExceptionOr BaseEndpointChannel::Read( packet_meta_data.StopEncryption(); if (result.Empty()) { NEARBY_LOGS(WARNING) << __func__ << ": Unable to parse read result."; - return ExceptionOr(Exception::kInvalidProtocolBuffer); + return ExceptionOr(message_exception); } } } @@ -266,7 +272,7 @@ void BaseEndpointChannel::Close() { // In case channel is paused, resume it first thing. MutexLock lock(&is_paused_mutex_); if (is_closed_) { - NEARBY_LOGS(VERBOSE) << "EndpointChannel already closed"; + NEARBY_VLOG(1) << "EndpointChannel already closed"; return; } is_closed_ = true; @@ -309,12 +315,19 @@ void BaseEndpointChannel::SetAnalyticsRecorder( void BaseEndpointChannel::Close( location::nearby::proto::connections::DisconnectionReason reason) { + Close(reason, ConnectionsLog::EstablishedConnection::SAFE_DISCONNECTION); +} + +void BaseEndpointChannel::Close( + location::nearby::proto::connections::DisconnectionReason reason, + SafeDisconnectionResult result) { NEARBY_LOGS(INFO) << __func__ << ": Closing endpoint channel, reason: " << reason; Close(); if (analytics_recorder_ != nullptr && !endpoint_id_.empty()) { - analytics_recorder_->OnConnectionClosed(endpoint_id_, GetMedium(), reason); + analytics_recorder_->OnConnectionClosed(endpoint_id_, GetMedium(), reason, + result); } } diff --git a/connections/implementation/base_endpoint_channel.h b/connections/implementation/base_endpoint_channel.h index 889cf4fa..570e96ac 100644 --- a/connections/implementation/base_endpoint_channel.h +++ b/connections/implementation/base_endpoint_channel.h @@ -28,6 +28,7 @@ #include "internal/platform/input_stream.h" #include "internal/platform/mutex.h" #include "internal/platform/output_stream.h" +#include "internal/platform/socket.h" namespace nearby { namespace connections { @@ -58,6 +59,10 @@ class BaseEndpointChannel : public EndpointChannel { void Close() ABSL_LOCKS_EXCLUDED(is_paused_mutex_) override; void Close(location::nearby::proto::connections::DisconnectionReason reason) override; + void Close( + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result) override; std::string GetType() const override; std::string GetServiceId() const override; std::string GetName() const override; diff --git a/connections/implementation/base_endpoint_channel_test.cc b/connections/implementation/base_endpoint_channel_test.cc index 00646455..c59ac361 100644 --- a/connections/implementation/base_endpoint_channel_test.cc +++ b/connections/implementation/base_endpoint_channel_test.cc @@ -58,7 +58,7 @@ class TestEndpointChannel : public BaseEndpointChannel { using BaseEndpointChannel::EncodeMessageForTests; - MOCK_METHOD(Medium, GetMedium, (), (const override)); + MOCK_METHOD(Medium, GetMedium, (), (const, override)); MOCK_METHOD(void, CloseImpl, (), (override)); }; diff --git a/connections/implementation/base_pcp_handler.cc b/connections/implementation/base_pcp_handler.cc index 085121d8..15a7d566 100644 --- a/connections/implementation/base_pcp_handler.cc +++ b/connections/implementation/base_pcp_handler.cc @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2021-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ #include "connections/implementation/base_pcp_handler.h" #include +#include #include #include #include @@ -22,32 +23,61 @@ #include #include "securegcm/ukey2_handshake.h" +#include "absl/base/thread_annotations.h" +#include "absl/container/btree_map.h" #include "absl/container/flat_hash_set.h" #include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "absl/time/time.h" #include "absl/types/span.h" #include "connections/advertising_options.h" #include "connections/connection_options.h" -#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/discovery_options.h" +#include "connections/implementation/analytics/connection_attempt_metadata_params.h" +#include "connections/implementation/bwu_manager.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/connections_authentication_transport.h" +#include "connections/implementation/encryption_runner.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_manager.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/mediums/mediums.h" #include "connections/implementation/mediums/utils.h" +#include "connections/implementation/mediums/webrtc_peer_id.h" #include "connections/implementation/offline_frames.h" +#include "connections/implementation/pcp.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" +#include "connections/listeners.h" #include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/params.h" #include "connections/status.h" #include "connections/v3/connection_listening_options.h" #include "connections/v3/listeners.h" #include "internal/flags/nearby_flags.h" +#include "internal/interop/authentication_status.h" #include "internal/interop/device.h" +#include "internal/interop/device_provider.h" #include "internal/platform/base64_utils.h" +#include "internal/platform/bluetooth_adapter.h" #include "internal/platform/bluetooth_connection_info.h" #include "internal/platform/bluetooth_utils.h" +#include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" #include "internal/platform/connection_info.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/future.h" +#include "internal/platform/implementation/system_clock.h" +#include "internal/platform/implementation/wifi.h" #include "internal/platform/logging.h" +#include "internal/platform/mutex_lock.h" +#include "internal/platform/prng.h" +#include "internal/platform/runnable.h" +#include "internal/platform/wifi.h" #include "internal/platform/wifi_lan_connection_info.h" #include "proto/connections_enums.pb.h" @@ -55,7 +85,20 @@ namespace nearby { namespace connections { namespace { + constexpr int kEndpointCancelAlarmTimeout = 10; + +std::string AuthenticationStatusToString(nearby::AuthenticationStatus status) { + switch (status) { + case AuthenticationStatus::kUnknown: + return "unknown"; + case AuthenticationStatus::kSuccess: + return "success"; + case AuthenticationStatus::kFailure: + return "failure"; + } +} + } // namespace using ::location::nearby::connections::ConnectionRequestFrame; @@ -81,7 +124,7 @@ BasePcpHandler::BasePcpHandler(Mediums* mediums, bwu_manager_(bwu_manager) {} BasePcpHandler::~BasePcpHandler() { - NEARBY_LOGS(VERBOSE) << __func__; + NEARBY_VLOG(1) << __func__; Shutdown(); } @@ -186,20 +229,34 @@ Status BasePcpHandler::StartAdvertising( "start-advertising", [this, client, &service_id, &info, &compatible_advertising_options, &response]() RUN_ON_PCP_HANDLER_THREAD() { - // The endpoint id inside of the advertisement is different to high - // visibility and low visibility mode. In order to decide if client - // should grab the high visibility or low visibility id, it needs to - // tell client which one right now, before - // client#StartedAdvertising. - if (ShouldEnterHighVisibilityMode(compatible_advertising_options)) { - client->EnterHighVisibilityMode(); + if (NearbyFlags::GetInstance().GetBoolFlag( + connections::config_package_nearby::nearby_connections_feature:: + kUseStableEndpointId)) { + if (ShouldEnterStableEndpointIdMode(compatible_advertising_options)) { + client->EnterStableEndpointIdMode(); + } + } else { + // The endpoint id inside of the advertisement is different to high + // visibility and low visibility mode. In order to decide if client + // should grab the high visibility or low visibility id, it needs to + // tell client which one right now, before + // client#StartedAdvertising. + if (ShouldEnterHighVisibilityMode(compatible_advertising_options)) { + client->EnterHighVisibilityMode(); + } } auto result = StartAdvertisingImpl( client, service_id, client->GetLocalEndpointId(), info.endpoint_info, compatible_advertising_options); if (!result.status.Ok()) { - client->ExitHighVisibilityMode(); + if (NearbyFlags::GetInstance().GetBoolFlag( + connections::config_package_nearby:: + nearby_connections_feature::kUseStableEndpointId)) { + client->ExitStableEndpointIdMode(); + } else { + client->ExitHighVisibilityMode(); + } response.Set(result.status); return; } @@ -292,6 +349,17 @@ bool BasePcpHandler::ShouldEnterHighVisibilityMode( advertising_options.allowed.bluetooth; } +bool BasePcpHandler::ShouldEnterStableEndpointIdMode( + const AdvertisingOptions& advertising_options) { + if (advertising_options.use_stable_endpoint_id) { + return true; + } else if (advertising_options.low_power) { + return false; + } else { + return true; + } +} + BooleanMediumSelector BasePcpHandler::ComputeIntersectionOfSupportedMediums( const PendingConnectionInfo& connection_info) { absl::flat_hash_set intersection; @@ -353,7 +421,7 @@ BooleanMediumSelector BasePcpHandler::ComputeIntersectionOfSupportedMediums( Status BasePcpHandler::StartDiscovery(ClientProxy* client, const std::string& service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener) { + DiscoveryListener listener) { Future response; DiscoveryOptions stripped_discovery_options = discovery_options; StripOutUnavailableMediums(stripped_discovery_options); @@ -362,9 +430,9 @@ Status BasePcpHandler::StartDiscovery(ClientProxy* client, stripped_discovery_options); RunOnPcpHandlerThread( "start-discovery", - [this, client, service_id, stripped_discovery_options, &listener, - &response]() RUN_ON_PCP_HANDLER_THREAD() - ABSL_LOCKS_EXCLUDED(discovered_endpoint_mutex_) { + [this, client, service_id, stripped_discovery_options, + listener = std::move(listener), &response]() RUN_ON_PCP_HANDLER_THREAD() + ABSL_LOCKS_EXCLUDED(discovered_endpoint_mutex_) mutable { // Ask the implementation to attempt to start discovery. auto result = StartDiscoveryImpl(client, service_id, stripped_discovery_options); @@ -379,9 +447,9 @@ Status BasePcpHandler::StartDiscovery(ClientProxy* client, MutexLock lock(&discovered_endpoint_mutex_); discovered_endpoints_.clear(); } - client->StartedDiscovery(service_id, GetStrategy(), listener, - absl::MakeSpan(result.mediums), - stripped_discovery_options); + client->StartedDiscovery( + service_id, GetStrategy(), std::move(listener), + absl::MakeSpan(result.mediums), stripped_discovery_options); response.Set({Status::kSuccess}); }); return WaitForResult(absl::StrCat("StartDiscovery(", service_id, ")"), @@ -480,11 +548,115 @@ EncryptionRunner::ResultListener BasePcpHandler::GetResultListener() { }; } +EncryptionRunner::ResultListener BasePcpHandler::GetResultListenerV3( + const NearbyDeviceProvider& device_provider, + const NearbyDevice& remote_device, + const EndpointChannel& endpoint_channel) { + return { + .on_success_cb = + [this, &device_provider, &remote_device, &endpoint_channel]( + const std::string& endpoint_id, + std::unique_ptr ukey2, + const std::string& auth_token, const ByteArray& raw_auth_token) { + RunOnPcpHandlerThread( + "encryption-success", + [this, &device_provider, &remote_device, &endpoint_channel, + raw_ukey2 = ukey2.release(), auth_token, + raw_auth_token]() RUN_ON_PCP_HANDLER_THREAD() mutable { + OnEncryptionSuccessRunnableV3( + remote_device, std::unique_ptr(raw_ukey2), + auth_token, raw_auth_token, endpoint_channel, + device_provider); + }); + }, + .on_failure_cb = + [this](const std::string& endpoint_id, EndpointChannel* channel) { + RunOnPcpHandlerThread( + "encryption-failure", + [this, endpoint_id, channel]() RUN_ON_PCP_HANDLER_THREAD() { + NEARBY_LOGS(ERROR) + << "Encryption failed for endpoint_id=" << endpoint_id + << " on medium=" + << location::nearby::proto::connections::Medium_Name( + channel->GetMedium()); + OnEncryptionFailureRunnable(endpoint_id, channel); + }); + }, + }; +} + +void BasePcpHandler::OnEncryptionSuccessRunnableV3( + const NearbyDevice& remote_device, std::unique_ptr ukey2, + absl::string_view auth_token, const ByteArray& raw_auth_token, + const EndpointChannel& endpoint_channel, + const NearbyDeviceProvider& device_provider) { + // Quick fail if we've been removed from pending connections while we were + // busy running UKEY2. + // TODO(b/316421187): Add test coverage + auto it = pending_connections_.find(remote_device.GetEndpointId()); + if (it == pending_connections_.end()) { + NEARBY_LOGS(ERROR) + << __func__ + << ": Connection not found on UKEY negotination complete; endpoint_id=" + << remote_device.GetEndpointId(); + return; + } + + BasePcpHandler::PendingConnectionInfo& connection_info = it->second; + + // TODO(b/300149127): Add test coverage. + if (!ukey2) { + // Fail early, if there is no crypto context. + ProcessPreConnectionInitiationFailure( + connection_info.client, connection_info.medium, + remote_device.GetEndpointId(), connection_info.channel.get(), + connection_info.is_incoming, connection_info.start_time, + {Status::kEndpointIoError}, connection_info.result.lock().get()); + return; + } + + // For the Nearby Presence MVP on ChromeOS, only outgoing connections are + // support in the RequestConnectionV3() API, and this is enforced below with + // an early return. This means `OnEncryptionSuccessRunnableV3()` only needs to + // authenticate in the initiator role (as opposed to responder). In order to + // support incoming connections post MVP, the responder role needs to be + // implemented, and triggered appropriately here. + // + // TODO(b/305004353): Authenticate the connection in the responder role for + // outgoing connections. + if (!connection_info.is_incoming) { + NEARBY_LOGS(ERROR) << __func__ + << ": only outgoing connections are supported"; + return; + } + + NEARBY_VLOG(1) + << __func__ + << ": beginning authentication to the remote device as an initiator"; + ConnectionsAuthenticationTransport connections_authentication_transport = + ConnectionsAuthenticationTransport(endpoint_channel); + connection_info.authentication_status = + device_provider.AuthenticateAsInitiator( + /*remote_device=*/remote_device, + /*shared_secret=*/auth_token, + /*authentication_transport=*/connections_authentication_transport); + NEARBY_LOGS(INFO) << __func__ << ": authentication result = " + << AuthenticationStatusToString( + connection_info.authentication_status); + + RegisterDeviceAfterEncryptionSuccess( + /*endpoint_id=*/remote_device.GetEndpointId(), + /*ukey2=*/std::move(ukey2), /*auth_token=*/auth_token, + /*raw_auth_token=*/raw_auth_token, + /*connection_info=*/connection_info); +} + void BasePcpHandler::OnEncryptionSuccessRunnable( const std::string& endpoint_id, std::unique_ptr ukey2, const std::string& auth_token, const ByteArray& raw_auth_token) { // Quick fail if we've been removed from pending connections while we were // busy running UKEY2. + // TODO(b/316421187): Add test coverage auto it = pending_connections_.find(endpoint_id); if (it == pending_connections_.end()) { NEARBY_LOGS(INFO) @@ -494,18 +666,28 @@ void BasePcpHandler::OnEncryptionSuccessRunnable( } BasePcpHandler::PendingConnectionInfo& connection_info = it->second; - Medium medium = connection_info.channel->GetMedium(); if (!ukey2) { // Fail early, if there is no crypto context. ProcessPreConnectionInitiationFailure( - connection_info.client, medium, endpoint_id, + connection_info.client, connection_info.medium, endpoint_id, connection_info.channel.get(), connection_info.is_incoming, connection_info.start_time, {Status::kEndpointIoError}, connection_info.result.lock().get()); return; } + RegisterDeviceAfterEncryptionSuccess( + /*endpoint_id=*/endpoint_id, + /*ukey2=*/std::move(ukey2), /*auth_token=*/auth_token, + /*raw_auth_token=*/raw_auth_token, + /*connection_info=*/connection_info); +} + +void BasePcpHandler::RegisterDeviceAfterEncryptionSuccess( + std::string_view endpoint_id, std::unique_ptr ukey2, + std::string_view auth_token, const ByteArray& raw_auth_token, + BasePcpHandler::PendingConnectionInfo& connection_info) { connection_info.SetCryptoContext(std::move(ukey2)); connection_info.connection_token = GetHashedConnectionToken(raw_auth_token); NEARBY_LOGS(INFO) @@ -521,14 +703,15 @@ void BasePcpHandler::OnEncryptionSuccessRunnable( // Now we register our endpoint so that we can listen for both sides to // accept. - LogConnectionAttemptSuccess(endpoint_id, connection_info); + LogConnectionAttemptSuccess(std::string(endpoint_id), connection_info); endpoint_manager_->RegisterEndpoint( - connection_info.client, endpoint_id, + connection_info.client, std::string(endpoint_id), { .remote_endpoint_info = connection_info.remote_endpoint_info, - .authentication_token = auth_token, + .authentication_token = std::string(auth_token), .raw_authentication_token = raw_auth_token, .is_incoming_connection = connection_info.is_incoming, + .authentication_status = connection_info.authentication_status, }, connection_options, std::move(connection_info.channel), connection_info.listener, connection_info.connection_token); @@ -566,7 +749,7 @@ void BasePcpHandler::OnEncryptionFailureRunnable( } ProcessPreConnectionInitiationFailure( - info.client, info.channel->GetMedium(), endpoint_id, info.channel.get(), + info.client, info.medium, endpoint_id, info.channel.get(), info.is_incoming, info.start_time, {Status::kEndpointIoError}, info.result.lock().get()); } @@ -595,6 +778,15 @@ ConnectionInfo BasePcpHandler::FillConnectionInfo( } connection_info.supported_mediums = GetSupportedConnectionMediumsByPriority(connection_options); + + if (!NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableWifiHotspotClient) || + connection_options.non_disruptive_hotspot_mode) { + // Remove Wi-Fi Hotspot if WiFi LAN is available. + StripOutWifiHotspotMedium(connection_info); + } + connection_info.keep_alive_interval_millis = connection_options.keep_alive_interval_millis; connection_info.keep_alive_timeout_millis = @@ -613,27 +805,141 @@ Status BasePcpHandler::RequestConnection( result]() RUN_ON_PCP_HANDLER_THREAD() { absl::Time start_time = SystemClock::ElapsedRealtime(); - // If we already have a pending connection, then we shouldn't allow any - // more outgoing connections to this endpoint. - if (pending_connections_.count(endpoint_id)) { + DiscoveredEndpoint* endpoint = GetDiscoveredEndpoint(endpoint_id); + if (endpoint == nullptr) { NEARBY_LOGS(INFO) - << "In requestConnection(), connection requested with " - "endpoint(id=" - << endpoint_id - << "), but we already have a pending connection with them."; - result->Set({Status::kAlreadyConnectedToEndpoint}); + << "Discovered endpoint not found: endpoint_id=" << endpoint_id; + result->Set({Status::kEndpointUnknown}); return; } - // If our child class says we can't send any more outgoing connections, - // listen to them. - if (client->ShouldEnforceTopologyConstraints() && - !CanSendOutgoingConnection(client)) { + auto remote_bluetooth_mac_address = BluetoothUtils::ToString( + connection_options.remote_bluetooth_mac_address); + if (!remote_bluetooth_mac_address.empty()) { + if (AppendRemoteBluetoothMacAddressEndpoint( + endpoint_id, remote_bluetooth_mac_address, + client->GetDiscoveryOptions())) + NEARBY_LOGS(INFO) + << "Appended remote Bluetooth MAC Address endpoint [" + << remote_bluetooth_mac_address << "]"; + } + + if (AppendWebRTCEndpoint(endpoint_id, client->GetDiscoveryOptions())) + NEARBY_LOGS(INFO) << "Appended Web RTC endpoint."; + + auto discovered_endpoints = GetDiscoveredEndpoints(endpoint_id); + std::unique_ptr channel; + ConnectImplResult connect_impl_result; + + for (auto connect_endpoint : discovered_endpoints) { + if (!MediumSupportedByClientOptions(connect_endpoint->medium, + connection_options)) + continue; + connect_impl_result = ConnectImpl(client, connect_endpoint); + if (connect_impl_result.status.Ok()) { + channel = std::move(connect_impl_result.endpoint_channel); + break; + } + } + + Medium channel_medium = + channel ? channel->GetMedium() : Medium::UNKNOWN_MEDIUM; + if (channel == nullptr) { NEARBY_LOGS(INFO) - << "In requestConnection(), client=" << client->GetClientId() - << " attempted a connection with endpoint(id=" << endpoint_id - << "), but outgoing connections are disallowed"; - result->Set({Status::kOutOfOrderApiCall}); + << "Endpoint channel not available: endpoint_id=" << endpoint_id; + ProcessPreConnectionInitiationFailure( + client, channel_medium, endpoint_id, channel.get(), + /* is_incoming = */ false, start_time, connect_impl_result.status, + result.get()); + return; + } + + NEARBY_LOGS(INFO) + << "In requestConnection(), wrote ConnectionRequestFrame " + "to endpoint_id=" + << endpoint_id; + + ConnectionInfo connection_info = + FillConnectionInfo(client, info, connection_options); + + const NearbyDevice* local_device = client->GetLocalDevice(); + Exception write_exception = WriteConnectionRequestFrame( + local_device->GetType(), local_device->ToProtoBytes(), + connection_info, channel.get()); + + if (!write_exception.Ok()) { + NEARBY_LOGS(INFO) << "Failed to send connection request: endpoint_id=" + << endpoint_id; + ProcessPreConnectionInitiationFailure( + client, channel_medium, endpoint_id, channel.get(), + /* is_incoming = */ false, start_time, {Status::kEndpointIoError}, + result.get()); + return; + } + + NEARBY_LOGS(INFO) << "Adding connection to pending set: endpoint_id=" + << endpoint_id; + + // We've successfully connected to the device, and are now about to jump + // on to the EncryptionRunner thread to start running our encryption + // protocol. We'll mark ourselves as pending in case we get another call + // to RequestConnection or OnIncomingConnection, so that we can cancel + // the connection if needed. + // Not using designated initializers here since the VS C++ compiler + // errors out indicating that MediumSelector is not an aggregate + // TODO(b/300149127): Add test coverage to `PendingConnectionInfo` + // fields. + PendingConnectionInfo pendingConnectionInfo{}; + pendingConnectionInfo.client = client; + pendingConnectionInfo.remote_endpoint_info = endpoint->endpoint_info; + pendingConnectionInfo.nonce = connection_info.nonce; + pendingConnectionInfo.is_incoming = false; + pendingConnectionInfo.start_time = start_time; + pendingConnectionInfo.listener = info.listener; + pendingConnectionInfo.connection_options = connection_options; + pendingConnectionInfo.result = result; + pendingConnectionInfo.medium = channel->GetMedium(); + pendingConnectionInfo.channel = std::move(channel); + + EndpointChannel* endpoint_channel = + pending_connections_ + .emplace(endpoint_id, std::move(pendingConnectionInfo)) + .first->second.channel.get(); + + NEARBY_LOGS(INFO) << "Initiating secure connection: endpoint_id=" + << endpoint_id; + // Next, we'll set up encryption. When it's done, our future will return + // and RequestConnection() will finish. + encryption_runner_.StartClient(client, endpoint_id, endpoint_channel, + GetResultListener()); + }); + NEARBY_LOGS(INFO) << "Waiting for connection to complete: endpoint_id=" + << endpoint_id; + auto status = + WaitForResult(absl::StrCat("RequestConnection(", endpoint_id, ")"), + client->GetClientId(), result.get()); + NEARBY_LOGS(INFO) << "Wait is complete: endpoint_id=" << endpoint_id + << "; status=" << status.value; + return status; +} + +Status BasePcpHandler::RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) { + auto result = std::make_shared>(); + std::string endpoint_id = remote_device.GetEndpointId(); + RunOnPcpHandlerThread( + "request-connection-v3", + [this, client, &info, connection_options, &remote_device, + result]() RUN_ON_PCP_HANDLER_THREAD() { + absl::Time start_time = SystemClock::ElapsedRealtime(); + std::string endpoint_id = remote_device.GetEndpointId(); + + auto connection_request_verification_status = + VerifyConnectionRequest(endpoint_id, client); + if (!connection_request_verification_status.Ok()) { + result->Set(connection_request_verification_status); return; } @@ -692,7 +998,7 @@ Status BasePcpHandler::RequestConnection( } NEARBY_LOGS(INFO) - << "In requestConnection(), wrote ConnectionRequestFrame " + << "In requestConnectionV3(), wrote ConnectionRequestFrame " "to endpoint_id=" << endpoint_id; @@ -727,15 +1033,18 @@ Status BasePcpHandler::RequestConnection( // the connection if needed. // Not using designated initializers here since the VS C++ compiler // errors out indicating that MediumSelector is not an aggregate + // For the Nearby Presence MVP on ChromeOS, only outgoing connections + // are supported in the RequestConnectionV3() API. PendingConnectionInfo pendingConnectionInfo{}; pendingConnectionInfo.client = client; pendingConnectionInfo.remote_endpoint_info = endpoint->endpoint_info; pendingConnectionInfo.nonce = connection_info.nonce; - pendingConnectionInfo.is_incoming = false; + pendingConnectionInfo.is_incoming = true; pendingConnectionInfo.start_time = start_time; pendingConnectionInfo.listener = info.listener; pendingConnectionInfo.connection_options = connection_options; pendingConnectionInfo.result = result; + pendingConnectionInfo.medium = channel->GetMedium(); pendingConnectionInfo.channel = std::move(channel); EndpointChannel* endpoint_channel = @@ -745,15 +1054,18 @@ Status BasePcpHandler::RequestConnection( NEARBY_LOGS(INFO) << "Initiating secure connection: endpoint_id=" << endpoint_id; - // Next, we'll set up encryption. When it's done, our future will return - // and RequestConnection() will finish. - encryption_runner_.StartClient(client, endpoint_id, endpoint_channel, - GetResultListener()); + // Next, we'll set up encryption and authenticate the remote device. + // When it's done, our future will return and RequestConnectionV3() + // will finish. + encryption_runner_.StartClient( + client, endpoint_id, endpoint_channel, + GetResultListenerV3(*(client->GetLocalDeviceProvider()), + remote_device, *endpoint_channel)); }); NEARBY_LOGS(INFO) << "Waiting for connection to complete: endpoint_id=" << endpoint_id; auto status = - WaitForResult(absl::StrCat("RequestConnection(", endpoint_id, ")"), + WaitForResult(absl::StrCat("RequestConnectionV3(", endpoint_id, ")"), client->GetClientId(), result.get()); NEARBY_LOGS(INFO) << "Wait is complete: endpoint_id=" << endpoint_id << "; status=" << status.value; @@ -876,7 +1188,7 @@ BasePcpHandler::GetDiscoveredEndpoints(const std::string& endpoint_id) { std::vector BasePcpHandler::GetDiscoveredEndpoints( - const location::nearby::proto::connections::Medium medium) { + location::nearby::proto::connections::Medium medium) { std::vector result; MutexLock lock(&discovered_endpoint_mutex_); for (const auto& item : discovered_endpoints_) { @@ -937,6 +1249,25 @@ mediums::WebrtcPeerId BasePcpHandler::CreatePeerIdFromAdvertisement( return mediums::WebrtcPeerId::FromSeed(ByteArray(std::move(seed))); } +void BasePcpHandler::StripOutWifiHotspotMedium( + ConnectionInfo& connection_info) { + bool has_wifi_lan = false; + for (auto medium : connection_info.supported_mediums) { + if (medium == location::nearby::proto::connections::WIFI_LAN) { + has_wifi_lan = true; + break; + } + } + + if (has_wifi_lan) { + connection_info.supported_mediums.erase( + std::remove(connection_info.supported_mediums.begin(), + connection_info.supported_mediums.end(), + Medium::WIFI_HOTSPOT), + connection_info.supported_mediums.end()); + } +} + bool BasePcpHandler::HasOutgoingConnections(ClientProxy* client) const { for (const auto& item : pending_connections_) { auto& connection = item.second; @@ -1062,7 +1393,8 @@ Status BasePcpHandler::AcceptConnection(ClientProxy* client, Exception write_exception = channel->Write(parser::ForConnectionResponse( - Status::kSuccess, client->GetLocalOsInfo())); + Status::kSuccess, client->GetLocalOsInfo(), + client->GetLocalMultiplexSocketBitmask())); if (!write_exception.Ok()) { NEARBY_LOGS(INFO) << "AcceptConnection: failed to send response: endpoint_id=" @@ -1093,7 +1425,7 @@ Status BasePcpHandler::RejectConnection(ClientProxy* client, RunOnPcpHandlerThread( "reject-connection", [this, client, endpoint_id, &response]() RUN_ON_PCP_HANDLER_THREAD() { - NEARBY_LOG(INFO, "RejectConnection: id=%s", endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "RejectConnection: id=" << endpoint_id; if (!pending_connections_.count(endpoint_id)) { NEARBY_LOGS(INFO) << "RejectConnection: no pending connection for endpoint_id=" @@ -1124,7 +1456,8 @@ Status BasePcpHandler::RejectConnection(ClientProxy* client, Exception write_exception = channel->Write(parser::ForConnectionResponse( - Status::kConnectionRejected, client->GetLocalOsInfo())); + Status::kConnectionRejected, client->GetLocalOsInfo(), + client->GetLocalMultiplexSocketBitmask())); if (!write_exception.Ok()) { NEARBY_LOGS(INFO) << "RejectConnection: failed to send response: endpoint_id=" @@ -1195,6 +1528,11 @@ void BasePcpHandler::OnIncomingFrame( client->SetRemoteOsInfo(endpoint_id, connection_response.os_info()); } + if (connection_response.has_multiplex_socket_bitmask()) { + client->SetRemoteMultiplexSocketBitmask( + endpoint_id, connection_response.multiplex_socket_bitmask()); + } + if (connection_response.has_safe_to_disconnect_version()) { NEARBY_LOGS(INFO) << "[safe-to-disconnect]: endpoint_id=" << endpoint_id @@ -1203,8 +1541,8 @@ void BasePcpHandler::OnIncomingFrame( client->SetRemoteSafeToDisconnectVersion( endpoint_id, connection_response.safe_to_disconnect_version()); } - channel_manager_->UpdateSafeToDisconnectForEndpoint(endpoint_id, - client->IsSafeToDisconnectEnabled(endpoint_id)); + channel_manager_->UpdateSafeToDisconnectForEndpoint( + endpoint_id, client->IsSafeToDisconnectEnabled(endpoint_id)); EvaluateConnectionResult(client, endpoint_id, /* can_close_immediately= */ true); @@ -1222,21 +1560,20 @@ void BasePcpHandler::OnEndpointDisconnect(ClientProxy* client, barrier.CountDown(); return; } - RunOnPcpHandlerThread("on-endpoint-disconnect", - [this, client, endpoint_id, barrier, reason]() - RUN_ON_PCP_HANDLER_THREAD() mutable { - auto item = pending_alarms_.find(endpoint_id); - if (item != pending_alarms_.end()) { - auto& alarm = item->second; - alarm->Cancel(); - pending_alarms_.erase(item); - } - ProcessPreConnectionResultFailure( - client, endpoint_id, - /* should_call_disconnect_endpoint= */ false, - reason); - barrier.CountDown(); - }); + RunOnPcpHandlerThread( + "on-endpoint-disconnect", [this, client, endpoint_id, barrier, + reason]() RUN_ON_PCP_HANDLER_THREAD() mutable { + auto item = pending_alarms_.find(endpoint_id); + if (item != pending_alarms_.end()) { + auto& alarm = item->second; + alarm->Cancel(); + pending_alarms_.erase(item); + } + ProcessPreConnectionResultFailure( + client, endpoint_id, + /* should_call_disconnect_endpoint= */ false, reason); + barrier.CountDown(); + }); } BluetoothDevice BasePcpHandler::GetRemoteBluetoothDevice( @@ -1249,21 +1586,29 @@ void BasePcpHandler::OnEndpointFound( ClientProxy* client, std::shared_ptr endpoint) { // Check if we've seen this endpoint ID before. std::string& endpoint_id = endpoint->endpoint_id; - NEARBY_LOGS(INFO) << "OnEndpointFound: id=" << endpoint_id << " [enter]"; + NEARBY_LOGS(INFO) << "OnEndpointFound: id=" << endpoint_id << ", medium=" + << location::nearby::proto::connections::Medium_Name( + endpoint->medium) + << " [enter]"; MutexLock lock(&discovered_endpoint_mutex_); auto range = discovered_endpoints_.equal_range(endpoint->endpoint_id); bool is_range_empty = range.first == range.second; DiscoveredEndpoint* owned_endpoint = nullptr; for (auto& item = range.first; item != range.second; ++item) { auto& discovered_endpoint = item->second; - if (discovered_endpoint->medium != endpoint->medium) continue; - // Check if there was a info change. If there was, report the previous - // endpoint as lost. if (discovered_endpoint->endpoint_info != endpoint->endpoint_info) { - owned_endpoint = discovered_endpoint.get(); - client->OnEndpointLost(owned_endpoint->service_id, - owned_endpoint->endpoint_id); - discovered_endpoints_.erase(item); + // Endpoint info should be same for an endpoint ID. If it is changed, + // we should reset discovered endpoints of the endpoint ID, and use the + // new endpoint info and medium as discovered endpoint. + NEARBY_LOGS(INFO) << "Endpoint info of endpoint " << endpoint_id + << " changed on medium " + << location::nearby::proto::connections::Medium_Name( + endpoint->medium); + // Report endpoint lost + client->OnEndpointLost(endpoint->service_id, endpoint->endpoint_id); + // Reset discovered endpoints + discovered_endpoints_.erase(item->first); + // Add the endpoint as discovered endpoint. owned_endpoint = discovered_endpoints_.emplace(endpoint_id, std::move(endpoint)) ->second.get(); @@ -1273,17 +1618,19 @@ void BasePcpHandler::OnEndpointFound( owned_endpoint->service_id, owned_endpoint->endpoint_id, owned_endpoint->endpoint_info, owned_endpoint->medium); return; - } else { - owned_endpoint = endpoint.get(); - break; + } + if (discovered_endpoint->medium == endpoint->medium) { + NEARBY_LOGS(INFO) << "Ignore the dup endpoint info on medium " + << location::nearby::proto::connections::Medium_Name( + endpoint->medium); + return; } } - if (!owned_endpoint) { - owned_endpoint = - discovered_endpoints_.emplace(endpoint_id, std::move(endpoint)) - ->second.get(); - } + owned_endpoint = + discovered_endpoints_.emplace(endpoint_id, std::move(endpoint)) + ->second.get(); + NEARBY_LOGS(INFO) << "Adding new medium for endpoint: endpoint_id=" << endpoint_id << "; medium=" << location::nearby::proto::connections::Medium_Name( @@ -1329,7 +1676,8 @@ void BasePcpHandler::OnEndpointLost( << absl::BytesToHexString( discovered_endpoint->endpoint_info.data()); } - NEARBY_LOGS(INFO) << "Erase Endpoint with Meduim: " + NEARBY_LOGS(INFO) << "Erase Endpoint " << endpoint.endpoint_id + << " on Medium " << location::nearby::proto::connections::Medium_Name( discovered_endpoint->medium); if (--count == 0) { @@ -1340,6 +1688,26 @@ void BasePcpHandler::OnEndpointLost( } } +void BasePcpHandler::OnInstantLost(ClientProxy* client, + const std::string& endpoint_id, + const ByteArray& endpoint_info) { + NEARBY_LOGS(INFO) << "OnInstantLost: id=" << endpoint_id; + std::vector discovered_endpoints = + GetDiscoveredEndpoints(endpoint_id); + if (discovered_endpoints.empty()) { + return; + } + + for (auto& discovered_endpoint : discovered_endpoints) { + if (discovered_endpoint->endpoint_info == endpoint_info) { + OnEndpointLost(client, *discovered_endpoint); + } + } + + NEARBY_LOGS(INFO) << "Reported lost endpoint " << endpoint_id + << " on all mediums."; +} + Status BasePcpHandler::UpdateAdvertisingOptions( ClientProxy* client, absl::string_view service_id, const AdvertisingOptions& advertising_options) { @@ -1469,9 +1837,8 @@ Exception BasePcpHandler::OnIncomingConnection( << "; device=" << absl::BytesToHexString(remote_endpoint_info.data()) << "with error: " << wrapped_frame.exception(); ProcessPreConnectionInitiationFailure( - client, medium, "", channel.get(), - /* is_incoming= */ false, start_time, {Status::kError}, nullptr); - return {Exception::kSuccess}; + client, medium, /*endpoint_id=*/"", channel.get(), + /*is_incoming=*/true, start_time, {Status::kError}, nullptr); } return wrapped_frame.GetException(); } @@ -1593,6 +1960,7 @@ Exception BasePcpHandler::OnIncomingConnection( pendingConnectionInfo.connection_options = connection_options; pendingConnectionInfo.supported_mediums = parser::ConnectionRequestMediumsToMediums(connection_request); + pendingConnectionInfo.medium = channel->GetMedium(); pendingConnectionInfo.channel = std::move(channel); auto* owned_channel = pending_connections_ @@ -1652,7 +2020,6 @@ bool BasePcpHandler::BreakTie(ClientProxy* client, // Oh. Huh. We both lost. Well, that's awkward. We'll clean up both and // just force the devices to retry. endpoint_channel->Close(); - ProcessTieBreakLoss(client, endpoint_id, &info); NEARBY_LOGS(INFO) @@ -1670,13 +2037,39 @@ bool BasePcpHandler::BreakTie(ClientProxy* client, return false; } +Status BasePcpHandler::VerifyConnectionRequest(const std::string& endpoint_id, + ClientProxy* client) { + // If we already have a pending connection, then we shouldn't allow any + // more outgoing connections to this endpoint. + if (pending_connections_.count(endpoint_id)) { + NEARBY_LOGS(INFO) + << "In requestConnection(), connection requested with " + "endpoint(id=" + << endpoint_id + << "), but we already have a pending connection with them."; + return {Status::kAlreadyConnectedToEndpoint}; + } + + // If our child class says we can't send any more outgoing connections, + // listen to them. + if (client->ShouldEnforceTopologyConstraints() && + !CanSendOutgoingConnection(client)) { + NEARBY_LOGS(INFO) << "In requestConnection(), client=" + << client->GetClientId() + << " attempted a connection with endpoint(id=" + << endpoint_id + << "), but outgoing connections are disallowed"; + return {Status::kOutOfOrderApiCall}; + } + return {Status::kSuccess}; +} + void BasePcpHandler::ProcessTieBreakLoss( ClientProxy* client, const std::string& endpoint_id, BasePcpHandler::PendingConnectionInfo* info) { ProcessPreConnectionInitiationFailure( - client, info->channel->GetMedium(), endpoint_id, info->channel.get(), - info->is_incoming, info->start_time, {Status::kEndpointIoError}, - info->result.lock().get()); + client, info->medium, endpoint_id, info->channel.get(), info->is_incoming, + info->start_time, {Status::kEndpointIoError}, info->result.lock().get()); ProcessPreConnectionResultFailure(client, endpoint_id, /* should_call_disconnect_endpoint= */ true, DisconnectionReason::IO_ERROR); @@ -1766,8 +2159,8 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client, bool can_close_immediately) { // Short-circuit immediately if we're not in an actionable state yet. We will // be called again once the other side has made their decision. - if (!client->IsConnectionAccepted(endpoint_id) && - !client->IsConnectionRejected(endpoint_id)) { + bool is_connection_accepted = client->IsConnectionAccepted(endpoint_id); + if (!is_connection_accepted && !client->IsConnectionRejected(endpoint_id)) { if (!client->HasLocalEndpointResponded(endpoint_id)) { NEARBY_LOGS(INFO) << "ConnectionResult: local client did not respond; endpoint_id=" @@ -1791,7 +2184,15 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client, auto pair = pending_connections_.extract(it); BasePcpHandler::PendingConnectionInfo& connection_info = pair.mapped(); - bool is_connection_accepted = client->IsConnectionAccepted(endpoint_id); + std::shared_ptr endpint_channel = + channel_manager_->GetChannelForEndpoint(endpoint_id); + if (endpint_channel == nullptr) { + NEARBY_LOGS(WARNING) << "No endpint channel for endpoint_id=" + << endpoint_id; + return; + } + + Medium medium = endpint_channel->GetMedium(); Status response_code; if (is_connection_accepted) { @@ -1814,6 +2215,28 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client, std::move(context))) { response_code = {Status::kEndpointUnknown}; } + + std::shared_ptr channel = + channel_manager_->GetChannelForEndpoint(endpoint_id); + if (channel != nullptr) { + if (client->IsMultiplexSocketSupported(endpoint_id, + channel->GetMedium())) { + if (!channel->EnableMultiplexSocket()) { + NEARBY_LOGS(INFO) + << "MultiplexSocket is not implemented for Medium: " + << location::nearby::proto::connections::Medium_Name( + channel->GetMedium()); + } else { + NEARBY_LOGS(INFO) + << "MultiplexSocket is supported for Medium: " + << location::nearby::proto::connections::Medium_Name( + channel->GetMedium()) + << " on both sides."; + } + } + } else { + NEARBY_LOGS(INFO) << "channel is null"; + } } else { NEARBY_LOGS(INFO) << "Pending connection rejected; endpoint_id=" << endpoint_id; @@ -1843,8 +2266,6 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client, return; } - Medium medium = - channel_manager_->GetChannelForEndpoint(endpoint_id)->GetMedium(); client->GetAnalyticsRecorder().OnConnectionEstablished( endpoint_id, medium, connection_info.connection_token); @@ -1852,6 +2273,13 @@ void BasePcpHandler::EvaluateConnectionResult(ClientProxy* client, client->OnConnectionAccepted(endpoint_id); // Report the current bandwidth to the client + if (FeatureFlags::GetInstance() + .GetFlags() + .support_web_rtc_non_cellular_medium) { + if (medium == Medium::WEB_RTC && !mediums_->GetWebRtc().IsUsingCellular()) { + medium = Medium::WEB_RTC_NON_CELLULAR; + } + } client->OnBandwidthChanged(endpoint_id, medium); NEARBY_LOGS(INFO) << "Connection accepted on Medium:" @@ -1949,15 +2377,14 @@ void BasePcpHandler::LogConnectionAttemptSuccess( connection_info.channel->GetFrequency(), connection_info.channel->GetTryCount()); } else { - NEARBY_LOG(ERROR, - "PendingConnectionInfo channel is null for " - "LogConnectionAttemptSuccess. Bail out."); + NEARBY_LOGS(ERROR) << "PendingConnectionInfo channel is null for " + "LogConnectionAttemptSuccess. Bail out."; return; } + if (connection_info.is_incoming) { connection_info.client->GetAnalyticsRecorder().OnIncomingConnectionAttempt( - location::nearby::proto::connections::INITIAL, - connection_info.channel->GetMedium(), + location::nearby::proto::connections::INITIAL, connection_info.medium, location::nearby::proto::connections::RESULT_SUCCESS, SystemClock::ElapsedRealtime() - connection_info.start_time, connection_info.connection_token, @@ -1965,7 +2392,7 @@ void BasePcpHandler::LogConnectionAttemptSuccess( } else { connection_info.client->GetAnalyticsRecorder().OnOutgoingConnectionAttempt( endpoint_id, location::nearby::proto::connections::INITIAL, - connection_info.channel->GetMedium(), + connection_info.medium, location::nearby::proto::connections::RESULT_SUCCESS, SystemClock::ElapsedRealtime() - connection_info.start_time, connection_info.connection_token, @@ -1992,7 +2419,7 @@ void BasePcpHandler::PendingConnectionInfo::SetCryptoContext( BasePcpHandler::PendingConnectionInfo::~PendingConnectionInfo() { auto future_status = result.lock(); if (future_status && !future_status->IsSet()) { - NEARBY_LOG(INFO, "Future was not set; destroying info"); + NEARBY_LOGS(INFO) << "Future was not set; destroying info"; future_status->Set({Status::kError}); } diff --git a/connections/implementation/base_pcp_handler.h b/connections/implementation/base_pcp_handler.h index 07496504..5a3c5560 100644 --- a/connections/implementation/base_pcp_handler.h +++ b/connections/implementation/base_pcp_handler.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -25,27 +26,45 @@ #include "absl/base/thread_annotations.h" #include "absl/container/btree_map.h" #include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" #include "absl/time/time.h" +#include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" +#include "connections/implementation/analytics/packet_meta_data.h" #include "connections/implementation/bwu_manager.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/encryption_runner.h" +#include "connections/implementation/endpoint_channel.h" #include "connections/implementation/endpoint_channel_manager.h" #include "connections/implementation/endpoint_manager.h" #include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/mediums/webrtc_peer_id.h" #include "connections/implementation/pcp.h" #include "connections/implementation/pcp_handler.h" #include "connections/listeners.h" #include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/params.h" #include "connections/status.h" +#include "connections/strategy.h" #include "connections/v3/connection_listening_options.h" #include "connections/v3/listeners.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/device.h" +#include "internal/interop/device_provider.h" #include "internal/platform/atomic_boolean.h" +#include "internal/platform/ble_v2.h" +#include "internal/platform/bluetooth_adapter.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" #include "internal/platform/connection_info.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" #include "internal/platform/future.h" -#include "internal/platform/prng.h" +#include "internal/platform/mutex.h" +#include "internal/platform/nsd_service_info.h" +#include "internal/platform/runnable.h" #include "internal/platform/scheduled_executor.h" #include "internal/platform/single_thread_executor.h" @@ -106,7 +125,7 @@ class BasePcpHandler : public PcpHandler, // DiscoveryListener will get called in case of any event. Status StartDiscovery(ClientProxy* client, const std::string& service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener) override; + DiscoveryListener listener) override; // Stops Discovery if it is active, and changes CLientProxy state, // otherwise does nothing. @@ -126,6 +145,11 @@ class BasePcpHandler : public PcpHandler, const ConnectionRequestInfo& info, const ConnectionOptions& connection_options) override; + Status RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) override; + // Called by either party to accept connection on their part. // Until both parties call it, connection will not reach a data phase. // Updates state in ClientProxy. @@ -268,6 +292,10 @@ class BasePcpHandler : public PcpHandler, RUN_ON_PCP_HANDLER_THREAD() ABSL_LOCKS_EXCLUDED(discovered_endpoint_mutex_); + void OnInstantLost(ClientProxy* client, const std::string& endpoint_id, + const ByteArray& endpoint_info) + RUN_ON_PCP_HANDLER_THREAD(); + Exception OnIncomingConnection( ClientProxy* client, const ByteArray& remote_endpoint_info, std::unique_ptr endpoint_channel, @@ -355,7 +383,7 @@ class BasePcpHandler : public PcpHandler, // Returns a vector of discovered endpoints that share a given Medium. std::vector GetDiscoveredEndpoints( - const location::nearby::proto::connections::Medium medium) + location::nearby::proto::connections::Medium medium) ABSL_LOCKS_EXCLUDED(discovered_endpoint_mutex_); // Start alarms for endpoints lost by their mediums. Used when updating @@ -374,7 +402,7 @@ class BasePcpHandler : public PcpHandler, absl::string_view service_id, StartOperationResult result); mediums::WebrtcPeerId CreatePeerIdFromAdvertisement( - const string& service_id, const string& endpoint_id, + const std::string& service_id, const std::string& endpoint_id, const ByteArray& endpoint_info); SingleThreadExecutor* GetPcpHandlerThread() @@ -382,6 +410,8 @@ class BasePcpHandler : public PcpHandler, return &serial_executor_; } + void StripOutWifiHotspotMedium(ConnectionInfo& connection_info); + // Test only. int GetEndpointLostByMediumAlarmsCount() RUN_ON_PCP_HANDLER_THREAD() { return endpoint_lost_by_medium_alarms_.size(); @@ -410,6 +440,9 @@ class BasePcpHandler : public PcpHandler, // Pass Reject notification to client. void LocalEndpointRejectedConnection(const std::string& endpoint_id); + // Check for a pending connection to |endpoint_id|. + bool HasPendingConnectionToEndpoint(const std::string& endpoint_id); + // Client state tracker to report events to. Never changes. Always valid. ClientProxy* client = nullptr; // Peer endpoint info, or empty, if not discovered yet. May change. @@ -421,6 +454,10 @@ class BasePcpHandler : public PcpHandler, ConnectionListener listener; ConnectionOptions connection_options; + // Result of authentication via the DeviceProvider, if available. Only used + // for `RequestConnectionV3()`. + AuthenticationStatus authentication_status = AuthenticationStatus::kUnknown; + // Only set for outgoing connections. If set, we must call // result->Set() when connection is established, or rejected. std::weak_ptr> result; @@ -428,7 +465,10 @@ class BasePcpHandler : public PcpHandler, // Only (possibly) vector for incoming connections. std::vector supported_mediums; - // Keep track of a channel before we pass it to EndpointChannelManager. + // Keep track of a channel before we pass it to EndpointChannelManager. This + // is owned until the call to OnEncryptionSuccessRunnableV3 or + // OnEncryptionSuccessRunnable when ownership is transferred to the + // EndpointManager. std::unique_ptr channel; // Crypto context; initially empty; established first thing after channel @@ -441,6 +481,9 @@ class BasePcpHandler : public PcpHandler, // Used in AnalyticsRecorder for devices connection tracking. std::string connection_token; + + // The medium that the connection was established on. + location::nearby::proto::connections::Medium medium; }; // @EncryptionRunnerThread @@ -456,13 +499,28 @@ class BasePcpHandler : public PcpHandler, EndpointChannel* channel); EncryptionRunner::ResultListener GetResultListener(); + EncryptionRunner::ResultListener GetResultListenerV3( + const NearbyDeviceProvider& device_provider, + const NearbyDevice& remote_device, + const EndpointChannel& endpoint_channel); void OnEncryptionSuccessRunnable( const std::string& endpoint_id, std::unique_ptr ukey2, const std::string& auth_token, const ByteArray& raw_auth_token); + void OnEncryptionSuccessRunnableV3( + const NearbyDevice& remote_device, + std::unique_ptr<::securegcm::UKey2Handshake> ukey2, + absl::string_view auth_token, const ByteArray& raw_auth_token, + const EndpointChannel& endpoint_channel, + const NearbyDeviceProvider& device_provider); void OnEncryptionFailureRunnable(const std::string& endpoint_id, EndpointChannel* endpoint_channel); + void RegisterDeviceAfterEncryptionSuccess( + std::string_view endpoint_id, + std::unique_ptr<::securegcm::UKey2Handshake> ukey2, + std::string_view auth_token, const ByteArray& raw_auth_token, + BasePcpHandler::PendingConnectionInfo& connection_info); static Exception WriteConnectionRequestFrame( NearbyDevice::Type device_type, absl::string_view device_proto_bytes, @@ -497,6 +555,9 @@ class BasePcpHandler : public PcpHandler, const DiscoveryOptions& local_discovery_options) ABSL_LOCKS_EXCLUDED(discovered_endpoint_mutex_); + Status VerifyConnectionRequest(const std::string& endpoint_id, + ClientProxy* client); + // Returns true if the webrtc endpoint is created and appended into // discovered_endpoints_ with key endpoint_id. bool AppendWebRTCEndpoint(const std::string& endpoint_id, @@ -571,6 +632,13 @@ class BasePcpHandler : public PcpHandler, bool ShouldEnterHighVisibilityMode( const AdvertisingOptions& advertising_options); + // Below cases should enter stable endpoint id mode: + // 1. When use stable endpoint id returns true. + // 2. When low power returns false. + // 3. Other cases return true. + bool ShouldEnterStableEndpointIdMode( + const AdvertisingOptions& advertising_options); + // Returns the intersection of supported mediums based on the mediums reported // by the remote client and the local client's advertising options. BooleanMediumSelector ComputeIntersectionOfSupportedMediums( diff --git a/connections/implementation/base_pcp_handler_test.cc b/connections/implementation/base_pcp_handler_test.cc index 59cdded1..12aa3ff1 100644 --- a/connections/implementation/base_pcp_handler_test.cc +++ b/connections/implementation/base_pcp_handler_test.cc @@ -36,9 +36,12 @@ #include "connections/implementation/bwu_manager.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/encryption_runner.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/endpoint_channel_manager.h" #include "connections/implementation/endpoint_manager.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/mock_device.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/pcp.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" @@ -50,16 +53,21 @@ #include "connections/strategy.h" #include "connections/v3/connection_listening_options.h" #include "internal/flags/nearby_flags.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/authentication_transport.h" #include "internal/interop/device.h" #include "internal/interop/device_provider.h" #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/future.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" #include "internal/platform/output_stream.h" #include "internal/platform/pipe.h" #include "proto/connections_enums.pb.h" +#include "proto/connections_enums.proto.h" namespace nearby { namespace connections { @@ -71,9 +79,12 @@ using ::testing::_; using ::testing::AtLeast; using ::testing::Invoke; using ::testing::MockFunction; +using ::testing::NiceMock; using ::testing::Return; using ::testing::StrictMock; +constexpr absl::string_view kTestEndpointId = "REMOTETEST"; + constexpr std::array kFakeMacAddress = {'a', 'b', 'c', 'd', 'e', 'f'}; constexpr BooleanMediumSelector kTestCases[] = { @@ -108,17 +119,32 @@ constexpr BooleanMediumSelector kTestCases[] = { class FakePresenceDevice : public NearbyDevice { public: - std::string GetEndpointId() const override { return "TEST"; } + std::string GetEndpointId() const override { return "LOCALTEST"; } MOCK_METHOD(std::vector, GetConnectionInfos, (), - (const override)); - MOCK_METHOD(NearbyDevice::Type, GetType, (), (const override)); - MOCK_METHOD(std::string, ToProtoBytes, (), (const override)); + (const, override)); + MOCK_METHOD(NearbyDevice::Type, GetType, (), (const, override)); + MOCK_METHOD(std::string, ToProtoBytes, (), (const, override)); }; class FakePresenceDeviceProvider : public NearbyDeviceProvider { public: const NearbyDevice* GetLocalDevice() override { return &local_device_; } + AuthenticationStatus AuthenticateAsInitiator( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const override { + authenticate_as_initiator_called_ = true; + return authentication_status_; + } + + void SetAuthenticationStatus(AuthenticationStatus status) { + authentication_status_ = status; + } + FakePresenceDevice local_device_; + mutable bool authenticate_as_initiator_called_ = false; + + private: + AuthenticationStatus authentication_status_ = AuthenticationStatus::kSuccess; }; class MockEndpointChannel : public BaseEndpointChannel { @@ -145,13 +171,13 @@ class MockEndpointChannel : public BaseEndpointChannel { MOCK_METHOD(Exception, Write, (const ByteArray& data), (override)); MOCK_METHOD(void, CloseImpl, (), (override)); MOCK_METHOD(location::nearby::proto::connections::Medium, GetMedium, (), - (const override)); - MOCK_METHOD(std::string, GetType, (), (const override)); - MOCK_METHOD(std::string, GetName, (), (const override)); - MOCK_METHOD(bool, IsPaused, (), (const override)); + (const, override)); + MOCK_METHOD(std::string, GetType, (), (const, override)); + MOCK_METHOD(std::string, GetName, (), (const, override)); + MOCK_METHOD(bool, IsPaused, (), (const, override)); MOCK_METHOD(void, Pause, (), (override)); MOCK_METHOD(void, Resume, (), (override)); - MOCK_METHOD(absl::Time, GetLastReadTimestamp, (), (const override)); + MOCK_METHOD(absl::Time, GetLastReadTimestamp, (), (const, override)); bool broken_write_{false}; @@ -173,8 +199,8 @@ class MockPcpHandler : public BasePcpHandler { using BasePcpHandler::DiscoveredEndpoint; using BasePcpHandler::StartOperationResult; - MOCK_METHOD(Strategy, GetStrategy, (), (const override)); - MOCK_METHOD(Pcp, GetPcp, (), (const override)); + MOCK_METHOD(Strategy, GetStrategy, (), (const, override)); + MOCK_METHOD(Pcp, GetPcp, (), (const, override)); MOCK_METHOD(bool, HasOutgoingConnections, (ClientProxy * client), (const, override)); @@ -241,6 +267,12 @@ class MockPcpHandler : public BasePcpHandler { ABSL_NO_THREAD_SAFETY_ANALYSIS { BasePcpHandler::OnEndpointLost(client, endpoint); } + void OnInstantLost(ClientProxy* client, + std::shared_ptr endpoint) + ABSL_NO_THREAD_SAFETY_ANALYSIS { + BasePcpHandler::OnInstantLost(client, endpoint->endpoint_id, + endpoint->endpoint_info); + } BasePcpHandler::DiscoveredEndpoint* GetDiscoveredEndpoint( const std::string& endpoint_id) { return BasePcpHandler::GetDiscoveredEndpoint(endpoint_id); @@ -396,6 +428,13 @@ class BasePcpHandlerTest endpoint_distance_changed_cb; }; + void SetUp() override { + // Disable instant on lost for all tests by default. + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableInstantOnLost, + false); + } + void StartAdvertising(ClientProxy* client, MockPcpHandler* pcp_handler, BooleanMediumSelector allowed = GetParam()) { AdvertisingOptions advertising_options{ @@ -467,7 +506,7 @@ class BasePcpHandlerTest pcp_handler->GetMediumsFromSelector(discovery_options.allowed), })); EXPECT_EQ(pcp_handler->StartDiscovery(client, service_id, discovery_options, - discovery_listener_), + GetDiscoveryListener()), Status{Status::kSuccess}); EXPECT_TRUE(client->IsDiscovering()); for (const auto& discovered_medium : @@ -498,6 +537,10 @@ class BasePcpHandlerTest std::move(output_b)); auto channel_b = std::make_unique(std::move(input_b), std::move(output_a)); + ON_CALL(mock_device_, GetType) + .WillByDefault(Return(NearbyDevice::Type::kUnknownDevice)); + ON_CALL(mock_device_, GetEndpointId) + .WillByDefault(Return(std::string(kTestEndpointId))); // On initiator (A) side, we drop the first write, since this is a // connection establishment packet, and we don't have the peer entity, just // the peer channel. The rest of the exchange must happen for the benefit of @@ -530,6 +573,46 @@ class BasePcpHandlerTest return std::make_pair(std::move(channel_a), std::move(channel_b)); } + std::pair, + std::unique_ptr> + SetupConnectionForConnectFailure( + location::nearby::proto::connections::Medium medium) { // NOLINT + auto [input_a, output_a] = CreatePipe(); + auto [input_b, output_b] = CreatePipe(); + auto channel_a = std::make_unique(std::move(input_a), + std::move(output_b)); + auto channel_b = std::make_unique(std::move(input_b), + std::move(output_a)); + ON_CALL(mock_device_, GetType) + .WillByDefault(Return(NearbyDevice::Type::kUnknownDevice)); + ON_CALL(mock_device_, GetEndpointId) + .WillByDefault(Return(std::string(kTestEndpointId))); + // On initiator (A) side, we drop the first write, since this is a + // connection establishment packet, and we don't have the peer entity, just + // the peer channel. The rest of the exchange must happen for the benefit of + // DH key exchange. + EXPECT_CALL(*channel_a, Read()) + .WillRepeatedly(Invoke( + [channel = channel_a.get()]() { return channel->DoRead(); })); + EXPECT_CALL(*channel_a, GetMedium).WillRepeatedly(Return(medium)); + EXPECT_CALL(*channel_a, GetLastReadTimestamp) + .WillRepeatedly(Return(absl::Now())); + EXPECT_CALL(*channel_a, IsPaused).WillRepeatedly(Return(false)); + EXPECT_CALL(*channel_b, Read()) + .WillRepeatedly(Invoke( + [channel = channel_b.get()]() { return channel->DoRead(); })); + EXPECT_CALL(*channel_b, Write(_)) + .WillRepeatedly( + Invoke([channel = channel_b.get()](const ByteArray& data) { + return channel->DoWrite(data); + })); + EXPECT_CALL(*channel_b, GetMedium).WillRepeatedly(Return(medium)); + EXPECT_CALL(*channel_b, GetLastReadTimestamp) + .WillRepeatedly(Return(absl::Now())); + EXPECT_CALL(*channel_b, IsPaused).WillRepeatedly(Return(false)); + return std::make_pair(std::move(channel_a), std::move(channel_b)); + } + void RequestConnection( const std::string& endpoint_id, std::unique_ptr channel_a, @@ -598,7 +681,87 @@ class BasePcpHandlerTest EXPECT_EQ(pcp_handler->RequestConnection(client, endpoint_id, info, connection_options), expected_result); - NEARBY_LOG(INFO, "Stopping Encryption Runner"); + NEARBY_LOGS(INFO) << "Stopping Encryption Runner"; + } + + void RequestConnectionV3( + const NearbyDevice& remote_device, + std::unique_ptr channel_a, + MockEndpointChannel* channel_b, ClientProxy* client, + MockPcpHandler* pcp_handler, + location::nearby::proto::connections::Medium connect_medium, + FakePresenceDeviceProvider* fake_presence_device_provider, + std::atomic_int* flag = nullptr, + Status expected_result = {Status::kSuccess}, + AuthenticationStatus expected_authentication_status = + AuthenticationStatus::kSuccess) { + ConnectionRequestInfo info{ + .endpoint_info = ByteArray{"ABCD"}, + .listener = connection_listener_, + }; + ConnectionOptions connection_options{ + .remote_bluetooth_mac_address = ByteArray{"\x12\x34\x56\x78\x9a\xbc"}, + .keep_alive_interval_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis, + .keep_alive_timeout_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_timeout_millis, + }; + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call); + EXPECT_CALL(*pcp_handler, CanSendOutgoingConnection) + .WillRepeatedly(Return(true)); + EXPECT_CALL(*pcp_handler, GetStrategy) + .WillRepeatedly(Return(Strategy::kP2pCluster)); + if (expected_result == Status{Status::kSuccess}) { + EXPECT_CALL(mock_connection_listener_.initiated_cb, Call) + .WillOnce([&](const std::string& endpoint_id, + const ConnectionResponseInfo& info) { + EXPECT_EQ(info.authentication_status, + expected_authentication_status); + EXPECT_TRUE(fake_presence_device_provider + ->authenticate_as_initiator_called_); + }); + } + // Simulate successful discovery. + auto encryption_runner = std::make_unique(); + auto allowed_mediums = pcp_handler->GetDiscoveryMediums(client); + + EXPECT_CALL(*pcp_handler, ConnectImpl) + .WillRepeatedly( + Invoke([&channel_a, connect_medium]( + ClientProxy* client, + MockPcpHandler::DiscoveredEndpoint* endpoint) { + return MockPcpHandler::ConnectImplResult{ + .medium = connect_medium, + .status = {Status::kSuccess}, + .endpoint_channel = std::move(channel_a), + }; + })); + + for (const auto& discovered_medium : allowed_mediums) { + pcp_handler->OnEndpointFound( + client, + std::make_shared(MockDiscoveredEndpoint{ + { + remote_device.GetEndpointId(), + info.endpoint_info, + "service", + discovered_medium, + WebRtcState::kUndefined, + }, + MockContext{flag}, + })); + } + auto other_client = std::make_unique(); + + // Run peer crypto in advance, if channel_b is provided. + // Otherwise stay in not-encrypted state. + if (channel_b != nullptr) { + encryption_runner->StartServer( + other_client.get(), remote_device.GetEndpointId(), channel_b, {}); + } + EXPECT_EQ(pcp_handler->RequestConnectionV3(client, remote_device, info, + connection_options), + expected_result); } void RequestConnectionWifiLanFail( @@ -681,7 +844,7 @@ class BasePcpHandlerTest EXPECT_EQ(pcp_handler->RequestConnection(client, endpoint_id, info, connection_options), expected_result); - NEARBY_LOG(INFO, "Stopping Encryption Runner"); + NEARBY_LOGS(INFO) << "Stopping Encryption Runner"; } MockConnectionListener mock_connection_listener_; MockDiscoveryListener mock_discovery_listener_; @@ -694,16 +857,28 @@ class BasePcpHandlerTest .bandwidth_changed_cb = mock_connection_listener_.bandwidth_changed_cb.AsStdFunction(), }; - DiscoveryListener discovery_listener_{ - .endpoint_found_cb = - mock_discovery_listener_.endpoint_found_cb.AsStdFunction(), - .endpoint_lost_cb = - mock_discovery_listener_.endpoint_lost_cb.AsStdFunction(), - .endpoint_distance_changed_cb = - mock_discovery_listener_.endpoint_distance_changed_cb.AsStdFunction(), - }; + DiscoveryListener GetDiscoveryListener() { + return DiscoveryListener{ + .endpoint_found_cb = + mock_discovery_listener_.endpoint_found_cb.AsStdFunction(), + .endpoint_lost_cb = + mock_discovery_listener_.endpoint_lost_cb.AsStdFunction(), + .endpoint_distance_changed_cb = + mock_discovery_listener_.endpoint_distance_changed_cb + .AsStdFunction(), + }; + } + + void EnableInstantOnLostFeature() { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + connections::config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost, + true); + } + SetSafeToDisconnect set_safe_to_disconnect_{true}; MediumEnvironment& env_ = MediumEnvironment::Instance(); + NiceMock mock_device_; }; TEST_P(BasePcpHandlerTest, ConstructorDestructorWorks) { @@ -783,7 +958,7 @@ TEST_P(BasePcpHandlerTest, StartDiscoveryFails) { .mediums = {}, })); EXPECT_EQ(pcp_handler.StartDiscovery(&client, "service", discovery_options, - discovery_listener_), + GetDiscoveryListener()), Status{Status::kError}); bwu.Shutdown(); env_.Stop(); @@ -837,6 +1012,77 @@ TEST_P(BasePcpHandlerTest, StartStopStartDiscoveryClearsEndpoints) { env_.Stop(); } +TEST_F(BasePcpHandlerTest, ShouldLostEndpointWhenReportInstantLost) { + EnableInstantOnLostFeature(); + env_.Start({.use_simulated_clock = true}); + BooleanMediumSelector allowed{ + .bluetooth = true, + .ble = true, + .wifi_lan = true, + }; + + auto endpoint = std::make_shared( + MockDiscoveredEndpoint{{"ABCD", ByteArray("1234"), "service", Medium::BLE, + WebRtcState::kUndefined}, + MockContext{nullptr}}); + + ClientProxy client; + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler, allowed); + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call); + pcp_handler.OnEndpointFound(&client, endpoint); + EXPECT_EQ(pcp_handler.GetDiscoveredEndpoints("ABCD").size(), 1); + EXPECT_CALL(mock_discovery_listener_.endpoint_lost_cb, Call); + pcp_handler.OnInstantLost(&client, endpoint); + EXPECT_EQ(pcp_handler.GetDiscoveredEndpoints("ABCD").size(), 0); + EXPECT_CALL(pcp_handler, StopDiscoveryImpl(&client)).Times(1); + pcp_handler.StopDiscovery(&client); + bwu.Shutdown(); + env_.Stop(); +} + +TEST_F(BasePcpHandlerTest, ShouldLostAllEndpointsWhenReportInstantLost) { + EnableInstantOnLostFeature(); + env_.Start({.use_simulated_clock = true}); + BooleanMediumSelector allowed{ + .bluetooth = true, + .ble = true, + .wifi_lan = true, + }; + + auto endpoint = std::make_shared( + MockDiscoveredEndpoint{{"ABCD", ByteArray("1234"), "service", Medium::BLE, + WebRtcState::kUndefined}, + MockContext{nullptr}}); + auto endpoint_bluetooth = std::make_shared( + MockDiscoveredEndpoint{{"ABCD", ByteArray("1234"), "service", + Medium::BLUETOOTH, WebRtcState::kUndefined}, + MockContext{nullptr}}); + + ClientProxy client; + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler, allowed); + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call); + pcp_handler.OnEndpointFound(&client, endpoint); + pcp_handler.OnEndpointFound(&client, endpoint_bluetooth); + EXPECT_EQ(pcp_handler.GetDiscoveredEndpoints("ABCD").size(), 2); + EXPECT_CALL(mock_discovery_listener_.endpoint_lost_cb, Call); + pcp_handler.OnInstantLost(&client, endpoint); + EXPECT_EQ(pcp_handler.GetDiscoveredEndpoints("ABCD").size(), 0); + EXPECT_CALL(pcp_handler, StopDiscoveryImpl(&client)).Times(1); + pcp_handler.StopDiscovery(&client); + bwu.Shutdown(); + env_.Stop(); +} + TEST_F(BasePcpHandlerTest, WifiMediumFailFallBackToBT) { env_.Start(); std::string service_id{"service"}; @@ -866,7 +1112,7 @@ TEST_F(BasePcpHandlerTest, WifiMediumFailFallBackToBT) { })); EXPECT_EQ(pcp_handler.StartDiscovery(&client, service_id, discovery_options, - discovery_listener_), + GetDiscoveryListener()), Status{Status::kSuccess}); EXPECT_TRUE(client.IsDiscovering()); @@ -880,7 +1126,7 @@ TEST_F(BasePcpHandlerTest, WifiMediumFailFallBackToBT) { EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); RequestConnectionWifiLanFail(endpoint_id, std::move(channel_a), channel_b.get(), &client, &pcp_handler); - NEARBY_LOG(INFO, "RequestConnection complete"); + NEARBY_LOGS(INFO) << "RequestConnection complete"; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); @@ -906,7 +1152,7 @@ TEST_P(BasePcpHandlerTest, RequestConnectionChangesState) { EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); RequestConnection("1234", std::move(channel_a), channel_b.get(), &client, &pcp_handler, connect_medium); - NEARBY_LOG(INFO, "RequestConnection complete"); + NEARBY_LOGS(INFO) << "RequestConnection complete"; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); @@ -951,11 +1197,10 @@ TEST_P(BasePcpHandlerTest, CanRequestConnectionPresence) { EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); RequestConnection("1234", std::move(channel_a), channel_b.get(), &client, &pcp_handler, connect_medium); - NEARBY_LOG(INFO, "RequestConnection complete"); + NEARBY_LOGS(INFO) << "RequestConnection complete"; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); - env_.Stop(); } TEST_P(BasePcpHandlerTest, CanRequestConnectionLegacy) { @@ -982,7 +1227,252 @@ TEST_P(BasePcpHandlerTest, CanRequestConnectionLegacy) { EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); RequestConnection("1234", std::move(channel_a), channel_b.get(), &client, &pcp_handler, connect_medium); - NEARBY_LOG(INFO, "RequestConnection complete"); + NEARBY_LOGS(INFO) << "RequestConnection complete"; + channel_b->Close(); + bwu.Shutdown(); + pcp_handler.DisconnectFromEndpointManager(); + env_.Stop(); +} + +TEST_P(BasePcpHandlerTest, RequestConnectionV3) { + env_.Start(); + ClientProxy client; + FakePresenceDeviceProvider provider; + EXPECT_CALL(provider.local_device_, GetType) + .WillRepeatedly(Return(NearbyDevice::Type::kUnknownDevice)); + EXPECT_CALL(provider.local_device_, ToProtoBytes); + client.RegisterDeviceProvider(&provider); + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler); + auto mediums = pcp_handler.GetDiscoveryMediums(&client); + auto connect_medium = mediums[mediums.size() - 1]; + auto channel_pair = SetupConnection(connect_medium); + auto& channel_a = channel_pair.first; + const auto& channel_b = channel_pair.second; + EXPECT_CALL(*channel_a, CloseImpl).Times(1); + EXPECT_CALL(*channel_b, CloseImpl).Times(1); + EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); + RequestConnectionV3(mock_device_, std::move(channel_a), channel_b.get(), + &client, &pcp_handler, connect_medium, &provider); + NEARBY_LOGS(INFO) << "RequestConnectionV3 complete"; + channel_b->Close(); + bwu.Shutdown(); + pcp_handler.DisconnectFromEndpointManager(); + env_.Stop(); +} + +TEST_P(BasePcpHandlerTest, RequestConnectionV3_AuthenticationFailure) { + env_.Start(); + ClientProxy client; + FakePresenceDeviceProvider provider; + provider.SetAuthenticationStatus(AuthenticationStatus::kFailure); + EXPECT_CALL(provider.local_device_, GetType) + .WillRepeatedly(Return(NearbyDevice::Type::kUnknownDevice)); + EXPECT_CALL(provider.local_device_, ToProtoBytes); + client.RegisterDeviceProvider(&provider); + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler); + auto mediums = pcp_handler.GetDiscoveryMediums(&client); + auto connect_medium = mediums[mediums.size() - 1]; + auto channel_pair = SetupConnection(connect_medium); + auto& channel_a = channel_pair.first; + const auto& channel_b = channel_pair.second; + EXPECT_CALL(*channel_a, CloseImpl).Times(1); + EXPECT_CALL(*channel_b, CloseImpl).Times(1); + EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); + RequestConnectionV3( + mock_device_, std::move(channel_a), channel_b.get(), &client, + &pcp_handler, connect_medium, &provider, /*flag=*/nullptr, + /*expected_result=*/{Status::kSuccess}, + /*expected_authentication_status=*/AuthenticationStatus::kFailure); + NEARBY_LOGS(INFO) << "RequestConnectionV3 complete"; + channel_b->Close(); + bwu.Shutdown(); + pcp_handler.DisconnectFromEndpointManager(); + env_.Stop(); +} + +TEST_P(BasePcpHandlerTest, RequestConnectionV3_ConnectImplFailure) { + env_.Start(); + ClientProxy client; + FakePresenceDeviceProvider provider; + EXPECT_CALL(provider.local_device_, GetType) + .WillRepeatedly(Return(NearbyDevice::Type::kUnknownDevice)); + client.RegisterDeviceProvider(&provider); + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler); + auto mediums = pcp_handler.GetDiscoveryMediums(&client); + auto connect_medium = mediums[mediums.size() - 1]; + auto channel_pair = SetupConnectionForConnectFailure(connect_medium); + const auto& channel_b = channel_pair.second; + EXPECT_CALL(*channel_b, CloseImpl).Times(1); + EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); + ConnectionRequestInfo info{ + .endpoint_info = ByteArray{"ABCD"}, + .listener = connection_listener_, + }; + ConnectionOptions connection_options{ + .remote_bluetooth_mac_address = ByteArray{"\x12\x34\x56\x78\x9a\xbc"}, + .keep_alive_interval_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis, + .keep_alive_timeout_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_timeout_millis, + }; + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call); + EXPECT_CALL(pcp_handler, CanSendOutgoingConnection) + .WillRepeatedly(Return(true)); + EXPECT_CALL(pcp_handler, GetStrategy) + .WillRepeatedly(Return(Strategy::kP2pCluster)); + // Simulate successful discovery. + auto encryption_runner = std::make_unique(); + auto allowed_mediums = pcp_handler.GetDiscoveryMediums(&client); + + EXPECT_CALL(pcp_handler, ConnectImpl) + .WillRepeatedly(Invoke( + [connect_medium](ClientProxy* client, + MockPcpHandler::DiscoveredEndpoint* endpoint) { + return MockPcpHandler::ConnectImplResult{ + .medium = connect_medium, + .status = {Status::kError}, + .endpoint_channel = nullptr, + }; + })); + + for (const auto& discovered_medium : allowed_mediums) { + pcp_handler.OnEndpointFound( + &client, + std::make_shared(MockDiscoveredEndpoint{ + { + mock_device_.GetEndpointId(), + info.endpoint_info, + "service", + discovered_medium, + WebRtcState::kUndefined, + }, + MockContext{nullptr}, + })); + } + + Status expected_result = {Status::kError}; + EXPECT_EQ(pcp_handler.RequestConnectionV3(&client, mock_device_, info, + connection_options), + expected_result); + NEARBY_LOGS(INFO) << "RequestConnectionV3 complete"; + channel_b->Close(); + bwu.Shutdown(); + pcp_handler.DisconnectFromEndpointManager(); + env_.Stop(); +} + +TEST_P(BasePcpHandlerTest, RequestConnection_ConnectImplFailure) { + env_.Start(); + ClientProxy client; + FakePresenceDeviceProvider provider; + EXPECT_CALL(provider.local_device_, GetType) + .WillRepeatedly(Return(NearbyDevice::Type::kUnknownDevice)); + client.RegisterDeviceProvider(&provider); + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler); + auto mediums = pcp_handler.GetDiscoveryMediums(&client); + auto connect_medium = mediums[mediums.size() - 1]; + auto channel_pair = SetupConnectionForConnectFailure(connect_medium); + const auto& channel_b = channel_pair.second; + EXPECT_CALL(*channel_b, CloseImpl).Times(1); + EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); + ConnectionRequestInfo info{ + .endpoint_info = ByteArray{"ABCD"}, + .listener = connection_listener_, + }; + ConnectionOptions connection_options{ + .remote_bluetooth_mac_address = ByteArray{"\x12\x34\x56\x78\x9a\xbc"}, + .keep_alive_interval_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_interval_millis, + .keep_alive_timeout_millis = + FeatureFlags::GetInstance().GetFlags().keep_alive_timeout_millis, + }; + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call); + EXPECT_CALL(pcp_handler, CanSendOutgoingConnection) + .WillRepeatedly(Return(true)); + EXPECT_CALL(pcp_handler, GetStrategy) + .WillRepeatedly(Return(Strategy::kP2pCluster)); + // Simulate successful discovery. + auto encryption_runner = std::make_unique(); + auto allowed_mediums = pcp_handler.GetDiscoveryMediums(&client); + + EXPECT_CALL(pcp_handler, ConnectImpl) + .WillRepeatedly(Invoke( + [connect_medium](ClientProxy* client, + MockPcpHandler::DiscoveredEndpoint* endpoint) { + return MockPcpHandler::ConnectImplResult{ + .medium = connect_medium, + .status = {Status::kError}, + .endpoint_channel = nullptr, + }; + })); + + for (const auto& discovered_medium : allowed_mediums) { + pcp_handler.OnEndpointFound( + &client, + std::make_shared(MockDiscoveredEndpoint{ + { + std::string(kTestEndpointId), + info.endpoint_info, + "service", + discovered_medium, + WebRtcState::kUndefined, + }, + MockContext{nullptr}, + })); + } + Status expected_result = {Status::kError}; + EXPECT_EQ(pcp_handler.RequestConnection(&client, std::string(kTestEndpointId), + info, connection_options), + expected_result); + NEARBY_LOGS(INFO) << "RequestConnection complete"; + channel_b->Close(); + bwu.Shutdown(); + pcp_handler.DisconnectFromEndpointManager(); + env_.Stop(); +} + +TEST_P(BasePcpHandlerTest, IoError_RequestConnectionV3Fails) { + env_.Start(); + ClientProxy client; + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + StartDiscovery(&client, &pcp_handler); + auto mediums = pcp_handler.GetDiscoveryMediums(&client); + auto connect_medium = mediums[mediums.size() - 1]; + auto channel_pair = SetupConnection(connect_medium); + auto& channel_a = channel_pair.first; + auto& channel_b = channel_pair.second; + EXPECT_CALL(*channel_a, CloseImpl).Times(AtLeast(1)); + EXPECT_CALL(*channel_b, CloseImpl).Times(AtLeast(1)); + channel_b->broken_write_ = true; + EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); + RequestConnectionV3(mock_device_, std::move(channel_a), channel_b.get(), + &client, &pcp_handler, connect_medium, nullptr, nullptr, + {Status::kEndpointIoError}); + NEARBY_LOGS(INFO) << "RequestConnectionV3 complete"; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); @@ -1011,7 +1501,7 @@ TEST_P(BasePcpHandlerTest, IoError_RequestConnectionFails) { RequestConnection(endpoint_id, std::move(channel_a), channel_b.get(), &client, &pcp_handler, connect_medium, nullptr, {Status::kEndpointIoError}); - NEARBY_LOG(INFO, "RequestConnection complete"); + NEARBY_LOGS(INFO) << "RequestConnection complete"; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); @@ -1037,8 +1527,7 @@ TEST_P(BasePcpHandlerTest, AcceptConnectionChangesState) { EXPECT_CALL(*channel_b, CloseImpl).Times(1); RequestConnection(endpoint_id, std::move(channel_a), channel_b.get(), &client, &pcp_handler, connect_medium); - NEARBY_LOG(INFO, "Attempting to accept connection: id=%s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Attempting to accept connection: id=" << endpoint_id; EXPECT_EQ(pcp_handler.AcceptConnection(&client, endpoint_id, {}), Status{Status::kSuccess}); EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); @@ -1102,10 +1591,10 @@ TEST_P(BasePcpHandlerTest, OnIncomingFrameChangesState) { .Times(AtLeast(0)); EXPECT_EQ(pcp_handler.AcceptConnection(&client, endpoint_id, {}), Status{Status::kSuccess}); - NEARBY_LOG(INFO, "Simulating remote accept: id=%s", endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Simulating remote accept: id=" << endpoint_id; OsInfo os_info; - auto frame = parser::FromBytes( - parser::ForConnectionResponse(Status::kSuccess, os_info)); + auto frame = parser::FromBytes(parser::ForConnectionResponse( + Status::kSuccess, os_info, /*multiplex_socket_bitmask=*/0)); EXPECT_CALL(mock_connection_listener_.bandwidth_changed_cb, Call).Times(1); pcp_handler.OnIncomingFrame(frame.result(), endpoint_id, &client, connect_medium, packet_meta_data); @@ -1139,12 +1628,11 @@ TEST_P(BasePcpHandlerTest, DestructorIsCalledOnProtocolEndpoint) { RequestConnection(endpoint_id, std::move(channel_a), channel_b.get(), &client, &pcp_handler, connect_medium, &destroyed_flag); mediums_count = mediums.size(); - NEARBY_LOG(INFO, "Attempting to accept connection: id=%s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Attempting to accept connection: id=" << endpoint_id; EXPECT_EQ(pcp_handler.AcceptConnection(&client, endpoint_id, {}), Status{Status::kSuccess}); EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); - NEARBY_LOG(INFO, "Closing connection: id=%s", endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Closing connection: id=" << endpoint_id; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); @@ -1184,8 +1672,7 @@ TEST_P(BasePcpHandlerTest, MultipleMediumsProduceSingleEndpointLostEvent) { &client, &pcp_handler, connect_medium, &destroyed_flag); auto allowed_mediums = pcp_handler.GetDiscoveryMediums(&client); mediums_count = allowed_mediums.size(); - NEARBY_LOG(INFO, "Attempting to accept connection: id=%s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Attempting to accept connection: id=" << endpoint_id; EXPECT_EQ(pcp_handler.AcceptConnection(&client, endpoint_id, {}), Status{Status::kSuccess}); EXPECT_CALL(mock_connection_listener_.rejected_cb, Call).Times(AtLeast(0)); @@ -1198,7 +1685,7 @@ TEST_P(BasePcpHandlerTest, MultipleMediumsProduceSingleEndpointLostEvent) { } EXPECT_EQ(pcp_handler.GetDiscoveredEndpoint(endpoint_id), nullptr); EXPECT_FALSE(client.IsConnectedToEndpoint(endpoint_id)); - NEARBY_LOG(INFO, "Closing connection: id=%s", endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Closing connection: id=" << endpoint_id; channel_b->Close(); bwu.Shutdown(); pcp_handler.DisconnectFromEndpointManager(); @@ -1238,7 +1725,7 @@ TEST_F(BasePcpHandlerTest, InjectEndpoint) { .mediums = allowed.GetMediums(true), })); EXPECT_EQ(pcp_handler.StartDiscovery(&client, service_id, discovery_options, - discovery_listener_), + GetDiscoveryListener()), Status{Status::kSuccess}); EXPECT_TRUE(client.IsDiscovering()); @@ -1270,6 +1757,122 @@ TEST_F(BasePcpHandlerTest, InjectEndpoint) { env_.Stop(); } +TEST_F(BasePcpHandlerTest, + TestEndpointInfoChangedWhenEndpointDiscoveredOnMultipleMediums) { + env_.Start(); + std::string service_id{"service"}; + std::string endpoint_id{"ABCD"}; + ClientProxy client; + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + BooleanMediumSelector allowed{ + .bluetooth = true, + .ble = true, + }; + DiscoveryOptions discovery_options{ + { + Strategy::kP2pPointToPoint, + allowed, + }, + false, // auto_upgrade_bandwidth; + false, // enforce_topology_constraints; + }; + + EXPECT_CALL(pcp_handler, StartDiscoveryImpl) + .WillOnce(Return(MockPcpHandler::StartOperationResult{ + .status = {Status::kSuccess}, + .mediums = allowed.GetMediums(true), + })); + + EXPECT_EQ(pcp_handler.StartDiscovery(&client, service_id, discovery_options, + GetDiscoveryListener()), + Status{Status::kSuccess}); + EXPECT_TRUE(client.IsDiscovering()); + + ::testing::InSequence seq; + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call) + .WillOnce(Invoke([id = endpoint_id](const std::string& endpoint_id, + const ByteArray& endpoint_info, + const std::string& service_id) { + EXPECT_EQ(endpoint_id, id); + EXPECT_EQ(endpoint_info, ByteArray{"ABCD"}); + })); + + EXPECT_CALL(mock_discovery_listener_.endpoint_lost_cb, Call) + .WillOnce(Invoke([id = endpoint_id](const std::string& endpoint_id) { + EXPECT_EQ(endpoint_id, id); + })); + + EXPECT_CALL(mock_discovery_listener_.endpoint_found_cb, Call) + .WillOnce(Invoke([id = endpoint_id](const std::string& endpoint_id, + const ByteArray& endpoint_info, + const std::string& service_id) { + EXPECT_EQ(endpoint_id, id); + EXPECT_EQ(endpoint_info, ByteArray{"ABCDEF"}); + })); + + EXPECT_CALL(mock_discovery_listener_.endpoint_lost_cb, Call) + .WillOnce(Invoke([id = endpoint_id](const std::string& endpoint_id) { + EXPECT_EQ(endpoint_id, id); + })); + + // Found endpoint on Bluetooth + pcp_handler.OnEndpointFound( + &client, std::make_shared(MockDiscoveredEndpoint{ + { + endpoint_id, + /*endpoint_info=*/ByteArray{"ABCD"}, + service_id, + Medium::BLUETOOTH, + WebRtcState::kUndefined, + }, + MockContext{nullptr}, + })); + // Found endpoint on BLE + pcp_handler.OnEndpointFound( + &client, std::make_shared(MockDiscoveredEndpoint{ + { + endpoint_id, + /*endpoint_info=*/ByteArray{"ABCD"}, + service_id, + Medium::BLE, + WebRtcState::kUndefined, + }, + MockContext{nullptr}, + })); + + // Endpoint info changed on BLE + pcp_handler.OnEndpointFound( + &client, std::make_shared(MockDiscoveredEndpoint{ + { + endpoint_id, + /*endpoint_info=*/ByteArray{"ABCDEF"}, + service_id, + Medium::BLE, + WebRtcState::kUndefined, + }, + MockContext{nullptr}, + })); + + pcp_handler.OnEndpointLost(&client, + MockDiscoveredEndpoint{ + { + endpoint_id, + /*endpoint_info=*/ByteArray{"ABCDEF"}, + service_id, + Medium::BLE, + WebRtcState::kUndefined, + }, + MockContext{nullptr}, + }); + + env_.Sync(false); + env_.Stop(); +} + TEST_F(BasePcpHandlerTest, TestStartStopEndpointLostAlarm) { env_.Start(); std::string service_id{"service"}; @@ -1891,6 +2494,56 @@ TEST_F(BasePcpHandlerTest, TestDeviceFilterForConnectionsWithPresence) { env_.Stop(); } +TEST_F(BasePcpHandlerTest, IncomingConnectionFailsWithEmptyEndpointId) { + env_.Start(); + ClientProxy client; + Mediums m; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(m, em, ecm, {}, {}); + MockPcpHandler pcp_handler(&m, &em, &ecm, &bwu); + v3::ConnectionListeningOptions options = { + .strategy = Strategy::kP2pCluster, + .enable_ble_listening = true, + .enable_bluetooth_listening = true, + .enable_wlan_listening = true, + .listening_endpoint_type = NearbyDevice::Type::kConnectionsDevice}; + EXPECT_CALL(pcp_handler, StartListeningForIncomingConnectionsImpl) + .WillOnce(Return( + MockPcpHandler::StartOperationResult{.status = {Status::kSuccess}})); + EXPECT_CALL(pcp_handler, CanReceiveIncomingConnection) + .WillRepeatedly(Return(true)); + EXPECT_TRUE( + pcp_handler + .StartListeningForIncomingConnections(&client, "service", options, {}) + .first.Ok()); + ASSERT_TRUE(client.IsListeningForIncomingConnections()); + ASSERT_TRUE(pcp_handler.CanReceiveIncomingConnection(&client)); + auto channel_pair = SetupConnection(Medium::BLUETOOTH); + ByteArray serialized_frame = parser::ForConnectionRequestConnections( + {}, { + .local_endpoint_id = "", + .local_endpoint_info = ByteArray("local endpoint"), + }); + // At this point the connection request doesn't have an endpoint ID field + // set, so we do that here. + location::nearby::connections::OfflineFrame frame; + frame.ParseFromString(serialized_frame.AsStringView()); + frame.mutable_v1()->mutable_connection_request()->set_endpoint_id(""); + ASSERT_TRUE(frame.v1().connection_request().has_endpoint_id()); + // do a dummy write to get to the actual write. + channel_pair.first->Write(ByteArray()); + channel_pair.first->Write(ByteArray(frame.SerializeAsString())); + EXPECT_EQ(pcp_handler + .OnIncomingConnection(&client, ByteArray("remote endpoint"), + std::move(channel_pair.second), + Medium::BLUETOOTH, + NearbyDevice::Type::kConnectionsDevice) + .value, + Exception::Value::kIo); + env_.Stop(); +} + TEST_F(BasePcpHandlerTest, TestNeedsToTurnOffAdvertisingMedium) { Mediums m; EndpointChannelManager ecm; diff --git a/connections/implementation/ble_advertisement.cc b/connections/implementation/ble_advertisement.cc index 08861b4d..83f7fea6 100644 --- a/connections/implementation/ble_advertisement.cc +++ b/connections/implementation/ble_advertisement.cc @@ -16,9 +16,15 @@ #include +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" #include "connections/implementation/base_pcp_handler.h" +#include "connections/implementation/pcp.h" #include "internal/platform/base_input_stream.h" +#include "internal/platform/bluetooth_utils.h" +#include "internal/platform/byte_array.h" #include "internal/platform/logging.h" namespace nearby { @@ -87,26 +93,22 @@ void BleAdvertisement::DoInitialize(bool fast_advertisement, Version version, } } -BleAdvertisement::BleAdvertisement(bool fast_advertisement, - const ByteArray& ble_advertisement_bytes) { - fast_advertisement_ = fast_advertisement; - +absl::StatusOr BleAdvertisement::CreateBleAdvertisement( + bool fast_advertisement, const ByteArray& ble_advertisement_bytes) { if (ble_advertisement_bytes.Empty()) { - NEARBY_LOG(ERROR, - "Cannot deserialize BleAdvertisement: null bytes passed in."); - return; + return absl::InvalidArgumentError( + "Cannot deserialize BleAdvertisement: null bytes passed in."); } - int min_advertisement_length = fast_advertisement_ + int min_advertisement_length = fast_advertisement ? kMinFastAdvertisementLength : kMinAdvertisementLength; if (ble_advertisement_bytes.size() < min_advertisement_length) { - NEARBY_LOG(ERROR, - "Cannot deserialize BleAdvertisement: expecting min %d raw " - "bytes, got %" PRIu64, - kMinAdvertisementLength, ble_advertisement_bytes.size()); - return; + return absl::InvalidArgumentError( + absl::StrCat("Cannot deserialize BleAdvertisement: expecting min ", + min_advertisement_length, " raw bytes, got ", + ble_advertisement_bytes.size())); } ByteArray advertisement_bytes{ble_advertisement_bytes}; @@ -114,98 +116,105 @@ BleAdvertisement::BleAdvertisement(bool fast_advertisement, // The first 1 byte is supposed to be the version and pcp. auto version_and_pcp_byte = static_cast(base_input_stream.ReadUint8()); // The upper 3 bits are supposed to be the version. - version_ = + Version version = static_cast((version_and_pcp_byte & kVersionBitmask) >> 5); - if (version_ != Version::kV1) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: unsupported Version %d", - version_); - return; + if (version != Version::kV1) { + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: unsupported Version: ", version)); } + // The lower 5 bits are supposed to be the Pcp. - pcp_ = static_cast(version_and_pcp_byte & kPcpBitmask); - switch (pcp_) { + Pcp pcp = static_cast(version_and_pcp_byte & kPcpBitmask); + switch (pcp) { case Pcp::kP2pCluster: // Fall through case Pcp::kP2pStar: // Fall through case Pcp::kP2pPointToPoint: break; default: - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: unsupported V1 PCP %d", - pcp_); + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: unsupported V1 PCP ", pcp)); } // The next 3 bytes are supposed to be the service_id_hash if not fast // advertisement. - if (!fast_advertisement_) - service_id_hash_ = base_input_stream.ReadBytes(kServiceIdHashLength); + ByteArray service_id_hash; + if (!fast_advertisement) { + service_id_hash = base_input_stream.ReadBytes(kServiceIdHashLength); + } // The next 4 bytes are supposed to be the endpoint_id. - endpoint_id_ = std::string{base_input_stream.ReadBytes(kEndpointIdLength)}; + std::string endpoint_id = + std::string{base_input_stream.ReadBytes(kEndpointIdLength)}; // The next 1 byte is supposed to be the length of the endpoint_info. - std::uint32_t expected_endpoint_info_length = base_input_stream.ReadUint8(); + auto expected_endpoint_info_length = base_input_stream.ReadUint8(); // The next x bytes are the endpoint info. (Max length is 131 bytes or 17 // bytes as fast_advertisement being true). - endpoint_info_ = base_input_stream.ReadBytes(expected_endpoint_info_length); + auto endpoint_info = + base_input_stream.ReadBytes(expected_endpoint_info_length); const int max_endpoint_info_length = - fast_advertisement_ ? kMaxFastEndpointInfoLength : kMaxEndpointInfoLength; - if (endpoint_info_.Empty() || - endpoint_info_.size() != expected_endpoint_info_length || - endpoint_info_.size() > max_endpoint_info_length) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement(fast advertisement=%d): " - "expected endpointInfo to be %d bytes, got %" PRIu64, - fast_advertisement_, expected_endpoint_info_length, - endpoint_info_.size()); - - // Clear endpoint_id for validity. - endpoint_id_.clear(); - return; + fast_advertisement ? kMaxFastEndpointInfoLength : kMaxEndpointInfoLength; + if (endpoint_info.Empty() || + endpoint_info.size() != expected_endpoint_info_length || + endpoint_info.size() > max_endpoint_info_length) { + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement(fast advertisement=", + fast_advertisement, "): expected endpointInfo to be ", + expected_endpoint_info_length, " bytes, got ", endpoint_info.size())); } // The next 6 bytes are the bluetooth mac address if not fast advertisement. - if (!fast_advertisement_) { + std::string bluetooth_mac_address; + if (!fast_advertisement) { auto bluetooth_mac_address_bytes = base_input_stream.ReadBytes(BluetoothUtils::kBluetoothMacAddressLength); - bluetooth_mac_address_ = + bluetooth_mac_address = BluetoothUtils::ToString(bluetooth_mac_address_bytes); } // The next 1 byte is supposed to be the length of the uwb_address. If the // next byte is not available then it should be a fast advertisement and skip // it for remaining bytes. + ByteArray uwb_address; + BleAdvertisement ble_advertisement; if (base_input_stream.IsAvailable(1)) { - std::uint32_t expected_uwb_address_length = base_input_stream.ReadUint8(); + auto expected_uwb_address_length = base_input_stream.ReadUint8(); // If the length of uwb_address is not zero, then retrieve it. if (expected_uwb_address_length != 0) { - uwb_address_ = base_input_stream.ReadBytes(expected_uwb_address_length); - if (uwb_address_.Empty() || - uwb_address_.size() != expected_uwb_address_length) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: " - "expected uwbAddress size to be %d bytes, got %" PRIu64, - expected_uwb_address_length, uwb_address_.size()); - - // Clear endpoint_id for validity. - endpoint_id_.clear(); - return; + uwb_address = base_input_stream.ReadBytes(expected_uwb_address_length); + if (uwb_address.Empty() || + uwb_address.size() != expected_uwb_address_length) { + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: expected uwbAddress size to " + "be ", + expected_uwb_address_length, " bytes, got ", uwb_address.size())); } } // The next 1 byte is extra field. - if (!fast_advertisement_) { + if (!fast_advertisement) { if (base_input_stream.IsAvailable(kExtraFieldLength)) { auto extra_field = static_cast(base_input_stream.ReadUint8()); - web_rtc_state_ = (extra_field & kWebRtcConnectableFlagBitmask) == 1 - ? WebRtcState::kConnectable - : WebRtcState::kUnconnectable; + ble_advertisement.web_rtc_state_ = + (extra_field & kWebRtcConnectableFlagBitmask) == 1 + ? WebRtcState::kConnectable + : WebRtcState::kUnconnectable; } } } base_input_stream.Close(); + + ble_advertisement.fast_advertisement_ = fast_advertisement; + ble_advertisement.version_ = version; + ble_advertisement.pcp_ = pcp; + ble_advertisement.service_id_hash_ = service_id_hash; + ble_advertisement.endpoint_id_ = endpoint_id; + ble_advertisement.endpoint_info_ = endpoint_info; + ble_advertisement.bluetooth_mac_address_ = bluetooth_mac_address; + ble_advertisement.uwb_address_ = uwb_address; + return ble_advertisement; } BleAdvertisement::operator ByteArray() const { diff --git a/connections/implementation/ble_advertisement.h b/connections/implementation/ble_advertisement.h index 6ba4cd5b..d50ebf94 100644 --- a/connections/implementation/ble_advertisement.h +++ b/connections/implementation/ble_advertisement.h @@ -15,6 +15,7 @@ #ifndef CORE_INTERNAL_BLE_ADVERTISEMENT_H_ #define CORE_INTERNAL_BLE_ADVERTISEMENT_H_ +#include "absl/status/statusor.h" #include "connections/implementation/base_pcp_handler.h" #include "connections/implementation/pcp.h" #include "internal/platform/bluetooth_utils.h" @@ -77,8 +78,8 @@ class BleAdvertisement { const ByteArray& endpoint_info, const std::string& bluetooth_mac_address, const ByteArray& uwb_address, WebRtcState web_rtc_state); - BleAdvertisement(bool fast_advertisement, - const ByteArray& ble_advertisement_bytes); + static absl::StatusOr CreateBleAdvertisement( + bool fast_advertisement, const ByteArray& ble_advertisement_bytes); BleAdvertisement(const BleAdvertisement&) = default; BleAdvertisement& operator=(const BleAdvertisement&) = default; BleAdvertisement(BleAdvertisement&&) = default; diff --git a/connections/implementation/ble_advertisement_test.cc b/connections/implementation/ble_advertisement_test.cc index d73df08c..db6a021c 100644 --- a/connections/implementation/ble_advertisement_test.cc +++ b/connections/implementation/ble_advertisement_test.cc @@ -14,8 +14,12 @@ #include "connections/implementation/ble_advertisement.h" +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/status/status.h" #include "connections/implementation/base_pcp_handler.h" +#include "internal/platform/byte_array.h" namespace nearby { namespace connections { @@ -31,6 +35,9 @@ constexpr absl::string_view kFastAdvertisementEndpointName{"Fast Advertise"}; constexpr absl::string_view kBluetoothMacAddress{"00:00:E6:88:64:13"}; constexpr WebRtcState kWebRtcState = WebRtcState::kConnectable; +using ::absl::StatusCode::kInvalidArgument; +using ::testing::status::StatusIs; + // TODO(b/169550050): Implement UWBAddress. TEST(BleAdvertisementTest, ConstructionWorks) { ByteArray service_id_hash{std::string(kServiceIdHashBytes)}; @@ -269,7 +276,10 @@ TEST(BleAdvertisementTest, ConstructionFromBytesWorks) { ByteArray{}, kWebRtcState}; ByteArray ble_advertisement_bytes(org_ble_advertisement); - BleAdvertisement ble_advertisement{false, ble_advertisement_bytes}; + auto ble_status_or = + BleAdvertisement::CreateBleAdvertisement(false, ble_advertisement_bytes); + ASSERT_OK(ble_status_or.status()); + auto ble_advertisement = ble_status_or.value(); EXPECT_TRUE(ble_advertisement.IsValid()); EXPECT_FALSE(ble_advertisement.IsFastAdvertisement()); @@ -290,7 +300,10 @@ TEST(BleAdvertisementTest, ConstructionFromBytesWorksForFastAdvertisement) { fast_endpoint_info, ByteArray{}}; ByteArray ble_advertisement_bytes(org_ble_advertisement); - BleAdvertisement ble_advertisement{true, ble_advertisement_bytes}; + auto ble_status_or = + BleAdvertisement::CreateBleAdvertisement(true, ble_advertisement_bytes); + ASSERT_OK(ble_status_or.status()); + auto ble_advertisement = ble_status_or.value(); EXPECT_TRUE(ble_advertisement.IsValid()); EXPECT_TRUE(ble_advertisement.IsFastAdvertisement()); @@ -322,7 +335,10 @@ TEST(BleAdvertisementTest, ConstructionFromLongLengthBytesWorks) { memcpy(long_ble_advertisement_bytes.data(), ble_advertisement_bytes.data(), ble_advertisement_bytes.size()); - BleAdvertisement long_ble_advertisement{false, long_ble_advertisement_bytes}; + auto ble_status_or = BleAdvertisement::CreateBleAdvertisement( + false, long_ble_advertisement_bytes); + ASSERT_OK(ble_status_or.status()); + auto long_ble_advertisement = ble_status_or.value(); EXPECT_TRUE(long_ble_advertisement.IsValid()); EXPECT_EQ(kVersion, long_ble_advertisement.GetVersion()); @@ -336,15 +352,13 @@ TEST(BleAdvertisementTest, ConstructionFromLongLengthBytesWorks) { } TEST(BleAdvertisementTest, ConstructionFromNullBytesFails) { - BleAdvertisement ble_advertisement{false, ByteArray{}}; - - EXPECT_FALSE(ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement(false, ByteArray()), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, ConstructionFromNullBytesFailsForFastAdvertisement) { - BleAdvertisement ble_advertisement{true, ByteArray{}}; - - EXPECT_FALSE(ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement(true, ByteArray()), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, ConstructionFromShortLengthBytesFails) { @@ -363,10 +377,9 @@ TEST(BleAdvertisementTest, ConstructionFromShortLengthBytesFails) { ble_advertisement_bytes.data(), BleAdvertisement::kMinAdvertisementLength - 1}; - BleAdvertisement short_ble_advertisement{false, - short_ble_advertisement_bytes}; - - EXPECT_FALSE(short_ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement( + false, short_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, @@ -382,9 +395,9 @@ TEST(BleAdvertisementTest, ble_advertisement_bytes.data(), BleAdvertisement::kMinAdvertisementLength - 1}; - BleAdvertisement short_ble_advertisement{true, short_ble_advertisement_bytes}; - - EXPECT_FALSE(short_ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement( + true, short_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, @@ -404,10 +417,9 @@ TEST(BleAdvertisementTest, corrupt_ble_advertisement_string[8] ^= 0x0FF; ByteArray corrupt_ble_advertisement_bytes(corrupt_ble_advertisement_string); - BleAdvertisement corrupt_ble_advertisement{false, - corrupt_ble_advertisement_bytes}; - - EXPECT_FALSE(corrupt_ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement( + false, corrupt_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, @@ -423,10 +435,9 @@ TEST(BleAdvertisementTest, corrupt_ble_advertisement_string[5] ^= 0x0FF; ByteArray corrupt_ble_advertisement_bytes(corrupt_ble_advertisement_string); - BleAdvertisement corrupt_ble_advertisement{true, - corrupt_ble_advertisement_bytes}; - - EXPECT_FALSE(corrupt_ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement( + true, corrupt_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } } // namespace diff --git a/connections/implementation/bluetooth_bwu_handler.cc b/connections/implementation/bluetooth_bwu_handler.cc index 21328239..74e72312 100644 --- a/connections/implementation/bluetooth_bwu_handler.cc +++ b/connections/implementation/bluetooth_bwu_handler.cc @@ -21,6 +21,7 @@ #include "connections/implementation/bluetooth_endpoint_channel.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/offline_frames.h" +#include "internal/platform/logging.h" // Manages the Bluetooth-specific methods needed to upgrade an {@link // EndpointChannel}. @@ -44,18 +45,18 @@ BluetoothBwuHandler::CreateUpgradedEndpointChannel( upgrade_path_info.bluetooth_credentials(); if (!bluetooth_credentials.has_service_name() || !bluetooth_credentials.has_mac_address()) { - NEARBY_LOG(ERROR, "BluetoothBwuHandler failed to parse UpgradePathInfo."); + NEARBY_LOGS(ERROR) + << "BluetoothBwuHandler failed to parse UpgradePathInfo."; return nullptr; } const std::string& service_name = bluetooth_credentials.service_name(); const std::string& mac_address = bluetooth_credentials.mac_address(); - NEARBY_LOGS(VERBOSE) << "BluetoothBwuHandler is attempting to connect to " - "available Bluetooth device (" - << service_name << ", " << mac_address - << ") for endpoint " << endpoint_id << " and service ID " - << service_id; + NEARBY_VLOG(1) << "BluetoothBwuHandler is attempting to connect to " + "available Bluetooth device (" + << service_name << ", " << mac_address << ") for endpoint " + << endpoint_id << " and service ID " << service_id; BluetoothDevice device = bluetooth_medium_.GetRemoteDevice(mac_address); if (!device.IsValid()) { @@ -76,7 +77,7 @@ BluetoothBwuHandler::CreateUpgradedEndpointChannel( return nullptr; } - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "BluetoothBwuHandler successfully connected to Bluetooth device (" << service_id << ", " << mac_address << ") while upgrading endpoint " << endpoint_id; @@ -93,6 +94,7 @@ BluetoothBwuHandler::CreateUpgradedEndpointChannel( return nullptr; } + client->SetBluetoothMacAddress(endpoint_id, mac_address); return channel; } @@ -122,7 +124,7 @@ ByteArray BluetoothBwuHandler::HandleInitializeUpgradedMediumForEndpoint( return {}; } - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "BluetoothBwuHandler successfully started listening for incoming " "Bluetooth connections on service_id=" << upgrade_service_id << " while upgrading endpoint " << endpoint_id; @@ -134,8 +136,8 @@ ByteArray BluetoothBwuHandler::HandleInitializeUpgradedMediumForEndpoint( void BluetoothBwuHandler::HandleRevertInitiatorStateForService( const std::string& upgrade_service_id) { bluetooth_medium_.StopAcceptingConnections(upgrade_service_id); - NEARBY_LOG(INFO, - "BluetoothBwuHandler successfully reverted all Bluetooth state."); + NEARBY_LOGS(INFO) + << "BluetoothBwuHandler successfully reverted all Bluetooth state."; } // Accept Connection Callback. diff --git a/connections/implementation/bluetooth_bwu_test.cc b/connections/implementation/bluetooth_bwu_test.cc new file mode 100644 index 00000000..6b0b9897 --- /dev/null +++ b/connections/implementation/bluetooth_bwu_test.cc @@ -0,0 +1,126 @@ +// Copyright 2022 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. + +#include + +#include "gtest/gtest.h" +#include "absl/time/time.h" +#include "connections/implementation/bwu_handler.h" +#include "connections/implementation/bluetooth_bwu_handler.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/offline_frames.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/logging.h" +#include "internal/platform/medium_environment.h" +#include "internal/platform/single_thread_executor.h" + +namespace nearby { +namespace connections { + +namespace { +using ::location::nearby::connections::OfflineFrame; +constexpr absl::Duration kWaitDuration = absl::Milliseconds(1000); +} // namespace + +class BluetoothBwuTest : public testing::Test { + protected: + BluetoothBwuTest() { env_.Start(); } + ~BluetoothBwuTest() override { env_.Stop(); } + + MediumEnvironment& env_{MediumEnvironment::Instance()}; +}; + +TEST_F(BluetoothBwuTest, CanCreateBwuHandler) { + ClientProxy client; + Mediums mediums; + + auto handler = std::make_unique(mediums, nullptr); + + handler->InitializeUpgradedMediumForEndpoint(&client, /*service_id=*/"B", + /*endpoint_id=*/"2"); + handler->RevertInitiatorState(); + SUCCEED(); + handler.reset(); +} + +TEST_F(BluetoothBwuTest, SoftAPBWUInit_STACreateEndpointChannel) { + CountDownLatch start_latch(1); + CountDownLatch accept_latch(1); + CountDownLatch end_latch(1); + + ClientProxy client_1, client_2; + Mediums mediums_1, mediums_2; + ExceptionOr upgrade_frame; + + auto handler_1 = std::make_unique( + mediums_1, [&](ClientProxy* client, + std::unique_ptr + mutable_connection) { + NEARBY_LOGS(WARNING) << "Server socket connection accept call back"; + accept_latch.CountDown(); + EXPECT_TRUE(end_latch.Await(kWaitDuration).result()); + }); + + // client_1 works as Bluetooth Server Device + SingleThreadExecutor server_executor; + server_executor.Execute([&]() { + ByteArray upgrade_path_available_frame = + handler_1->InitializeUpgradedMediumForEndpoint(&client_1, + /*service_id=*/"A", + /*endpoint_id=*/"1"); + EXPECT_FALSE(upgrade_path_available_frame.Empty()); + + upgrade_frame = parser::FromBytes(upgrade_path_available_frame); + start_latch.CountDown(); + }); + + // client_2 works as Bluetooth Client Device which will connect to client_1 + SingleThreadExecutor client_executor; + // Wait till client_1 started as Bluetooth and then connect to it + EXPECT_TRUE(start_latch.Await(kWaitDuration).result()); + std::unique_ptr handler_2 = + std::make_unique(mediums_2, nullptr); + + client_executor.Execute([&]() { + auto bwu_frame = + upgrade_frame.result().v1().bandwidth_upgrade_negotiation(); + + std::unique_ptr new_channel = + handler_2->CreateUpgradedEndpointChannel(&client_2, /*service_id=*/"A", + /*endpoint_id=*/"1", + bwu_frame.upgrade_path_info()); + if (!FeatureFlags::GetInstance().GetFlags().enable_cancellation_flag) { + EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); + EXPECT_EQ(new_channel->GetMedium(), + location::nearby::proto::connections::Medium::BLUETOOTH); + } else { + accept_latch.CountDown(); + EXPECT_EQ(new_channel, nullptr); + } + EXPECT_FALSE(mediums_2.GetBluetoothClassic().GetMacAddress().empty()); + handler_2->RevertResponderState(/*service_id=*/"A"); + end_latch.CountDown(); + }); + + EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); + EXPECT_TRUE(end_latch.Await(kWaitDuration).result()); +} + +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/bluetooth_device_name.cc b/connections/implementation/bluetooth_device_name.cc index 920fd3fd..4823e72e 100644 --- a/connections/implementation/bluetooth_device_name.cc +++ b/connections/implementation/bluetooth_device_name.cc @@ -66,11 +66,10 @@ BluetoothDeviceName::BluetoothDeviceName( } if (bluetooth_device_name_bytes.size() < kMinBluetoothDeviceNameLength) { - NEARBY_LOG(INFO, - "Cannot deserialize BluetoothDeviceName: expecting min %d raw " - "bytes, got %" PRIu64, - kMinBluetoothDeviceNameLength, - bluetooth_device_name_bytes.size()); + NEARBY_LOGS(INFO) + << "Cannot deserialize BluetoothDeviceName: expecting min " + << kMinBluetoothDeviceNameLength << " raw bytes, got " + << bluetooth_device_name_bytes.size(); return; } @@ -81,9 +80,9 @@ BluetoothDeviceName::BluetoothDeviceName( version_ = static_cast((version_and_pcp_byte & kVersionBitmask) >> 5); if (version_ != Version::kV1) { - NEARBY_LOG(INFO, - "Cannot deserialize BluetoothDeviceName: unsupported version=%d", - version_); + NEARBY_LOGS(INFO) + << "Cannot deserialize BluetoothDeviceName: unsupported version=" + << static_cast(version_); return; } // The lower 5 bits are supposed to be the Pcp. @@ -94,9 +93,9 @@ BluetoothDeviceName::BluetoothDeviceName( case Pcp::kP2pPointToPoint: break; default: - NEARBY_LOG( - INFO, "Cannot deserialize BluetoothDeviceName: unsupported V1 PCP %d", - pcp_); + NEARBY_LOGS(INFO) + << "Cannot deserialize BluetoothDeviceName: unsupported V1 PCP " + << static_cast(pcp_); return; } @@ -123,10 +122,10 @@ BluetoothDeviceName::BluetoothDeviceName( endpoint_info_ = base_input_stream.ReadBytes(expected_endpoint_info_length); if (endpoint_info_.Empty() || endpoint_info_.size() != expected_endpoint_info_length) { - NEARBY_LOG(INFO, - "Cannot deserialize BluetoothDeviceName: expected " - "endpoint info to be %d bytes, got %" PRIu64, - expected_endpoint_info_length, endpoint_info_.size()); + NEARBY_LOGS(INFO) << "Cannot deserialize BluetoothDeviceName: expected " + "endpoint info to be " + << expected_endpoint_info_length << " bytes, got " + << endpoint_info_.size(); // Clear endpoint_id for validity. endpoint_id_.clear(); @@ -144,10 +143,10 @@ BluetoothDeviceName::BluetoothDeviceName( uwb_address_ = base_input_stream.ReadBytes(expected_uwb_address_length); if (uwb_address_.Empty() || uwb_address_.size() != expected_uwb_address_length) { - NEARBY_LOG(INFO, - "Cannot deserialize BluetoothDeviceName: " - "expected uwbAddress size to be %d bytes, got %" PRIu64, - expected_uwb_address_length, uwb_address_.size()); + NEARBY_LOGS(INFO) << "Cannot deserialize BluetoothDeviceName: expected " + "uwbAddress size to be " + << expected_uwb_address_length << " bytes, got " + << uwb_address_.size(); // Clear endpoint_id for validity. endpoint_id_.clear(); @@ -179,11 +178,11 @@ BluetoothDeviceName::operator std::string() const { ByteArray usable_endpoint_info(endpoint_info_); if (endpoint_info_.size() > kMaxEndpointInfoLength) { - NEARBY_LOG(INFO, - "While serializing Advertisement, truncating Endpoint Name %s " - "(%lu bytes) down to %d bytes", - absl::BytesToHexString(endpoint_info_.data()).c_str(), - endpoint_info_.size(), kMaxEndpointInfoLength); + NEARBY_LOGS(INFO) + << "While serializing Advertisement, truncating Endpoint Name " + << absl::BytesToHexString(endpoint_info_.data()) << " (" + << endpoint_info_.size() << " bytes) down to " << kMaxEndpointInfoLength + << " bytes"; usable_endpoint_info.SetData(endpoint_info_.data(), kMaxEndpointInfoLength); } diff --git a/connections/implementation/bluetooth_endpoint_channel.cc b/connections/implementation/bluetooth_endpoint_channel.cc index 04278cf9..2b1aa65e 100644 --- a/connections/implementation/bluetooth_endpoint_channel.cc +++ b/connections/implementation/bluetooth_endpoint_channel.cc @@ -62,5 +62,12 @@ void BluetoothEndpointChannel::CloseImpl() { } } +bool BluetoothEndpointChannel::EnableMultiplexSocket() { + NEARBY_LOGS(INFO) << "BluetoothEndpointChannel MultiplexSocket will be " + "enabled if the Bluetooth MultiplexSocket is valid"; + bluetooth_socket_.EnableMultiplexSocket(); + return true; +} + } // namespace connections } // namespace nearby diff --git a/connections/implementation/bluetooth_endpoint_channel.h b/connections/implementation/bluetooth_endpoint_channel.h index 3c44d71a..b2176388 100644 --- a/connections/implementation/bluetooth_endpoint_channel.h +++ b/connections/implementation/bluetooth_endpoint_channel.h @@ -33,6 +33,7 @@ class BluetoothEndpointChannel final : public BaseEndpointChannel { location::nearby::proto::connections::Medium GetMedium() const override; int GetMaxTransmitPacketSize() const override; + bool EnableMultiplexSocket() override; private: static constexpr int kDefaultBTMaxTransmitPacketSize = 1980; // 990 * 2 Bytes diff --git a/connections/implementation/bwu_manager.cc b/connections/implementation/bwu_manager.cc index 78ab4992..28f37f2c 100644 --- a/connections/implementation/bwu_manager.cc +++ b/connections/implementation/bwu_manager.cc @@ -15,17 +15,22 @@ #include "connections/implementation/bwu_manager.h" #include +#include #include #include #include #include +#include "absl/container/flat_hash_map.h" #include "absl/functional/bind_front.h" #include "absl/time/time.h" +#include "connections/implementation/analytics/connection_attempt_metadata_params.h" #include "connections/implementation/bluetooth_bwu_handler.h" #include "connections/implementation/bwu_handler.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" #include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_manager.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/service_id_constants.h" #ifdef NO_WEBRTC @@ -36,10 +41,15 @@ #include "connections/implementation/wifi_direct_bwu_handler.h" #include "connections/implementation/wifi_hotspot_bwu_handler.h" #include "connections/implementation/wifi_lan_bwu_handler.h" +#include "connections/medium_selector.h" #include "internal/platform/byte_array.h" +#include "internal/platform/cancelable_alarm.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/system_clock.h" #include "internal/platform/logging.h" +#include "internal/platform/runnable.h" +#include "proto/connections_enums.pb.h" namespace nearby { namespace connections { @@ -349,7 +359,7 @@ void BwuManager::OnEndpointDisconnect(ClientProxy* client, DisconnectionReason reason) { NEARBY_LOGS(INFO) << "BwuManager has processed endpoint disconnection for endpoint " - << endpoint_id; + << endpoint_id << " with reason " << DisconnectionReason_Name(reason); RunOnBwuManagerThread("bwu-on-endpoint-disconnect", [this, client, service_id, endpoint_id, barrier]() mutable { @@ -466,10 +476,27 @@ BwuHandler* BwuManager::GetHandlerForMedium(Medium medium) const { void BwuManager::OnBwuNegotiationFrame(ClientProxy* client, const BwuNegotiationFrame frame, - const string& endpoint_id) { + const std::string& endpoint_id) { NEARBY_LOGS(INFO) << "OnBwuNegotiationFrame: processing incoming " << BwuNegotiationFrame::EventType_Name(frame.event_type()) << " frame for endpoint " << endpoint_id; + + if (!client->IsConnectedToEndpoint(endpoint_id)) { + NEARBY_LOGS(WARNING) + << "BwuManager skips the process BANDWIDTH_UPGRADE_NEGOTIATION before " + "PCP connected, " + << frame.event_type(); + + // For the case discover side not yet get the local accept from client, but + // advertise side already get, discover side should inform advertise side + // the upgrade failed, so the advertise side could have chance to initialize + // another upgrade flow again. + if (frame.event_type() == BwuNegotiationFrame::UPGRADE_PATH_AVAILABLE) { + RunUpgradeFailedProtocol(client, endpoint_id, frame.upgrade_path_info()); + } + return; + } + switch (frame.event_type()) { case BwuNegotiationFrame::UPGRADE_PATH_AVAILABLE: ProcessBwuPathAvailableEvent(client, endpoint_id, @@ -501,90 +528,95 @@ void BwuManager::OnIncomingConnection( NEARBY_LOGS(INFO) << "BwuManager process incoming connection"; std::shared_ptr connection( mutable_connection.release()); - RunOnBwuManagerThread( - "bwu-on-incoming-connection", [this, client, connection]() { - absl::Time connection_attempt_start_time = - SystemClock::ElapsedRealtime(); - EndpointChannel* channel = connection->channel.get(); - if (channel == nullptr) { - NEARBY_LOGS(ERROR) - << "BwuManager failed to create new EndpointChannel for incoming " - "socket."; - connection->socket->Close(); - AttemptToRecordBandwidthUpgradeErrorForUnknownEndpoint( - location::nearby::proto::connections::MEDIUM_ERROR, - location::nearby::proto::connections::SOCKET_CREATION); - return; - } + RunOnBwuManagerThread("bwu-on-incoming-connection", [this, client, + connection]() { + absl::Time connection_attempt_start_time = SystemClock::ElapsedRealtime(); + EndpointChannel* channel = connection->channel.get(); + if (channel == nullptr) { + NEARBY_LOGS(ERROR) + << "BwuManager failed to create new EndpointChannel for incoming " + "socket."; + connection->socket->Close(); + AttemptToRecordBandwidthUpgradeErrorForUnknownEndpoint( + location::nearby::proto::connections::MEDIUM_ERROR, + location::nearby::proto::connections::SOCKET_CREATION); + return; + } - NEARBY_LOGS(VERBOSE) - << "BwuManager successfully created new EndpointChannel for " - "incoming socket"; + NEARBY_VLOG(1) << "BwuManager successfully created new EndpointChannel for " + "incoming socket"; - ClientIntroduction introduction; - if (!ReadClientIntroductionFrame(channel, introduction)) { - // This was never a fully EstablishedConnection, no need to provide a - // closure reason. - channel->Close(); - NEARBY_LOGS(ERROR) - << "BwuManager failed to read " - "BWU_NEGOTIATION.CLIENT_INTRODUCTION OfflineFrame from " - "newly-created EndpointChannel " - << channel->GetName() - << ", so the EndpointChannel was discarded."; - return; - } + ClientIntroduction introduction; + if (!ReadClientIntroductionFrame(channel, introduction)) { + // This was never a fully EstablishedConnection, no need to provide a + // closure reason. + channel->Close(); + NEARBY_LOGS(ERROR) + << "BwuManager failed to read " + "BWU_NEGOTIATION.CLIENT_INTRODUCTION OfflineFrame from " + "newly-created EndpointChannel " + << channel->GetName() << ", so the EndpointChannel was discarded."; + return; + } - if (!WriteClientIntroductionAckFrame(channel)) { - // This was never a fully EstablishedConnection, no need to provide a - // closure reason. - channel->Close(); - return; - } + NEARBY_VLOG(1) << "BwuManager successfully received " + "BWU_NEGOTIATION.CLIENT_INTRODUCTION " + "OfflineFrame on EndpointChannel " + << channel->GetName(); - NEARBY_LOGS(VERBOSE) << "BwuManager successfully received " - "BWU_NEGOTIATION.CLIENT_INTRODUCTION " - "OfflineFrame on EndpointChannel " - << channel->GetName(); + if (!WriteClientIntroductionAckFrame(channel)) { + // This was never a fully EstablishedConnection, no need to provide a + // closure reason. + NEARBY_LOGS(ERROR) << "BwuManager failed to write" + "BWU_NEGOTIATION.CLIENT_INTRODUCTION_ACK " + "OfflineFrame on EndpointChannel " + << channel->GetName(); + channel->Close(); + return; + } - const std::string& endpoint_id = introduction.endpoint_id(); - ClientProxy* mapped_client; - const auto item = in_progress_upgrades_.find(endpoint_id); - if (item == in_progress_upgrades_.end()) return; - mapped_client = item->second; - CancelRetryUpgradeAlarm(endpoint_id); - if (mapped_client == nullptr) { - // This was never a fully EstablishedConnection, no need to provide a - // closure reason. - channel->Close(); - return; - } + NEARBY_VLOG(1) << "BwuManager successfully wrote " + "BWU_NEGOTIATION.CLIENT_INTRODUCTION_ACK " + "OfflineFrame on EndpointChannel " + << channel->GetName(); - CHECK(client == mapped_client); + const std::string& endpoint_id = introduction.endpoint_id(); + ClientProxy* mapped_client; + const auto item = in_progress_upgrades_.find(endpoint_id); + if (item == in_progress_upgrades_.end()) return; + mapped_client = item->second; + CancelRetryUpgradeAlarm(endpoint_id); + if (mapped_client == nullptr) { + // This was never a fully EstablishedConnection, no need to provide a + // closure reason. + channel->Close(); + return; + } - // The ConnectionAttempt has now succeeded, so record it as such. - std::unique_ptr - connections_attempt_metadata_params; - if (channel != nullptr) { - connections_attempt_metadata_params = - client->GetAnalyticsRecorder() - .BuildConnectionAttemptMetadataParams( - channel->GetTechnology(), channel->GetBand(), - channel->GetFrequency(), channel->GetTryCount()); - } - client->GetAnalyticsRecorder().OnIncomingConnectionAttempt( - location::nearby::proto::connections::UPGRADE, channel->GetMedium(), - location::nearby::proto::connections::RESULT_SUCCESS, - SystemClock::ElapsedRealtime() - connection_attempt_start_time, - client->GetConnectionToken(endpoint_id), - connections_attempt_metadata_params.get()); + CHECK(client == mapped_client); - // Use the introductory client information sent over to run the upgrade - // protocol. - RunUpgradeProtocol(mapped_client, endpoint_id, - std::move(connection->channel), - !introduction.supports_disabling_encryption()); - }); + // The ConnectionAttempt has now succeeded, so record it as such. + std::unique_ptr + connections_attempt_metadata_params; + if (channel != nullptr) { + connections_attempt_metadata_params = + client->GetAnalyticsRecorder().BuildConnectionAttemptMetadataParams( + channel->GetTechnology(), channel->GetBand(), + channel->GetFrequency(), channel->GetTryCount()); + } + client->GetAnalyticsRecorder().OnIncomingConnectionAttempt( + location::nearby::proto::connections::UPGRADE, channel->GetMedium(), + location::nearby::proto::connections::RESULT_SUCCESS, + SystemClock::ElapsedRealtime() - connection_attempt_start_time, + client->GetConnectionToken(endpoint_id), + connections_attempt_metadata_params.get()); + + // Use the introductory client information sent over to run the upgrade + // protocol. + RunUpgradeProtocol(mapped_client, endpoint_id, + std::move(connection->channel), + !introduction.supports_disabling_encryption()); + }); } void BwuManager::RunOnBwuManagerThread(const std::string& name, @@ -642,10 +674,10 @@ void BwuManager::RunUpgradeProtocol( location::nearby::proto::connections::LAST_WRITE_TO_PRIOR_CHANNEL); return; } - NEARBY_LOGS(VERBOSE) << "BwuManager successfully wrote " - "BWU_NEGOTIATION.LAST_WRITE_TO_PRIOR_CHANNEL " - "OfflineFrame while upgrading endpoint " - << endpoint_id; + NEARBY_VLOG(1) << "BwuManager successfully wrote " + "BWU_NEGOTIATION.LAST_WRITE_TO_PRIOR_CHANNEL " + "OfflineFrame while upgrading endpoint " + << endpoint_id; // The remainder of this clean shutdown for the previous EndpointChannel will // continue when we receive a corresponding @@ -663,7 +695,7 @@ void BwuManager::RunUpgradeProtocol( // Outgoing BWU session. void BwuManager::ProcessBwuPathAvailableEvent( - ClientProxy* client, const string& endpoint_id, + ClientProxy* client, const std::string& endpoint_id, const UpgradePathInfo& upgrade_path_info) { Medium upgrade_medium = parser::UpgradePathInfoMediumToMedium(upgrade_path_info.medium()); @@ -686,6 +718,12 @@ void BwuManager::ProcessBwuPathAvailableEvent( return; } + if (client->IsIncomingConnection(endpoint_id)) { + NEARBY_LOGS(INFO) + << "ProcessBandwidthUpgradePathAvailableEvent ignored by Advertiser"; + return; + } + if (in_progress_upgrades_.contains(endpoint_id)) { NEARBY_LOGS(ERROR) << "BwuManager received a duplicate bandwidth upgrade for endpoint " @@ -1068,10 +1106,10 @@ void BwuManager::ProcessLastWriteToPriorChannelEvent( location::nearby::proto::connections::SAFE_TO_CLOSE_PRIOR_CHANNEL); return; } - NEARBY_LOGS(VERBOSE) << "BwuManager successfully wrote " - "BWU_NEGOTIATION.SAFE_TO_CLOSE_PRIOR_CHANNEL " - "OfflineFrame while trying to upgrade endpoint " - << endpoint_id; + NEARBY_VLOG(1) << "BwuManager successfully wrote " + "BWU_NEGOTIATION.SAFE_TO_CLOSE_PRIOR_CHANNEL " + "OfflineFrame while trying to upgrade endpoint " + << endpoint_id; // The upgrade protocol's clean shutdown of the prior EndpointChannel will // conclude when we receive a corresponding @@ -1129,7 +1167,7 @@ void BwuManager::ProcessSafeToClosePriorChannelEvent( previous_endpoint_channel->Read(); previous_endpoint_channel->Close(DisconnectionReason::UPGRADED); - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "BwuManager cleanly shut down prior " << previous_endpoint_channel->GetType() << " EndpointChannel to conclude upgrade protocol for endpoint " @@ -1157,7 +1195,15 @@ void BwuManager::ProcessSafeToClosePriorChannelEvent( channel->Resume(); // Report the success to the client - client->OnBandwidthChanged(endpoint_id, channel->GetMedium()); + Medium medium = channel->GetMedium(); + if (FeatureFlags::GetInstance() + .GetFlags() + .support_web_rtc_non_cellular_medium) { + if (medium == Medium::WEB_RTC && !mediums_->GetWebRtc().IsUsingCellular()) { + medium = Medium::WEB_RTC_NON_CELLULAR; + } + } + client->OnBandwidthChanged(endpoint_id, medium); in_progress_upgrades_.erase(endpoint_id); } @@ -1238,9 +1284,9 @@ void BwuManager::TryNextBestUpgradeMediums( auto channel = channel_manager_->GetChannelForEndpoint(endpoint_id); Medium current_medium = channel ? channel->GetMedium() : Medium::UNKNOWN_MEDIUM; - NEARBY_LOGS(VERBOSE) << "current_medium: " - << location::nearby::proto::connections::Medium_Name( - current_medium); + NEARBY_VLOG(1) << "current_medium: " + << location::nearby::proto::connections::Medium_Name( + current_medium); if (current_medium != Medium::WIFI_LAN && (next_medium == current_medium || next_medium == Medium::UNKNOWN_MEDIUM || upgrade_mediums.empty())) { diff --git a/connections/implementation/bwu_manager_test.cc b/connections/implementation/bwu_manager_test.cc index 5a5e2659..56d07afd 100644 --- a/connections/implementation/bwu_manager_test.cc +++ b/connections/implementation/bwu_manager_test.cc @@ -20,16 +20,22 @@ #include "gtest/gtest.h" #include "absl/strings/string_view.h" +#include "connections/connection_options.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/endpoint_channel.h" #include "connections/implementation/endpoint_channel_manager.h" #include "connections/implementation/endpoint_manager.h" #include "connections/implementation/fake_bwu_handler.h" #include "connections/implementation/fake_endpoint_channel.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/mediums/mediums.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/service_id_constants.h" +#include "connections/listeners.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/byte_array.h" #include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" #include "internal/proto/analytics/connections_log.pb.h" #include "proto/connections_enums.pb.h" @@ -89,9 +95,15 @@ class BwuManagerTest : public ::testing::Test { // Create the initial device-to-device connection, before bandwidth upgrade. // Typically |medium| will be Bluetooth. - FakeEndpointChannel* CreateInitialEndpoint(absl::string_view service_id, + FakeEndpointChannel* CreateInitialEndpoint(ClientProxy* client, + absl::string_view service_id, absl::string_view endpoint_id, Medium medium) { + client->OnConnectionInitiated( + std::string(endpoint_id), + {.remote_endpoint_info = ByteArray("remote endpoint")}, + {.auto_upgrade_bandwidth = false}, {}, ""); + client->OnConnectionAccepted(std::string(endpoint_id)); auto channel = std::make_unique(medium, std::string(service_id)); FakeEndpointChannel* channel_raw = channel.get(); @@ -235,8 +247,8 @@ class BwuManagerTestParam : public BwuManagerTest, TEST_P(BwuManagerTestParam, InitiateBwu_Success) { // Create the initial device-to-device Bluetooth connection. - FakeEndpointChannel* initial_channel = - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + FakeEndpointChannel* initial_channel = CreateInitialEndpoint( + &client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); // Initiate BWU, and send BANDWIDTH_UPGRADE_NEGOTIATION.UPGRADE_PATH_AVAILABLE // to the Responder over the initial Bluetooth channel. @@ -298,7 +310,7 @@ TEST_P(BwuManagerTestParam, InitiateBwu_Success) { TEST_P(BwuManagerTestParam, InitiateBwu_Error_DontUpgradeIfAlreadyConenctedOverTheRequestedMedium) { - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); EXPECT_EQ(1u, fake_web_rtc_bwu_handler_->handle_initialize_calls().size()); @@ -312,7 +324,7 @@ TEST_P(BwuManagerTestParam, TEST_P(BwuManagerTestParam, InitiateBwu_Error_DontUpgradeFromWIFI_LANToWIFI_HOTSPOT) { - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::WIFI_LAN); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::WIFI_LAN); // Ignore request to upgrade to WebRTC if we're already connected. bwu_manager_->InitiateBwuForEndpoint(&client_, std::string(kEndpointId1), @@ -336,7 +348,7 @@ TEST_P(BwuManagerTestParam, InitiateBwu_Error_NoInitialMedium) { } TEST_P(BwuManagerTestParam, InitiateBwu_Error_UpgradeAlreadyInProgress) { - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); bwu_manager_->InitiateBwuForEndpoint(&client_, std::string(kEndpointId1), Medium::WEB_RTC); @@ -357,8 +369,8 @@ TEST_P(BwuManagerTestParam, InitiateBwu_Error_UpgradeAlreadyInProgress) { TEST_P(BwuManagerTestParam, InitiateBwu_Error_FailedToWriteUpgradePathAvailableFrame) { // Create the initial device-to-device Bluetooth connection. - FakeEndpointChannel* initial_channel = - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + FakeEndpointChannel* initial_channel = CreateInitialEndpoint( + &client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); // Make the initial endpoint channel fail when writing the // UPGRADE_PATH_AVAILABLE frame. @@ -391,8 +403,8 @@ TEST_F(BwuManagerTest, FeatureFlags::GetMutableFlagsForTesting().support_multiple_bwu_mediums = true; // Say we have two already upgraded WebRTC connections for the same service. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdA, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId2, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); FullyUpgradeEndpoint(kEndpointId2, /*initial_medium=*/Medium::BLUETOOTH, @@ -441,8 +453,8 @@ TEST_F(BwuManagerTest, false; // Say we have two already upgraded WebRTC connections for the same service. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdA, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId2, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); FullyUpgradeEndpoint(kEndpointId2, /*initial_medium=*/Medium::BLUETOOTH, @@ -497,8 +509,8 @@ TEST_F(BwuManagerTest, FeatureFlags::GetMutableFlagsForTesting().support_multiple_bwu_mediums = true; // Say we have two already upgraded WLAN connections for different services. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdB, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId2, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WIFI_LAN); FullyUpgradeEndpoint(kEndpointId2, /*initial_medium=*/Medium::BLUETOOTH, @@ -552,8 +564,8 @@ TEST_F(BwuManagerTest, false; // Say we have two already upgraded WLAN connections for different services. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdB, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId2, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WIFI_LAN); FullyUpgradeEndpoint(kEndpointId2, /*initial_medium=*/Medium::BLUETOOTH, @@ -611,11 +623,11 @@ TEST_F( // Say we have three upgraded connections for two different services and two // different mediums. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdA, kEndpointId2, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdB, kEndpointId3, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdB, kEndpointId4, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdB, kEndpointId5, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId3, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId4, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId5, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); FullyUpgradeEndpoint(kEndpointId4, /*initial_medium=*/Medium::BLUETOOTH, @@ -759,15 +771,15 @@ TEST_F(BwuManagerTest, InitiateBwu_Revert_OnUpgradeFailure_FlagEnabled) { FeatureFlags::GetMutableFlagsForTesting().support_multiple_bwu_mediums = true; // Say we have two already upgraded WebRTC connections for service A. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdA, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId2, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); FullyUpgradeEndpoint(kEndpointId2, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); // Service B has an initial Bluetooth connection that it tries to upgrade. - CreateInitialEndpoint(kServiceIdB, kEndpointId3, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId3, Medium::BLUETOOTH); bwu_manager_->InitiateBwuForEndpoint(&client_, std::string(kEndpointId3), Medium::WEB_RTC); fake_web_rtc_bwu_handler_->NotifyBwuManagerOfIncomingConnection( @@ -797,15 +809,15 @@ TEST_F(BwuManagerTest, InitiateBwu_Revert_OnUpgradeFailure_FlagDisabled) { false; // Say we have two already upgraded WebRTC connections for service A. - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); - CreateInitialEndpoint(kServiceIdA, kEndpointId2, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId2, Medium::BLUETOOTH); FullyUpgradeEndpoint(kEndpointId1, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); FullyUpgradeEndpoint(kEndpointId2, /*initial_medium=*/Medium::BLUETOOTH, /*upgrade_medium=*/Medium::WEB_RTC); // Service B has an initial Bluetooth connection that it tries to upgrade. - CreateInitialEndpoint(kServiceIdB, kEndpointId3, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdB, kEndpointId3, Medium::BLUETOOTH); bwu_manager_->InitiateBwuForEndpoint(&client_, std::string(kEndpointId3), Medium::WEB_RTC); fake_web_rtc_bwu_handler_->NotifyBwuManagerOfIncomingConnection( @@ -832,7 +844,7 @@ TEST_F(BwuManagerTest, InitiateBwu_Revert_OnUpgradeFailure_FlagDisabled) { TEST_F(BwuManagerTest, InitiateBwu_Revert_OnDisconnect_WifiDirect) { FeatureFlags::GetMutableFlagsForTesting().support_multiple_bwu_mediums = true; OfflineFrame frame; - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); ByteArray bytes = parser::ForBwuWifiDirectPathAvailable( /*ssid=*/"Direct-12345678", /*password=*/"87654321", /*port=*/2143, @@ -865,12 +877,13 @@ TEST_F(BwuManagerTest, InitiateBwu_Revert_OnDisconnect_WifiDirect) { TEST_F(BwuManagerTest, InitiateBwu_Revert_OnDisconnect_Hotspot) { FeatureFlags::GetMutableFlagsForTesting().support_multiple_bwu_mediums = true; - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); ExceptionOr hotspot_path_available_frame = parser::FromBytes(parser::ForBwuWifiHotspotPathAvailable( /*ssid=*/"Direct-357a2d8c", /*password=*/"b592f7d3", - /*port=*/1234, /*gateway=*/"123.234.23.1", false)); + /*port=*/1234, /*frequency=*/2412, /*gateway=*/"123.234.23.1", + false)); OfflineFrame frame = hotspot_path_available_frame.result(); frame.set_version(OfflineFrame::V1); auto* v1_frame = frame.mutable_v1(); @@ -894,7 +907,7 @@ TEST_F(BwuManagerTest, InitiateBwu_Revert_OnDisconnect_Hotspot) { TEST_F(BwuManagerTest, InitiateBwu_Revert_OnDisconnect_Wlan) { FeatureFlags::GetMutableFlagsForTesting().support_multiple_bwu_mediums = true; - CreateInitialEndpoint(kServiceIdA, kEndpointId1, Medium::BLUETOOTH); + CreateInitialEndpoint(&client_, kServiceIdA, kEndpointId1, Medium::BLUETOOTH); ExceptionOr wlan_path_available_frame = parser::FromBytes( parser::ForBwuWifiLanPathAvailable(/*ip_address=*/"ABCD", @@ -927,6 +940,78 @@ TEST_F(BwuManagerTest, OnProcessBwuEvent) { // TODO(b/235109434): Add more unit tests coverage for BWU module } +TEST_F(BwuManagerTest, BlockBwuFrameBeforeAccept) { + auto channel = std::make_unique( + Medium::BLUETOOTH, std::string(kServiceIdA)); + ecm_.RegisterChannelForEndpoint(&client_, std::string(kEndpointId2), + std::move(channel)); + + ExceptionOr hotspot_path_available_frame2 = + parser::FromBytes(parser::ForBwuWifiHotspotPathAvailable( + /*ssid=*/"Direct-357a2d8c", /*password=*/"b592f7d3", + /*port=*/1234, /*frequency=*/2412, /*gateway=*/"123.234.23.1", true)); + OfflineFrame frame2 = hotspot_path_available_frame2.result(); + frame2.set_version(OfflineFrame::V1); + auto* v1_frame2 = frame2.mutable_v1(); + auto* sub_frame2 = v1_frame2->mutable_bandwidth_upgrade_negotiation(); + sub_frame2->set_event_type( + BandwidthUpgradeNegotiationFrame::UPGRADE_PATH_AVAILABLE); + auto* upgrade_path_info2 = sub_frame2->mutable_upgrade_path_info(); + + upgrade_path_info2->set_supports_client_introduction_ack(false); + upgrade_path_info2->set_supports_disabling_encryption(true); + bwu_manager_->OnIncomingFrame(frame2, std::string(kEndpointId2), &client_, + Medium::BLUETOOTH, packet_meta_data_); + CountDownLatch latch2(1); + // The BWU frame should be drop, so the inProgressUpgrades should be empty. + ASSERT_EQ(bwu_manager_->IsUpgradeOngoing(std::string(kEndpointId2)), false); + UnRegisterChannelForEndpoint(kEndpointId2); +} + +TEST_F(BwuManagerTest, BlockBwuFrameFromAdvertiser) { + ExceptionOr hotspot_path_available_frame = + parser::FromBytes(parser::ForBwuWifiHotspotPathAvailable( + /*ssid=*/"Direct-357a2d8c", /*password=*/"b592f7d3", + /*port=*/1234, /*frequency=*/2412, /*gateway=*/"123.234.23.1", true)); + OfflineFrame frame = hotspot_path_available_frame.result(); + frame.set_version(OfflineFrame::V1); + auto* v1_frame = frame.mutable_v1(); + auto* sub_frame = v1_frame->mutable_bandwidth_upgrade_negotiation(); + sub_frame->set_event_type( + BandwidthUpgradeNegotiationFrame::UPGRADE_PATH_AVAILABLE); + auto* upgrade_path_info = sub_frame->mutable_upgrade_path_info(); + upgrade_path_info->set_supports_client_introduction_ack(false); + upgrade_path_info->set_supports_disabling_encryption(true); + + ConnectionResponseInfo response_info{ + .remote_endpoint_info = ByteArray{"endpoint_name"}, + .authentication_token = "auth_token", + .raw_authentication_token = ByteArray{"auth_token"}, + .is_incoming_connection = true, + }; + ConnectionOptions connection_options; + + auto channel = std::make_unique( + Medium::BLUETOOTH, std::string(kServiceIdA)); + ecm_.RegisterChannelForEndpoint(&client_, std::string(kEndpointId2), + std::move(channel)); + + client_.OnConnectionInitiated(std::string(kEndpointId2), response_info, + connection_options, {}, "token"); + client_.LocalEndpointAcceptedConnection(std::string(kEndpointId2), {}); + client_.RemoteEndpointAcceptedConnection(std::string(kEndpointId2)); + EXPECT_TRUE(client_.IsConnectionAccepted(std::string(kEndpointId2))); + client_.OnConnectionAccepted(std::string(kEndpointId2)); + EXPECT_TRUE(client_.IsConnectedToEndpoint(std::string(kEndpointId2))); + + bwu_manager_->OnIncomingFrame(frame, std::string(kEndpointId2), &client_, + Medium::BLUETOOTH, packet_meta_data_); + CountDownLatch latch2(1); + // The BWU frame should be drop, so the IsUpgradeOngoing should be empty. + ASSERT_EQ(bwu_manager_->IsUpgradeOngoing(std::string(kEndpointId2)), false); + UnRegisterChannelForEndpoint(kEndpointId2); +} + INSTANTIATE_TEST_SUITE_P(BwuManagerTestParam, BwuManagerTestParam, testing::Bool()); diff --git a/connections/implementation/client_proxy.cc b/connections/implementation/client_proxy.cc index 06768e72..b6d77e77 100644 --- a/connections/implementation/client_proxy.cc +++ b/connections/implementation/client_proxy.cc @@ -15,27 +15,46 @@ #include "connections/implementation/client_proxy.h" #include -#include #include #include -#include #include #include +#include #include #include #include +#include #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/functional/any_invocable.h" #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "absl/types/span.h" +#include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" +#include "connections/implementation/analytics/analytics_recorder.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/payload.h" +#include "connections/status.h" +#include "connections/strategy.h" #include "connections/v3/bandwidth_info.h" #include "connections/v3/connection_listening_options.h" +#include "connections/v3/connection_result.h" +#include "connections/v3/connections_device.h" #include "connections/v3/connections_device_provider.h" +#include "connections/v3/listeners.h" #include "internal/analytics/event_logger.h" #include "internal/flags/nearby_flags.h" +#include "internal/interop/device.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancelable_alarm.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/error_code_params.h" #include "internal/platform/error_code_recorder.h" #include "internal/platform/feature_flags.h" #include "internal/platform/implementation/platform.h" @@ -47,18 +66,26 @@ namespace nearby { namespace connections { - +namespace { using ::location::nearby::connections::OsInfo; -// The definition is necessary before C++17. -constexpr absl::Duration - ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout; - constexpr char kEndpointIdChars[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; +bool IsFeatureUseStableEndpointIdEnabled() { + return NearbyFlags::GetInstance().GetBoolFlag( + connections::config_package_nearby::nearby_connections_feature:: + kUseStableEndpointId); +} + +} // namespace + +// The definition is necessary before C++17. +constexpr absl::Duration + ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout; + ClientProxy::ClientProxy(::nearby::analytics::EventLogger* event_logger) : client_id_(Prng().NextInt64()) { NEARBY_LOGS(INFO) << "ClientProxy ctor event_logger=" << event_logger; @@ -73,9 +100,14 @@ ClientProxy::ClientProxy(::nearby::analytics::EventLogger* event_logger) supports_safe_to_disconnect_ = NearbyFlags::GetInstance().GetBoolFlag( config_package_nearby::nearby_connections_feature:: kEnableSafeToDisconnect); + support_auto_reconnect_ = NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableAutoReconnect); local_safe_to_disconnect_version_ = NearbyFlags::GetInstance().GetInt64Flag( config_package_nearby::nearby_connections_feature:: kSafeToDisconnectVersion); + NEARBY_LOGS(INFO) << "[safe-to-disconnect]: Local enabled: " + << supports_safe_to_disconnect_ + << "; Version: " << local_safe_to_disconnect_version_; } ClientProxy::~ClientProxy() { Reset(); } @@ -85,13 +117,21 @@ std::int64_t ClientProxy::GetClientId() const { return client_id_; } std::string ClientProxy::GetLocalEndpointId() { MutexLock lock(&mutex_); if (!local_endpoint_id_.empty()) { + NEARBY_LOGS(INFO) << __func__ + << ": Reusing cached endpoint id: " << local_endpoint_id_; return local_endpoint_id_; } if (external_device_provider_ == nullptr) { local_endpoint_id_ = GenerateLocalEndpointId(); + NEARBY_LOGS(INFO) << __func__ << ": Locally generating endpoint id: " + << local_endpoint_id_; } else { local_endpoint_id_ = external_device_provider_->GetLocalDevice()->GetEndpointId(); + NEARBY_LOGS(INFO) + << __func__ + << ": From external device provider, populating endpoint id: " + << local_endpoint_id_; } return local_endpoint_id_; } @@ -116,14 +156,39 @@ std::string ClientProxy::GetConnectionToken(const std::string& endpoint_id) { return {}; } +std::optional ClientProxy::GetBluetoothMacAddress( + const std::string& endpoint_id) { + auto item = bluetooth_mac_addresses_.find(endpoint_id); + if (item != bluetooth_mac_addresses_.end()) return item->second; + return std::nullopt; +} + +void ClientProxy::SetBluetoothMacAddress( + const std::string& endpoint_id, const std::string& bluetooth_mac_address) { + bluetooth_mac_addresses_[endpoint_id] = bluetooth_mac_address; +} + std::string ClientProxy::GenerateLocalEndpointId() { - if (high_vis_mode_) { - if (!local_high_vis_mode_cache_endpoint_id_.empty()) { - NEARBY_LOGS(INFO) - << "ClientProxy [Local Endpoint Re-using cached endpoint id]: client=" - << GetClientId() << "; local_high_vis_mode_cache_endpoint_id_=" - << local_high_vis_mode_cache_endpoint_id_; - return local_high_vis_mode_cache_endpoint_id_; + if (IsFeatureUseStableEndpointIdEnabled()) { + if (!cached_endpoint_id_.empty()) { + if (stable_endpoint_id_mode_) { + NEARBY_LOGS(INFO) << "ClientProxy [Local Endpoint Re-using cached " + "endpoint id due to in stable endpoint id mode]: " + "client=" + << GetClientId() + << "; cached_endpoint_id_=" << cached_endpoint_id_; + return cached_endpoint_id_; + } + } + } else { + if (high_vis_mode_) { + if (!cached_endpoint_id_.empty()) { + NEARBY_LOGS(INFO) << "ClientProxy [Local Endpoint Re-using cached " + "endpoint id]: client=" + << GetClientId() + << "; cached_endpoint_id_=" << cached_endpoint_id_; + return cached_endpoint_id_; + } } } std::string id; @@ -140,7 +205,11 @@ void ClientProxy::Reset() { StoppedAdvertising(); StoppedDiscovery(); RemoveAllEndpoints(); - ExitHighVisibilityMode(); + if (IsFeatureUseStableEndpointIdEnabled()) { + ExitStableEndpointIdMode(); + } else { + ExitHighVisibilityMode(); + } } void ClientProxy::StartedAdvertising( @@ -152,13 +221,22 @@ void ClientProxy::StartedAdvertising( NEARBY_LOGS(INFO) << "ClientProxy [StartedAdvertising]: client=" << GetClientId(); - if (high_vis_mode_) { - local_high_vis_mode_cache_endpoint_id_ = local_endpoint_id_; - NEARBY_LOGS(INFO) - << "ClientProxy [High Visibility Mode Adv, Cache EndpointId]: client=" - << GetClientId() << "; local_high_vis_mode_cache_endpoint_id_=" - << local_high_vis_mode_cache_endpoint_id_; - CancelClearLocalHighVisModeCacheEndpointIdAlarm(); + if (IsFeatureUseStableEndpointIdEnabled()) { + if (stable_endpoint_id_mode_) { + cached_endpoint_id_ = local_endpoint_id_; + } else { + cached_endpoint_id_.clear(); + } + + CancelClearCachedEndpointIdAlarm(); + } else { + if (high_vis_mode_) { + cached_endpoint_id_ = local_endpoint_id_; + NEARBY_LOGS(INFO) + << "ClientProxy [High Visibility Mode Adv, Cache EndpointId]: client=" + << GetClientId() << "; cached_endpoint_id_=" << cached_endpoint_id_; + CancelClearCachedEndpointIdAlarm(); + } } advertising_info_ = {service_id, listener}; @@ -182,7 +260,11 @@ void ClientProxy::StoppedAdvertising() { // advertising_options_ is purposefully not cleared here. OnSessionComplete(); - ExitHighVisibilityMode(); + if (IsFeatureUseStableEndpointIdEnabled()) { + ExitStableEndpointIdMode(); + } else { + ExitHighVisibilityMode(); + } } bool ClientProxy::IsAdvertising() const { @@ -279,11 +361,11 @@ ConnectionListener ClientProxy::GetAdvertisingOrIncomingConnectionListener() { void ClientProxy::StartedDiscovery( const std::string& service_id, Strategy strategy, - const DiscoveryListener& listener, + DiscoveryListener listener, absl::Span mediums, const DiscoveryOptions& discovery_options) { MutexLock lock(&mutex_); - discovery_info_ = DiscoveryInfo{service_id, listener}; + discovery_info_ = DiscoveryInfo{service_id, std::move(listener)}; discovery_options_ = discovery_options; const std::vector medium_vector( @@ -360,10 +442,9 @@ void ClientProxy::OnEndpointLost(const std::string& service_id, NEARBY_LOGS(INFO) << "ClientProxy [Endpoint Lost]: [enter] id=" << endpoint_id << "; service=" << service_id; if (!IsDiscoveringServiceId(service_id)) { - NEARBY_LOG(INFO, - "ClientProxy [Endpoint Lost]: Ignoring event for id=%s because " - "this client is not discovering", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "ClientProxy [Endpoint Lost]: Ignoring event for id=" + << endpoint_id + << " because this client is not discovering."; return; } @@ -382,6 +463,7 @@ void ClientProxy::OnEndpointLost(const std::string& service_id, void ClientProxy::OnRequestConnection( const Strategy& strategy, const std::string& endpoint_id, const ConnectionOptions& connection_options) { + NEARBY_LOGS(INFO) << "ClientProxy [RequestConnection]: id=" << endpoint_id; analytics_recorder_->OnRequestConnection(strategy, endpoint_id); } @@ -433,6 +515,7 @@ void ClientProxy::OnConnectionInitiated( } void ClientProxy::OnConnectionAccepted(const std::string& endpoint_id) { + NEARBY_LOGS(INFO) << "ClientProxy [ConnectionAccepted]: id=" << endpoint_id; MutexLock lock(&mutex_); if (!HasPendingConnectionToEndpoint(endpoint_id)) { @@ -452,6 +535,7 @@ void ClientProxy::OnConnectionAccepted(const std::string& endpoint_id) { void ClientProxy::OnConnectionRejected(const std::string& endpoint_id, const Status& status) { + NEARBY_LOGS(INFO) << "ClientProxy [ConnectionRejected]: id=" << endpoint_id; MutexLock lock(&mutex_); if (!HasPendingConnectionToEndpoint(endpoint_id)) { @@ -471,6 +555,7 @@ void ClientProxy::OnConnectionRejected(const std::string& endpoint_id, void ClientProxy::OnBandwidthChanged(const std::string& endpoint_id, Medium new_medium) { + NEARBY_LOGS(INFO) << "ClientProxy [BandwidthChanged]: id=" << endpoint_id; MutexLock lock(&mutex_); const ConnectionPair* item = LookupConnection(endpoint_id); @@ -483,6 +568,7 @@ void ClientProxy::OnBandwidthChanged(const std::string& endpoint_id, } void ClientProxy::OnDisconnected(const std::string& endpoint_id, bool notify) { + NEARBY_LOGS(INFO) << "ClientProxy [OnDisconnected]: id=" << endpoint_id; MutexLock lock(&mutex_); const ConnectionPair* item = LookupConnection(endpoint_id); @@ -495,6 +581,12 @@ void ClientProxy::OnDisconnected(const std::string& endpoint_id, bool notify) { } CancelEndpoint(endpoint_id); + + if (IsFeatureUseStableEndpointIdEnabled()) { + if (!stable_endpoint_id_mode_ && !HasOngoingConnection()) { + ScheduleClearCachedEndpointIdAlarm(); + } + } } bool ClientProxy::ConnectionStatusMatches(const std::string& endpoint_id, @@ -591,6 +683,11 @@ std::vector ClientProxy::GetConnectedEndpoints() const { }); } +bool ClientProxy::HasOngoingConnection() const { + return !GetPendingConnectedEndpoints().empty() || + !GetConnectedEndpoints().empty(); +} + std::int32_t ClientProxy::GetNumOutgoingConnections() const { return GetMatchingEndpoints([](const Connection& connection) { return connection.status == Connection::kConnected && @@ -607,6 +704,24 @@ std::int32_t ClientProxy::GetNumIncomingConnections() const { .size(); } +bool ClientProxy::IsIncomingConnection(const std::string& endpoint_id) const { + MutexLock lock(&mutex_); + const ConnectionPair* item = LookupConnection(endpoint_id); + if (item != nullptr && item->first.status == Connection::kConnected) { + return item->first.is_incoming; + } + return false; +} + +bool ClientProxy::IsOutgoingConnection(const std::string& endpoint_id) const { + MutexLock lock(&mutex_); + const ConnectionPair* item = LookupConnection(endpoint_id); + if (item != nullptr && item->first.status == Connection::kConnected) { + return !item->first.is_incoming; + } + return false; +} + bool ClientProxy::HasPendingConnectionToEndpoint( const std::string& endpoint_id) const { MutexLock lock(&mutex_); @@ -641,15 +756,14 @@ bool ClientProxy::HasRemoteEndpointResponded( void ClientProxy::LocalEndpointAcceptedConnection( const std::string& endpoint_id, PayloadListener listener) { MutexLock lock(&mutex_); - if (HasLocalEndpointResponded(endpoint_id)) { NEARBY_LOGS(INFO) << "ClientProxy [Local Accepted]: local endpoint has responded; id=" << endpoint_id; return; } - AppendConnectionStatus(endpoint_id, Connection::kLocalEndpointAccepted); + NEARBY_LOGS(INFO) << "ClientProxy [Local Accepted]: id=" << endpoint_id; ConnectionPair* item = LookupConnection(endpoint_id); if (item != nullptr) { item->second = std::move(listener); @@ -819,6 +933,7 @@ void ClientProxy::SetRemoteOsInfo(absl::string_view endpoint_id, std::optional ClientProxy::GetRemoteSafeToDisconnectVersion( absl::string_view endpoint_id) const { + MutexLock lock(&mutex_); const ConnectionPair* item = LookupConnection(endpoint_id); if (item != nullptr) { return item->first.safe_to_disconnect_version; @@ -829,6 +944,7 @@ std::optional ClientProxy::GetRemoteSafeToDisconnectVersion( void ClientProxy::SetRemoteSafeToDisconnectVersion( absl::string_view endpoint_id, const std::int32_t& safe_to_disconnect_version) { + MutexLock lock(&mutex_); ConnectionPair* item = LookupConnection(endpoint_id); if (item != nullptr) { item->first.safe_to_disconnect_version = safe_to_disconnect_version; @@ -844,6 +960,15 @@ bool ClientProxy::IsSafeToDisconnectEnabled(absl::string_view endpoint_id) { .min_nc_version_supports_safe_to_disconnect); } +bool ClientProxy::IsAutoReconnectEnabled(absl::string_view endpoint_id) { + return IsSupportAutoReconnect() && + GetRemoteSafeToDisconnectVersion(endpoint_id).has_value() && + (GetRemoteSafeToDisconnectVersion(endpoint_id) >= + FeatureFlags::GetInstance() + .GetFlags() + .min_nc_version_supports_auto_reconnect); +} + bool ClientProxy::IsPayloadReceivedAckEnabled(absl::string_view endpoint_id) { return IsSupportSafeToDisconnect() && GetRemoteSafeToDisconnectVersion(endpoint_id).has_value() && @@ -853,7 +978,6 @@ bool ClientProxy::IsPayloadReceivedAckEnabled(absl::string_view endpoint_id) { .min_nc_version_supports_payload_received_ack); } - void ClientProxy::CancelAllEndpoints() { for (const auto& item : cancellation_flags_) { CancellationFlag* cancellation_flag = item.second.get(); @@ -902,11 +1026,10 @@ void ClientProxy::OnPayloadProgress(const std::string& endpoint_id, item->second.payload_progress_cb(endpoint_id, info); if (info.status == PayloadProgressInfo::Status::kInProgress) { - NEARBY_LOGS(VERBOSE) - << "ClientProxy [reporting onPayloadProgress]: client=" - << GetClientId() << "; endpoint_id=" << endpoint_id - << "; payload_id=" << info.payload_id - << ", payload_status=" << ToString(info.status); + NEARBY_VLOG(1) << "ClientProxy [reporting onPayloadProgress]: client=" + << GetClientId() << "; endpoint_id=" << endpoint_id + << "; payload_id=" << info.payload_id + << ", payload_status=" << ToString(info.status); } else { NEARBY_LOGS(INFO) << "ClientProxy [reporting onPayloadProgress]: client=" @@ -926,13 +1049,14 @@ void ClientProxy::RemoveAllEndpoints() { // just remove without notifying. connections_.clear(); cancellation_flags_.clear(); + bluetooth_mac_addresses_.clear(); OnSessionComplete(); } void ClientProxy::OnSessionComplete() { MutexLock lock(&mutex_); - if (connections_.empty() && !IsAdvertising() && !IsDiscovering()) { + if (connections_.empty() && !IsAdvertising()) { local_endpoint_id_.clear(); analytics_recorder_->LogSession(); @@ -984,16 +1108,40 @@ void ClientProxy::ExitHighVisibilityMode() { << GetClientId(); high_vis_mode_ = false; - ScheduleClearLocalHighVisModeCacheEndpointIdAlarm(); + ScheduleClearCachedEndpointIdAlarm(); } -void ClientProxy::ScheduleClearLocalHighVisModeCacheEndpointIdAlarm() { - CancelClearLocalHighVisModeCacheEndpointIdAlarm(); +void ClientProxy::EnterStableEndpointIdMode() { + MutexLock lock(&mutex_); + NEARBY_LOGS(INFO) << "ClientProxy [EnterStableEndpointIdMode]: client=" + << GetClientId(); - if (local_high_vis_mode_cache_endpoint_id_.empty()) { - NEARBY_LOGS(VERBOSE) << "ClientProxy [There is no cached local high power " - "advertising endpoint Id]: client=" - << GetClientId(); + stable_endpoint_id_mode_ = true; +} + +void ClientProxy::ExitStableEndpointIdMode() { + MutexLock lock(&mutex_); + NEARBY_LOGS(INFO) << "ClientProxy [ExitStableEndpointIdMode]: client=" + << GetClientId(); + + stable_endpoint_id_mode_ = false; + ScheduleClearCachedEndpointIdAlarm(); +} + +void ClientProxy::ScheduleClearCachedEndpointIdAlarm() { + CancelClearCachedEndpointIdAlarm(); + + if (cached_endpoint_id_.empty()) { + NEARBY_VLOG(1) << "ClientProxy [There is no cached local high power " + "advertising endpoint Id]: client=" + << GetClientId(); + return; + } + + if (IsFeatureUseStableEndpointIdEnabled() && HasOngoingConnection()) { + NEARBY_VLOG(1) << "ClientProxy [Handle clearing cached endpoint ID " + "during disconnection]: client=" + << GetClientId(); return; } @@ -1002,9 +1150,8 @@ void ClientProxy::ScheduleClearLocalHighVisModeCacheEndpointIdAlarm() { NEARBY_LOGS(INFO) << "ClientProxy [High Visibility Mode Adv, Schedule to " "Clear Cache EndpointId]: client=" << GetClientId() - << "; local_high_vis_mode_cache_endpoint_id_=" - << local_high_vis_mode_cache_endpoint_id_; - clear_local_high_vis_mode_cache_endpoint_id_alarm_ = + << "; cached_endpoint_id_=" << cached_endpoint_id_; + cached_endpoint_id_alarm_ = std::make_unique( "clear_high_power_endpoint_id_cache", [this]() { @@ -1012,19 +1159,18 @@ void ClientProxy::ScheduleClearLocalHighVisModeCacheEndpointIdAlarm() { NEARBY_LOGS(INFO) << "ClientProxy [Cleared cached local high power advertising " "endpoint Id.]: client=" - << GetClientId() << "; local_high_vis_mode_cache_endpoint_id_=" - << local_high_vis_mode_cache_endpoint_id_; - local_high_vis_mode_cache_endpoint_id_.clear(); + << GetClientId() + << "; cached_endpoint_id_=" << cached_endpoint_id_; + cached_endpoint_id_.clear(); }, kHighPowerAdvertisementEndpointIdCacheTimeout, &single_thread_executor_); } -void ClientProxy::CancelClearLocalHighVisModeCacheEndpointIdAlarm() { - if (clear_local_high_vis_mode_cache_endpoint_id_alarm_ && - clear_local_high_vis_mode_cache_endpoint_id_alarm_->IsValid()) { - clear_local_high_vis_mode_cache_endpoint_id_alarm_->Cancel(); - clear_local_high_vis_mode_cache_endpoint_id_alarm_.reset(); +void ClientProxy::CancelClearCachedEndpointIdAlarm() { + if (cached_endpoint_id_alarm_ && cached_endpoint_id_alarm_->IsValid()) { + cached_endpoint_id_alarm_->Cancel(); + cached_endpoint_id_alarm_.reset(); } } @@ -1043,6 +1189,80 @@ OsInfo::OsType ClientProxy::OSNameToOsInfoType(api::OSName osName) { } } +std::int32_t ClientProxy::GetLocalMultiplexSocketBitmask() const { + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableMultiplex)) { + NEARBY_LOGS(INFO) << "ClientProxy [GetLocalMultiplexSocketBitmask]: " + << kBtMultiplexEnabled; + return kBtMultiplexEnabled; + } + return 0; +} + +void ClientProxy::SetRemoteMultiplexSocketBitmask( + absl::string_view endpoint_id, int remote_multiplex_socket_bitmask) { + ConnectionPair* item = LookupConnection(endpoint_id); + if (item != nullptr) { + item->first.remote_multiplex_socket_bitmask = + remote_multiplex_socket_bitmask; + NEARBY_LOGS(INFO) << "ClientProxy [SetRemoteMultiplexSocketBitmask]: " + << remote_multiplex_socket_bitmask; + } +} + +bool ClientProxy::IsLocalMultiplexSocketSupported(Medium medium) { + int bitmask = GetLocalMultiplexSocketBitmask(); + switch (medium) { + case Medium::BLUETOOTH: + NEARBY_LOGS(INFO) << "ClientProxy [IsLocalMultiplexSocketSupported]: " + << (bitmask & kBtMultiplexEnabled); + return (bitmask & kBtMultiplexEnabled) != 0; + case Medium::WIFI_LAN: + return (bitmask & kWifiLanMultiplexEnabled) != 0; + default: + return false; + } +} + +std::optional ClientProxy::GetRemoteMultiplexSocketBitmask( + absl::string_view endpoint_id) const { + const ConnectionPair* item = LookupConnection(endpoint_id); + if (item != nullptr) { + return item->first.remote_multiplex_socket_bitmask; + } + return std::nullopt; +} + +bool ClientProxy::IsMultiplexSocketSupported(absl::string_view endpoint_id, + Medium medium) { + ConnectionPair* item = LookupConnection(endpoint_id); + if (item == nullptr) { + return false; + } + int combined_result = GetLocalMultiplexSocketBitmask() & + item->first.remote_multiplex_socket_bitmask; + + switch (medium) { + case Medium::BLUETOOTH: + return (combined_result & kBtMultiplexEnabled) != 0; + case Medium::WIFI_LAN: + return (combined_result & kWifiLanMultiplexEnabled) != 0; + default: + return false; + } +} + +bool ClientProxy::GetWebRtcNonCellular() { return webrtc_non_cellular_; } + +void ClientProxy::SetWebRtcNonCellular(bool webrtc_non_cellular) { + std::string allow_webrtc_cellular_str = + webrtc_non_cellular ? "disallow" : "allow"; + NEARBY_LOGS(INFO) << "ClientProxy: client=" << GetClientId() + << allow_webrtc_cellular_str << " to use mobile data.", + webrtc_non_cellular_ = webrtc_non_cellular; +} + std::string ClientProxy::ToString(PayloadProgressInfo::Status status) const { switch (status) { case PayloadProgressInfo::Status::kSuccess: diff --git a/connections/implementation/client_proxy.h b/connections/implementation/client_proxy.h index e39ae058..881c1605 100644 --- a/connections/implementation/client_proxy.h +++ b/connections/implementation/client_proxy.h @@ -23,11 +23,16 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" #include "connections/advertising_options.h" +#include "connections/connection_options.h" #include "connections/discovery_options.h" #include "connections/implementation/analytics/analytics_recorder.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" #include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/payload.h" #include "connections/status.h" #include "connections/strategy.h" #include "connections/v3/connection_listening_options.h" @@ -46,6 +51,8 @@ #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" #include "absl/types/span.h" +#include "internal/platform/os_name.h" +#include "internal/platform/scheduled_executor.h" namespace nearby { namespace connections { @@ -74,6 +81,10 @@ class ClientProxy final { } std::string GetConnectionToken(const std::string& endpoint_id); + std::optional GetBluetoothMacAddress( + const std::string& endpoint_id); + void SetBluetoothMacAddress(const std::string& endpoint_id, + const std::string& bluetooth_mac_address); const NearbyDevice* GetLocalDevice(); NearbyDeviceProvider* GetLocalDeviceProvider() { if (external_device_provider_ != nullptr) { @@ -110,7 +121,7 @@ class ClientProxy final { // Marks this client as discovering with the given callback. void StartedDiscovery( const std::string& service_id, Strategy strategy, - const DiscoveryListener& discovery_listener, + DiscoveryListener discovery_listener, absl::Span mediums, const DiscoveryOptions& discovery_options = DiscoveryOptions{}); // Marks this client as not discovering at all. @@ -184,10 +195,17 @@ class ClientProxy final { std::vector GetConnectedEndpoints() const; // Returns all endpoints that are still awaiting acceptance. std::vector GetPendingConnectedEndpoints() const; + // Returns true if there is at least one connected connection or one pending + // connection. + bool HasOngoingConnection() const; // Returns the number of endpoints that are connected and outgoing. std::int32_t GetNumOutgoingConnections() const; // Returns the number of endpoints that are connected and incoming. std::int32_t GetNumIncomingConnections() const; + // Returns true if endpoint is incoming connection. + bool IsIncomingConnection(const std::string& endpoint_id) const; + // Returns true if endpoint is outgoing connection. + bool IsOutgoingConnection(const std::string& endpoint_id) const; // If true, then we're in the process of approving (or rejecting) a // connection. No payloads should be sent until isConnectedToEndpoint() // returns true. @@ -249,6 +267,12 @@ class ClientProxy final { // rotates. void ExitHighVisibilityMode(); + // Enters stable endpoint ID mode. + void EnterStableEndpointIdMode(); + // Cleans up any modifications in stable endpoint ID mode. The endpoint id + // always rotates. + void ExitStableEndpointIdMode(); + std::string Dump(); const location::nearby::connections::OsInfo& GetLocalOsInfo() const; @@ -270,6 +294,9 @@ class ClientProxy final { const bool& IsSupportSafeToDisconnect() const { return supports_safe_to_disconnect_; } + + bool IsSupportAutoReconnect() const { return support_auto_reconnect_; } + const std::int32_t& GetLocalSafeToDisconnectVersion() const { return local_safe_to_disconnect_version_; } @@ -279,8 +306,41 @@ class ClientProxy final { absl::string_view endpoint_id, const std::int32_t& safe_to_disconnect_version); bool IsSafeToDisconnectEnabled(absl::string_view endpoint_id); + bool IsAutoReconnectEnabled(absl::string_view endpoint_id); bool IsPayloadReceivedAckEnabled(absl::string_view endpoint_id); + // Returns the multiplex socket supports status for local device. + std::int32_t GetLocalMultiplexSocketBitmask() const; + // Sets the multiplex socket supports status for remote device. + void SetRemoteMultiplexSocketBitmask(absl::string_view endpoint_id, + int remote_multiplex_socket_bitmask); + // Returns true if the multiplex socket is supported for the given medium. + bool IsLocalMultiplexSocketSupported(Medium medium); + + // Gets the multiplex socket supports status for remote device. + std::optional GetRemoteMultiplexSocketBitmask( + absl::string_view endpoint_id) const; + // Returns true if the multiplex socket is supported for the given medium. + bool IsMultiplexSocketSupported(absl::string_view endpoint_id, Medium medium); + + // Gets the WebRTC non cellular network status. + bool GetWebRtcNonCellular(); + + // Sets the WebRTC non cellular network status. + void SetWebRtcNonCellular(bool webrtc_non_cellular); + + /** Bitmask for bt multiplex connection support. */ + // Note. Deprecates the first and second bit of BT_MULTIPLEX_ENABLED and + // WIFI_LAN_MULTIPLEX_ENABLED and shift them to the third and the forth bit. + // The reason is we need to escape the (0, 1) bit which has been set in some + // devices without salt enabled. If accompany with the devices with salted + // enabled, the frames passed cannot be decrypted and the connection shall be + // failed. Please refer to b/295925531#comment#14 for the details. + enum MultiplexSocketBitmask : uint32_t { + kBtMultiplexEnabled = 1 << 2, + kWifiLanMultiplexEnabled = 1 << 3, + }; + private: struct Connection { // Status: may be either: @@ -311,6 +371,7 @@ class ClientProxy final { std::string connection_token; std::optional os_info; std::int32_t safe_to_disconnect_version; + std::int32_t remote_multiplex_socket_bitmask; }; using ConnectionPair = std::pair; @@ -356,8 +417,8 @@ class ClientProxy final { absl::AnyInvocable pred) const; std::string GenerateLocalEndpointId(); - void ScheduleClearLocalHighVisModeCacheEndpointIdAlarm(); - void CancelClearLocalHighVisModeCacheEndpointIdAlarm(); + void ScheduleClearCachedEndpointIdAlarm(); + void CancelClearCachedEndpointIdAlarm(); location::nearby::connections::OsInfo::OsType OSNameToOsInfoType( api::OSName osName); @@ -373,18 +434,17 @@ class ClientProxy final { // id is stable for 30s. When high_visibility_mode_ is false, the endpoint id // always rotates. bool high_vis_mode_ = false; - // Caches the endpoint id when it is in high visibility mode advertisement for - // 30s. Currently, Nearby Connections keeps rotating endpoint id. The client - // (Nearby Share) treats different endpoints as different receivers, duplicate - // share targets for same devices occur on share sheet in this case. - // Therefore, we remember the high visibility mode advertisement endpoint id - // here. empty if 1) There is no high power advertisement before 2) The - // endpoint id cached here in previous high visibility mode advertisement - // expires. - std::string local_high_vis_mode_cache_endpoint_id_; + + // If advertising is in stable endpoint ID mode, the endpoint ID is stable + // for 30s after advertising or disconnection. When stable_endpoint_id_mode_ + // is false, the endpoint id always rotates. + bool stable_endpoint_id_mode_ = false; + + // Caches the endpoint id for stable endpoint ID mode. + std::string cached_endpoint_id_; + ScheduledExecutor single_thread_executor_; - std::unique_ptr - clear_local_high_vis_mode_cache_endpoint_id_alarm_; + std::unique_ptr cached_endpoint_id_alarm_; // If not empty, we are currently advertising and accepting connection // requests for the given service_id. @@ -415,6 +475,9 @@ class ClientProxy final { // Maps endpoint_id to endpoint connection state. absl::flat_hash_map connections_; + // Maps endpoint_id to Bluetooth Mac Addresses. + absl::flat_hash_map bluetooth_mac_addresses_; + // A cache of endpoint ids that we've already notified the discoverer of. We // check this cache before calling onEndpointFound() so that we don't notify // the client multiple times for the same endpoint. This would otherwise @@ -443,7 +506,10 @@ class ClientProxy final { // For Nearby Connections' own device provider. std::unique_ptr connections_device_provider_; bool supports_safe_to_disconnect_; + bool support_auto_reconnect_; std::int32_t local_safe_to_disconnect_version_; + // Allowed to use WebRTC over non-cellular networks. + bool webrtc_non_cellular_ = false; }; } // namespace connections diff --git a/connections/implementation/client_proxy_test.cc b/connections/implementation/client_proxy_test.cc index 3d53bc87..7113806a 100644 --- a/connections/implementation/client_proxy_test.cc +++ b/connections/implementation/client_proxy_test.cc @@ -15,32 +15,45 @@ #include "connections/implementation/client_proxy.h" #include -#include #include #include #include #include #include +#include "base/casts.h" #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" -#include "absl/container/flat_hash_set.h" #include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "absl/types/span.h" +#include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/payload.h" +#include "connections/status.h" #include "connections/strategy.h" -#include "connections/v3/bandwidth_info.h" #include "connections/v3/connection_listening_options.h" +#include "connections/v3/connection_result.h" #include "connections/v3/connections_device_provider.h" -#include "internal/analytics/event_logger.h" +#include "connections/v3/listeners.h" +#include "internal/analytics/mock_event_logger.h" +#include "internal/flags/nearby_flags.h" +#include "internal/interop/device.h" #include "internal/interop/device_provider.h" #include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/feature_flags.h" #include "internal/platform/medium_environment.h" +#include "internal/platform/mutex.h" +#include "internal/platform/mutex_lock.h" #include "proto/connections_enums.pb.h" namespace nearby { @@ -64,15 +77,13 @@ constexpr FeatureFlags::Flags kTestCases[] = { }, }; -class FakeEventLogger : public ::nearby::analytics::EventLogger { +class FakeEventLogger : public ::nearby::analytics::MockEventLogger { public: explicit FakeEventLogger() = default; - void Log(const ::google::protobuf::MessageLite& message) override { - ConnectionsLog log; - log.CheckTypeAndMergeFrom(message); + void Log(const ConnectionsLog& message) override { MutexLock lock(&mutex_); - logs_.push_back(std::move(log)); + logs_.push_back(message); } int GetCompleteClientSessionCount() { @@ -149,17 +160,51 @@ class ClientProxyTest : public ::testing::TestWithParam { std::string id; }; + void SetUp() override { + EnvironmentConfig config{/*webrtc_enabled=*/false, + /*use_simulated_clock=*/true}; + env_.Start(config); + client1_ = std::make_unique(&event_logger1_); + client2_ = std::make_unique(&event_logger2_); + } + + void TearDown() override { + client1_.reset(); + client2_.reset(); + env_.Stop(); + NearbyFlags::GetInstance().ResetOverridedValues(); + } + bool ShouldEnterHighVisibilityMode( const AdvertisingOptions& advertising_options) { return !advertising_options.low_power && advertising_options.allowed.bluetooth; } + bool ShouldEnterStableEndpointIdMode( + const AdvertisingOptions& advertising_options) { + if (advertising_options.use_stable_endpoint_id) { + return true; + } else if (advertising_options.low_power) { + return false; + } else { + return true; + } + } + Endpoint StartAdvertising( ClientProxy* client, ConnectionListener listener, AdvertisingOptions advertising_options = AdvertisingOptions{}) { - if (ShouldEnterHighVisibilityMode(advertising_options)) { - client->EnterHighVisibilityMode(); + if (NearbyFlags::GetInstance().GetBoolFlag( + connections::config_package_nearby::nearby_connections_feature:: + kUseStableEndpointId)) { + if (ShouldEnterStableEndpointIdMode(advertising_options)) { + client->EnterStableEndpointIdMode(); + } + } else { + if (ShouldEnterHighVisibilityMode(advertising_options)) { + client->EnterHighVisibilityMode(); + } } Endpoint endpoint{ .info = ByteArray{"advertising endpoint name"}, @@ -210,7 +255,7 @@ class ClientProxyTest : public ::testing::TestWithParam { .info = ByteArray{"discovery endpoint name"}, .id = client->GetLocalEndpointId(), }; - client->StartedDiscovery(service_id_, strategy_, listener, + client->StartedDiscovery(service_id_, strategy_, std::move(listener), absl::MakeSpan(mediums_)); return endpoint; } @@ -321,6 +366,26 @@ class ClientProxyTest : public ::testing::TestWithParam { client->OnPayloadProgress(endpoint.id, {}); } + void EnableUseStableEndpointIdFeature() { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + connections::config_package_nearby::nearby_connections_feature:: + kUseStableEndpointId, + true); + } + + ClientProxy* client1() { return client1_.get(); } + + ClientProxy* client2() { return client2_.get(); } + + void FastForward(absl::Duration duration) { + (*env_.GetSimulatedClock()) + ->FastForward( + ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + + absl::Milliseconds(100)); + // make sure the timer based callback is executed. + absl::SleepFor(absl::Milliseconds(100)); + } + MockConnectionListener mock_advertising_connection_; MockDiscoveryListener mock_discovery_; @@ -332,12 +397,14 @@ class ClientProxyTest : public ::testing::TestWithParam { std::vector mediums_{ location::nearby::proto::connections::Medium::BLUETOOTH, }; + + MediumEnvironment& env_ = MediumEnvironment::Instance(); Strategy strategy_{Strategy::kP2pPointToPoint}; const std::string service_id_{"service"}; FakeEventLogger event_logger1_; FakeEventLogger event_logger2_; - ClientProxy client1_{&event_logger1_}; - ClientProxy client2_{&event_logger2_}; + std::unique_ptr client1_; + std::unique_ptr client2_; std::string auth_token_ = "auth_token"; ByteArray raw_auth_token_ = ByteArray(auth_token_); ByteArray payload_bytes_{"bytes"}; @@ -363,10 +430,12 @@ class ClientProxyTest : public ::testing::TestWithParam { .bandwidth_changed_cb = mock_discovery_connection_.bandwidth_changed_cb.AsStdFunction(), }; - DiscoveryListener discovery_listener_{ - .endpoint_found_cb = mock_discovery_.endpoint_found_cb.AsStdFunction(), - .endpoint_lost_cb = mock_discovery_.endpoint_lost_cb.AsStdFunction(), - }; + DiscoveryListener GetDiscoveryListener() { + return DiscoveryListener{ + .endpoint_found_cb = mock_discovery_.endpoint_found_cb.AsStdFunction(), + .endpoint_lost_cb = mock_discovery_.endpoint_lost_cb.AsStdFunction(), + }; + } ConnectionOptions connection_options_; AdvertisingOptions advertising_options_; DiscoveryOptions discovery_options_; @@ -378,32 +447,32 @@ TEST_P(ClientProxyTest, CanCancelEndpoint) { MediumEnvironment::Instance().SetFeatureFlags(feature_flags); Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); // `CancellationFlag` pointers are passed to other classes in Nearby // Connections, and by using the pointers directly, we test their // consumption of `CancellationFlag` pointers. CancellationFlag* cancellation_flag = - client2_.GetCancellationFlag(advertising_endpoint.id); + client2()->GetCancellationFlag(advertising_endpoint.id); EXPECT_FALSE( - client2_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client2()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); EXPECT_FALSE(cancellation_flag->Cancelled()); - client2_.CancelEndpoint(advertising_endpoint.id); + client2()->CancelEndpoint(advertising_endpoint.id); // If FeatureFlag is disabled, Cancelled is false as no-op. if (!feature_flags.enable_cancellation_flag) { EXPECT_FALSE( - client2_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client2()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); EXPECT_FALSE(cancellation_flag->Cancelled()); } else { // The Cancelled is always true as the default flag being returned. EXPECT_TRUE( - client2_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client2()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); EXPECT_TRUE(cancellation_flag->Cancelled()); } } @@ -414,32 +483,32 @@ TEST_P(ClientProxyTest, CanCancelAllEndpoints) { MediumEnvironment::Instance().SetFeatureFlags(feature_flags); Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); // `CancellationFlag` pointers are passed to other classes in Nearby // Connections, and by using the pointers directly, we test their // consumption of `CancellationFlag` pointers. CancellationFlag* cancellation_flag = - client2_.GetCancellationFlag(advertising_endpoint.id); + client2()->GetCancellationFlag(advertising_endpoint.id); EXPECT_FALSE( - client2_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client2()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); EXPECT_FALSE(cancellation_flag->Cancelled()); - client2_.CancelAllEndpoints(); + client2()->CancelAllEndpoints(); // If FeatureFlag is disabled, Cancelled is false as no-op. if (!feature_flags.enable_cancellation_flag) { EXPECT_FALSE( - client2_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client2()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); EXPECT_FALSE(cancellation_flag->Cancelled()); } else { // The Cancelled is always true as the default flag being returned. EXPECT_TRUE( - client2_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client2()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); EXPECT_TRUE(cancellation_flag->Cancelled()); } } @@ -452,40 +521,40 @@ TEST_P(ClientProxyTest, CanCancelAllEndpointsWithDifferentEndpoint) { ConnectionListener advertising_connection_listener_3; ClientProxy client3; - StartDiscovery(&client1_, discovery_listener_); + StartDiscovery(client1(), GetDiscoveryListener()); Endpoint advertising_endpoint_2 = - StartAdvertising(&client2_, advertising_connection_listener_2); + StartAdvertising(client2(), advertising_connection_listener_2); Endpoint advertising_endpoint_3 = StartAdvertising(&client3, advertising_connection_listener_3); - OnDiscoveryEndpointFound(&client1_, advertising_endpoint_2); - OnDiscoveryConnectionInitiated(&client1_, advertising_endpoint_2); - OnDiscoveryEndpointFound(&client1_, advertising_endpoint_3); - OnDiscoveryConnectionInitiated(&client1_, advertising_endpoint_3); + OnDiscoveryEndpointFound(client1(), advertising_endpoint_2); + OnDiscoveryConnectionInitiated(client1(), advertising_endpoint_2); + OnDiscoveryEndpointFound(client1(), advertising_endpoint_3); + OnDiscoveryConnectionInitiated(client1(), advertising_endpoint_3); // The CancellationFlag of endpoint_2 and endpoint_3 have been added. Default // Cancelled is false. EXPECT_FALSE( - client1_.GetCancellationFlag(advertising_endpoint_2.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint_2.id)->Cancelled()); EXPECT_FALSE( - client1_.GetCancellationFlag(advertising_endpoint_3.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint_3.id)->Cancelled()); - client1_.CancelAllEndpoints(); + client1()->CancelAllEndpoints(); if (!feature_flags.enable_cancellation_flag) { // The CancellationFlag of endpoint_2 and endpoint_3 will not be removed // since it is not added. The default flag returned as Cancelled being true, // but Cancelled requested is false since the FeatureFlag is off. EXPECT_FALSE( - client1_.GetCancellationFlag(advertising_endpoint_2.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint_2.id)->Cancelled()); EXPECT_FALSE( - client1_.GetCancellationFlag(advertising_endpoint_3.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint_3.id)->Cancelled()); } else { // Expect the CancellationFlag of endpoint_2 and endpoint_3 has been // removed. The Cancelled is always true as the default flag being returned. EXPECT_TRUE( - client1_.GetCancellationFlag(advertising_endpoint_2.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint_2.id)->Cancelled()); EXPECT_TRUE( - client1_.GetCancellationFlag(advertising_endpoint_3.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint_3.id)->Cancelled()); } } @@ -495,7 +564,7 @@ INSTANTIATE_TEST_SUITE_P(ParametrisedClientProxyTest, ClientProxyTest, TEST_F(ClientProxyTest, ConstructorDestructorWorks) { SUCCEED(); } TEST_F(ClientProxyTest, ClientIdIsUnique) { - EXPECT_NE(client1_.GetClientId(), client2_.GetClientId()); + EXPECT_NE(client1()->GetClientId(), client2()->GetClientId()); } TEST_F(ClientProxyTest, DumpString) { @@ -510,153 +579,153 @@ TEST_F(ClientProxyTest, DumpString) { " Discovery Service ID: \n" " Connections: \n" " Discovered endpoint IDs: \n", - client1_.GetClientId(), client1_.GetLocalEndpointId()); - std::string dump = client1_.Dump(); + client1()->GetClientId(), client1()->GetLocalEndpointId()); + std::string dump = client1()->Dump(); EXPECT_EQ(dump, expect); } TEST_F(ClientProxyTest, GeneratedEndpointIdIsUnique) { - EXPECT_NE(client1_.GetLocalEndpointId(), client2_.GetLocalEndpointId()); + EXPECT_NE(client1()->GetLocalEndpointId(), client2()->GetLocalEndpointId()); } TEST_F(ClientProxyTest, GeneratedEndpointIdIsUniqueWithDeviceProvider) { - client1_.RegisterConnectionsDeviceProvider( + client1()->RegisterConnectionsDeviceProvider( std::make_unique( v3::ConnectionsDeviceProvider("", {}))); - client2_.RegisterConnectionsDeviceProvider( + client2()->RegisterConnectionsDeviceProvider( std::make_unique( v3::ConnectionsDeviceProvider("", {}))); - EXPECT_NE(client1_.GetLocalEndpointId(), client2_.GetLocalEndpointId()); + EXPECT_NE(client1()->GetLocalEndpointId(), client2()->GetLocalEndpointId()); } TEST_F(ClientProxyTest, ResetClearsState) { - client1_.Reset(); - EXPECT_FALSE(client1_.IsAdvertising()); - EXPECT_FALSE(client1_.IsDiscovering()); - EXPECT_TRUE(client1_.GetAdvertisingServiceId().empty()); - EXPECT_TRUE(client1_.GetDiscoveryServiceId().empty()); + client1()->Reset(); + EXPECT_FALSE(client1()->IsAdvertising()); + EXPECT_FALSE(client1()->IsDiscovering()); + EXPECT_TRUE(client1()->GetAdvertisingServiceId().empty()); + EXPECT_TRUE(client1()->GetDiscoveryServiceId().empty()); } TEST_F(ClientProxyTest, StartedAdvertisingChangesStateFromIdle) { - client1_.StartedAdvertising(service_id_, strategy_, {}, {}); + client1()->StartedAdvertising(service_id_, strategy_, {}, {}); - EXPECT_TRUE(client1_.IsAdvertising()); - EXPECT_FALSE(client1_.IsDiscovering()); - EXPECT_EQ(client1_.GetAdvertisingServiceId(), service_id_); - EXPECT_TRUE(client1_.GetDiscoveryServiceId().empty()); + EXPECT_TRUE(client1()->IsAdvertising()); + EXPECT_FALSE(client1()->IsDiscovering()); + EXPECT_EQ(client1()->GetAdvertisingServiceId(), service_id_); + EXPECT_TRUE(client1()->GetDiscoveryServiceId().empty()); } TEST_F(ClientProxyTest, StartedDiscoveryChangesStateFromIdle) { - client1_.StartedDiscovery(service_id_, strategy_, {}, {}); + client1()->StartedDiscovery(service_id_, strategy_, {}, {}); - EXPECT_FALSE(client1_.IsAdvertising()); - EXPECT_TRUE(client1_.IsDiscovering()); - EXPECT_TRUE(client1_.GetAdvertisingServiceId().empty()); - EXPECT_EQ(client1_.GetDiscoveryServiceId(), service_id_); + EXPECT_FALSE(client1()->IsAdvertising()); + EXPECT_TRUE(client1()->IsDiscovering()); + EXPECT_TRUE(client1()->GetAdvertisingServiceId().empty()); + EXPECT_EQ(client1()->GetDiscoveryServiceId(), service_id_); } TEST_F(ClientProxyTest, OnEndpointFoundFiresNotificationInDiscovery) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, OnEndpointLostFiresNotificationInDiscovery) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryEndpointLost(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryEndpointLost(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, OnConnectionInitiatedFiresNotificationInDiscovery) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, OnBandwidthChangedFiresNotificationInDiscovery) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionLocalAccepted(&client2_, advertising_endpoint); - OnDiscoveryConnectionRemoteAccepted(&client2_, advertising_endpoint); - OnDiscoveryConnectionAccepted(&client2_, advertising_endpoint); - OnDiscoveryBandwidthChanged(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionLocalAccepted(client2(), advertising_endpoint); + OnDiscoveryConnectionRemoteAccepted(client2(), advertising_endpoint); + OnDiscoveryConnectionAccepted(client2(), advertising_endpoint); + OnDiscoveryBandwidthChanged(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, OnDisconnectedFiresNotificationInDiscovery) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionDisconnected(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionDisconnected(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, LocalEndpointAcceptedConnectionChangesState) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionLocalAccepted(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionLocalAccepted(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, LocalEndpointRejectedConnectionChangesState) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionLocalRejected(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionLocalRejected(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, RemoteEndpointAcceptedConnectionChangesState) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionRemoteAccepted(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionRemoteAccepted(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, RemoteEndpointRejectedConnectionChangesState) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionRemoteRejected(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionRemoteRejected(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, OnPayloadChangesState) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionLocalAccepted(&client2_, advertising_endpoint); - OnDiscoveryConnectionRemoteAccepted(&client2_, advertising_endpoint); - OnDiscoveryConnectionAccepted(&client2_, advertising_endpoint); - OnPayload(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionLocalAccepted(client2(), advertising_endpoint); + OnDiscoveryConnectionRemoteAccepted(client2(), advertising_endpoint); + OnDiscoveryConnectionAccepted(client2(), advertising_endpoint); + OnPayload(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, OnPayloadProgressChangesState) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); - OnDiscoveryConnectionLocalAccepted(&client2_, advertising_endpoint); - OnDiscoveryConnectionRemoteAccepted(&client2_, advertising_endpoint); - OnDiscoveryConnectionAccepted(&client2_, advertising_endpoint); - OnPayloadProgress(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); + OnDiscoveryConnectionLocalAccepted(client2(), advertising_endpoint); + OnDiscoveryConnectionRemoteAccepted(client2(), advertising_endpoint); + OnDiscoveryConnectionAccepted(client2(), advertising_endpoint); + OnPayloadProgress(client2(), advertising_endpoint); } TEST_F(ClientProxyTest, @@ -675,13 +744,13 @@ TEST_F(ClientProxyTest, }; Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); - StopAdvertising(&client1_); + StopAdvertising(client1()); // Advertise immediately. Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); } @@ -702,15 +771,16 @@ TEST_F(ClientProxyTest, }; Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); - StopAdvertising(&client1_); + StopAdvertising(client1()); // Wait to expire and then advertise. - absl::SleepFor(ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + - absl::Milliseconds(100)); + FastForward(ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + + absl::Milliseconds(100)); + Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } @@ -730,10 +800,10 @@ TEST_F(ClientProxyTest, false, // low_power }; Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_, + StartAdvertising(client1(), advertising_connection_listener_, high_viz_advertising_options); - StopAdvertising(&client1_); + StopAdvertising(client1()); AdvertisingOptions low_viz_advertising_options{ { @@ -746,7 +816,273 @@ TEST_F(ClientProxyTest, }; Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, low_viz_advertising_options); + client1(), advertising_connection_listener_, low_viz_advertising_options); + + EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F(ClientProxyTest, + RotateWhenLowVizAdvertisementAfterHighVizAndStableAdvertisement) { + EnableUseStableEndpointIdFeature(); + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions high_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + Endpoint advertising_endpoint_1 = + StartAdvertising(client1(), advertising_connection_listener_, + high_viz_advertising_options); + + StopAdvertising(client1()); + + AdvertisingOptions low_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + }; + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, low_viz_advertising_options); + + EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F( + ClientProxyTest, + NoRotateWhenLowVizStableAdvertisementAfterHighVizAndStableAdvertisement) { + EnableUseStableEndpointIdFeature(); + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions high_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + Endpoint advertising_endpoint_1 = + StartAdvertising(client1(), advertising_connection_listener_, + high_viz_advertising_options); + + StopAdvertising(client1()); + + AdvertisingOptions low_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, low_viz_advertising_options); + + EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F( + ClientProxyTest, + NoRotateWhenAdvertisementHasConnectionAfterStableAdvertisementForAWhile) { + EnableUseStableEndpointIdFeature(); + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions high_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + Endpoint advertising_endpoint_1 = + StartAdvertising(client1(), advertising_connection_listener_, + high_viz_advertising_options); + + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint_1); + StopAdvertising(client1()); + + // Client should use cached endpoint id when having connection. + EXPECT_EQ(client1()->GetLocalEndpointId(), advertising_endpoint_1.id); + + // Wait to expire and then advertise. + FastForward(ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + + absl::Milliseconds(100)); + + AdvertisingOptions low_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + }; + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, low_viz_advertising_options); + + EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F(ClientProxyTest, RotateWhenLowVizAdvertisementAfterDisconnection) { + EnableUseStableEndpointIdFeature(); + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions high_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + Endpoint advertising_endpoint_1 = + StartAdvertising(client1(), advertising_connection_listener_, + high_viz_advertising_options); + + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint_1); + StopAdvertising(client1()); + FastForward(absl::Seconds(2)); + client1()->OnDisconnected(advertising_endpoint_1.id, true); + + AdvertisingOptions low_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + }; + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, low_viz_advertising_options); + + EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F(ClientProxyTest, + NoRotateWhenLowVizAndStableAdvertisementAfterDisconnection) { + EnableUseStableEndpointIdFeature(); + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions high_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + Endpoint advertising_endpoint_1 = + StartAdvertising(client1(), advertising_connection_listener_, + high_viz_advertising_options); + + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint_1); + StopAdvertising(client1()); + FastForward(absl::Seconds(2)); + client1()->OnDisconnected(advertising_endpoint_1.id, true); + + AdvertisingOptions low_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, low_viz_advertising_options); + + EXPECT_EQ(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F(ClientProxyTest, RotateWhenAdvertisementAfterDisconnectionForAWhile) { + EnableUseStableEndpointIdFeature(); + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions high_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + + Endpoint advertising_endpoint_1 = + StartAdvertising(client1(), advertising_connection_listener_, + high_viz_advertising_options); + + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint_1); + StopAdvertising(client1()); + client1()->OnDisconnected(advertising_endpoint_1.id, true); + + // Wait to expire and then advertise. + FastForward(ClientProxy::kHighPowerAdvertisementEndpointIdCacheTimeout + + absl::Milliseconds(100)); + AdvertisingOptions low_viz_advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + true, // low_power + }; + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, low_viz_advertising_options); EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } @@ -767,13 +1103,43 @@ TEST_F(ClientProxyTest, EndpointIdRotateWhenStartDiscovery) { }; Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); - StopAdvertising(&client1_); - StartDiscovery(&client1_, discovery_listener_); + StopAdvertising(client1()); + StartDiscovery(client1(), GetDiscoveryListener()); Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); + + EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); +} + +TEST_F(ClientProxyTest, + EndpointIdRotateWhenStartDiscoveryAfterStableAdvertising) { + BooleanMediumSelector booleanMediumSelector; + booleanMediumSelector.bluetooth = true; + + AdvertisingOptions advertising_options{ + { + strategy_, + booleanMediumSelector, + }, + false, // auto_upgrade_bandwidth + false, // enforce_topology_constraints + false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id + }; + + Endpoint advertising_endpoint_1 = StartAdvertising( + client1(), advertising_connection_listener_, advertising_options); + + StopAdvertising(client1()); + StartDiscovery(client1(), GetDiscoveryListener()); + + Endpoint advertising_endpoint_2 = StartAdvertising( + client1(), advertising_connection_listener_, advertising_options); EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } @@ -792,15 +1158,18 @@ TEST_F(ClientProxyTest, false, // auto_upgrade_bandwidth false, // enforce_topology_constraints false, // low_power + true, // enable_bluetooth_listening + false, // enable_webrtc_listening + true, // use_stable_endpoint_id }; Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); - StopAdvertising(&client1_); + StopAdvertising(client1()); Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } @@ -820,137 +1189,137 @@ TEST_F(ClientProxyTest, EndpointIdRotateWhenLowVizAdvertisementWithLowPower) { true, // low_power }; Endpoint advertising_endpoint_1 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); - StopAdvertising(&client1_); + StopAdvertising(client1()); Endpoint advertising_endpoint_2 = StartAdvertising( - &client1_, advertising_connection_listener_, advertising_options); + client1(), advertising_connection_listener_, advertising_options); EXPECT_NE(advertising_endpoint_1.id, advertising_endpoint_2.id); } TEST_F(ClientProxyTest, NotLogSessionForStoppedAdvertisingWithConnection) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - OnAdvertisingConnectionInitiated(&client1_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); // Before - EXPECT_TRUE(client1_.HasPendingConnectionToEndpoint( - advertising_endpoint.id)); // Connections are available - EXPECT_FALSE(client1_.IsDiscovering()); // No Discovery - EXPECT_TRUE(client1_.IsAdvertising()); // Advertising + EXPECT_TRUE(client1()->HasPendingConnectionToEndpoint( + advertising_endpoint.id)); // Connections are available + EXPECT_FALSE(client1()->IsDiscovering()); // No Discovery + EXPECT_TRUE(client1()->IsAdvertising()); // Advertising // After - StopAdvertising(&client1_); // No Advertising - client1_.GetAnalyticsRecorder().Sync(); + StopAdvertising(client1()); // No Advertising + client1()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger1_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, LogSessionForStoppedAdvertisingWhenNoConnectionsAndNoDiscovering) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); // Before - EXPECT_FALSE(client1_.HasPendingConnectionToEndpoint( - advertising_endpoint.id)); // No Connections - EXPECT_FALSE(client1_.IsDiscovering()); // No Discovery - EXPECT_TRUE(client1_.IsAdvertising()); // Advertising - client1_.GetAnalyticsRecorder().Sync(); + EXPECT_FALSE(client1()->HasPendingConnectionToEndpoint( + advertising_endpoint.id)); // No Connections + EXPECT_FALSE(client1()->IsDiscovering()); // No Discovery + EXPECT_TRUE(client1()->IsAdvertising()); // Advertising + client1()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger1_.GetCompleteClientSessionCount(), 0); // After - StopAdvertising(&client1_); - client1_.GetAnalyticsRecorder().Sync(); + StopAdvertising(client1()); + client1()->GetAnalyticsRecorder().Sync(); EXPECT_GT(event_logger1_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, NotLogSessionForStoppedDiscoveryWithConnection) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); // Before OnDiscoveryConnectionInitiated( - &client2_, advertising_endpoint); // Connections are available - EXPECT_FALSE(client2_.IsAdvertising()); // No Advertising - EXPECT_TRUE(client2_.IsDiscovering()); // Discovering + client2(), advertising_endpoint); // Connections are available + EXPECT_FALSE(client2()->IsAdvertising()); // No Advertising + EXPECT_TRUE(client2()->IsDiscovering()); // Discovering // After - StopDiscovery(&client2_); - client2_.GetAnalyticsRecorder().Sync(); + StopDiscovery(client2()); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger2_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, NotLogSessionForStoppedDiscoveryWithoutConnectionsAndAdvertising) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); // Before - EXPECT_FALSE(client2_.IsAdvertising()); // No Advertising - EXPECT_TRUE(client2_.IsDiscovering()); // Discoverying - EXPECT_FALSE(client2_.HasPendingConnectionToEndpoint( + EXPECT_FALSE(client2()->IsAdvertising()); // No Advertising + EXPECT_TRUE(client2()->IsDiscovering()); // Discovering + EXPECT_FALSE(client2()->HasPendingConnectionToEndpoint( advertising_endpoint.id)); // No Connections // After - StopDiscovery(&client2_); - client2_.GetAnalyticsRecorder().Sync(); + StopDiscovery(client2()); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_GT(event_logger2_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, LogSessionOnDisconnectedWithOneConnection) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); // Before - EXPECT_FALSE(client2_.IsAdvertising()); // No Advertising - StopDiscovery(&client2_); // No Discovery - EXPECT_TRUE(client2_.HasPendingConnectionToEndpoint( + EXPECT_FALSE(client2()->IsAdvertising()); // No Advertising + StopDiscovery(client2()); // No Discovery + EXPECT_TRUE(client2()->HasPendingConnectionToEndpoint( advertising_endpoint.id)); // One Connection // After - OnDiscoveryConnectionDisconnected(&client2_, advertising_endpoint); - client2_.GetAnalyticsRecorder().Sync(); + OnDiscoveryConnectionDisconnected(client2(), advertising_endpoint); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_GT(event_logger2_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, NotLogSessionOnDisconnectedWithoutConnectionsDiscoveringAdvertising) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); // Before - EXPECT_FALSE(client2_.IsAdvertising()); // No Advertising - EXPECT_FALSE(client2_.IsDiscovering()); // No Discovery - EXPECT_FALSE(client2_.HasPendingConnectionToEndpoint( + EXPECT_FALSE(client2()->IsAdvertising()); // No Advertising + EXPECT_FALSE(client2()->IsDiscovering()); // No Discovery + EXPECT_FALSE(client2()->HasPendingConnectionToEndpoint( advertising_endpoint.id)); // No Connections // After - client2_.OnDisconnected(advertising_endpoint.id, /*notify=*/false); - client2_.GetAnalyticsRecorder().Sync(); + client2()->OnDisconnected(advertising_endpoint.id, /*notify=*/false); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger2_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, NotLogSessionOnDisconnectedWhenMoreThanOneConnection) { ClientProxy client3; Endpoint advertising_endpoint_1 = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); Endpoint advertising_endpoint_2 = - StartAdvertising(&client2_, advertising_connection_listener_); - StartDiscovery(&client3, discovery_listener_); + StartAdvertising(client2(), advertising_connection_listener_); + StartDiscovery(&client3, GetDiscoveryListener()); OnDiscoveryEndpointFound(&client3, advertising_endpoint_1); OnDiscoveryConnectionInitiated(&client3, advertising_endpoint_1); @@ -967,49 +1336,51 @@ TEST_F(ClientProxyTest, NotLogSessionOnDisconnectedWhenMoreThanOneConnection) { StopDiscovery(&client3); // No Discovery // After - client2_.OnDisconnected(advertising_endpoint_1.id, /*notify=*/false); - client2_.GetAnalyticsRecorder().Sync(); + client2()->OnDisconnected(advertising_endpoint_1.id, /*notify=*/false); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger2_.GetCompleteClientSessionCount(), 0); } TEST_F(ClientProxyTest, NotLogSessionOnDisconnectedForDiscoveringWithOnlyOneConnection) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); // Before - EXPECT_FALSE(client2_.IsAdvertising()); // No Advertising - EXPECT_TRUE(client2_.IsDiscovering()); // Discovering - EXPECT_TRUE(client2_.HasPendingConnectionToEndpoint( + EXPECT_FALSE(client2()->IsAdvertising()); // No Advertising + EXPECT_TRUE(client2()->IsDiscovering()); // Discovering + EXPECT_TRUE(client2()->HasPendingConnectionToEndpoint( advertising_endpoint.id)); // One Connection // After - OnDiscoveryConnectionDisconnected(&client2_, advertising_endpoint); - client2_.GetAnalyticsRecorder().Sync(); - EXPECT_EQ(event_logger2_.GetCompleteClientSessionCount(), 0); + OnDiscoveryConnectionDisconnected(client2(), advertising_endpoint); + client2()->GetAnalyticsRecorder().Sync(); + // Since we are no longer checking IsDiscovering(), we complete sessions now + // solely based on advertising. + EXPECT_EQ(event_logger2_.GetCompleteClientSessionCount(), 1); } TEST_F(ClientProxyTest, LogSessionForResetClientProxy) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - StartDiscovery(&client2_, discovery_listener_); - OnDiscoveryEndpointFound(&client2_, advertising_endpoint); - OnDiscoveryConnectionInitiated(&client2_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + StartDiscovery(client2(), GetDiscoveryListener()); + OnDiscoveryEndpointFound(client2(), advertising_endpoint); + OnDiscoveryConnectionInitiated(client2(), advertising_endpoint); - client1_.GetAnalyticsRecorder().Sync(); + client1()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger1_.GetCompleteClientSessionCount(), 0); - client1_.Reset(); - client1_.GetAnalyticsRecorder().Sync(); + client1()->Reset(); + client1()->GetAnalyticsRecorder().Sync(); // TODO(b/290936886): Why are there more than one complete sessions? EXPECT_GT(event_logger1_.GetCompleteClientSessionCount(), 0); - client2_.GetAnalyticsRecorder().Sync(); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_EQ(event_logger2_.GetCompleteClientSessionCount(), 0); - client2_.Reset(); - client2_.GetAnalyticsRecorder().Sync(); + client2()->Reset(); + client2()->GetAnalyticsRecorder().Sync(); EXPECT_GT(event_logger2_.GetCompleteClientSessionCount(), 0); } @@ -1021,31 +1392,32 @@ TEST_F(ClientProxyTest, GetLocalInfoCorrect) { TEST_F(ClientProxyTest, GetRemoteInfoNullWithoutConnections) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); - EXPECT_FALSE(client1_.GetRemoteOsInfo(advertising_endpoint.id).has_value()); - EXPECT_FALSE( - client1_.GetRemoteSafeToDisconnectVersion(advertising_endpoint.id) - .has_value()); + EXPECT_FALSE(client1()->GetRemoteOsInfo(advertising_endpoint.id).has_value()); + EXPECT_FALSE(client1() + ->GetRemoteSafeToDisconnectVersion(advertising_endpoint.id) + .has_value()); } TEST_F(ClientProxyTest, SetRemoteInfoCorrect) { Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); - OnAdvertisingConnectionInitiated(&client1_, advertising_endpoint); + StartAdvertising(client1(), advertising_connection_listener_); + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint); OsInfo os_info; os_info.set_type(OsInfo::ANDROID); std::int32_t nearby_connections_version = 2; - client1_.SetRemoteOsInfo(advertising_endpoint.id, os_info); - client1_.SetRemoteSafeToDisconnectVersion(advertising_endpoint.id, - nearby_connections_version); + client1()->SetRemoteOsInfo(advertising_endpoint.id, os_info); + client1()->SetRemoteSafeToDisconnectVersion(advertising_endpoint.id, + nearby_connections_version); - ASSERT_TRUE(client1_.GetRemoteOsInfo(advertising_endpoint.id).has_value()); - EXPECT_EQ(client1_.GetRemoteOsInfo(advertising_endpoint.id).value().type(), + ASSERT_TRUE(client1()->GetRemoteOsInfo(advertising_endpoint.id).has_value()); + EXPECT_EQ(client1()->GetRemoteOsInfo(advertising_endpoint.id).value().type(), OsInfo::ANDROID); - EXPECT_EQ(client1_.GetRemoteSafeToDisconnectVersion(advertising_endpoint.id), - nearby_connections_version); + EXPECT_EQ( + client1()->GetRemoteSafeToDisconnectVersion(advertising_endpoint.id), + nearby_connections_version); } // Test ClientProxy::AddCancellationFlag, where if a flag is already in the map, @@ -1061,50 +1433,50 @@ TEST_F(ClientProxyTest, UncancelCancellationFlags) { // Enable cancellation flags. MediumEnvironment::Instance().SetFeatureFlags(kTestCases[0]); Endpoint advertising_endpoint = - StartAdvertising(&client1_, advertising_connection_listener_); + StartAdvertising(client1(), advertising_connection_listener_); // Add a cancellation flag to the client proxy. - client1_.AddCancellationFlag(advertising_endpoint.id); - auto flag = client1_.GetCancellationFlag(advertising_endpoint.id); + client1()->AddCancellationFlag(advertising_endpoint.id); + auto flag = client1()->GetCancellationFlag(advertising_endpoint.id); EXPECT_FALSE(flag->Cancelled()); EXPECT_FALSE( - client1_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); // Cancel the flag. flag->Cancel(); EXPECT_TRUE(flag->Cancelled()); EXPECT_TRUE( - client1_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); // On subsequent calls to add a new cancellation flag, expect an the flag to // be uncancelled. - client1_.AddCancellationFlag(advertising_endpoint.id); - flag = client1_.GetCancellationFlag(advertising_endpoint.id); + client1()->AddCancellationFlag(advertising_endpoint.id); + flag = client1()->GetCancellationFlag(advertising_endpoint.id); EXPECT_FALSE(flag->Cancelled()); EXPECT_FALSE( - client1_.GetCancellationFlag(advertising_endpoint.id)->Cancelled()); + client1()->GetCancellationFlag(advertising_endpoint.id)->Cancelled()); } TEST_F(ClientProxyTest, GetLocalDeviceWorksWithoutDeviceProvider) { - auto device = client1_.GetLocalDevice(); + auto device = client1()->GetLocalDevice(); EXPECT_NE(device, nullptr); EXPECT_EQ(device->GetEndpointId().length(), 4); - EXPECT_NE(client1_.GetLocalDeviceProvider(), nullptr); + EXPECT_NE(client1()->GetLocalDeviceProvider(), nullptr); } TEST_F(ClientProxyTest, GetLocalDeviceWorksWithDeviceProvider) { MockDeviceProvider provider; - client1_.RegisterDeviceProvider(&provider); - ASSERT_NE(client1_.GetLocalDeviceProvider(), nullptr); + client1()->RegisterDeviceProvider(&provider); + ASSERT_NE(client1()->GetLocalDeviceProvider(), nullptr); EXPECT_CALL( - *(down_cast(client1_.GetLocalDeviceProvider())), + *(down_cast(client1()->GetLocalDeviceProvider())), GetLocalDevice); - client1_.GetLocalDevice(); + client1()->GetLocalDevice(); } TEST_F(ClientProxyTest, TestGetSetLocalEndpointInfo) { - client1_.UpdateLocalEndpointInfo("endpoint_info"); - EXPECT_EQ(client1_.GetLocalEndpointInfo(), "endpoint_info"); + client1()->UpdateLocalEndpointInfo("endpoint_info"); + EXPECT_EQ(client1()->GetLocalEndpointInfo(), "endpoint_info"); } TEST_F(ClientProxyTest, TestGetIncomingConnectionListener) { @@ -1112,7 +1484,7 @@ TEST_F(ClientProxyTest, TestGetIncomingConnectionListener) { CountDownLatch bwu_latch(1); CountDownLatch disconnect_latch(1); CountDownLatch init_latch(1); - client1_.StartedListeningForIncomingConnections( + client1()->StartedListeningForIncomingConnections( service_id_, Strategy::kP2pCluster, { .initiated_cb = @@ -1133,7 +1505,7 @@ TEST_F(ClientProxyTest, TestGetIncomingConnectionListener) { }, }, {}); - auto listener = client1_.GetAdvertisingOrIncomingConnectionListener(); + auto listener = client1()->GetAdvertisingOrIncomingConnectionListener(); listener.accepted_cb("endpoint-id"); listener.initiated_cb("endpoint-id", {.is_incoming_connection = false}); listener.disconnected_cb("endpoint-id"); @@ -1146,39 +1518,81 @@ TEST_F(ClientProxyTest, TestGetIncomingConnectionListener) { } TEST_F(ClientProxyTest, EnforceTopologyWhenRequestedAdvertising) { - EXPECT_FALSE(client1_.ShouldEnforceTopologyConstraints()); - StartAdvertising(&client1_, advertising_connection_listener_, + EXPECT_FALSE(client1()->ShouldEnforceTopologyConstraints()); + StartAdvertising(client1(), advertising_connection_listener_, {.enforce_topology_constraints = true}); - EXPECT_TRUE(client1_.ShouldEnforceTopologyConstraints()); + EXPECT_TRUE(client1()->ShouldEnforceTopologyConstraints()); } TEST_F(ClientProxyTest, EnforceTopologyWhenRequestedListeningWithStrategy) { - EXPECT_FALSE(client1_.ShouldEnforceTopologyConstraints()); - StartListeningForIncomingConnections(&client1_, {}, + EXPECT_FALSE(client1()->ShouldEnforceTopologyConstraints()); + StartListeningForIncomingConnections(client1(), {}, {.strategy = Strategy::kP2pCluster, .enforce_topology_constraints = true}); - EXPECT_TRUE(client1_.ShouldEnforceTopologyConstraints()); + EXPECT_TRUE(client1()->ShouldEnforceTopologyConstraints()); } TEST_F(ClientProxyTest, DontEnforceTopologyWhenRequestedWithNoStrategy) { - EXPECT_FALSE(client1_.ShouldEnforceTopologyConstraints()); - StartListeningForIncomingConnections(&client1_, {}, + EXPECT_FALSE(client1()->ShouldEnforceTopologyConstraints()); + StartListeningForIncomingConnections(client1(), {}, {.strategy = Strategy::kNone}); - EXPECT_TRUE(client1_.ShouldEnforceTopologyConstraints()); + EXPECT_TRUE(client1()->ShouldEnforceTopologyConstraints()); } TEST_F(ClientProxyTest, TestAutoBwuWhenAdvertisingWithAutoBwu) { - EXPECT_FALSE(client1_.AutoUpgradeBandwidth()); - StartAdvertising(&client1_, advertising_connection_listener_, + EXPECT_FALSE(client1()->AutoUpgradeBandwidth()); + StartAdvertising(client1(), advertising_connection_listener_, {.auto_upgrade_bandwidth = true}); - EXPECT_TRUE(client1_.AutoUpgradeBandwidth()); + EXPECT_TRUE(client1()->AutoUpgradeBandwidth()); } TEST_F(ClientProxyTest, TestAutoBwuWhenListeningWithAutoBwu) { - EXPECT_FALSE(client1_.AutoUpgradeBandwidth()); - StartListeningForIncomingConnections(&client1_, {}, + EXPECT_FALSE(client1()->AutoUpgradeBandwidth()); + StartListeningForIncomingConnections(client1(), {}, {.auto_upgrade_bandwidth = true}); - EXPECT_TRUE(client1_.AutoUpgradeBandwidth()); + EXPECT_TRUE(client1()->AutoUpgradeBandwidth()); +} + +TEST_F(ClientProxyTest, TestMultiplexSocketBitmask) { + EXPECT_EQ(client1()->GetLocalMultiplexSocketBitmask(), 0); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableMultiplex, + true); + EXPECT_EQ(client1()->GetLocalMultiplexSocketBitmask(), + ClientProxy::kBtMultiplexEnabled); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableMultiplex, + false); +} + +TEST_F(ClientProxyTest, TestRemoteMultiplexSocketBitmask) { + EXPECT_EQ(client1()->GetLocalMultiplexSocketBitmask(), 0); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableMultiplex, + true); + Endpoint advertising_endpoint = + StartAdvertising(client1(), advertising_connection_listener_); + OnAdvertisingConnectionInitiated(client1(), advertising_endpoint); + client1()->SetRemoteMultiplexSocketBitmask( + advertising_endpoint.id, + ClientProxy::kBtMultiplexEnabled | ClientProxy::kWifiLanMultiplexEnabled); + ASSERT_TRUE(client1() + ->GetRemoteMultiplexSocketBitmask(advertising_endpoint.id) + .has_value()); + EXPECT_EQ( + client1() + ->GetRemoteMultiplexSocketBitmask(advertising_endpoint.id) + .value(), + ClientProxy::kBtMultiplexEnabled | ClientProxy::kWifiLanMultiplexEnabled); + EXPECT_TRUE(client1()->IsMultiplexSocketSupported(advertising_endpoint.id, + Medium::BLUETOOTH)); + EXPECT_FALSE(client1()->IsMultiplexSocketSupported(advertising_endpoint.id, + Medium::WIFI_LAN)); + EXPECT_FALSE(client1()->IsMultiplexSocketSupported(advertising_endpoint.id, + Medium::WIFI_AWARE)); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableMultiplex, + false); } } // namespace diff --git a/connections/implementation/connections_authentication_transport_test.cc b/connections/implementation/connections_authentication_transport_test.cc index ef72c23e..fc5058da 100644 --- a/connections/implementation/connections_authentication_transport_test.cc +++ b/connections/implementation/connections_authentication_transport_test.cc @@ -21,6 +21,8 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/time/time.h" +#include "connections/implementation/analytics/analytics_recorder.h" #include "connections/implementation/endpoint_channel.h" #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" @@ -44,29 +46,34 @@ class MockEndpointChannel : public EndpointChannel { void, Close, (location::nearby::proto::connections::DisconnectionReason reason), (override)); - MOCK_METHOD(std::string, GetType, (), (const override)); - MOCK_METHOD(std::string, GetServiceId, (), (const override)); - MOCK_METHOD(std::string, GetName, (), (const override)); + MOCK_METHOD(void, Close, + (location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result), + (override)); + MOCK_METHOD(std::string, GetType, (), (const, override)); + MOCK_METHOD(std::string, GetServiceId, (), (const, override)); + MOCK_METHOD(std::string, GetName, (), (const, override)); MOCK_METHOD(location::nearby::proto::connections::Medium, GetMedium, (), - (const override)); + (const, override)); MOCK_METHOD(location::nearby::proto::connections::ConnectionTechnology, - GetTechnology, (), (const override)); + GetTechnology, (), (const, override)); MOCK_METHOD(location::nearby::proto::connections::ConnectionBand, GetBand, (), - (const override)); - MOCK_METHOD(int, GetFrequency, (), (const override)); - MOCK_METHOD(int, GetTryCount, (), (const override)); - MOCK_METHOD(int, GetMaxTransmitPacketSize, (), (const override)); + (const, override)); + MOCK_METHOD(int, GetFrequency, (), (const, override)); + MOCK_METHOD(int, GetTryCount, (), (const, override)); + MOCK_METHOD(int, GetMaxTransmitPacketSize, (), (const, override)); MOCK_METHOD(void, EnableEncryption, (std::shared_ptr), (override)); MOCK_METHOD(void, DisableEncryption, (), (override)); MOCK_METHOD(bool, IsEncrypted, (), (override)); MOCK_METHOD(ExceptionOr, TryDecrypt, (const ByteArray& data), (override)); - MOCK_METHOD(bool, IsPaused, (), (const override)); + MOCK_METHOD(bool, IsPaused, (), (const, override)); MOCK_METHOD(void, Pause, (), (override)); MOCK_METHOD(void, Resume, (), (override)); - MOCK_METHOD(absl::Time, GetLastReadTimestamp, (), (const override)); - MOCK_METHOD(absl::Time, GetLastWriteTimestamp, (), (const override)); + MOCK_METHOD(absl::Time, GetLastReadTimestamp, (), (const, override)); + MOCK_METHOD(absl::Time, GetLastWriteTimestamp, (), (const, override)); MOCK_METHOD(void, SetAnalyticsRecorder, (analytics::AnalyticsRecorder*, const std::string&), (override)); diff --git a/connections/implementation/encryption_runner_test.cc b/connections/implementation/encryption_runner_test.cc index 4dbd624e..5702c284 100644 --- a/connections/implementation/encryption_runner_test.cc +++ b/connections/implementation/encryption_runner_test.cc @@ -68,6 +68,12 @@ class FakeEndpointChannel : public EndpointChannel { override { Close(); } + void Close( + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result) override { + Close(); + } location::nearby::proto::connections::ConnectionTechnology GetTechnology() const override { return location::nearby::proto::connections::ConnectionTechnology:: diff --git a/connections/implementation/endpoint_channel.h b/connections/implementation/endpoint_channel.h index f0fc3e67..19d8b0f3 100644 --- a/connections/implementation/endpoint_channel.h +++ b/connections/implementation/endpoint_channel.h @@ -15,7 +15,6 @@ #ifndef CORE_INTERNAL_ENDPOINT_CHANNEL_H_ #define CORE_INTERNAL_ENDPOINT_CHANNEL_H_ -#include #include #include "securegcm/d2d_connection_context_v1.h" @@ -23,7 +22,6 @@ #include "connections/implementation/analytics/packet_meta_data.h" #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" -#include "internal/platform/mutex.h" namespace nearby { namespace connections { @@ -54,6 +52,13 @@ class EndpointChannel { virtual void Close( location::nearby::proto::connections::DisconnectionReason reason) = 0; + // Closes this EndpointChannel and records the closure with the given reason + // and safe disconnection result. + virtual void Close( + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result) = 0; + // Returns a one-word type descriptor for the concrete EndpointChannel // implementation that can be used in log messages; eg: BLUETOOTH, BLE, WIFI. virtual std::string GetType() const = 0; @@ -121,6 +126,9 @@ class EndpointChannel { virtual void SetAnalyticsRecorder( analytics::AnalyticsRecorder* analytics_recorder, const std::string& endpoint_id) = 0; + + // Enables the multiplex socket on the EndpointChannel. + virtual bool EnableMultiplexSocket() {return false;} }; inline bool operator==(const EndpointChannel& lhs, const EndpointChannel& rhs) { diff --git a/connections/implementation/endpoint_channel_manager.cc b/connections/implementation/endpoint_channel_manager.cc index cc3b5282..5ee27a48 100644 --- a/connections/implementation/endpoint_channel_manager.cc +++ b/connections/implementation/endpoint_channel_manager.cc @@ -19,9 +19,12 @@ #include #include "absl/time/time.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" #include "connections/implementation/offline_frames.h" #include "internal/platform/condition_variable.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/system_clock.h" #include "internal/platform/logging.h" #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" @@ -36,10 +39,10 @@ const absl::Duration kDataTransferDelay = absl::Milliseconds(500); } EndpointChannelManager::~EndpointChannelManager() { - NEARBY_LOG(INFO, "Initiating shutdown of EndpointChannelManager."); + LOG(INFO) << "Initiating shutdown of EndpointChannelManager."; MutexLock lock(&mutex_); channel_state_.DestroyAll(); - NEARBY_LOG(INFO, "EndpointChannelManager has shut down."); + LOG(INFO) << "EndpointChannelManager has shut down."; } void EndpointChannelManager::RegisterChannelForEndpoint( @@ -47,22 +50,30 @@ void EndpointChannelManager::RegisterChannelForEndpoint( std::unique_ptr channel) { MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << "EndpointChannelManager registered channel of type " + LOG(INFO) << "EndpointChannelManager registered channel of type " << channel->GetType() << " to endpoint " << endpoint_id; SetActiveEndpointChannel(client, endpoint_id, std::move(channel), true /* enable_encryption */); - NEARBY_LOG(INFO, "Registered channel: id=%s", endpoint_id.c_str()); + LOG(INFO) << "Registered channel: id=" << endpoint_id; } void EndpointChannelManager::ReplaceChannelForEndpoint( ClientProxy* client, const std::string& endpoint_id, std::unique_ptr channel, bool enable_encryption) { MutexLock lock(&mutex_); + if (client->IsSafeToDisconnectEnabled(endpoint_id) && + channel_state_.IsWaitingForSafeToDisconnectTimeout(endpoint_id)) { + LOG(WARNING) + << "EndpointChannelManager failed to replace endpoint " << endpoint_id + << "'s channel with type " << channel->GetType() + << " because the endpoint is waiting for active channel closure."; + return; + } auto* endpoint = channel_state_.LookupEndpointData(endpoint_id); if (endpoint != nullptr && endpoint->channel == nullptr) { - NEARBY_LOGS(INFO) << "EndpointChannelManager is missing channel while " + LOG(INFO) << "EndpointChannelManager is missing channel while " "trying to update: endpoint " << endpoint_id; } @@ -87,7 +98,7 @@ std::shared_ptr EndpointChannelManager::GetChannelForEndpoint( auto* endpoint = channel_state_.LookupEndpointData(endpoint_id); if (endpoint == nullptr) { - NEARBY_LOGS(INFO) << "No channel info for endpoint " << endpoint_id; + LOG(INFO) << "No channel info for endpoint " << endpoint_id; return {}; } @@ -135,8 +146,9 @@ void EndpointChannelManager::MarkEndpointStopWaitToDisconnect( } bool EndpointChannelManager::CreateNewTimeoutDisconnectedState( - const std::string& endpoint_id) { - return channel_state_.CreateNewTimeoutDisconnectedState(endpoint_id); + const std::string& endpoint_id, absl::Duration timeout_millis) { + return channel_state_.CreateNewTimeoutDisconnectedState(endpoint_id, + timeout_millis); } bool EndpointChannelManager::IsSafeToDisconnect( @@ -194,7 +206,7 @@ void EndpointChannelManager::ChannelState::UpdateEncryptionContextForEndpoint( void EndpointChannelManager::ChannelState::UpdateSafeToDisconnectForEndpoint( const std::string& endpoint_id, bool safe_to_disconnect_enabled) { - NEARBY_LOGS(INFO) << "[safe-to-disconnect] " + LOG(INFO) << "[safe-to-disconnect] " "UpdateSafeToDisconnectForEndpoint for: " << endpoint_id << " " << safe_to_disconnect_enabled; @@ -206,7 +218,7 @@ bool EndpointChannelManager::ChannelState::GetSafeToDisconnectForEndpoint( const std::string& endpoint_id) { auto item = endpoints_.find(endpoint_id); if (item == endpoints_.end()) return false; - NEARBY_LOGS(INFO) << "[safe-to-disconnect] GetSafeToDisconnectForEndpoint: " + LOG(INFO) << "[safe-to-disconnect] GetSafeToDisconnectForEndpoint: " << item->second.safe_to_disconnect_enabled; return item->second.safe_to_disconnect_enabled; } @@ -228,17 +240,18 @@ bool EndpointChannelManager::ChannelState::RemoveEndpoint( // we resume to ensure the thread won't hang when trying to write to it. channel->Resume(); - NEARBY_LOGS(INFO) << "[safe-to-disconnect] Sending DISCONNECTION frame" + LOG(INFO) << "[safe-to-disconnect] Sending DISCONNECTION frame" " with request 0, ack 0"; channel->Write( parser::ForDisconnection(/* request_safe_to_disconnect */ false, /* ack_safe_to_disconnect */ false)); - NEARBY_LOGS(INFO) + LOG(INFO) << "EndpointChannelManager reported the disconnection to endpoint " << endpoint_id; SystemClock::Sleep(kDataTransferDelay); } - NEARBY_LOGS(INFO) << "Remove Endpoint: " << endpoint_id; + + LOG(INFO) << "Remove Endpoint: " << endpoint_id; endpoints_.erase(item); return true; } @@ -248,7 +261,7 @@ bool EndpointChannelManager::ChannelState::isWifiLanConnected() const { auto channel = endpoint.second.channel; if (channel) { if (channel->GetMedium() == Medium::WIFI_LAN) { - NEARBY_LOGS(INFO) << "Found WIFI_LAN Medium for endpoint:" + LOG(INFO) << "Found WIFI_LAN Medium for endpoint:" << endpoint.first; return true; } @@ -263,7 +276,7 @@ void EndpointChannelManager::ChannelState::MarkEndpointStopWaitToDisconnect( bool notify_stop_waiting) { auto item = endpoints_.find(endpoint_id); if (item == endpoints_.end()) return; - NEARBY_LOGS(INFO) << "[safe-to-disconnect] is_safe_to_disconnect= " + LOG(INFO) << "[safe-to-disconnect] is_safe_to_disconnect= " << is_safe_to_disconnect << ", notify_stop_waiting= " << notify_stop_waiting << " for endpoint: " << endpoint_id; @@ -272,7 +285,7 @@ void EndpointChannelManager::ChannelState::MarkEndpointStopWaitToDisconnect( item->second.is_safe_to_disconnect = is_safe_to_disconnect; if (!item->second.timeout_to_disconnected_enabled) return; if (notify_stop_waiting) { - NEARBY_LOGS(INFO) << "[safe-to-disconnect] Notify stop " + LOG(INFO) << "[safe-to-disconnect] Notify stop " "waiting before timeout."; item->second.timeout_to_disconnected.Notify(); item->second.timeout_to_disconnected_notified = true; @@ -281,20 +294,18 @@ void EndpointChannelManager::ChannelState::MarkEndpointStopWaitToDisconnect( } bool EndpointChannelManager::ChannelState::CreateNewTimeoutDisconnectedState( - const std::string& endpoint_id) { + const std::string& endpoint_id, absl::Duration timeout_millis) { auto item = endpoints_.find(endpoint_id); if (item == endpoints_.end()) return false; - NEARBY_LOGS(INFO) << "[safe-to-disconnect] " + LOG(INFO) << "[safe-to-disconnect] " "Create TimeoutDisconnectedState for endpoint: " << endpoint_id; { MutexLock lock(&item->second.timeout_to_disconnected_mutex); item->second.timeout_to_disconnected_enabled = true; item->second.timeout_to_disconnected_notified = false; - item->second.timeout_to_disconnected.Wait(FeatureFlags::GetInstance() - .GetFlags() - .safe_to_disconnect_ack_delay_millis); - NEARBY_LOGS(INFO) << "[safe-to-disconnect] Wait is done with " + item->second.timeout_to_disconnected.Wait(timeout_millis); + LOG(INFO) << "[safe-to-disconnect] Wait is done with " << (item->second.timeout_to_disconnected_notified ? "notification" : "timeout"); @@ -305,6 +316,19 @@ bool EndpointChannelManager::ChannelState::CreateNewTimeoutDisconnectedState( } return true; } +bool EndpointChannelManager::ChannelState::IsWaitingForSafeToDisconnectTimeout( + const std::string& endpoint_id) { + auto item = endpoints_.find(endpoint_id); + if (item == endpoints_.end()) return false; + { + MutexLock lock(&item->second.timeout_to_disconnected_mutex); + LOG(INFO) << "[safe-to-disconnect] " + "IsWaitingForSafeToDisconnectTimeout for endpoint: " + << endpoint_id << ": " + << item->second.timeout_to_disconnected_enabled; + return (item->second.timeout_to_disconnected_enabled); + } +} bool EndpointChannelManager::ChannelState::IsSafeToDisconnect( const std::string& endpoint_id) { @@ -313,7 +337,7 @@ bool EndpointChannelManager::ChannelState::IsSafeToDisconnect( if (item == endpoints_.end()) return true; { MutexLock lock(&item->second.timeout_to_disconnected_mutex); - NEARBY_LOGS(INFO) + LOG(INFO) << "[safe-to-disconnect] Get SafeToDisconnect status for endpoint: " << endpoint_id << ": " << item->second.is_safe_to_disconnect; return (item->second.is_safe_to_disconnect); @@ -342,7 +366,7 @@ bool EndpointChannelManager::UnregisterChannelForEndpoint( safe_to_disconnect_enabled, result)) { return false; } - NEARBY_LOGS(INFO) + LOG(INFO) << "EndpointChannelManager unregistered channel for endpoint " << endpoint_id; return true; diff --git a/connections/implementation/endpoint_channel_manager.h b/connections/implementation/endpoint_channel_manager.h index 16980164..cbc5556a 100644 --- a/connections/implementation/endpoint_channel_manager.h +++ b/connections/implementation/endpoint_channel_manager.h @@ -17,16 +17,15 @@ #include #include -#include -#include "securegcm/d2d_connection_context_v1.h" #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" +#include "absl/time/time.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/endpoint_channel.h" -#include "internal/platform/feature_flags.h" #include "internal/platform/mutex.h" #include "internal/proto/analytics/connections_log.pb.h" +#include "proto/connections_enums.pb.h" namespace nearby { namespace connections { @@ -114,7 +113,8 @@ class EndpointChannelManager final { bool is_safe_to_disconnect, bool notify_stop_waiting) ABSL_LOCKS_EXCLUDED(mutex_); - bool CreateNewTimeoutDisconnectedState(const std::string& endpoint_id) + bool CreateNewTimeoutDisconnectedState(const std::string& endpoint_id, + absl::Duration timeout_millis) ABSL_LOCKS_EXCLUDED(mutex_); bool IsSafeToDisconnect(const std::string& endpoint_id) ABSL_LOCKS_EXCLUDED(mutex_); @@ -193,7 +193,9 @@ class EndpointChannelManager final { void MarkEndpointStopWaitToDisconnect(const std::string& endpoint_id, bool is_safe_to_disconnect, bool notify_stop_waiting); - bool CreateNewTimeoutDisconnectedState(const std::string& endpoint_id); + bool CreateNewTimeoutDisconnectedState(const std::string& endpoint_id, + absl::Duration timeout_millis); + bool IsWaitingForSafeToDisconnectTimeout(const std::string& endpoint_id); bool IsSafeToDisconnect(const std::string& endpoint_id); void RemoveTimeoutDisconnectedState(const std::string& endpoint_id); diff --git a/connections/implementation/endpoint_channel_manager_test.cc b/connections/implementation/endpoint_channel_manager_test.cc index eb0da0c2..7a1718d0 100644 --- a/connections/implementation/endpoint_channel_manager_test.cc +++ b/connections/implementation/endpoint_channel_manager_test.cc @@ -63,7 +63,7 @@ class MockEndpointChannel : public BaseEndpointChannel { explicit MockEndpointChannel(InputStream* input, OutputStream* output) : BaseEndpointChannel("service_id", "channel", input, output) {} - MOCK_METHOD(Medium, GetMedium, (), (const override)); + MOCK_METHOD(Medium, GetMedium, (), (const, override)); MOCK_METHOD(void, CloseImpl, (), (override)); }; diff --git a/connections/implementation/endpoint_manager.cc b/connections/implementation/endpoint_manager.cc index 1cccfc41..59420720 100644 --- a/connections/implementation/endpoint_manager.cc +++ b/connections/implementation/endpoint_manager.cc @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,13 +15,16 @@ #include "connections/implementation/endpoint_manager.h" #include -#include +#include #include #include #include #include +#include "absl/functional/any_invocable.h" #include "absl/time/time.h" +#include "connections/connection_options.h" +#include "connections/implementation/analytics/packet_meta_data.h" #include "connections/implementation/analytics/throughput_recorder.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/endpoint_channel.h" @@ -30,11 +33,19 @@ #include "connections/implementation/payload_manager.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" #include "connections/implementation/service_id_constants.h" +#include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/payload_type.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/system_clock.h" #include "internal/platform/logging.h" #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/runnable.h" +#include "internal/platform/single_thread_executor.h" #include "internal/proto/analytics/connections_log.pb.h" #include "proto/connections_enums.pb.h" @@ -46,6 +57,8 @@ using ::location::nearby::analytics::proto::ConnectionsLog; using ::location::nearby::connections::OfflineFrame; using ::location::nearby::connections::V1Frame; using ::nearby::analytics::PacketMetaData; +using DisconnectionReason = + ::location::nearby::proto::connections::DisconnectionReason; // We set this to 11s to provide sufficient time for an in-progress WebRTC // bandwidth upgrade to resolve. This is chosen to be slightly longer than the @@ -112,8 +125,8 @@ void EndpointManager::EndpointChannelLoopRunnable( // will retry and attempt to pick another channel. // If channel is deleted (no mapping), or it is still the same channel // (same Medium) on which we got the Exception::kIo, we terminate the loop. - NEARBY_LOG(INFO, "Started worker loop name=%s, endpoint=%s", - runnable_name.c_str(), endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Started worker loop name=" << runnable_name + << ", endpoint=" << endpoint_id; Medium last_failed_medium = Medium::UNKNOWN_MEDIUM; while (true) { // It's important to keep re-fetching the EndpointChannel for an endpoint @@ -122,7 +135,7 @@ void EndpointManager::EndpointChannelLoopRunnable( std::shared_ptr channel = channel_manager_->GetChannelForEndpoint(endpoint_id); if (channel == nullptr) { - NEARBY_LOG(INFO, "Endpoint channel is nullptr, bail out."); + NEARBY_LOGS(INFO) << "Endpoint channel is nullptr, bail out."; break; } @@ -130,8 +143,8 @@ void EndpointManager::EndpointChannelLoopRunnable( // EndpointChannel for this endpoint, there's nothing more to do here. if ((last_failed_medium != Medium::UNKNOWN_MEDIUM) && (channel->GetMedium() == last_failed_medium)) { - NEARBY_LOG( - INFO, "No new endpoint channel is found after a failure, exit loop."); + NEARBY_LOGS(INFO) + << "No new endpoint channel is found after a failure, exit loop."; break; } @@ -194,8 +207,8 @@ ExceptionOr EndpointManager::TryDecryptFrame( while (true) { ExceptionOr decrypted = endpoint_channel->TryDecrypt(data); if (decrypted.ok()) { - NEARBY_LOGS(VERBOSE) << "Message decrypted after " - << SystemClock::ElapsedRealtime() - start_time; + NEARBY_VLOG(1) << "Message decrypted after " + << SystemClock::ElapsedRealtime() - start_time; return parser::FromBytes(decrypted.result()); } if (decrypted.exception() == Exception::kExecution) { @@ -203,7 +216,7 @@ ExceptionOr EndpointManager::TryDecryptFrame( } auto elapsed = SystemClock::ElapsedRealtime() - start_time; if (elapsed > kDecryptRetryTimeout) { - NEARBY_LOGS(WARNING) << "Can't decrypt the mesage. Timeout after " + NEARBY_LOGS(WARNING) << "Can't decrypt the message. Timeout after " << elapsed; return Exception::kTimeout; } @@ -224,8 +237,8 @@ ExceptionOr EndpointManager::HandleData( PacketMetaData packet_meta_data; ExceptionOr bytes = endpoint_channel->Read(packet_meta_data); if (!bytes.ok()) { - NEARBY_LOG(INFO, "Stop reading on read-time exception: %d", - bytes.exception()); + NEARBY_LOGS(INFO) << "Stop reading on read-time exception: " + << bytes.exception(); return ExceptionOr(bytes.exception()); } ExceptionOr wrapped_frame = parser::FromBytes(bytes.result()); @@ -249,12 +262,13 @@ ExceptionOr EndpointManager::HandleData( if (!wrapped_frame.ok()) { if (wrapped_frame.GetException().Raised( Exception::kInvalidProtocolBuffer)) { - NEARBY_LOG(INFO, "Failed to decode; endpoint=%s; channel=%s; skip", - endpoint_id.c_str(), endpoint_channel->GetType().c_str()); + NEARBY_LOGS(INFO) << "Failed to decode; endpoint=" << endpoint_id + << "; channel=" << endpoint_channel->GetType() + << "; skip"; continue; } else { - NEARBY_LOG(INFO, "Stop reading on parse-time exception: %d", - wrapped_frame.exception()); + NEARBY_LOGS(INFO) << "Stop reading on parse-time exception: " + << wrapped_frame.exception(); return ExceptionOr(wrapped_frame.exception()); } } @@ -267,11 +281,9 @@ ExceptionOr EndpointManager::HandleData( // report messages without handlers, except KEEP_ALIVE, which has // no explicit handler. if (frame_type == V1Frame::KEEP_ALIVE) { - NEARBY_LOG(INFO, "KeepAlive message for endpoint %s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "KeepAlive message for endpoint " << endpoint_id; } else if (frame_type == V1Frame::DISCONNECTION) { - NEARBY_LOG(INFO, "Disconnect message for endpoint %s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Disconnect message for endpoint " << endpoint_id; ProcessDisconnectionFrame(client, endpoint_id, endpoint_channel, frame); } else { NEARBY_LOGS(ERROR) << "Unhandled message: endpoint_id=" << endpoint_id @@ -325,7 +337,7 @@ void EndpointManager::ProcessDisconnectionFrame( endpoint_id, /* is_safe_to_disconnect */ true, /* notify_stop_waiting */ false); RunOnEndpointManagerThread( - "safe-to-disconnect", [this, client, &endpoint_id]() { + "safe-to-disconnect", [this, client, endpoint_id]() { RemoveEndpoint(client, endpoint_id, /*notify=*/true, DisconnectionReason::REMOTE_DISCONNECTION); }); @@ -412,7 +424,7 @@ EndpointManager::EndpointManager( : channel_manager_(manager), serial_executor_(std::move(serial_executor)) {} EndpointManager::~EndpointManager() { - NEARBY_LOG(INFO, "Initiating shutdown of EndpointManager."); + NEARBY_LOGS(INFO) << "Initiating shutdown of EndpointManager."; { MutexLock lock(&mutex_); is_shutdown_ = true; @@ -420,15 +432,15 @@ EndpointManager::~EndpointManager() { analytics::ThroughputRecorderContainer::GetInstance().Shutdown(); CountDownLatch latch(1); RunOnEndpointManagerThread("bring-down-endpoints", [this, &latch]() { - NEARBY_LOG(INFO, "Bringing down endpoints"); + NEARBY_LOGS(INFO) << "Bringing down endpoints"; endpoints_.clear(); latch.CountDown(); }); latch.Await(); - NEARBY_LOG(INFO, "Bringing down control thread"); + NEARBY_LOGS(INFO) << "Bringing down control thread"; serial_executor_->Shutdown(); - NEARBY_LOG(INFO, "EndpointManager is down"); + NEARBY_LOGS(INFO) << "EndpointManager is down"; } void EndpointManager::RegisterFrameProcessor( @@ -488,15 +500,14 @@ EndpointManager::LockedFrameProcessor EndpointManager::GetFrameProcessor( } void EndpointManager::RemoveEndpointState(const std::string& endpoint_id) { - NEARBY_LOGS(VERBOSE) << "EnsureWorkersTerminated for endpoint " - << endpoint_id; + NEARBY_VLOG(1) << "EnsureWorkersTerminated for endpoint " << endpoint_id; auto item = endpoints_.find(endpoint_id); if (item != endpoints_.end()) { NEARBY_LOGS(INFO) << "EndpointState found for endpoint " << endpoint_id; // If another instance of data and keep-alive handlers is running, it will // terminate soon. Removing EndpointState waits for workers to complete. endpoints_.erase(item); - NEARBY_LOGS(VERBOSE) << "Workers terminated for endpoint " << endpoint_id; + NEARBY_VLOG(1) << "Workers terminated for endpoint " << endpoint_id; } else { NEARBY_LOGS(INFO) << "EndpointState not found for endpoint " << endpoint_id; } @@ -580,8 +591,8 @@ void EndpointManager::RegisterEndpoint( // (**) Wifi Hotspots can fail to notice a connection has been lost, // and they will happily keep writing to /dev/null. This is why we // listen for the pong. - NEARBY_LOGS(VERBOSE) << "EndpointManager enabling KeepAlive for endpoint " - << endpoint_id; + NEARBY_VLOG(1) << "EndpointManager enabling KeepAlive for endpoint " + << endpoint_id; endpoint_state.StartEndpointKeepAliveManager( [this, client, endpoint_id, keep_alive_interval, keep_alive_timeout]( Mutex* keep_alive_waiter_mutex, @@ -696,14 +707,14 @@ void EndpointManager::DiscardEndpoint(ClientProxy* client, { MutexLock lock(&mutex_); if (is_shutdown_) { - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "DiscardEndpoint called during destruction, returning early."; return; } } RemoveEndpoint(client, endpoint_id, - /* notify */client->IsConnectedToEndpoint(endpoint_id), + /* notify */ client->IsConnectedToEndpoint(endpoint_id), reason); }); } @@ -748,7 +759,7 @@ void EndpointManager::RemoveEndpoint(ClientProxy* client, ? ConnectionsLog::EstablishedConnection::SAFE_DISCONNECTION : ConnectionsLog::EstablishedConnection::UNSAFE_DISCONNECTION; NEARBY_LOGS(INFO) << "[safe-to-disconnect] safe_disconnect_result:" - << (safe_disconnect_result? "true" : "false"); + << (safe_disconnect_result ? "true" : "false"); } } if (safe_disconnect_result == @@ -780,11 +791,17 @@ bool EndpointManager::ApplySafeToDisconnect(const std::string& endpoint_id, DisconnectionReason reason) { NEARBY_LOGS(INFO) << "[safe-to-disconnect] ApplySafeToDisconnect reason: " << reason; + // TODO(b/303544913): clean up the safe-to-disconnect logic bool is_safe_disconnection = false; bool send_disconnection_frame = true; + absl::Duration timeout_millis = FeatureFlags::GetInstance() + .GetFlags() + .safe_to_disconnect_ack_delay_millis; + bool is_wait_for_ack = true; switch (reason) { case DisconnectionReason::UPGRADED: case DisconnectionReason::SHUTDOWN: + case DisconnectionReason::PREV_CHANNEL_DISCONNECTION_IN_RECONNECT: case DisconnectionReason::UNFINISHED: return true; // safe disconnection case DisconnectionReason::IO_ERROR: @@ -796,6 +813,10 @@ bool EndpointManager::ApplySafeToDisconnect(const std::string& endpoint_id, case DisconnectionReason::REMOTE_DISCONNECTION: is_safe_disconnection = true; send_disconnection_frame = false; + timeout_millis = FeatureFlags::GetInstance() + .GetFlags() + .safe_to_disconnect_remote_disc_delay_millis; + is_wait_for_ack = false; break; default: is_safe_disconnection = false; @@ -820,8 +841,13 @@ bool EndpointManager::ApplySafeToDisconnect(const std::string& endpoint_id, } } - bool state = - channel_manager_->CreateNewTimeoutDisconnectedState(endpoint_id); + NEARBY_LOGS(WARNING) << "[safe-to-disconnect] Wait for " + << (is_wait_for_ack ? "ack" : "disconnection") + << " from endpoint: " << endpoint_id + << " for reason: " << reason << ", timeout in " + << timeout_millis; + bool state = channel_manager_->CreateNewTimeoutDisconnectedState( + endpoint_id, timeout_millis); if (!state) return is_safe_disconnection; return is_safe_disconnection || @@ -884,6 +910,19 @@ CountDownLatch EndpointManager::NotifyFrameProcessorsOnEndpointDisconnect( return barrier; } +std::vector EndpointManager::SendPayloadAck( + std::int64_t payload_id, const std::vector& endpoint_ids) { + ByteArray bytes = parser::ForPayloadAckPayloadTransfer(payload_id); + PacketMetaData packet_meta_data; + + return SendTransferFrameBytes( + endpoint_ids, bytes, payload_id, + /* offset= */ -1, + /*packet_type=*/ + PayloadTransferFrame::PacketType_Name(PayloadTransferFrame::PAYLOAD_ACK), + packet_meta_data); +} + std::vector EndpointManager::SendTransferFrameBytes( const std::vector& endpoint_ids, const ByteArray& bytes, std::int64_t payload_id, std::int64_t offset, @@ -928,7 +967,7 @@ EndpointManager::EndpointState::~EndpointState() { // object (in move constructor) which prevents unregistering the channel // prematurely. if (channel_manager_) { - NEARBY_LOG(VERBOSE, "EndpointState destructor %s", endpoint_id_.c_str()); + NEARBY_VLOG(1) << "EndpointState destructor " << endpoint_id_; channel_manager_->UnregisterChannelForEndpoint( endpoint_id_, DisconnectionReason::SHUTDOWN, ConnectionsLog::EstablishedConnection::SAFE_DISCONNECTION); diff --git a/connections/implementation/endpoint_manager.h b/connections/implementation/endpoint_manager.h index 02306ca2..8b2b0b81 100644 --- a/connections/implementation/endpoint_manager.h +++ b/connections/implementation/endpoint_manager.h @@ -1,4 +1,4 @@ -// Copyright 2021 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -141,7 +141,10 @@ class EndpointManager { const location::nearby::connections::PayloadTransferFrame::ControlMessage& control_message, const std::vector& endpoint_ids); - + // Receiver sends this frame when all the packets are received. Returns the + // list of endpoints to which sending this frame failed. + std::vector SendPayloadAck( + std::int64_t payload_id, const std::vector& endpoint_ids); // Called when we internally want to get rid of the endpoint, without the // client directly telling us to. For example... // a) We failed to read from the endpoint in its dedicated reader thread. diff --git a/connections/implementation/endpoint_manager_test.cc b/connections/implementation/endpoint_manager_test.cc index d2047130..09466d63 100644 --- a/connections/implementation/endpoint_manager_test.cc +++ b/connections/implementation/endpoint_manager_test.cc @@ -15,6 +15,7 @@ #include "connections/implementation/endpoint_manager.h" #include +#include #include #include #include @@ -27,16 +28,20 @@ #include "absl/time/clock.h" #include "absl/time/time.h" #include "connections/connection_options.h" +#include "connections/implementation/analytics/analytics_recorder.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" #include "connections/implementation/endpoint_channel_manager.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/offline_frames.h" +#include "connections/listeners.h" +#include "connections/status.h" #include "internal/flags/nearby_flags.h" #include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/exception.h" -// #include "internal/platform/feature_flags.h" #include "internal/platform/logging.h" +#include "internal/platform/single_thread_executor.h" #include "internal/test/fake_single_thread_executor.h" #include "proto/connections_enums.pb.h" @@ -66,28 +71,33 @@ class MockEndpointChannel : public EndpointChannel { (override)); MOCK_METHOD(void, Close, (), (override)); MOCK_METHOD(void, Close, (DisconnectionReason reason), (override)); + MOCK_METHOD(void, Close, + (DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result), + (override)); MOCK_METHOD(location::nearby::proto::connections::ConnectionTechnology, - GetTechnology, (), (const override)); + GetTechnology, (), (const, override)); MOCK_METHOD(location::nearby::proto::connections::ConnectionBand, GetBand, (), - (const override)); - MOCK_METHOD(int, GetFrequency, (), (const override)); - MOCK_METHOD(int, GetTryCount, (), (const override)); - MOCK_METHOD(std::string, GetType, (), (const override)); - MOCK_METHOD(std::string, GetServiceId, (), (const override)); - MOCK_METHOD(std::string, GetName, (), (const override)); - MOCK_METHOD(Medium, GetMedium, (), (const override)); - MOCK_METHOD(int, GetMaxTransmitPacketSize, (), (const override)); + (const, override)); + MOCK_METHOD(int, GetFrequency, (), (const, override)); + MOCK_METHOD(int, GetTryCount, (), (const, override)); + MOCK_METHOD(std::string, GetType, (), (const, override)); + MOCK_METHOD(std::string, GetServiceId, (), (const, override)); + MOCK_METHOD(std::string, GetName, (), (const, override)); + MOCK_METHOD(Medium, GetMedium, (), (const, override)); + MOCK_METHOD(int, GetMaxTransmitPacketSize, (), (const, override)); MOCK_METHOD(void, EnableEncryption, (std::shared_ptr context), (override)); MOCK_METHOD(void, DisableEncryption, (), (override)); - MOCK_METHOD(bool, IsPaused, (), (const override)); + MOCK_METHOD(bool, IsPaused, (), (const, override)); MOCK_METHOD(bool, IsEncrypted, (), (override)); MOCK_METHOD(ExceptionOr, TryDecrypt, (const ByteArray& data), (override)); MOCK_METHOD(void, Pause, (), (override)); MOCK_METHOD(void, Resume, (), (override)); - MOCK_METHOD(absl::Time, GetLastReadTimestamp, (), (const override)); - MOCK_METHOD(absl::Time, GetLastWriteTimestamp, (), (const override)); + MOCK_METHOD(absl::Time, GetLastReadTimestamp, (), (const, override)); + MOCK_METHOD(absl::Time, GetLastWriteTimestamp, (), (const, override)); MOCK_METHOD(void, SetAnalyticsRecorder, (analytics::AnalyticsRecorder*, const std::string&), (override)); @@ -122,11 +132,24 @@ class MockFrameProcessor : public EndpointManager::FrameProcessor { class SetSafeToDisconnect { public: - explicit SetSafeToDisconnect(bool safe_to_disconnect) { + SetSafeToDisconnect(bool safe_to_disconnect, bool auto_reconnect, + bool payload_received_ack, + std::int32_t safe_to_disconnect_version) { NearbyFlags::GetInstance().OverrideBoolFlagValue( config_package_nearby::nearby_connections_feature:: kEnableSafeToDisconnect, safe_to_disconnect); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableAutoReconnect, + auto_reconnect); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kEnablePayloadReceivedAck, + payload_received_ack); + NearbyFlags::GetInstance().OverrideInt64FlagValue( + config_package_nearby::nearby_connections_feature:: + kSafeToDisconnectVersion, + safe_to_disconnect_version); } }; @@ -155,12 +178,12 @@ class EndpointManagerTest : public ::testing::Test { EXPECT_CALL(mock_listener_.initiated_cb, Call).Times(1); em_.RegisterEndpoint(client_.get(), endpoint_id_, info_, connection_options_, std::move(channel), listener_, - connection_token); + connection_token_); if (should_close) { EXPECT_TRUE(done.Await(absl::Milliseconds(1000)).result()); } } - SetSafeToDisconnect set_safe_to_disconnect_{true}; + SetSafeToDisconnect set_safe_to_disconnect_{true, false, true, 5}; std::unique_ptr client_ = std::make_unique(); ConnectionOptions connection_options_{ .keep_alive_interval_millis = 5000, @@ -198,7 +221,7 @@ class EndpointManagerTest : public ::testing::Test { .bandwidth_changed_cb = mock_listener_.bandwidth_changed_cb.AsStdFunction(), }; - std::string connection_token = "conntokn"; + std::string connection_token_ = "conntokn"; absl::Time start_time_{absl::Now()}; }; @@ -233,7 +256,7 @@ TEST_F(EndpointManagerTest, // (IMO, it should be called as long as any connection callback was called // before. (in this case initiated_cb is called)). // Test captures current protocol behavior. - client_->SetRemoteSafeToDisconnectVersion(endpoint_id_, 2); + client_->SetRemoteSafeToDisconnectVersion(endpoint_id_, 5); ecm_.UpdateSafeToDisconnectForEndpoint(endpoint_id_, true); em_.UnregisterEndpoint(client_.get(), endpoint_id_); } @@ -293,7 +316,7 @@ TEST_F(EndpointManagerTest, UnregisterFrameProcessorWorks) { em_.UnregisterEndpoint(client_.get(), endpoint_id_); } -TEST_F(EndpointManagerTest, SendControlMessageWorks) { +TEST_F(EndpointManagerTest, SendControlMessageAndPayloadAckWorks) { auto endpoint_channel = std::make_unique(); PayloadTransferFrame::PayloadHeader header; PayloadTransferFrame::ControlMessage control; @@ -306,9 +329,9 @@ TEST_F(EndpointManagerTest, SendControlMessageWorks) { ON_CALL(*endpoint_channel, Read(_)) .WillByDefault([channel = endpoint_channel.get()]() { if (channel->IsClosed()) return ExceptionOr(Exception::kIo); - NEARBY_LOG(INFO, "Simulate read delay: wait"); + NEARBY_LOGS(INFO) << "Simulate read delay: wait"; absl::SleepFor(absl::Milliseconds(100)); - NEARBY_LOG(INFO, "Simulate read delay: done"); + NEARBY_LOGS(INFO) << "Simulate read delay: done"; if (channel->IsClosed()) return ExceptionOr(Exception::kIo); return ExceptionOr(ByteArray{}); }); @@ -316,18 +339,21 @@ TEST_F(EndpointManagerTest, SendControlMessageWorks) { .WillByDefault( [channel = endpoint_channel.get()](DisconnectionReason reason) { channel->DoClose(); - NEARBY_LOG(INFO, "Channel closed"); + NEARBY_LOGS(INFO) << "Channel closed"; }); EXPECT_CALL(*endpoint_channel, Write(_, _)) .WillRepeatedly(Return(Exception{Exception::kSuccess})); RegisterEndpoint(std::move(endpoint_channel), false); - auto failed_ids = + auto failed_ids_1 = em_.SendControlMessage(header, control, std::vector{endpoint_id_}); - EXPECT_EQ(failed_ids, std::vector{}); - NEARBY_LOG(INFO, "Will unregister endpoint now"); + EXPECT_EQ(failed_ids_1, std::vector{}); + auto failed_ids_2 = em_.SendPayloadAck(header.id(), + std::vector{endpoint_id_}); + EXPECT_EQ(failed_ids_2, std::vector{}); + NEARBY_LOGS(INFO) << "Will unregister endpoint now"; em_.UnregisterEndpoint(client_.get(), endpoint_id_); - NEARBY_LOG(INFO, "Will call destructors now"); + NEARBY_LOGS(INFO) << "Will call destructors now"; } TEST_F(EndpointManagerTest, SingleReadOnReadError) { diff --git a/connections/implementation/fake_bwu_handler.h b/connections/implementation/fake_bwu_handler.h index 78c13719..6f9aaa91 100644 --- a/connections/implementation/fake_bwu_handler.h +++ b/connections/implementation/fake_bwu_handler.h @@ -137,13 +137,15 @@ class FakeBwuHandler : public BaseBwuHandler { return parser::ForBwuWifiLanPathAvailable(/*ip_address=*/"ABCD", /*port=*/1234); case location::nearby::proto::connections::WEB_RTC: + case location::nearby::proto::connections::WEB_RTC_NON_CELLULAR: return parser::ForBwuWebrtcPathAvailable( /*peer_id=*/"peer-id", location::nearby::connections::LocationHint{}); case location::nearby::proto::connections::WIFI_HOTSPOT: return parser::ForBwuWifiHotspotPathAvailable( /*ssid=*/"Direct-357a2d8c", /*password=*/"b592f7d3", - /*port=*/1234, /*gateway=*/"123.234.23.1", false); + /*port=*/1234, /*frequency=*/2412, /*gateway=*/"123.234.23.1", + false); case location::nearby::proto::connections::WIFI_DIRECT: return parser::ForBwuWifiDirectPathAvailable( /*ssid=*/"Direct-12345678", /*password=*/"87654321", /*port=*/2143, diff --git a/connections/implementation/fake_endpoint_channel.h b/connections/implementation/fake_endpoint_channel.h index 24744c76..72725980 100644 --- a/connections/implementation/fake_endpoint_channel.h +++ b/connections/implementation/fake_endpoint_channel.h @@ -19,6 +19,7 @@ #include "connections/implementation/endpoint_channel.h" #include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" namespace nearby { namespace connections { @@ -58,6 +59,12 @@ class FakeEndpointChannel : public EndpointChannel { is_closed_ = true; disconnection_reason_ = reason; } + void Close( + location::nearby::proto::connections::DisconnectionReason reason, + location::nearby::analytics::proto::ConnectionsLog:: + EstablishedConnection::SafeDisconnectionResult result) override { + Close(reason); + } location::nearby::proto::connections::ConnectionTechnology GetTechnology() const override { return location::nearby::proto::connections::ConnectionTechnology:: diff --git a/connections/implementation/flags/BUILD b/connections/implementation/flags/BUILD index 686e99ad..fe0f2c65 100644 --- a/connections/implementation/flags/BUILD +++ b/connections/implementation/flags/BUILD @@ -20,7 +20,11 @@ cc_library( ], visibility = [ "//connections:__subpackages__", + "//googlemac/iPhone/Shared/Identity/SmartSetup:__subpackages__", + "//internal/platform/implementation:__subpackages__", "//location/nearby/cpp:__subpackages__", + "//location/nearby/testing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ "//internal/flags:flag_reader", diff --git a/connections/implementation/flags/nearby_connections_feature_flags.h b/connections/implementation/flags/nearby_connections_feature_flags.h index ecab2dd4..92db9a59 100644 --- a/connections/implementation/flags/nearby_connections_feature_flags.h +++ b/connections/implementation/flags/nearby_connections_feature_flags.h @@ -1,4 +1,4 @@ -// Copyright 2023 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Mendel flags, auto-generated. DO NOT EDIT. #ifndef THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_FLAGS_NEARBY_CONNECTIONS_FEATURE_FLAGS_H_ #define THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_FLAGS_NEARBY_CONNECTIONS_FEATURE_FLAGS_H_ @@ -26,37 +27,49 @@ namespace config_package_nearby { constexpr absl::string_view kConfigPackage = "nearby"; -// The Nearby Connections features. namespace nearby_connections_feature { - -// Disable/Enable BLE v2 in Nearby Connections SDK. -constexpr auto kEnableBleV2 = - flags::Flag(kConfigPackage, "45401515", false); - // The timeout in millis to report peripheral device lost. constexpr auto kBlePeripheralLostTimeoutMillis = flags::Flag(kConfigPackage, "45411439", 12000); - -// Enable/Disable GATT query during scanning. +// When true, disable Bluetooth classic scanning. +constexpr auto kDisableBluetoothClassicScanning = + flags::Flag(kConfigPackage, "45639961", false); +// Enable/Disable auto_reconnect feature. +constexpr auto kEnableAutoReconnect = + flags::Flag(kConfigPackage, "45427690", false); +// Disable/Enable BLE v2 in Nearby Connections SDK. +constexpr auto kEnableBleV2 = + flags::Flag(kConfigPackage, "45401515", false); +// Disable/Enable GATT query in thread in BLE V2. +// Manual edit: setting this to false for ChromeOS rollout as well. constexpr auto kEnableGattQueryInThread = flags::Flag(kConfigPackage, "45415261", false); - +// When true, enable instant on lost feature. +constexpr auto kEnableInstantOnLost = + flags::Flag(kConfigPackage, "45642180", false); +// When true, enable multiplexing in NC. +constexpr auto kEnableMultiplex = + flags::Flag(kConfigPackage, "45647946", false); // Enable/Disable payload manager to skip chunk update. constexpr auto kEnablePayloadManagerToSkipChunkUpdate = - flags::Flag(kConfigPackage, "45415729", false); - + flags::Flag(kConfigPackage, "45415729", true); +// Enable/Disable payload-received-ack feature. +constexpr auto kEnablePayloadReceivedAck = + flags::Flag(kConfigPackage, "45425840", false); // Enable/Disable safe-to-disconnect feature. constexpr auto kEnableSafeToDisconnect = flags::Flag(kConfigPackage, "45425789", false); - -// When true, allows to enable payload-received-ack protocol. -constexpr auto kEnablePayloadReceivedAck = - flags::Flag(kConfigPackage, "45425840", false); - -// Support 0. disabled all. 1. safe-to-disconnect 2. reserved 3. auto-reconnect -// 4. auto-resume for dev device 5. payload_ack +// by default, enable Wi-Fi Hotspot client. +constexpr auto kEnableWifiHotspotClient = + flags::Flag(kConfigPackage, "45648734", true); +// Set the safe-to-disconnect version. +// Enable 1. safe-to-disconnect check 2. reserved 3. auto-reconnect 4. +// auto-resume 5. non-distance-constraint-recovery 6. payload_ack constexpr auto kSafeToDisconnectVersion = flags::Flag(kConfigPackage, "45425841", 0); +// When true, use stable endpoint ID. +constexpr auto kUseStableEndpointId = + flags::Flag(kConfigPackage, "45639298", false); } // namespace nearby_connections_feature } // namespace config_package_nearby diff --git a/connections/implementation/fuzzers/BUILD b/connections/implementation/fuzzers/BUILD index 54b9df9b..0cfc0c5a 100644 --- a/connections/implementation/fuzzers/BUILD +++ b/connections/implementation/fuzzers/BUILD @@ -11,19 +11,22 @@ # 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. -load("//security/fuzzing/blaze:cc_fuzz_target.bzl", "cc_fuzz_target") licenses(["notice"]) -cc_fuzz_target( +cc_test( name = "offline_frames_fuzzer", srcs = ["offline_frames_fuzzer.cc"], - componentid = 148515, - copts = ["-DCORE_ADAPTER_DLL"], + linkopts = [ + "-Wl,--warn-backrefs-exclude=*third_party/nearby/internal/platform/implementation/g3/_objs*", + ], + tags = ["componentid:148515"], deps = [ "//connections/implementation:internal", "//internal/platform:base", "//internal/platform/implementation/g3", - "//security/fuzzing/blaze:default_init_google_for_cc_fuzz_target", + "//testing/fuzzing:fuzztest", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", ], ) diff --git a/connections/implementation/mediums/BUILD b/connections/implementation/mediums/BUILD index 554b8288..243e4b3a 100644 --- a/connections/implementation/mediums/BUILD +++ b/connections/implementation/mediums/BUILD @@ -49,6 +49,7 @@ cc_library( "//connections:core_types", "//connections/implementation/flags:connections_flags", "//connections/implementation/mediums/ble_v2", + "//connections/implementation/mediums/multiplex", "//connections/implementation/mediums/webrtc", "//connections/implementation/proto:offline_wire_formats_cc_proto", "//internal/flags:nearby_flags", @@ -57,13 +58,16 @@ cc_library( "//internal/platform:comm", "//internal/platform:types", "//internal/platform:uuid", + "//internal/platform/implementation:comm", "//proto/mediums:web_rtc_signaling_frames_cc_proto", # TODO: Support WebRTC + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:btree", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/functional:bind_front", + "@com_google_absl//absl/status", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/time", @@ -90,6 +94,7 @@ cc_library( visibility = [ "//connections/implementation:__pkg__", "//connections/implementation/mediums/ble_v2:__subpackages__", + "//connections/implementation/mediums/multiplex:__pkg__", "//connections/implementation/mediums/webrtc:__pkg__", ], deps = [ @@ -97,6 +102,7 @@ cc_library( "//connections/implementation/proto:offline_wire_formats_cc_proto", "//internal/platform:base", "//internal/platform:types", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/strings", ], @@ -120,16 +126,21 @@ cc_test( deps = [ ":mediums", ":utils", + "//connections:core_types", "//connections/implementation/flags:connections_flags", "//connections/implementation/mediums/ble_v2", "//internal/flags:nearby_flags", "//internal/platform:base", + "//internal/platform:cancellation_flag", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", + "//internal/platform/implementation:types", "//internal/platform/implementation/g3", # build_cleaner: keep "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", ], @@ -151,6 +162,7 @@ cc_test( ":mediums", ":utils", "//internal/platform:base", + "//internal/platform:cancellation_flag", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", diff --git a/connections/implementation/mediums/ble.cc b/connections/implementation/mediums/ble.cc index c6667050..887d5ef6 100644 --- a/connections/implementation/mediums/ble.cc +++ b/connections/implementation/mediums/ble.cc @@ -14,6 +14,7 @@ #include "connections/implementation/mediums/ble.h" +#include #include #include #include @@ -21,6 +22,7 @@ #include "absl/strings/escaping.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement.h" #include "connections/implementation/mediums/utils.h" +#include "internal/platform/byte_array.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" #include "internal/platform/prng.h" @@ -61,10 +63,11 @@ bool Ble::StartAdvertising(const std::string& service_id, } if (advertisement_bytes.size() > kMaxAdvertisementLength) { - NEARBY_LOG(INFO, - "Refusing to start BLE advertising because the advertisement " - "was too long. Expected at most %d bytes but received %d.", - kMaxAdvertisementLength, advertisement_bytes.size()); + NEARBY_LOGS(INFO) + << "Refusing to start BLE advertising because the advertisement " + "was too long. Expected at most " + << kMaxAdvertisementLength << " bytes but received " + << advertisement_bytes.size(); return false; } @@ -76,7 +79,7 @@ bool Ble::StartAdvertising(const std::string& service_id, if (!radio_.IsEnabled()) { NEARBY_LOGS(INFO) - << "Can't start BLE scanning because Bluetooth was never turned on"; + << "Can't start BLE adveertising because Bluetooth was never turned on"; return false; } @@ -89,7 +92,7 @@ bool Ble::StartAdvertising(const std::string& service_id, << advertisement_bytes.size() << ")" << ", service id=" << service_id << ", fast advertisement service uuid=" - << fast_advertisement_service_uuid; + << absl::BytesToHexString(fast_advertisement_service_uuid); // Wrap the connections advertisement to the medium advertisement. const bool fast_advertisement = !fast_advertisement_service_uuid.empty(); @@ -138,6 +141,79 @@ bool Ble::StopAdvertising(const std::string& service_id) { return ret; } +bool Ble::StartLegacyAdvertising( + const std::string& input_service_id, const std::string& local_endpoint_id, + const std::string& fast_advertisement_service_uuid) { + NEARBY_LOGS(INFO) << "StartLegacyAdvertising: " << input_service_id.c_str() + << ", local_endpoint_id: " << local_endpoint_id.c_str(); + MutexLock lock(&mutex_); + std::string service_id = input_service_id + "-Legacy"; + + if (IsAdvertisingLocked(service_id)) { + NEARBY_LOGS(INFO) + << "Failed to BLE legacy advertise because we're already advertising."; + return false; + } + + if (!radio_.IsEnabled()) { + NEARBY_LOGS(INFO) << "Can't start BLE legacy advertising because Bluetooth " + "was never turned on"; + return false; + } + + if (!IsAvailableLocked()) { + NEARBY_LOGS(INFO) + << "Can't turn on BLE legacy advertising. BLE is not available."; + return false; + } + // TODO(hais) improve working dummy set to feed proper hash value. + std::array encoded_legacy_char_array = { + 0x51, 0x43, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x41, 0x41, 0x44, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}; + ByteArray encoded_bytes{encoded_legacy_char_array}; + + NEARBY_LOGS(INFO) << "Turning on BLE advertising (advertisement size=" + << encoded_bytes.size() + << "): " << absl::BytesToHexString(encoded_bytes.data()) + << ", service id=" << service_id + << ", fast advertisement service uuid=" + << fast_advertisement_service_uuid; + + if (!medium_.StartAdvertising(service_id, encoded_bytes, + fast_advertisement_service_uuid)) { + NEARBY_LOGS(ERROR) + << "Failed to turn on BLE advertising with advertisement bytes=" + << absl::BytesToHexString(encoded_bytes.data()) + << ", size=" << encoded_bytes.size() + << ", fast advertisement service uuid=" + << fast_advertisement_service_uuid; + return false; + } + + advertising_info_.Add(service_id); + return true; +} + +bool Ble::StopLegacyAdvertising(const std::string& input_service_id) { + NEARBY_LOGS(INFO) << "StopLegacyAdvertising:" << input_service_id.c_str(); + MutexLock lock(&mutex_); + + std::string service_id = input_service_id + "-Legacy"; + if (!IsAdvertisingLocked(service_id)) { + NEARBY_LOGS(INFO) + << "Can't turn off BLE legacy advertising; it is already off"; + return false; + } + + NEARBY_LOGS(INFO) << "Turned off BLE legacy advertising with service id=" + << service_id; + bool ret = medium_.StopAdvertising(service_id); + // Reset our bundle of advertising state to mark that we're no longer + // advertising. + advertising_info_.Remove(service_id); + return ret; +} + bool Ble::IsAdvertising(const std::string& service_id) { MutexLock lock(&mutex_); @@ -227,8 +303,7 @@ bool Ble::StopScanning(const std::string& service_id) { return false; } - NEARBY_LOG(INFO, "Turned off BLE scanning with service id=%s", - service_id.c_str()); + NEARBY_LOGS(INFO) << "Turned off BLE scanning with service id=" << service_id; bool ret = medium_.StopScanning(service_id); scanning_info_.Clear(); return ret; @@ -349,12 +424,15 @@ BleSocket Ble::Connect(BlePeripheral& peripheral, const std::string& service_id, ByteArray Ble::UnwrapAdvertisementBytes( const ByteArray& medium_advertisement_data) { - mediums::BleAdvertisement medium_ble_advertisement{medium_advertisement_data}; - if (!medium_ble_advertisement.IsValid()) { - return ByteArray{}; + auto medium_ble_advertisement_status_or = + mediums::BleAdvertisement::CreateBleAdvertisement( + medium_advertisement_data); + if (!medium_ble_advertisement_status_or.ok()) { + NEARBY_LOGS(INFO) << medium_ble_advertisement_status_or.status().ToString(); + return ByteArray(); } - return medium_ble_advertisement.GetData(); + return medium_ble_advertisement_status_or.value().GetData(); } } // namespace connections diff --git a/connections/implementation/mediums/ble.h b/connections/implementation/mediums/ble.h index a855b8b3..2502f92b 100644 --- a/connections/implementation/mediums/ble.h +++ b/connections/implementation/mediums/ble.h @@ -53,6 +53,19 @@ class Ble { bool StopAdvertising(const std::string& service_id) ABSL_LOCKS_EXCLUDED(mutex_); + // (TODO:hais) remove this after ble_v2 refactor + // Sets custom advertisement data, and then enables Ble advertising. + // Returns true, if data is successfully set, and false otherwise. + bool StartLegacyAdvertising( + const std::string& service_id, const std::string& local_endpoint_id, + const std::string& fast_advertisement_service_uuid) + ABSL_LOCKS_EXCLUDED(mutex_); + + // (TODO:hais) remove this after ble_v2 refactor + // Disables Ble advertising. + bool StopLegacyAdvertising(const std::string& service_id) + ABSL_LOCKS_EXCLUDED(mutex_); + bool IsAdvertising(const std::string& service_id) ABSL_LOCKS_EXCLUDED(mutex_); // Enables Ble scanning mode. Will report any discoverable peripherals in diff --git a/connections/implementation/mediums/ble_test.cc b/connections/implementation/mediums/ble_test.cc index 51673a77..c88cb51c 100644 --- a/connections/implementation/mediums/ble_test.cc +++ b/connections/implementation/mediums/ble_test.cc @@ -14,14 +14,19 @@ #include "connections/implementation/mediums/ble.h" +#include #include -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" #include "connections/implementation/mediums/bluetooth_radio.h" #include "internal/platform/ble.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" @@ -73,25 +78,26 @@ TEST_P(BleTest, CanStartAcceptingConnectionsAndConnect) { ble_a.StartAcceptingConnections( service_id, [&](BleSocket socket, const std::string&) { accept_latch.CountDown(); }); - BlePeripheral discovered_peripheral; + std::atomic atomic_discovered_peripheral; ble_b.StartScanning( service_id, fast_advertisement_service_uuid, { .peripheral_discovered_cb = - [&found_latch, &discovered_peripheral]( + [&found_latch, &atomic_discovered_peripheral]( BlePeripheral& peripheral, const std::string& service_id, const ByteArray& advertisement_bytes, bool fast_advertisement) { - discovered_peripheral = peripheral; - NEARBY_LOG( - INFO, - "Discovered peripheral=%p [impl=%p], fast advertisement=%d", - &peripheral, &peripheral.GetImpl(), fast_advertisement); + NEARBY_LOGS(INFO) + << "Discovered peripheral=" << peripheral.GetName() + << ", impl=" << &peripheral.GetImpl() + << ", fast advertisement=" << fast_advertisement; + atomic_discovered_peripheral.store(peripheral); found_latch.CountDown(); }, }); EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + BlePeripheral discovered_peripheral = atomic_discovered_peripheral.load(); ASSERT_TRUE(discovered_peripheral.IsValid()); CancellationFlag flag; BleSocket socket = ble_b.Connect(discovered_peripheral, service_id, &flag); @@ -123,25 +129,26 @@ TEST_P(BleTest, CanCancelConnect) { ble_a.StartAcceptingConnections( service_id, [&](BleSocket socket, const std::string&) { accept_latch.CountDown(); }); - BlePeripheral discovered_peripheral; + std::atomic atomic_discovered_peripheral; ble_b.StartScanning( service_id, fast_advertisement_service_uuid, { .peripheral_discovered_cb = - [&found_latch, &discovered_peripheral]( + [&found_latch, &atomic_discovered_peripheral]( BlePeripheral& peripheral, const std::string& service_id, const ByteArray& advertisement_bytes, bool fast_advertisement) { - discovered_peripheral = peripheral; - NEARBY_LOG( - INFO, - "Discovered peripheral=%p [impl=%p], fast advertisement=%d", - &peripheral, &peripheral.GetImpl(), fast_advertisement); + NEARBY_LOGS(INFO) + << "Discovered peripheral=" << peripheral.GetName() + << ", impl=" << &peripheral.GetImpl() + << ", fast advertisement=" << fast_advertisement; + atomic_discovered_peripheral.store(peripheral); found_latch.CountDown(); }, }); EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + BlePeripheral discovered_peripheral = atomic_discovered_peripheral.load(); ASSERT_TRUE(discovered_peripheral.IsValid()); CancellationFlag flag(true); BleSocket socket = ble_b.Connect(discovered_peripheral, service_id, &flag); @@ -247,6 +254,24 @@ TEST_F(BleTest, CanStartDiscovery) { env_.Stop(); } +TEST_F(BleTest, CanStartAndStopLegacyAdvertising) { + env_.Start(); + BluetoothRadio radio_a; + Ble ble_a{radio_a}; + radio_a.Enable(); + std::string service_id(kServiceID); + std::string legacy_service_id(std::string{kServiceID} + "-Legacy"); + std::string device_a_endpoint_id{"1A1A"}; + std::string fast_advertisement_service_uuid(kFastAdvertisementServiceUuid); + EXPECT_TRUE(ble_a.StartLegacyAdvertising(service_id, device_a_endpoint_id, + fast_advertisement_service_uuid)); + EXPECT_FALSE(ble_a.IsAdvertising(service_id)); + EXPECT_TRUE(ble_a.IsAdvertising(legacy_service_id)); + EXPECT_TRUE(ble_a.StopLegacyAdvertising(service_id)); + EXPECT_FALSE(ble_a.IsAdvertising(legacy_service_id)); + env_.Stop(); +} + } // namespace } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/ble_v2.cc b/connections/implementation/mediums/ble_v2.cc index 88131d85..20953f8c 100644 --- a/connections/implementation/mediums/ble_v2.cc +++ b/connections/implementation/mediums/ble_v2.cc @@ -15,27 +15,42 @@ #include "connections/implementation/mediums/ble_v2.h" #include +#include #include #include #include #include +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "absl/status/status.h" #include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" #include "absl/time/time.h" #include "absl/types/optional.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/mediums/ble_v2/advertisement_read_result.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" #include "connections/implementation/mediums/ble_v2/ble_utils.h" #include "connections/implementation/mediums/ble_v2/bloom_filter.h" +#include "connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h" #include "connections/implementation/mediums/bluetooth_radio.h" #include "connections/implementation/mediums/utils.h" #include "connections/power_level.h" #include "internal/flags/nearby_flags.h" +#include "internal/platform/ble_v2.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/ble_v2.h" #include "internal/platform/logging.h" +#include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/runnable.h" +#include "internal/platform/uuid.h" namespace nearby { namespace connections { @@ -60,8 +75,15 @@ BleV2::BleV2(BluetoothRadio& radio) BleV2::~BleV2() { // Destructor is not taking locks, but methods it is calling are. - while (!scanned_service_ids_.empty()) { - StopScanning(*scanned_service_ids_.begin()); + if (FeatureFlags::GetInstance().GetFlags().enable_ble_v2_async_scanning) { + // If using asynchronous scanning, check the corresponding map. + while (!service_ids_to_scanning_sessions_.empty()) { + StopScanning(service_ids_to_scanning_sessions_.begin()->first); + } + } else { + while (!scanned_service_ids_.empty()) { + StopScanning(*scanned_service_ids_.begin()); + } } while (!advertising_infos_.empty()) { StopAdvertising(advertising_infos_.begin()->first); @@ -73,6 +95,12 @@ BleV2::~BleV2() { serial_executor_.Shutdown(); alarm_executor_.Shutdown(); accept_loops_runner_.Shutdown(); + + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost)) { + instant_on_lost_manager_.Shutdown(); + } } bool BleV2::IsAvailable() const { @@ -88,33 +116,32 @@ bool BleV2::StartAdvertising(const std::string& service_id, MutexLock lock(&mutex_); if (advertisement_bytes.Empty()) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Refusing to turn on BLE advertising. Empty advertisement data."; return false; } if (advertisement_bytes.size() > kMaxAdvertisementLength) { - NEARBY_LOG(INFO, - "Refusing to start BLE advertising because the advertisement " - "was too long. Expected at most %d bytes but received %d.", - kMaxAdvertisementLength, advertisement_bytes.size()); + LOG(INFO) << "Refusing to start BLE advertising because the " + "advertisement was too long. Expected at most " + << kMaxAdvertisementLength << " bytes but received " + << advertisement_bytes.size() << " bytes."; return false; } if (IsAdvertisingLocked(service_id)) { - NEARBY_LOGS(INFO) - << "Failed to BLE advertise because we're already advertising."; + LOG(INFO) << "Failed to BLE advertise because we're already advertising."; return false; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) - << "Can't start BLE scanning because Bluetooth was never turned on"; + LOG(INFO) + << "Can't start BLE advertising because Bluetooth was never turned on"; return false; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) << "Can't turn on BLE advertising. BLE is not available."; + LOG(INFO) << "Can't turn on BLE advertising. BLE is not available."; return false; } @@ -132,8 +159,8 @@ bool BleV2::StartAdvertising(const std::string& service_id, mediums::bleutils::GenerateDeviceToken(), psm}; if (!medium_advertisement.IsValid()) { - NEARBY_LOGS(INFO) << "Failed to BLE advertise because we could not wrap a " - "connection advertisement to medium advertisement."; + LOG(INFO) << "Failed to BLE advertise because we could not wrap a " + "connection advertisement to medium advertisement."; return false; } @@ -143,8 +170,13 @@ bool BleV2::StartAdvertising(const std::string& service_id, .power_level = power_level, .is_fast_advertisement = is_fast_advertisement}}); - // Stop the pre-existing BLE advertisement if there is one. - medium_.StopAdvertising(); + // TODO(hais): need to update here after cros support RAII StartAdvertising. + // After all platforms support RAII StartAdvertising, then we can stop + // advertising operations precisely without affect other advertising sessions. + // Currently, cros RAII StartAdvertising is not there yet. And the advertising + // for legacy device will be stopped from later StartAdvertising by this line + // below. Comment it out now. + // medium_.StopAdvertising(); if (!StartAdvertisingLocked(service_id)) { advertising_infos_.erase(service_id); @@ -156,14 +188,13 @@ bool BleV2::StartAdvertising(const std::string& service_id, bool BleV2::StopAdvertising(const std::string& service_id) { MutexLock lock(&mutex_); if (!IsAdvertisingLocked(service_id)) { - NEARBY_LOGS(INFO) << "Cannot stop BLE advertising for service_id=" - << service_id << " because it never started."; + LOG(INFO) << "Cannot stop BLE advertising for service_id=" << service_id + << " because it never started."; return false; } // Stop the BLE advertisement. We will restart it later if necessary. - NEARBY_LOGS(INFO) << "Turned off BLE advertising with service_id=" - << service_id; + LOG(INFO) << "Turned off BLE advertising with service_id=" << service_id; advertising_infos_.erase(service_id); medium_.StopAdvertising(); @@ -178,35 +209,39 @@ bool BleV2::StopAdvertising(const std::string& service_id) { ByteArray empty_value = {}; for (const auto& characteristic : hosted_gatt_characteristics_) { if (!gatt_server_->UpdateCharacteristic(characteristic, empty_value)) { - NEARBY_LOGS(ERROR) - << "Failed to clear characteristic uuid=" - << std::string(characteristic.uuid) - << " after stopping BLE advertisement for service_id=" - << service_id; + LOG(ERROR) << "Failed to clear characteristic uuid=" + << std::string(characteristic.uuid) + << " after stopping BLE advertisement for service_id=" + << service_id; } } hosted_gatt_characteristics_.clear(); } const std::string& new_service_id = advertising_infos_.begin()->first; if (!StartAdvertisingLocked(new_service_id)) { - NEARBY_LOGS(ERROR) - << "Failed to restart BLE advertisement after stopping " - "BLE advertisement for new service_id=" - << new_service_id; + LOG(ERROR) << "Failed to restart BLE advertisement after stopping " + "BLE advertisement for new service_id=" + << new_service_id; advertising_infos_.erase(new_service_id); return false; } - NEARBY_LOGS(INFO) << "Restart BLE advertising with new service_id=" - << new_service_id; + LOG(INFO) << "Restart BLE advertising with new service_id=" + << new_service_id; } else if (incoming_sockets_.empty()) { // Otherwise, if we aren't restarting the BLE advertisement, then shutdown // the gatt server if it's not in use. - NEARBY_LOGS(VERBOSE) << "Aggressively stopping any pre-existing " - "advertisement GATT servers " - "because no incoming BLE sockets are connected."; + VLOG(1) << "Aggressively stopping any pre-existing " + "advertisement GATT servers " + "because no incoming BLE sockets are connected."; StopAdvertisementGattServerLocked(); } + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost)) { + instant_on_lost_manager_.OnAdvertisingStopped(service_id); + } + return true; } @@ -216,30 +251,120 @@ bool BleV2::IsAdvertising(const std::string& service_id) const { return IsAdvertisingLocked(service_id); } +bool BleV2::IsAdvertisingForLegacyDevice(const std::string& service_id) const { + MutexLock lock(&mutex_); + + return IsAdvertisingForLegacyDeviceLocked(service_id); +} + +bool BleV2::StartLegacyAdvertising( + const std::string& input_service_id, const std::string& local_endpoint_id, + const std::string& fast_advertisement_service_uuid) { + LOG(INFO) << "StartLegacyAdvertising: " << input_service_id + << ", local_endpoint_id: " << local_endpoint_id; + MutexLock lock(&mutex_); + + if (!radio_.IsEnabled()) { + LOG(INFO) << "Can't start BLE v2 legacy advertising because " + "Bluetooth was never turned on"; + return false; + } + if (!IsAvailableLocked()) { + LOG(INFO) + << "Can't turn on BLE v2 legacy advertising. BLE is not available."; + return false; + } + if (medium_.IsExtendedAdvertisementsAvailable()) { + LOG(INFO) << "Skip dummy advertising for non legacy device"; + return true; + } + std::string service_id = input_service_id + "-Legacy"; + if (service_ids_to_advertising_sessions_.find(service_id) != + service_ids_to_advertising_sessions_.end()) { + LOG(INFO) << "Already started legacy device advertising for " << service_id; + return false; + } + + std::unique_ptr + legacy_device_advertizing_session = medium_.StartAdvertising( + CreateAdvertisingDataForLegacyDevice(), + {.tx_power_level = TxPowerLevel::kMedium, .is_connectable = true}, + api::ble_v2::BleMedium::AdvertisingCallback{ + .start_advertising_result = + [this, &service_id](absl::Status status) mutable { + AssumeHeld(mutex_); + if (status.ok()) { + LOG(INFO) + << "BLE V2 advertising for legacy device started " + "successfully for service ID " + << &service_id; + } else { + LOG(ERROR) << "BLE V2 advertising for legacy " + "device failed for service ID " + << &service_id << ": " << status; + service_ids_to_advertising_sessions_.erase(service_id); + } + }, + }); + if (legacy_device_advertizing_session == nullptr) { + LOG(ERROR) << "Failed to turn on BLE v2 advertising for legacy " + "device for service ID " + << service_id; + return false; + } + + service_ids_to_advertising_sessions_.insert( + {std::string(service_id), std::move(legacy_device_advertizing_session)}); + return true; +} + +bool BleV2::StopLegacyAdvertising(const std::string& input_service_id) { + LOG(INFO) << "StopLegacyAdvertising:" << input_service_id; + MutexLock lock(&mutex_); + + std::string service_id = input_service_id + "-Legacy"; + auto legacy_device_advertising_session = + service_ids_to_advertising_sessions_.find(service_id); + if (legacy_device_advertising_session == + service_ids_to_advertising_sessions_.end()) { + LOG(INFO) << "Can't find session to turn off legacy device BLE " + "advertisingfor this service ID: " + << service_id; + return false; + } + absl::Status status = + legacy_device_advertising_session->second->stop_advertising(); + + if (!status.ok()) { + LOG(WARNING) << "StopLegacyAdvertising error: " << status; + } + service_ids_to_advertising_sessions_.erase(legacy_device_advertising_session); + LOG(INFO) << "Removed advertising-session for " << service_id; + return status.ok(); +} + bool BleV2::StartScanning(const std::string& service_id, PowerLevel power_level, DiscoveredPeripheralCallback callback) { MutexLock lock(&mutex_); if (service_id.empty()) { - NEARBY_LOGS(INFO) << "Can not start BLE scanning with empty service id."; + LOG(INFO) << "Can not start BLE scanning with empty service id."; return false; } if (IsScanningLocked(service_id)) { - NEARBY_LOGS(INFO) << "Cannot start scan of BLE peripherals because " - "scanning is already in-progress."; + LOG(INFO) << "Cannot start scan of BLE peripherals because " + "scanning is already in-progress."; return false; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) - << "Can't start BLE scanning because Bluetooth is disabled"; + LOG(INFO) << "Can't start BLE scanning because Bluetooth is disabled"; return false; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) - << "Can't scan BLE peripherals because BLE isn't available."; + LOG(INFO) << "Can't scan BLE peripherals because BLE isn't available."; return false; } @@ -248,12 +373,16 @@ bool BleV2::StartScanning(const std::string& service_id, PowerLevel power_level, service_id, std::move(callback), mediums::bleutils::kCopresenceServiceUuid); + if (FeatureFlags::GetInstance().GetFlags().enable_ble_v2_async_scanning) { + return StartAsyncScanningLocked(service_id, power_level); + } + // Check if scan has been activated, if yes, no need to notify client // to scan again. if (!scanned_service_ids_.empty()) { scanned_service_ids_.insert(service_id); - NEARBY_LOGS(INFO) << "Turned on BLE scanning with service id=" << service_id - << " without start client scanning"; + LOG(INFO) << "Turned on BLE scanning with service id=" << service_id + << " without start client scanning"; return true; } @@ -273,30 +402,27 @@ bool BleV2::StartScanning(const std::string& service_id, PowerLevel power_level, discovered_peripheral_tracker_ .ProcessFoundBleAdvertisement( std::move(peripheral), advertisement_data, - { - .fetch_advertisements = - [&](BleV2Peripheral peripheral, - int num_slots, int psm, - const std::vector& - interesting_service_ids, - mediums::AdvertisementReadResult& - advertisement_read_result) { - // Th`mutex_` is already held here. Use - // `AssumeHeld` tell the thread - // annotation static analysis that - // `mutex_` is already exclusively - // locked. - AssumeHeld(mutex_); - ProcessFetchGattAdvertisementsRequest( - std::move(peripheral), num_slots, - psm, interesting_service_ids, - advertisement_read_result); - }, + [this](BleV2Peripheral peripheral, int num_slots, + int psm, + const std::vector& + interesting_service_ids, + mediums::AdvertisementReadResult& + advertisement_read_result) { + // Th`mutex_` is already held here. Use + // `AssumeHeld` tell the thread + // annotation static analysis that + // `mutex_` is already exclusively + // locked. + AssumeHeld(mutex_); + ProcessFetchGattAdvertisementsRequest( + std::move(peripheral), num_slots, psm, + interesting_service_ids, + advertisement_read_result); }); }); }, })) { - NEARBY_LOGS(INFO) << "Failed to start scan of BLE services."; + LOG(INFO) << "Failed to start scan of BLE services."; discovered_peripheral_tracker_.StopTracking(service_id); // Erase the service id that is just added. scanned_service_ids_.erase(service_id); @@ -316,21 +442,25 @@ bool BleV2::StartScanning(const std::string& service_id, PowerLevel power_level, }, peripheral_lost_timeout, &alarm_executor_, /*is_recurring=*/true); - NEARBY_LOGS(INFO) << "Turned on BLE scanning with service id=" << service_id; + LOG(INFO) << "Turned on BLE scanning with service id=" << service_id; return true; } bool BleV2::StopScanning(const std::string& service_id) { MutexLock lock(&mutex_); + if (FeatureFlags::GetInstance().GetFlags().enable_ble_v2_async_scanning) { + return StopAsyncScanningLocked(service_id); + } if (!IsScanningLocked(service_id)) { - NEARBY_LOGS(INFO) << "Can't turn off BLE scanning because we never " - "started scanning."; + LOG(INFO) << "Can't turn off BLE scanning because we never " + "started scanning."; return false; } discovered_peripheral_tracker_.StopTracking(service_id); - NEARBY_LOGS(INFO) << "Turned off BLE scanning with service id=" << service_id; + LOG(INFO) << "Turned off BLE scanning with service id=" << service_id; + scanned_service_ids_.erase(service_id); // If still has scanner, don't stop the client scanning. @@ -339,7 +469,7 @@ bool BleV2::StopScanning(const std::string& service_id) { } // If no more scanning activities, then stop client scanning. - NEARBY_LOGS(INFO) << "Turned off BLE client scanning"; + LOG(INFO) << "Turned off BLE client scanning"; if (lost_alarm_->IsValid()) { lost_alarm_->Cancel(); } @@ -357,35 +487,34 @@ bool BleV2::StartAcceptingConnections(const std::string& service_id, MutexLock lock(&mutex_); if (service_id.empty()) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Refusing to start accepting BLE connections with empty service id."; return false; } if (IsAcceptingConnectionsLocked(service_id)) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Refusing to start accepting BLE connections for " << service_id << " because another BLE peripheral socket is already in-progress."; return false; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) << "Can't start accepting BLE connections for " - << service_id << " because Bluetooth isn't enabled."; + LOG(INFO) << "Can't start accepting BLE connections for " << service_id + << " because Bluetooth isn't enabled."; return false; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) << "Can't start accepting BLE connections for " - << service_id << " because BLE isn't available."; + LOG(INFO) << "Can't start accepting BLE connections for " << service_id + << " because BLE isn't available."; return false; } BleV2ServerSocket server_socket = medium_.OpenServerSocket(service_id); if (!server_socket.IsValid()) { - NEARBY_LOGS(INFO) - << "Failed to start accepting Ble connections for service_id=" - << service_id; + LOG(INFO) << "Failed to start accepting Ble connections for service_id=" + << service_id; return false; } @@ -405,7 +534,7 @@ bool BleV2::StartAcceptingConnections(const std::string& service_id, while (true) { BleV2Socket client_socket = server_socket.Accept(); if (!client_socket.IsValid()) { - NEARBY_LOGS(WARNING) << "The client socket to accept is invalid."; + LOG(WARNING) << "The client socket to accept is invalid."; server_socket.Close(); break; } @@ -431,7 +560,7 @@ bool BleV2::StopAcceptingConnections(const std::string& service_id) { const auto it = server_sockets_.find(service_id); if (it == server_sockets_.end()) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Can't stop accepting BLE connections because it was never started."; return false; } @@ -453,8 +582,8 @@ bool BleV2::StopAcceptingConnections(const std::string& service_id) { // Finally, close the BleServerSocket. if (!listening_socket.Close().Ok()) { - NEARBY_LOGS(INFO) << "Failed to close Ble server socket for service_id=" - << service_id; + LOG(INFO) << "Failed to close Ble server socket for service_id=" + << service_id; return false; } @@ -474,19 +603,19 @@ BleV2Socket BleV2::Connect(const std::string& service_id, BleV2Socket socket; if (service_id.empty()) { - NEARBY_LOGS(INFO) << "Refusing to create client Ble socket because " - "service_id is empty."; + LOG(INFO) << "Refusing to create client Ble socket because " + "service_id is empty."; return socket; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) << "Can't create client Ble socket [service_id=" - << service_id << "]; Ble isn't available."; + LOG(INFO) << "Can't create client Ble socket [service_id=" << service_id + << "]; Ble isn't available."; return socket; } if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) << "Can't create client Ble socket due to cancel."; + LOG(INFO) << "Can't create client Ble socket due to cancel."; return socket; } @@ -494,8 +623,7 @@ BleV2Socket BleV2::Connect(const std::string& service_id, PowerLevelToTxPowerLevel(PowerLevel::kHighPower), peripheral, cancellation_flag); if (!socket.IsValid()) { - NEARBY_LOGS(INFO) << "Failed to Connect via Ble [service_id=" << service_id - << "]"; + LOG(INFO) << "Failed to Connect via Ble [service_id=" << service_id << "]"; } return socket; @@ -507,7 +635,17 @@ bool BleV2::IsAdvertisingLocked(const std::string& service_id) const { return advertising_infos_.contains(service_id); } +bool BleV2::IsAdvertisingForLegacyDeviceLocked( + const std::string& service_id) const { + return service_ids_to_advertising_sessions_.contains(service_id + "-Legacy"); +} + bool BleV2::IsScanningLocked(const std::string& service_id) const { + if (FeatureFlags::GetInstance().GetFlags().enable_ble_v2_async_scanning) { + // If using asynchronous scanning, check the corresponding map. + auto it = service_ids_to_scanning_sessions_.find(service_id); + return it != service_ids_to_scanning_sessions_.end(); + } return scanned_service_ids_.contains(service_id); } @@ -522,15 +660,15 @@ bool BleV2::IsAdvertisementGattServerRunningLocked() { bool BleV2::StartAdvertisementGattServerLocked( const std::string& service_id, const ByteArray& gatt_advertisement) { if (IsAdvertisementGattServerRunningLocked()) { - NEARBY_LOGS(INFO) << "Advertisement GATT server is not started because one " - "is already running."; + LOG(INFO) << "Advertisement GATT server is not started because one " + "is already running."; return false; } std::unique_ptr gatt_server = medium_.StartGattServer(/*ServerGattConnectionCallback=*/{}); if (!gatt_server || !gatt_server->IsValid()) { - NEARBY_LOGS(INFO) << "Unable to start an advertisement GATT server."; + LOG(INFO) << "Unable to start an advertisement GATT server."; return false; } @@ -558,7 +696,7 @@ bool BleV2::GenerateAdvertisementCharacteristic( absl::optional advertiement_uuid = mediums::bleutils::GenerateAdvertisementUuid(slot); if (!advertiement_uuid.has_value()) { - NEARBY_LOGS(INFO) << "Unable to generate advertisement uuid."; + LOG(INFO) << "Unable to generate advertisement uuid."; return false; } // NOLINTNEXTLINE(google3-legacy-absl-backports) @@ -567,13 +705,13 @@ bool BleV2::GenerateAdvertisementCharacteristic( mediums::bleutils::kCopresenceServiceUuid, *advertiement_uuid, permission, property); if (!gatt_characteristic.has_value()) { - NEARBY_LOGS(INFO) << "Unable to create and add a characterstic to the gatt " - "server for the advertisement."; + LOG(INFO) << "Unable to create and add a characterstic to the gatt " + "server for the advertisement."; return false; } if (!gatt_server.UpdateCharacteristic(gatt_characteristic.value(), gatt_advertisement)) { - NEARBY_LOGS(INFO) << "Unable to write a value to the GATT characteristic."; + LOG(INFO) << "Unable to write a value to the GATT characteristic."; return false; } hosted_gatt_characteristics_.insert(gatt_characteristic.value()); @@ -586,20 +724,20 @@ void BleV2::ProcessFetchGattAdvertisementsRequest( const std::vector& interesting_service_ids, mediums::AdvertisementReadResult& advertisement_read_result) { if (!peripheral.IsValid()) { - NEARBY_LOGS(INFO) << "Can't read from an advertisement GATT server because " - "ble peripheral is null."; + LOG(INFO) << "Can't read from an advertisement GATT server because " + "ble peripheral is null."; return; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) << "Can't read from an advertisement GATT server because " - "Bluetooth was never turned on."; + LOG(INFO) << "Can't read from an advertisement GATT server because " + "Bluetooth was never turned on."; return; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) << "Can't read from an advertisement GATT server because " - "BLE is not available."; + LOG(INFO) << "Can't read from an advertisement GATT server because " + "BLE is not available."; return; } @@ -636,7 +774,7 @@ void BleV2::ProcessFetchGattAdvertisementsRequest( } if (slot_characteristic_uuids.empty()) { // TODO(b/222392304): More test coverage. - NEARBY_LOGS(WARNING) << "GATT client doesn't have characteristics."; + LOG(WARNING) << "GATT client doesn't have characteristics."; advertisement_read_result.RecordLastReadStatus(false); return; } @@ -650,7 +788,7 @@ void BleV2::ProcessFetchGattAdvertisementsRequest( if (!gatt_client->DiscoverServiceAndCharacteristics( mediums::bleutils::kCopresenceServiceUuid, characteristic_uuids)) { // TODO(b/222392304): More test coverage. - NEARBY_LOGS(WARNING) << "GATT client doesn't have characteristics."; + LOG(WARNING) << "GATT client doesn't have characteristics."; advertisement_read_result.RecordLastReadStatus(false); return; } @@ -671,12 +809,13 @@ void BleV2::ProcessFetchGattAdvertisementsRequest( auto characteristic_byte = gatt_client->ReadCharacteristic(gatt_characteristic.value()); if (characteristic_byte.has_value()) { - advertisement_read_result.AddAdvertisement( - slot, ByteArray(characteristic_byte.value())); - NEARBY_LOGS(VERBOSE) << "Successfully read advertisement at slot=" - << slot; + if (!characteristic_byte->empty()) { + advertisement_read_result.AddAdvertisement( + slot, ByteArray(characteristic_byte.value())); + LOG(INFO) << "Successfully read advertisement at slot=" << slot; + } } else { - NEARBY_LOGS(WARNING) << "Can't read advertisement for slot=" << slot; + LOG(WARNING) << "Can't read advertisement for slot=" << slot; read_success = false; } // Whether or not we succeeded with this slot, we should try reading the @@ -690,8 +829,8 @@ void BleV2::ProcessFetchGattAdvertisementsRequest( bool BleV2::StopAdvertisementGattServerLocked() { if (!IsAdvertisementGattServerRunningLocked()) { - NEARBY_LOGS(INFO) << "Unable to stop the advertisement GATT server because " - "it's not running."; + LOG(INFO) << "Unable to stop the advertisement GATT server because " + "it's not running."; return false; } @@ -733,17 +872,29 @@ ByteArray BleV2::CreateAdvertisementHeader( advertisement_hash, psm)); } +api::ble_v2::BleAdvertisementData +BleV2::CreateAdvertisingDataForLegacyDevice() { + BleAdvertisementData advertising_data; + advertising_data.is_extended_advertisement = false; + + ByteArray encoded_bytes{ + mediums::DiscoveredPeripheralTracker::kDummyAdvertisementValue}; + + advertising_data.service_data.insert( + {mediums::bleutils::kCopresenceServiceUuid, encoded_bytes}); + return advertising_data; +} + bool BleV2::StartAdvertisingLocked(const std::string& service_id) { const auto it = advertising_infos_.find(service_id); if (it == advertising_infos_.end()) { - NEARBY_LOGS(WARNING) << "Failed to BLE advertise with service_id=" - << service_id; + LOG(WARNING) << "Failed to BLE advertise with service_id=" << service_id; return false; } const AdvertisingInfo& info = it->second; if (info.is_fast_advertisement) { - return StartFastAdvertisingLocked(info.power_level, + return StartFastAdvertisingLocked(service_id, info.power_level, info.medium_advertisement); } else { return StartRegularAdvertisingLocked(service_id, info.power_level, @@ -752,7 +903,7 @@ bool BleV2::StartAdvertisingLocked(const std::string& service_id) { } bool BleV2::StartFastAdvertisingLocked( - PowerLevel power_level, + const std::string& service_id, PowerLevel power_level, const mediums::BleAdvertisement& medium_advertisement) { // Begin building the fast BLE advertisement. BleAdvertisementData advertising_data; @@ -766,12 +917,19 @@ bool BleV2::StartFastAdvertisingLocked( advertising_data, {.tx_power_level = PowerLevelToTxPowerLevel(power_level), .is_connectable = true})) { - NEARBY_LOGS(ERROR) << "Failed to turn on BLE fast advertising with " - "advertisement bytes=" - << absl::BytesToHexString( - medium_advertisement_bytes.data()); + LOG(ERROR) << "Failed to turn on BLE fast advertising with " + "advertisement bytes=" + << absl::BytesToHexString(medium_advertisement_bytes.data()); return false; } + + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost)) { + instant_on_lost_manager_.OnAdvertisingStarted(service_id, + medium_advertisement_bytes); + } + return true; } @@ -799,14 +957,20 @@ bool BleV2::StartRegularAdvertisingLocked( {.tx_power_level = PowerLevelToTxPowerLevel(power_level), .is_connectable = true}); if (!extended_regular_advertisement_success) { - NEARBY_LOGS(ERROR) - << "Failed to turn on BLE extended regular advertising with " - "advertisement bytes=" - << absl::BytesToHexString(medium_advertisement_bytes.data()); + LOG(ERROR) << "Failed to turn on BLE extended regular advertising with " + "advertisement bytes=" + << absl::BytesToHexString(medium_advertisement_bytes.data()); + } else { + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost)) { + instant_on_lost_manager_.OnAdvertisingStarted( + service_id, medium_advertisement_bytes); + } } } - // Start GATT advertisement no matter extended advertisment succeeded or not. + // Start GATT advertisement no matter extended advertisement succeeded or not. // This is to ensure that legacy devices which don't support extended // advertisement can get the advertisement via GATT connection. bool gatt_advertisement_success = StartGattAdvertisingLocked( @@ -836,9 +1000,8 @@ bool BleV2::StartGattAdvertisingLocked( // remote device is indefinitely connected to this device's GATT server is // when it has a BLE socket connection. if (incoming_sockets_.empty()) { - NEARBY_LOGS(VERBOSE) - << "Aggressively stopping any pre-existing advertisement GATT " - "servers because no incoming BLE sockets are connected"; + VLOG(1) << "Aggressively stopping any pre-existing advertisement GATT " + "servers because no incoming BLE sockets are connected"; StopAdvertisementGattServerLocked(); } @@ -847,10 +1010,9 @@ bool BleV2::StartGattAdvertisingLocked( if (!IsAdvertisementGattServerRunningLocked()) { if (!StartAdvertisementGattServerLocked(service_id, medium_advertisement_bytes)) { - NEARBY_LOGS(ERROR) - << "Failed to turn on BLE GATT advertising for service_id=" - << service_id - << " because the advertisement GATT server failed to start."; + LOG(ERROR) << "Failed to turn on BLE GATT advertising for service_id=" + << service_id + << " because the advertisement GATT server failed to start."; return false; } } @@ -860,9 +1022,8 @@ bool BleV2::StartGattAdvertisingLocked( ByteArray advertisement_header_bytes = CreateAdvertisementHeader(psm, extended_advertisement_advertised); if (advertisement_header_bytes.Empty()) { - NEARBY_LOGS(ERROR) - << "Failed to turn on BLE GATT advertising because we could not " - "create an advertisement header."; + LOG(ERROR) << "Failed to turn on BLE GATT advertising because we could not " + "create an advertisement header."; // Failed to create an advertisement header, so stop the advertisement // GATT server. StopAdvertisementGattServerLocked(); @@ -877,16 +1038,139 @@ bool BleV2::StartGattAdvertisingLocked( advertising_data, {.tx_power_level = PowerLevelToTxPowerLevel(power_level), .is_connectable = true})) { - NEARBY_LOGS(ERROR) << "Failed to turn on BLE GATT advertising with " - "advertisement bytes=" - << absl::BytesToHexString( - medium_advertisement_bytes.data()); + LOG(ERROR) << "Failed to turn on BLE GATT advertising with " + "advertisement bytes=" + << absl::BytesToHexString(medium_advertisement_bytes.data()); // If BLE advertising was not successful, stop the advertisement GATT // server. StopAdvertisementGattServerLocked(); return false; } + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost)) { + for (const auto& item : advertising_data.service_data) { + instant_on_lost_manager_.OnAdvertisingStarted(service_id, item.second); + } + } + + return true; +} + +bool BleV2::StartAsyncScanningLocked(absl::string_view service_id, + PowerLevel power_level) { + CHECK(FeatureFlags::GetInstance().GetFlags().enable_ble_v2_async_scanning); + + // Use the asynchronous StartScanning method instead of the synchronous one. + // Note: using FeatureFlags instead of NearbyFlags as there is no Mendel + // experiment associated with this change, which was driven by ChromeOS. + + // Should we check if the map is not empty, and forego scanning if true? + // If so, do we store a nullptr instead of a scanning session ptr? + + auto scanning_session = medium_.StartScanning( + mediums::bleutils::kCopresenceServiceUuid, + PowerLevelToTxPowerLevel(power_level), + api::ble_v2::BleMedium::ScanningCallback{ + .start_scanning_result = + [this, &service_id](absl::Status status) mutable { + // The `mutex_` is already held here. Use + // `AssumeHeld` to tell the thread + // annotation static analysis that + // `mutex_` is already exclusively + // locked. + // Note: unsure if this is always the case, but when I + // attempted to acquire the lock here I hit a deadlock. + AssumeHeld(mutex_); + if (status.ok()) { + LOG(INFO) << "BLE V2 async StartScanning started " + "successfully for service ID" + << &service_id; + } else { + LOG(ERROR) << "BLE V2 async StartScanning " + "failed for service ID" + << &service_id << ": " << status; + service_ids_to_scanning_sessions_.erase(service_id); + } + }, + .advertisement_found_cb = + [this](api::ble_v2::BlePeripheral& peripheral, + BleAdvertisementData advertisement_data) { + AssumeHeld(mutex_); + BleV2Peripheral proxy(medium_, peripheral); + RunOnBleThread([this, proxy = std::move(proxy), + advertisement_data]() { + MutexLock lock(&mutex_); + discovered_peripheral_tracker_.ProcessFoundBleAdvertisement( + std::move(proxy), advertisement_data, + [this](BleV2Peripheral proxy, int num_slots, int psm, + const std::vector& + interesting_service_ids, + mediums::AdvertisementReadResult& + advertisement_read_result) { + // The `mutex_` is already held here. Use + // `AssumeHeld` to tell the thread + // annotation static analysis that + // `mutex_` is already exclusively + // locked. + AssumeHeld(mutex_); + ProcessFetchGattAdvertisementsRequest( + std::move(proxy), num_slots, psm, + interesting_service_ids, advertisement_read_result); + }); + }); + }, + .advertisement_lost_cb = + [](api::ble_v2::BlePeripheral& peripheral) { + // TODO(b/345514862): Implement. + }, + }); + service_ids_to_scanning_sessions_.insert( + {std::string(service_id), std::move(scanning_session)}); + LOG(INFO) << "Requested to start BLE scanning with service id=" << service_id + << " size " << service_ids_to_scanning_sessions_.size(); + + if (lost_alarm_ != nullptr && lost_alarm_->IsValid()) { + // We only use one lost alarm, which will check all service IDs for lost + // advertisements. + return true; + } + + absl::Duration peripheral_lost_timeout = + absl::Milliseconds(NearbyFlags::GetInstance().GetInt64Flag( + config_package_nearby::nearby_connections_feature:: + kBlePeripheralLostTimeoutMillis)); + // Set up lost alarm. + lost_alarm_ = std::make_unique( + "BLE.StartScanning() onLost", + [this]() { + MutexLock lock(&mutex_); + discovered_peripheral_tracker_.ProcessLostGattAdvertisements(); + }, + peripheral_lost_timeout, &alarm_executor_, /*is_recurring=*/true); + return true; +} + +bool BleV2::StopAsyncScanningLocked(absl::string_view service_id) { + CHECK(FeatureFlags::GetInstance().GetFlags().enable_ble_v2_async_scanning); + // If using asynchronous scanning, check the corresponding map. + auto scanning_session = service_ids_to_scanning_sessions_.find(service_id); + if (scanning_session == service_ids_to_scanning_sessions_.end()) { + LOG(INFO) << "Can't turn off async BLE scanning because we never " + "started scanning for this service ID."; + return false; + } + absl::Status status = scanning_session->second->stop_scanning(); + if (!status.ok()) { + LOG(WARNING) << "StopAsyncScanningLocked error: " << status; + } + service_ids_to_scanning_sessions_.erase(scanning_session); + + LOG(INFO) << "Turned off BLE client scanning"; + if (lost_alarm_->IsValid()) { + lost_alarm_->Cancel(); + } return true; } diff --git a/connections/implementation/mediums/ble_v2.h b/connections/implementation/mediums/ble_v2.h index 0040dbd0..2879cd55 100644 --- a/connections/implementation/mediums/ble_v2.h +++ b/connections/implementation/mediums/ble_v2.h @@ -20,21 +20,29 @@ #include #include +#include "absl/base/thread_annotations.h" #include "absl/container/btree_map.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" #include "connections/implementation/mediums/ble_v2/advertisement_read_result.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement.h" +#include "connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h" #include "connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h" +#include "connections/implementation/mediums/ble_v2/instant_on_lost_manager.h" #include "connections/implementation/mediums/bluetooth_radio.h" #include "connections/power_level.h" #include "internal/platform/ble_v2.h" #include "internal/platform/bluetooth_adapter.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/implementation/ble_v2.h" #include "internal/platform/multi_thread_executor.h" #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/runnable.h" #include "internal/platform/scheduled_executor.h" #include "internal/platform/single_thread_executor.h" @@ -78,6 +86,21 @@ class BleV2 final { bool IsAdvertising(const std::string& service_id) const ABSL_LOCKS_EXCLUDED(mutex_); + bool IsAdvertisingForLegacyDevice(const std::string& service_id) const + ABSL_LOCKS_EXCLUDED(mutex_); + + // Use dummy bytes to do ble advertising, only for legacy devices. + // Returns true, if data is successfully set, and false otherwise. + bool StartLegacyAdvertising( + const std::string& service_id, const std::string& local_endpoint_id, + const std::string& fast_advertisement_service_uuid) + ABSL_LOCKS_EXCLUDED(mutex_); + + // (TODO:hais) update this after ble_v2 async api refactor. + // Stop Ble advertising with dummy bytes for legagy device. + bool StopLegacyAdvertising(const std::string& service_id) + ABSL_LOCKS_EXCLUDED(mutex_); + // Enables BLE scanning for a service ID. Will report any discoverable // advertisement data through a callback. // Returns true, if the scanning is successfully enabled, false otherwise. @@ -124,6 +147,12 @@ class BleV2 final { return medium_.IsValid(); } + // Returns true if the BLE device support extended advertisement. + bool IsExtendedAdvertisementsAvailable() ABSL_LOCKS_EXCLUDED(mutex_) { + MutexLock lock(&mutex_); + return medium_.IsExtendedAdvertisementsAvailable(); + }; + private: struct AdvertisingInfo { mediums::BleAdvertisement medium_advertisement; @@ -138,6 +167,11 @@ class BleV2 final { bool IsAdvertisingLocked(const std::string& service_id) const ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + // Same as IsAdvertisingForLegacyDevice(), but must be called with `mutex_` + // held. + bool IsAdvertisingForLegacyDeviceLocked(const std::string& service_id) const + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + // Same as IsScanning(), but must be called with `mutex_` held. bool IsScanningLocked(const std::string& service_id) const ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); @@ -167,10 +201,14 @@ class BleV2 final { ByteArray CreateAdvertisementHeader(int psm, bool extended_advertisement_advertised) ABSL_SHARED_LOCKS_REQUIRED(mutex_); + + // For devices that don't have extended nor gatt adverting. + api::ble_v2::BleAdvertisementData CreateAdvertisingDataForLegacyDevice(); + bool StartAdvertisingLocked(const std::string& service_id) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); bool StartFastAdvertisingLocked( - PowerLevel power_level, + const std::string& service_id, PowerLevel power_level, const mediums::BleAdvertisement& medium_advertisement) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); bool StartRegularAdvertisingLocked( @@ -182,6 +220,13 @@ class BleV2 final { const ByteArray& medium_advertisement_bytes, bool extended_advertisement_advertised) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + // Called by StartScanning when using the async methods. + bool StartAsyncScanningLocked(absl::string_view service_id, + PowerLevel power_level) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + // Called by StartScanning when using the async methods. + bool StopAsyncScanningLocked(absl::string_view service_id) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); api::ble_v2::TxPowerLevel PowerLevelToTxPowerLevel(PowerLevel power_level); @@ -204,6 +249,16 @@ class BleV2 final { absl::flat_hash_set hosted_gatt_characteristics_ ABSL_GUARDED_BY(mutex_); absl::flat_hash_set scanned_service_ids_ ABSL_GUARDED_BY(mutex_); + // This map has the same purpose as the set above, but is used only by + // the async StartScanning method. + absl::flat_hash_map> + service_ids_to_scanning_sessions_ ABSL_GUARDED_BY(mutex_); + // Save advertising sessions by service id, used by the async StartAdvertising + // method. + absl::flat_hash_map< + std::string, std::unique_ptr> + service_ids_to_advertising_sessions_ ABSL_GUARDED_BY(mutex_); std::unique_ptr lost_alarm_; mediums::DiscoveredPeripheralTracker discovered_peripheral_tracker_ ABSL_GUARDED_BY(mutex_){medium_.IsExtendedAdvertisementsAvailable()}; @@ -221,6 +276,8 @@ class BleV2 final { // it's okay to restart GATT server related operations. absl::flat_hash_map incoming_sockets_ ABSL_GUARDED_BY(mutex_); + + mediums::InstantOnLostManager instant_on_lost_manager_; }; } // namespace connections diff --git a/connections/implementation/mediums/ble_v2/BUILD b/connections/implementation/mediums/ble_v2/BUILD index 17241f9e..288a65d3 100644 --- a/connections/implementation/mediums/ble_v2/BUILD +++ b/connections/implementation/mediums/ble_v2/BUILD @@ -11,6 +11,7 @@ # 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. + licenses(["notice"]) cc_library( @@ -23,6 +24,8 @@ cc_library( "ble_utils.cc", "bloom_filter.cc", "discovered_peripheral_tracker.cc", + "instant_on_lost_advertisement.cc", + "instant_on_lost_manager.cc", ], hdrs = [ "advertisement_read_result.h", @@ -33,13 +36,14 @@ cc_library( "bloom_filter.h", "discovered_peripheral_callback.h", "discovered_peripheral_tracker.h", + "instant_on_lost_advertisement.h", + "instant_on_lost_manager.h", ], copts = ["-DCORE_ADAPTER_DLL"], visibility = [ "//connections/implementation:__subpackages__", ], deps = [ - "//connections:core_types", "//connections/implementation/flags:connections_flags", "//connections/implementation/mediums:utils", "//internal/flags:nearby_flags", @@ -48,12 +52,16 @@ cc_library( "//internal/platform:types", "//internal/platform:util", "//internal/platform:uuid", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", "//proto/mediums:ble_frames_cc_proto", "@aappleby_smhasher//:libmurmur3", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/numeric:int128", + "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", @@ -72,19 +80,30 @@ cc_test( "ble_utils_test.cc", "bloom_filter_test.cc", "discovered_peripheral_tracker_test.cc", + "instant_on_lost_advertisement_test.cc", + "instant_on_lost_manager_test.cc", ], deps = [ ":ble_v2", + "//connections/implementation/flags:connections_flags", + "//connections/implementation/mediums:utils", + "//internal/flags:nearby_flags", "//internal/platform:base", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", + "//internal/platform:uuid", + "//internal/platform/implementation:comm", "//internal/platform/implementation/g3", # buildcleaner: keep "//proto/mediums:ble_frames_cc_proto", "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/hash:hash_testing", + "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings:string_view", "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", "@com_google_googletest//:gtest_main", ], ) diff --git a/connections/implementation/mediums/ble_v2/ble_advertisement.cc b/connections/implementation/mediums/ble_v2/ble_advertisement.cc index 3abb8a79..d4b81b76 100644 --- a/connections/implementation/mediums/ble_v2/ble_advertisement.cc +++ b/connections/implementation/mediums/ble_v2/ble_advertisement.cc @@ -20,9 +20,12 @@ #include #include +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" #include "internal/platform/base_input_stream.h" +#include "internal/platform/byte_array.h" #include "internal/platform/logging.h" namespace nearby { @@ -81,92 +84,85 @@ void BleAdvertisement::DoInitialize(bool fast_advertisement, Version version, psm_ = psm; } -BleAdvertisement::BleAdvertisement(const ByteArray &ble_advertisement_bytes) { +absl::StatusOr BleAdvertisement::CreateBleAdvertisement( + const ByteArray &ble_advertisement_bytes) { if (ble_advertisement_bytes.Empty()) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: null bytes passed in."); - return; + return absl::InvalidArgumentError( + "Cannot deserialize BleAdvertisement: null bytes passed in."); } if (ble_advertisement_bytes.size() < kVersionLength) { - NEARBY_LOG( - INFO, - "Cannot deserialize BleAdvertisement: expecting min %d raw bytes to " - "parse the version, got %" PRIu64, - kVersionLength, ble_advertisement_bytes.size()); - return; + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: expecting min ", kVersionLength, + " bytes, got ", ble_advertisement_bytes.size())); } - ByteArray advertisement_bytes{ble_advertisement_bytes}; - BaseInputStream base_input_stream{advertisement_bytes}; + ByteArray advertisement_bytes(ble_advertisement_bytes); + BaseInputStream base_input_stream(advertisement_bytes); // The first 1 byte is supposed to be the version, socket version and the fast // advertisement flag. auto version_byte = static_cast(base_input_stream.ReadUint8()); - // Version. - version_ = static_cast((version_byte & kVersionBitmask) >> 5); - if (!IsSupportedVersion(version_)) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: unsupported Version %u", - version_); - return; + Version version = static_cast((version_byte & kVersionBitmask) >> 5); + if (!IsSupportedVersion(version)) { + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: unsupported Version ", version)); } - // Socket version. - socket_version_ = + SocketVersion socket_version = static_cast((version_byte & kSocketVersionBitmask) >> 2); - if (!IsSupportedSocketVersion(socket_version_)) { - NEARBY_LOG( - INFO, - "Cannot deserialize BleAdvertisement: unsupported SocketVersion %u", - socket_version_); - version_ = Version::kUndefined; - return; + if (!IsSupportedSocketVersion(socket_version)) { + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: unsupported SocketVersion ", + socket_version)); } - // Fast advertisement flag. - fast_advertisement_ = + bool fast_advertisement = static_cast((version_byte & kFastAdvertisementFlagBitmask) >> 1); // The next 3 bytes are supposed to be the service_id_hash if not fast // advertisement. - if (!fast_advertisement_) { - service_id_hash_ = base_input_stream.ReadBytes(kServiceIdHashLength); + ByteArray service_id_hash; + if (!fast_advertisement) { + service_id_hash = base_input_stream.ReadBytes(kServiceIdHashLength); } // Data length. int expected_data_size = - fast_advertisement_ + fast_advertisement ? static_cast( base_input_stream.ReadBytes(kFastDataSizeLength).data()[0]) : static_cast(base_input_stream.ReadUint32()); if (expected_data_size < 0) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: negative data size %d", - expected_data_size); - version_ = Version::kUndefined; - return; + return absl::InvalidArgumentError( + absl::StrCat("Cannot deserialize BleAdvertisement: negative data size ", + expected_data_size)); } // Data. // Check that the stated data size is the same as what we received. - data_ = base_input_stream.ReadBytes(expected_data_size); - if (data_.size() != expected_data_size) { - NEARBY_LOG(INFO, - "Cannot deserialize BleAdvertisement: expected data to be %u " - "bytes, got %" PRIu64 " bytes ", - expected_data_size, data_.size()); - version_ = Version::kUndefined; - return; + auto data = base_input_stream.ReadBytes(expected_data_size); + if (data.size() != expected_data_size) { + return absl::InvalidArgumentError(absl::StrCat( + "Cannot deserialize BleAdvertisement: expected data to be ", + expected_data_size, " bytes, got ", data.size())); } + BleAdvertisement ble_advertisement; + ble_advertisement.version_ = version; + ble_advertisement.socket_version_ = socket_version; + ble_advertisement.fast_advertisement_ = fast_advertisement; + ble_advertisement.service_id_hash_ = service_id_hash; + ble_advertisement.data_ = data; + // Device token. If the number of remaining bytes are valid for device token, // then read it. if (base_input_stream.IsAvailable(kDeviceTokenLength)) { - device_token_ = base_input_stream.ReadBytes(kDeviceTokenLength); + ble_advertisement.device_token_ = + base_input_stream.ReadBytes(kDeviceTokenLength); } else { // No device token no more optional field. - return; + return ble_advertisement; } // Extra fields, for backward compatible reason, put this field in the end of @@ -178,8 +174,9 @@ BleAdvertisement::BleAdvertisement(const ByteArray &ble_advertisement_bytes) { if (base_input_stream.IsAvailable(extra_fields_byte_number)) { BleExtraFields extra_fields{ base_input_stream.ReadBytes(extra_fields_byte_number)}; - psm_ = extra_fields.GetPsm(); + ble_advertisement.psm_ = extra_fields.GetPsm(); } + return ble_advertisement; } BleAdvertisement::operator ByteArray() const { @@ -243,12 +240,11 @@ bool BleAdvertisement::operator==(const BleAdvertisement &rhs) const { this->GetPsm() == rhs.GetPsm(); } -bool BleAdvertisement::IsSupportedVersion(Version version) const { +bool BleAdvertisement::IsSupportedVersion(Version version) { return version >= Version::kV1 && version <= Version::kV2; } -bool BleAdvertisement::IsSupportedSocketVersion( - SocketVersion socket_version) const { +bool BleAdvertisement::IsSupportedSocketVersion(SocketVersion socket_version) { return socket_version >= SocketVersion::kV1 && socket_version <= SocketVersion::kV2; } diff --git a/connections/implementation/mediums/ble_v2/ble_advertisement.h b/connections/implementation/mediums/ble_v2/ble_advertisement.h index 94a20aa6..5a470584 100644 --- a/connections/implementation/mediums/ble_v2/ble_advertisement.h +++ b/connections/implementation/mediums/ble_v2/ble_advertisement.h @@ -17,6 +17,7 @@ #include +#include "absl/status/statusor.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" #include "internal/platform/byte_array.h" @@ -73,7 +74,9 @@ class BleAdvertisement { const ByteArray &service_id_hash, const ByteArray &data, const ByteArray &device_token, int psm = BleAdvertisementHeader::kDefaultPsmValue); - explicit BleAdvertisement(const ByteArray &ble_advertisement_bytes); + + static absl::StatusOr CreateBleAdvertisement( + const ByteArray &ble_advertisement_bytes); BleAdvertisement(const BleAdvertisement &) = default; BleAdvertisement &operator=(const BleAdvertisement &) = default; BleAdvertisement(BleAdvertisement &&) = default; @@ -128,8 +131,8 @@ class BleAdvertisement { SocketVersion socket_version, const ByteArray &service_id_hash, const ByteArray &data, const ByteArray &device_token, int psm); - bool IsSupportedVersion(Version version) const; - bool IsSupportedSocketVersion(SocketVersion socket_version) const; + static bool IsSupportedVersion(Version version); + static bool IsSupportedSocketVersion(SocketVersion socket_version); void SerializeDataSize(bool fast_advertisement, char *data_size_bytes_write_ptr, size_t data_size) const; diff --git a/connections/implementation/mediums/ble_v2/ble_advertisement_header.cc b/connections/implementation/mediums/ble_v2/ble_advertisement_header.cc index d9e31774..c04b62ee 100644 --- a/connections/implementation/mediums/ble_v2/ble_advertisement_header.cc +++ b/connections/implementation/mediums/ble_v2/ble_advertisement_header.cc @@ -70,25 +70,22 @@ BleAdvertisementHeader::BleAdvertisementHeader( kMinAdvertisementHeaderLength + 2) { advertisement_header_bytes = ble_advertisement_header_bytes; } else { - NEARBY_LOG(WARNING, - "Cannot deserialize BLEAdvertisementHeader. Invalid " - "advertising data."); + NEARBY_VLOG(1) << "Cannot deserialize BLEAdvertisementHeader. " + "Invalid advertising data."; return; } } else { - NEARBY_LOG( - ERROR, - "Cannot deserialize BLEAdvertisementHeader: failed Base64 decoding"); + NEARBY_LOGS(ERROR) << "Cannot deserialize BLEAdvertisementHeader: failed " + "Base64 decoding"; return; } } if (advertisement_header_bytes.size() < kMinAdvertisementHeaderLength) { - NEARBY_LOG(ERROR, - "Cannot deserialize BleAdvertisementHeader: expecting min %u " - "raw bytes, got %" PRIu64 " instead", - kMinAdvertisementHeaderLength, - advertisement_header_bytes.size()); + NEARBY_LOGS(ERROR) + << "Cannot deserialize BleAdvertisementHeader: expecting min " + << kMinAdvertisementHeaderLength << "raw bytes, got " + << advertisement_header_bytes.size(); return; } @@ -100,10 +97,9 @@ BleAdvertisementHeader::BleAdvertisementHeader( version_ = static_cast((version_and_num_slots_byte & kVersionBitmask) >> 5); if (version_ != Version::kV2) { - NEARBY_LOG( - ERROR, - "Cannot deserialize BleAdvertisementHeader: unsupported Version %d", - version_); + NEARBY_LOGS(ERROR) + << "Cannot deserialize BleAdvertisementHeader: unsupported Version " + << static_cast(version_); return; } // The next 1 bit is supposed to be the extended advertisement flag. diff --git a/connections/implementation/mediums/ble_v2/ble_advertisement_test.cc b/connections/implementation/mediums/ble_v2/ble_advertisement_test.cc index 99131eb6..4ef352d6 100644 --- a/connections/implementation/mediums/ble_v2/ble_advertisement_test.cc +++ b/connections/implementation/mediums/ble_v2/ble_advertisement_test.cc @@ -17,8 +17,13 @@ #include #include +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/hash/hash_testing.h" +#include "absl/status/status.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" namespace nearby { namespace connections { @@ -40,6 +45,9 @@ constexpr size_t kAdvertisementLength = 77; constexpr size_t kFastAdvertisementLength = 16; constexpr size_t kLongAdvertisementLength = kAdvertisementLength + 1000; +using ::absl::StatusCode::kInvalidArgument; +using ::testing::status::StatusIs; + TEST(BleAdvertisementTest, ConstructionWorksV1) { ByteArray service_id_hash{std::string(kServiceIDHashBytes)}; ByteArray data{std::string(kData)}; @@ -224,7 +232,11 @@ TEST(BleAdvertisementTest, ConstructionFromSerializedBytesWorks) { kVersion, kSocketVersion, service_id_hash, data, device_token}; ByteArray ble_advertisement_bytes{original_ble_advertisement}; - BleAdvertisement ble_advertisement{ble_advertisement_bytes}; + + auto ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(ble_advertisement_bytes); + ASSERT_OK(ble_advertisement_status_or.status()); + auto ble_advertisement = ble_advertisement_status_or.value(); EXPECT_TRUE(ble_advertisement.IsValid()); EXPECT_FALSE(ble_advertisement.IsFastAdvertisement()); @@ -245,7 +257,11 @@ TEST(BleAdvertisementTest, kVersion, kSocketVersion, ByteArray{}, fast_data, device_token}; ByteArray ble_advertisement_bytes{original_ble_advertisement}; - BleAdvertisement ble_advertisement{ble_advertisement_bytes}; + + auto ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(ble_advertisement_bytes); + ASSERT_OK(ble_advertisement_status_or.status()); + auto ble_advertisement = ble_advertisement_status_or.value(); EXPECT_TRUE(ble_advertisement.IsValid()); EXPECT_TRUE(ble_advertisement.IsFastAdvertisement()); @@ -263,7 +279,11 @@ TEST(BleAdvertisementTest, ConstructionFromSerializedBytesWithEmptyDataWorks) { BleAdvertisement original_ble_advertisement{ kVersion, kSocketVersion, service_id_hash, ByteArray(), device_token}; ByteArray ble_advertisement_bytes{original_ble_advertisement}; - BleAdvertisement ble_advertisement{ble_advertisement_bytes}; + + auto ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(ble_advertisement_bytes); + ASSERT_OK(ble_advertisement_status_or.status()); + auto ble_advertisement = ble_advertisement_status_or.value(); EXPECT_TRUE(ble_advertisement.IsValid()); EXPECT_FALSE(ble_advertisement.IsFastAdvertisement()); @@ -281,7 +301,11 @@ TEST(BleAdvertisementTest, BleAdvertisement original_ble_advertisement{ kVersion, kSocketVersion, ByteArray{}, ByteArray(), device_token}; ByteArray ble_advertisement_bytes{original_ble_advertisement}; - BleAdvertisement ble_advertisement{ble_advertisement_bytes}; + + auto ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(ble_advertisement_bytes); + ASSERT_OK(ble_advertisement_status_or.status()); + auto ble_advertisement = ble_advertisement_status_or.value(); EXPECT_TRUE(ble_advertisement.IsValid()); EXPECT_TRUE(ble_advertisement.IsFastAdvertisement()); @@ -310,7 +334,11 @@ TEST(BleAdvertisementTest, ConstructionFromExtraSerializedBytesWorks) { // Re-parse the Ble advertisement using our extra long advertisement bytes. ByteArray long_ble_advertisement_bytes{raw_ble_advertisement_bytes, kLongAdvertisementLength}; - BleAdvertisement long_ble_advertisement{long_ble_advertisement_bytes}; + + auto long_ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(long_ble_advertisement_bytes); + ASSERT_OK(long_ble_advertisement_status_or.status()); + auto long_ble_advertisement = long_ble_advertisement_status_or.value(); EXPECT_TRUE(long_ble_advertisement.IsValid()); EXPECT_FALSE(long_ble_advertisement.IsFastAdvertisement()); @@ -341,7 +369,11 @@ TEST(BleAdvertisementTest, // Re-parse the Ble advertisement using our extra long advertisement bytes. ByteArray long_ble_advertisement_bytes{raw_ble_advertisement_bytes, kLongAdvertisementLength}; - BleAdvertisement long_ble_advertisement{long_ble_advertisement_bytes}; + + auto long_ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(long_ble_advertisement_bytes); + ASSERT_OK(long_ble_advertisement_status_or.status()); + auto long_ble_advertisement = long_ble_advertisement_status_or.value(); EXPECT_TRUE(long_ble_advertisement.IsValid()); EXPECT_TRUE(long_ble_advertisement.IsFastAdvertisement()); @@ -353,9 +385,8 @@ TEST(BleAdvertisementTest, } TEST(BleAdvertisementTest, ConstructionFromNullBytesFails) { - BleAdvertisement ble_advertisement{ByteArray{}}; - - EXPECT_FALSE(ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement(ByteArray()), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, ConstructionFromShortLengthSerializedBytesFails) { @@ -370,9 +401,9 @@ TEST(BleAdvertisementTest, ConstructionFromShortLengthSerializedBytesFails) { // Cut off the advertisement so that it's too short. ByteArray short_ble_advertisement_bytes{ original_ble_advertisement_bytes.data(), 7}; - BleAdvertisement short_ble_advertisement{short_ble_advertisement_bytes}; - - EXPECT_FALSE(short_ble_advertisement.IsValid()); + EXPECT_THAT( + BleAdvertisement::CreateBleAdvertisement(short_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, @@ -387,9 +418,9 @@ TEST(BleAdvertisementTest, // Cut off the advertisement so that it's too short. ByteArray short_ble_advertisement_bytes{ original_ble_advertisement_bytes.data(), 2}; - BleAdvertisement short_ble_advertisement{short_ble_advertisement_bytes}; - - EXPECT_FALSE(short_ble_advertisement.IsValid()); + EXPECT_THAT( + BleAdvertisement::CreateBleAdvertisement(short_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, @@ -415,10 +446,9 @@ TEST(BleAdvertisementTest, // Try to parse the Ble advertisement using our corrupted advertisement bytes. ByteArray corrupted_ble_advertisement_bytes{raw_ble_advertisement_bytes, kAdvertisementLength}; - BleAdvertisement corrupted_ble_advertisement{ - corrupted_ble_advertisement_bytes}; - - EXPECT_FALSE(corrupted_ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement( + corrupted_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, @@ -443,10 +473,9 @@ TEST(BleAdvertisementTest, // Try to parse the Ble advertisement using our corrupted advertisement bytes. ByteArray corrupted_ble_advertisement_bytes{raw_ble_advertisement_bytes, kFastAdvertisementLength}; - BleAdvertisement corrupted_ble_advertisement{ - corrupted_ble_advertisement_bytes}; - - EXPECT_FALSE(corrupted_ble_advertisement.IsValid()); + EXPECT_THAT(BleAdvertisement::CreateBleAdvertisement( + corrupted_ble_advertisement_bytes), + StatusIs(kInvalidArgument)); } TEST(BleAdvertisementTest, ConstructionWorksWithPsmValue) { @@ -480,7 +509,11 @@ TEST(BleAdvertisementTest, kVersion, kSocketVersion, service_id_hash, data, device_token, psm); ByteArray ble_advertisement_bytes = original_ble_advertisement.ByteArrayWithExtraField(); - BleAdvertisement ble_advertisement(ble_advertisement_bytes); + + auto ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(ble_advertisement_bytes); + ASSERT_OK(ble_advertisement_status_or.status()); + auto ble_advertisement = ble_advertisement_status_or.value(); ASSERT_TRUE(ble_advertisement.IsValid()); EXPECT_FALSE(ble_advertisement.IsFastAdvertisement()); @@ -505,7 +538,11 @@ TEST(BleAdvertisementTest, // But use ByteArrayWithExtraField to restore back. It should fail. ByteArray ble_advertisement_bytes = original_ble_advertisement.ByteArrayWithExtraField(); - BleAdvertisement ble_advertisement(ble_advertisement_bytes); + + auto ble_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(ble_advertisement_bytes); + ASSERT_OK(ble_advertisement_status_or.status()); + auto ble_advertisement = ble_advertisement_status_or.value(); ASSERT_TRUE(ble_advertisement.IsValid()); EXPECT_FALSE(ble_advertisement.IsFastAdvertisement()); diff --git a/connections/implementation/mediums/ble_v2/ble_packet.cc b/connections/implementation/mediums/ble_v2/ble_packet.cc index ef837f9d..b9501c1f 100644 --- a/connections/implementation/mediums/ble_v2/ble_packet.cc +++ b/connections/implementation/mediums/ble_v2/ble_packet.cc @@ -122,15 +122,14 @@ absl::StatusOr BlePacket::CreateDataPacket( BlePacket::BlePacket(const ByteArray& ble_packet_bytes) { if (ble_packet_bytes.Empty()) { - NEARBY_LOG(ERROR, "Cannot deserialize BlePacket: null bytes passed in"); + NEARBY_LOGS(ERROR) << "Cannot deserialize BlePacket: null bytes passed in"; return; } if (ble_packet_bytes.size() < kServiceIdHashLength) { - NEARBY_LOG( - INFO, - "Cannot deserialize BlePacket: expecting min %u raw bytes, got %zu", - kServiceIdHashLength, ble_packet_bytes.size()); + NEARBY_LOGS(INFO) << "Cannot deserialize BlePacket: expecting min " + << kServiceIdHashLength << " raw bytes, got " + << ble_packet_bytes.size(); return; } diff --git a/connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h b/connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h index 5a190282..63378db6 100644 --- a/connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h +++ b/connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h @@ -15,9 +15,9 @@ #ifndef CORE_INTERNAL_MEDIUMS_BLE_V2_DISCOVERED_PERIPHERAL_CALLBACK_H_ #define CORE_INTERNAL_MEDIUMS_BLE_V2_DISCOVERED_PERIPHERAL_CALLBACK_H_ -#include #include +#include "absl/functional/any_invocable.h" #include "internal/platform/ble_v2.h" #include "internal/platform/byte_array.h" @@ -27,16 +27,22 @@ namespace mediums { // Callback that is invoked when a {@link BlePeripheral} is discovered. struct DiscoveredPeripheralCallback { - std::function + absl::AnyInvocable peripheral_discovered_cb = [](BleV2Peripheral, const std::string&, const ByteArray&, bool) {}; - std::function + absl::AnyInvocable peripheral_lost_cb = [](BleV2Peripheral, const std::string&, const ByteArray&, bool) {}; + absl::AnyInvocable + instant_lost_cb = + [](BleV2Peripheral, const std::string&, const ByteArray&, bool) {}; + absl::AnyInvocable legacy_device_discovered_cb = []() {}; }; } // namespace mediums diff --git a/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.cc b/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.cc index 806cf3dc..b1a8792d 100644 --- a/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.cc +++ b/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.cc @@ -21,26 +21,39 @@ #include #include +#include "absl/container/flat_hash_map.h" +#include "absl/status/statusor.h" #include "absl/strings/escaping.h" +#include "absl/time/time.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/mediums/ble_v2/advertisement_read_result.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" #include "connections/implementation/mediums/ble_v2/ble_utils.h" #include "connections/implementation/mediums/ble_v2/bloom_filter.h" +#include "connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h" +#include "connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h" +#include "connections/implementation/mediums/lost_entity_tracker.h" #include "internal/flags/nearby_flags.h" #include "internal/platform/ble_v2.h" #include "internal/platform/byte_array.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/system_clock.h" #include "internal/platform/logging.h" #include "internal/platform/multi_thread_executor.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/uuid.h" + +using ::nearby::api::ble_v2::BleAdvertisementData; namespace nearby { namespace connections { namespace mediums { namespace { constexpr int kGattThreadCount = 1; -} +constexpr absl::Duration kInstantLostAdvertisementTimeout = absl::Seconds(60); +} // namespace DiscoveredPeripheralTracker::DiscoveredPeripheralTracker( bool is_extended_advertisement_available) @@ -66,7 +79,7 @@ DiscoveredPeripheralTracker::~DiscoveredPeripheralTracker() { void DiscoveredPeripheralTracker::StartTracking( const std::string& service_id, - const DiscoveredPeripheralCallback& discovered_peripheral_callback, + DiscoveredPeripheralCallback discovered_peripheral_callback, const Uuid& fast_advertisement_service_uuid) { MutexLock lock(&mutex_); @@ -97,55 +110,131 @@ void DiscoveredPeripheralTracker::StopTracking(const std::string& service_id) { } void DiscoveredPeripheralTracker::ProcessFoundBleAdvertisement( - BleV2Peripheral peripheral, - ::nearby::api::ble_v2::BleAdvertisementData advertisement_data, + BleV2Peripheral peripheral, BleAdvertisementData advertisement_data, AdvertisementFetcher advertisement_fetcher) { MutexLock lock(&mutex_); if (service_id_infos_.empty()) { - NEARBY_LOGS(INFO) << "Ignoring BLE advertisement header because we are not " - "tracking any service IDs."; + LOG(INFO) << "Ignoring BLE advertisement header because we are not " + "tracking any service IDs."; return; } if (!peripheral.IsValid() || advertisement_data.service_data.empty()) { - NEARBY_LOGS(INFO) - << "Ignoring BLE advertisement header because the peripheral is " - "invalid or the given service data is empty."; + LOG(INFO) << "Ignoring BLE advertisement header because the peripheral is " + "invalid or the given service data is empty."; + return; + } + + if (HandleOnLostAdvertisementLocked(peripheral, advertisement_data)) { return; } if (IsSkippableGattAdvertisement(advertisement_data)) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Ignore GATT advertisement and wait for extended advertisement."; return; } + if (IsLegacyDeviceAdvertisementData(advertisement_data)) { + if (nearby::FeatureFlags::GetInstance() + .GetFlags() + .enable_invoking_legacy_device_discovered_cb) { + for (auto& itor : service_id_infos_) { + itor.second.discovered_peripheral_callback + .legacy_device_discovered_cb(); + } + } + return; + } HandleAdvertisement(peripheral, advertisement_data); HandleAdvertisementHeader(peripheral, advertisement_data, std::move(advertisement_fetcher)); } +bool DiscoveredPeripheralTracker::HandleOnLostAdvertisementLocked( + BleV2Peripheral peripheral, + const BleAdvertisementData& advertisement_data) { + auto service_data = + advertisement_data.service_data.find(bleutils::kCopresenceServiceUuid); + if (service_data == advertisement_data.service_data.end()) { + return false; + } + absl::StatusOr on_lost_advertisement = + InstantOnLostAdvertisement::CreateFromBytes( + service_data->second.AsStringView()); + if (!on_lost_advertisement.ok()) { + return false; + } + + LOG(INFO) << __func__ << ": Found OnLost advertisement for hash:" + << absl::BytesToHexString(on_lost_advertisement->ToBytes()); + + for (const auto& hash : on_lost_advertisement->hashes()) { + for (const auto& it : gatt_advertisement_infos_) { + if (it.second.advertisement_header.GetAdvertisementHash().string_data() == + hash) { + auto discovery_cb_it = service_id_infos_.find(it.second.service_id); + if (discovery_cb_it == service_id_infos_.end()) { + LOG(INFO) + << __func__ + << ": Discarding OnLost advertisement for untracked service_id"; + break; + } + + auto gatt_advertisements = + gatt_advertisements_[it.second.advertisement_header]; + + // Need to report OnLost for each gatt_advertisement. + for (const auto& gatt_advertisement : gatt_advertisements) { + BleV2Peripheral lost_peripheral = it.second.peripheral; + lost_peripheral.SetId(ByteArray(gatt_advertisement)); + if (gatt_advertisement.IsValid()) { + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableInstantOnLost)) { + AddInstantLostAdvertisement(it.second.advertisement_header); + discovery_cb_it->second.discovered_peripheral_callback + .instant_lost_cb(lost_peripheral, it.second.service_id, + gatt_advertisement.GetData(), + gatt_advertisement.IsFastAdvertisement()); + } else { + discovery_cb_it->second.discovered_peripheral_callback + .peripheral_lost_cb(lost_peripheral, it.second.service_id, + gatt_advertisement.GetData(), + gatt_advertisement.IsFastAdvertisement()); + } + LOG(INFO) << __func__ << ": OnLost triggered for service_id " + << it.second.service_id; + } + + ClearGattAdvertisement(gatt_advertisement); + } + break; + } + } + } + return true; +} + void DiscoveredPeripheralTracker::ProcessLostGattAdvertisements() { MutexLock lock(&mutex_); - for (const auto& it : service_id_infos_) { + for (auto& it : service_id_infos_) { const std::string& service_id = it.first; - const ServiceIdInfo& service_id_info = it.second; - DiscoveredPeripheralCallback discovered_peripheral_callback = - service_id_info.discovered_peripheral_callback; + ServiceIdInfo& service_id_info = it.second; BleAdvertisementSet lost_gatt_advertisements = service_id_info.lost_entity_tracker->ComputeLostEntities(); - // Clear the map state for each lost GATT advertisement and report it to the - // client. + // Clear the map state for each lost GATT advertisement and report it to + // the client. for (const auto& gatt_advertisement : lost_gatt_advertisements) { const auto it = gatt_advertisement_infos_.find(gatt_advertisement); if (it != gatt_advertisement_infos_.end()) { BleV2Peripheral lost_peripheral = it->second.peripheral; if (lost_peripheral.IsValid()) { lost_peripheral.SetId(ByteArray(gatt_advertisement)); - discovered_peripheral_callback.peripheral_lost_cb( + service_id_info.discovered_peripheral_callback.peripheral_lost_cb( std::move(lost_peripheral), service_id, gatt_advertisement.GetData(), gatt_advertisement.IsFastAdvertisement()); @@ -202,8 +291,8 @@ void DiscoveredPeripheralTracker::ClearGattAdvertisement( BleAdvertisementSet& gatt_advertisement_set = ga_it->second; gatt_advertisement_set.erase(gatt_advertisement); - // Unconditionally remove the header from advertisement_read_results_ so we - // can attempt to reread the GATT advertisement if they return. + // Unconditionally remove the header from advertisement_read_results_ so + // we can attempt to reread the GATT advertisement if they return. advertisement_read_results_.erase( gatt_advertisement_info.advertisement_header); @@ -327,24 +416,41 @@ BleAdvertisementHeader DiscoveredPeripheralTracker::HandleRawGattAdvertisements( new_advertisement_header.SetPsm(new_psm); } - // If the device received first fast advertisement is legacy one after then - // received extended one, should replace legacy with extended one which has - // psm value. + // If the device received first fast advertisement is legacy one after + // then received extended one, should replace legacy with extended one + // which has psm value. if (!old_advertisement_header.IsValid() || ShouldNotifyForNewPsm(old_advertisement_header.GetPsm(), new_psm)) { - // The GATT advertisement has never been seen before. Report it up to the - // client. + // The GATT advertisement has never been seen before. Report it up to + // the client. const auto sii_it = service_id_infos_.find(service_id); if (sii_it == service_id_infos_.end()) { - NEARBY_LOGS(WARNING) << "HandleRawGattAdvertisements, failed to find " - "callback for service_id=" - << service_id; + LOG(WARNING) << "HandleRawGattAdvertisements, failed to find " + "callback for service_id=" + << service_id; continue; } if (peripheral.IsValid()) { peripheral.SetPsm(new_psm); BleV2Peripheral discovered_peripheral = peripheral; discovered_peripheral.SetId(ByteArray(gatt_advertisement)); + + if (IsInstantLostAdvertisement(new_advertisement_header)) { + LOG(INFO) << "Skip the advertisement header with hash " + << absl::BytesToHexString( + new_advertisement_header.GetAdvertisementHash() + .AsStringView()) + << " due to it was reported lost."; + continue; + } + + LOG(INFO) + << "Report new peripheral for the advertisement header with hash " + << absl::BytesToHexString( + new_advertisement_header.GetAdvertisementHash() + .AsStringView()) + << ", IsFastAdvertisement " + << gatt_advertisement.IsFastAdvertisement(); sii_it->second.discovered_peripheral_callback.peripheral_discovered_cb( std::move(discovered_peripheral), service_id, gatt_advertisement.GetData(), @@ -361,8 +467,8 @@ BleAdvertisementHeader DiscoveredPeripheralTracker::HandleRawGattAdvertisements( } else if (ShouldRemoveHeader(old_advertisement_header, new_advertisement_header)) { // The GATT advertisement has been seen on a different advertisement - // header. Remove info about the old advertisement header since it's stale - // now. + // header. Remove info about the old advertisement header since it's + // stale now. advertisement_read_results_.erase(old_advertisement_header); gatt_advertisements_.erase(old_advertisement_header); } @@ -374,6 +480,7 @@ BleAdvertisementHeader DiscoveredPeripheralTracker::HandleRawGattAdvertisements( gatt_advertisement_infos_.insert_or_assign( gatt_advertisement, std::move(gatt_advertisement_info)); } + // Insert the list of read GATT advertisements for this advertisement // header. gatt_advertisements_.insert( @@ -391,19 +498,20 @@ DiscoveredPeripheralTracker::ParseRawGattAdvertisements( // TODO(edwinwu): Refactor this big loop as subroutines. for (const auto gatt_advertisement_bytes : gatt_advertisement_bytes_list) { // First, parse the raw bytes into a BleAdvertisement. - BleAdvertisement gatt_advertisement(*gatt_advertisement_bytes); - if (!gatt_advertisement.IsValid()) { - NEARBY_LOGS(INFO) << "Unable to parse raw GATT advertisement:" - << absl::BytesToHexString( - gatt_advertisement_bytes->data()); + + auto gatt_advertisement_status_or = + BleAdvertisement::CreateBleAdvertisement(*gatt_advertisement_bytes); + if (!gatt_advertisement_status_or.ok()) { + VLOG(1) << gatt_advertisement_status_or.status(); continue; } + auto gatt_advertisement = gatt_advertisement_status_or.value(); // Make sure the advertisement belongs to a service ID we're tracking. for (const auto& item : service_id_infos_) { const std::string& service_id = item.first; - // If we already found a higher version advertisement for this service ID, - // there's no point in comparing this advertisement against it. + // If we already found a higher version advertisement for this service + // ID, there's no point in comparing this advertisement against it. const auto pga_it = parsed_gatt_advertisements.find(service_id); if (pga_it != parsed_gatt_advertisements.end()) { if (pga_it->second.GetVersion() > gatt_advertisement.GetVersion()) { @@ -411,18 +519,18 @@ DiscoveredPeripheralTracker::ParseRawGattAdvertisements( } } - // service_id_hash is null here (mediums advertisement) because we already - // have a UUID in the fast advertisement. + // service_id_hash is null here (mediums advertisement) because we + // already have a UUID in the fast advertisement. if (gatt_advertisement.IsFastAdvertisement() && !service_uuid.IsEmpty()) { const auto sii_it = service_id_infos_.find(service_id); if (sii_it != service_id_infos_.end()) { if (sii_it->second.fast_advertisement_service_uuid == service_uuid) { - NEARBY_LOGS(INFO) - << "This GATT advertisement:" - << absl::BytesToHexString(gatt_advertisement_bytes->data()) - << " is a fast advertisement and matched UUID=" - << service_uuid.Get16BitAsString() - << " in a map with service_id=" << service_id; + VLOG(1) << "This GATT advertisement:" + << absl::BytesToHexString( + gatt_advertisement_bytes->AsStringView()) + << " is a fast advertisement and matched UUID=" + << service_uuid.Get16BitAsString() + << " in a map with service_id=" << service_id; parsed_gatt_advertisements.insert({service_id, gatt_advertisement}); } } @@ -432,10 +540,10 @@ DiscoveredPeripheralTracker::ParseRawGattAdvertisements( // Map the service ID to the advertisement if the service_id_hash match. if (bleutils::GenerateServiceIdHash(service_id) == gatt_advertisement.GetServiceIdHash()) { - NEARBY_LOGS(INFO) << "Matched service_id=" << service_id - << " to GATT advertisement=" - << absl::BytesToHexString( - gatt_advertisement_bytes->data()); + LOG(INFO) << "Matched service_id=" << service_id + << " to GATT advertisement=" + << absl::BytesToHexString( + gatt_advertisement_bytes->AsStringView()); parsed_gatt_advertisements.insert({service_id, gatt_advertisement}); break; } @@ -459,8 +567,8 @@ bool DiscoveredPeripheralTracker::ShouldRemoveHeader( } // We received the physical from legacy advertisement and create a mock one - // when receive a regular advertisement from extended advertisements. Avoid to - // remove the physical header for the new incoming regular extended + // when receive a regular advertisement from extended advertisements. Avoid + // to remove the physical header for the new incoming regular extended // advertisement. Otherwise, it make the device to fetch advertisement when // received a physical header again. if (is_extended_advertisement_available_) { @@ -478,7 +586,7 @@ bool DiscoveredPeripheralTracker::IsDummyAdvertisementHeader( // Do not count advertisementHash and psm value here, for L2CAP feature, the // regular advertisement has different value, it will include PSM value if // received it from extended advertisement protocol and it will not has PSM - // value if it fetcted from GATT connection. + // value if it fetched from GATT connection. BloomFilter bloom_filter( std::make_unique>()); @@ -497,76 +605,61 @@ void DiscoveredPeripheralTracker::HandleAdvertisementHeader( BleAdvertisementHeader advertisement_header( ExtractAdvertisementHeaderBytes(advertisement_data)); if (!advertisement_header.IsValid()) { - NEARBY_LOGS(INFO) - << "Failed to deserialize BLE advertisement header. Ignoring."; + VLOG(1) << "Failed to deserialize BLE advertisement header. Ignoring."; return; } // Check if the advertisement header contains a service ID we're tracking. if (!IsInterestingAdvertisementHeader(advertisement_header)) { - NEARBY_LOGS(VERBOSE) << "Ignoring BLE advertisement header=" - << absl::BytesToHexString( - ByteArray(advertisement_header).data()) - << " because it does not contain any service IDs " - "we're interested in."; + VLOG(1) << "Ignoring BLE advertisement header with hash" + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) + << " because it does not contain any service IDs " + "we're interested in."; return; } + // Report a nearby legacy device is found when advertisement header doesn't + // support extended advertisement. + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning)) { + if (!advertisement_header.IsSupportExtendedAdvertisement()) { + for (auto& item : service_id_infos_) { + item.second.discovered_peripheral_callback + .legacy_device_discovered_cb(); + } + } + } + // Determine whether or not we need to read a fresh GATT advertisement. if (ShouldReadRawAdvertisementFromServer(advertisement_header)) { // Determine whether or not we need to read a fresh GATT advertisement. if (NearbyFlags::GetInstance().GetBoolFlag( config_package_nearby::nearby_connections_feature:: kEnableGattQueryInThread)) { - NEARBY_LOGS(VERBOSE) << ": Handle GATT advertisement " - << absl::BytesToHexString( - ByteArray(advertisement_header).data()) - << " in thread"; - ByteArray advertisement_data{advertisement_header}; - if (fetching_advertisements_.contains(advertisement_data)) { - NEARBY_LOGS(VERBOSE) << ": Ignore the advertisement header due to it " - "is already in fetcing."; + VLOG(1) << ": Handle GATT advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) + << " in thread"; + + if (!fetching_advertisements_.insert(advertisement_header).second) { + VLOG(1) << ": Ignore the advertisement header due to it " + "is already in fetching."; return; } - fetching_advertisements_.insert(advertisement_data); - if (executor_ == nullptr) { // The situation happens when flag value changed executor_ = std::make_unique(kGattThreadCount); } - executor_->Execute([this, peripheral, advertisement_header, - advertisement_fetcher = - std::move(advertisement_fetcher), - advertisement_data = - std::move(advertisement_data)]() { - { - MutexLock lock(&mutex_); - if (!IsInterestingAdvertisementHeader(advertisement_header)) { - NEARBY_LOGS(INFO) - << ": Ignore to read raw advertisement from server due to it " - "is not interesting header now."; - fetching_advertisements_.erase(advertisement_data); - return; - } - } - - std::vector gatt_advertisement_bytes_list = + executor_->Execute( + [this, peripheral, advertisement_header, + advertisement_fetcher = std::move(advertisement_fetcher), + advertisement_data = std::move(advertisement_data)]() mutable { FetchRawAdvertisementsInThread(peripheral, advertisement_header, std::move(advertisement_fetcher)); - { - MutexLock lock(&mutex_); - HandleRawGattAdvertisements(peripheral, advertisement_header, - gatt_advertisement_bytes_list, - /*service_uuid=*/{}); - UpdateCommonStateForFoundBleAdvertisement(advertisement_header); - fetching_advertisements_.erase(advertisement_data); - NEARBY_LOGS(VERBOSE) - << ": Completed to handle GATT advertisement " - << absl::BytesToHexString(ByteArray(advertisement_header).data()) - << " in thread"; - } - }); + }); return; } else { std::vector gatt_advertisement_bytes_list = @@ -622,11 +715,11 @@ bool DiscoveredPeripheralTracker::ShouldReadRawAdvertisementFromServer( ByteArray advertisement_header_bytes(advertisement_header); const auto it = advertisement_read_results_.find(advertisement_header); if (it == advertisement_read_results_.end()) { - NEARBY_LOGS(INFO) << "Received advertisement header=" - << absl::BytesToHexString( - advertisement_header_bytes.data()) - << ", but we have never seen it before. Caller should " - "try reading its GATT advertisement."; + LOG(INFO) << "Received advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) + << ", but we have never seen it before. Caller should " + "try reading its GATT advertisement."; return true; } @@ -636,21 +729,23 @@ bool DiscoveredPeripheralTracker::ShouldReadRawAdvertisementFromServer( // Now evaluate if we should retry reading. switch (advertisement_read_result->EvaluateRetryStatus()) { case AdvertisementReadResult::RetryStatus::kRetry: - NEARBY_LOGS(INFO) - << "Received advertisement header=" - << absl::BytesToHexString(advertisement_header_bytes.data()) + LOG(INFO) + << "Received advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) << ". Caller should retry reading its GATT advertisement."; return true; case AdvertisementReadResult::RetryStatus::kPreviouslySucceeded: - NEARBY_LOGS(INFO) << "Received advertisement header=" - << absl::BytesToHexString( - advertisement_header_bytes.data()) - << ", but we have already read its GATT advertisement."; + VLOG(1) << "Received advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) + << ", but we have already read its GATT advertisement."; return false; case AdvertisementReadResult::RetryStatus::kTooSoon: - NEARBY_LOGS(INFO) - << "Received advertisement header=" - << absl::BytesToHexString(advertisement_header_bytes.data()) + LOG(INFO) + << "Received advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) << ", but we have recently failed to read its GATT advertisement."; return false; case AdvertisementReadResult::RetryStatus::kUnknown: @@ -658,11 +753,11 @@ bool DiscoveredPeripheralTracker::ShouldReadRawAdvertisementFromServer( break; } - NEARBY_LOGS(INFO) - << "Received advertisement header=" - << absl::BytesToHexString(advertisement_header_bytes.data()) - << ", but we do not know whether or not to retry reading " - "its GATT advertisement. Caller should retry to be safe."; + LOG(INFO) << "Received advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) + << ", but we do not know whether or not to retry reading " + "its GATT advertisement. Caller should retry to be safe."; return true; } @@ -681,51 +776,80 @@ DiscoveredPeripheralTracker::FetchRawAdvertisements( std::transform(service_id_infos_.begin(), service_id_infos_.end(), std::back_inserter(service_ids), [](auto& kv) { return kv.first; }); - advertisement_fetcher.fetch_advertisements( - std::move(peripheral), advertisement_header.GetNumSlots(), - advertisement_header.GetPsm(), service_ids, *result); + advertisement_fetcher(peripheral, advertisement_header.GetNumSlots(), + advertisement_header.GetPsm(), service_ids, *result); // Take those results and return all the advertisements we were able to // read. return result->GetAdvertisements(); } -std::vector -DiscoveredPeripheralTracker::FetchRawAdvertisementsInThread( +void DiscoveredPeripheralTracker::FetchRawAdvertisementsInThread( BleV2Peripheral peripheral, const BleAdvertisementHeader& advertisement_header, AdvertisementFetcher advertisement_fetcher) { std::vector service_ids; - AdvertisementReadResult* result = nullptr; + { MutexLock lock(&mutex_); - // Fetch the raw GATT advertisements and store the results. - auto& read_result = advertisement_read_results_[advertisement_header]; - if (read_result == nullptr) { - read_result = std::make_unique(); + if (!IsInterestingAdvertisementHeader(advertisement_header)) { + LOG(INFO) << ": Ignore to read raw advertisement from server due to it " + "is not interesting header now."; + fetching_advertisements_.erase(advertisement_header); + return; } - result = read_result.get(); std::transform(service_id_infos_.begin(), service_id_infos_.end(), std::back_inserter(service_ids), [](auto& kv) { return kv.first; }); } - advertisement_fetcher.fetch_advertisements( - std::move(peripheral), advertisement_header.GetNumSlots(), - advertisement_header.GetPsm(), service_ids, *result); - // Take those results and return all the advertisements we were able to - // read. - return result->GetAdvertisements(); + auto result = std::make_unique(); + advertisement_fetcher(peripheral, advertisement_header.GetNumSlots(), + advertisement_header.GetPsm(), service_ids, *result); + { + MutexLock lock(&mutex_); + // The fetching process might take a few seconds, and tracking settings + // could change during that time. We need to double-check if the result + // is still valid afterward. + if (!IsInterestingAdvertisementHeader(advertisement_header)) { + LOG(WARNING) + << ": Ignore the fetched GATT advertisement from server due to it " + "is not interesting header now."; + return; + } + + auto it = advertisement_read_results_.insert_or_assign(advertisement_header, + std::move(result)); + std::vector gatt_advertisement_bytes_list = + it.first->second->GetAdvertisements(); + + if (gatt_advertisement_bytes_list.empty() || + !IsInterestingAdvertisementHeader(advertisement_header)) { + fetching_advertisements_.erase(advertisement_header); + return; + } + + HandleRawGattAdvertisements(peripheral, advertisement_header, + gatt_advertisement_bytes_list, + /*service_uuid=*/{}); + UpdateCommonStateForFoundBleAdvertisement(advertisement_header); + fetching_advertisements_.erase(advertisement_header); + VLOG(1) << ": Completed to handle GATT advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()) + << " in thread"; + } } void DiscoveredPeripheralTracker::UpdateCommonStateForFoundBleAdvertisement( const BleAdvertisementHeader& advertisement_header) { const auto ga_it = gatt_advertisements_.find(advertisement_header); if (ga_it == gatt_advertisements_.end()) { - NEARBY_LOGS(INFO) - << "No GATT advertisements found for advertisement header=" - << absl::BytesToHexString(ByteArray(advertisement_header).data()); + LOG(INFO) + << "No GATT advertisements found for advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()); return; } @@ -741,10 +865,10 @@ void DiscoveredPeripheralTracker::UpdateCommonStateForFoundBleAdvertisement( if (sii_it != service_id_infos_.end()) { auto* lost_entity_tracker = sii_it->second.lost_entity_tracker.get(); if (!lost_entity_tracker) { - NEARBY_LOGS(WARNING) << "UpdateCommonStateForFoundBleAdvertisement, " - "failed to find entity " - "tracker for service_id=" - << gatt_advertisement_info.service_id; + LOG(WARNING) << "UpdateCommonStateForFoundBleAdvertisement, " + "failed to find entity " + "tracker for service_id=" + << gatt_advertisement_info.service_id; continue; } lost_entity_tracker->RecordFoundEntity(gatt_advertisement); @@ -752,6 +876,58 @@ void DiscoveredPeripheralTracker::UpdateCommonStateForFoundBleAdvertisement( } } +bool DiscoveredPeripheralTracker::IsLegacyDeviceAdvertisementData( + const BleAdvertisementData& advertisement_data) { + return !advertisement_data.is_extended_advertisement && + advertisement_data.service_data.size() == 1 && + advertisement_data.service_data.find( + bleutils::kCopresenceServiceUuid) != + advertisement_data.service_data.end() && + advertisement_data.service_data.at(bleutils::kCopresenceServiceUuid) == + ByteArray(DiscoveredPeripheralTracker::kDummyAdvertisementValue); +} + +bool DiscoveredPeripheralTracker::IsInstantLostAdvertisement( + const BleAdvertisementHeader& advertisement_header) { + RemoveExpiredInstantLostAdvertisements(); + return lost_advertisment_infos_.contains( + std::string(advertisement_header.GetAdvertisementHash())); +} + +void DiscoveredPeripheralTracker::AddInstantLostAdvertisement( + const BleAdvertisementHeader& advertisement_header) { + LOG(INFO) << "Add instant lost advertisement header with hash " + << absl::BytesToHexString( + advertisement_header.GetAdvertisementHash().AsStringView()); + lost_advertisment_infos_[std::string( + advertisement_header.GetAdvertisementHash())] = + SystemClock::ElapsedRealtime(); +} + +void DiscoveredPeripheralTracker::RemoveExpiredInstantLostAdvertisements() { + absl::Time now = SystemClock::ElapsedRealtime(); + if (now - last_lost_info_update_time_ < kInstantLostAdvertisementTimeout) { + return; + } + + auto it = lost_advertisment_infos_.begin(), + end = lost_advertisment_infos_.end(); + + LOG(INFO) << "Start to remove expired lost advertisements."; + int count = 0; + while (it != end) { + if (now - it->second >= kInstantLostAdvertisementTimeout) { + lost_advertisment_infos_.erase(it++); + ++count; + } else { + ++it; + } + } + + last_lost_info_update_time_ = now; + LOG(INFO) << "Removed " << count << " expired lost advertisements."; +} + } // namespace mediums } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h b/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h index fcd59951..af799bab 100644 --- a/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h +++ b/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h @@ -15,7 +15,7 @@ #ifndef CORE_INTERNAL_MEDIUMS_BLE_V2_DISCOVERED_PERIPHERAL_TRACKER_H_ #define CORE_INTERNAL_MEDIUMS_BLE_V2_DISCOVERED_PERIPHERAL_TRACKER_H_ -#include +#include #include #include #include @@ -23,16 +23,20 @@ #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/functional/any_invocable.h" +#include "absl/time/time.h" #include "connections/implementation/mediums//lost_entity_tracker.h" #include "connections/implementation/mediums/ble_v2/advertisement_read_result.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement.h" #include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" #include "connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h" #include "connections/implementation/mediums/lost_entity_tracker.h" -#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/ble_v2.h" #include "internal/platform/byte_array.h" +#include "internal/platform/implementation/ble_v2.h" #include "internal/platform/multi_thread_executor.h" #include "internal/platform/mutex.h" +#include "internal/platform/uuid.h" namespace nearby { namespace connections { @@ -46,21 +50,19 @@ namespace mediums { // compute found and lost peripherals. class DiscoveredPeripheralTracker { public: + static constexpr std::array kDummyAdvertisementValue = { + 0x51, 0x43, 0x41, 0x41, 0x41, 0x42, 0x41, 0x43, 0x41, 0x41, 0x41, 0x44, + 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}; // GATT advertisement fetcher. - struct AdvertisementFetcher { - // Fetches relevant GATT advertisements for the peripheral found in {@link - // DiscoveredPeripheralTracker#ProcessFoundBleAdvertisement(}. - // - // `advertisement_read_result` is in/out mutable reference that the caller - // should take of its life cycle and pass a valid reference. - std::function& interesting_service_ids, - mediums::AdvertisementReadResult& advertisement_read_result)> - fetch_advertisements = [](BleV2Peripheral, int, int, - const std::vector&, - mediums::AdvertisementReadResult&) {}; - }; + // Fetches relevant GATT advertisements for the peripheral found in {@link + // DiscoveredPeripheralTracker#ProcessFoundBleAdvertisement(}. + // + // `advertisement_read_result` is in/out mutable reference that the caller + // should take of its life cycle and pass a valid reference. + using AdvertisementFetcher = absl::AnyInvocable& interesting_service_ids, + mediums::AdvertisementReadResult& advertisement_read_result)>; explicit DiscoveredPeripheralTracker( bool is_extended_advertisement_available = false); @@ -79,7 +81,7 @@ class DiscoveredPeripheralTracker { // advertisement. void StartTracking( const std::string& service_id, - const DiscoveredPeripheralCallback& discovered_peripheral_callback, + DiscoveredPeripheralCallback discovered_peripheral_callback, const Uuid& fast_advertisement_service_uuid) ABSL_LOCKS_EXCLUDED(mutex_); // Stops tracking discoveries for a particular service Id. @@ -232,14 +234,14 @@ class DiscoveredPeripheralTracker { // AdvertisementData. // // advertisement_fetcher : a fetcher passed from BLE medium to read the - // advertisemeent from BLE characteristics by GATT server. + // advertisement from BLE characteristics by GATT server. std::vector FetchRawAdvertisements( BleV2Peripheral peripheral, const BleAdvertisementHeader& advertisement_header, AdvertisementFetcher advertisement_fetcher) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - std::vector FetchRawAdvertisementsInThread( + void FetchRawAdvertisementsInThread( BleV2Peripheral peripheral, const BleAdvertisementHeader& advertisement_header, AdvertisementFetcher advertisement_fetcher); @@ -250,6 +252,30 @@ class DiscoveredPeripheralTracker { const BleAdvertisementHeader& advertisement_header) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + // Processes on lost advertisements. Returns true when the advertisement: + // 1. Is an Instant On Lost BLE advertisement. + // 2. Matches a peripheral's advertisement hash that has previously been + // discovered. + bool HandleOnLostAdvertisementLocked( + BleV2Peripheral peripheral, + const ::nearby::api::ble_v2::BleAdvertisementData& advertisement_data) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + + // Returns true if the advertisement header met the special conditions of + // a legacy device dummy advertisement. + static bool IsLegacyDeviceAdvertisementData( + const api::ble_v2::BleAdvertisementData& advertisement_data); + + // Helps to handle advertisement for Instant On lost. + bool IsInstantLostAdvertisement( + const BleAdvertisementHeader& advertisement_header) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + void AddInstantLostAdvertisement( + const BleAdvertisementHeader& advertisement_header) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + void RemoveExpiredInstantLostAdvertisements() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + Mutex mutex_; bool is_extended_advertisement_available_; @@ -293,11 +319,18 @@ class DiscoveredPeripheralTracker { gatt_advertisement_infos_ ABSL_GUARDED_BY(mutex_); // Tracks the advertisements in GATT fetching. - absl::flat_hash_set fetching_advertisements_ + absl::flat_hash_set fetching_advertisements_ ABSL_GUARDED_BY(mutex_); std::unique_ptr executor_ ABSL_GUARDED_BY(mutex_) = nullptr; + + // Maps an advertisement header's hash with the time it's reported lost. + // Ignores subsequent discovery events for the same advertisement header. + absl::flat_hash_map lost_advertisment_infos_ + ABSL_GUARDED_BY(mutex_); + absl::Time last_lost_info_update_time_ ABSL_GUARDED_BY(mutex_) = + absl::InfinitePast(); }; } // namespace mediums diff --git a/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker_test.cc b/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker_test.cc index 8379b4b0..0683ba59 100644 --- a/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker_test.cc +++ b/connections/implementation/mediums/ble_v2/discovered_peripheral_tracker_test.cc @@ -14,17 +14,39 @@ #include "connections/implementation/mediums/ble_v2/discovered_peripheral_tracker.h" +#include +#include #include #include +#include +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/base/thread_annotations.h" +#include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/mediums/ble_v2/advertisement_read_result.h" +#include "connections/implementation/mediums/ble_v2/ble_advertisement.h" +#include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" #include "connections/implementation/mediums/ble_v2/ble_utils.h" #include "connections/implementation/mediums/ble_v2/bloom_filter.h" +#include "connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h" +#include "connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h" +#include "connections/implementation/mediums/utils.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/ble_v2.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/ble_v2.h" #include "internal/platform/medium_environment.h" #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/uuid.h" namespace nearby { namespace connections { @@ -69,6 +91,19 @@ ByteArray CreateLegacyBleAdvertisement(const std::string& service_id, data, device_token, BleAdvertisementHeader::kDefaultPsmValue)); } +BleAdvertisementHeader CreateFastBleAdvertisementHeader( + const ByteArray& advertisement_bytes) { + BloomFilter bloom_filter( + std::make_unique>()); + + return BleAdvertisementHeader( + BleAdvertisementHeader::Version::kV2, /*extended_advertisement=*/false, + /*num_slots=*/1, ByteArray(bloom_filter), + bleutils::GenerateAdvertisementHash(advertisement_bytes), + /*psm=*/BleAdvertisementHeader::kDefaultPsmValue); +} + ByteArray CreateBleAdvertisementHeader(const ByteArray& advertisement_hash, int psm, std::vector& service_ids) { @@ -101,9 +136,34 @@ ByteArray GenerateRandomAdvertisementHash() { return random_advertisement_hash; } -class DiscoveredPeripheralTrackerTest : public testing::Test { +class MockDiscoveredPeripheralCallback : public DiscoveredPeripheralCallback { + public: + MOCK_METHOD(void, OnPeripheralDiscovered, + (BleV2Peripheral, const std::string&, const ByteArray&, bool), + ()); + MOCK_METHOD(void, OnPeripheralLost, + (BleV2Peripheral, const std::string&, const ByteArray&, bool), + ()); + MOCK_METHOD(void, OnInstantLost, + (BleV2Peripheral, const std::string&, const ByteArray&, bool), + ()); + MOCK_METHOD(void, OnLegacyDeviceDiscovered, (), ()); +}; + +class DiscoveredPeripheralTrackerTest : public testing::TestWithParam { public: void SetUp() override { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning, + false); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableInstantOnLost, + false); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kEnableGattQueryInThread, + GetParam()); MediumEnvironment::Instance().Start(); adapter_peripheral_ = std::make_unique(); adapter_central_ = std::make_unique(); @@ -111,7 +171,10 @@ class DiscoveredPeripheralTrackerTest : public testing::Test { ble_central_ = std::make_unique(*adapter_central_); } - void TearDown() override { MediumEnvironment::Instance().Stop(); } + void TearDown() override { + MediumEnvironment::Instance().Stop(); + NearbyFlags::GetInstance().ResetOverridedValues(); + } BleV2Peripheral CreateBlePeripheral() { return ble_central_->GetRemotePeripheral( @@ -142,33 +205,81 @@ class DiscoveredPeripheralTrackerTest : public testing::Test { GetAdvertisementFetcher(fetch_latch, advertisement_bytes_list)); } + void FindAdvertisementWithSlowFetcher( + const api::ble_v2::BleAdvertisementData& advertisement_data, + const std::vector& advertisement_bytes_list, + CountDownLatch& fetch_latch) { + BleV2Peripheral peripheral = CreateBlePeripheral(); + + discovered_peripheral_tracker_.ProcessFoundBleAdvertisement( + peripheral, advertisement_data, + GetSlowAdvertisementFetcher(fetch_latch, advertisement_bytes_list)); + } + int GetFetchAdvertisementCallbackCount() const { MutexLock lock(&mutex_); return fetch_count_; } + void DisableBluetoothScanning() { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning, + true); + } + + void EnableInstantOnLost() { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableInstantOnLost, + true); + } + + void EnableFetchGattAdvertisementInThread() { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kEnableGattQueryInThread, + true); + } + protected: // A stub Advertisement fetcher. DiscoveredPeripheralTracker::AdvertisementFetcher GetAdvertisementFetcher( CountDownLatch& fetch_latch, const std::vector& advertisement_bytes_list) { - return { - .fetch_advertisements = - [this, &fetch_latch, &advertisement_bytes_list]( - BleV2Peripheral peripheral, int num_slots, int psm, - const std::vector& interesting_service_ids, - mediums::AdvertisementReadResult& advertisement_read_result) { - MutexLock lock(&mutex_); - fetch_count_++; - int slot = 0; - for (const auto& advertisement_bytes : advertisement_bytes_list) { - advertisement_read_result.AddAdvertisement(slot++, - advertisement_bytes); - } - advertisement_read_result.RecordLastReadStatus( - /*is_success=*/true); - fetch_latch.CountDown(); - }, + return [this, &fetch_latch, advertisement_bytes_list]( + BleV2Peripheral peripheral, int num_slots, int psm, + const std::vector& interesting_service_ids, + mediums::AdvertisementReadResult& advertisement_read_result) { + MutexLock lock(&mutex_); + fetch_count_++; + int slot = 0; + for (const auto& advertisement_bytes : advertisement_bytes_list) { + advertisement_read_result.AddAdvertisement(slot++, advertisement_bytes); + } + advertisement_read_result.RecordLastReadStatus( + /*is_success=*/true); + fetch_latch.CountDown(); + }; + } + + DiscoveredPeripheralTracker::AdvertisementFetcher GetSlowAdvertisementFetcher( + CountDownLatch& fetch_latch, + const std::vector& advertisement_bytes_list) { + return [this, &fetch_latch, advertisement_bytes_list]( + BleV2Peripheral peripheral, int num_slots, int psm, + const std::vector& interesting_service_ids, + mediums::AdvertisementReadResult& advertisement_read_result) { + MutexLock lock(&mutex_); + fetch_count_++; + int slot = 0; + // In real environment, the GATT fetch may run about 3-5 seconds. + absl::SleepFor(absl::Milliseconds(200)); + for (const auto& advertisement_bytes : advertisement_bytes_list) { + advertisement_read_result.AddAdvertisement(slot++, advertisement_bytes); + } + advertisement_read_result.RecordLastReadStatus( + /*is_success=*/true); + fetch_latch.CountDown(); }; } @@ -181,7 +292,7 @@ class DiscoveredPeripheralTrackerTest : public testing::Test { DiscoveredPeripheralTracker discovered_peripheral_tracker_; }; -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundFastAdvertisementPeripheralDiscovered) { ByteArray fast_advertisement_bytes = CreateFastBleAdvertisement( ByteArray(std::string(kData)), ByteArray(std::string(kDeviceToken))); @@ -203,7 +314,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, Uuid(kFastAdvertisementServiceUuid)); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!fast_advertisement_bytes.Empty()) { advertisement_data.service_data.insert( {Uuid(kFastAdvertisementServiceUuid), fast_advertisement_bytes}); @@ -218,13 +329,55 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 0); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, + ReportFoundLegacyDeviceWhenFoundBleAdvertisementPeripheralDiscovered) { + DisableBluetoothScanning(); + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( + GenerateRandomAdvertisementHash(), service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + CountDownLatch found_latch(1); + CountDownLatch legacy_found_latch(1); + CountDownLatch fetch_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + {.peripheral_discovered_cb = + [&found_latch]( + BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, bool fast_advertisement) { + EXPECT_EQ(advertisement_bytes, ByteArray(std::string(kData))); + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + .legacy_device_discovered_cb = + [&legacy_found_latch]() { legacy_found_latch.CountDown(); }}, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + FindAdvertisement(advertisement_data, {advertisement_bytes}, fetch_latch); + + // We should receive a client callback of a peripheral discovery. + fetch_latch.Await(kWaitDuration); + EXPECT_TRUE(legacy_found_latch.Await(kWaitDuration).result()); + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); +} + +TEST_P(DiscoveredPeripheralTrackerTest, CanStartMultipleTrackingWithSameServiceId) { ByteArray fast_advertisement_bytes = CreateFastBleAdvertisement( ByteArray(std::string(kData)), ByteArray(std::string(kDeviceToken))); CountDownLatch found_latch(3); CountDownLatch fetch_latch(3); - int callback_times = 0; + std::atomic callback_times = 0; // 1st tracking. discovered_peripheral_tracker_.StartTracking( @@ -243,7 +396,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, Uuid(kFastAdvertisementServiceUuid)); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!fast_advertisement_bytes.Empty()) { advertisement_data.service_data.insert( {Uuid(kFastAdvertisementServiceUuid), fast_advertisement_bytes}); @@ -290,13 +443,13 @@ TEST_F(DiscoveredPeripheralTrackerTest, FindFastAdvertisement(advertisement_data, {}, fetch_latch); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundFastAdvertisementDuplicateAdvertisements) { ByteArray fast_advertisement_bytes = CreateFastBleAdvertisement( ByteArray(std::string(kData)), ByteArray(std::string(kDeviceToken))); CountDownLatch found_latch(3); CountDownLatch fetch_latch(3); - int callback_times = 0; + std::atomic callback_times = 0; discovered_peripheral_tracker_.StartTracking( std::string(kServiceIdA), @@ -314,7 +467,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, Uuid(kFastAdvertisementServiceUuid)); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!fast_advertisement_bytes.Empty()) { advertisement_data.service_data.insert( {Uuid(kFastAdvertisementServiceUuid), fast_advertisement_bytes}); @@ -334,7 +487,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 0); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundFastAdvertisementUntrackedFastAdvertisementServiceUuid) { ByteArray fast_advertisement_bytes = CreateFastBleAdvertisement( ByteArray(std::string(kData)), ByteArray(std::string(kDeviceToken))); @@ -358,7 +511,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, Uuid("FE3C")); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!fast_advertisement_bytes.Empty()) { advertisement_data.service_data.insert( {Uuid(kFastAdvertisementServiceUuid), fast_advertisement_bytes}); @@ -372,7 +525,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 0); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundFastAdvertisementAndGattAdvertisementSimultaneously) { std::vector service_ids = {std::string(kServiceIdB)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -415,7 +568,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -434,7 +587,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundBleAdvertisementPeripheralDiscovered) { std::vector service_ids = {std::string(kServiceIdA)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -460,7 +613,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -474,7 +627,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundBleAdvertisementLegacyPeripheralDiscovered) { std::vector service_ids = {std::string(kServiceIdA)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -496,7 +649,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -511,7 +664,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundBleAdvertisementFavorLatestPeripheral) { std::vector service_ids = {std::string(kServiceIdA)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -524,7 +677,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, ByteArray(std::string(kDeviceToken))); CountDownLatch found_latch(1); CountDownLatch fetch_latch(1); - int callback_times = 0; + std::atomic callback_times = 0; discovered_peripheral_tracker_.StartTracking( std::string(kServiceIdA), @@ -542,7 +695,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -555,12 +708,12 @@ TEST_F(DiscoveredPeripheralTrackerTest, // We should only receive one callback with data from the V2 GATT // advertisement. fetch_latch.Await(kWaitDuration); - EXPECT_EQ(callback_times, 1); EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(callback_times, 1); EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundBleAdvertisementDuplicateAdvertisements) { std::vector service_ids = {std::string(kServiceIdA)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -570,7 +723,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, ByteArray(std::string(kDeviceToken))); CountDownLatch found_latch(3); CountDownLatch fetch_latch(3); - int callback_times = 0; + std::atomic callback_times = 0; discovered_peripheral_tracker_.StartTracking( std::string(kServiceIdA), @@ -588,7 +741,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -608,7 +761,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundBleAdvertisementUntrackedServiceId) { std::vector service_ids = {std::string(kServiceIdA), std::string(kServiceIdB)}; @@ -631,7 +784,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -645,7 +798,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, LostPeripheralForFastAdvertisementLost) { std::vector service_ids = {}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -655,7 +808,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, CountDownLatch found_latch(1); CountDownLatch lost_latch(2); CountDownLatch fetch_latch(1); - int lost_callback_times = 0; + std::atomic lost_callback_times = 0; discovered_peripheral_tracker_.StartTracking( std::string(kServiceIdA), @@ -680,7 +833,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, Uuid(kFastAdvertisementServiceUuid)); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -709,7 +862,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_EQ(lost_callback_times, 1); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, FoundFastAdvertisementAlmostLostPeripheral) { std::vector service_ids = {}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -740,7 +893,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, Uuid(kFastAdvertisementServiceUuid)); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -766,7 +919,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_FALSE(lost_latch.Await(kWaitDuration).result()); } -TEST_F(DiscoveredPeripheralTrackerTest, LostPeripheralForAdvertisementLost) { +TEST_P(DiscoveredPeripheralTrackerTest, LostPeripheralForAdvertisementLost) { std::vector service_ids = {std::string(kServiceIdA)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( GenerateRandomAdvertisementHash(), service_ids); @@ -797,7 +950,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, LostPeripheralForAdvertisementLost) { }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -811,7 +964,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, LostPeripheralForAdvertisementLost) { EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); // Then, go through two cycles of onLost. The first cycle should include the - // recently discovered eripheral in its 'found' pool. The second one should + // recently discovered peripheral in its 'found' pool. The second one should // trigger the onLost callback. discovered_peripheral_tracker_.ProcessLostGattAdvertisements(); discovered_peripheral_tracker_.ProcessLostGattAdvertisements(); @@ -820,7 +973,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, LostPeripheralForAdvertisementLost) { EXPECT_TRUE(lost_latch.Await(kWaitDuration).result()); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, LostPeripheralForFastAndGattAdvertisementLost) { std::vector service_ids = {std::string(kServiceIdB)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -875,7 +1028,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -905,7 +1058,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_TRUE(lost_latch_b.Await(kWaitDuration).result()); } -TEST_F(DiscoveredPeripheralTrackerTest, +TEST_P(DiscoveredPeripheralTrackerTest, LostPeripheralNotCallbackForUntrackedServiceId) { std::vector service_ids = {std::string(kServiceIdA)}; ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( @@ -937,7 +1090,7 @@ TEST_F(DiscoveredPeripheralTrackerTest, }, {}); - api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::BleAdvertisementData advertisement_data{}; if (!advertisement_header_bytes.Empty()) { advertisement_data.service_data.insert( {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); @@ -959,6 +1112,489 @@ TEST_F(DiscoveredPeripheralTrackerTest, EXPECT_FALSE(lost_latch.Await(kWaitDuration).result()); } +TEST_P(DiscoveredPeripheralTrackerTest, LostPeripheralForInstantOnLost) { + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_hash = GenerateRandomAdvertisementHash(); + ByteArray advertisement_header_bytes = + CreateBleAdvertisementHeader(advertisement_hash, service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + CountDownLatch found_latch(1); + CountDownLatch lost_latch(1); + CountDownLatch fetch_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(advertisement_bytes, ByteArray(std::string(kData))); + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + .peripheral_lost_cb = + [&lost_latch]( + BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { lost_latch.CountDown(); }, + }, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + FindAdvertisement(advertisement_data, {advertisement_bytes}, fetch_latch); + + // We should receive a client callback of a peripheral discovery. + fetch_latch.Await(kWaitDuration); + ASSERT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); + + auto advertisement = InstantOnLostAdvertisement::CreateFromHashes( + std::list({std::string(advertisement_hash)})); + ASSERT_OK(advertisement); + api::ble_v2::BleAdvertisementData loss_advertisement_data{}; + loss_advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, ByteArray(advertisement->ToBytes())}); + + FindAdvertisement(loss_advertisement_data, + {ByteArray(advertisement->ToBytes())}, fetch_latch); + + // Then, go through a cycle of onLost. Since we triggered a forced loss via + // the instant on los advertisement, the lost call should trigger the onLost + // client callback. + discovered_peripheral_tracker_.ProcessLostGattAdvertisements(); + + // We should receive a client callback of a lost peripheral + EXPECT_TRUE(lost_latch.Await(kWaitDuration).result()); +} + +TEST_P(DiscoveredPeripheralTrackerTest, InstantLostPeripheralForInstantOnLost) { + EnableInstantOnLost(); + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_hash = GenerateRandomAdvertisementHash(); + ByteArray advertisement_header_bytes = + CreateBleAdvertisementHeader(advertisement_hash, service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + CountDownLatch found_latch(1); + CountDownLatch lost_latch(1); + CountDownLatch fetch_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(advertisement_bytes, ByteArray(std::string(kData))); + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + .instant_lost_cb = + [&lost_latch]( + BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { lost_latch.CountDown(); }, + }, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + FindAdvertisement(advertisement_data, {advertisement_bytes}, fetch_latch); + + // We should receive a client callback of a peripheral discovery. + fetch_latch.Await(kWaitDuration); + ASSERT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); + + auto advertisement = InstantOnLostAdvertisement::CreateFromHashes( + std::list({std::string(advertisement_hash)})); + ASSERT_OK(advertisement); + api::ble_v2::BleAdvertisementData loss_advertisement_data{}; + loss_advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, ByteArray(advertisement->ToBytes())}); + + FindAdvertisement(loss_advertisement_data, + {ByteArray(advertisement->ToBytes())}, fetch_latch); + + // Then, go through a cycle of onLost. Since we triggered a forced loss via + // the instant on los advertisement, the lost call should trigger the onLost + // client callback. + discovered_peripheral_tracker_.ProcessLostGattAdvertisements(); + + // We should receive a client callback of a lost peripheral + EXPECT_TRUE(lost_latch.Await(kWaitDuration).result()); +} + +TEST_P(DiscoveredPeripheralTrackerTest, + IgnoreFoundAdvertisementForInstantOnLost) { + EnableInstantOnLost(); + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_hash = GenerateRandomAdvertisementHash(); + ByteArray advertisement_header_bytes = + CreateBleAdvertisementHeader(advertisement_hash, service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + + CountDownLatch fetch_latch(1); + MockDiscoveredPeripheralCallback mock_callback; + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&mock_callback](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + mock_callback.OnPeripheralDiscovered(peripheral, service_id, + advertisement_bytes, + fast_advertisement); + }, + .instant_lost_cb = + [&mock_callback](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + mock_callback.OnInstantLost(peripheral, service_id, + advertisement_bytes, + fast_advertisement); + }, + }, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + EXPECT_CALL(mock_callback, OnPeripheralDiscovered).Times(1); + FindAdvertisement(advertisement_data, {advertisement_bytes}, fetch_latch); + fetch_latch.Await(kWaitDuration); + + // We should receive a client callback of a peripheral discovery. + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); + + CountDownLatch fetch_latch2(1); + auto advertisement = InstantOnLostAdvertisement::CreateFromHashes( + std::list({std::string(advertisement_hash)})); + ASSERT_OK(advertisement); + api::ble_v2::BleAdvertisementData loss_advertisement_data{}; + loss_advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, ByteArray(advertisement->ToBytes())}); + + EXPECT_CALL(mock_callback, OnInstantLost).Times(1); + FindAdvertisement(loss_advertisement_data, + {ByteArray(advertisement->ToBytes())}, fetch_latch2); + fetch_latch2.Await(kWaitDuration); + + // Then, go through a cycle of onLost. Since we triggered a forced loss via + // the instant on los advertisement, the lost call should trigger the onLost + // client callback. + discovered_peripheral_tracker_.ProcessLostGattAdvertisements(); + + // Lost advertisement should not be reported. + CountDownLatch fetch_latch3(1); + EXPECT_CALL(mock_callback, OnPeripheralDiscovered).Times(0); + FindAdvertisement(advertisement_data, {advertisement_bytes}, fetch_latch3); + fetch_latch3.Await(kWaitDuration); +} + +TEST_P(DiscoveredPeripheralTrackerTest, + LostPeripheralWithFastAdvertisementForInstantOnLost) { + ByteArray fast_advertisement_bytes = CreateFastBleAdvertisement( + ByteArray(std::string(kData)), ByteArray(std::string(kDeviceToken))); + + // Used to get advertisement hash from fast advertisement bytes. + BleAdvertisementHeader ble_advertisement_header = + CreateFastBleAdvertisementHeader(fast_advertisement_bytes); + + ByteArray advertisement_hash = + ble_advertisement_header.GetAdvertisementHash(); + + CountDownLatch found_latch(1); + CountDownLatch lost_latch(1); + CountDownLatch fetch_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(advertisement_bytes, ByteArray(std::string(kData))); + EXPECT_TRUE(fast_advertisement); + found_latch.CountDown(); + }, + .peripheral_lost_cb = + [&lost_latch]( + BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { lost_latch.CountDown(); }, + }, + Uuid(kFastAdvertisementServiceUuid)); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!fast_advertisement_bytes.Empty()) { + advertisement_data.service_data.insert( + {Uuid(kFastAdvertisementServiceUuid), fast_advertisement_bytes}); + } + + FindFastAdvertisement(advertisement_data, {}, fetch_latch); + + // We should receive a client callback of a peripheral discovery. + fetch_latch.Await(kWaitDuration); + ASSERT_TRUE(found_latch.Await(kWaitDuration).result()); + + auto advertisement = InstantOnLostAdvertisement::CreateFromHashes( + std::list({std::string(advertisement_hash)})); + ASSERT_OK(advertisement); + api::ble_v2::BleAdvertisementData loss_advertisement_data{}; + loss_advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, ByteArray(advertisement->ToBytes())}); + + FindAdvertisement(loss_advertisement_data, + {ByteArray(advertisement->ToBytes())}, fetch_latch); + + // We should receive a client callback of a lost peripheral + EXPECT_TRUE(lost_latch.Await(kWaitDuration).result()); +} + +TEST_P(DiscoveredPeripheralTrackerTest, HandleDummyAdvertisement) { + auto flag = nearby::FeatureFlags::Flags{ + .enable_invoking_legacy_device_discovered_cb = true, + }; + MediumEnvironment::Instance().SetFeatureFlags(flag); + api::ble_v2::BleAdvertisementData advertising_data{}; + advertising_data.is_extended_advertisement = false; + ByteArray encoded_bytes{ + DiscoveredPeripheralTracker::kDummyAdvertisementValue}; + advertising_data.service_data.insert( + {mediums::bleutils::kCopresenceServiceUuid, encoded_bytes}); + CountDownLatch fetch_latch(1); + CountDownLatch legacy_device_found_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [](BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + FAIL() << "Should NOT report found for dummy advertisement"; + }, + .legacy_device_discovered_cb = + [&legacy_device_found_latch]() { + legacy_device_found_latch.CountDown(); + }, + }, + {}); + + FindAdvertisement(advertising_data, {}, fetch_latch); + + EXPECT_TRUE(legacy_device_found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 0); +} + +TEST_P(DiscoveredPeripheralTrackerTest, SkipDummyAdvertisement) { + auto flag = nearby::FeatureFlags::Flags{ + .enable_invoking_legacy_device_discovered_cb = false, + }; + MediumEnvironment::Instance().SetFeatureFlags(flag); + api::ble_v2::BleAdvertisementData advertising_data{}; + advertising_data.is_extended_advertisement = false; + ByteArray encoded_bytes{ + DiscoveredPeripheralTracker::kDummyAdvertisementValue}; + advertising_data.service_data.insert( + {mediums::bleutils::kCopresenceServiceUuid, encoded_bytes}); + CountDownLatch fetch_latch(1); + CountDownLatch legacy_device_found_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [](BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + FAIL() << "Should NOT report found for dummy advertisement"; + }, + .legacy_device_discovered_cb = + []() { + FAIL() << "Should NOT report found for dummy advertisement"; + }, + }, + {}); + + FindAdvertisement(advertising_data, {}, fetch_latch); + + EXPECT_FALSE(legacy_device_found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 0); +} + +TEST_P(DiscoveredPeripheralTrackerTest, FetchGattAdvertisementInThread) { + EnableFetchGattAdvertisementInThread(); + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( + GenerateRandomAdvertisementHash(), service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + CountDownLatch found_latch(1); + CountDownLatch fetch_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(advertisement_bytes, ByteArray(std::string(kData))); + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + }, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + FindAdvertisementWithSlowFetcher(advertisement_data, {advertisement_bytes}, + fetch_latch); + + // We should receive a client callback of a peripheral discovery. + fetch_latch.Await(kWaitDuration); + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); +} + +TEST_P(DiscoveredPeripheralTrackerTest, + IgnoreGattAdvertisementResultWhentrackingStoppedInThread) { + EnableFetchGattAdvertisementInThread(); + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( + GenerateRandomAdvertisementHash(), service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + CountDownLatch found_latch(1); + CountDownLatch fetch_latch(1); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(advertisement_bytes, ByteArray(std::string(kData))); + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + }, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + FindAdvertisementWithSlowFetcher(advertisement_data, {advertisement_bytes}, + fetch_latch); + + // We should receive a client callback of a peripheral discovery. + absl::SleepFor(absl::Milliseconds(20)); + discovered_peripheral_tracker_.StopTracking(std::string(kServiceIdA)); + fetch_latch.Await(kWaitDuration); + EXPECT_FALSE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 1); +} + +TEST_P(DiscoveredPeripheralTrackerTest, + FetchMultipleGattAdvertisementResultsInThread) { + EnableFetchGattAdvertisementInThread(); + std::vector service_ids = {std::string(kServiceIdA)}; + ByteArray advertisement_header_bytes = CreateBleAdvertisementHeader( + GenerateRandomAdvertisementHash(), service_ids); + ByteArray advertisement_header_bytes_2 = CreateBleAdvertisementHeader( + GenerateRandomAdvertisementHash(), service_ids); + ByteArray advertisement_bytes = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData)), + ByteArray(std::string(kDeviceToken))); + ByteArray advertisement_bytes_2 = CreateBleAdvertisement( + std::string(kServiceIdA), ByteArray(std::string(kData2)), + ByteArray(std::string(kDeviceToken))); + CountDownLatch found_latch(2); + CountDownLatch fetch_latch(2); + + discovered_peripheral_tracker_.StartTracking( + std::string(kServiceIdA), + { + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + }, + {}); + + api::ble_v2::BleAdvertisementData advertisement_data{}; + if (!advertisement_header_bytes.Empty()) { + advertisement_data.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes}); + } + + FindAdvertisementWithSlowFetcher(advertisement_data, {advertisement_bytes}, + fetch_latch); + + api::ble_v2::BleAdvertisementData advertisement_data_2{}; + if (!advertisement_header_bytes_2.Empty()) { + advertisement_data_2.service_data.insert( + {bleutils::kCopresenceServiceUuid, advertisement_header_bytes_2}); + } + + FindAdvertisementWithSlowFetcher(advertisement_data_2, + {advertisement_bytes_2}, fetch_latch); + + // We should receive a client callback of a peripheral discovery. + fetch_latch.Await(kWaitDuration); + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_EQ(GetFetchAdvertisementCallbackCount(), 2); +} + +INSTANTIATE_TEST_SUITE_P(DiscoveredPeripheralTrackerFlagsTest, + DiscoveredPeripheralTrackerTest, + /*kEnableGattQueryInThread=*/testing::Bool()); + } // namespace } // namespace mediums diff --git a/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.cc b/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.cc new file mode 100644 index 00000000..373011d3 --- /dev/null +++ b/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.cc @@ -0,0 +1,134 @@ +// Copyright 2023 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. + +#include "connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h" + +#include +#include +#include + +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "connections/implementation/mediums/ble_v2/ble_advertisement_header.h" +#include "internal/platform/logging.h" + +namespace nearby { +namespace connections { +namespace mediums { + +namespace { +constexpr int kAdvertisementType = 0b0001; +constexpr int kVersion = 1; +// Type + Version + Hash Count +constexpr int kMetadataLength = 2; +constexpr int kAdvertisementHashLength = + BleAdvertisementHeader::kAdvertisementHashByteLength; + +constexpr int kTypeBitmask = 0x0F0; +constexpr int kVersionBitmask = 0x007; +constexpr int kHashCountBitmask = 0x007; + +bool IsSupportedVersion(int version) { return version == kVersion; } + +} // namespace + +absl::StatusOr +InstantOnLostAdvertisement::CreateFromHashes( + const std::list& hashes) { + for (auto& hash : hashes) { + if (hash.length() != kAdvertisementHashLength) { + return absl::InvalidArgumentError( + absl::StrFormat("Cannot create instant on loss advertisement from " + "invalid hashes")); + } + } + + return InstantOnLostAdvertisement(hashes); +} + +std::string InstantOnLostAdvertisement::ToBytes() const { + if (hashes_.empty() || hashes_.size() > kMaxHashCount) { + NEARBY_LOGS(ERROR) << __func__ + << ": Failed to convert hashes due to hash " + "size is not valid, size = " + << hashes_.size(); + return ""; + } + + // 1. Header. + uint8_t header = ((kAdvertisementType << 4) & kTypeBitmask); + header |= (kVersion & kVersionBitmask); + + // 2. Hash counts. + uint8_t count = static_cast(hashes_.size() & kHashCountBitmask); + std::string result = absl::StrFormat("%c%c", header, count); + for (const auto& hash : hashes_) { + if (hash.length() != kAdvertisementHashLength) { + NEARBY_LOGS(ERROR) << __func__ + << ": Failed to convert hashes to advertisement due " + "to invalid hash : " + << absl::BytesToHexString(hash); + return ""; + } + absl::StrAppend(&result, hash); + } + return result; +} + +absl::StatusOr +InstantOnLostAdvertisement::CreateFromBytes(absl::string_view bytes) { + if (bytes.length() < kMetadataLength) { + return absl::InvalidArgumentError(absl::StrFormat( + "Cannot create instant on loss advertisement due to invalid length %d", + bytes.length())); + } + + // 1. Parse header. + uint8_t header = bytes[0]; + int type = (header & kTypeBitmask) >> 4; + if (type != kAdvertisementType) { + return absl::InvalidArgumentError( + absl::StrFormat("Failed to parse due to header type %d.", type)); + } + + // 2. Parse version. + int version = header & kVersionBitmask; + if (!IsSupportedVersion(version)) { + return absl::InvalidArgumentError( + absl::StrFormat("Failed to parse due to unknown version %d.", version)); + } + + // 3. Parse hash counts. + uint8_t count = (bytes[1] & kHashCountBitmask); + if (count * kAdvertisementHashLength + 2 != bytes.length()) { + return absl::InvalidArgumentError( + absl::StrFormat("Failed to parse due to incorrect count %d.", count)); + } + + // 4. Parse hashes. + std::list hashes; + for (int i = 2; i < bytes.length(); i += kAdvertisementHashLength) { + hashes.push_back(std::string(bytes.substr(i, kAdvertisementHashLength))); + } + + return InstantOnLostAdvertisement(hashes); +} + +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h b/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h new file mode 100644 index 00000000..42104265 --- /dev/null +++ b/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h @@ -0,0 +1,67 @@ +// Copyright 2023 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_MEDIUMS_BLE_V2_INSTANT_ON_LOST_ADVERTISEMENT_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_MEDIUMS_BLE_V2_INSTANT_ON_LOST_ADVERTISEMENT_H_ + +#include +#include +#include + +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" + +namespace nearby { +namespace connections { +namespace mediums { + +// Represents the format of the BLE instant on lost Advertisement used in +// Advertising + Discovery. +// +//

[ADVERTISEMENT TYPE 4 bits][1 bit unused][VERSION 3 bits] [5 bits +// unused][HASH COUNT 3 bits] [ADVERTISEMENT_HASH 4 Bytes]x1~6 +class InstantOnLostAdvertisement { + public: + // The BLE advertisement available size is 27 - 3 (BT header) - 2 (Our Header) + // = 22 bytes so we can put at most 5 hashes in one advertisement. + static constexpr int kMaxHashCount = 5; + + // Creates an on lost advertisement from an advertisement hash. + static absl::StatusOr CreateFromHashes( + const std::list& hashes); + + // Creates an InstantOnLostAdvertisement from raw bytes received over-the-air. + static absl::StatusOr CreateFromBytes( + absl::string_view bytes); + + // Returns this instant-on-lost-advertisement in raw string + // (non human-readable) format. + // NOTE: Even though this function returns a string, this is not a UTF-8 + // string, as it contains raw bytes. + std::string ToBytes() const; + + std::list hashes() const { return hashes_; } + + private: + explicit InstantOnLostAdvertisement(const std::list& hashes) + : hashes_(hashes) {} + + std::list hashes_; +}; + +} // namespace mediums +} // namespace connections +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_MEDIUMS_BLE_V2_INSTANT_ON_LOST_ADVERTISEMENT_H_ diff --git a/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement_test.cc b/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement_test.cc new file mode 100644 index 00000000..a3b721f3 --- /dev/null +++ b/connections/implementation/mediums/ble_v2/instant_on_lost_advertisement_test.cc @@ -0,0 +1,104 @@ +// Copyright 2023 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. + +#include "connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h" + +#include +#include +#include + +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" +#include "gtest/gtest.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/platform/logging.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace { + +constexpr std::array kGoodHash = { + "\x01\x02\x03\x04", "\x05\x06\x07\x08", "\x09\x0A\x0B\x0C"}; + +constexpr std::array kBadHash = { + "\x01\x02\x03\x04", "x06\x07\x08", "\x09\x0A\x0B\x0C"}; + +using ::testing::status::StatusIs; + +TEST(InstantOnLostAdvertisementTest, + InstantOnLostAdvertisementParsesFromGoodHash) { + absl::StatusOr advertisement = + InstantOnLostAdvertisement::CreateFromHashes( + std::list(kGoodHash.begin(), kGoodHash.end())); + ASSERT_OK(advertisement); + EXPECT_EQ(advertisement->ToBytes().size(), 14); + + absl::StatusOr des_advertisement = + InstantOnLostAdvertisement::CreateFromBytes(advertisement->ToBytes()); + ASSERT_OK(des_advertisement); + EXPECT_EQ(des_advertisement->hashes(), + std::list(kGoodHash.begin(), kGoodHash.end())); +} + +TEST(InstantOnLostAdvertisementTest, + InstantOnLostAdvertisementFailsParseFromBadHash) { + absl::StatusOr advertisement = + InstantOnLostAdvertisement::CreateFromHashes( + std::list(kBadHash.begin(), kBadHash.end())); + EXPECT_THAT(advertisement, StatusIs(absl::StatusCode::kInvalidArgument)); +} + +TEST(InstantOnLostAdvertisementTest, + InstantOnLostAdvertisementFailsParseFromLessBytes) { + EXPECT_THAT(InstantOnLostAdvertisement::CreateFromBytes("01"), + StatusIs(absl::StatusCode::kInvalidArgument)); + EXPECT_THAT(InstantOnLostAdvertisement::CreateFromBytes("test"), + StatusIs(absl::StatusCode::kInvalidArgument)); +} + +TEST(InstantOnLostAdvertisementTest, + InstantOnLostAdvertisementFailsParseBadVersion) { + absl::StatusOr advertisement = + InstantOnLostAdvertisement::CreateFromHashes( + std::list(kGoodHash.begin(), kGoodHash.end())); + ASSERT_OK(advertisement); + // Set version to 0. + std::string advertisement_bytes = advertisement->ToBytes(); + advertisement_bytes[0] = 0x10; + + EXPECT_THAT(InstantOnLostAdvertisement::CreateFromBytes(advertisement_bytes), + StatusIs(absl::StatusCode::kInvalidArgument)); +} + +TEST(InstantOnLostAdvertisementTest, + InstantOnLostAdvertisementFailsParseBadAdvertisementType) { + absl::StatusOr advertisement = + InstantOnLostAdvertisement::CreateFromHashes( + std::list(kGoodHash.begin(), kGoodHash.end())); + ASSERT_OK(advertisement); + // Set advertisement type to 0. + std::string advertisement_bytes = advertisement->ToBytes(); + advertisement_bytes[0] = 0x01; + + EXPECT_THAT(InstantOnLostAdvertisement::CreateFromBytes(advertisement_bytes), + StatusIs(absl::StatusCode::kInvalidArgument)); +} + +} // namespace +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/ble_v2/instant_on_lost_manager.cc b/connections/implementation/mediums/ble_v2/instant_on_lost_manager.cc new file mode 100644 index 00000000..a6f389ed --- /dev/null +++ b/connections/implementation/mediums/ble_v2/instant_on_lost_manager.cc @@ -0,0 +1,249 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/ble_v2/instant_on_lost_manager.h" + +#include +#include +#include + +#include "absl/strings/escaping.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "connections/implementation/mediums/ble_v2/ble_utils.h" +#include "connections/implementation/mediums/ble_v2/instant_on_lost_advertisement.h" +#include "internal/platform/ble_v2.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancelable_alarm.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/logging.h" +#include "internal/platform/mutex_lock.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace { +// The max number of concurrent on lost advertisements. +constexpr int kMaxAdvertisingOnLostHashCount = + InstantOnLostAdvertisement::kMaxHashCount; +constexpr absl::Duration kInstantOnLostAdvertiseDuration = absl::Seconds(2); +} // namespace + +void InstantOnLostManager::OnAdvertisingStarted( + const std::string& service_id, const ByteArray& advertisement_data) { + MutexLock lock(&mutex_); + if (is_shutdown_) { + NEARBY_LOGS(WARNING) << __func__ << ": InstantOnLostManager is shutdown."; + return; + } + + if (service_id.empty()) { + NEARBY_LOGS(WARNING) << __func__ << ": Invalid service ID."; + return; + } + + if (advertisement_data.Empty()) { + NEARBY_LOGS(WARNING) << __func__ << ": Invalid advertisement data."; + return; + } + + ByteArray advertisement_hash = + bleutils::GenerateAdvertisementHash(advertisement_data); + + // Check whether the hash is in on lost list. + for (auto& it : active_on_lost_advertising_list_) { + if (it.hash == std::string(advertisement_hash)) { + StopOnLostAdvertising(); + if (stop_advertising_alarm_ != nullptr) { + stop_advertising_alarm_->Cancel(); + } + + active_on_lost_advertising_list_.remove(it); + if (!active_on_lost_advertising_list_.empty()) { + StartInstantOnLostAdvertisement(); + } + NEARBY_LOGS(INFO) << __func__ << ": Remove the lost hash " + << absl::BytesToHexString( + advertisement_hash.AsStringView()) + << " from the list."; + break; + } + } + + active_advertising_map_[service_id] = advertisement_hash; + NEARBY_LOGS(INFO) << __func__ + << ": OnAdvertisingStarted from service ID: " << service_id + << " with hash: " + << absl::BytesToHexString( + advertisement_hash.AsStringView()); +} + +void InstantOnLostManager::OnAdvertisingStopped(const std::string& service_id) { + MutexLock lock(&mutex_); + + if (is_shutdown_) { + NEARBY_LOGS(WARNING) << __func__ << ": InstantOnLostManager is shutdown."; + return; + } + + auto active_advertising = active_advertising_map_.extract(service_id); + + if (active_advertising.empty()) { + NEARBY_LOGS(WARNING) + << __func__ << ": Stopped advertising for service ID: " << service_id + << " but it is not found in the active advertising map."; + return; + } + + const ByteArray& advertisement_hash = active_advertising.mapped(); + + if (active_on_lost_advertising_list_.size() >= + kMaxAdvertisingOnLostHashCount) { + active_on_lost_advertising_list_.pop_front(); + } + + active_on_lost_advertising_list_.push_back( + {absl::Now(), std::string(advertisement_hash)}); + + if (!StartInstantOnLostAdvertisement()) { + NEARBY_LOGS(ERROR) << __func__ + << ": Failed to advertise instant onLost BLE."; + } + + NEARBY_LOGS(INFO) << __func__ + << ": OnAdvertisingStopped from service ID: " << service_id; +} + +bool InstantOnLostManager::Shutdown() { + MutexLock lock(&mutex_); + if (is_shutdown_) { + NEARBY_LOGS(WARNING) << __func__ + << ": InstantOnLostManager is already shutdown."; + return false; + } + + if (stop_advertising_alarm_ != nullptr) { + stop_advertising_alarm_->Cancel(); + } + + StopOnLostAdvertising(); + + active_on_lost_advertising_list_.clear(); + active_advertising_map_.clear(); + is_shutdown_ = true; + + NEARBY_LOGS(INFO) << __func__ << ": InstantOnLostManager is shutdown."; + return true; +} + +std::list InstantOnLostManager::GetOnLostHashes() { + MutexLock lock(&mutex_); + return GetOnLostHashesInternal(); +} + +bool InstantOnLostManager::IsOnLostAdvertising() { + MutexLock lock(&mutex_); + return is_on_lost_advertising_; +} + +bool InstantOnLostManager::StartInstantOnLostAdvertisement() { + api::ble_v2::BleAdvertisementData advertisement_data; + api::ble_v2::AdvertiseParameters advertise_parameters; + advertise_parameters.is_connectable = false; + advertise_parameters.tx_power_level = api::ble_v2::TxPowerLevel::kHigh; + + RemoveExpiredOnLostAdvertisements(); + absl::StatusOr on_lost_advertisement = + InstantOnLostAdvertisement::CreateFromHashes(GetOnLostHashesInternal()); + if (!on_lost_advertisement.ok()) { + NEARBY_LOGS(ERROR) << __func__ + << ": Failed to create instant on lost advertisement."; + return false; + } + + advertisement_data.is_extended_advertisement = false; + advertisement_data.service_data.insert_or_assign( + mediums::bleutils::kCopresenceServiceUuid, + ByteArray(on_lost_advertisement->ToBytes())); + + StopOnLostAdvertising(); + + if (!ble_medium_.StartAdvertising(advertisement_data, advertise_parameters)) { + NEARBY_LOGS(ERROR) << __func__ + << ": Failed to start advertising for instant on lost."; + return false; + } + + if (stop_advertising_alarm_ != nullptr) { + stop_advertising_alarm_->Cancel(); + } + + // Schedule to stop the advertising. + stop_advertising_alarm_ = std::make_unique( + "stop_instant_on_lost_advertising", + [this]() { + MutexLock lock(&mutex_); + StopOnLostAdvertising(); + // All hashes already advertised for enough time, we should clear the + // list. + active_on_lost_advertising_list_.clear(); + is_on_lost_advertising_ = false; + }, + kInstantOnLostAdvertiseDuration, &executor_); + + is_on_lost_advertising_ = true; + NEARBY_LOGS(INFO) + << __func__ << ": Started instant on lost advertising with hashes count: " + << active_on_lost_advertising_list_.size(); + return true; +} + +bool InstantOnLostManager::StopOnLostAdvertising() { + if (!is_on_lost_advertising_) { + return true; + } + + if (!ble_medium_.StopAdvertising()) { + NEARBY_LOGS(ERROR) << __func__ << ": Failed to stop on lost advertising."; + return false; + } + + is_on_lost_advertising_ = false; + NEARBY_LOGS(INFO) << __func__ << ": Stopped instant on lost advertising"; + return true; +} + +void InstantOnLostManager::RemoveExpiredOnLostAdvertisements() { + absl::Time now = absl::Now(); + auto it = active_on_lost_advertising_list_.begin(); + while (it != active_on_lost_advertising_list_.end()) { + if ((now - it->start_time) >= kInstantOnLostAdvertiseDuration) { + it = active_on_lost_advertising_list_.erase(it); + } else { + break; + } + } +} + +std::list InstantOnLostManager::GetOnLostHashesInternal() { + std::list result; + for (auto& it : active_on_lost_advertising_list_) { + result.push_back(it.hash); + } + return result; +} + +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/ble_v2/instant_on_lost_manager.h b/connections/implementation/mediums/ble_v2/instant_on_lost_manager.h new file mode 100644 index 00000000..77bcc424 --- /dev/null +++ b/connections/implementation/mediums/ble_v2/instant_on_lost_manager.h @@ -0,0 +1,96 @@ +// Copyright 2024 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_MEDIUMS_BLE_V2_INSTANT_ON_LOST_MANAGER_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_MEDIUMS_BLE_V2_INSTANT_ON_LOST_MANAGER_H_ + +#include +#include +#include + +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "absl/time/time.h" +#include "internal/platform/ble_v2.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancelable_alarm.h" +#include "internal/platform/mutex.h" +#include "internal/platform/scheduled_executor.h" + +namespace nearby { +namespace connections { +namespace mediums { + +class InstantOnLostManager { + public: + InstantOnLostManager() = default; + ~InstantOnLostManager() = default; + + void OnAdvertisingStarted(const std::string& service_id, + const ByteArray& advertisement_data) + ABSL_LOCKS_EXCLUDED(mutex_); + void OnAdvertisingStopped(const std::string& service_id) + ABSL_LOCKS_EXCLUDED(mutex_); + + bool Shutdown() ABSL_LOCKS_EXCLUDED(mutex_); + + std::list GetOnLostHashes() ABSL_LOCKS_EXCLUDED(mutex_); + bool IsOnLostAdvertising() ABSL_LOCKS_EXCLUDED(mutex_); + + private: + struct OnLostAdvertisementHashInfo { + absl::Time start_time; + std::string hash; + + bool operator==(const OnLostAdvertisementHashInfo& info) const { + return this->start_time == info.start_time && this->hash == info.hash; + } + }; + + bool StartInstantOnLostAdvertisement() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + bool StopOnLostAdvertising() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + void RemoveExpiredOnLostAdvertisements() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + std::list GetOnLostHashesInternal() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + + Mutex mutex_; + + std::unique_ptr stop_advertising_alarm_ + ABSL_GUARDED_BY(mutex_); + + // BLE medium used for lost packet advertising. + BluetoothAdapter adapter_ ABSL_GUARDED_BY(mutex_); + BleV2Medium ble_medium_ ABSL_GUARDED_BY(mutex_) = BleV2Medium{adapter_}; + bool is_on_lost_advertising_ ABSL_GUARDED_BY(mutex_) = false; + + bool is_shutdown_ ABSL_GUARDED_BY(mutex_) = false; + + ScheduledExecutor executor_ ABSL_GUARDED_BY(mutex_); + + // Active on lost advertising, the maximum size is 5. + std::list active_on_lost_advertising_list_ + ABSL_GUARDED_BY(mutex_); + + // Map of service ID to advertisement data hash. + absl::flat_hash_map active_advertising_map_ + ABSL_GUARDED_BY(mutex_); +}; + +} // namespace mediums +} // namespace connections +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_IMPLEMENTATION_MEDIUMS_BLE_V2_INSTANT_ON_LOST_MANAGER_H_ diff --git a/connections/implementation/mediums/ble_v2/instant_on_lost_manager_test.cc b/connections/implementation/mediums/ble_v2/instant_on_lost_manager_test.cc new file mode 100644 index 00000000..38e8f37a --- /dev/null +++ b/connections/implementation/mediums/ble_v2/instant_on_lost_manager_test.cc @@ -0,0 +1,150 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/ble_v2/instant_on_lost_manager.h" + +#include + +#include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "internal/platform/byte_array.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace { + +constexpr absl::string_view kServiceIdA = "A"; +constexpr absl::string_view kServiceIdB = "B"; +constexpr absl::string_view kServiceIdC = "C"; +constexpr absl::string_view kData1 = "\x01\x02\x03"; +constexpr absl::string_view kData2 = "\x04\x05\x06"; +constexpr absl::string_view kData3 = "\x07\x08\x09"; +constexpr absl::string_view kData4 = "\x10\x11\x12"; +constexpr absl::string_view kData5 = "\x13\x14\x15"; +constexpr absl::string_view kData6 = "\x16\x17\x18"; + +constexpr absl::Duration kOnLostAdvertisingDuration = absl::Milliseconds(2100); + +TEST(InstantOnLostManager, StartOnLostAdvertisingAfterStopAdvertising) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + absl::SleepFor(kOnLostAdvertisingDuration); + EXPECT_FALSE(instant_on_lost_manager.IsOnLostAdvertising()); +} + +TEST(InstantOnLostManager, NoOnLostAdvertisingWhenAdvertiseAgain) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + EXPECT_FALSE(instant_on_lost_manager.IsOnLostAdvertising()); + instant_on_lost_manager.Shutdown(); +} + +TEST(InstantOnLostManager, MultipleAdvertisingOnSameServiceId) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 1); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData2.data(), kData2.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 2); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData3.data(), kData3.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 3); + instant_on_lost_manager.Shutdown(); +} + +TEST(InstantOnLostManager, MaximumOnLostHashesInOnLostAdvertising) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData2.data(), kData2.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData3.data(), kData3.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdB), ByteArray(kData4.data(), kData4.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdB)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdB), ByteArray(kData5.data(), kData5.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdB)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdC), ByteArray(kData6.data(), kData6.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdC)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 5); + instant_on_lost_manager.Shutdown(); +} + +TEST(InstantOnLostManager, ShutdownMultipleTimes) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + EXPECT_TRUE(instant_on_lost_manager.Shutdown()); + EXPECT_FALSE(instant_on_lost_manager.Shutdown()); +} + +TEST(InstantOnLostManager, AdvertisingOnShutdownManager) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.Shutdown(); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_FALSE(instant_on_lost_manager.IsOnLostAdvertising()); +} + +TEST(InstantOnLostManager, RemoveExpiredOnLostAdvertisement) { + InstantOnLostManager instant_on_lost_manager; + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData1.data(), kData1.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 1); + absl::SleepFor(absl::Milliseconds(1050)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData2.data(), kData2.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 2); + absl::SleepFor(absl::Milliseconds(1050)); + instant_on_lost_manager.OnAdvertisingStarted( + std::string(kServiceIdA), ByteArray(kData3.data(), kData3.size())); + instant_on_lost_manager.OnAdvertisingStopped(std::string(kServiceIdA)); + EXPECT_TRUE(instant_on_lost_manager.IsOnLostAdvertising()); + EXPECT_EQ(instant_on_lost_manager.GetOnLostHashes().size(), 2); + instant_on_lost_manager.Shutdown(); +} + +} // namespace +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/ble_v2_test.cc b/connections/implementation/mediums/ble_v2_test.cc index d1d1ca5e..39f22bf3 100644 --- a/connections/implementation/mediums/ble_v2_test.cc +++ b/connections/implementation/mediums/ble_v2_test.cc @@ -14,14 +14,24 @@ #include "connections/implementation/mediums/ble_v2.h" +#include #include +#include #include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/mediums/ble_v2/discovered_peripheral_callback.h" #include "connections/implementation/mediums/bluetooth_radio.h" +#include "connections/power_level.h" #include "internal/flags/nearby_flags.h" +#include "internal/platform/ble_v2.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" namespace nearby { @@ -46,6 +56,9 @@ constexpr absl::string_view kServiceIDA = constexpr absl::string_view kServiceIDB = "com.google.location.nearby.apps.test.b"; constexpr absl::string_view kAdvertisementString = "\x0a\x0b\x0c\x0d"; +constexpr absl::string_view kAdvertisementStringB = "\x01\x02\x03\x04"; +constexpr absl::string_view kLocalEndpointId = "local_endpoint_id"; +constexpr absl::string_view kFastAdvertisementServiceUuid{"\xf3\xfe"}; class BleV2Test : public testing::TestWithParam { public: @@ -96,9 +109,10 @@ TEST_P(BleV2Test, CanConnect) { const ByteArray& advertisement_bytes, bool fast_advertisement) { discovered_peripheral = peripheral; - NEARBY_LOG(INFO, - "Discovered peripheral=%p, fast advertisement=%d", - &peripheral, fast_advertisement); + NEARBY_LOGS(INFO) + << "Discovered peripheral=" + << peripheral.GetAddress().value_or("") + << ", fast advertisement=" << fast_advertisement; discovered_latch.CountDown(); }, }); @@ -154,9 +168,10 @@ TEST_P(BleV2Test, CanCancelConnect) { const ByteArray& advertisement_bytes, bool fast_advertisement) { discovered_peripheral = peripheral; - NEARBY_LOG(INFO, - "Discovered peripheral=%p, fast advertisement=%d", - &peripheral, fast_advertisement); + NEARBY_LOGS(INFO) + << "Discovered peripheral=" + << peripheral.GetAddress().value_or("") + << ", fast advertisement=" << fast_advertisement; discovered_latch.CountDown(); }, }); @@ -577,6 +592,471 @@ TEST_F(BleV2Test, StartScanningDiscoverButNoPeripheralLostAfterStopScanning) { env_.Stop(); } +TEST_F(BleV2Test, CanStartAndStopLegacyAdvertising) { + env_.Start(); + BluetoothRadio radio_a; + BleV2 ble_a{radio_a}; + radio_a.Enable(); + std::string service_id(kServiceIDA); + EXPECT_TRUE( + ble_a.StartLegacyAdvertising(service_id, std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid))); + EXPECT_FALSE(ble_a.IsAdvertising(service_id)); + EXPECT_TRUE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + EXPECT_TRUE(ble_a.StopLegacyAdvertising(service_id)); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + env_.Stop(); +} + +TEST_F(BleV2Test, CanNotStartLegacyAdvertisingWhenRadioNotEnabled) { + env_.Start(); + BluetoothRadio radio_a; + BleV2 ble_a{radio_a}; + radio_a.Disable(); + std::string service_id(kServiceIDA); + EXPECT_FALSE( + ble_a.StartLegacyAdvertising(service_id, std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid))); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + env_.Stop(); +} + +TEST_F(BleV2Test, CanNotStopLegacyAdvertisingForNonExistingServiceId) { + env_.Start(); + BluetoothRadio radio_a; + BleV2 ble_a{radio_a}; + radio_a.Enable(); + std::string service_id(kServiceIDA); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + EXPECT_FALSE(ble_a.StopLegacyAdvertising(service_id)); + EXPECT_TRUE( + ble_a.StartLegacyAdvertising(service_id, std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid))); + EXPECT_TRUE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + EXPECT_TRUE(ble_a.StopLegacyAdvertising(service_id)); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + env_.Stop(); +} + +TEST_F(BleV2Test, StartLegacyAdvertisingNotBlockedByRegularAdvertising) { + env_.Start(); + BluetoothRadio radio_a; + BleV2 ble_a{radio_a}; + radio_a.Enable(); + std::string service_id(kServiceIDA); + ByteArray advertisement_bytes((std::string(kAdvertisementString))); + + ble_a.StartAdvertising(std::string(kServiceIDA), advertisement_bytes, + PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + EXPECT_TRUE(ble_a.IsAdvertising(service_id)); + EXPECT_TRUE( + ble_a.StartLegacyAdvertising(service_id, std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid))); + EXPECT_TRUE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + ble_a.StopAdvertising(std::string(kServiceIDA)); + env_.Stop(); +} + +TEST_F(BleV2Test, DuplicateStartLegacyAdvertisingReturnsFalse) { + env_.Start(); + BluetoothRadio radio_a; + BleV2 ble_a{radio_a}; + radio_a.Enable(); + std::string service_id(kServiceIDA); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + EXPECT_TRUE( + ble_a.StartLegacyAdvertising(service_id, std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid))); + EXPECT_TRUE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + EXPECT_FALSE( + ble_a.StartLegacyAdvertising(service_id, std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid))); + EXPECT_TRUE(ble_a.StopLegacyAdvertising(service_id)); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(service_id)); + env_.Stop(); +} + +TEST_F(BleV2Test, HandleLegacyAdvertising) { + env_.SetFeatureFlags( + {FeatureFlags{.enable_invoking_legacy_device_discovered_cb = true}}); + env_.Start(); + BluetoothRadio radio_a; + BluetoothRadio radio_b; + BleV2 ble_a(radio_a); + BleV2 ble_b(radio_b); + radio_a.Enable(); + radio_b.Enable(); + ByteArray advertisement_bytes((std::string(kAdvertisementString))); + CountDownLatch legacy_device_found_latch(1); + + ble_b.StartLegacyAdvertising(std::string(kServiceIDA), + std::string(kLocalEndpointId), + std::string(kFastAdvertisementServiceUuid)); + EXPECT_FALSE(ble_a.IsAdvertisingForLegacyDevice(std::string(kServiceIDA))); + std::string legacy_service_id("NearbySharing"); + EXPECT_TRUE(ble_a.StartScanning( + legacy_service_id, PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [](BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + FAIL() << "Legacy device shouldn't be reported here."; + }, + .legacy_device_discovered_cb = + [&legacy_device_found_latch]() { + legacy_device_found_latch.CountDown(); + }, + })); + + EXPECT_TRUE(legacy_device_found_latch.Await(kWaitDuration).result()); + ble_b.StopAdvertising(std::string(kServiceIDA)); + EXPECT_TRUE(ble_a.StopScanning(legacy_service_id)); + env_.Stop(); +} + +TEST_F(BleV2Test, CanStartAsyncScanning) { + env_.SetFeatureFlags({FeatureFlags{.enable_ble_v2_async_scanning = true}}); + env_.Start(); + BluetoothRadio radio_a; + BluetoothRadio radio_b; + BleV2 ble_a(radio_a); + BleV2 ble_b(radio_b); + radio_a.Enable(); + radio_b.Enable(); + ByteArray advertisement_bytes((std::string(kAdvertisementString))); + CountDownLatch found_latch(1); + + ble_b.StartAdvertising(std::string(kServiceIDA), advertisement_bytes, + PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + + EXPECT_TRUE(ble_a.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + })); + + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + ble_b.StopAdvertising(std::string(kServiceIDA)); + EXPECT_TRUE(ble_a.StopScanning(std::string(kServiceIDA))); + env_.Stop(); +} + +TEST_F(BleV2Test, StartAsyncScanningWithPlatformErrors) { + env_.SetFeatureFlags({FeatureFlags{.enable_ble_v2_async_scanning = true}}); + env_.Start(); + BluetoothRadio radio_a; + BluetoothRadio radio_b; + BleV2 ble_a(radio_a); + BleV2 ble_b(radio_b); + radio_a.Enable(); + radio_b.Enable(); + ByteArray advertisement_bytes((std::string(kAdvertisementString))); + CountDownLatch found_latch(1); + + ble_b.StartAdvertising(std::string(kServiceIDA), advertisement_bytes, + PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + + // Disable radio a to simulate platform error. + radio_a.Disable(); + EXPECT_FALSE(ble_a.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + })); + + radio_a.Enable(); + EXPECT_TRUE(ble_a.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + })); + + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + ble_b.StopAdvertising(std::string(kServiceIDA)); + + EXPECT_TRUE(ble_a.StopScanning(std::string(kServiceIDA))); + + // Should return false the second time, as we removed service ID from the map. + EXPECT_FALSE(ble_a.StopScanning(std::string(kServiceIDA))); + env_.Stop(); +} + +TEST_F(BleV2Test, StartAsyncScanningDiscoverAndLostPeripheral) { + env_.SetFeatureFlags({FeatureFlags{.enable_ble_v2_async_scanning = true}}); + env_.Start(); + BluetoothRadio radio_a; + BluetoothRadio radio_b; + BleV2 ble_a(radio_a); + BleV2 ble_b(radio_b); + radio_a.Enable(); + radio_b.Enable(); + ByteArray advertisement_bytes((std::string(kAdvertisementString))); + CountDownLatch found_latch(1); + CountDownLatch lost_latch(1); + + ble_b.StartAdvertising(std::string(kServiceIDA), advertisement_bytes, + PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + + EXPECT_TRUE(ble_a.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + .peripheral_lost_cb = + [&lost_latch]( + BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { lost_latch.CountDown(); }, + })); + + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + EXPECT_TRUE(ble_b.StopAdvertising(std::string(kServiceIDA))); + + // Wait for a while (2 times delay) to let the alarm occur twice and + // `ProcessLostGattAdvertisements` twice to lost periperal. + SystemClock::Sleep(absl::Milliseconds(kPeripheralLostTimeoutInMillis) * 2); + + EXPECT_TRUE(lost_latch.Await(kWaitDuration).result()); + + EXPECT_TRUE(ble_a.StopScanning(std::string(kServiceIDA))); + env_.Stop(); +} + +TEST_F(BleV2Test, + StartAsyncScanningDiscoverButNoPeripheralLostAfterStopScanning) { + env_.SetFeatureFlags({FeatureFlags{.enable_ble_v2_async_scanning = true}}); + env_.Start(); + BluetoothRadio radio_a; + BluetoothRadio radio_b; + BleV2 ble_a(radio_a); + BleV2 ble_b(radio_b); + radio_a.Enable(); + radio_b.Enable(); + ByteArray advertisement_bytes((std::string(kAdvertisementString))); + CountDownLatch found_latch(1); + CountDownLatch lost_latch(1); + + ble_b.StartAdvertising(std::string(kServiceIDA), advertisement_bytes, + PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + + EXPECT_TRUE(ble_a.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_FALSE(fast_advertisement); + found_latch.CountDown(); + }, + .peripheral_lost_cb = + [&lost_latch]( + BleV2Peripheral peripheral, const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { lost_latch.CountDown(); }, + })); + + EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); + + EXPECT_TRUE(ble_b.StopAdvertising(std::string(kServiceIDA))); + EXPECT_TRUE(ble_a.StopScanning(std::string(kServiceIDA))); + + // Don't receive lost peripheral callback because we have stopped scanning and + // cancelled the alarm. + EXPECT_FALSE(lost_latch.Await(kWaitDuration).result()); + + env_.Stop(); +} + +TEST_F(BleV2Test, CanStartStopMultipleAsyncScanningWithDifferentServiceIds) { + env_.SetFeatureFlags({FeatureFlags{.enable_ble_v2_async_scanning = true}}); + env_.Start(); + BluetoothRadio radio_scanner; + BluetoothRadio radio_advertiser_a; + BluetoothRadio radio_advertiser_b; + BleV2 ble_scanner(radio_scanner); + BleV2 ble_advertiser_a(radio_advertiser_a); + BleV2 ble_advertiser_b(radio_advertiser_b); + radio_scanner.Enable(); + radio_advertiser_a.Enable(); + radio_advertiser_b.Enable(); + ByteArray advertisement_bytes_a((std::string(kAdvertisementString))); + ByteArray advertisement_bytes_b((std::string(kAdvertisementStringB))); + CountDownLatch found_latch_a(1); + CountDownLatch found_latch_b(1); + + ble_advertiser_a.StartAdvertising( + std::string(kServiceIDA), advertisement_bytes_a, PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + ble_advertiser_b.StartAdvertising( + std::string(kServiceIDB), advertisement_bytes_b, PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + + ble_scanner.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch_a](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(service_id, kServiceIDA); + EXPECT_FALSE(fast_advertisement); + found_latch_a.CountDown(); + }, + }); + + ble_scanner.StartScanning( + std::string(kServiceIDB), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch_b](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(service_id, kServiceIDB); + EXPECT_FALSE(fast_advertisement); + found_latch_b.CountDown(); + }, + }); + + EXPECT_TRUE(found_latch_a.Await(kWaitDuration).result()); + EXPECT_TRUE(found_latch_b.Await(kWaitDuration).result()); + EXPECT_TRUE(ble_scanner.StopScanning(std::string(kServiceIDA))); + EXPECT_TRUE(ble_scanner.StopScanning(std::string(kServiceIDB))); + env_.Stop(); +} + +TEST_F(BleV2Test, StartMultipleAsyncScanningDiscoverAndLostPeripheral) { + env_.SetFeatureFlags({FeatureFlags{.enable_ble_v2_async_scanning = true}}); + env_.Start(); + BluetoothRadio radio_scanner; + BluetoothRadio radio_advertiser_a; + BluetoothRadio radio_advertiser_b; + BleV2 ble_scanner(radio_scanner); + BleV2 ble_advertiser_a(radio_advertiser_a); + BleV2 ble_advertiser_b(radio_advertiser_b); + radio_scanner.Enable(); + radio_advertiser_a.Enable(); + radio_advertiser_b.Enable(); + ByteArray advertisement_bytes_a((std::string(kAdvertisementString))); + ByteArray advertisement_bytes_b((std::string(kAdvertisementStringB))); + CountDownLatch found_latch_a(1); + CountDownLatch found_latch_b(1); + CountDownLatch lost_latch_a(1); + CountDownLatch lost_latch_b(1); + + ble_advertiser_a.StartAdvertising( + std::string(kServiceIDA), advertisement_bytes_a, PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + ble_advertiser_b.StartAdvertising( + std::string(kServiceIDB), advertisement_bytes_b, PowerLevel::kHighPower, + /*is_fast_advertisement=*/false); + + ble_scanner.StartScanning( + std::string(kServiceIDA), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch_a](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(service_id, kServiceIDA); + EXPECT_FALSE(fast_advertisement); + found_latch_a.CountDown(); + }, + .peripheral_lost_cb = + [&lost_latch_a](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(service_id, kServiceIDA); + EXPECT_FALSE(fast_advertisement); + lost_latch_a.CountDown(); + }, + }); + + ble_scanner.StartScanning( + std::string(kServiceIDB), PowerLevel::kHighPower, + mediums::DiscoveredPeripheralCallback{ + .peripheral_discovered_cb = + [&found_latch_b](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(service_id, kServiceIDB); + EXPECT_FALSE(fast_advertisement); + found_latch_b.CountDown(); + }, + .peripheral_lost_cb = + [&lost_latch_b](BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement) { + EXPECT_EQ(service_id, kServiceIDB); + EXPECT_FALSE(fast_advertisement); + lost_latch_b.CountDown(); + }, + }); + + EXPECT_TRUE(found_latch_a.Await(kWaitDuration).result()); + EXPECT_TRUE(found_latch_b.Await(kWaitDuration).result()); + + EXPECT_TRUE(ble_advertiser_a.StopAdvertising(std::string(kServiceIDA))); + + // Wait for a while (2 times delay) to let the alarm occur twice and + // `ProcessLostGattAdvertisements` twice to lost periperal. + SystemClock::Sleep(absl::Milliseconds(kPeripheralLostTimeoutInMillis) * 2); + + EXPECT_TRUE(lost_latch_a.Await(kWaitDuration).result()); + + EXPECT_TRUE(ble_advertiser_b.StopAdvertising(std::string(kServiceIDB))); + + // Wait for a while (2 times delay) to let the alarm occur twice and + // `ProcessLostGattAdvertisements` twice to lost periperal. + SystemClock::Sleep(absl::Milliseconds(kPeripheralLostTimeoutInMillis) * 2); + + EXPECT_TRUE(lost_latch_b.Await(kWaitDuration).result()); + + EXPECT_TRUE(ble_scanner.StopScanning(std::string(kServiceIDA))); + EXPECT_TRUE(ble_scanner.StopScanning(std::string(kServiceIDB))); + env_.Stop(); +} + } // namespace } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/bluetooth_classic.cc b/connections/implementation/mediums/bluetooth_classic.cc index 34803fd8..f78ed08f 100644 --- a/connections/implementation/mediums/bluetooth_classic.cc +++ b/connections/implementation/mediums/bluetooth_classic.cc @@ -18,9 +18,18 @@ #include #include +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/mediums/bluetooth_radio.h" +#include "connections/implementation/mediums/multiplex/multiplex_socket.h" +#include "connections/medium_selector.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/bluetooth_adapter.h" #include "internal/platform/bluetooth_classic.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/socket.h" +#include "internal/platform/types.h" #include "internal/platform/uuid.h" namespace nearby { @@ -41,6 +50,8 @@ std::string ScanModeToString(BluetoothAdapter::ScanMode mode) { } } // namespace +using MultiplexSocket = mediums::multiplex::MultiplexSocket; + BluetoothClassic::BluetoothClassic(BluetoothRadio& radio) : BluetoothClassic(radio, std::make_unique( radio.GetBluetoothAdapter())) {} @@ -49,16 +60,33 @@ BluetoothClassic::BluetoothClassic( BluetoothRadio& radio, std::unique_ptr medium) : radio_(radio), adapter_(radio_.GetBluetoothAdapter()), - medium_(std::move(medium)) {} + medium_(std::move(medium)) { + is_multiplex_enabled_ = NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableMultiplex); +} BluetoothClassic::~BluetoothClassic() { // Destructor is not taking locks, but methods it is calling are. - StopDiscovery(); + StopAllDiscovery(); while (!server_sockets_.empty()) { StopAcceptingConnections(server_sockets_.begin()->first); } TurnOffDiscoverability(); + { + MutexLock lock(&mutex_); + LOG(INFO) << "Closing multiplex sockets for " << multiplex_sockets_.size() + << " devices"; + if (is_multiplex_enabled_) { + for (auto& [bt_mac, multiplex_socket] : multiplex_sockets_) { + LOG(INFO) << "Closing multiplex sockets for " + << GetRemoteDevice(bt_mac).GetName(); + multiplex_socket->Shutdown(); + } + } + multiplex_sockets_.clear(); + } + // All the AcceptLoopRunnable objects in here should already have gotten an // opportunity to shut themselves down cleanly in the calls to // StopAcceptingConnections() above. @@ -76,43 +104,41 @@ bool BluetoothClassic::IsAvailableLocked() const { } bool BluetoothClassic::TurnOnDiscoverability(const std::string& device_name) { + LOG(INFO) << "Turning on BT discoverability with device_name=" << device_name; MutexLock lock(&mutex_); if (device_name.empty()) { - NEARBY_LOGS(INFO) - << "Refusing to turn on BT discoverability. Empty device name."; + LOG(INFO) << "Refusing to turn on BT discoverability. Empty device name."; return false; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) << "Can't turn on BT discoverability. BT is off."; + LOG(INFO) << "Can't turn on BT discoverability. BT is off."; return false; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) - << "Can't turn on BT discoverability. BT is not available."; + LOG(INFO) << "Can't turn on BT discoverability. BT is not available."; return false; } if (IsDiscoverable()) { - NEARBY_LOGS(INFO) << "Refusing to turn on BT discoverability; new name='" - << device_name << "'; current name='" - << adapter_.GetName() << "'"; + LOG(INFO) << "Refusing to turn on BT discoverability; new name='" + << device_name << "'; current name='" << adapter_.GetName() + << "'"; return false; } if (!ModifyDeviceName(device_name)) { - NEARBY_LOGS(INFO) - << "Failed to turn on BT discoverability; failed to set name to " - << device_name; + LOG(INFO) << "Failed to turn on BT discoverability; failed to set name to " + << device_name; return false; } if (!ModifyScanMode(ScanMode::kConnectableDiscoverable)) { - NEARBY_LOGS(INFO) << "Failed to turn on BT discoverability; failed to set " - "scan_mode to " - << ScanModeToString(ScanMode::kConnectableDiscoverable); + LOG(INFO) << "Failed to turn on BT discoverability; failed to set " + "scan_mode to " + << ScanModeToString(ScanMode::kConnectableDiscoverable); // Don't forget to perform this rollback of the partial state changes we've // made til now. @@ -120,23 +146,23 @@ bool BluetoothClassic::TurnOnDiscoverability(const std::string& device_name) { return false; } - NEARBY_LOGS(INFO) << "Turned on BT discoverability with device_name=" - << device_name; + LOG(INFO) << "Turned on BT discoverability with device_name=" << device_name; return true; } bool BluetoothClassic::TurnOffDiscoverability() { + LOG(INFO) << "Turning off Bluetooth discoverability."; MutexLock lock(&mutex_); if (!IsDiscoverable()) { - NEARBY_LOGS(INFO) << "Can't turn off BT discoverability; it is already off"; + LOG(INFO) << "Can't turn off BT discoverability; it is already off"; return false; } RestoreScanMode(); RestoreDeviceName(); - NEARBY_LOGS(INFO) << "Turned Bluetooth discoverability off"; + LOG(INFO) << "Turned Bluetooth discoverability off."; return true; } @@ -169,8 +195,8 @@ bool BluetoothClassic::ModifyScanMode(ScanMode scan_mode) { bool BluetoothClassic::RestoreScanMode() { if (original_scan_mode_ == ScanMode::kUnknown || !adapter_.SetScanMode(original_scan_mode_)) { - NEARBY_LOGS(INFO) << "Failed to restore original Bluetooth scan mode to " - << ScanModeToString(original_scan_mode_); + LOG(INFO) << "Failed to restore original Bluetooth scan mode to " + << ScanModeToString(original_scan_mode_); return false; } @@ -183,38 +209,77 @@ bool BluetoothClassic::RestoreScanMode() { bool BluetoothClassic::RestoreDeviceName() { if (original_device_name_.empty() || !adapter_.SetName(original_device_name_, /* persis= */ true)) { - NEARBY_LOGS(INFO) << "Failed to restore original Bluetooth device name to " - << original_device_name_; + LOG(INFO) << "Failed to restore original Bluetooth device name to " + << original_device_name_; return false; } original_device_name_.clear(); return true; } -bool BluetoothClassic::StartDiscovery(DiscoveredDeviceCallback callback) { +bool BluetoothClassic::StartDiscovery(const std::string& serviceId, + DiscoveredDeviceCallback callback) { MutexLock lock(&mutex_); + if (serviceId.empty()) { + LOG(INFO) << "Refusing to start discovery; service ID is empty."; + return false; + } + if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) << "Can't discover BT devices because BT isn't enabled."; + LOG(INFO) << "Can't discover BT devices because BT isn't enabled."; return false; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) - << "Can't discover BT devices because BT isn't available."; + LOG(INFO) << "Can't discover BT devices because BT isn't available."; return false; } - if (IsDiscovering()) { - NEARBY_LOGS(INFO) - << "Refusing to start discovery of BT devices because another " - "discovery is already in-progress."; + if (IsDiscoveringLocked(serviceId)) { + LOG(INFO) << "Refusing to start discovery of BT devices because another " + "discovery is already in-progress for service_id=" + << serviceId; return false; } - if (!medium_->StartDiscovery(std::move(callback))) { - NEARBY_LOGS(INFO) << "Failed to start discovery of BT devices."; - return false; + if (!HasDiscoveryCallbacks()) { + BluetoothClassicMedium::DiscoveryCallback medium_callback{ + .device_discovered_cb = + [this](BluetoothDevice& device) { + MutexLock lock(&discovery_callbacks_mutex_); + for (auto& [service_id, callback] : discovery_callbacks_) { + if (callback.device_discovered_cb) { + callback.device_discovered_cb(device); + } + } + }, + .device_name_changed_cb = + [this](BluetoothDevice& device) { + MutexLock lock(&discovery_callbacks_mutex_); + for (auto& [service_id, callback] : discovery_callbacks_) { + if (callback.device_name_changed_cb) { + callback.device_name_changed_cb(device); + } + } + }, + .device_lost_cb = + [this](BluetoothDevice& device) { + MutexLock lock(&discovery_callbacks_mutex_); + for (auto& [service_id, callback] : discovery_callbacks_) { + if (callback.device_lost_cb) { + callback.device_lost_cb(device); + } + } + }}; + + AddDiscoveryCallback(serviceId, std::move(callback)); + + if (!medium_->StartDiscovery(std::move(medium_callback))) { + LOG(INFO) << "Failed to start discovery of BT devices."; + RemoveDiscoveryCallback(serviceId); + return false; + } } // Mark the fact that we're currently performing a Bluetooth scan. @@ -223,60 +288,76 @@ bool BluetoothClassic::StartDiscovery(DiscoveredDeviceCallback callback) { return true; } -bool BluetoothClassic::StopDiscovery() { +bool BluetoothClassic::StopDiscovery(const std::string& serviceId) { MutexLock lock(&mutex_); - if (!IsDiscovering()) { - NEARBY_LOGS(INFO) - << "Can't stop discovery of BT devices because it never started."; + if (!IsDiscoveringLocked(serviceId)) { + LOG(INFO) << "Can't stop discovery of BT devices because it never started."; return false; } - if (!medium_->StopDiscovery()) { - NEARBY_LOGS(INFO) << "Failed to stop discovery of Bluetooth devices."; - return false; - } + RemoveDiscoveryCallback(serviceId); - scan_info_.valid = false; + if (!HasDiscoveryCallbacks()) { + if (!medium_->StopDiscovery()) { + LOG(INFO) << "Failed to stop discovery of Bluetooth devices."; + return false; + } + + scan_info_.valid = false; + } return true; } -bool BluetoothClassic::IsDiscovering() const { return scan_info_.valid; } +bool BluetoothClassic::IsDiscoveringLocked(const std::string& serviceId) const { + MutexLock lock(&discovery_callbacks_mutex_); + return scan_info_.valid && discovery_callbacks_.contains(serviceId); +} + +void BluetoothClassic::StopAllDiscovery() { + MutexLock lock(&mutex_); + if (!medium_->StopDiscovery()) { + LOG(INFO) << "Failed to stop discovery of Bluetooth devices."; + } + + RemoveAllDiscoveryCallbacks(); + scan_info_.valid = false; +} bool BluetoothClassic::StartAcceptingConnections( const std::string& service_id, AcceptedConnectionCallback callback) { MutexLock lock(&mutex_); if (service_id.empty()) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Refusing to start accepting BT connections; service ID is empty."; return false; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) << "Can't create BT server socket [service=" << service_id - << "]; BT is disabled."; + LOG(INFO) << "Can't create BT server socket [service=" << service_id + << "]; BT is disabled."; return false; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) << "Can't start accepting BT connections [service=" - << service_id << "]; BT not available."; + LOG(INFO) << "Can't start accepting BT connections [service=" << service_id + << "]; BT not available."; return false; } if (IsAcceptingConnectionsLocked(service_id)) { - NEARBY_LOGS(INFO) - << "Refusing to start accepting BT connections [service=" << service_id - << "]; BT server is already in-progress with the same name."; + LOG(INFO) << "Refusing to start accepting BT connections [service=" + << service_id + << "]; BT server is already in-progress with the same name."; return false; } BluetoothServerSocket socket = medium_->ListenForService(service_id, GenerateUuidFromString(service_id)); if (!socket.IsValid()) { - NEARBY_LOGS(INFO) << "Failed to start accepting Bluetooth connections for " - << service_id; + LOG(INFO) << "Failed to start accepting Bluetooth connections for " + << service_id; return false; } @@ -285,24 +366,67 @@ bool BluetoothClassic::StartAcceptingConnections( auto owned_socket = server_sockets_.emplace(service_id, std::move(socket)).first->second; - // Start the accept loop on a dedicated thread - this stays alive and - // listening for new incoming connections until StopAcceptingConnections() is - // invoked. - accept_loops_runner_.Execute( - "bt-accept", - [callback = std::move(callback), server_socket = std::move(owned_socket), - service_id]() mutable { - while (true) { - BluetoothSocket client_socket = server_socket.Accept(); - if (!client_socket.IsValid()) { - server_socket.Close(); - break; - } + if (is_multiplex_enabled_) { + MultiplexSocket::ListenForIncomingConnection( + service_id, Medium::BLUETOOTH, + [&callback](const std::string& listening_service_id, + MediumSocket* virtual_socket) mutable { if (callback) { - callback(service_id, std::move(client_socket)); + callback(listening_service_id, + *(down_cast(virtual_socket))); + } + }); + } + // Start the accept loop on a dedicated thread - this stays alive and + // listening for new incoming connections until StopAcceptingConnections() + // is invoked. + accept_loops_runner_.Execute("bt-accept", [callback = std::move(callback), + server_socket = + std::move(owned_socket), + service_id, this]() mutable { + while (true) { + BluetoothSocket client_socket = server_socket.Accept(); + if (!client_socket.IsValid()) { + LOG(INFO) << "Failed to accept connection for " << service_id; + server_socket.Close(); + break; + } + LOG(INFO) << "Accepted connection for " << service_id; + bool callback_called = false; + { + MutexLock lock(&mutex_); + if (is_multiplex_enabled_) { + BluetoothSocket client_socket_bak = client_socket; + auto physical_socket_ptr = + std::make_shared(client_socket_bak); + MultiplexSocket* multiplex_socket = + MultiplexSocket::CreateIncomingSocket(physical_socket_ptr, + service_id); + + if (multiplex_socket != nullptr && + multiplex_socket->GetVirtualSocket(service_id)) { + multiplex_sockets_.emplace( + client_socket.GetRemoteDevice().GetMacAddress(), + multiplex_socket); + MultiplexSocket::StopListeningForIncomingConnection( + service_id, Medium::BLUETOOTH); + LOG(INFO) << "Multiplex virtaul socket created for " + << client_socket.GetRemoteDevice().GetName(); + if (callback) { + callback(service_id, + *(down_cast( + multiplex_socket->GetVirtualSocket(service_id)))); + callback_called = true; + } } } - }); + } + if (callback && !callback_called) { + LOG(INFO) << "Call back triggered for physical socket."; + callback(service_id, std::move(client_socket)); + } + } + }); return true; } @@ -322,22 +446,26 @@ bool BluetoothClassic::StopAcceptingConnections(const std::string& service_id) { MutexLock lock(&mutex_); if (service_id.empty()) { - NEARBY_LOGS(INFO) << "Unable to stop accepting BT connections because the " - "service_id is empty."; + LOG(INFO) << "Unable to stop accepting BT connections because the " + "service_id is empty."; return false; } const auto& it = server_sockets_.find(service_id); if (it == server_sockets_.end()) { - NEARBY_LOGS(INFO) << "Can't stop accepting BT connections for " - << service_id << " because it was never started."; + LOG(INFO) << "Can't stop accepting BT connections for " << service_id + << " because it was never started."; return false; } + if (is_multiplex_enabled_) { + MultiplexSocket::StopListeningForIncomingConnection(service_id, + Medium::BLUETOOTH); + } // Closing the BluetoothServerSocket will kick off the suicide of the thread - // in accept_loops_thread_pool_ that blocks on BluetoothServerSocket.accept(). - // That may take some time to complete, but there's no particular reason to - // wait around for it. + // in accept_loops_thread_pool_ that blocks on + // BluetoothServerSocket.accept(). That may take some time to complete, but + // there's no particular reason to wait around for it. auto item = server_sockets_.extract(it); // Store a handle to the BluetoothServerSocket, so we can use it after @@ -351,7 +479,7 @@ bool BluetoothClassic::StopAcceptingConnections(const std::string& service_id) { // Finally, close the BluetoothServerSocket. if (!listening_socket.Close().Ok()) { - NEARBY_LOGS(INFO) << "Failed to close BT server socket for " << service_id; + LOG(INFO) << "Failed to close BT server socket for " << service_id; return false; } @@ -361,22 +489,43 @@ bool BluetoothClassic::StopAcceptingConnections(const std::string& service_id) { BluetoothSocket BluetoothClassic::Connect(BluetoothDevice& bluetooth_device, const std::string& service_id, CancellationFlag* cancellation_flag) { + { + MutexLock lock(&mutex_); + if (is_multiplex_enabled_) { + LOG(INFO) << "multiplex_sockets_ size:" << multiplex_sockets_.size(); + auto it = multiplex_sockets_.find(bluetooth_device.GetMacAddress()); + if (it != multiplex_sockets_.end()) { + MultiplexSocket* multiplex_socket = it->second; + if (multiplex_socket->IsEnabled()) { + auto* virtual_socket = + multiplex_socket->EstablishVirtualSocket(service_id); + // Should not happen. + auto* bluetooth_socket = down_cast(virtual_socket); + if (bluetooth_socket == nullptr) { + LOG(INFO) << "Failed to cast to BluetoothSocket for " << service_id + << " with " << bluetooth_device.GetName(); + return BluetoothSocket{}; + } + return *bluetooth_socket; + } + } + } + } service_id_to_connect_attempts_count_map_[service_id] = 1; while (service_id_to_connect_attempts_count_map_[service_id] <= kConnectAttemptsLimit) { if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(WARNING) - << "Attempt #" - << service_id_to_connect_attempts_count_map_[service_id] - << ": Cannot start creating client BT socket due to cancel."; - return BluetoothSocket(); + LOG(WARNING) << "Attempt #" + << service_id_to_connect_attempts_count_map_[service_id] + << ": Cannot start creating client BT socket due to cancel."; + return BluetoothSocket{}; } - NEARBY_LOGS(INFO) << "Attempt #" - << service_id_to_connect_attempts_count_map_[service_id] - << " to connect."; auto wrapper_result = AttemptToConnect(bluetooth_device, service_id, cancellation_flag); + LOG(INFO) << "Attempt #" + << service_id_to_connect_attempts_count_map_[service_id] + << " to connect: " << wrapper_result.IsValid(); if (wrapper_result.IsValid()) { return wrapper_result; } @@ -384,35 +533,39 @@ BluetoothSocket BluetoothClassic::Connect(BluetoothDevice& bluetooth_device, service_id_to_connect_attempts_count_map_[service_id]++; } - NEARBY_LOGS(WARNING) << "Giving up after " << kConnectAttemptsLimit - << " attempts"; - return BluetoothSocket(); + LOG(WARNING) << "Giving up after " << kConnectAttemptsLimit << " attempts"; + return BluetoothSocket{}; } BluetoothSocket BluetoothClassic::AttemptToConnect( BluetoothDevice& bluetooth_device, const std::string& service_id, CancellationFlag* cancellation_flag) { MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << "BluetoothClassic::Connect: service_id=" << service_id - << ", device=" << &bluetooth_device; + LOG(INFO) << "BluetoothClassic::Connect: service_id=" << service_id + << ", device=" << &bluetooth_device; // Socket to return. To allow for NRVO to work, it has to be a single object. - BluetoothSocket socket; + BluetoothSocket socket{}; if (service_id.empty()) { - NEARBY_LOGS(INFO) + LOG(WARNING) << "Refusing to create client BT socket because service_id is empty."; return socket; } if (!radio_.IsEnabled()) { - NEARBY_LOGS(INFO) << "Can't create client BT socket [service=" << service_id - << "]: BT isn't enabled."; + LOG(WARNING) << "Can't create client BT socket [service=" << service_id + << "]: BT isn't enabled."; return socket; } if (!IsAvailableLocked()) { - NEARBY_LOGS(INFO) << "Can't create client BT socket [service=" << service_id - << "]; BT isn't available."; + LOG(WARNING) << "Can't create client BT socket [service=" << service_id + << "]; BT isn't available."; + return socket; + } + + if (!bluetooth_device.IsValid()) { + LOG(WARNING) << "Bluetooth device is not valid."; return socket; } @@ -423,14 +576,56 @@ BluetoothSocket BluetoothClassic::AttemptToConnect( // `ConnectToService`, return an empty socket. There is no need for a // CancellationFlagListener because the attempt logic is not asynchronous. if (!socket.IsValid() || cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) << "Failed to Connect via BT [service=" << service_id - << "]"; - return BluetoothSocket(); + LOG(INFO) << "Failed to Connect via BT [service=" << service_id << "]"; + return BluetoothSocket{}; + } + + if (is_multiplex_enabled_) { + // New MultiplexSocket but default disabled, should be enabled after + // negotiated + auto physical_socket_ptr = std::make_shared(socket); + MultiplexSocket* multiplex_socket = MultiplexSocket::CreateOutgoingSocket( + std::move(physical_socket_ptr), service_id); + + auto* virtual_socket = multiplex_socket->GetVirtualSocket(service_id); + // Should not happen. + auto* bluetooth_socket = down_cast(virtual_socket); + if (bluetooth_socket == nullptr) { + LOG(INFO) << "Failed to cast to BluetoothSocket for " << service_id + << " with " << bluetooth_device.GetName(); + return BluetoothSocket{}; + } + LOG(INFO) << "Multiplex socket created for " << bluetooth_device.GetName(); + multiplex_sockets_.emplace(bluetooth_device.GetMacAddress(), + multiplex_socket); + return *bluetooth_socket; } return socket; } +bool BluetoothClassic::HasDiscoveryCallbacks() const { + MutexLock lock(&discovery_callbacks_mutex_); + return !discovery_callbacks_.empty(); +} + +void BluetoothClassic::RemoveDiscoveryCallback(const std::string& service_id) { + MutexLock lock(&discovery_callbacks_mutex_); + if (discovery_callbacks_.contains(service_id)) { + discovery_callbacks_.erase(service_id); + } +} +void BluetoothClassic::AddDiscoveryCallback(const std::string& service_id, + DiscoveredDeviceCallback callback) { + MutexLock lock(&discovery_callbacks_mutex_); + discovery_callbacks_.insert({service_id, std::move(callback)}); +} + +void BluetoothClassic::RemoveAllDiscoveryCallbacks() { + MutexLock lock(&discovery_callbacks_mutex_); + discovery_callbacks_.clear(); +} + BluetoothDevice BluetoothClassic::GetRemoteDevice( const std::string& mac_address) { MutexLock lock(&mutex_); @@ -442,6 +637,12 @@ BluetoothDevice BluetoothClassic::GetRemoteDevice( return medium_->GetRemoteDevice(mac_address); } +bool BluetoothClassic::IsDiscovering(const std::string& serviceId) const { + MutexLock lock(&mutex_); + return IsDiscoveringLocked(serviceId); + ; +} + std::string BluetoothClassic::GetMacAddress() const { MutexLock lock(&mutex_); diff --git a/connections/implementation/mediums/bluetooth_classic.h b/connections/implementation/mediums/bluetooth_classic.h index 8c84215f..dd60c035 100644 --- a/connections/implementation/mediums/bluetooth_classic.h +++ b/connections/implementation/mediums/bluetooth_classic.h @@ -15,18 +15,19 @@ #ifndef CORE_INTERNAL_MEDIUMS_BLUETOOTH_CLASSIC_H_ #define CORE_INTERNAL_MEDIUMS_BLUETOOTH_CLASSIC_H_ -#include -#include #include #include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" +#include "absl/functional/any_invocable.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/mediums/bluetooth_radio.h" -#include "connections/listeners.h" +#include "connections/implementation/mediums/multiplex/multiplex_socket.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/bluetooth_adapter.h" #include "internal/platform/bluetooth_classic.h" -#include "internal/platform/byte_array.h" #include "internal/platform/cancellation_flag.h" #include "internal/platform/multi_thread_executor.h" #include "internal/platform/mutex.h" @@ -63,17 +64,16 @@ class BluetoothClassic { // Called by server. bool TurnOffDiscoverability() ABSL_LOCKS_EXCLUDED(mutex_); - // Enables BT discovery mode. Will report any discoverable devices in range - // through a callback. - // Returns true, if discovery mode was enabled, false otherwise. - // Called by client. - bool StartDiscovery(DiscoveredDeviceCallback callback) + // Enables BT discovery for serviceId. If it is the first call to start + // discovery, will enable BT discovery mode. + // Returns true, if discovery enabled for serviceId, false otherwise. + bool StartDiscovery(const std::string& serviceId, + DiscoveredDeviceCallback callback) ABSL_LOCKS_EXCLUDED(mutex_); - // Disables BT discovery mode. - // Returns true, if discovery mode was previously enabled, false otherwise. - // Called by client. - bool StopDiscovery() ABSL_LOCKS_EXCLUDED(mutex_); + // Disables BT discovery for serviceId. + // if it is the last call to stop discovery, will disable BT discovery mode. + bool StopDiscovery(const std::string& serviceId) ABSL_LOCKS_EXCLUDED(mutex_); // Starts a worker thread, creates a BT server socket, associates it with a // service ID; in a worker thread repeatedly calls ServerSocket::Accept(). @@ -121,6 +121,9 @@ class BluetoothClassic { BluetoothDevice GetRemoteDevice(const std::string& mac_address) ABSL_LOCKS_EXCLUDED(mutex_); + bool IsDiscovering(const std::string& serviceId) const + ABSL_LOCKS_EXCLUDED(mutex_); + protected: // Use for unit tests only to inject a BluetoothClassicMedium. BluetoothClassic(BluetoothRadio& radio, @@ -171,7 +174,10 @@ class BluetoothClassic { bool RestoreDeviceName() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Returns true if device is currently in discovery mode. - bool IsDiscovering() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + bool IsDiscoveringLocked(const std::string& serviceId) const + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + + void StopAllDiscovery() ABSL_LOCKS_EXCLUDED(mutex_); // Establishes connection to BT service that was might be started on another // device with StartAcceptingConnections() using the same service_id. @@ -182,6 +188,17 @@ class BluetoothClassic { const std::string& service_id, CancellationFlag* cancellation_flag); + // Accesses to discovery callbacks. + bool HasDiscoveryCallbacks() const + ABSL_LOCKS_EXCLUDED(discovery_callbacks_mutex_); + void RemoveDiscoveryCallback(const std::string& service_id) + ABSL_LOCKS_EXCLUDED(discovery_callbacks_mutex_); + void AddDiscoveryCallback(const std::string& service_id, + DiscoveredDeviceCallback callback) + ABSL_LOCKS_EXCLUDED(discovery_callbacks_mutex_); + void RemoveAllDiscoveryCallbacks() + ABSL_LOCKS_EXCLUDED(discovery_callbacks_mutex_); + mutable Mutex mutex_; BluetoothRadio& radio_ ABSL_GUARDED_BY(mutex_); BluetoothAdapter& adapter_ ABSL_GUARDED_BY(mutex_); @@ -209,6 +226,21 @@ class BluetoothClassic { // and thus require pointer stability. absl::flat_hash_map server_sockets_ ABSL_GUARDED_BY(mutex_); + + // A map of service ID to discovery callback. + mutable Mutex discovery_callbacks_mutex_; + absl::flat_hash_map + discovery_callbacks_ ABSL_GUARDED_BY(discovery_callbacks_mutex_); + + // Whether the multiplex feature is enabled. + bool is_multiplex_enabled_ = NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableMultiplex); + + // A map of Bluetooth MacAddress -> MultiplexSocket. + absl::flat_hash_map + multiplex_sockets_ ABSL_GUARDED_BY(mutex_); }; } // namespace connections diff --git a/connections/implementation/mediums/bluetooth_classic_test.cc b/connections/implementation/mediums/bluetooth_classic_test.cc index 0c618524..0da5e525 100644 --- a/connections/implementation/mediums/bluetooth_classic_test.cc +++ b/connections/implementation/mediums/bluetooth_classic_test.cc @@ -18,16 +18,18 @@ #include #include -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/strings/string_view.h" #include "absl/time/time.h" #include "connections/implementation/mediums/bluetooth_radio.h" +#include "internal/platform/bluetooth_adapter.h" #include "internal/platform/bluetooth_classic.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/system_clock.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" -#include "internal/platform/system_clock.h" namespace nearby { namespace connections { @@ -45,6 +47,9 @@ constexpr FeatureFlags kTestCases[] = { }; constexpr absl::Duration kWaitDuration = absl::Milliseconds(1000); +constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; +constexpr absl::string_view kServiceId1{"service ID 1"}; +constexpr absl::string_view kServiceId2{"service ID 2"}; class FakeBluetoothClassicMedium final : public BluetoothClassicMedium { public: @@ -83,7 +88,7 @@ class BluetoothClassicTest : public ::testing::TestWithParam { protected: using DiscoveryCallback = BluetoothClassicMedium::DiscoveryCallback; - BluetoothClassicTest() { + void SetUp() override { env_.Start(); radio_a_ = std::make_unique(); radio_b_ = std::make_unique(); @@ -104,7 +109,7 @@ class BluetoothClassicTest : public ::testing::TestWithParam { env_.Sync(); } - ~BluetoothClassicTest() override { + void TearDown() override { env_.Sync(false); radio_a_->Disable(); radio_b_->Disable(); @@ -126,12 +131,123 @@ class BluetoothClassicTest : public ::testing::TestWithParam { std::unique_ptr bt_b_; }; -TEST_P(BluetoothClassicTest, CanConnect) { +TEST_P(BluetoothClassicTest, CanNotTurnOnDiscoverability) { FeatureFlags feature_flags = GetParam(); env_.SetFeatureFlags(feature_flags); - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; - constexpr absl::string_view kServiceName1{"service name"}; + BluetoothRadio& radio_for_client = *radio_a_; + BluetoothClassic& bt_client = *bt_a_; + + // Cannot turn on discoverability to an empty device name. + EXPECT_FALSE(bt_client.TurnOnDiscoverability("")); + + // Cannot turn on discoverability when radio is disabled. + radio_for_client.Disable(); + EXPECT_FALSE(bt_client.TurnOnDiscoverability(std::string(kDeviceName))); + radio_for_client.Enable(); + + // Cannot connect when discovery is running. + EXPECT_TRUE(bt_client.TurnOnDiscoverability(std::string(kDeviceName))); + env_.Sync(); + EXPECT_FALSE(bt_client.TurnOnDiscoverability(std::string(kDeviceName))); +} + +TEST_P(BluetoothClassicTest, CanNotConnect) { + FeatureFlags feature_flags = GetParam(); + env_.SetFeatureFlags(feature_flags); + + BluetoothRadio& radio_for_client = *radio_a_; + BluetoothClassic& bt_client = *bt_a_; + + // Cannot connect to an empty service id. + CancellationFlag flag; + BluetoothDevice discovered_device; + BluetoothSocket socket_for_client = + bt_client.Connect(discovered_device, "", &flag); + + EXPECT_FALSE(socket_for_client.IsValid()); + + // Cannot connect when radio is disabled. + radio_for_client.Disable(); + socket_for_client = + bt_client.Connect(discovered_device, std::string(kServiceId1), &flag); + EXPECT_FALSE(socket_for_client.IsValid()); + radio_for_client.Enable(); + + // Cannot connect when adapter is disabled. + radio_for_client.GetBluetoothAdapter().SetStatus( + BluetoothAdapter::Status::kDisabled); + socket_for_client = + bt_client.Connect(discovered_device, std::string(kServiceId1), &flag); + EXPECT_FALSE(socket_for_client.IsValid()); +} + +TEST_P(BluetoothClassicTest, CannotStartAcceptingConnections) { + FeatureFlags feature_flags = GetParam(); + env_.SetFeatureFlags(feature_flags); + + BluetoothRadio& radio_for_client = *radio_a_; + BluetoothClassic& bt_client = *bt_a_; + + // Cannot start accepting connections to an empty service ID. + EXPECT_FALSE(bt_client.StartAcceptingConnections( + "", [&](const std::string& service_id, BluetoothSocket socket) {})); + + // Cannot start accepting connections when radio is disabled. + radio_for_client.Disable(); + EXPECT_FALSE(bt_client.StartAcceptingConnections( + std::string(kServiceId1), + [&](const std::string& service_id, BluetoothSocket socket) {})); + radio_for_client.Enable(); + + // Cannot start accepting connections when it is already accepting. + EXPECT_FALSE(bt_client.IsAcceptingConnections(std::string(kServiceId1))); + EXPECT_TRUE(bt_client.StartAcceptingConnections( + std::string(kServiceId1), + [&](const std::string& service_id, BluetoothSocket socket) {})); + EXPECT_TRUE(bt_client.IsAcceptingConnections(std::string(kServiceId1))); + env_.Sync(); + EXPECT_FALSE(bt_client.StartAcceptingConnections( + std::string(kServiceId1), + [&](const std::string& service_id, BluetoothSocket socket) {})); +} + +TEST_P(BluetoothClassicTest, CannotStopAcceptingConnections) { + FeatureFlags feature_flags = GetParam(); + env_.SetFeatureFlags(feature_flags); + + BluetoothClassic& bt_client = *bt_a_; + + // Cannot stop accepting connections to an empty service ID. + EXPECT_FALSE(bt_client.StopAcceptingConnections("")); + + // Cannot stop accepting connections when service ID is not accepting. + EXPECT_FALSE(bt_client.StopAcceptingConnections(std::string(kServiceId1))); +} + +TEST_P(BluetoothClassicTest, CannotStartDiscovery) { + FeatureFlags feature_flags = GetParam(); + env_.SetFeatureFlags(feature_flags); + + BluetoothRadio& radio_for_client = *radio_a_; + BluetoothClassic& bt_client = *bt_a_; + + // Cannot start discovery when service ID is empty. + EXPECT_FALSE(bt_client.StartDiscovery("", {})); + + // Cannot start discovery when radio is disabled. + radio_for_client.Disable(); + EXPECT_FALSE(bt_client.StartDiscovery(std::string(kServiceId1), {})); + radio_for_client.Enable(); + + // Cannot start discovery when it is already discovering. + EXPECT_TRUE(bt_client.StartDiscovery(std::string(kServiceId1), {})); + EXPECT_FALSE(bt_client.StartDiscovery(std::string(kServiceId1), {})); +} + +TEST_P(BluetoothClassicTest, CanConnect) { + FeatureFlags feature_flags = GetParam(); + env_.SetFeatureFlags(feature_flags); BluetoothRadio& radio_for_client = *radio_a_; BluetoothRadio& radio_for_server = *radio_b_; @@ -146,31 +262,33 @@ TEST_P(BluetoothClassicTest, CanConnect) { std::string(kDeviceName)); CountDownLatch latch(1); BluetoothDevice discovered_device; - EXPECT_TRUE(bt_client.StartDiscovery({ - .device_discovered_cb = - [&latch, &discovered_device](BluetoothDevice& device) { - discovered_device = device; - NEARBY_LOG(INFO, "Discovered device=%p [impl=%p]", &device, - &device.GetImpl()); - latch.CountDown(); - }, - })); + EXPECT_TRUE(bt_client.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Discovered device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + latch.CountDown(); + }, + })); EXPECT_TRUE(latch.Await(kWaitDuration).result()); EXPECT_TRUE(bt_server.TurnOffDiscoverability()); ASSERT_TRUE(discovered_device.IsValid()); BluetoothSocket socket_for_server; CountDownLatch accept_latch(1); EXPECT_TRUE(bt_server.StartAcceptingConnections( - std::string(kServiceName1), + std::string(kServiceId1), [&](const std::string& service_id, BluetoothSocket socket) { socket_for_server = std::move(socket); accept_latch.CountDown(); })); CancellationFlag flag; BluetoothSocket socket_for_client = - bt_client.Connect(discovered_device, std::string(kServiceName1), &flag); + bt_client.Connect(discovered_device, std::string(kServiceId1), &flag); EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); EXPECT_TRUE(socket_for_server.IsValid()); EXPECT_TRUE(socket_for_client.IsValid()); EXPECT_TRUE(socket_for_server.GetRemoteDevice().IsValid()); @@ -181,9 +299,6 @@ TEST_P(BluetoothClassicTest, CanCancelBeforeConnect) { FeatureFlags feature_flags = GetParam(); env_.SetFeatureFlags(feature_flags); - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; - constexpr absl::string_view kServiceName1{"service name"}; - BluetoothRadio& radio_for_client = *radio_a_; BluetoothRadio& radio_for_server = *radio_b_; TestBluetoothClassic& bt_client = *bt_a_; @@ -197,47 +312,49 @@ TEST_P(BluetoothClassicTest, CanCancelBeforeConnect) { std::string(kDeviceName)); CountDownLatch latch(1); BluetoothDevice discovered_device; - EXPECT_TRUE(bt_client.StartDiscovery({ - .device_discovered_cb = - [&latch, &discovered_device](BluetoothDevice& device) { - discovered_device = device; - NEARBY_LOG(INFO, "Discovered device=%p [impl=%p]", &device, - &device.GetImpl()); - latch.CountDown(); - }, - })); + EXPECT_TRUE(bt_client.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch, &discovered_device](BluetoothDevice& device) { + NEARBY_LOGS(INFO) << "Discovered device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + discovered_device = device; + latch.CountDown(); + }, + })); EXPECT_TRUE(latch.Await(kWaitDuration).result()); EXPECT_TRUE(bt_server.TurnOffDiscoverability()); ASSERT_TRUE(discovered_device.IsValid()); BluetoothSocket socket_for_server; CountDownLatch accept_latch(1); EXPECT_TRUE(bt_server.StartAcceptingConnections( - std::string(kServiceName1), + std::string(kServiceId1), [&](const std::string& service_id, BluetoothSocket socket) { socket_for_server = std::move(socket); accept_latch.CountDown(); })); CancellationFlag flag(true); BluetoothSocket socket_for_client = - bt_client.Connect(discovered_device, std::string(kServiceName1), &flag); + bt_client.Connect(discovered_device, std::string(kServiceId1), &flag); // If FeatureFlag is disabled, Cancelled is false as no-op. if (!feature_flags.enable_cancellation_flag) { EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); EXPECT_TRUE(socket_for_server.IsValid()); EXPECT_TRUE(socket_for_client.IsValid()); EXPECT_TRUE(socket_for_server.GetRemoteDevice().IsValid()); EXPECT_TRUE(socket_for_client.GetRemoteDevice().IsValid()); } else { EXPECT_FALSE(accept_latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); EXPECT_FALSE(socket_for_server.IsValid()); EXPECT_FALSE(socket_for_client.IsValid()); // Expect an invalid socket from stopping during the first attempt to - // connect, because `Connect` returned immediatley when it checked for + // connect, because `Connect` returned immediately when it checked for // cancellation. - EXPECT_EQ(1, bt_client.connect_attempts_count(std::string(kServiceName1))); + EXPECT_EQ(1, bt_client.connect_attempts_count(std::string(kServiceId1))); } } @@ -245,9 +362,6 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect) { FeatureFlags feature_flags = GetParam(); env_.SetFeatureFlags(feature_flags); - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; - constexpr absl::string_view kServiceName1{"service name"}; - BluetoothRadio& radio_for_client = *radio_a_; BluetoothRadio& radio_for_server = *radio_b_; TestBluetoothClassic& bt_client = *bt_a_; @@ -264,40 +378,42 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect) { std::string(kDeviceName)); CountDownLatch latch(1); BluetoothDevice discovered_device; - EXPECT_TRUE(bt_client.StartDiscovery({ - .device_discovered_cb = - [&latch, &discovered_device](BluetoothDevice& device) { - discovered_device = device; - NEARBY_LOG(INFO, "Discovered device=%p [impl=%p]", &device, - &device.GetImpl()); - latch.CountDown(); - }, - })); + EXPECT_TRUE(bt_client.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Discovered device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + latch.CountDown(); + }, + })); EXPECT_TRUE(latch.Await(kWaitDuration).result()); EXPECT_TRUE(bt_server.TurnOffDiscoverability()); ASSERT_TRUE(discovered_device.IsValid()); BluetoothSocket socket_for_server; CountDownLatch accept_latch(1); EXPECT_TRUE(bt_server.StartAcceptingConnections( - std::string(kServiceName1), + std::string(kServiceId1), [&](const std::string& service_id, BluetoothSocket socket) { socket_for_server = std::move(socket); accept_latch.CountDown(); })); CancellationFlag flag; BluetoothSocket socket_for_client = - bt_client.Connect(discovered_device, std::string(kServiceName1), &flag); + bt_client.Connect(discovered_device, std::string(kServiceId1), &flag); // If FeatureFlag is disabled, Cancelled is false as no-op. if (!feature_flags.enable_cancellation_flag) { EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); EXPECT_TRUE(socket_for_server.IsValid()); EXPECT_TRUE(socket_for_client.IsValid()); EXPECT_TRUE(socket_for_server.GetRemoteDevice().IsValid()); EXPECT_TRUE(socket_for_client.GetRemoteDevice().IsValid()); } else { EXPECT_FALSE(accept_latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); EXPECT_FALSE(socket_for_server.IsValid()); EXPECT_FALSE(socket_for_client.IsValid()); @@ -307,7 +423,7 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect) { // during shutdown. Because of the way the iteration happens, the check for // is cancelled happens after the counter has already been incremented, but // before the attempt actually occurs. - EXPECT_EQ(2, bt_client.connect_attempts_count(std::string(kServiceName1))); + EXPECT_EQ(2, bt_client.connect_attempts_count(std::string(kServiceId1))); } } @@ -315,10 +431,6 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect_MultipleEndpoints) { FeatureFlags feature_flags = GetParam(); env_.SetFeatureFlags(feature_flags); - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; - constexpr absl::string_view kServiceName1{"service name"}; - constexpr absl::string_view kServiceName2{"anotherservice name"}; - BluetoothRadio& radio_for_client = *radio_a_; BluetoothRadio& radio_for_server = *radio_b_; TestBluetoothClassic& bt_client = *bt_a_; @@ -331,15 +443,17 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect_MultipleEndpoints) { std::string(kDeviceName)); CountDownLatch latch(1); BluetoothDevice discovered_device; - EXPECT_TRUE(bt_client.StartDiscovery({ - .device_discovered_cb = - [&latch, &discovered_device](BluetoothDevice& device) { - discovered_device = device; - NEARBY_LOG(INFO, "Discovered device=%p [impl=%p]", &device, - &device.GetImpl()); - latch.CountDown(); - }, - })); + EXPECT_TRUE(bt_client.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Discovered device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + latch.CountDown(); + }, + })); EXPECT_TRUE(latch.Await(kWaitDuration).result()); EXPECT_TRUE(bt_server.TurnOffDiscoverability()); ASSERT_TRUE(discovered_device.IsValid()); @@ -348,33 +462,37 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect_MultipleEndpoints) { CountDownLatch accept_latch(1); EXPECT_TRUE(bt_server.StartAcceptingConnections( - std::string(kServiceName1), + std::string(kServiceId1), [&](const std::string& service_id, BluetoothSocket socket) { socket_for_server1 = std::move(socket); accept_latch.CountDown(); })); CancellationFlag flag; BluetoothSocket socket_for_client1 = - bt_client.Connect(discovered_device, std::string(kServiceName1), &flag); + bt_client.Connect(discovered_device, std::string(kServiceId1), &flag); // Simulate the flag being cancelled during connection attempt to a different // endpoint. medium_a_->CancelDuringConnectToService(); + EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); + + CountDownLatch accept_latch2(1); EXPECT_TRUE(bt_server.StartAcceptingConnections( - std::string(kServiceName2), + std::string(kServiceId2), [&](const std::string& service_id, BluetoothSocket socket) { socket_for_server2 = std::move(socket); - accept_latch.CountDown(); + accept_latch2.CountDown(); })); + CancellationFlag flag2; BluetoothSocket socket_for_client2 = - bt_client.Connect(discovered_device, std::string(kServiceName2), &flag); + bt_client.Connect(discovered_device, std::string(kServiceId2), &flag2); // If FeatureFlag is disabled, Cancelled is false as no-op. if (!feature_flags.enable_cancellation_flag) { - EXPECT_TRUE(accept_latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName2))); + EXPECT_TRUE(accept_latch2.Await(kWaitDuration).result()); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId2))); EXPECT_TRUE(socket_for_server1.IsValid()); EXPECT_TRUE(socket_for_server2.IsValid()); EXPECT_TRUE(socket_for_client1.IsValid()); @@ -384,8 +502,8 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect_MultipleEndpoints) { EXPECT_TRUE(socket_for_client1.GetRemoteDevice().IsValid()); EXPECT_TRUE(socket_for_client2.GetRemoteDevice().IsValid()); } else { - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName2))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId2))); EXPECT_TRUE(socket_for_client1.IsValid()); EXPECT_FALSE(socket_for_client2.IsValid()); @@ -395,11 +513,11 @@ TEST_P(BluetoothClassicTest, CanCancelDuringConnect_MultipleEndpoints) { // during shutdown. Because of the way the iteration happens, the check for // is cancelled happens after the counter has already been incremented, but // before the attempt actually occurs. - EXPECT_EQ(2, bt_client.connect_attempts_count(std::string(kServiceName2))); + EXPECT_EQ(2, bt_client.connect_attempts_count(std::string(kServiceId2))); // With the first service name, we expect one attempt count since it // succeeded. - EXPECT_EQ(1, bt_client.connect_attempts_count(std::string(kServiceName1))); + EXPECT_EQ(1, bt_client.connect_attempts_count(std::string(kServiceId1))); } } @@ -417,45 +535,91 @@ TEST_F(BluetoothClassicTest, CanConstructValidObject) { } TEST_F(BluetoothClassicTest, CanStartAdvertising) { - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; EXPECT_TRUE(bt_a_->TurnOnDiscoverability(std::string(kDeviceName))); EXPECT_EQ(radio_a_->GetBluetoothAdapter().GetName(), kDeviceName); } TEST_F(BluetoothClassicTest, CanStopAdvertising) { - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; EXPECT_TRUE(bt_a_->TurnOnDiscoverability(std::string(kDeviceName))); EXPECT_EQ(radio_a_->GetBluetoothAdapter().GetName(), kDeviceName); EXPECT_TRUE(bt_a_->TurnOffDiscoverability()); } TEST_F(BluetoothClassicTest, CanStartDiscovery) { - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; EXPECT_TRUE(bt_a_->TurnOnDiscoverability(std::string(kDeviceName))); EXPECT_EQ(radio_a_->GetBluetoothAdapter().GetName(), kDeviceName); CountDownLatch latch(1); - EXPECT_TRUE(bt_b_->StartDiscovery({ - .device_discovered_cb = - [&latch](BluetoothDevice& device) { latch.CountDown(); }, - })); + EXPECT_TRUE(bt_b_->StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch](BluetoothDevice& device) { latch.CountDown(); }, + })); EXPECT_TRUE(latch.Await(kWaitDuration).result()); EXPECT_TRUE(bt_a_->TurnOffDiscoverability()); } TEST_F(BluetoothClassicTest, CanStopDiscovery) { CountDownLatch latch(1); - EXPECT_TRUE(bt_a_->StartDiscovery({ - .device_discovered_cb = - [&latch](BluetoothDevice& device) { latch.CountDown(); }, - })); + EXPECT_TRUE(bt_a_->StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch](BluetoothDevice& device) { latch.CountDown(); }, + })); EXPECT_FALSE(latch.Await(kWaitDuration).result()); - EXPECT_TRUE(bt_a_->StopDiscovery()); + EXPECT_TRUE(bt_a_->StopDiscovery(std::string(kServiceId1))); +} + +TEST_F(BluetoothClassicTest, CanDiscoverDeviceChanges) { + BluetoothRadio& radio_for_client = *radio_a_; + BluetoothRadio& radio_for_server = *radio_b_; + BluetoothClassic& bt_client = *bt_a_; + BluetoothClassic& bt_server = *bt_b_; + + EXPECT_TRUE(radio_for_client.IsEnabled()); + EXPECT_TRUE(radio_for_server.IsEnabled()); + + EXPECT_TRUE(bt_server.TurnOnDiscoverability(std::string(kDeviceName))); + EXPECT_EQ(radio_for_server.GetBluetoothAdapter().GetName(), kDeviceName); + CountDownLatch discovered_latch(1); + CountDownLatch rename_latch(1); + CountDownLatch lost_latch(1); + BluetoothDevice discovered_device; + EXPECT_TRUE(bt_client.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&discovered_latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Discovered device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + discovered_latch.CountDown(); + }, + .device_name_changed_cb = + [&rename_latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Rename device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + rename_latch.CountDown(); + }, + .device_lost_cb = + [&lost_latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Lost device=" << device.GetName() + << ", impl=" << &device.GetImpl(); + lost_latch.CountDown(); + }, + })); + EXPECT_TRUE(discovered_latch.Await(kWaitDuration).result()); + EXPECT_TRUE(radio_for_server.GetBluetoothAdapter().SetName("new_name")); + EXPECT_TRUE(rename_latch.Await(kWaitDuration).result()); + EXPECT_TRUE(radio_for_server.Disable()); + EXPECT_TRUE(lost_latch.Await(kWaitDuration).result()); + EXPECT_TRUE(bt_client.StopDiscovery(std::string(kServiceId1))); } TEST_F(BluetoothClassicTest, CanStartAcceptingConnections) { - constexpr absl::string_view kDeviceName{"Simulated BT device #1"}; - constexpr absl::string_view kServiceName1{"service name"}; - BluetoothRadio& radio_for_client = *radio_a_; BluetoothRadio& radio_for_server = *radio_b_; BluetoothClassic& bt_client = *bt_a_; @@ -468,24 +632,59 @@ TEST_F(BluetoothClassicTest, CanStartAcceptingConnections) { EXPECT_EQ(radio_for_server.GetBluetoothAdapter().GetName(), kDeviceName); CountDownLatch latch(1); BluetoothDevice discovered_device; - EXPECT_TRUE(bt_client.StartDiscovery({ - .device_discovered_cb = - [&latch, &discovered_device](BluetoothDevice& device) { - discovered_device = device; - NEARBY_LOG(INFO, "Discovered device=%p [impl=%p]", &device, - &device.GetImpl()); - latch.CountDown(); - }, - })); + EXPECT_TRUE(bt_client.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = + [&latch, &discovered_device](BluetoothDevice& device) { + discovered_device = device; + NEARBY_LOGS(INFO) << "Discovered device=" << device.GetName() + << ",impl=" << &device.GetImpl(); + latch.CountDown(); + }, + })); EXPECT_TRUE(latch.Await(kWaitDuration).result()); EXPECT_TRUE(bt_server.TurnOffDiscoverability()); EXPECT_TRUE(discovered_device.IsValid()); EXPECT_TRUE( - bt_server.StartAcceptingConnections(std::string(kServiceName1), {})); + bt_server.StartAcceptingConnections(std::string(kServiceId1), {})); // Allow StartAcceptingConnections do something, before stopping it. // This is best effort, because no callbacks are invoked in this scenario. SystemClock::Sleep(kWaitDuration); - EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceName1))); + EXPECT_TRUE(bt_server.StopAcceptingConnections(std::string(kServiceId1))); + EXPECT_TRUE(bt_client.StopDiscovery(std::string(kServiceId1))); +} + +TEST_F(BluetoothClassicTest, CheckDiscoveryingStatus) { + BluetoothClassic& bluetooth_classic = *bt_a_; + + EXPECT_FALSE(bluetooth_classic.IsDiscovering(std::string(kServiceId1))); + EXPECT_TRUE(bluetooth_classic.StartDiscovery( + std::string(kServiceId1), + { + .device_discovered_cb = [](BluetoothDevice& device) {}, + })); + EXPECT_TRUE(bluetooth_classic.IsDiscovering(std::string(kServiceId1))); + EXPECT_TRUE(bluetooth_classic.StopDiscovery(std::string(kServiceId1))); + EXPECT_FALSE(bluetooth_classic.IsDiscovering(std::string(kServiceId1))); + EXPECT_FALSE(bluetooth_classic.StopDiscovery(std::string(kServiceId1))); +} + +TEST_F(BluetoothClassicTest, GetMacAddress) { + EXPECT_NE(bt_a_->GetMacAddress(), ""); + radio_a_->Disable(); + EXPECT_EQ(bt_a_->GetMacAddress(), ""); +} + +TEST_F(BluetoothClassicTest, GetRemoteDevice) { + EXPECT_EQ( + bt_a_->GetRemoteDevice(radio_b_->GetBluetoothAdapter().GetMacAddress()) + .GetMacAddress(), + radio_b_->GetBluetoothAdapter().GetMacAddress()); + radio_a_->Disable(); + EXPECT_FALSE( + bt_a_->GetRemoteDevice(radio_b_->GetBluetoothAdapter().GetMacAddress()) + .IsValid()); } } // namespace diff --git a/connections/implementation/mediums/bluetooth_radio.cc b/connections/implementation/mediums/bluetooth_radio.cc index 2bea0888..c3818058 100644 --- a/connections/implementation/mediums/bluetooth_radio.cc +++ b/connections/implementation/mediums/bluetooth_radio.cc @@ -21,20 +21,20 @@ namespace connections { BluetoothRadio::BluetoothRadio() { if (!IsAdapterValid()) { - NEARBY_LOG(ERROR, "Bluetooth adapter is not valid: BT is not supported"); + NEARBY_LOGS(ERROR) << "Bluetooth adapter is not valid: BT is not supported"; } } BluetoothRadio::~BluetoothRadio() { // We never enabled Bluetooth, nothing to do. if (!ever_saved_state_.Get()) { - NEARBY_LOG(INFO, "BT adapter was not used. Not touching HW."); + NEARBY_LOGS(INFO) << "BT adapter was not used. Not touching HW."; return; } - NEARBY_LOG(INFO, "Bring BT adapter to original state"); + NEARBY_LOGS(INFO) << "Bring BT adapter to original state"; if (!SetBluetoothState(originally_enabled_.Get())) { - NEARBY_LOG(INFO, "Failed to restore BT adapter original state."); + NEARBY_LOGS(INFO) << "Failed to restore BT adapter original state."; } } diff --git a/connections/implementation/mediums/multiplex/BUILD b/connections/implementation/mediums/multiplex/BUILD new file mode 100644 index 00000000..b655f3cb --- /dev/null +++ b/connections/implementation/mediums/multiplex/BUILD @@ -0,0 +1,86 @@ +# Copyright 2024 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. +licenses(["notice"]) + +cc_library( + name = "multiplex", + srcs = [ + "multiplex_frames.cc", + "multiplex_output_stream.cc", + "multiplex_socket.cc", + ], + hdrs = [ + "multiplex_frames.h", + "multiplex_output_stream.h", + "multiplex_socket.h", + ], + visibility = [ + "//connections/implementation:__subpackages__", + ], + deps = [ + "//connections:core_types", + "//connections/implementation/flags:connections_flags", + "//connections/implementation/mediums:utils", + "//internal/flags:nearby_flags", + "//internal/platform:base", + "//internal/platform:comm", + "//internal/platform:types", + "//internal/platform:util", + "//internal/platform:uuid", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", + "//proto:connections_enums_cc_proto", + "//proto/mediums:multiplex_frames_cc_proto", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/numeric:int128", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:optional", + ], +) + +cc_test( + name = "multiplex_test", + srcs = [ + "multiplex_frames_test.cc", + "multiplex_output_stream_test.cc", + "multiplex_socket_test.cc", + ], + deps = [ + ":multiplex", + "//connections/implementation:internal", + "//internal/platform:base", + "//internal/platform:comm", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation:comm", + "//internal/platform/implementation/g3", # buildcleaner: keep + "//proto:connections_enums_cc_proto", + "//proto/mediums:multiplex_frames_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/hash:hash_testing", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/connections/implementation/mediums/multiplex/multiplex_frames.cc b/connections/implementation/mediums/multiplex/multiplex_frames.cc new file mode 100644 index 00000000..9ba8cf5d --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_frames.cc @@ -0,0 +1,216 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/multiplex/multiplex_frames.h" + +#include +#include + +#include "connections/implementation/mediums/utils.h" +#include "internal/platform/base64_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/logging.h" + + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +using ::location::nearby::mediums::MultiplexFrame; +using ::location::nearby::mediums::MultiplexControlFrame; +using ::location::nearby::mediums::ConnectionResponseFrame; + +ByteArray GenerateServiceIdHash(const std::string& service_id) { + return Utils::Sha256Hash(service_id, kServiceIdHashLength); +} + +ByteArray GenerateServiceIdHashWithSalt(const std::string& service_id, + std::string salt) { + if (salt.empty()) { + return GenerateServiceIdHash(service_id); + } + + return Utils::Sha256Hash(service_id + salt, kServiceIdHashLength); +} + +std::string GenerateServiceIdHashKey(const ByteArray& service_id_hash) { + return Base64Utils::Encode(service_id_hash); +} + +std::string GenerateServiceIdHashKey(const std::string& service_id) { + return GenerateServiceIdHashKey(GenerateServiceIdHash(service_id)); +} + +std::string GenerateServiceIdHashKeyWithSalt(const std::string& service_id, + std::string salt) { + return GenerateServiceIdHashKey( + GenerateServiceIdHashWithSalt(service_id, salt)); +} + +ByteArray ToBytes(MultiplexFrame&& frame) { + ByteArray bytes(frame.ByteSizeLong()); + frame.SerializeToArray(bytes.data(), bytes.size()); + return bytes; +} + +ByteArray ForConnectionRequest(const std::string& service_id, + const std::string& service_id_hash_salt) { + MultiplexFrame frame; + + frame.set_frame_type(MultiplexFrame::CONTROL_FRAME); + auto* header = frame.mutable_header(); + header->set_salted_service_id_hash(std::string( + GenerateServiceIdHashWithSalt(service_id, service_id_hash_salt))); + header->set_service_id_hash_salt(service_id_hash_salt); + + auto* control_frame = frame.mutable_control_frame(); + control_frame->set_control_frame_type( + MultiplexControlFrame::CONNECTION_REQUEST); + + return ToBytes(std::move(frame)); +} + +ByteArray ForConnectionResponse( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + ConnectionResponseFrame::ConnectionResponseCode response_code) { + MultiplexFrame frame; + + frame.set_frame_type(MultiplexFrame::CONTROL_FRAME); + auto* header = frame.mutable_header(); + header->set_salted_service_id_hash(std::string(salted_service_id_hash)); + header->set_service_id_hash_salt(service_id_hash_salt); + + auto* control_frame = frame.mutable_control_frame(); + control_frame->set_control_frame_type( + MultiplexControlFrame::CONNECTION_RESPONSE); + + auto* response_frame = control_frame->mutable_connection_response_frame(); + response_frame->set_connection_response_code(response_code); + + return ToBytes(std::move(frame)); +} + +ByteArray ForDisconnection(const std::string& service_id, + const std::string& service_id_hash_salt) { + MultiplexFrame frame; + + frame.set_frame_type(MultiplexFrame::CONTROL_FRAME); + auto* header = frame.mutable_header(); + header->set_salted_service_id_hash(std::string( + GenerateServiceIdHashWithSalt(service_id, service_id_hash_salt))); + header->set_service_id_hash_salt(service_id_hash_salt); + + auto* control_frame = frame.mutable_control_frame(); + control_frame->set_control_frame_type( + MultiplexControlFrame::DISCONNECTION); + + return ToBytes(std::move(frame)); +} + +ByteArray ForData(const std::string& service_id, + const std::string& service_id_hash_salt, + bool should_pass_salt, const ByteArray& data) { + MultiplexFrame frame; + + frame.set_frame_type(MultiplexFrame::DATA_FRAME); + auto* header = frame.mutable_header(); + header->set_salted_service_id_hash(std::string( + GenerateServiceIdHashWithSalt(service_id, service_id_hash_salt))); + if (should_pass_salt) { + header->set_service_id_hash_salt(service_id_hash_salt); + } + + auto* data_frame = frame.mutable_data_frame(); + data_frame->set_data(std::string(std::move(data))); + + return ToBytes(std::move(frame)); +} + +ExceptionOr FromBytes(const ByteArray& multiplex_frame_bytes){ + MultiplexFrame frame; + + if (frame.ParseFromString(std::string(multiplex_frame_bytes))) { + if (!IsValid(frame)) { + return ExceptionOr(Exception::kInvalidProtocolBuffer); + } + return ExceptionOr(std::move(frame)); + } else { + return ExceptionOr(Exception::kInvalidProtocolBuffer); + } +} + +bool IsControlFrame(MultiplexFrame::MultiplexFrameType frame_type) { + return frame_type == MultiplexFrame::CONTROL_FRAME; +} + +bool IsDataFrame(MultiplexFrame::MultiplexFrameType frame_type) { + return frame_type == MultiplexFrame::DATA_FRAME; +} + +bool IsValid(const MultiplexFrame& frame) { + switch (frame.frame_type()) { + case MultiplexFrame::CONTROL_FRAME: + return IsValidControlFrame(frame); + case MultiplexFrame::DATA_FRAME: + return IsValidDataFrame(frame); + default: + return false; + } +} + +bool IsValidControlFrame(const MultiplexFrame& frame) { + if (!frame.has_control_frame()) { + return false; + } + + switch (frame.control_frame().control_frame_type()) { + case MultiplexControlFrame::CONNECTION_REQUEST: + case MultiplexControlFrame::CONNECTION_RESPONSE: + case MultiplexControlFrame::DISCONNECTION: + if (frame.header().salted_service_id_hash().size() == + kServiceIdHashLength) { + return true; + } + break; + default: + break; + } + + return false; +} + +bool IsValidDataFrame(const MultiplexFrame& frame) { + return frame.has_data_frame() && + frame.header().salted_service_id_hash().size() == kServiceIdHashLength; +} + +bool IsMultiplexFrame(const ByteArray& data) { + ExceptionOr frame = FromBytes(data); + if (!frame.ok()) { + return false; + } else { + NEARBY_LOGS(INFO) << "Checked data is a multiplex frame. Is Control ? " + << frame.result().has_control_frame() << ", is data ? " + << frame.result().has_data_frame(); + return true; + } +} + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/multiplex/multiplex_frames.h b/connections/implementation/mediums/multiplex/multiplex_frames.h new file mode 100644 index 00000000..2483c382 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_frames.h @@ -0,0 +1,111 @@ + +// Copyright 2024 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_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_FRAMES_H_ +#define CORE_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_FRAMES_H_ + +#include + +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "proto/mediums/multiplex_frames.pb.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +constexpr int kServiceIdHashLength = 4; + +// Serialize/Deserialize MultiplexFrame messages. + +// Parses incoming MultiplexFrame message. +// Returns MultiplexFrame if parser was able to understand it, or +// Exception::kInvalidProtocolBuffer, if parser failed. + +// Generates a service ID hash bytes with {@link +// MultiplexFrames#SERVICE_ID_HASH_LENGTH}. +ByteArray GenerateServiceIdHash(const std::string& service_id); + +// Generates a service ID hash bytes with salt and {@link +// MultiplexFrames#SERVICE_ID_HASH_LENGTH}. +ByteArray GenerateServiceIdHashWithSalt(const std::string& service_id, + std::string salt); + +// Converts the service Id hash bytes to a Base64 encoded string to be used as a +// {@code Map} key. +std::string GenerateServiceIdHashKey(const ByteArray& service_id_hash); + +// Generates a service ID hash bytes with {@link +// MultiplexFrames#SERVICE_ID_HASH_LENGTH} and converts to a Base64 encoded +// string to be used as a {@code Map} key. +std::string GenerateServiceIdHashKey(const std::string& service_id); + +// Generates a service ID hash bytes with salt and {@link +// MultiplexFrames#SERVICE_ID_HASH_LENGTH} and converts to a Base64 encoded +// string to be used as a { @code Map } key. +std::string GenerateServiceIdHashKeyWithSalt(const std::string& service_id, + std::string salt); + +// Build a MultiplexFrame Connection Request frame Bytes stream. +// @param service_id The service ID of the connection. +// @param service_id_hash_salt The salt used to generate the service ID hash. +ByteArray ForConnectionRequest(const std::string& service_id, + const std::string& service_id_hash_salt); + +// Build a MultiplexFrame Connection Response frame Bytes stream. +// @param salted_service_id_hash The salted service ID hash. +// @param service_id_hash_salt The salt used to generate the service ID hash. +// @param response_code The response code of the connection. +ByteArray ForConnectionResponse( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + location::nearby::mediums::ConnectionResponseFrame::ConnectionResponseCode + response_code); + +// Build a MultiplexFrame Disconnection frame Bytes stream. +// @param service_id The service ID of the connection. +// @param service_id_hash_salt The salt used to generate the service ID hash. +ByteArray ForDisconnection(const std::string& service_id, + const std::string& service_id_hash_salt); + +// Build a MultiplexFrame Data frame Bytes stream. +// @param service_id The service ID of the connection. +// @param service_id_hash_salt The salt used to generate the service ID hash. +// @param should_pass_salt Whether to pass the salt in the data frame. +// @param data The data to send. +ByteArray ForData(const std::string& service_id, + const std::string& service_id_hash_salt, + bool should_pass_salt, const ByteArray& data); + +ExceptionOr FromBytes( + const ByteArray& multiplex_frame_bytes); + +bool IsControlFrame( + location::nearby::mediums::MultiplexFrame::MultiplexFrameType frame_type); +bool IsDataFrame( + location::nearby::mediums::MultiplexFrame::MultiplexFrameType frame_type); +bool IsValid(const location::nearby::mediums::MultiplexFrame& frame); +bool IsValidControlFrame( + const location::nearby::mediums::MultiplexFrame& frame); +bool IsValidDataFrame(const location::nearby::mediums::MultiplexFrame& frame); +bool IsMultiplexFrame(const ByteArray& data); + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby + +#endif // CORE_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_FRAMES_H_ diff --git a/connections/implementation/mediums/multiplex/multiplex_frames_test.cc b/connections/implementation/mediums/multiplex/multiplex_frames_test.cc new file mode 100644 index 00000000..238e02e8 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_frames_test.cc @@ -0,0 +1,170 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/multiplex/multiplex_frames.h" +#include +#include + +#include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +using ::location::nearby::mediums::MultiplexFrame; +using ::location::nearby::mediums::MultiplexControlFrame; +using ::location::nearby::mediums::ConnectionResponseFrame; + +constexpr absl::string_view kServiceId_1 = "serviceId_1"; +constexpr absl::string_view kServiceId_2 = "serviceId_2"; + +TEST(MultiplexFrameTest, FrameValidation) { + const ByteArray data("abcdefghijklmnopqrstuvwxyz"); + MultiplexFrame frame; + EXPECT_FALSE(IsValid(frame)); + frame.set_frame_type(MultiplexFrame::CONTROL_FRAME); + EXPECT_FALSE(IsValidControlFrame(frame)); + + auto* control_frame = frame.mutable_control_frame(); + control_frame->set_control_frame_type( + MultiplexControlFrame::UNKNOWN_CONTROL_FRAME_TYPE); + EXPECT_FALSE(IsValidControlFrame(frame)); + auto* header = frame.mutable_header(); + header->set_salted_service_id_hash(std::string( + GenerateServiceIdHashWithSalt(std::string(kServiceId_1), "1234"))); + control_frame->set_control_frame_type( + MultiplexControlFrame::CONNECTION_REQUEST); + EXPECT_TRUE(IsValidControlFrame(frame)); + EXPECT_TRUE(IsValid(frame)); + control_frame->set_control_frame_type( + MultiplexControlFrame::CONNECTION_RESPONSE); + EXPECT_TRUE(IsValidControlFrame(frame)); + EXPECT_TRUE(IsValid(frame)); + control_frame->set_control_frame_type( + MultiplexControlFrame::DISCONNECTION); + EXPECT_TRUE(IsValidControlFrame(frame)); + EXPECT_TRUE(IsValid(frame)); + + EXPECT_FALSE(IsValidDataFrame(frame)); + frame.set_frame_type(MultiplexFrame::DATA_FRAME); + auto* data_frame = frame.mutable_data_frame(); + data_frame->set_data(std::string(std::move(data))); + EXPECT_TRUE(IsValidDataFrame(frame)); + EXPECT_TRUE(IsValid(frame)); + + frame.set_frame_type(MultiplexFrame::UNKNOWN_FRAME_TYPE); + EXPECT_FALSE(IsValid(frame)); + + frame.set_frame_type(MultiplexFrame::DATA_FRAME); + auto serialized_bytes = ByteArray(frame.SerializeAsString()); + EXPECT_TRUE(IsMultiplexFrame(std::move(serialized_bytes))); + + EXPECT_TRUE(IsControlFrame(MultiplexFrame::CONTROL_FRAME)); + EXPECT_FALSE(IsControlFrame(MultiplexFrame::DATA_FRAME)); + EXPECT_TRUE(IsDataFrame(MultiplexFrame::DATA_FRAME)); + EXPECT_FALSE(IsDataFrame(MultiplexFrame::UNKNOWN_FRAME_TYPE)); +} + +TEST(MultiplexFrameTest, HashValidtion) { + auto service_id_hash_1 = GenerateServiceIdHash(std::string(kServiceId_1)); + EXPECT_EQ(service_id_hash_1.size(), kServiceIdHashLength); + auto service_id_hash_2 = GenerateServiceIdHash(std::string(kServiceId_2)); + EXPECT_NE(service_id_hash_1, service_id_hash_2); + + auto hash_key_1 = GenerateServiceIdHashKey(service_id_hash_1); + auto hash_key_2 = GenerateServiceIdHashKey(service_id_hash_2); + EXPECT_NE(hash_key_1, hash_key_2); + + auto service_id_hash_with_salt_1 = + GenerateServiceIdHashWithSalt(std::string(kServiceId_1), "1234"); + EXPECT_EQ(service_id_hash_with_salt_1.size(), kServiceIdHashLength); + auto service_id_hash_with_salt_2 = + GenerateServiceIdHashWithSalt(std::string(kServiceId_2), "1234"); + EXPECT_NE(service_id_hash_with_salt_1, service_id_hash_with_salt_2); + service_id_hash_with_salt_2 = + GenerateServiceIdHashWithSalt(std::string(kServiceId_1), "abcd"); + EXPECT_NE(service_id_hash_with_salt_1, service_id_hash_with_salt_2); + + auto hash_key_with_salt_1 = + GenerateServiceIdHashKeyWithSalt(std::string(kServiceId_1), "1234"); + auto hash_key_with_salt_2 = + GenerateServiceIdHashKeyWithSalt(std::string(kServiceId_2), "1234"); + EXPECT_NE(hash_key_with_salt_1, hash_key_with_salt_2); +} + +TEST(MultiplexFrameTest, CanGenerateConnectionRequest) { + ByteArray bytes = ForConnectionRequest(std::string(kServiceId_1), "1234"); + auto request = FromBytes(bytes); + ASSERT_TRUE(request.ok()); + auto frame = request.result(); + EXPECT_EQ(frame.control_frame().control_frame_type(), + MultiplexControlFrame::CONNECTION_REQUEST); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + "1234"))); +} + +TEST(MultiplexFrameTest, CanGenerateConnectionRespons) { + auto service_id_hash_with_salt_2 = + GenerateServiceIdHashWithSalt(std::string(kServiceId_2), "1234"); + ByteArray bytes = + ForConnectionResponse(service_id_hash_with_salt_2, "1234", + ConnectionResponseFrame::CONNECTION_ACCEPTED); + auto response = FromBytes(bytes); + ASSERT_TRUE(response.ok()); + auto frame = response.result(); + EXPECT_EQ(frame.control_frame().control_frame_type(), + MultiplexControlFrame::CONNECTION_RESPONSE); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(service_id_hash_with_salt_2)); + EXPECT_EQ(frame.control_frame() + .connection_response_frame() + .connection_response_code(), + ConnectionResponseFrame::CONNECTION_ACCEPTED); +} + +TEST(MultiplexFrameTest, CanGenerateDisconnection) { + ByteArray bytes = ForDisconnection(std::string(kServiceId_1), "1234"); + auto response = FromBytes(bytes); + ASSERT_TRUE(response.ok()); + auto frame = response.result(); + EXPECT_EQ(frame.control_frame().control_frame_type(), + MultiplexControlFrame::DISCONNECTION); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + "1234"))); +} + +TEST(MultiplexFrameTest, CanGenerateData) { + ByteArray data("abcdefghijklmnopqrstuvwxyz"); + ByteArray bytes = + ForData(std::string(kServiceId_1), "1234", true, data); + auto response = FromBytes(bytes); + ASSERT_TRUE(response.ok()); + auto frame = response.result(); + EXPECT_EQ(frame.frame_type(), MultiplexFrame::DATA_FRAME); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + "1234"))); + EXPECT_EQ(frame.data_frame().data(), + std::string("abcdefghijklmnopqrstuvwxyz")); +} + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/multiplex/multiplex_output_stream.cc b/connections/implementation/mediums/multiplex/multiplex_output_stream.cc new file mode 100644 index 00000000..16f311b4 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_output_stream.cc @@ -0,0 +1,365 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/multiplex/multiplex_output_stream.h" + +#include +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "connections/implementation/mediums/multiplex/multiplex_frames.h" +#include "internal/platform/array_blocking_queue.h" +#include "internal/platform/atomic_boolean.h" +#include "internal/platform/base64_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/future.h" +#include "internal/platform/logging.h" +#include "internal/platform/mutex_lock.h" +#include "internal/platform/output_stream.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { +namespace { +using ::location::nearby::mediums::ConnectionResponseFrame; + +constexpr absl::string_view kFakeSalt = "RECEIVER_CONDIMENT"; +} // namespace + +// Implementation for class MultiplexOutputStream +MultiplexOutputStream::MultiplexOutputStream(OutputStream* physical_writer, + AtomicBoolean& is_enabled) + : is_enabled_(is_enabled), + physical_writer_(physical_writer), + multiplex_writer_{physical_writer} {} + +Exception MultiplexOutputStream::WaitForResult(const std::string& method_name, + Future* future) { + if (!future) { + NEARBY_LOGS(INFO) << "No future to wait for; return with error."; + return {Exception::kFailed}; + } + NEARBY_LOGS(INFO) << "Waiting for future to complete: " << method_name; + ExceptionOr result = + future->Get(FeatureFlags::GetInstance() + .GetFlags() + .mediums_frame_write_timeout_millis); + if (!result.ok()) { + NEARBY_LOGS(INFO) << "Future:[" << method_name + << "] completed with exception:" << result.exception(); + return {Exception::kFailed}; + } + if (result.result()) { + NEARBY_LOGS(INFO) << "Future:[" << method_name + << "] completed with success."; + return {Exception::kSuccess}; + } + NEARBY_LOGS(INFO) << "Future:[" << method_name + << "] completed with failure."; + return {Exception::kFailed}; +} + +bool MultiplexOutputStream::WriteConnectionRequestFrame( + const std::string& service_id, const std::string& service_id_hash_salt) { + if (!is_enabled_.Get()) { + return false; + } + Future future; + multiplex_writer_.EnqueueToSend( + &future, ForConnectionRequest(service_id, service_id_hash_salt), + "MultiplexFrame::CONNECTION_REQUEST"); + if (WaitForResult("MultiplexFrame::CONNECTION_REQUEST", &future).Ok()) + return true; + return false; +} + +bool MultiplexOutputStream::WriteConnectionResponseFrame( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + ConnectionResponseFrame::ConnectionResponseCode response_code) { + if (!is_enabled_.Get()) { + return false; + } + Future future; + multiplex_writer_.EnqueueToSend( + &future, + ForConnectionResponse(salted_service_id_hash, service_id_hash_salt, + response_code), + "MultiplexFrame::CONNECTION_RESPONSE"); + if (WaitForResult("MultiplexFrame::CONNECTION_RESPONSE", &future).Ok()) + return true; + return false; +} + +bool MultiplexOutputStream::Close(const std::string& service_id) { + auto item = virtual_output_streams_.find(service_id); + if (item == virtual_output_streams_.end()) { + NEARBY_LOGS(INFO) << "Don't need to close VirtualOutputStream(" + << service_id << ") because it's already gone."; + return false; + } + + item->second->Close(); + if (is_enabled_.Get()) { + Future future; + multiplex_writer_.EnqueueToSend( + &future, + ForDisconnection(service_id, item->second->GetServiceIdHashSalt()), + "MultiplexFrame::DISCONNECTION"); + WaitForResult("MultiplexFrame::DISCONNECTION", &future); + } + virtual_output_streams_.erase(service_id); + if (virtual_output_streams_.empty()) { + physical_writer_->Close(); + multiplex_writer_.Close(); + } + return true; +} + +void MultiplexOutputStream::CloseAll() { + for (auto& [service_id, virtual_output_stream] : virtual_output_streams_) { + if (is_enabled_.Get()) { + Future future; + multiplex_writer_.EnqueueToSend( + &future, + ForDisconnection(service_id, + virtual_output_stream->GetServiceIdHashSalt()), + "MultiplexFrame::DISCONNECTION"); + WaitForResult("MultiplexFrame::DISCONNECTION", &future); + } + virtual_output_stream->Close(); + } + virtual_output_streams_.clear(); + physical_writer_->Close(); + multiplex_writer_.Close(); +} + +OutputStream* +MultiplexOutputStream::CreateVirtualOutputStreamForFirstVirtualSocket( + const std::string& service_id, const std::string& service_id_hash_salt) { + return virtual_output_streams_ + .emplace(service_id, + std::make_unique( + service_id, service_id_hash_salt, physical_writer_, + multiplex_writer_, + VirtualOutputStreamType::kFirstVirtualSocket, *this)) + .first->second.get(); +} + +OutputStream* MultiplexOutputStream::CreateVirtualOutputStream( + const std::string& service_id, const std::string& service_id_hash_salt) { + return virtual_output_streams_ + .emplace(service_id, + std::make_unique( + service_id, service_id_hash_salt, physical_writer_, + multiplex_writer_, + VirtualOutputStreamType::kNormalVirtualSocket, *this)) + .first->second.get(); +} + +std::string MultiplexOutputStream::GetServiceIdHashSalt( + const std::string& service_id) { + auto item = virtual_output_streams_.find(service_id); + if (item != virtual_output_streams_.end()) { + return item->second->GetServiceIdHashSalt(); + } + return {}; +} + +void MultiplexOutputStream::Shutdown() { + physical_writer_->Close(); + multiplex_writer_.Close(); +} + +// Implementation for class MultiplexOutputStream::MultiplexWriter +MultiplexOutputStream::MultiplexWriter::MultiplexWriter( + OutputStream* physical_writer) + : physical_writer_(physical_writer) {} + +MultiplexOutputStream::MultiplexWriter::~MultiplexWriter() { + Close(); + physical_writer_ = nullptr; +} + +void MultiplexOutputStream::MultiplexWriter::EnqueueToSend( + Future* future, const ByteArray& data, + const std::string& frame_name) { + MutexLock lock(&writing_mutex_); + data_queue_.Put(EnqueuedFrame(future, data)); + + if (is_writing_) { + return; + } + is_writing_ = true; + is_writing_cond_.Notify(); + if (!is_write_loop_running_) { + is_write_loop_running_ = true; + writer_thread_.Execute("Start writing", [this] { StartWriting(); }); + } +} + +void MultiplexOutputStream::MultiplexWriter::StartWriting() { + NEARBY_LOGS(INFO) << "Writing loop started."; + while (true) { + auto enqueued_frame = data_queue_.TryTake(); + if (enqueued_frame != std::nullopt) { + Write(enqueued_frame.value()); + continue; + } + { + MutexLock lock(&writing_mutex_); + if (data_queue_.Empty() && is_writing_ && !is_closed_) { + is_writing_ = false; + NEARBY_LOGS(INFO) << "Waiting for data_queue_ has data."; + Exception wait_succeeded = is_writing_cond_.Wait(); + if (!wait_succeeded.Ok()) { + NEARBY_LOGS(WARNING) + << "Failure waiting to wait: " << wait_succeeded.value; + return; + } + } + if (is_closed_) { + NEARBY_LOGS(INFO) << "Notify to close_writing_thread"; + MutexLock lock(&close_writing_thread_mutex_); + close_writing_thread_cond_.Notify(); + break; + } + } + } + NEARBY_LOGS(INFO) << "Writing loop stopped."; +} + +void MultiplexOutputStream::MultiplexWriter::Write( + EnqueuedFrame& enqueued_frame) { + MutexLock lock(&writer_mutex_); + if (!physical_writer_ + ->Write(Base64Utils::IntToBytes(enqueued_frame.data_.size())) + .Ok()) { + enqueued_frame.future_->SetException({Exception::kIo}); + return; + }; + if (!physical_writer_->Write(enqueued_frame.data_).Ok()) { + enqueued_frame.future_->SetException({Exception::kIo}); + return; + }; + if (!physical_writer_->Flush().Ok()) { + enqueued_frame.future_->SetException({Exception::kIo}); + return; + }; + enqueued_frame.future_->Set(true); +} + +void MultiplexOutputStream::MultiplexWriter::Close() { + if (is_closed_) { + NEARBY_LOGS(INFO) << "MultiplexWriter is already closed."; + return; + } + NEARBY_LOGS(INFO) << "Stop writing loop and Shutdown writer thread."; + { + MutexLock lock(&writing_mutex_); + is_closed_ = true; + if (!is_write_loop_running_) { + writer_thread_.Shutdown(); + return; + } + is_write_loop_running_ = false; + is_writing_cond_.Notify(); + } + NEARBY_LOGS(INFO) << "Wait to close_writing_thread"; + { + MutexLock lock(&close_writing_thread_mutex_); + close_writing_thread_cond_.Wait(absl::Milliseconds(20)); + NEARBY_LOGS(INFO) << "Shutdown writer thread."; + writer_thread_.Shutdown(); + } +} + +MultiplexOutputStream::VirtualOutputStream::VirtualOutputStream( + std::string service_id, std::string service_id_hash_salt, + OutputStream* physical_writer, MultiplexWriter& multiplex_writer, + VirtualOutputStreamType virtual_output_stream_type, + MultiplexOutputStream& multiplex_output_stream) + : service_id_(service_id), + service_id_hash_salt_(service_id_hash_salt), + physical_writer_(physical_writer), + multiplex_writer_(multiplex_writer), + virtual_output_stream_type_(virtual_output_stream_type), + multiplex_output_stream_(multiplex_output_stream) {} + +Exception MultiplexOutputStream::VirtualOutputStream::Write( + const ByteArray& data) { + if (is_closed_.Get()) { + NEARBY_LOGS(WARNING) + << "Failed to write data because the VirtualOutputStream for " + << service_id_ << " closed"; + return {Exception::kIo}; + } + if (multiplex_output_stream_.is_enabled_.Get()) { + bool should_pass_salt = false; + if (IsFirstVirtualOutputStream()) { + if (!first_frame_sent_for_first_virtual_output_stream_) { + first_frame_sent_for_first_virtual_output_stream_ = true; + should_pass_salt = true; + } + // Fixes b/290724590, b/290983930 which can't get the correct socket + // from the virtualSockets map. NS receiver side will pass 2 + // DATA_FRAMEs continuously to the remote sender side but originally + // impl will only consider the 1st one. Add below fix to handle 2nd + // frame which the salt is still fake one and change shouldPassSalt to + // true to let the remote handle correctly. + if ((service_id_hash_salt_ == kFakeSalt) && !should_pass_salt) { + should_pass_salt = true; + NEARBY_LOGS(INFO) << "service_idHashSalt is still a fake one and " + "not changed yet; continue to pass salt."; + } + } + ByteArray data_frame = + ForData(service_id_, service_id_hash_salt_, should_pass_salt, data); + Future future; + multiplex_writer_.EnqueueToSend(&future, data_frame, + "MultiplexFrame::DATA_FRAME"); + return multiplex_output_stream_.WaitForResult("MultiplexFrame::DATA_FRAME", + &future); + } else { + if (!physical_writer_->Write(data).Ok()) { + return {Exception::kIo}; + }; + if (!physical_writer_->Flush().Ok()) { + return {Exception::kIo}; + }; + } + + return {Exception::kSuccess}; +} + +Exception MultiplexOutputStream::VirtualOutputStream::Flush() { + return {Exception::kSuccess}; +} + +Exception MultiplexOutputStream::VirtualOutputStream::Close() { + NEARBY_LOGS(INFO) << "MultiplexOutputStream::VirtualOutputStream::Close"; + is_closed_.Set(true); + return {Exception::kSuccess}; +} + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/multiplex/multiplex_output_stream.h b/connections/implementation/mediums/multiplex/multiplex_output_stream.h new file mode 100644 index 00000000..24925e9b --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_output_stream.h @@ -0,0 +1,208 @@ +// Copyright 2024 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_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_OUTPUT_STREAM_H_ +#define CORE_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_OUTPUT_STREAM_H_ + +#include +#include + +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "internal/platform/array_blocking_queue.h" +#include "internal/platform/atomic_boolean.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/future.h" +#include "internal/platform/mutex.h" +#include "internal/platform/output_stream.h" +#include "internal/platform/single_thread_executor.h" +#include "proto/mediums/multiplex_frames.pb.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { +/** + * A helper class to send out the {@code MultiplexControlFrame} and the outgoing + * data from clients. It schedules control and data frames with priority below + * + *

{@link MultiplexControlFrameType#CONNECTION_REQUEST} and {@link + * MultiplexControlFrameType#CONNECTION_RESPONSE} have the highest priority + * + *

All {@link MultiplexDataFrame} has the medium priority. If there's + * multiple clients send data at the same time, should poll every client's + * outgoing data in sequence. For example, client A and B send data at the same + * time, the outgoing data sequence should like A-Frame-1, B-Frame-1, A-Frame-2, + * B-Frame-2,... + * + *

{@link MultiplexControlFrameType#DISCONNECTION} has the same priority with + * {@link MultiplexDataFrame} because the disconnect should not make the already + * enqueued data failed to send out, so put it in the same priority queue with + * the MultiplexDataFrame. + */ +class MultiplexOutputStream { + public: + enum class VirtualOutputStreamType { + // The type of virtual socket established for the physical socket is + // created. + kFirstVirtualSocket = 0, + // The others except FIRST_VIRTUAL_SCOKET type. + kNormalVirtualSocket = 1, + }; + + MultiplexOutputStream(OutputStream* physical_writer, + AtomicBoolean& is_enabled); + ~MultiplexOutputStream() { Shutdown(); } + + // Writes the connection request frame to the physical output stream. + bool WriteConnectionRequestFrame(const std::string& service_id, + const std::string& service_id_hash_salt); + + // Writes the connection response frame to the physical output stream. + bool WriteConnectionResponseFrame( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + ::location::nearby::mediums::ConnectionResponseFrame:: + ConnectionResponseCode response_code); + + // Closes the virtual output stream. + bool Close(const std::string& service_id); + + // Closes all virtual output streams. + void CloseAll(); + + // Waits for the result of the future. + Exception WaitForResult(const std::string& method_name, Future* future); + + // Creates the virtual output stream for the first virtual socket. + OutputStream* CreateVirtualOutputStreamForFirstVirtualSocket( + const std::string& service_id, const std::string& service_id_hash_salt); + + // Creates the virtual output stream. + OutputStream* CreateVirtualOutputStream( + const std::string& service_id, const std::string& service_id_hash_salt); + + // Gets the service id hash salt. + std::string GetServiceIdHashSalt(const std::string& service_id); + + // Shuts down the multiplex output stream. + void Shutdown(); + + class EnqueuedFrame { + public: + EnqueuedFrame(Future* future, ByteArray data) + : future_(future), data_(data) {} + ~EnqueuedFrame() = default; + + Future* future_; + ByteArray data_; + }; + + class MultiplexWriter { + public: + explicit MultiplexWriter(OutputStream* physical_writer); + ~MultiplexWriter(); + + // Enqueues the frame to be sent out. + void EnqueueToSend(Future* future, const ByteArray& data, + const std::string& frame_name); + // Closes the writer. + void Close(); + + private: + // Starts the writer thread. + void StartWriting(); + + // Writes the enqueued frame. + void Write(EnqueuedFrame& enqueued_frame); + + Mutex writer_mutex_; + OutputStream* physical_writer_ ABSL_PT_GUARDED_BY(writer_mutex_); + + ArrayBlockingQueue data_queue_{ + FeatureFlags::GetInstance() + .GetFlags() + .multiplex_socket_middle_priority_queue_capacity}; + mutable Mutex writing_mutex_; + ConditionVariable is_writing_cond_{&writing_mutex_}; + bool is_writing_ ABSL_GUARDED_BY(writing_mutex_) = false; + bool is_closed_ = false; + mutable Mutex close_writing_thread_mutex_; + ConditionVariable close_writing_thread_cond_{&close_writing_thread_mutex_}; + + // The single thread to write all enqueued frames. + SingleThreadExecutor writer_thread_; + bool is_write_loop_running_ = false; + }; + + class VirtualOutputStream : public OutputStream { + public: + VirtualOutputStream(std::string service_id, + std::string service_id_hash_salt, + OutputStream* physical_writer, + MultiplexWriter& multiplex_writer, + VirtualOutputStreamType virtual_output_stream_type, + MultiplexOutputStream& multiplex_output_stream); + ~VirtualOutputStream() override = default; + + // Returns true if the virtual output stream is the first virtual output + // stream. + bool IsFirstVirtualOutputStream() { + return virtual_output_stream_type_ == + VirtualOutputStreamType::kFirstVirtualSocket; + } + + // Returns the service id hash salt. + std::string GetServiceIdHashSalt() { return service_id_hash_salt_; } + + // Sets the service id hash salt. + void SetserviceIdHashSalt(std::string service_id_hash_salt) { + service_id_hash_salt_ = service_id_hash_salt; + } + + // Writes the data to the physical output stream. + Exception Write(const ByteArray& data) override; + // Flushes the physical output stream. + Exception Flush() override; + // Closes the virtual output stream. + Exception Close() override; + + private: + AtomicBoolean is_closed_{false}; + + std::string service_id_; + std::string service_id_hash_salt_; + OutputStream* physical_writer_; + MultiplexWriter& multiplex_writer_; + VirtualOutputStreamType virtual_output_stream_type_; + bool first_frame_sent_for_first_virtual_output_stream_ = false; + MultiplexOutputStream& multiplex_output_stream_; + }; + + private: + AtomicBoolean& is_enabled_; + OutputStream* physical_writer_; + absl::flat_hash_map> + virtual_output_streams_; + MultiplexWriter multiplex_writer_; +}; + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby + +#endif // CORE_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_OUTPUT_STREAM_H_ diff --git a/connections/implementation/mediums/multiplex/multiplex_output_stream_test.cc b/connections/implementation/mediums/multiplex/multiplex_output_stream_test.cc new file mode 100644 index 00000000..071ad322 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_output_stream_test.cc @@ -0,0 +1,253 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/multiplex/multiplex_output_stream.h" + +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "connections/implementation/mediums/multiplex/multiplex_frames.h" +#include "internal/platform/atomic_boolean.h" +#include "internal/platform/base64_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/logging.h" +#include "internal/platform/multi_thread_executor.h" +#include "internal/platform/output_stream.h" +#include "internal/platform/pipe.h" +#include "proto/mediums/multiplex_frames.pb.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +constexpr absl::string_view kServiceId_1 = "serviceId_1"; +constexpr absl::string_view kServiceId_2 = "serviceId_2"; +constexpr absl::string_view kNoSalt = ""; +constexpr absl::string_view kSalt_1 = "DNFG"; +constexpr absl::string_view kSalt_2 = "YFRT"; + +using ::location::nearby::mediums::ConnectionResponseFrame; +using ::location::nearby::mediums::MultiplexControlFrame; +using ::location::nearby::mediums::MultiplexFrame; + +class MultiplexOutputStreamTest : public ::testing::Test { + protected: + ExceptionOr ReadFrame() { + ExceptionOr read_int = Base64Utils::ReadInt(reader_.get()); + if (!read_int.ok()) return read_int.GetException(); + if (read_int.result() <= 0) return {Exception::kFailed}; + + ExceptionOr received_data = + reader_->ReadExactly(read_int.result()); + if (!received_data.ok()) return received_data.GetException(); + auto bytes = std::move(received_data.result()); + return FromBytes(bytes); + } + + AtomicBoolean enabled_{true}; + std::pair, std::unique_ptr> pipe_ = + CreatePipe(); + + std::unique_ptr reader_ = std::move(pipe_.first); + std::unique_ptr writer_ = std::move(pipe_.second); + std::unique_ptr multiplex_output_stream_; +}; + +TEST_F(MultiplexOutputStreamTest, SendConnectionRequestFrame) { + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + EXPECT_TRUE(multiplex_output_stream_->WriteConnectionRequestFrame( + std::string(kServiceId_1), std::string(kNoSalt))); + + auto request = ReadFrame(); + ASSERT_TRUE(request.ok()); + auto frame = request.result(); + EXPECT_EQ(frame.control_frame().control_frame_type(), + MultiplexControlFrame::CONNECTION_REQUEST); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + std::string(kNoSalt)))); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, SendConnectionRequestFrameDisabled) { + enabled_.Set(false); + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + EXPECT_FALSE(multiplex_output_stream_->WriteConnectionRequestFrame( + std::string(kServiceId_1), std::string(kNoSalt))); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, SendConnectionResponseFrame) { + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + EXPECT_TRUE(multiplex_output_stream_->WriteConnectionResponseFrame( + GenerateServiceIdHash(std::string(kServiceId_1)), std::string(kNoSalt), + ConnectionResponseFrame::CONNECTION_ACCEPTED)); + + auto response = ReadFrame(); + ASSERT_TRUE(response.ok()); + auto frame = response.result(); + EXPECT_EQ(frame.control_frame().control_frame_type(), + MultiplexControlFrame::CONNECTION_RESPONSE); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + std::string(kNoSalt)))); + EXPECT_EQ(frame.control_frame() + .connection_response_frame() + .connection_response_code(), + ConnectionResponseFrame::CONNECTION_ACCEPTED); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, SendConnectionResponseFrameDisabled) { + enabled_.Set(false); + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + EXPECT_FALSE(multiplex_output_stream_->WriteConnectionResponseFrame( + GenerateServiceIdHash(std::string(kServiceId_1)), std::string(kNoSalt), + ConnectionResponseFrame::CONNECTION_ACCEPTED)); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, CloseVirtualStreamFailed) { + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + EXPECT_FALSE(multiplex_output_stream_->Close(std::string(kServiceId_1))); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, CloseVirtualStreamSuccess) { + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + EXPECT_FALSE(multiplex_output_stream_->Close(std::string(kServiceId_1))); + + multiplex_output_stream_->CreateVirtualOutputStream(std::string(kServiceId_1), + std::string(kNoSalt)); + EXPECT_TRUE(multiplex_output_stream_->Close(std::string(kServiceId_1))); + + auto request = ReadFrame(); + ASSERT_TRUE(request.ok()); + auto frame = request.result(); + EXPECT_EQ(frame.control_frame().control_frame_type(), + MultiplexControlFrame::DISCONNECTION); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + std::string(kNoSalt)))); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, CreateVirtualStream_SendData) { + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + + auto virtual_output_stream = + multiplex_output_stream_->CreateVirtualOutputStream( + std::string(kServiceId_1), std::string(kSalt_1)); + + const ByteArray data("abcdefghijklmnopqrstuvwxyz"); + virtual_output_stream->Write(data); + virtual_output_stream->Flush(); + auto frame_data = ReadFrame(); + ASSERT_TRUE(frame_data.ok()); + auto frame = frame_data.result(); + EXPECT_EQ(frame.frame_type(), MultiplexFrame::DATA_FRAME); + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + std::string(kSalt_1)))); + EXPECT_EQ(frame.data_frame().data(), std::string(data)); + + multiplex_output_stream_->Shutdown(); +} + +TEST_F(MultiplexOutputStreamTest, CreateTwoVirtualStreams_SendData) { + multiplex_output_stream_ = std::make_unique( + writer_.get(), enabled_); + + auto virtual_output_stream_1 = + multiplex_output_stream_->CreateVirtualOutputStreamForFirstVirtualSocket( + std::string(kServiceId_1), std::string(kSalt_1)); + auto virtual_output_stream_2 = + multiplex_output_stream_->CreateVirtualOutputStreamForFirstVirtualSocket( + std::string(kServiceId_2), std::string(kSalt_2)); + + const ByteArray data_1("abcdefg"); + const ByteArray data_2("hijklmn"); + MultiThreadExecutor executor(2); + CountDownLatch latch(2); + executor.Execute([&virtual_output_stream_1, &latch, &data_1]() { + absl::SleepFor(absl::Milliseconds(100)); + virtual_output_stream_1->Write(data_1); + virtual_output_stream_1->Flush(); + latch.CountDown(); + }); + executor.Execute([&virtual_output_stream_2, &latch, &data_2]() { + virtual_output_stream_2->Write(data_2); + virtual_output_stream_2->Flush(); + latch.CountDown(); + }); + EXPECT_TRUE(latch.Await(absl::Milliseconds(5000)).result()); + + auto frame_data = ReadFrame(); + ASSERT_TRUE(frame_data.ok()); + auto frame = frame_data.result(); + EXPECT_EQ(frame.frame_type(), MultiplexFrame::DATA_FRAME); + bool first_frame_is_data_1 = true; + if (frame.header().salted_service_id_hash() == + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_1), + std::string(kSalt_1)))) { + EXPECT_EQ(frame.data_frame().data(), std::string(data_1)); + NEARBY_LOGS(INFO) << "Read first virtual stream frame first."; + } else { + EXPECT_EQ(frame.header().salted_service_id_hash(), + std::string(GenerateServiceIdHashWithSalt(std::string(kServiceId_2), + std::string(kSalt_2)))); + EXPECT_EQ(frame.data_frame().data(), std::string(data_2)); + first_frame_is_data_1 = false; + NEARBY_LOGS(INFO) << "Read second virtual stream frame first."; + } + + frame_data = ReadFrame(); + ASSERT_TRUE(frame_data.ok()); + frame = frame_data.result(); + EXPECT_EQ(frame.frame_type(), MultiplexFrame::DATA_FRAME); + if (first_frame_is_data_1) { + EXPECT_EQ(frame.data_frame().data(), std::string(data_2)); + } else { + EXPECT_EQ(frame.data_frame().data(), std::string(data_1)); + } + multiplex_output_stream_->Shutdown(); +} + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/multiplex/multiplex_socket.cc b/connections/implementation/mediums/multiplex/multiplex_socket.cc new file mode 100644 index 00000000..8edcac66 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_socket.cc @@ -0,0 +1,780 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/multiplex/multiplex_socket.h" + +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "connections/implementation/mediums/multiplex/multiplex_frames.h" +#include "connections/implementation/mediums/multiplex/multiplex_output_stream.h" +#include "connections/implementation/mediums/utils.h" +#include "internal/platform/base64_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/future.h" +#include "internal/platform/logging.h" +#include "internal/platform/mutex.h" +#include "internal/platform/mutex_lock.h" +#include "internal/platform/socket.h" +#include "internal/platform/types.h" +#include "proto/connections_enums.pb.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +namespace { +// It is defined for the receiver which send the first packet to the sender +// without getting salt from it yet. The fake salt reminds sender to get the +// correct socket from `virtualSockets` without remapping it. +constexpr absl::string_view kFakeSalt = "RECEIVER_CONDIMENT"; + +// The max duration to wait for the reader thread to stop. +constexpr absl::Duration kTimeoutForReaderThreadStop = absl::Milliseconds(100); + +} // namespace + +using ::location::nearby::mediums::ConnectionResponseFrame; +using ::location::nearby::mediums::MultiplexControlFrame; +using ::location::nearby::mediums::MultiplexDataFrame; +using ::location::nearby::mediums::MultiplexFrame; +using ::location::nearby::proto::connections::Medium; +using ::location::nearby::proto::connections::Medium_Name; +using ConnectionResponseCode = ConnectionResponseFrame::ConnectionResponseCode; + +void MultiplexSocket::ListenForIncomingConnection( + const std::string& service_id, Medium type, + MultiplexIncomingConnectionCb incoming_connection_cb) { + GetIncomingConnectionCallbacks().emplace( + std::pair(service_id, type), + std::move(incoming_connection_cb)); +} + +void MultiplexSocket::StopListeningForIncomingConnection( + const std::string& service_id, Medium type) { + GetIncomingConnectionCallbacks().erase( + std::pair(service_id, type)); +} + +MultiplexSocket::MultiplexSocket(std::shared_ptr physical_socket) + : physical_socket_ptr_(physical_socket), + multiplex_output_stream_{&physical_socket_ptr_->GetOutputStream(), + enabled_}, + physical_reader_(&physical_socket_ptr_->GetInputStream()), + medium_(physical_socket_ptr_->GetMedium()) {} + +absl::flat_hash_map, + MultiplexIncomingConnectionCb>& +MultiplexSocket::GetIncomingConnectionCallbacks() { + static std::aligned_storage_t< + sizeof(absl::flat_hash_map, + MultiplexIncomingConnectionCb>), + alignof(absl::flat_hash_map, + MultiplexIncomingConnectionCb>)> + storage; + static absl::flat_hash_map, + MultiplexIncomingConnectionCb>* + incoming_connection_callbacks = + new (&storage) absl::flat_hash_map, + MultiplexIncomingConnectionCb>(); + + return *incoming_connection_callbacks; +} + +MultiplexSocket* MultiplexSocket::CreateIncomingSocket( + std::shared_ptr physical_socket, + const std::string& service_id) { + static MultiplexSocket* multiplex_incoming_socket = nullptr; + switch (physical_socket->GetMedium()) { + case Medium::BLUETOOTH: + static std::aligned_storage_t + storage_bt; + multiplex_incoming_socket = + new (&storage_bt) MultiplexSocket(physical_socket); + + break; + case Medium::BLE: + static std::aligned_storage_t + storage_ble; + multiplex_incoming_socket = + new (&storage_ble) MultiplexSocket(physical_socket); + break; + case Medium::WIFI_LAN: + static std::aligned_storage_t + storage_wlan; + multiplex_incoming_socket = + new (&storage_wlan) MultiplexSocket(physical_socket); + break; + default: + NEARBY_LOGS(ERROR) << __func__ << "Unsupported medium: " + << physical_socket->GetMedium(); + multiplex_incoming_socket = nullptr; + return multiplex_incoming_socket; + } + NEARBY_LOGS(INFO) << "CreateIncomingSocket with serviceId=" << service_id + << ", serviceIdHashSalt=" << kFakeSalt; + + multiplex_incoming_socket->CreateFirstVirtualSocket(service_id, + (std::string)kFakeSalt); + multiplex_incoming_socket->StartReaderThread(); + + return multiplex_incoming_socket; +} + +MultiplexSocket* MultiplexSocket::CreateOutgoingSocket( + std::shared_ptr physical_socket, + const std::string& service_id, const std::string& service_id_hash_salt) { + static MultiplexSocket* multiplex_outgoing_socket = nullptr; + switch (physical_socket->GetMedium()) { + case Medium::BLUETOOTH: + static std::aligned_storage_t + storage_bt; + multiplex_outgoing_socket = + new (&storage_bt) MultiplexSocket(physical_socket); + break; + case Medium::BLE: + static std::aligned_storage_t + storage_ble; + multiplex_outgoing_socket = + new (&storage_ble) MultiplexSocket(physical_socket); + break; + case Medium::WIFI_LAN: + static std::aligned_storage_t + storage_wlan; + multiplex_outgoing_socket = + new (&storage_wlan) MultiplexSocket(physical_socket); + break; + default: + NEARBY_LOGS(ERROR) << __func__ << "Unsupported medium: " + << physical_socket->GetMedium(); + return multiplex_outgoing_socket; + } + NEARBY_LOGS(INFO) << "CreateOutgoingSocket with serviceId=" << service_id + << ", serviceIdHashSalt=" << service_id_hash_salt; + + multiplex_outgoing_socket->CreateFirstVirtualSocket(service_id, + service_id_hash_salt); + multiplex_outgoing_socket->StartReaderThread(); + return multiplex_outgoing_socket; +} + +MultiplexSocket* MultiplexSocket::CreateOutgoingSocket( + std::shared_ptr physical_socket, + const std::string& service_id) { + return CreateOutgoingSocket(physical_socket, service_id, + Utils::GenerateSalt()); +} + +MediumSocket* MultiplexSocket::CreateFirstVirtualSocket( + const std::string& service_id, const std::string& service_id_hash_salt) { + auto output_stream = + multiplex_output_stream_.CreateVirtualOutputStreamForFirstVirtualSocket( + service_id, service_id_hash_salt); + + MutexLock lock(&virtual_socket_mutex_); + std::string salted_service_id_hash_key = + GenerateServiceIdHashKeyWithSalt(service_id, service_id_hash_salt); + NEARBY_LOGS(INFO) << __func__ << " for service_id=" << service_id + << ", salt=" << service_id_hash_salt + << ", salted_service_id_hash_key=" + << salted_service_id_hash_key; + MediumSocket* virtual_socket = physical_socket_ptr_->CreateVirtualSocket( + salted_service_id_hash_key, output_stream, medium_, &virtual_sockets_); + + virtual_socket->AddOnSocketClosedListener( + std::make_unique>( + [this, service_id]() { OnVirtualSocketClosed(service_id); })); + + if (!IsEnabled()) { + NEARBY_LOGS(INFO) << __func__ << ": Register multiplex enabled callback"; + virtual_socket->RegisterMultiplexEnabledCallback(enable_cb_); + } + + return virtual_socket; +} + +MediumSocket* MultiplexSocket::CreateVirtualSocket( + const std::string& service_id, const std::string& service_id_hash_salt) { + auto output_stream = multiplex_output_stream_.CreateVirtualOutputStream( + service_id, service_id_hash_salt); + MutexLock lock(&virtual_socket_mutex_); + std::string salted_service_id_hash_key = + GenerateServiceIdHashKeyWithSalt(service_id, service_id_hash_salt); + + NEARBY_LOGS(INFO) << __func__ << "service_id=" << service_id + << ", salt=" << service_id_hash_salt + << ", salted_service_id_hash_key=" + << salted_service_id_hash_key; + + MediumSocket* virtual_socket = physical_socket_ptr_->CreateVirtualSocket( + salted_service_id_hash_key, output_stream, medium_, &virtual_sockets_); + + virtual_socket->AddOnSocketClosedListener( + std::make_unique>( + [this, service_id]() { OnVirtualSocketClosed(service_id); })); + + return virtual_socket; +} + +MediumSocket* MultiplexSocket::GetVirtualSocket(const std::string& service_id) { + MutexLock lock(&virtual_socket_mutex_); + NEARBY_LOGS(INFO) << __func__ << " service_id=" << service_id << ", Salt=" + << multiplex_output_stream_.GetServiceIdHashSalt(service_id) + << ", virtual_sockets_.size()=" << virtual_sockets_.size(); + auto item = virtual_sockets_.find(GenerateServiceIdHashKeyWithSalt( + service_id, multiplex_output_stream_.GetServiceIdHashSalt(service_id))); + if (item == virtual_sockets_.end()) { + NEARBY_LOGS(INFO) << "Not found!"; + return nullptr; + } + return item->second.get(); +} + +int MultiplexSocket::GetVirtualSocketCount() { + MutexLock lock(&virtual_socket_mutex_); + return virtual_sockets_.size(); +} + +void MultiplexSocket::ListVirtualSocket() { + NEARBY_LOGS(INFO) << __func__ + << " virtual_sockets_.size()=" << virtual_sockets_.size(); + for (auto& [service_id_hash_key, virtual_socket] : virtual_sockets_) { + NEARBY_LOGS(INFO) << __func__ + << " service_id_hash_key=" << service_id_hash_key + << ", virtual_socket=" << virtual_socket; + } +} + +std::shared_ptr> +MultiplexSocket::RegisterConnectionResponse(const std::string& service_id) { + auto future = std::make_shared>(); + connection_response_futures_.emplace(service_id, future); + + return future; +} + +void MultiplexSocket::UnRegisterConnectionResponse( + const std::string& service_id) { + connection_response_futures_.erase(service_id); +} + +MediumSocket* MultiplexSocket::EstablishVirtualSocket( + const std::string& service_id) { + if (!IsEnabled()) { + NEARBY_LOGS(ERROR) + << "MultiplexSocket is disabled, cannot establish virtual socket."; + return nullptr; + } + + std::string service_id_hash_salt = Utils::GenerateSalt(); + auto future = RegisterConnectionResponse(service_id); + + multiplex_output_stream_.WriteConnectionRequestFrame(service_id, + service_id_hash_salt); + auto result = + future->Get(FeatureFlags::GetInstance() + .GetFlags() + .multiplex_socket_connection_response_timeout_millis); + if (!result.ok()) { + NEARBY_LOGS(ERROR) << __func__ + << "EstablishVirtualSocket failed with response code=" + << result.exception(); + return nullptr; + } + + ConnectionResponseCode response_code = result.GetResult(); + switch (response_code) { + case ConnectionResponseFrame::CONNECTION_ACCEPTED: + NEARBY_LOGS(INFO) << "EstablishVirtualSocket after remote response to" + " accept the connection with service_id=" + << service_id + << ", service_id_hash_salt=" << service_id_hash_salt; + return CreateVirtualSocket(service_id, service_id_hash_salt); + case ConnectionResponseFrame::NOT_LISTENING: + NEARBY_LOGS(ERROR) << "EstablishVirtualSocket failed for service_id=" + << service_id + << ", service_id_hash_salt=" << service_id_hash_salt + << " with response code=NOT_LISTENING"; + break; + default: + NEARBY_LOGS(ERROR) << "EstablishVirtualSocket failed for service_id=" + << service_id + << ", service_id_hash_salt=" << service_id_hash_salt + << " with response code=UNKNOWN_RESPONSE_CODE"; + break; + } + return nullptr; +} + +void MultiplexSocket::StartReaderThread() { + if (is_shutdown_) { + NEARBY_LOGS(WARNING) << "Stop to start reader thread since socket is " + "shutdown."; + return; + } + reader_thread_shutdown_barrier_ = std::make_unique(1); + physical_reader_thread_.Execute([this]() { + NEARBY_LOGS(INFO) << __func__ << " Reader thread starts."; + while (!is_shutdown_) { + bool fail = false; + ExceptionOr bytes; + ExceptionOr read_int = + Base64Utils::ReadInt(physical_reader_); + if (!read_int.ok()) { + NEARBY_LOGS(WARNING) + << __func__ << "Failed to read. Exception:" << read_int.exception(); + fail = true; + } else { + auto length = read_int.result(); + NEARBY_VLOG(1) << __func__ << " length:" << length; + + if (length < 0 || length > FeatureFlags::GetInstance() + .GetFlags() + .connection_max_frame_length) { + // Ignore the failure because not only one client use this + // connection. + NEARBY_LOGS(WARNING) + << __func__ << "Failed to read because received a invalid length " + << length << ", but continue to read."; + continue; + } + + bytes = physical_reader_->ReadExactly(length); + if (!bytes.ok()) { + NEARBY_LOGS(WARNING) + << __func__ << "Read data exception:" << bytes.exception(); + fail = true; + } + } + if (fail) { + reader_thread_shutdown_barrier_->CountDown(); + return; + } + + ExceptionOr frame_exc = + multiplex::FromBytes(bytes.result()); + if (!frame_exc.ok()) { + HandleOfflineFrame(bytes.result()); + continue; + } + + if (!IsEnabled()) { + // The reader thread will only be enabled when local device + // supports multiplex if we received a multiplex frame from + // the remote, it means that the remote and the local both + // support multiplex as well. So it is safe to just turn on + // the feature at this point. + NEARBY_LOGS(INFO) + << __func__ + << " Received a multiplex frame while not enabled, enable " + "multiplex."; + Enable(); + } + const auto& frame = frame_exc.result(); + auto salted_service_id_hash = + ByteArray{std::move(frame.header().salted_service_id_hash())}; + auto service_id_hash_salt = frame.header().has_service_id_hash_salt() + ? frame.header().service_id_hash_salt() + : ""; + switch (frame.frame_type()) { + case MultiplexFrame::CONTROL_FRAME: + HandleControlFrame(salted_service_id_hash, service_id_hash_salt, + frame.control_frame()); + break; + case MultiplexFrame::DATA_FRAME: + NEARBY_VLOG(1) << "service_id_hash_salt: " << service_id_hash_salt; + HandleDataFrame(salted_service_id_hash, service_id_hash_salt, + frame.data_frame()); + break; + default: + NEARBY_LOGS(WARNING) + << __func__ << " Received MultiplexFrame with unknown frame type " + << frame.frame_type(); + } + } + }); +} + +void MultiplexSocket::HandleOfflineFrame(const ByteArray& bytes) { + MutexLock lock(&virtual_socket_mutex_); + NEARBY_LOGS(INFO) << __func__ + << " Virtual_socket num:" << virtual_sockets_.size(); + if (virtual_sockets_.size() == 1) { + auto item = virtual_sockets_.begin(); + if (item->second == nullptr) { + NEARBY_LOGS(WARNING) << "Expected one live socket, but found null."; + return; + } + NEARBY_LOGS(INFO) << __func__ << "FeedIncomingData:" << std::string(bytes); + item->second->FeedIncomingData(Base64Utils::IntToBytes(bytes.size())); + item->second->FeedIncomingData(bytes); + } +} + +void MultiplexSocket::HandleControlFrame( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + const MultiplexControlFrame& frame) { + switch (frame.control_frame_type()) { + case MultiplexControlFrame::CONNECTION_REQUEST: + RunOffloadThread("CONNECTION_REQUEST", [this, salted_service_id_hash, + service_id_hash_salt] { + HandleConnectionRequest(salted_service_id_hash, service_id_hash_salt); + }); + break; + case MultiplexControlFrame::CONNECTION_RESPONSE: + NEARBY_LOGS(INFO) + << __func__ << "Received an CONNECTION_RESPONSE frame." + << " salted_service_id_hash: " << std::string(salted_service_id_hash) + << ", service_id_hash_salt: " << service_id_hash_salt + << ", ConnectionResponseCode: " + << frame.connection_response_frame().connection_response_code(); + + RunOffloadThread("CONNECTION_RESPONSE", [this, salted_service_id_hash, + service_id_hash_salt, + frame = frame] { + HandleConnectionResponse(salted_service_id_hash, service_id_hash_salt, + frame.connection_response_frame()); + }); + break; + case MultiplexControlFrame::DISCONNECTION: + RunOffloadThread("DISCONNECTION", [this, salted_service_id_hash] { + HandleDisconnection(salted_service_id_hash); + }); + break; + default: + NEARBY_LOGS(WARNING) << __func__ << "Received an unknown frame type " + << frame.control_frame_type(); + break; + } +} + +void MultiplexSocket::HandleConnectionRequest( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt) { + if (!IsEnabled()) { + NEARBY_LOGS(WARNING) << "Received a CONNECTION_REQUEST frame on medium " + << Medium_Name(medium_) + << " but status is disabled, ignore it."; + return; + } + + std::string salted_service_id_hash_key = + GenerateServiceIdHashKey(salted_service_id_hash); + MultiplexIncomingConnectionCb* incoming_connection_callback = nullptr; + std::string listening_service_id = ""; + for (auto& [service_id_medium_pair, callback] : + GetIncomingConnectionCallbacks()) { + if (GenerateServiceIdHashWithSalt(service_id_medium_pair.first, + service_id_hash_salt) == + salted_service_id_hash) { + incoming_connection_callback = &callback; + listening_service_id = service_id_medium_pair.first; + } + } + + if (incoming_connection_callback == nullptr || listening_service_id.empty()) { + NEARBY_LOGS(INFO) << "There's no client listening for hash salt : " + << service_id_hash_salt + << ", hash key : " << salted_service_id_hash_key + << " on medium " << Medium_Name(medium_); + + NEARBY_LOGS(INFO) << "The size of incomingConnectionCallbacks : " + << GetIncomingConnectionCallbacks().size(); + if (!multiplex_output_stream_.WriteConnectionResponseFrame( + salted_service_id_hash, service_id_hash_salt, + ConnectionResponseFrame::NOT_LISTENING)) { + NEARBY_LOGS(INFO) << __func__ << "Failed to write NOT_LISTENING frame."; + } + return; + } + NEARBY_LOGS(INFO) << "Accept new virtual socket request service ID : " + << listening_service_id + << ", hash salt : " << service_id_hash_salt + << ", hash key : " << salted_service_id_hash_key + << " on medium " << Medium_Name(medium_); + + if (!multiplex_output_stream_.WriteConnectionResponseFrame( + salted_service_id_hash, service_id_hash_salt, + ConnectionResponseFrame::CONNECTION_ACCEPTED)) { + NEARBY_LOGS(INFO) << "Failed to write CONNECTION_ACCEPTED frame."; + return; + } + + NEARBY_VLOG(1) + << "EstablishVirtualSocket after local device accept the connection " + "with serviceId=" + << listening_service_id << ", serviceIdHashSalt=" << service_id_hash_salt; + MediumSocket* virtual_socket = + CreateVirtualSocket(listening_service_id, service_id_hash_salt); + (*incoming_connection_callback)(std::move(listening_service_id), + virtual_socket); +} + +void MultiplexSocket::HandleConnectionResponse( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + const ConnectionResponseFrame& frame) { + NEARBY_LOGS(INFO) << __func__ << "connection_response_code: " + << frame.connection_response_code(); + for (auto& [service_id, future] : connection_response_futures_) { + if (GenerateServiceIdHashWithSalt(service_id, service_id_hash_salt) == + salted_service_id_hash) { + if (future != nullptr) { + future->Set(frame.connection_response_code()); + NEARBY_LOGS(INFO) << __func__ + << "Set the future for serviceId=" << service_id + << ", serviceIdHashSalt=" << service_id_hash_salt + << " with response code=" + << frame.connection_response_code(); + return; + } + } + } + + NEARBY_LOGS(WARNING) + << __func__ + << "Received a CONNECTION_RESPONSE frame but no client waiting for " + "service ID Hash Key" + << GenerateServiceIdHashKey(salted_service_id_hash); +} + +void MultiplexSocket::HandleDisconnection( + const ByteArray& salted_service_id_hash) { + std::string salted_service_id_hash_key = + GenerateServiceIdHashKey(salted_service_id_hash); + { + MutexLock lock(&virtual_socket_mutex_); + auto item = virtual_sockets_.find(salted_service_id_hash_key); + if (item != virtual_sockets_.end()) { + NEARBY_LOGS(INFO) + << "Received a DISCONNECTION frame to disconnect virtual socket for " + "salted service ID Hash Key " + << salted_service_id_hash_key; + } else { + NEARBY_LOGS(WARNING) + << "Received a DISCONNECTION frame but there's no alive socket to " + "disconnect for service ID Hash Key " + << salted_service_id_hash_key; + } + } +} + +void MultiplexSocket::HandleDataFrame(const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + const MultiplexDataFrame& frame) { + std::string salted_service_id_hash_key = + GenerateServiceIdHashKey(salted_service_id_hash); + MediumSocket* virtual_socket = nullptr; + if (service_id_hash_salt.empty()) { + { + MutexLock lock(&virtual_socket_mutex_); + auto item = virtual_sockets_.find(salted_service_id_hash_key); + if (item != virtual_sockets_.end()) { + virtual_socket = item->second.get(); + } + } + } else { + virtual_socket = + ReMapAndGetVirtualSocket(salted_service_id_hash, service_id_hash_salt); + } + + if (virtual_socket != nullptr) { + NEARBY_VLOG(1) + << "Received a DATA frame to feed virtual socket for salted service ID " + "Hash Key " + << salted_service_id_hash_key; + virtual_socket->FeedIncomingData(ByteArray(frame.data())); + } else { + NEARBY_LOGS(WARNING) + << "Received a DATA frame but there's no alive socket to feed for " + "salted service ID Hash Key " + << salted_service_id_hash_key; + } +} + +void MultiplexSocket::OnPhysicalSocketClosed() { + RunOffloadThread("Shutdown", [this]() { Shutdown(); }); +} + +void MultiplexSocket::OnVirtualSocketClosed(const std::string& service_id) { + NEARBY_LOGS(INFO) << __func__ << " for service_id:" << service_id; + CountDownLatch latch(1); + bool shutdown = false; + RunOffloadThread("VirtualSocketClosed", [this, service_id, &latch, + &shutdown]() { + NEARBY_LOGS(INFO) << "Try to close Virtual socket: " << service_id; + MediumSocket* virtual_socket = GetVirtualSocket(service_id); + { + MutexLock lock(&virtual_socket_mutex_); + NEARBY_LOGS(INFO) << "virtual_socket:" << virtual_socket; + if (virtual_socket != nullptr) { + auto salted_service_id_hash_key = GenerateServiceIdHashKeyWithSalt( + service_id, + multiplex_output_stream_.GetServiceIdHashSalt(service_id)); + multiplex_output_stream_.Close(service_id); + virtual_sockets_.erase(salted_service_id_hash_key); + NEARBY_LOGS(INFO) << "Erase Virtual socket with service_id: " + << service_id + << ", hash_key: " << salted_service_id_hash_key; + ListVirtualSocket(); + + if (virtual_sockets_.empty()) { + NEARBY_LOGS(INFO) << "Close the physical socket because all virtual " + "sockets disconnected."; + Shutdown(); + shutdown = true; + } + } else { + NEARBY_LOGS(INFO) << "Virtual socket(" << service_id << ") not found"; + } + } + latch.CountDown(); + }); + + if (!latch.Await(absl::Milliseconds(1000)).result()) { + NEARBY_LOGS(ERROR) << "Timeout to close virtual socket"; + } + + if (shutdown) { + NEARBY_LOGS(INFO) + << "Shutdown single_thread_offloader_ and physical_reader_thread_"; + single_thread_offloader_.Shutdown(); + physical_reader_thread_.Shutdown(); + } +} + +MediumSocket* MultiplexSocket::ReMapAndGetVirtualSocket( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt) { + std::string salted_service_id_hash_key = + GenerateServiceIdHashKey(salted_service_id_hash); + NEARBY_VLOG(1) << "ReMapAndGetVirtualSocket with serviceIdHashSalt=" + << service_id_hash_salt + << ", saltedServiceIdHashKey=" << salted_service_id_hash_key; + { + MutexLock lock(&virtual_socket_mutex_); + for (auto& [hash_key, virtual_socket] : virtual_sockets_) { + auto output_stream = + down_cast( + &(virtual_socket->GetOutputStream())); + if (output_stream == nullptr) { + continue; + } + if (!output_stream->IsFirstVirtualOutputStream()) { + continue; + } + if ((service_id_hash_salt == kFakeSalt) || + (hash_key == salted_service_id_hash_key)) { + return virtual_socket.get(); + } else { + NEARBY_LOGS(INFO) << "Remap the virtualSockets."; + output_stream->SetserviceIdHashSalt(service_id_hash_salt); + auto virtual_socket_tmp = virtual_socket; + NEARBY_LOGS(INFO) << "virtual_socket before:" << virtual_socket; + virtual_sockets_.erase(hash_key); + virtual_sockets_[salted_service_id_hash_key] = virtual_socket_tmp; + ListVirtualSocket(); + return virtual_socket_tmp.get(); + } + } + } + + NEARBY_LOGS(INFO) << "Failed to remap the virtualSockets."; + return nullptr; +} + +void MultiplexSocket::RunOffloadThread(const std::string& name, + absl::AnyInvocable runnable) { + single_thread_offloader_.Execute(name, std::move(runnable)); +} + +void MultiplexSocket::Shutdown() { + NEARBY_LOGS(INFO) << __func__ << " start"; + if (is_shutdown_) { + NEARBY_LOGS(INFO) << __func__ << " Already shutdown"; + return; + } + + multiplex_output_stream_.Shutdown(); + physical_socket_ptr_->Close(); + + if (reader_thread_shutdown_barrier_) { + reader_thread_shutdown_barrier_->Await(kTimeoutForReaderThreadStop); + } + + GetIncomingConnectionCallbacks().clear(); + connection_response_futures_.clear(); + + is_shutdown_ = true; + enabled_.Set(false); + NEARBY_LOGS(INFO) << __func__ << " end"; +} + +void MultiplexSocket::ShutdownAll() { + NEARBY_LOGS(INFO) << __func__ << " start"; + if (is_shutdown_) { + NEARBY_LOGS(WARNING) << __func__ << " Already shutdown"; + return; + } + + CountDownLatch latch(1); + RunOffloadThread("VirtualSocketClosed", [this, &latch]() { + { + MutexLock lock(&virtual_socket_mutex_); + multiplex_output_stream_.CloseAll(); + virtual_sockets_.clear(); + + Shutdown(); + } + latch.CountDown(); + }); + + if (!latch + .Await(FeatureFlags::GetInstance() + .GetFlags() + .mediums_frame_write_timeout_millis) + .result() + + 200) { + NEARBY_LOGS(ERROR) << "Timeout to close virtual socket"; + } + + NEARBY_LOGS(INFO) + << "Shutdown single_thread_offloader_ and physical_reader_thread_"; + single_thread_offloader_.Shutdown(); + physical_reader_thread_.Shutdown(); + NEARBY_LOGS(INFO) << __func__ << " end"; +} + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/multiplex/multiplex_socket.h b/connections/implementation/mediums/multiplex/multiplex_socket.h new file mode 100644 index 00000000..5575a013 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_socket.h @@ -0,0 +1,218 @@ +// Copyright 2024 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_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_SOCKET_H_ +#define CORE_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_SOCKET_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/functional/any_invocable.h" +#include "connections/implementation/mediums/multiplex/multiplex_output_stream.h" +#include "connections/medium_selector.h" +#include "internal/platform/atomic_boolean.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/future.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/logging.h" +#include "internal/platform/mutex.h" +#include "internal/platform/single_thread_executor.h" +#include "internal/platform/socket.h" +#include "proto/connections_enums.pb.h" +#include "proto/mediums/multiplex_frames.pb.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +using MultiplexEnbaleCb = absl::AnyInvocable; +using MultiplexIncomingConnectionCb = absl::AnyInvocable; + +class MultiplexSocket { + public: + MultiplexSocket(const MultiplexSocket&) = delete; + MultiplexSocket& operator=(const MultiplexSocket&) = delete; + + // Creates a new incoming MultiplexSocket. + static MultiplexSocket* CreateIncomingSocket( + std::shared_ptr physical_socket, + const std::string& service_id); + // Creates a new outgoing MultiplexSocket. + static MultiplexSocket* CreateOutgoingSocket( + std::shared_ptr physical_socket, + const std::string& service_id, const std::string& service_id_hash_salt); + + // Creates a new outgoing MultiplexSocket with default service_id_hash_salt. + static MultiplexSocket* CreateOutgoingSocket( + std::shared_ptr physical_socket, + const std::string& service_id); + + // A Table of service Id as row key, medium type as column key, and + // MultiplexIncomingConnectionCb as value. Non-empty while the client starts + // listening for incoming virtual socket. The MultiplexIncomingConnectionCb + // will be called when the incoming virtual socket is established. + static absl::flat_hash_map< + std::pair, + MultiplexIncomingConnectionCb>& + GetIncomingConnectionCallbacks(); + + // Listens for incoming connection through multiplex for specified {@code + // service_id} on medium + // {@code type}. Should register the callback before new the MultiplexSocket. + static void ListenForIncomingConnection( + const std::string& service_id, + ::location::nearby::proto::connections::Medium type, + absl::AnyInvocable + incoming_connection_cb); + + // Stops listening for incoming multiplex connection for {@code service_id} on + // medium {@code type}. + static void StopListeningForIncomingConnection( + const std::string& service_id, + ::location::nearby::proto::connections::Medium type); + + bool IsEnabled() { return enabled_.Get(); } + void Enable() { + NEARBY_LOGS(INFO) << "Enable the Multiplex MediumSocket."; + enabled_.Set(true); + } + + // Gets the virtual socket by service id. + MediumSocket* GetVirtualSocket(const std::string& service_id); + // Gets the virtual socket count. + int GetVirtualSocketCount(); + + void ListVirtualSocket(); + + // Establishes the virtual socket by service id. + MediumSocket* EstablishVirtualSocket(const std::string& service_id); + // Shuts down the multiplex socket. + void Shutdown(); + bool IsShutdown() { return is_shutdown_; } + void SetShutdown(bool is_shutdown) { is_shutdown_ = is_shutdown; } + void ShutdownAll(); + + private: + explicit MultiplexSocket(std::shared_ptr physical_socket); + ~MultiplexSocket() { ShutdownAll(); }; + + // Creates the first virtual socket for the service id. The first virtual + // socket is created by the sender. + MediumSocket* CreateFirstVirtualSocket( + const std::string& service_id, const std::string& service_id_hash_salt); + // Creates the virtual socket for the service id. + MediumSocket* CreateVirtualSocket(const std::string& service_id, + const std::string& service_id_hash_salt); + // Registers the connection response future for the service id. + std::shared_ptr> + RegisterConnectionResponse(const std::string& service_id); + // Unregisters the connection response future for the service id. + void UnRegisterConnectionResponse(const std::string& service_id); + // Starts the reader thread to read the incoming MultiplexFrame from the + // physical socket. + void StartReaderThread(); + // Handles the offline frame from the physical socket. + void HandleOfflineFrame(const ByteArray& bytes); + // Handles the control frame from the physical socket. + void HandleControlFrame( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + const ::location::nearby::mediums::MultiplexControlFrame& frame); + // Handles the connection request frame from the physical socket. + void HandleConnectionRequest(const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt); + // Handles the connection response frame from the physical socket. + void HandleConnectionResponse( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + const ::location::nearby::mediums::ConnectionResponseFrame& frame); + // Handles the disconnection frame from the physical socket. + void HandleDisconnection(const ByteArray& salted_service_id_hash); + // Handles the data frame from the physical socket. + void HandleDataFrame( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt, + const ::location::nearby::mediums::MultiplexDataFrame& frame); + // Handles the physical socket closed. + void OnPhysicalSocketClosed(); + // Remaps and gets the virtual socket by service id hash. + MediumSocket* ReMapAndGetVirtualSocket( + const ByteArray& salted_service_id_hash, + const std::string& service_id_hash_salt); + // Handles the virtual socket closed. + void OnVirtualSocketClosed(const std::string& service_id); + // Runs the offload thread. + void RunOffloadThread(const std::string& name, + absl::AnyInvocable runnable); + + // The physical socket connect to the remote device. + std::shared_ptr physical_socket_ptr_; + + // The output stream to manage all outgoing frames from all clients. + MultiplexOutputStream multiplex_output_stream_; + // The {@link InputStream} of the physical socket. It is used to read the + // incoming MultiplexFrame from the physical socket. + InputStream* physical_reader_; + // The medium type of the physical socket. + Medium medium_; + + // The callback to enable the MultiplexSocket. + std::shared_ptr> enable_cb_ = + std::make_shared>([this]() { Enable(); }); + + // A map of service Id -> {@link SettableFuture} for waiting the + // ConnectionResponse. Non-empty while requesting the virtual socket. + absl::flat_hash_map>> + connection_response_futures_; + + // A map of service Id hash key -> virtual socket. Non-empty while at least + // one virtual socket alive. Class derived from "MediumSocket" should define a + // pointer to the virtual sockets map. When here's any virtual socket + // operation, it will be reflected in both derived MediumSocket class and + // MultiplexSocket object + mutable Mutex virtual_socket_mutex_; + absl::flat_hash_map> + // virtual_sockets_ ABSL_GUARDED_BY(virtual_socket_mutex_); + virtual_sockets_; + + // The thread to receive incoming MultiplexFrame from the physical socket. + SingleThreadExecutor physical_reader_thread_; + // The single thread we throw the potentially blocking work on to. + SingleThreadExecutor single_thread_offloader_; + + // The status of the MultiplexSocket enabled or disabled, it depends on both + // Sender and Receiver supports MultiplexSocket or not. Default disabled and + // enable it once two devices negotiated finished. + AtomicBoolean enabled_{false}; + + // If the socket is already shutdown and no longer in use. + bool is_shutdown_ = false; + std::unique_ptr reader_thread_shutdown_barrier_; +}; + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby +#endif // CORE_INTERNAL_MEDIUMS_MULTIPLEX_MULTIPLEX_SOCKET_H_ diff --git a/connections/implementation/mediums/multiplex/multiplex_socket_test.cc b/connections/implementation/mediums/multiplex/multiplex_socket_test.cc new file mode 100644 index 00000000..2e841cd5 --- /dev/null +++ b/connections/implementation/mediums/multiplex/multiplex_socket_test.cc @@ -0,0 +1,383 @@ +// Copyright 2024 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. + +#include "connections/implementation/mediums/multiplex/multiplex_socket.h" + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" +#include "gtest/gtest.h" +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "connections/implementation/mediums/multiplex/multiplex_frames.h" +#include "connections/implementation/offline_frames.h" +#include "internal/platform/base64_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/future.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/logging.h" +#include "internal/platform/output_stream.h" +#include "internal/platform/pipe.h" +#include "internal/platform/single_thread_executor.h" +#include "internal/platform/socket.h" +#include "proto/connections_enums.proto.h" + +namespace nearby { +namespace connections { +namespace mediums { +namespace multiplex { + +constexpr absl::string_view SERVICE_ID_1 = "serviceId_1"; +constexpr absl::string_view SERVICE_ID_2 = "serviceId_2"; + +using location::nearby::mediums::MultiplexFrame; +using location::nearby::mediums::MultiplexControlFrame; +using location::nearby::mediums::ConnectionResponseFrame; +using location::nearby::proto::connections::Medium; +using location::nearby::proto::connections::Medium_Name; + +// A fake socket for testing. +class FakeSocket : public MediumSocket { + public: + explicit FakeSocket(Medium medium) : MediumSocket(medium) { + pipe_1_ = CreatePipe(); + reader_1_ = std::move(pipe_1_.first); + writer_1_ = std::move(pipe_1_.second); + pipe_2_ = CreatePipe(); + reader_2_ = std::move(pipe_2_.first); + writer_2_ = std::move(pipe_2_.second); + NEARBY_LOGS(WARNING) << "Physical Socket Medium:" + << Medium_Name(GetMedium()); + }; + ~FakeSocket() override = default; + + FakeSocket(const FakeSocket&) = default; + FakeSocket& operator=(const FakeSocket&) = default; + + /** + * The constructor for a virtual socket which own the virtual {@link + * OutputStream} and {@link InputStream}. + */ + explicit FakeSocket(Medium medium, OutputStream* virtualOutputStream) + : MediumSocket(medium), is_virtual_socket_(true) { + pipe_1_ = CreatePipe(); + reader_1_ = std::move(pipe_1_.first); + writer_1_ = std::move(pipe_1_.second); + pipe_2_ = CreatePipe(); + reader_2_ = std::move(pipe_2_.first); + writer_2_ = std::move(pipe_2_.second); + } + + InputStream& GetInputStream() override { return *reader_1_; } + OutputStream& GetOutputStream() override { return *writer_2_; } + Exception Close() override { + if (IsVirtualSocket()) { + NEARBY_LOGS(INFO) << "Multiplex: Closing virtual socket: " << this; + CloseLocal(); + return {Exception::kSuccess}; + } + NEARBY_LOGS(INFO) << "Multiplex: Closing physical socket: " << this; + reader_1_->Close(); + reader_2_->Close(); + writer_1_->Close(); + writer_2_->Close(); + return {Exception::kSuccess}; + } + + MediumSocket* CreateVirtualSocket( + const std::string& salted_service_id_hash_key, OutputStream* outputstream, + Medium medium, + absl::flat_hash_map>* + virtual_sockets_ptr) override { + if (IsVirtualSocket()) { + NEARBY_LOGS(WARNING) + << "Creating the virtual socket on a virtual socket is not allowed."; + return nullptr; + } + + auto virtual_socket = std::make_shared(medium, outputstream); + NEARBY_LOGS(WARNING) << "Created the virtual socket for Medium: " + << Medium_Name(virtual_socket->GetMedium()); + + if (virtual_sockets_ptr_ == nullptr) { + virtual_sockets_ptr_ = virtual_sockets_ptr; + } + + (*virtual_sockets_ptr_)[salted_service_id_hash_key] = virtual_socket; + NEARBY_LOGS(INFO) << "virtual_sockets_ size: " + << virtual_sockets_ptr_->size(); + return virtual_socket.get(); + } + + void FeedIncomingData(ByteArray data) override { + bytes_read_future_.Set(data); + NEARBY_LOGS(INFO) << "FeedIncomingData. Size of receive data: " + << data.size() << ", bytes content:" << std::string(data); + } + + bool IsVirtualSocket() override { return is_virtual_socket_; } + Future& GetByteReadFuture() { return bytes_read_future_; } + + std::pair, std::unique_ptr> + pipe_1_; + std::unique_ptr reader_1_; + std::unique_ptr writer_1_; + std::pair, std::unique_ptr> + pipe_2_; + std::unique_ptr reader_2_; + std::unique_ptr writer_2_; + + private: + bool is_virtual_socket_ = false; + Future bytes_read_future_; + absl::flat_hash_map>* + virtual_sockets_ptr_ = nullptr; +}; + +TEST(MultiplexSocketTest, CreateSuccessAndReaderThreadStarted) { + auto fake_socket_ptr = + std::make_shared(Medium::BLUETOOTH); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_1), + Medium::BLUETOOTH); + MultiplexSocket* multiplex_socket_incoming = + MultiplexSocket::CreateIncomingSocket(fake_socket_ptr, + std::string(SERVICE_ID_1)); + ASSERT_NE(multiplex_socket_incoming, nullptr); + FakeSocket* virtual_socket = + (FakeSocket*)multiplex_socket_incoming->GetVirtualSocket( + std::string(SERVICE_ID_1)); + if (virtual_socket == nullptr) { + NEARBY_LOGS(INFO) << "Virtual socket not found for " << SERVICE_ID_1; + return; + } + + SingleThreadExecutor executor; + FakeSocket* socket = fake_socket_ptr.get(); + CountDownLatch latch(1); + executor.Execute([socket, &latch]() { + ByteArray connection_req_frame = parser::ForConnectionRequestConnections( + {}, { + .local_endpoint_id = "endpoint1", + .local_endpoint_info = ByteArray("endpoint1 info"), + }); + auto& writer = socket->writer_1_; + NEARBY_LOGS(INFO) << "writer_1_ Write start"; + writer->Write(Base64Utils::IntToBytes(connection_req_frame.size())); + writer->Write(connection_req_frame); + writer->Flush(); + NEARBY_LOGS(INFO) << "writer_1_ Write end"; + latch.CountDown(); + }); + + latch.Await(absl::Milliseconds(100)); + ExceptionOr result = virtual_socket->GetByteReadFuture().Get(); + if (!result.ok()) { + ADD_FAILURE() << "Read error: " << result.GetException().value; + } + ByteArray data = result.result(); + NEARBY_LOGS(INFO) << "Received " << data.size() << " bytes of data."; + EXPECT_NE(data.size(), 0); + absl::SleepFor(absl::Milliseconds(100)); + socket->reader_1_->Close(); + EXPECT_EQ(multiplex_socket_incoming->GetVirtualSocketCount(), 1); + virtual_socket->Close(); + EXPECT_EQ(multiplex_socket_incoming->GetVirtualSocketCount(), 0); +} +TEST(MultiplexSocketTest, CreateFail_MediumNotSupport) { + auto fake_socket_ptr = + std::make_shared(Medium::WEB_RTC); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_1), + Medium::WEB_RTC); + MultiplexSocket* multiplex_socket_incoming = + MultiplexSocket::CreateIncomingSocket(fake_socket_ptr, + std::string(SERVICE_ID_1)); + + ASSERT_EQ(multiplex_socket_incoming, nullptr); +} + +TEST(MultiplexSocketTest, + EstablishVirtualSocket_ReturnNullWhenMultiplexSocketDisabled) { + auto fake_socket_ptr = std::make_shared(Medium::BLE); + + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_1), + Medium::BLE); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_2), + Medium::BLE); + MultiplexSocket* multiplex_socket = MultiplexSocket::CreateOutgoingSocket( + fake_socket_ptr, std::string(SERVICE_ID_1)); + ASSERT_NE(multiplex_socket, nullptr); + + MediumSocket* socket = + multiplex_socket->EstablishVirtualSocket(std::string(SERVICE_ID_2)); + EXPECT_EQ(socket, nullptr); + absl::SleepFor(absl::Milliseconds(100)); + FakeSocket* virtual_socket = + (FakeSocket*)multiplex_socket->GetVirtualSocket( + std::string(SERVICE_ID_1)); + if (virtual_socket == nullptr) { + NEARBY_LOGS(INFO) << "Virtual socket not found for " << SERVICE_ID_1; + return; + } + fake_socket_ptr->reader_1_->Close(); + EXPECT_EQ(multiplex_socket->GetVirtualSocketCount(), 1); + virtual_socket->Close(); + EXPECT_EQ(multiplex_socket->GetVirtualSocketCount(), 0); +} + +TEST(MultiplexSocketTest, + EstablishVirtualSocket_TimeoutBecauseNoConnectionResponse) { + auto fake_socket_ptr = std::make_shared(Medium::WIFI_LAN); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_1), + Medium::WIFI_LAN); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_2), + Medium::WIFI_LAN); + MultiplexSocket* multiplex_socket = MultiplexSocket::CreateOutgoingSocket( + fake_socket_ptr, std::string(SERVICE_ID_1)); + ASSERT_NE(multiplex_socket, nullptr); + multiplex_socket->Enable(); + FakeSocket* virtual_socket = (FakeSocket*)multiplex_socket->GetVirtualSocket( + std::string(SERVICE_ID_1)); + if (virtual_socket == nullptr) { + NEARBY_LOGS(INFO) << "Virtual socket not found for " << SERVICE_ID_1; + return; + } + + SingleThreadExecutor executor; + CountDownLatch latch(1); + executor.Execute([&multiplex_socket, &latch]() { + NEARBY_LOGS(INFO) << "EstablishVirtualSocket"; + MediumSocket* socket = + multiplex_socket->EstablishVirtualSocket(std::string(SERVICE_ID_2)); + NEARBY_LOGS(INFO) << "EstablishVirtualSocket finished"; + EXPECT_EQ(socket, nullptr); + latch.CountDown(); + }); + latch.Await(absl::Milliseconds(3000)); + + auto reader = fake_socket_ptr->reader_2_.get(); + NEARBY_LOGS(INFO) << "reader_2_ Read start"; + ExceptionOr read_int = Base64Utils::ReadInt(reader); + if (!read_int.ok()) { + ADD_FAILURE() << "Failed to read. Exception:" + << read_int.exception(); + } + auto length = read_int.result(); + NEARBY_LOGS(INFO) << " length:" << length; + EXPECT_GT(length, 0); + EXPECT_EQ(multiplex_socket->GetVirtualSocket(std::string(SERVICE_ID_2)), + nullptr); + + absl::SleepFor(absl::Milliseconds(100)); + fake_socket_ptr->reader_1_->Close(); + EXPECT_EQ(multiplex_socket->GetVirtualSocketCount(), 1); + virtual_socket->Close(); + EXPECT_EQ(multiplex_socket->GetVirtualSocketCount(), 0); +} + +TEST(MultiplexSocketTest, + EstablishVirtualSocket_RemoteAccepted) { + auto fake_socket_ptr = std::make_shared(Medium::BLUETOOTH); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_1), + Medium::BLUETOOTH); + MultiplexSocket::StopListeningForIncomingConnection(std::string(SERVICE_ID_2), + Medium::BLUETOOTH); + + MultiplexSocket* multiplex_socket = MultiplexSocket::CreateOutgoingSocket( + fake_socket_ptr, std::string(SERVICE_ID_1)); + ASSERT_NE(multiplex_socket, nullptr); + multiplex_socket->Enable(); + + SingleThreadExecutor executor; + executor.Execute([&multiplex_socket]() { + NEARBY_LOGS(INFO) << "EstablishVirtualSocket"; + MediumSocket* socket = + multiplex_socket->EstablishVirtualSocket(std::string(SERVICE_ID_2)); + EXPECT_NE(socket, nullptr); + }); + + auto reader = fake_socket_ptr->reader_2_.get(); + NEARBY_LOGS(INFO) << "reader_2_ Waiting for CONNECTION_REQUEST frame."; + ExceptionOr read_int = Base64Utils::ReadInt(reader); + if (!read_int.ok()) { + ADD_FAILURE() << "Failed to read length.Exception:" << read_int.exception(); + } + auto length = read_int.result(); + if (length < 0 || + length > + FeatureFlags::GetInstance().GetFlags().connection_max_frame_length) { + ADD_FAILURE() << "Invalid length:" << length; + } + + auto bytes = reader->ReadExactly(length); + if (!bytes.ok()) { + ADD_FAILURE() << "Failed to read frame. Exception:" << bytes.exception(); + } + length = read_int.result(); + if (length < 0 || + length > + FeatureFlags::GetInstance().GetFlags().connection_max_frame_length) { + ADD_FAILURE() << "Invalid frame length:" << length; + } + + ExceptionOr frame_exc = + multiplex::FromBytes(bytes.result()); + if (!frame_exc.ok()) { + ADD_FAILURE() << "Failed to parse MultiplexFrame. Exception:" + << frame_exc.exception(); + } + auto frame = frame_exc.result(); + auto salted_service_id_hash = + ByteArray{std::move(frame.header().salted_service_id_hash())}; + auto service_id_hash_salt = frame.header().has_service_id_hash_salt() + ? frame.header().service_id_hash_salt() + : ""; + ASSERT_EQ(frame.frame_type(), MultiplexFrame::CONTROL_FRAME); + auto control_frame = frame.control_frame(); + ASSERT_EQ(control_frame.control_frame_type(), + MultiplexControlFrame::CONNECTION_REQUEST); + NEARBY_LOGS(INFO) << "Recieved MultiplexControlFrame::CONNECTION_REQUEST " + "frame, now send CONNECTION_RESPONSE frame."; + + ByteArray connection_response_frame = + ForConnectionResponse(salted_service_id_hash, service_id_hash_salt, + ConnectionResponseFrame::CONNECTION_ACCEPTED); + auto& writer = fake_socket_ptr->writer_1_; + NEARBY_LOGS(INFO) << "writer_1_ Write start"; + writer->Write(Base64Utils::IntToBytes(connection_response_frame.size())); + writer->Write(connection_response_frame); + writer->Flush(); + NEARBY_LOGS(INFO) << "writer_1_ Write end"; + absl::SleepFor(absl::Milliseconds(100)); + EXPECT_NE(multiplex_socket->GetVirtualSocket(std::string(SERVICE_ID_2)), + nullptr); + + fake_socket_ptr->reader_1_->Close(); + EXPECT_EQ(multiplex_socket->GetVirtualSocketCount(), 2); + multiplex_socket->ShutdownAll(); + EXPECT_EQ(multiplex_socket->GetVirtualSocketCount(), 0); +} + +} // namespace multiplex +} // namespace mediums +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/mediums/utils.cc b/connections/implementation/mediums/utils.cc index a6059145..9839fa45 100644 --- a/connections/implementation/mediums/utils.cc +++ b/connections/implementation/mediums/utils.cc @@ -14,14 +14,22 @@ #include "connections/implementation/mediums/utils.h" -#include +#include +#include #include +#include "internal/platform/base64_utils.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/crypto.h" //NOLINT #include "internal/platform/prng.h" -#include "internal/platform/crypto.h" namespace nearby { namespace connections { + +namespace { +constexpr int kDefaultSaltLength = 16; +} // namespace + using ::location::nearby::connections::LocationHint; using ::location::nearby::connections::LocationStandard; @@ -70,5 +78,13 @@ LocationHint Utils::BuildLocationHint(const std::string& location) { return location_hint; } +// Generates salts. +std::string Utils::GenerateSalt() { return GenerateSalt(kDefaultSaltLength); } + +std::string Utils::GenerateSalt(size_t length) { + ByteArray salt = GenerateRandomBytes(length); + return Base64Utils::Encode(salt); +} + } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/utils.h b/connections/implementation/mediums/utils.h index 578cf300..5097a123 100644 --- a/connections/implementation/mediums/utils.h +++ b/connections/implementation/mediums/utils.h @@ -15,7 +15,7 @@ #ifndef CORE_INTERNAL_MEDIUMS_UTILS_H_ #define CORE_INTERNAL_MEDIUMS_UTILS_H_ -#include +#include #include #include "connections/implementation/proto/offline_wire_formats.pb.h" @@ -31,6 +31,8 @@ class Utils { static ByteArray Sha256Hash(const std::string& source, size_t length); static location::nearby::connections::LocationHint BuildLocationHint( const std::string& location); + static std::string GenerateSalt(); + static std::string GenerateSalt(size_t length); }; } // namespace connections diff --git a/connections/implementation/mediums/webrtc.cc b/connections/implementation/mediums/webrtc.cc index 21ad6e8c..80b6bd27 100644 --- a/connections/implementation/mediums/webrtc.cc +++ b/connections/implementation/mediums/webrtc.cc @@ -18,19 +18,28 @@ #include #include +#include #include +#include +#include "absl/container/flat_hash_set.h" #include "absl/functional/bind_front.h" #include "absl/time/time.h" +#include "connections/implementation/mediums/webrtc/connection_flow.h" #include "connections/implementation/mediums/webrtc/session_description_wrapper.h" #include "connections/implementation/mediums/webrtc/signaling_frames.h" +#include "connections/implementation/mediums/webrtc_peer_id.h" #include "connections/implementation/mediums/webrtc_socket.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/cancellation_flag_listener.h" +#include "internal/platform/exception.h" #include "internal/platform/future.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/webrtc.h" #include "webrtc/api/jsep.h" namespace nearby { @@ -86,20 +95,19 @@ bool WebRtc::IsAcceptingConnectionsLocked(const std::string& service_id) { bool WebRtc::StartAcceptingConnections(const std::string& service_id, const WebrtcPeerId& self_peer_id, const LocationHint& location_hint, - AcceptedConnectionCallback callback) { + AcceptedConnectionCallback callback, + bool non_cellular) { MutexLock lock(&mutex_); if (!IsAvailable()) { - NEARBY_LOG(WARNING, - "Cannot start accepting WebRTC connections because WebRTC is " - "not available."); + NEARBY_LOGS(WARNING) << "Cannot start accepting WebRTC connections because " + "WebRTC is not available."; return false; } if (IsAcceptingConnectionsLocked(service_id)) { - NEARBY_LOG(WARNING, - "Cannot start accepting WebRTC connections because service %s " - "is already accepting WebRTC connections.", - service_id.c_str()); + NEARBY_LOGS(WARNING) + << "Cannot start accepting WebRTC connections because service " + << service_id << "is already accepting WebRTC connections."; return false; } @@ -109,6 +117,8 @@ bool WebRtc::StartAcceptingConnections(const std::string& service_id, info.self_peer_id = self_peer_id; info.accepted_connection_callback = std::move(callback); + medium_->SetNonCellular(non_cellular); + // Create a new SignalingMessenger so that we can communicate w/ Tachyon. info.signaling_messenger = medium_->GetSignalingMessenger(self_peer_id.GetId(), location_hint); @@ -137,19 +147,17 @@ bool WebRtc::StartAcceptingConnections(const std::string& service_id, // Now that we're set up to receive messages, we'll save our state and return // a successful result. accepting_connections_info_.emplace(service_id, std::move(info)); - NEARBY_LOG(INFO, - "Started listening for WebRTC connections as %s on service %s", - self_peer_id.GetId().c_str(), service_id.c_str()); + NEARBY_LOGS(INFO) << "Started listening for WebRTC connections as " + << self_peer_id.GetId() << " on service " << service_id; return true; } void WebRtc::StopAcceptingConnections(const std::string& service_id) { MutexLock lock(&mutex_); if (!IsAcceptingConnectionsLocked(service_id)) { - NEARBY_LOG(WARNING, - "Cannot stop accepting WebRTC connections because service %s " - "is not accepting WebRTC connections.", - service_id.c_str()); + NEARBY_LOGS(WARNING) + << "Cannot stop accepting WebRTC connections because service " + << service_id << "is not accepting WebRTC connections."; return; } @@ -194,15 +202,17 @@ void WebRtc::StopAcceptingConnections(const std::string& service_id) { // Clean up our state. We're now no longer listening for connections. accepting_connections_info_.erase(service_id); - NEARBY_LOG(INFO, "Stopped listening for WebRTC connections for service %s", - service_id.c_str()); + NEARBY_LOGS(INFO) << "Stopped listening for WebRTC connections for service " + << service_id; } WebRtcSocketWrapper WebRtc::Connect(const std::string& service_id, const WebrtcPeerId& remote_peer_id, const LocationHint& location_hint, - CancellationFlag* cancellation_flag) { + CancellationFlag* cancellation_flag, + bool non_cellular) { service_id_to_connect_attempts_count_map_[service_id] = 1; + medium_->SetNonCellular(non_cellular); while (service_id_to_connect_attempts_count_map_[service_id] <= kConnectAttemptsLimit) { if (cancellation_flag->Cancelled()) { @@ -253,10 +263,9 @@ WebRtcSocketWrapper WebRtc::AttemptToConnect( { MutexLock lock(&mutex_); if (!IsAvailable()) { - NEARBY_LOG( - WARNING, - "Cannot connect to WebRTC peer %s because WebRTC is not available.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(WARNING) << "Cannot connect to WebRTC peer " + << remote_peer_id.GetId() + << " because WebRTC is not available."; return WebRtcSocketWrapper(); } @@ -264,11 +273,9 @@ WebRtcSocketWrapper WebRtc::AttemptToConnect( std::unique_ptr connection_flow = CreateConnectionFlow(service_id, remote_peer_id); if (!connection_flow) { - NEARBY_LOG( - INFO, - "Cannot connect to WebRTC peer %s because we failed to create a " - "ConnectionFlow.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Cannot connect to WebRTC peer " + << remote_peer_id.GetId() + << " because we failed to create a ConnectionFlow."; return WebRtcSocketWrapper(); } @@ -276,11 +283,9 @@ WebRtcSocketWrapper WebRtc::AttemptToConnect( info.signaling_messenger = medium_->GetSignalingMessenger( info.self_peer_id.GetId(), location_hint); if (!info.signaling_messenger->IsValid()) { - NEARBY_LOG( - INFO, - "Cannot connect to WebRTC peer %s because we failed to create a " - "SignalingMessenger.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Cannot connect to WebRTC peer " + << remote_peer_id.GetId() + << " because we failed to create a SignalingMessenger."; return WebRtcSocketWrapper(); } @@ -294,10 +299,9 @@ WebRtcSocketWrapper WebRtc::AttemptToConnect( if (!info.signaling_messenger->StartReceivingMessages( absl::bind_front(&WebRtc::OnSignalingMessage, this, service_id), signaling_complete_callback)) { - NEARBY_LOG(INFO, - "Cannot connect to WebRTC peer %s because we failed to start " - "receiving messages over Tachyon.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) + << "Cannot connect to WebRTC peer " << remote_peer_id.GetId() + << " because we failed to start receiving messages over Tachyon."; info.signaling_messenger.reset(); return WebRtcSocketWrapper(); } @@ -306,10 +310,9 @@ WebRtcSocketWrapper WebRtc::AttemptToConnect( if (!info.signaling_messenger->SendMessage( remote_peer_id.GetId(), webrtc_frames::EncodeReadyForSignalingPoke(info.self_peer_id))) { - NEARBY_LOG(INFO, - "Cannot connect to WebRTC peer %s because we failed to poke " - "the peer over Tachyon.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Cannot connect to WebRTC peer " + << remote_peer_id.GetId() + << " because we failed to poke the peer over Tachyon."; info.signaling_messenger.reset(); return WebRtcSocketWrapper(); } @@ -337,8 +340,8 @@ WebRtcSocketWrapper WebRtc::AttemptToConnect( // Verify that the connection went through. if (!socket_result.ok()) { - NEARBY_LOG(INFO, "Failed to connect to WebRTC peer %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Failed to connect to WebRTC peer " + << remote_peer_id.GetId(); RemoveConnectionFlow(remote_peer_id); info.signaling_messenger.reset(); requesting_connections_info_.erase(remote_peer_id.GetId()); @@ -370,12 +373,11 @@ void WebRtc::ProcessLocalIceCandidate( webrtc_frames::EncodeIceCandidates( connection_request_entry->second.self_peer_id, {ice_candidate}))) { - NEARBY_LOG(INFO, "Failed to send ice candidate to %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Failed to send ice candidate to " + << remote_peer_id.GetId(); } - NEARBY_LOG(INFO, "Sent ice candidate to %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Sent ice candidate to " << remote_peer_id.GetId(); return; } @@ -391,19 +393,17 @@ void WebRtc::ProcessLocalIceCandidate( webrtc_frames::EncodeIceCandidates( accepting_connection_entry->second.self_peer_id, {ice_candidate}))) { - NEARBY_LOG(INFO, "Failed to send ice candidate to %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Failed to send ice candidate to " + << remote_peer_id.GetId(); } - NEARBY_LOG(INFO, "Sent ice candidate to %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Sent ice candidate to " << remote_peer_id.GetId(); return; } - NEARBY_LOG(INFO, - "Skipping restart listening for tachyon inbox messages since we " - "are not accepting connections for service %s.", - service_id.c_str()); + NEARBY_LOGS(INFO) << "Skipping restart listening for tachyon inbox messages " + "since we are not accepting connections for service " + << service_id; } void WebRtc::OnSignalingMessage(const std::string& service_id, @@ -414,7 +414,7 @@ void WebRtc::OnSignalingMessage(const std::string& service_id, } void WebRtc::OnSignalingComplete(const std::string& service_id, bool success) { - NEARBY_LOG(INFO, "Signaling completed with status: %d.", success); + NEARBY_LOGS(INFO) << "Signaling completed with status: " << success; if (success) { return; } @@ -444,13 +444,13 @@ void WebRtc::ProcessTachyonInboxMessage(const std::string& service_id, // Attempt to parse the incoming message as a WebRtcSignalingFrame. location::nearby::mediums::WebRtcSignalingFrame frame; if (!frame.ParseFromString(std::string(message))) { - NEARBY_LOG(WARNING, "Failed to parse signaling message."); + NEARBY_LOGS(WARNING) << "Failed to parse signaling message."; return; } // Ensure that the frame is valid (no missing fields). if (!frame.has_sender_id()) { - NEARBY_LOG(WARNING, "Invalid WebRTC frame: Sender ID is missing."); + NEARBY_LOGS(WARNING) << "Invalid WebRTC frame: Sender ID is missing."; return; } WebrtcPeerId remote_peer_id = WebrtcPeerId(frame.sender_id().id()); @@ -468,7 +468,7 @@ void WebRtc::ProcessTachyonInboxMessage(const std::string& service_id, ReceiveIceCandidates(remote_peer_id, webrtc_frames::DecodeIceCandidates(frame)); } else { - NEARBY_LOG(INFO, "Received unknown WebRTC frame: ignoring."); + NEARBY_LOGS(INFO) << "Received unknown WebRTC frame: ignoring."; } } else if (IsAcceptingConnectionsLocked(service_id)) { // We don't have an outgoing connection request with this peer, but we are @@ -483,12 +483,11 @@ void WebRtc::ProcessTachyonInboxMessage(const std::string& service_id, ReceiveIceCandidates(remote_peer_id, webrtc_frames::DecodeIceCandidates(frame)); } else { - NEARBY_LOG(INFO, "Received unknown WebRTC frame: ignoring."); + NEARBY_LOGS(INFO) << "Received unknown WebRTC frame: ignoring."; } } else { - NEARBY_LOG( - INFO, - "Ignoring Tachyon message since we are not accepting connections."); + NEARBY_LOGS(INFO) + << "Ignoring Tachyon message since we are not accepting connections."; } } @@ -497,23 +496,23 @@ void WebRtc::SendOffer(const std::string& service_id, std::unique_ptr connection_flow = CreateConnectionFlow(service_id, remote_peer_id); if (!connection_flow) { - NEARBY_LOG(INFO, - "Unable to send offer. Failed to create a ConnectionFlow."); + NEARBY_LOGS(INFO) + << "Unable to send offer. Failed to create a ConnectionFlow."; return; } SessionDescriptionWrapper offer = connection_flow->CreateOffer(); if (!offer.IsValid()) { - NEARBY_LOG(INFO, - "Unable to send offer. Failed to create our offer locally."); + NEARBY_LOGS(INFO) + << "Unable to send offer. Failed to create our offer locally."; RemoveConnectionFlow(remote_peer_id); return; } const webrtc::SessionDescriptionInterface& sdp = offer.GetSdp(); if (!connection_flow->SetLocalSessionDescription(offer)) { - NEARBY_LOG(INFO, - "Unable to send offer. Failed to register our offer locally."); + NEARBY_LOGS(INFO) + << "Unable to send offer. Failed to register our offer locally."; RemoveConnectionFlow(remote_peer_id); return; } @@ -525,30 +524,30 @@ void WebRtc::SendOffer(const std::string& service_id, if (!info.signaling_messenger->SendMessage( remote_peer_id.GetId(), webrtc_frames::EncodeOffer(info.self_peer_id, sdp))) { - NEARBY_LOG(INFO, - "Unable to send offer. Failed to write the offer to the remote " - "peer %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) + << "Unable to send offer. Failed to write the offer to the remote peer " + << remote_peer_id.GetId(); RemoveConnectionFlow(remote_peer_id); return; } // Store the ConnectionFlow so that other methods can use it later. connection_flows_.emplace(remote_peer_id.GetId(), std::move(connection_flow)); - NEARBY_LOG(INFO, "Sent offer to %s.", remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Sent offer to " << remote_peer_id.GetId(); } void WebRtc::ReceiveOffer(const WebrtcPeerId& remote_peer_id, SessionDescriptionWrapper offer) { const auto& entry = connection_flows_.find(remote_peer_id.GetId()); if (entry == connection_flows_.end()) { - NEARBY_LOG(INFO, - "Unable to receive offer. Failed to create a ConnectionFlow."); + NEARBY_LOGS(INFO) + << "Unable to receive offer. Failed to create a ConnectionFlow."; return; } if (!entry->second->OnOfferReceived(offer)) { - NEARBY_LOG(INFO, "Unable to receive offer. Failed to process the offer."); + NEARBY_LOGS(INFO) + << "Unable to receive offer. Failed to process the offer."; RemoveConnectionFlow(remote_peer_id); } } @@ -556,23 +555,23 @@ void WebRtc::ReceiveOffer(const WebrtcPeerId& remote_peer_id, void WebRtc::SendAnswer(const WebrtcPeerId& remote_peer_id) { const auto& entry = connection_flows_.find(remote_peer_id.GetId()); if (entry == connection_flows_.end()) { - NEARBY_LOG(INFO, - "Unable to send answer. Failed to create a ConnectionFlow."); + NEARBY_LOGS(INFO) + << "Unable to send answer. Failed to create a ConnectionFlow."; return; } SessionDescriptionWrapper answer = entry->second->CreateAnswer(); if (!answer.IsValid()) { - NEARBY_LOG(INFO, - "Unable to send answer. Failed to create our answer locally."); + NEARBY_LOGS(INFO) + << "Unable to send answer. Failed to create our answer locally."; RemoveConnectionFlow(remote_peer_id); return; } const webrtc::SessionDescriptionInterface& sdp = answer.GetSdp(); if (!entry->second->SetLocalSessionDescription(answer)) { - NEARBY_LOG(INFO, - "Unable to send answer. Failed to register our answer locally."); + NEARBY_LOGS(INFO) + << "Unable to send answer. Failed to register our answer locally."; RemoveConnectionFlow(remote_peer_id); return; } @@ -581,9 +580,8 @@ void WebRtc::SendAnswer(const WebrtcPeerId& remote_peer_id) { const auto& connection_request_entry = requesting_connections_info_.find(remote_peer_id.GetId()); if (connection_request_entry == requesting_connections_info_.end()) { - NEARBY_LOG(INFO, - "Unable to send answer. Failed to find an outgoing connection " - "request."); + NEARBY_LOGS(INFO) << "Unable to send answer. Failed to find an outgoing " + "connection request."; RemoveConnectionFlow(remote_peer_id); return; } @@ -593,29 +591,29 @@ void WebRtc::SendAnswer(const WebrtcPeerId& remote_peer_id) { remote_peer_id.GetId(), webrtc_frames::EncodeAnswer( connection_request_entry->second.self_peer_id, sdp))) { - NEARBY_LOG( - INFO, - "Unable to send answer. Failed to write the answer to the remote " - "peer %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) + << "Unable to send answer. Failed to write the answer to the remote " + "peer " + << remote_peer_id.GetId(); RemoveConnectionFlow(remote_peer_id); return; } - NEARBY_LOG(INFO, "Sent answer to %s.", remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) << "Sent answer to " << remote_peer_id.GetId(); } void WebRtc::ReceiveAnswer(const WebrtcPeerId& remote_peer_id, SessionDescriptionWrapper answer) { const auto& entry = connection_flows_.find(remote_peer_id.GetId()); if (entry == connection_flows_.end()) { - NEARBY_LOG(INFO, - "Unable to receive answer. Failed to create a ConnectionFlow."); + NEARBY_LOGS(INFO) + << "Unable to receive answer. Failed to create a ConnectionFlow."; return; } if (!entry->second->OnAnswerReceived(answer)) { - NEARBY_LOG(INFO, "Unable to receive answer. Failed to process the answer."); + NEARBY_LOGS(INFO) + << "Unable to receive answer. Failed to process the answer."; RemoveConnectionFlow(remote_peer_id); } } @@ -626,9 +624,8 @@ void WebRtc::ReceiveIceCandidates( ice_candidates) { const auto& entry = connection_flows_.find(remote_peer_id.GetId()); if (entry == connection_flows_.end()) { - NEARBY_LOG( - INFO, - "Unable to receive ice candidates. Failed to create a ConnectionFlow."); + NEARBY_LOGS(INFO) << "Unable to receive ice candidates. Failed to create a " + "ConnectionFlow."; return; } @@ -643,10 +640,10 @@ void WebRtc::ProcessRestartTachyonReceiveMessages( void WebRtc::RestartTachyonReceiveMessages(const std::string& service_id) { if (!IsAcceptingConnectionsLocked(service_id)) { - NEARBY_LOG(INFO, - "Skipping restart listening for tachyon inbox messages since we " - "are not accepting connections for service %s.", - service_id.c_str()); + NEARBY_LOGS(INFO) + << "Skipping restart listening for tachyon inbox messages since we are " + "not accepting connections for service " + << service_id; return; } @@ -660,17 +657,16 @@ void WebRtc::RestartTachyonReceiveMessages(const std::string& service_id) { if (!info.signaling_messenger->StartReceivingMessages( absl::bind_front(&WebRtc::OnSignalingMessage, this, service_id), absl::bind_front(&WebRtc::OnSignalingComplete, this, service_id))) { - NEARBY_LOG(WARNING, - "Failed to restart listening for tachyon inbox messages for " - "service %s since we failed to reach Tachyon.", - service_id.c_str()); + NEARBY_LOGS(WARNING) + << "Failed to restart listening for tachyon inbox messages for " + "service " + << service_id << " since we failed to reach Tachyon."; return; } - NEARBY_LOG(INFO, - "Successfully restarted listening for tachyon inbox messages on " - "service %s.", - service_id.c_str()); + NEARBY_LOGS(INFO) << "Successfully restarted listening for tachyon inbox " + "messages on service " + << service_id; } void WebRtc::ProcessDataChannelOpen(const std::string& service_id, @@ -697,17 +693,16 @@ void WebRtc::ProcessDataChannelOpen(const std::string& service_id, // No one to handle the newly created DataChannel, so we'll just close it. socket_wrapper.Close(); - NEARBY_LOG(INFO, - "Ignoring new DataChannel because we " - "are not accepting connections for service %s.", - service_id.c_str()); + NEARBY_LOGS(INFO) << "Ignoring new DataChannel because we are not accepting " + "connections for service " + << service_id; } void WebRtc::ProcessDataChannelClosed(const WebrtcPeerId& remote_peer_id) { MutexLock lock(&mutex_); - NEARBY_LOG(INFO, - "Data channel has closed, removing connection flow for peer %s.", - remote_peer_id.GetId().c_str()); + NEARBY_LOGS(INFO) + << "Data channel has closed, removing connection flow for peer " + << remote_peer_id.GetId(); RemoveConnectionFlow(remote_peer_id); } @@ -748,9 +743,32 @@ std::unique_ptr WebRtc::CreateConnectionFlow( }); }}, }, + { + .adapter_type_changed_cb = + {[this](/*rtc::AdapterType*/ int adapter_type) { + OffloadFromThread( + "rtc-adapter-type-changed", [this, adapter_type]() { + if (FeatureFlags::GetInstance() + .GetFlags() + .support_web_rtc_non_cellular_medium) { + AdapterTypeChangedHandler(adapter_type); + } + }); + }}, + }, *medium_); } +void WebRtc::AdapterTypeChangedHandler(/*rtc::AdapterType*/ int adapter_type) { + // TODO(edwinwu): Uncomment this once OSS supports WEB_RTC + // MutexLock lock(&mutex_); + // is_using_cellular_ = adapter_type == rtc::ADAPTER_TYPE_CELLULAR || + // adapter_type == rtc::ADAPTER_TYPE_CELLULAR_2G || + // adapter_type == rtc::ADAPTER_TYPE_CELLULAR_3G || + // adapter_type == rtc::ADAPTER_TYPE_CELLULAR_4G || + // adapter_type == rtc::ADAPTER_TYPE_CELLULAR_5G; +} + void WebRtc::RemoveConnectionFlow(const WebrtcPeerId& remote_peer_id) { if (!connection_flows_.erase(remote_peer_id.GetId())) { return; @@ -770,6 +788,11 @@ void WebRtc::OffloadFromThread(const std::string& name, Runnable runnable) { single_thread_executor_.Execute(name, std::move(runnable)); } +bool WebRtc::IsUsingCellular() { + MutexLock lock(&mutex_); + return is_using_cellular_; +} + } // namespace mediums } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/webrtc.h b/connections/implementation/mediums/webrtc.h index 8e8eef39..88314843 100644 --- a/connections/implementation/mediums/webrtc.h +++ b/connections/implementation/mediums/webrtc.h @@ -20,10 +20,13 @@ #include #include #include +#include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" #include "connections/implementation/mediums/webrtc/connection_flow.h" +#include "connections/implementation/mediums/webrtc/session_description_wrapper.h" #include "connections/implementation/mediums/webrtc_peer_id.h" #include "connections/implementation/mediums/webrtc_socket.h" #include "internal/platform/byte_array.h" @@ -70,7 +73,8 @@ class WebRtc { bool StartAcceptingConnections( const std::string& service_id, const WebrtcPeerId& self_peer_id, const location::nearby::connections::LocationHint& location_hint, - AcceptedConnectionCallback callback) ABSL_LOCKS_EXCLUDED(mutex_); + AcceptedConnectionCallback callback, bool non_cellular) + ABSL_LOCKS_EXCLUDED(mutex_); // Try to stop (accepting) the specific connection with provided service id. // Runs on @MainThread @@ -83,7 +87,10 @@ class WebRtc { WebRtcSocketWrapper Connect( const std::string& service_id, const WebrtcPeerId& peer_id, const location::nearby::connections::LocationHint& location_hint, - CancellationFlag* cancellation_flag) ABSL_LOCKS_EXCLUDED(mutex_); + CancellationFlag* cancellation_flag, bool non_cellular) + ABSL_LOCKS_EXCLUDED(mutex_); + + bool IsUsingCellular() ABSL_LOCKS_EXCLUDED(mutex_); protected: // Use for unit tests only to inject a WebRtcMedium. @@ -227,6 +234,10 @@ class WebRtc { void RestartTachyonReceiveMessages(const std::string& service_id) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + // Runs on |single_thread_executor_|. + void AdapterTypeChangedHandler(/*rtc::AdapterType*/ int adapter_type) + ABSL_LOCKS_EXCLUDED(mutex_); + void OffloadFromThread(const std::string& name, Runnable runnable); Mutex mutex_; @@ -251,6 +262,8 @@ class WebRtc { // a unique ConnectionFlow. absl::flat_hash_map> connection_flows_ ABSL_GUARDED_BY(mutex_); + + bool is_using_cellular_ ABSL_GUARDED_BY(mutex_) = true; }; } // namespace mediums diff --git a/connections/implementation/mediums/webrtc/BUILD b/connections/implementation/mediums/webrtc/BUILD index 2d15ee8d..ff2f5ca0 100644 --- a/connections/implementation/mediums/webrtc/BUILD +++ b/connections/implementation/mediums/webrtc/BUILD @@ -42,6 +42,8 @@ cc_library( "//internal/platform:types", "//proto/mediums:web_rtc_signaling_frames_cc_proto", # TODO: Support WebRTC + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/memory", "@com_google_absl//absl/time", ], @@ -91,12 +93,11 @@ cc_test( "//internal/platform:test_util", "//internal/platform:types", "//internal/platform/implementation/g3", # buildcleaner: keep + "//third_party/protobuf", "//third_party/webrtc/files/stable/webrtc/api:libjingle_peerconnection_api", - "//third_party/webrtc/files/stable/webrtc/api:rtc_error", "//third_party/webrtc/files/stable/webrtc/api:scoped_refptr", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", - "@com_google_protobuf//:protobuf", ], ) diff --git a/connections/implementation/mediums/webrtc/connection_flow.cc b/connections/implementation/mediums/webrtc/connection_flow.cc index 1dc62f1d..83a56fe6 100644 --- a/connections/implementation/mediums/webrtc/connection_flow.cc +++ b/connections/implementation/mediums/webrtc/connection_flow.cc @@ -18,14 +18,21 @@ #include #include +#include +#include #include "absl/memory/memory.h" #include "absl/time/time.h" +#include "connections/implementation/mediums/webrtc/data_channel_listener.h" +#include "connections/implementation/mediums/webrtc/local_ice_candidate_listener.h" #include "connections/implementation/mediums/webrtc/session_description_wrapper.h" #include "connections/implementation/mediums/webrtc/webrtc_socket_impl.h" #include "connections/implementation/mediums/webrtc_socket.h" +#include "internal/platform/exception.h" +#include "internal/platform/future.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/runnable.h" #include "internal/platform/webrtc.h" #include "webrtc/api/data_channel_interface.h" #include "webrtc/api/jsep.h" @@ -63,8 +70,8 @@ class CreateSessionDescriptionObserverImpl } void OnFailure(webrtc::RTCError error) override { - NEARBY_LOG(ERROR, "Error when creating session description: %s", - error.message()); + NEARBY_LOGS(ERROR) << "Error when creating session description: " + << error.message(); settable_future_.SetException({Exception::kFailed}); } @@ -118,10 +125,11 @@ using PeerConnectionState = std::unique_ptr ConnectionFlow::Create( LocalIceCandidateListener local_ice_candidate_listener, - DataChannelListener data_channel_listener, WebRtcMedium& webrtc_medium) { - auto connection_flow = absl::WrapUnique( - new ConnectionFlow(std::move(local_ice_candidate_listener), - std::move(data_channel_listener))); + DataChannelListener data_channel_listener, + AdapterTypeListener adapter_type_listener, WebRtcMedium& webrtc_medium) { + auto connection_flow = absl::WrapUnique(new ConnectionFlow( + std::move(local_ice_candidate_listener), std::move(data_channel_listener), + std::move(adapter_type_listener))); if (connection_flow->InitPeerConnection(webrtc_medium)) { return connection_flow; } @@ -131,15 +139,17 @@ std::unique_ptr ConnectionFlow::Create( ConnectionFlow::ConnectionFlow( LocalIceCandidateListener local_ice_candidate_listener, - DataChannelListener data_channel_listener) + DataChannelListener data_channel_listener, + AdapterTypeListener adapter_type_listener) : data_channel_listener_(std::move(data_channel_listener)), - local_ice_candidate_listener_(std::move(local_ice_candidate_listener)) {} + local_ice_candidate_listener_(std::move(local_ice_candidate_listener)), + adapter_type_listener_(std::move(adapter_type_listener)) {} ConnectionFlow::~ConnectionFlow() { - NEARBY_LOG(INFO, "~ConnectionFlow"); + NEARBY_LOGS(INFO) << "~ConnectionFlow"; RunOnSignalingThread([this] { CloseOnSignalingThread(); }); shutdown_latch_.Await(); - NEARBY_LOG(INFO, "~ConnectionFlow done"); + NEARBY_LOGS(INFO) << "~ConnectionFlow done"; } SessionDescriptionWrapper ConnectionFlow::CreateOffer() { @@ -148,14 +158,14 @@ SessionDescriptionWrapper ConnectionFlow::CreateOffer() { if (!RunOnSignalingThread([this, success_future] { CreateOfferOnSignalingThread(success_future); })) { - NEARBY_LOG(ERROR, "Failed to create offer"); + NEARBY_LOGS(ERROR) << "Failed to create offer"; return SessionDescriptionWrapper(); } ExceptionOr result = success_future.Get(kTimeout); if (result.ok()) { return std::move(result.result()); } - NEARBY_LOG(ERROR, "Failed to create offer: %d", result.exception()); + NEARBY_LOGS(ERROR) << "Failed to create offer: " << result.exception(); return SessionDescriptionWrapper(); } @@ -190,14 +200,14 @@ SessionDescriptionWrapper ConnectionFlow::CreateAnswer() { if (!RunOnSignalingThread([this, success_future] { CreateAnswerOnSignalingThread(success_future); })) { - NEARBY_LOG(ERROR, "Failed to create answer"); + NEARBY_LOGS(ERROR) << "Failed to create answer"; return SessionDescriptionWrapper(); } ExceptionOr result = success_future.Get(kTimeout); if (result.ok()) { return std::move(result.result()); } - NEARBY_LOG(ERROR, "Failed to create answer: %d", result.exception()); + NEARBY_LOGS(ERROR) << "Failed to create answer: " << result.exception(); return SessionDescriptionWrapper(); } @@ -241,8 +251,8 @@ bool ConnectionFlow::SetLocalSessionDescription(SessionDescriptionWrapper sdp) { ExceptionOr result = observer->GetResult(kTimeout); bool success = result.ok() && result.result(); if (!success) { - NEARBY_LOG(ERROR, "Failed to set local session description: %d", - result.exception()); + NEARBY_LOGS(ERROR) << "Failed to set local session description: " + << result.exception(); } return success; } @@ -274,8 +284,8 @@ bool ConnectionFlow::SetRemoteSessionDescription(SessionDescriptionWrapper sdp, ExceptionOr result = observer->GetResult(kTimeout); bool success = result.ok() && result.result(); if (!success) { - NEARBY_LOG(ERROR, "Failed to set remote description: %d", - result.exception()); + NEARBY_LOGS(ERROR) << "Failed to set remote description: " + << result.exception(); } return success; } @@ -306,7 +316,7 @@ bool ConnectionFlow::OnRemoteIceCandidatesReceived( pc->signaling_thread()->PostTask( [this, can_run_tasks = std::weak_ptr(can_run_tasks_), candidates = std::move(ice_candidates)]() mutable { - // don't run the task if the weak_ptr is no longer valid. + // Don't run the task if the weak_ptr is no longer valid. if (!can_run_tasks.lock()) { return; } @@ -320,8 +330,8 @@ void ConnectionFlow::AddIceCandidatesOnSignalingThread( ice_candidates) { CHECK(IsRunningOnSignalingThread()); if (state_ == State::kEnded) { - NEARBY_LOG(WARNING, - "You cannot add ice candidates to a disconnected session."); + NEARBY_LOGS(WARNING) + << "You cannot add ice candidates to a disconnected session."; return; } if (state_ != State::kWaitingToConnect && state_ != State::kConnected) { @@ -334,7 +344,7 @@ void ConnectionFlow::AddIceCandidatesOnSignalingThread( auto pc = GetPeerConnection(); for (auto&& ice_candidate : ice_candidates) { if (!pc->AddIceCandidate(ice_candidate.get())) { - NEARBY_LOG(WARNING, "Unable to add remote ice candidate."); + NEARBY_LOGS(WARNING) << "Unable to add remote ice candidate."; } } } @@ -387,8 +397,8 @@ bool ConnectionFlow::InitPeerConnection(WebRtcMedium& webrtc_medium) { bool success = result.ok() && result.result(); if (!success) { shutdown_latch_.CountDown(); - NEARBY_LOG(ERROR, "Failed to create peer connection: %d", - result.exception()); + NEARBY_LOGS(ERROR) << "Failed to create peer connection: " + << result.exception(); } return success; } @@ -398,7 +408,7 @@ void ConnectionFlow::OnSignalingStable() { auto pc = GetPeerConnection(); for (auto&& ice_candidate : cached_remote_ice_candidates_) { if (!pc->AddIceCandidate(ice_candidate.get())) { - NEARBY_LOG(WARNING, "Unable to add remote ice candidate."); + NEARBY_LOGS(WARNING) << "Unable to add remote ice candidate."; } } cached_remote_ice_candidates_.clear(); @@ -406,16 +416,15 @@ void ConnectionFlow::OnSignalingStable() { void ConnectionFlow::CreateSocketFromDataChannel( rtc::scoped_refptr data_channel) { - NEARBY_LOG(INFO, "Creating data channel socket"); + NEARBY_LOGS(INFO) << "Creating data channel socket"; auto socket = std::make_unique("WebRtcSocket", std::move(data_channel)); socket->SetSocketListener({ .socket_ready_cb = {[this](WebRtcSocket* socket) { CHECK(IsRunningOnSignalingThread()); if (!TransitionState(State::kWaitingToConnect, State::kConnected)) { - NEARBY_LOG(ERROR, - "Data channel socket is open but connection flow was not " - "in the required state"); + NEARBY_LOGS(ERROR) << "Data channel socket is open but connection " + "flow was not in the required state"; socket->Close(); return; } @@ -438,7 +447,7 @@ void ConnectionFlow::OnIceCandidate( void ConnectionFlow::OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) { - NEARBY_LOG(INFO, "OnSignalingChange: %d", new_state); + NEARBY_LOGS(INFO) << "OnSignalingChange: " << new_state; CHECK(IsRunningOnSignalingThread()); if (new_state == webrtc::PeerConnectionInterface::SignalingState::kStable) { OnSignalingStable(); @@ -447,45 +456,46 @@ void ConnectionFlow::OnSignalingChange( void ConnectionFlow::OnDataChannel( rtc::scoped_refptr data_channel) { - NEARBY_LOG(INFO, "OnDataChannel"); + NEARBY_LOGS(INFO) << "OnDataChannel"; CHECK(IsRunningOnSignalingThread()); CreateSocketFromDataChannel(std::move(data_channel)); } void ConnectionFlow::OnIceGatheringChange( webrtc::PeerConnectionInterface::IceGatheringState new_state) { - NEARBY_LOG(INFO, "OnIceGatheringChange: %d", new_state); + NEARBY_LOGS(INFO) << "OnIceGatheringChange: " << new_state; CHECK(IsRunningOnSignalingThread()); } void ConnectionFlow::OnConnectionChange( webrtc::PeerConnectionInterface::PeerConnectionState new_state) { - NEARBY_LOG(INFO, "OnConnectionChange: %d", new_state); + NEARBY_LOGS(INFO) << "OnConnectionChange: " << static_cast(new_state); CHECK(IsRunningOnSignalingThread()); if (new_state == PeerConnectionState::kClosed || new_state == PeerConnectionState::kFailed || new_state == PeerConnectionState::kDisconnected) { - NEARBY_LOG(INFO, "Closing due to peer connection state change: %d", - new_state); + NEARBY_LOGS(INFO) << "Closing due to peer connection state change: " + << static_cast(new_state); CloseOnSignalingThread(); } } void ConnectionFlow::OnRenegotiationNeeded() { - NEARBY_LOG(INFO, "OnRenegotiationNeeded"); + NEARBY_LOGS(INFO) << "OnRenegotiationNeeded"; CHECK(IsRunningOnSignalingThread()); } bool ConnectionFlow::TransitionState(State current_state, State new_state) { CHECK(IsRunningOnSignalingThread()); if (current_state != state_) { - NEARBY_LOG( - WARNING, - "Invalid state transition to %d: current state is %d but expected %d.", - new_state, state_, current_state); + NEARBY_LOGS(WARNING) << "Invalid state transition to " + << static_cast(new_state) << ": current state is " + << static_cast(state_) << " but expected " + << static_cast(current_state); return false; } - NEARBY_LOG(INFO, "Transition: %d -> %d", state_, new_state); + NEARBY_LOGS(INFO) << "Transition: " << static_cast(state_) << "->" + << static_cast(new_state); state_ = new_state; return true; } @@ -504,11 +514,11 @@ bool ConnectionFlow::CloseOnSignalingThread() { // object. auto pc = GetAndResetPeerConnection(); - NEARBY_LOG(INFO, "Closing WebRTC peer connection."); + NEARBY_LOGS(INFO) << "Closing WebRTC peer connection."; // NOTE: Closing the peer connection will close the data channel and thus the // socket implicitly. if (pc) pc->Close(); - NEARBY_LOG(INFO, "Closed WebRTC peer connection."); + NEARBY_LOGS(INFO) << "Closed WebRTC peer connection."; // Prevent any already queued tasks from running on the signaling thread can_run_tasks_.reset(); // If anyone was waiting for shutdown to be done let them know. @@ -520,8 +530,8 @@ bool ConnectionFlow::RunOnSignalingThread(Runnable&& runnable) { CHECK(!IsRunningOnSignalingThread()); auto pc = GetPeerConnection(); if (!pc) { - NEARBY_LOG(WARNING, - "Peer connection not available. Cannot schedule tasks."); + NEARBY_LOGS(WARNING) + << "Peer connection not available. Cannot schedule tasks."; return false; } // We are off signaling thread, so we can't use peer connection's methods @@ -529,12 +539,13 @@ bool ConnectionFlow::RunOnSignalingThread(Runnable&& runnable) { pc->signaling_thread()->PostTask( [can_run_tasks = std::weak_ptr(can_run_tasks_), task = std::move(runnable)]() mutable { - // don't run the task if the weak_ptr is no longer valid. + // Don't run the task if the weak_ptr is no longer valid. // shared_ptr |can_run_tasks_| is destroyed on the same thread // (signaling thread). This guarantees that if the weak_ptr is valid // when this task starts, it will stay valid until the task ends. if (!can_run_tasks.lock()) { - NEARBY_LOG(INFO, "Peer connection already closed. Cannot run tasks."); + NEARBY_LOGS(INFO) + << "Peer connection already closed. Cannot run tasks."; return; } task(); @@ -562,6 +573,7 @@ ConnectionFlow::GetAndResetPeerConnection() { MutexLock lock(&mutex_); return std::move(peer_connection_); } + } // namespace mediums } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/webrtc/connection_flow.h b/connections/implementation/mediums/webrtc/connection_flow.h index 40fe9d0e..d1c0da5f 100644 --- a/connections/implementation/mediums/webrtc/connection_flow.h +++ b/connections/implementation/mediums/webrtc/connection_flow.h @@ -18,14 +18,20 @@ #ifndef NO_WEBRTC #include +#include +#include "absl/base/thread_annotations.h" +#include "absl/functional/any_invocable.h" +#include "absl/time/time.h" #include "connections/implementation/mediums/webrtc/data_channel_listener.h" #include "connections/implementation/mediums/webrtc/local_ice_candidate_listener.h" #include "connections/implementation/mediums/webrtc/session_description_wrapper.h" #include "connections/implementation/mediums/webrtc_socket.h" -#include "internal/platform/runnable.h" #include "internal/platform/count_down_latch.h" -#include "internal/platform/single_thread_executor.h" +#include "internal/platform/future.h" +#include "internal/platform/listeners.h" +#include "internal/platform/mutex.h" +#include "internal/platform/runnable.h" #include "internal/platform/webrtc.h" #include "webrtc/api/data_channel_interface.h" #include "webrtc/api/peer_connection_interface.h" @@ -80,11 +86,20 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { kEnded, }; + // The listener that notifies the AdapterType has been changed. + // TODO(edwinwu): replace param |int| to |rtc::AdapterType| once OSS supports + // WebRtc. + struct AdapterTypeListener { + absl::AnyInvocable + adapter_type_changed_cb = DefaultCallback(); + }; + // This method blocks on the creation of the peer connection object. // Can be called on any thread but never called on signaling thread. static std::unique_ptr Create( LocalIceCandidateListener local_ice_candidate_listener, - DataChannelListener data_channel_listener, WebRtcMedium& webrtc_medium); + DataChannelListener data_channel_listener, + AdapterTypeListener adapter_type_listener, WebRtcMedium& webrtc_medium); ~ConnectionFlow() override; // Create the offer that will be sent to the remote. Mirrors the behaviour of @@ -134,13 +149,17 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { void OnConnectionChange( webrtc::PeerConnectionInterface::PeerConnectionState new_state) override; void OnRenegotiationNeeded() override; + // TODO(edwinwu): Implement once OSS supports WebRtc. + // void OnIceSelectedCandidatePairChanged( + // const cricket::CandidatePairChangeEvent& event) override; // Public because it's used in tests too. rtc::scoped_refptr GetPeerConnection(); private: ConnectionFlow(LocalIceCandidateListener local_ice_candidate_listener, - DataChannelListener data_channel_listener); + DataChannelListener data_channel_listener, + AdapterTypeListener adapter_type_listener); // Resets peer connection reference. Returns old value. rtc::scoped_refptr @@ -223,6 +242,8 @@ class ConnectionFlow : public webrtc::PeerConnectionObserver { // the former is thread-safe. std::shared_ptr can_run_tasks_ = std::make_shared(); + AdapterTypeListener adapter_type_listener_; + friend class CreateSessionDescriptionObserverImpl; }; diff --git a/connections/implementation/mediums/webrtc/connection_flow_test.cc b/connections/implementation/mediums/webrtc/connection_flow_test.cc index f0e1d6bf..5d349fb6 100644 --- a/connections/implementation/mediums/webrtc/connection_flow_test.cc +++ b/connections/implementation/mediums/webrtc/connection_flow_test.cc @@ -15,21 +15,23 @@ #include "connections/implementation/mediums/webrtc/connection_flow.h" #include +#include +#include #include -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/time/time.h" +#include "connections/implementation/mediums/webrtc/data_channel_listener.h" +#include "connections/implementation/mediums/webrtc/local_ice_candidate_listener.h" #include "connections/implementation/mediums/webrtc/session_description_wrapper.h" #include "connections/implementation/mediums/webrtc_socket.h" #include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/future.h" #include "internal/platform/medium_environment.h" #include "internal/platform/webrtc.h" -#include "webrtc/api/data_channel_interface.h" #include "webrtc/api/jsep.h" -#include "webrtc/api/rtc_error.h" #include "webrtc/api/scoped_refptr.h" namespace nearby { @@ -78,6 +80,10 @@ TEST_F(ConnectionFlowTest, SuccessfulOfferAnswerFlow) { [&offerer_socket_future](WebRtcSocketWrapper socket) { offerer_socket_future.Set(std::move(socket)); }}, + {.adapter_type_changed_cb = + [](/*rtc::AdapterType*/ int adapter_type) { + // Do nothing + }}, webrtc_medium_offerer); ASSERT_NE(offerer, nullptr); answerer = ConnectionFlow::Create( @@ -94,6 +100,10 @@ TEST_F(ConnectionFlowTest, SuccessfulOfferAnswerFlow) { [&answerer_socket_future](WebRtcSocketWrapper socket) { answerer_socket_future.Set(std::move(socket)); }}, + {.adapter_type_changed_cb = + [](/*rtc::AdapterType*/ int adapter_type) { + // Do nothing + }}, webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); @@ -133,7 +143,8 @@ TEST_F(ConnectionFlowTest, CreateAnswerBeforeOfferReceived) { WebRtcMedium webrtc_medium; std::unique_ptr answerer = ConnectionFlow::Create( - LocalIceCandidateListener(), DataChannelListener(), webrtc_medium); + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium); ASSERT_NE(answerer, nullptr); SessionDescriptionWrapper answer = answerer->CreateAnswer(); @@ -143,13 +154,13 @@ TEST_F(ConnectionFlowTest, CreateAnswerBeforeOfferReceived) { TEST_F(ConnectionFlowTest, SetAnswerBeforeOffer) { WebRtcMedium webrtc_medium_offerer, webrtc_medium_answerer; - std::unique_ptr offerer = - ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), - webrtc_medium_offerer); + std::unique_ptr offerer = ConnectionFlow::Create( + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium_offerer); ASSERT_NE(offerer, nullptr); - std::unique_ptr answerer = - ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), - webrtc_medium_answerer); + std::unique_ptr answerer = ConnectionFlow::Create( + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); SessionDescriptionWrapper offer = offerer->CreateOffer(); @@ -168,7 +179,8 @@ TEST_F(ConnectionFlowTest, CannotCreateOfferAfterClose) { WebRtcMedium webrtc_medium; std::unique_ptr offerer = ConnectionFlow::Create( - LocalIceCandidateListener(), DataChannelListener(), webrtc_medium); + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium); ASSERT_NE(offerer, nullptr); EXPECT_TRUE(offerer->CloseIfNotConnected()); @@ -180,7 +192,8 @@ TEST_F(ConnectionFlowTest, CannotSetSessionDescriptionAfterClose) { WebRtcMedium webrtc_medium; std::unique_ptr offerer = ConnectionFlow::Create( - LocalIceCandidateListener(), DataChannelListener(), webrtc_medium); + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium); ASSERT_NE(offerer, nullptr); SessionDescriptionWrapper offer = offerer->CreateOffer(); @@ -195,13 +208,13 @@ TEST_F(ConnectionFlowTest, CannotSetSessionDescriptionAfterClose) { TEST_F(ConnectionFlowTest, CannotReceiveOfferAfterClose) { WebRtcMedium webrtc_medium_offerer, webrtc_medium_answerer; - std::unique_ptr offerer = - ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), - webrtc_medium_offerer); + std::unique_ptr offerer = ConnectionFlow::Create( + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium_offerer); ASSERT_NE(offerer, nullptr); - std::unique_ptr answerer = - ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), - webrtc_medium_answerer); + std::unique_ptr answerer = ConnectionFlow::Create( + LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); EXPECT_TRUE(answerer->CloseIfNotConnected()); @@ -218,8 +231,9 @@ TEST_F(ConnectionFlowTest, NullPeerConnection) { /*use_valid_peer_connection=*/false); WebRtcMedium medium; - std::unique_ptr answerer = ConnectionFlow::Create( - LocalIceCandidateListener(), DataChannelListener(), medium); + std::unique_ptr answerer = + ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), medium); EXPECT_EQ(answerer, nullptr); } @@ -227,15 +241,17 @@ TEST_F(ConnectionFlowTest, PeerConnectionTimeout) { MediumEnvironment::Instance().SetUseValidPeerConnection( /*use_valid_peer_connection=*/true); WebRtcMedium medium1; - std::unique_ptr flow1 = ConnectionFlow::Create( - LocalIceCandidateListener(), DataChannelListener(), medium1); + std::unique_ptr flow1 = + ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), medium1); EXPECT_NE(flow1, nullptr); // Attempt to trigger the 2.5s peer connection timeout. MediumEnvironment::Instance().SetPeerConnectionLatency(absl::Seconds(5)); WebRtcMedium medium2; - std::unique_ptr flow2 = ConnectionFlow::Create( - LocalIceCandidateListener(), DataChannelListener(), medium2); + std::unique_ptr flow2 = + ConnectionFlow::Create(LocalIceCandidateListener(), DataChannelListener(), + ConnectionFlow::AdapterTypeListener(), medium2); EXPECT_EQ(flow2, nullptr); } @@ -263,6 +279,10 @@ TEST_F(ConnectionFlowTest, TerminateAnswerer) { [&offerer_socket_future](WebRtcSocketWrapper socket) { offerer_socket_future.Set(std::move(socket)); }}, + {.adapter_type_changed_cb = + [](/*rtc::AdapterType*/ int adapter_type) { + // Do nothing + }}, webrtc_medium_offerer); ASSERT_NE(offerer, nullptr); answerer = ConnectionFlow::Create( @@ -279,6 +299,10 @@ TEST_F(ConnectionFlowTest, TerminateAnswerer) { [&answerer_socket_future](WebRtcSocketWrapper wrapper) { answerer_socket_future.Set(std::move(wrapper)); }}, + {.adapter_type_changed_cb = + [](/*rtc::AdapterType*/ int adapter_type) { + // Do nothing + }}, webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); @@ -344,6 +368,10 @@ TEST_F(ConnectionFlowTest, TerminateOfferer) { [&offerer_socket_future](WebRtcSocketWrapper socket) { offerer_socket_future.Set(std::move(socket)); }}, + {.adapter_type_changed_cb = + [](/*rtc::AdapterType*/ int adapter_type) { + // Do nothing + }}, webrtc_medium_offerer); ASSERT_NE(offerer, nullptr); answerer = ConnectionFlow::Create( @@ -360,6 +388,10 @@ TEST_F(ConnectionFlowTest, TerminateOfferer) { [&answerer_socket_future](WebRtcSocketWrapper wrapper) { answerer_socket_future.Set(std::move(wrapper)); }}, + {.adapter_type_changed_cb = + [](/*rtc::AdapterType*/ int adapter_type) { + // Do nothing + }}, webrtc_medium_answerer); ASSERT_NE(answerer, nullptr); diff --git a/connections/implementation/mediums/webrtc/data_channel_listener.h b/connections/implementation/mediums/webrtc/data_channel_listener.h index 8a98cda2..17e6a0dc 100644 --- a/connections/implementation/mediums/webrtc/data_channel_listener.h +++ b/connections/implementation/mediums/webrtc/data_channel_listener.h @@ -17,9 +17,8 @@ #ifndef NO_WEBRTC +#include "absl/functional/any_invocable.h" #include "connections/implementation/mediums/webrtc_socket.h" -#include "connections/listeners.h" -#include "internal/platform/byte_array.h" namespace nearby { namespace connections { @@ -27,13 +26,13 @@ namespace mediums { // Callbacks from the data channel. struct DataChannelListener { - // Called when the data channel is open and the socket wraper is ready to + // Called when the data channel is open and the socket wrapper is ready to // read and write. - std::function data_channel_open_cb = + absl::AnyInvocable data_channel_open_cb = [](WebRtcSocketWrapper) {}; // Called when the data channel is closed. - std::function data_channel_closed_cb = []() {}; + absl::AnyInvocable data_channel_closed_cb = []() {}; }; } // namespace mediums diff --git a/connections/implementation/mediums/webrtc/signaling_frames_test.cc b/connections/implementation/mediums/webrtc/signaling_frames_test.cc index a1bb674d..7e11b09a 100644 --- a/connections/implementation/mediums/webrtc/signaling_frames_test.cc +++ b/connections/implementation/mediums/webrtc/signaling_frames_test.cc @@ -16,11 +16,11 @@ #include -#include "google/protobuf/text_format.h" #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "connections/implementation/mediums/webrtc_peer_id.h" +#include "google/protobuf/text_format.h" namespace nearby { namespace connections { diff --git a/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc b/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc index 96d1b9bb..ce667810 100644 --- a/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc +++ b/connections/implementation/mediums/webrtc/webrtc_socket_impl.cc @@ -34,19 +34,19 @@ namespace mediums { // OutputStreamImpl Exception WebRtcSocket::OutputStreamImpl::Write(const ByteArray& data) { if (data.size() > kMaxDataSize) { - NEARBY_LOG(WARNING, "Sending data larger than 1MB"); + NEARBY_LOGS(WARNING) << "Sending data larger than 1MB"; return {Exception::kIo}; } socket_->BlockUntilSufficientSpaceInBuffer(data.size()); if (socket_->IsClosed()) { - NEARBY_LOG(WARNING, "Tried sending message while socket is closed"); + NEARBY_LOGS(WARNING) << "Tried sending message while socket is closed"; return {Exception::kIo}; } if (!socket_->SendMessage(data)) { - NEARBY_LOG(INFO, "Unable to write data to socket."); + NEARBY_LOGS(INFO) << "Unable to write data to socket."; return {Exception::kIo}; } return {Exception::kSuccess}; @@ -90,9 +90,9 @@ InputStream& WebRtcSocket::GetInputStream() { return *pipe_input_; } OutputStream& WebRtcSocket::GetOutputStream() { return output_stream_; } -void WebRtcSocket::Close() { +Exception WebRtcSocket::Close() { NEARBY_LOGS(INFO) << "WebRtcSocket::Close(" << name_ << ") this: " << this; - if (closed_.Set(true)) return; + if (closed_.Set(true)) return {Exception::kSuccess}; ClosePipe(); // NOTE: This call blocks and triggers a state change on the siginaling thread @@ -101,6 +101,7 @@ void WebRtcSocket::Close() { data_channel_->Close(); NEARBY_LOGS(INFO) << "WebRtcSocket::Close(" << name_ << ") this: " << this << " done"; + return {Exception::kSuccess}; } void WebRtcSocket::OnStateChange() { @@ -119,9 +120,8 @@ void WebRtcSocket::OnStateChange() { case webrtc::DataChannelInterface::DataState::kClosing: break; case webrtc::DataChannelInterface::DataState::kClosed: - NEARBY_LOG( - ERROR, - "WebRtcSocket::OnStateChange() unregistering data channel observer."); + NEARBY_LOGS(ERROR) << "WebRtcSocket::OnStateChange() unregistering data " + "channel observer."; // This will trigger a destruction of the owning connection flow // We implicitly depend on the |socket_listener_| to offload from // the signaling thread so it does not get blocked. diff --git a/connections/implementation/mediums/webrtc/webrtc_socket_impl.h b/connections/implementation/mediums/webrtc/webrtc_socket_impl.h index 723280b8..2c11f57f 100644 --- a/connections/implementation/mediums/webrtc/webrtc_socket_impl.h +++ b/connections/implementation/mediums/webrtc/webrtc_socket_impl.h @@ -15,17 +15,20 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_SOCKET_IMPL_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_WEBRTC_SOCKET_IMPL_H_ -#ifndef NO_WEBRTC - +#include +#include #include -#include "connections/listeners.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/listeners.h" +#include "internal/platform/runnable.h" +#ifndef NO_WEBRTC #include "internal/platform/atomic_boolean.h" #include "internal/platform/condition_variable.h" #include "internal/platform/input_stream.h" #include "internal/platform/mutex.h" #include "internal/platform/output_stream.h" -#include "internal/platform/pipe.h" #include "internal/platform/single_thread_executor.h" #include "internal/platform/socket.h" #include "webrtc/api/data_channel_interface.h" @@ -54,7 +57,7 @@ class WebRtcSocket : public Socket, public webrtc::DataChannelObserver { // Overrides for nearby::Socket: InputStream& GetInputStream() override; OutputStream& GetOutputStream() override; - void Close() override; + Exception Close() override; // webrtc::DataChannelObserver: void OnStateChange() override; diff --git a/connections/implementation/mediums/webrtc_socket.h b/connections/implementation/mediums/webrtc_socket.h index 3c1370e6..724e247a 100644 --- a/connections/implementation/mediums/webrtc_socket.h +++ b/connections/implementation/mediums/webrtc_socket.h @@ -15,6 +15,7 @@ #ifndef CORE_INTERNAL_MEDIUMS_WEBRTC_SOCKET_H_ #define CORE_INTERNAL_MEDIUMS_WEBRTC_SOCKET_H_ +#include "internal/platform/exception.h" #ifndef NO_WEBRTC #include @@ -38,7 +39,7 @@ class WebRtcSocketWrapper final { OutputStream& GetOutputStream() { return impl_->GetOutputStream(); } - void Close() { return impl_->Close(); } + Exception Close() { return impl_->Close(); } bool IsValid() const { return impl_ != nullptr; } diff --git a/connections/implementation/mediums/webrtc_stub.cc b/connections/implementation/mediums/webrtc_stub.cc index 425cce4c..f13e43fc 100644 --- a/connections/implementation/mediums/webrtc_stub.cc +++ b/connections/implementation/mediums/webrtc_stub.cc @@ -57,6 +57,8 @@ WebRtcSocketWrapper WebRtc::Connect(const std::string& service_id, return WebRtcSocketWrapper(); } +bool WebRtc::IsUsingCellular() { return false; } + } // namespace mediums } // namespace connections } // namespace nearby diff --git a/connections/implementation/mediums/webrtc_stub.h b/connections/implementation/mediums/webrtc_stub.h index 3bc01fe7..76223d88 100644 --- a/connections/implementation/mediums/webrtc_stub.h +++ b/connections/implementation/mediums/webrtc_stub.h @@ -72,6 +72,8 @@ class WebRtc { const std::string& service_id, const WebrtcPeerId& peer_id, const location::nearby::connections::LocationHint& location_hint, CancellationFlag* cancellation_flag); + + bool IsUsingCellular(); }; } // namespace mediums diff --git a/connections/implementation/mediums/webrtc_test.cc b/connections/implementation/mediums/webrtc_test.cc index 3ab47b00..0fa910b3 100644 --- a/connections/implementation/mediums/webrtc_test.cc +++ b/connections/implementation/mediums/webrtc_test.cc @@ -21,10 +21,14 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "connections/implementation/mediums/webrtc_peer_id.h" #include "connections/implementation/mediums/webrtc_socket.h" -#include "internal/platform/listeners.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/future.h" #include "internal/platform/medium_environment.h" -#include "internal/platform/mutex_lock.h" #include "internal/platform/webrtc.h" #include "internal/test/fake_webrtc.h" @@ -37,13 +41,9 @@ namespace { using FeatureFlags = FeatureFlags::Flags; using ::location::nearby::connections::LocationHint; -constexpr FeatureFlags kTestCases[] = { - FeatureFlags{ - .enable_cancellation_flag = true, - }, - FeatureFlags{ - .enable_cancellation_flag = false, - }, +struct WebRtcTestParams { + FeatureFlags feature_flags; + bool non_cellular; }; class TestWebRtc : public WebRtc { @@ -56,7 +56,7 @@ class TestWebRtc : public WebRtc { } }; -class WebRtcTest : public ::testing::TestWithParam { +class WebRtcTest : public ::testing::TestWithParam { protected: using MockAcceptedCallback = testing::MockFunction; @@ -68,8 +68,8 @@ class WebRtcTest : public ::testing::TestWithParam { // other but the signaling channel is closed before sending the data. TEST_P(WebRtcTest, ConnectBothDevices_ShutdownSignaling_SendData) { env_.Start({.webrtc_enabled = true}); - FeatureFlags feature_flags = GetParam(); - env_.SetFeatureFlags(feature_flags); + WebRtcTestParams params = GetParam(); + env_.SetFeatureFlags(params.feature_flags); WebRtc receiver, sender; WebRtcSocketWrapper receiver_socket, sender_socket; const WebrtcPeerId self_id("self_id"); @@ -84,10 +84,12 @@ TEST_P(WebRtcTest, ConnectBothDevices_ShutdownSignaling_SendData) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); CancellationFlag flag; - sender_socket = sender.Connect(service_id, self_id, location_hint, &flag); + sender_socket = sender.Connect(service_id, self_id, location_hint, &flag, + params.non_cellular); EXPECT_TRUE(sender_socket.IsValid()); ExceptionOr devices_connected = connected.Get(); @@ -107,8 +109,8 @@ TEST_P(WebRtcTest, ConnectBothDevices_ShutdownSignaling_SendData) { TEST_P(WebRtcTest, CanCancelConnect) { env_.Start({.webrtc_enabled = true}); - FeatureFlags feature_flags = GetParam(); - env_.SetFeatureFlags(feature_flags); + WebRtcTestParams params = GetParam(); + env_.SetFeatureFlags(params.feature_flags); WebRtc receiver, sender; WebRtcSocketWrapper receiver_socket, sender_socket; const WebrtcPeerId self_id("self_id"); @@ -123,12 +125,14 @@ TEST_P(WebRtcTest, CanCancelConnect) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); CancellationFlag flag(true); - sender_socket = sender.Connect(service_id, self_id, location_hint, &flag); + sender_socket = sender.Connect(service_id, self_id, location_hint, &flag, + params.non_cellular); // If FeatureFlag is disabled, Cancelled is false as no-op. - if (!feature_flags.enable_cancellation_flag) { + if (!params.feature_flags.enable_cancellation_flag) { EXPECT_TRUE(sender_socket.IsValid()); ExceptionOr devices_connected = connected.Get(); @@ -148,11 +152,8 @@ TEST_P(WebRtcTest, CanCancelConnect) { env_.Stop(); } -INSTANTIATE_TEST_SUITE_P(ParametrisedWebRtcTest, WebRtcTest, - ::testing::ValuesIn(kTestCases)); - // Basic test to check that device is accepting connections when initialized. -TEST_F(WebRtcTest, NotAcceptingConnections) { +TEST_P(WebRtcTest, NotAcceptingConnections) { env_.Start({.webrtc_enabled = true}); WebRtc webrtc; ASSERT_TRUE(webrtc.IsAvailable()); @@ -162,8 +163,9 @@ TEST_F(WebRtcTest, NotAcceptingConnections) { // Tests the flow when the device tries to accept connections twice. In this // case, only the first call is successful and subsequent calls fail. -TEST_F(WebRtcTest, StartAcceptingConnectionTwice) { +TEST_P(WebRtcTest, StartAcceptingConnectionTwice) { env_.Start({.webrtc_enabled = true}); + WebRtcTestParams params = GetParam(); testing::StrictMock mock_accepted_callback_; WebRtc webrtc; WebrtcPeerId self_id("peer_id"); @@ -173,10 +175,10 @@ TEST_F(WebRtcTest, StartAcceptingConnectionTwice) { ASSERT_TRUE(webrtc.IsAvailable()); ASSERT_TRUE(webrtc.StartAcceptingConnections( service_id, self_id, location_hint, - mock_accepted_callback_.AsStdFunction())); + mock_accepted_callback_.AsStdFunction(), params.non_cellular)); EXPECT_FALSE(webrtc.StartAcceptingConnections( service_id, self_id, location_hint, - mock_accepted_callback_.AsStdFunction())); + mock_accepted_callback_.AsStdFunction(), params.non_cellular)); EXPECT_TRUE(webrtc.IsAcceptingConnections(service_id)); EXPECT_FALSE(webrtc.IsAcceptingConnections(std::string{})); env_.Stop(); @@ -184,8 +186,9 @@ TEST_F(WebRtcTest, StartAcceptingConnectionTwice) { // Tests the flow when the device tries to connect but there is no peer // accepting connections at the given peer ID. -TEST_F(WebRtcTest, Connect_NoPeer) { +TEST_P(WebRtcTest, Connect_NoPeer) { env_.Start({.webrtc_enabled = true}); + WebRtcTestParams params = GetParam(); WebRtc webrtc; WebrtcPeerId peer_id("peer_id"); const std::string service_id("NearbySharing"); @@ -193,20 +196,21 @@ TEST_F(WebRtcTest, Connect_NoPeer) { ASSERT_TRUE(webrtc.IsAvailable()); CancellationFlag flag; - WebRtcSocketWrapper wrapper_1 = - webrtc.Connect(service_id, peer_id, location_hint, &flag); + WebRtcSocketWrapper wrapper_1 = webrtc.Connect( + service_id, peer_id, location_hint, &flag, params.non_cellular); EXPECT_FALSE(wrapper_1.IsValid()); - EXPECT_TRUE(webrtc.StartAcceptingConnections(service_id, peer_id, - location_hint, nullptr)); + EXPECT_TRUE(webrtc.StartAcceptingConnections( + service_id, peer_id, location_hint, nullptr, params.non_cellular)); env_.Stop(); } // Tests the flow when the device calls Connect() after calling // StartAcceptingConnections() without StopAcceptingConnections(). -TEST_F(WebRtcTest, StartAcceptingConnection_ThenConnect) { +TEST_P(WebRtcTest, StartAcceptingConnection_ThenConnect) { env_.Start({.webrtc_enabled = true}); testing::StrictMock mock_accepted_callback_; + WebRtcTestParams params = GetParam(); WebRtc webrtc; WebrtcPeerId self_id("peer_id"); const std::string service_id("NearbySharing"); @@ -215,23 +219,25 @@ TEST_F(WebRtcTest, StartAcceptingConnection_ThenConnect) { ASSERT_TRUE(webrtc.IsAvailable()); ASSERT_TRUE(webrtc.StartAcceptingConnections( service_id, self_id, location_hint, - mock_accepted_callback_.AsStdFunction())); + mock_accepted_callback_.AsStdFunction(), params.non_cellular)); CancellationFlag flag; - WebRtcSocketWrapper wrapper = webrtc.Connect( - service_id, WebrtcPeerId("random_peer_id"), location_hint, &flag); + WebRtcSocketWrapper wrapper = + webrtc.Connect(service_id, WebrtcPeerId("random_peer_id"), location_hint, + &flag, params.non_cellular); EXPECT_TRUE(webrtc.IsAcceptingConnections(service_id)); EXPECT_FALSE(wrapper.IsValid()); EXPECT_FALSE(webrtc.StartAcceptingConnections( service_id, self_id, location_hint, - mock_accepted_callback_.AsStdFunction())); + mock_accepted_callback_.AsStdFunction(), params.non_cellular)); env_.Stop(); } // Tests the flow when the device calls StartAcceptingConnections but the medium // is closed before a peer device can connect to it. -TEST_F(WebRtcTest, StartAndStopAcceptingConnections) { +TEST_P(WebRtcTest, StartAndStopAcceptingConnections) { env_.Start({.webrtc_enabled = true}); testing::StrictMock mock_accepted_callback_; + WebRtcTestParams params = GetParam(); WebRtc webrtc; WebrtcPeerId self_id("peer_id"); const std::string service_id("NearbySharing"); @@ -240,7 +246,7 @@ TEST_F(WebRtcTest, StartAndStopAcceptingConnections) { ASSERT_TRUE(webrtc.IsAvailable()); ASSERT_TRUE(webrtc.StartAcceptingConnections( service_id, self_id, location_hint, - mock_accepted_callback_.AsStdFunction())); + mock_accepted_callback_.AsStdFunction(), params.non_cellular)); EXPECT_TRUE(webrtc.IsAcceptingConnections(service_id)); webrtc.StopAcceptingConnections(service_id); EXPECT_FALSE(webrtc.IsAcceptingConnections(service_id)); @@ -249,10 +255,11 @@ TEST_F(WebRtcTest, StartAndStopAcceptingConnections) { // Tests the flow when the device tries to connect to two different peers // without disconnecting in between. -TEST_F(WebRtcTest, ConnectTwice) { +TEST_P(WebRtcTest, ConnectTwice) { env_.Start({.webrtc_enabled = true}); WebRtc receiver, sender, device_c; WebRtcSocketWrapper receiver_socket, sender_socket; + WebRtcTestParams params = GetParam(); const WebrtcPeerId self_id("self_id"), other_id("other_id"); const std::string service_id("NearbySharing"); LocationHint location_hint; @@ -265,22 +272,25 @@ TEST_F(WebRtcTest, ConnectTwice) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); device_c.StartAcceptingConnections( service_id, other_id, location_hint, - [](const std::string& service_id, WebRtcSocketWrapper wrapper) {}); + [](const std::string& service_id, WebRtcSocketWrapper wrapper) {}, + params.non_cellular); CancellationFlag flag; - sender_socket = sender.Connect(service_id, self_id, location_hint, &flag); + sender_socket = sender.Connect(service_id, self_id, location_hint, &flag, + params.non_cellular); EXPECT_TRUE(sender_socket.IsValid()); ExceptionOr devices_connected = connected.Get(); ASSERT_TRUE(devices_connected.ok()); EXPECT_TRUE(devices_connected.result()); - WebRtcSocketWrapper socket = - sender.Connect(service_id, other_id, location_hint, &flag); + WebRtcSocketWrapper socket = sender.Connect( + service_id, other_id, location_hint, &flag, params.non_cellular); EXPECT_TRUE(socket.IsValid()); socket.Close(); @@ -299,10 +309,11 @@ TEST_F(WebRtcTest, ConnectTwice) { // Tests the flow when the two devices exchange SDP messages and connect to each // other but disconnect before being able to send/receive the actual data. -TEST_F(WebRtcTest, ConnectBothDevicesAndAbort) { +TEST_P(WebRtcTest, ConnectBothDevicesAndAbort) { env_.Start({.webrtc_enabled = true}); WebRtc receiver, sender; WebRtcSocketWrapper receiver_socket, sender_socket; + WebRtcTestParams params = GetParam(); const WebrtcPeerId self_id("self_id"); const std::string service_id("NearbySharing"); LocationHint location_hint; @@ -315,10 +326,12 @@ TEST_F(WebRtcTest, ConnectBothDevicesAndAbort) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); CancellationFlag flag; - sender_socket = sender.Connect(service_id, self_id, location_hint, &flag); + sender_socket = sender.Connect(service_id, self_id, location_hint, &flag, + params.non_cellular); EXPECT_TRUE(sender_socket.IsValid()); ExceptionOr devices_connected = connected.Get(); @@ -331,10 +344,11 @@ TEST_F(WebRtcTest, ConnectBothDevicesAndAbort) { // Tests the flow when the two devices exchange SDP messages and connect to each // other and the actual data is exchanged successfully between the devices. -TEST_F(WebRtcTest, ConnectBothDevicesAndSendData) { +TEST_P(WebRtcTest, ConnectBothDevicesAndSendData) { env_.Start({.webrtc_enabled = true}); WebRtc receiver, sender; WebRtcSocketWrapper receiver_socket, sender_socket; + WebRtcTestParams params = GetParam(); const WebrtcPeerId self_id("self_id"); const std::string service_id("NearbySharing"); LocationHint location_hint; @@ -347,10 +361,12 @@ TEST_F(WebRtcTest, ConnectBothDevicesAndSendData) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); CancellationFlag flag; - sender_socket = sender.Connect(service_id, self_id, location_hint, &flag); + sender_socket = sender.Connect(service_id, self_id, location_hint, &flag, + params.non_cellular); EXPECT_TRUE(sender_socket.IsValid()); ExceptionOr devices_connected = connected.Get(); @@ -367,8 +383,9 @@ TEST_F(WebRtcTest, ConnectBothDevicesAndSendData) { env_.Stop(); } -TEST_F(WebRtcTest, Connect_NullPeerConnection) { +TEST_P(WebRtcTest, Connect_NullPeerConnection) { env_.Start({.webrtc_enabled = true}); + WebRtcTestParams params = GetParam(); testing::StrictMock mock_accepted_callback_; env_.SetUseValidPeerConnection( /*use_valid_peer_connection=*/false); @@ -380,17 +397,19 @@ TEST_F(WebRtcTest, Connect_NullPeerConnection) { ASSERT_TRUE(webrtc.IsAvailable()); CancellationFlag flag; - WebRtcSocketWrapper wrapper = webrtc.Connect( - service_id, WebrtcPeerId("random_peer_id"), location_hint, &flag); + WebRtcSocketWrapper wrapper = + webrtc.Connect(service_id, WebrtcPeerId("random_peer_id"), location_hint, + &flag, params.non_cellular); EXPECT_FALSE(wrapper.IsValid()); env_.Stop(); } // Tests the flow when the device calls StartAcceptingConnections and the // receive messages stream fails. -TEST_F(WebRtcTest, ContinueAcceptingConnectionsOnComplete) { +TEST_P(WebRtcTest, ContinueAcceptingConnectionsOnComplete) { env_.Start({.webrtc_enabled = true}); testing::StrictMock mock_accepted_callback_; + WebRtcTestParams params = GetParam(); WebRtc webrtc; WebrtcPeerId self_id("peer_id"); const std::string service_id("NearbySharing"); @@ -399,7 +418,7 @@ TEST_F(WebRtcTest, ContinueAcceptingConnectionsOnComplete) { ASSERT_TRUE(webrtc.IsAvailable()); ASSERT_TRUE(webrtc.StartAcceptingConnections( service_id, self_id, location_hint, - mock_accepted_callback_.AsStdFunction())); + mock_accepted_callback_.AsStdFunction(), params.non_cellular)); EXPECT_TRUE(webrtc.IsAcceptingConnections(service_id)); // Simulate a failure in receiving messages stream, WebRtc should restart @@ -420,11 +439,14 @@ TEST_F(WebRtcTest, ContinueAcceptingConnectionsOnComplete) { // Tests when a CancellationFlag is cancelled during an attempt to // `WebRtc::AttemptToConnect` triggered by `WebRtc::Connect`. -TEST_F(WebRtcTest, CancelDuringConnect) { +TEST_P(WebRtcTest, CancelDuringConnect) { env_.Start({.webrtc_enabled = true}); + WebRtcTestParams params = GetParam(); // Enable cancellation flags. - env_.SetFeatureFlags(kTestCases[0]); + env_.SetFeatureFlags(FeatureFlags{ + .enable_cancellation_flag = true, + }); WebRtcSocketWrapper receiver_socket, sender_socket; const WebrtcPeerId self_id("self_id"); @@ -454,10 +476,11 @@ TEST_F(WebRtcTest, CancelDuringConnect) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); - sender_socket = - sender->Connect(service_id, self_id, location_hint, &sender_flag); + sender_socket = sender->Connect(service_id, self_id, location_hint, + &sender_flag, params.non_cellular); // Since the flag was cancelled during the initial `AttemptToConnect`, except // only one attempt instead of the usual three, because the cancellation flag @@ -473,11 +496,14 @@ TEST_F(WebRtcTest, CancelDuringConnect) { // Tests when a CancellationFlag is cancelled before `WebRtc::Connect` is // called. -TEST_F(WebRtcTest, CancelBeforeConnect) { +TEST_P(WebRtcTest, CancelBeforeConnect) { env_.Start({.webrtc_enabled = true}); + WebRtcTestParams params = GetParam(); // Enable cancellation flags. - env_.SetFeatureFlags(kTestCases[0]); + env_.SetFeatureFlags(FeatureFlags{ + .enable_cancellation_flag = true, + }); WebRtcSocketWrapper receiver_socket, sender_socket; const WebrtcPeerId self_id("self_id"); @@ -500,10 +526,11 @@ TEST_F(WebRtcTest, CancelBeforeConnect) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); - sender_socket = - sender->Connect(service_id, self_id, location_hint, &sender_flag); + sender_socket = sender->Connect(service_id, self_id, location_hint, + &sender_flag, params.non_cellular); // Expect an invalid socket from stopping during the first attempt to connect, // because `Connect` returned immediatley when it checked for cancellation. @@ -516,11 +543,14 @@ TEST_F(WebRtcTest, CancelBeforeConnect) { // Tests when a CancellationFlag is cancelled during an attempt to // `WebRtc::AttemptToConnect` triggered by `WebRtc::Connect` when multiple // `WebRTC::Connect` calls are in flight for multiple service ids. -TEST_F(WebRtcTest, CancelDuringConnect_MultipleConnect) { +TEST_P(WebRtcTest, CancelDuringConnect_MultipleConnect) { env_.Start({.webrtc_enabled = true}); + WebRtcTestParams params = GetParam(); // Enable cancellation flags. - env_.SetFeatureFlags(kTestCases[0]); + env_.SetFeatureFlags(FeatureFlags{ + .enable_cancellation_flag = true, + }); WebRtcSocketWrapper receiver_socket, sender_socket; const WebrtcPeerId self_id("self_id"); @@ -545,17 +575,20 @@ TEST_F(WebRtcTest, CancelDuringConnect_MultipleConnect) { WebRtcSocketWrapper wrapper) mutable { receiver_socket = wrapper; connected.Set(receiver_socket.IsValid()); - }); + }, + params.non_cellular); // Simulate a successful connect for the endpoint of NearbySharing. - sender_socket = sender->Connect(ns_service_id, self_id, location_hint, &flag); + sender_socket = sender->Connect(ns_service_id, self_id, location_hint, &flag, + params.non_cellular); EXPECT_TRUE(sender_socket.IsValid()); // Calls `CancellationFlag::Cancel` during a call to `GetSignalingMessenger` // to simulate the cancellation occuring during an `AttemptToConnect` for the // endpoint of Phone Hub. fake_sender_medium->TriggerCancellationDuringGetSignalingMessenger(); - sender_socket = sender->Connect(ph_service_id, self_id, location_hint, &flag); + sender_socket = sender->Connect(ph_service_id, self_id, location_hint, &flag, + params.non_cellular); EXPECT_FALSE(sender_socket.IsValid()); // Since the flag was cancelled during the initial `AttemptToConnect`, except @@ -571,6 +604,30 @@ TEST_F(WebRtcTest, CancelDuringConnect_MultipleConnect) { env_.Stop(); } +INSTANTIATE_TEST_SUITE_P(ParametrisedWebRtcTest, WebRtcTest, + testing::ValuesIn({ + {.feature_flags = + FeatureFlags{ + .enable_cancellation_flag = true, + }, + .non_cellular = true}, + {.feature_flags = + FeatureFlags{ + .enable_cancellation_flag = true, + }, + .non_cellular = false}, + {.feature_flags = + FeatureFlags{ + .enable_cancellation_flag = false, + }, + .non_cellular = true}, + {.feature_flags = + FeatureFlags{ + .enable_cancellation_flag = false, + }, + .non_cellular = false}, + })); + } // namespace } // namespace mediums diff --git a/connections/implementation/mediums/wifi_hotspot.cc b/connections/implementation/mediums/wifi_hotspot.cc index 8605ad1d..7ef93eae 100644 --- a/connections/implementation/mediums/wifi_hotspot.cc +++ b/connections/implementation/mediums/wifi_hotspot.cc @@ -94,14 +94,16 @@ bool WifiHotspot::IsConnectedToHotspot() { } bool WifiHotspot::ConnectWifiHotspot(const std::string& ssid, - const std::string& password) { + const std::string& password, + int frequency) { MutexLock lock(&mutex_); if (is_connected_to_hotspot_) { NEARBY_LOGS(INFO) << "No need to connect to Hotspot because it is already connected."; return true; } - is_connected_to_hotspot_ = medium_.ConnectWifiHotspot(ssid, password); + is_connected_to_hotspot_ = + medium_.ConnectWifiHotspot(ssid, password, frequency); return is_connected_to_hotspot_; } diff --git a/connections/implementation/mediums/wifi_hotspot.h b/connections/implementation/mediums/wifi_hotspot.h index 6b63eac7..4fac1c9c 100644 --- a/connections/implementation/mediums/wifi_hotspot.h +++ b/connections/implementation/mediums/wifi_hotspot.h @@ -49,8 +49,8 @@ class WifiHotspot { bool StopWifiHotspot() ABSL_LOCKS_EXCLUDED(mutex_); bool IsConnectedToHotspot() ABSL_LOCKS_EXCLUDED(mutex_); - bool ConnectWifiHotspot(const std::string& ssid, const std::string& password) - ABSL_LOCKS_EXCLUDED(mutex_); + bool ConnectWifiHotspot(const std::string& ssid, const std::string& password, + int frequency) ABSL_LOCKS_EXCLUDED(mutex_); bool DisconnectWifiHotspot() ABSL_LOCKS_EXCLUDED(mutex_); // Starts a worker thread, creates a WifiHotspot socket, associates it with a diff --git a/connections/implementation/mediums/wifi_hotspot_test.cc b/connections/implementation/mediums/wifi_hotspot_test.cc index d6057158..2211620d 100644 --- a/connections/implementation/mediums/wifi_hotspot_test.cc +++ b/connections/implementation/mediums/wifi_hotspot_test.cc @@ -15,9 +15,12 @@ #include "connections/implementation/mediums/wifi_hotspot.h" +#include +#include #include #include "gtest/gtest.h" +#include "absl/strings/string_view.h" #include "absl/time/clock.h" #include "internal/platform/medium_environment.h" #include "internal/platform/wifi_hotspot.h" @@ -42,6 +45,7 @@ constexpr absl::string_view kServiceID{"com.google.location.nearby.apps.test"}; constexpr absl::string_view kSsid{"Direct-357a2d8c"}; constexpr absl::string_view kPassword{"12345678"}; constexpr absl::string_view kIp = "123.234.23.1"; +constexpr int kFrequency = 2412; constexpr const size_t kPort = 20; class WifiHotspotTest : public testing::TestWithParam { @@ -86,7 +90,7 @@ TEST_F(WifiHotspotTest, CanConnectDisconnectHotspot) { std::string ssid(kSsid); std::string password(kPassword); - EXPECT_FALSE(wifi_hotspot_a->ConnectWifiHotspot(ssid, password)); + EXPECT_FALSE(wifi_hotspot_a->ConnectWifiHotspot(ssid, password, kFrequency)); EXPECT_TRUE(wifi_hotspot_a->DisconnectWifiHotspot()); } @@ -108,7 +112,8 @@ TEST_P(WifiHotspotTest, CanStartHotspotThatOtherConnect) { wifi_hotspot_a->GetCredentials(service_id); EXPECT_TRUE(wifi_hotspot_b->ConnectWifiHotspot( - hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword())); + hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword(), + hotspot_credentials->GetFrequency())); WifiHotspotSocket socket_client; EXPECT_FALSE(socket_client.IsValid()); @@ -144,7 +149,8 @@ TEST_P(WifiHotspotTest, CanStartHotspotThatOtherCanCancelConnect) { wifi_hotspot_a->GetCredentials(service_id); EXPECT_TRUE(wifi_hotspot_b->ConnectWifiHotspot( - hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword())); + hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword(), + hotspot_credentials->GetFrequency())); WifiHotspotSocket socket_client; EXPECT_FALSE(socket_client.IsValid()); @@ -175,7 +181,7 @@ TEST_F(WifiHotspotTest, CanStartHotspotTheOtherFailConnect) { std::string ssid(kSsid); std::string password(kPassword); - EXPECT_FALSE(wifi_hotspot_b->ConnectWifiHotspot(ssid, password)); + EXPECT_FALSE(wifi_hotspot_b->ConnectWifiHotspot(ssid, password, kFrequency)); EXPECT_TRUE(wifi_hotspot_b->DisconnectWifiHotspot()); EXPECT_TRUE(wifi_hotspot_a->StopWifiHotspot()); diff --git a/connections/implementation/message_lite.h b/connections/implementation/message_lite.h index 5ce9d91e..39635702 100644 --- a/connections/implementation/message_lite.h +++ b/connections/implementation/message_lite.h @@ -15,6 +15,6 @@ #ifndef CORE_INTERNAL_MESSAGE_LITE_H_ #define CORE_INTERNAL_MESSAGE_LITE_H_ -#include "google/protobuf/message_lite.h" +#include "google/protobuf/message_lite.h" // IWYU pragma: export #endif // CORE_INTERNAL_MESSAGE_LITE_H_ diff --git a/internal/platform/base_mutex_lock.h b/connections/implementation/mock_device.h similarity index 51% rename from internal/platform/base_mutex_lock.h rename to connections/implementation/mock_device.h index 90f27a29..b7cd733b 100644 --- a/internal/platform/base_mutex_lock.h +++ b/connections/implementation/mock_device.h @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,27 +12,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef PLATFORM_BASE_BASE_MUTEX_LOCK_H_ -#define PLATFORM_BASE_BASE_MUTEX_LOCK_H_ +#ifndef CORE_INTERNAL_MOCK_DEVICE +#define CORE_INTERNAL_MOCK_DEVICE -#include "absl/base/thread_annotations.h" -#include "internal/platform/implementation/mutex.h" +#include +#include + +#include "gmock/gmock.h" +#include "internal/interop/device.h" namespace nearby { -// An RAII mechanism to acquire a Lock over a block of code. -class ABSL_SCOPED_LOCKABLE BaseMutexLock final { +class MockNearbyDevice : public NearbyDevice { public: - explicit BaseMutexLock(api::Mutex* mutex) ABSL_EXCLUSIVE_LOCK_FUNCTION(mutex) - : mutex_(mutex) { - mutex_->Lock(); - } - ~BaseMutexLock() ABSL_UNLOCK_FUNCTION() { mutex_->Unlock(); } - - private: - api::Mutex* mutex_; + MOCK_METHOD(NearbyDevice::Type, GetType, (), (const, override)); + MOCK_METHOD(std::string, GetEndpointId, (), (const, override)); + MOCK_METHOD(std::vector, GetConnectionInfos, (), + (const, override)); + MOCK_METHOD(std::string, ToProtoBytes, (), (const, override)); }; } // namespace nearby -#endif // PLATFORM_BASE_BASE_MUTEX_LOCK_H_ +#endif // CORE_INTERNAL_MOCK_DEVICE diff --git a/connections/implementation/mock_service_controller.h b/connections/implementation/mock_service_controller.h index adff80b3..02e336c4 100644 --- a/connections/implementation/mock_service_controller.h +++ b/connections/implementation/mock_service_controller.h @@ -20,7 +20,9 @@ #include "gmock/gmock.h" #include "connections/implementation/service_controller.h" +#include "connections/listeners.h" #include "connections/v3/connection_listening_options.h" +#include "internal/interop/device.h" namespace nearby { namespace connections { @@ -46,7 +48,7 @@ class MockServiceController : public ServiceController { MOCK_METHOD(Status, StartDiscovery, (ClientProxy * client, const std::string& service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener), + DiscoveryListener listener), (override)); MOCK_METHOD(void, StopDiscovery, (ClientProxy * client), (override)); @@ -72,6 +74,12 @@ class MockServiceController : public ServiceController { const ConnectionOptions& connection_options), (override)); + MOCK_METHOD(Status, RequestConnectionV3, + (ClientProxy * client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options), + (override)); + MOCK_METHOD(Status, AcceptConnection, (ClientProxy * client, const std::string& endpoint_id, PayloadListener listener), diff --git a/connections/implementation/mock_service_controller_router.h b/connections/implementation/mock_service_controller_router.h index 4d8ea108..14e6e9c5 100644 --- a/connections/implementation/mock_service_controller_router.h +++ b/connections/implementation/mock_service_controller_router.h @@ -17,6 +17,7 @@ #include "gmock/gmock.h" #include "connections/implementation/service_controller_router.h" +#include "connections/listeners.h" namespace nearby { namespace connections { @@ -35,7 +36,7 @@ class MockServiceControllerRouter : public ServiceControllerRouter { MOCK_METHOD(void, StartDiscovery, (ClientProxy * client, absl::string_view service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener, ResultCallback callback), + DiscoveryListener listener, ResultCallback callback), (override)); MOCK_METHOD(void, StopDiscovery, diff --git a/connections/implementation/offline_frames.cc b/connections/implementation/offline_frames.cc index 395d2a99..e9084d83 100644 --- a/connections/implementation/offline_frames.cc +++ b/connections/implementation/offline_frames.cc @@ -21,8 +21,10 @@ #include #include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/internal_payload.h" #include "connections/implementation/offline_frames_validator.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" +#include "connections/medium_selector.h" #include "connections/status.h" #include "internal/flags/nearby_flags.h" #include "internal/platform/byte_array.h" @@ -43,6 +45,7 @@ using ::location::nearby::connections::OfflineFrame; using ::location::nearby::connections::OsInfo; using ::location::nearby::connections::PayloadTransferFrame; using ::location::nearby::connections::V1Frame; +using ::location::nearby::connections::AutoReconnectFrame; ByteArray ToBytes(OfflineFrame&& frame) { ByteArray bytes(frame.ByteSizeLong()); @@ -168,8 +171,8 @@ ByteArray ForConnectionRequestPresence( return ToBytes(std::move(frame)); } -ByteArray ForConnectionResponse( - std::int32_t status, const OsInfo& os_info) { +ByteArray ForConnectionResponse(std::int32_t status, const OsInfo& os_info, + std::int32_t multiplex_socket_bitmask) { OfflineFrame frame; frame.set_version(OfflineFrame::V1); @@ -185,6 +188,7 @@ ByteArray ForConnectionResponse( ? ConnectionResponseFrame::ACCEPT : ConnectionResponseFrame::REJECT); *sub_frame->mutable_os_info() = os_info; + sub_frame->set_multiplex_socket_bitmask(multiplex_socket_bitmask); sub_frame->set_safe_to_disconnect_version( NearbyFlags::GetInstance().GetInt64Flag( config_package_nearby::nearby_connections_feature:: @@ -225,9 +229,27 @@ ByteArray ForControlPayloadTransfer( return ToBytes(std::move(frame)); } +ByteArray ForPayloadAckPayloadTransfer(std::int64_t payload_id) { + OfflineFrame frame; + + frame.set_version(OfflineFrame::V1); + auto* v1_frame = frame.mutable_v1(); + v1_frame->set_type(V1Frame::PAYLOAD_TRANSFER); + auto* sub_frame = v1_frame->mutable_payload_transfer(); + sub_frame->set_packet_type(PayloadTransferFrame::PAYLOAD_ACK); + + PayloadTransferFrame::PayloadHeader header; + header.set_id(payload_id); + header.set_total_size(InternalPayload::kIndeterminateSize); + *sub_frame->mutable_payload_header() = header; + + return ToBytes(std::move(frame)); +} + ByteArray ForBwuWifiHotspotPathAvailable(const std::string& ssid, const std::string& password, std::int32_t port, + std::int32_t frequency, const std::string& gateway, bool supports_disabling_encryption) { OfflineFrame frame; @@ -248,6 +270,7 @@ ByteArray ForBwuWifiHotspotPathAvailable(const std::string& ssid, wifi_hotspot_credentials->set_ssid(ssid); wifi_hotspot_credentials->set_password(password); wifi_hotspot_credentials->set_port(port); + wifi_hotspot_credentials->set_frequency(frequency); wifi_hotspot_credentials->set_gateway(gateway); return ToBytes(std::move(frame)); @@ -467,6 +490,32 @@ ByteArray ForDisconnection(bool request_safe_to_disconnect, return ToBytes(std::move(frame)); } +ByteArray ForAutoReconnectIntroduction(const std::string& endpoint_id) { + OfflineFrame frame; + + frame.set_version(OfflineFrame::V1); + auto* v1_frame = frame.mutable_v1(); + v1_frame->set_type(V1Frame::AUTO_RECONNECT); + auto* auto_reconnect = v1_frame->mutable_auto_reconnect(); + auto_reconnect->set_endpoint_id(endpoint_id); + auto_reconnect->set_event_type(AutoReconnectFrame::CLIENT_INTRODUCTION); + + return ToBytes(std::move(frame)); +} + +ByteArray ForAutoReconnectIntroductionAck(const std::string& endpoint_id) { + OfflineFrame frame; + + frame.set_version(OfflineFrame::V1); + auto* v1_frame = frame.mutable_v1(); + v1_frame->set_type(V1Frame::AUTO_RECONNECT); + auto* auto_reconnect = v1_frame->mutable_auto_reconnect(); + auto_reconnect->set_endpoint_id(endpoint_id); + auto_reconnect->set_event_type(AutoReconnectFrame::CLIENT_INTRODUCTION_ACK); + + return ToBytes(std::move(frame)); +} + UpgradePathInfo::Medium MediumToUpgradePathInfoMedium(Medium medium) { switch (medium) { case Medium::MDNS: @@ -487,6 +536,8 @@ UpgradePathInfo::Medium MediumToUpgradePathInfoMedium(Medium medium) { return UpgradePathInfo::WIFI_DIRECT; case Medium::WEB_RTC: return UpgradePathInfo::WEB_RTC; + case Medium::WEB_RTC_NON_CELLULAR: + return UpgradePathInfo::WEB_RTC_NON_CELLULAR; default: return UpgradePathInfo::UNKNOWN_MEDIUM; } @@ -512,6 +563,8 @@ Medium UpgradePathInfoMediumToMedium(UpgradePathInfo::Medium medium) { return Medium::WIFI_DIRECT; case UpgradePathInfo::WEB_RTC: return Medium::WEB_RTC; + case UpgradePathInfo::WEB_RTC_NON_CELLULAR: + return Medium::WEB_RTC_NON_CELLULAR; default: return Medium::UNKNOWN_MEDIUM; } @@ -537,6 +590,8 @@ ConnectionRequestFrame::Medium MediumToConnectionRequestMedium(Medium medium) { return ConnectionRequestFrame::WIFI_DIRECT; case Medium::WEB_RTC: return ConnectionRequestFrame::WEB_RTC; + case Medium::WEB_RTC_NON_CELLULAR: + return ConnectionRequestFrame::WEB_RTC_NON_CELLULAR; default: return ConnectionRequestFrame::UNKNOWN_MEDIUM; } @@ -562,6 +617,8 @@ Medium ConnectionRequestMediumToMedium(ConnectionRequestFrame::Medium medium) { return Medium::WIFI_DIRECT; case ConnectionRequestFrame::WEB_RTC: return Medium::WEB_RTC; + case ConnectionRequestFrame::WEB_RTC_NON_CELLULAR: + return Medium::WEB_RTC_NON_CELLULAR; default: return Medium::UNKNOWN_MEDIUM; } diff --git a/connections/implementation/offline_frames.h b/connections/implementation/offline_frames.h index fb6214ab..c9e9e71c 100644 --- a/connections/implementation/offline_frames.h +++ b/connections/implementation/offline_frames.h @@ -53,7 +53,8 @@ ByteArray ForConnectionRequestPresence( const location::nearby::connections::PresenceDevice& proto_presence_device, const ConnectionInfo& connection_info); ByteArray ForConnectionResponse( - std::int32_t status, const location::nearby::connections::OsInfo& os_info); + std::int32_t status, const location::nearby::connections::OsInfo& os_info, + std::int32_t multiplex_socket_bitmask); // Builds Payload transfer messages. ByteArray ForDataPayloadTransfer( @@ -66,6 +67,7 @@ ByteArray ForControlPayloadTransfer( header, const location::nearby::connections::PayloadTransferFrame::ControlMessage& control); +ByteArray ForPayloadAckPayloadTransfer(std::int64_t payload_id); // Builds Bandwidth Upgrade [BWU] messages. ByteArray ForBwuIntroduction(const std::string& endpoint_id, @@ -74,6 +76,7 @@ ByteArray ForBwuIntroductionAck(); ByteArray ForBwuWifiHotspotPathAvailable(const std::string& ssid, const std::string& password, std::int32_t port, + std::int32_t frequency, const std::string& gateway, bool supports_disabling_encryption); ByteArray ForBwuWifiLanPathAvailable(const std::string& ip_address, @@ -100,6 +103,8 @@ ByteArray ForBwuSafeToClose(); ByteArray ForKeepAlive(); ByteArray ForDisconnection(bool request_safe_to_disconnect, bool ack_safe_to_disconnect); +ByteArray ForAutoReconnectIntroduction(const std::string& endpoint_id); +ByteArray ForAutoReconnectIntroductionAck(const std::string& endpoint_id); UpgradePathInfo::Medium MediumToUpgradePathInfoMedium(Medium medium); Medium UpgradePathInfoMediumToMedium(UpgradePathInfo::Medium medium); diff --git a/connections/implementation/offline_frames_test.cc b/connections/implementation/offline_frames_test.cc index ebd5c813..c200c6b5 100644 --- a/connections/implementation/offline_frames_test.cc +++ b/connections/implementation/offline_frames_test.cc @@ -17,14 +17,15 @@ #include #include #include -#include #include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/strings/string_view.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/byte_array.h" namespace nearby { @@ -269,13 +270,19 @@ TEST(OfflineFramesTest, CanGenerateConnectionResponse) { status: 1 response: REJECT os_info { type: LINUX } - safe_to_disconnect_version: 0 + multiplex_socket_bitmask: 0x01 + safe_to_disconnect_version: 5 > >)pb"; OsInfo os_info; os_info.set_type(OsInfo::LINUX); - ByteArray bytes = ForConnectionResponse(1, os_info); + NearbyFlags::GetInstance().OverrideInt64FlagValue( + config_package_nearby::nearby_connections_feature:: + kSafeToDisconnectVersion, + 5); + ByteArray bytes = + ForConnectionResponse(1, os_info, /*multiplex_socket_bitmask=*/0x01); auto response = FromBytes(bytes); ASSERT_TRUE(response.ok()); OfflineFrame message = response.result(); @@ -337,6 +344,24 @@ TEST(OfflineFramesTest, CanGenerateDataPayloadTransfer) { EXPECT_THAT(message, EqualsProto(kExpected)); } +TEST(OfflineFramesTest, CanGeneratePayloadAckPayloadTransfer) { + constexpr absl::string_view kExpected = + R"pb( + version: V1 + v1: < + type: PAYLOAD_TRANSFER + payload_transfer: < + packet_type: PAYLOAD_ACK, + payload_header: < id: 12345 total_size: -1 > + > + >)pb"; + ByteArray bytes = ForPayloadAckPayloadTransfer(12345); + auto response = FromBytes(bytes); + ASSERT_TRUE(response.ok()); + OfflineFrame message = response.result(); + EXPECT_THAT(message, EqualsProto(kExpected)); +} + TEST(OfflineFramesTest, CanGenerateBwuWifiHotspotPathAvailable) { constexpr absl::string_view kExpected = R"pb( @@ -352,14 +377,15 @@ TEST(OfflineFramesTest, CanGenerateBwuWifiHotspotPathAvailable) { password: "password" port: 1234 gateway: "0.0.0.0" + frequency: 2412 > supports_disabling_encryption: false supports_client_introduction_ack: true > > >)pb"; - ByteArray bytes = ForBwuWifiHotspotPathAvailable("ssid", "password", 1234, - "0.0.0.0", false); + ByteArray bytes = ForBwuWifiHotspotPathAvailable( + "ssid", "password", 1234, /*frequency=*/2412, "0.0.0.0", false); auto response = FromBytes(bytes); ASSERT_TRUE(response.ok()); OfflineFrame message = response.result(); @@ -558,6 +584,43 @@ TEST(OfflineFramesTest, CanGenerateDisconnection) { EXPECT_THAT(message, EqualsProto(kExpected)); } +TEST(OfflineFramesTest, CanGenerateAutoReconnectIntroduction) { + constexpr absl::string_view kExpected = + R"pb( + version: V1 + v1: < + type: AUTO_RECONNECT + auto_reconnect: < + event_type: CLIENT_INTRODUCTION + endpoint_id: "ABC" + > + >)pb"; + ByteArray bytes = ForAutoReconnectIntroduction(std::string(kEndpointId)); + auto response = FromBytes(bytes); + ASSERT_TRUE(response.ok()); + OfflineFrame message = response.result(); + EXPECT_THAT(message, EqualsProto(kExpected)); +} + +TEST(OfflineFramesTest, CanGenerateAutoReconnectIntroductionAck) { + constexpr absl::string_view kExpected = + R"pb( + version: V1 + v1: < + type: AUTO_RECONNECT + auto_reconnect: < + event_type: CLIENT_INTRODUCTION_ACK + endpoint_id: "ABC" + > + >)pb"; + ByteArray bytes = ForAutoReconnectIntroductionAck(std::string(kEndpointId)); + auto response = FromBytes(bytes); + ASSERT_TRUE(response.ok()); + OfflineFrame message = response.result(); + EXPECT_THAT(message, EqualsProto(kExpected)); +} + + } // namespace } // namespace parser } // namespace connections diff --git a/connections/implementation/offline_frames_validator.cc b/connections/implementation/offline_frames_validator.cc index 5df7a1d3..66f670ce 100644 --- a/connections/implementation/offline_frames_validator.cc +++ b/connections/implementation/offline_frames_validator.cc @@ -14,14 +14,14 @@ #include "connections/implementation/offline_frames_validator.h" -#include +#include #include //NOLINT #include #include "connections/implementation/internal_payload.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" -#include "internal/platform/implementation/platform.h" +#include "internal/platform/exception.h" #include "internal/platform/logging.h" namespace nearby { @@ -72,8 +72,8 @@ inline bool WithinRange(int value, int min, int max) { Exception EnsureValidConnectionRequestFrame( const ConnectionRequestFrame& frame) { - if (!frame.has_endpoint_id()) return {Exception::kInvalidProtocolBuffer}; - if (!frame.has_endpoint_name()) return {Exception::kInvalidProtocolBuffer}; + if (frame.endpoint_id().empty()) return {Exception::kInvalidProtocolBuffer}; + if (frame.endpoint_name().empty()) return {Exception::kInvalidProtocolBuffer}; // For backwards compatibility reasons, no other fields should be // null-checked for this frame. Parameter checking (eg. must be within this @@ -90,18 +90,26 @@ Exception EnsureValidConnectionResponseFrame( Exception EnsureValidPayloadTransferDataFrame(const PayloadChunk& payload_chunk, std::int64_t totalSize) { - if (!payload_chunk.has_flags()) return {Exception::kInvalidProtocolBuffer}; + if (!payload_chunk.has_flags()) { + LOG(ERROR) << "Missing payload chunk flags"; + return {Exception::kInvalidProtocolBuffer}; + } // Special case. The body can be null iff the chunk is flagged as the last // chunk. bool is_last_chunk = (payload_chunk.flags() & PayloadTransferFrame::PayloadChunk::LAST_CHUNK) != 0; - if (!payload_chunk.has_body() && !is_last_chunk) + if (!payload_chunk.has_body() && !is_last_chunk) { + LOG(ERROR) << "Missing payload chunk body"; return {Exception::kInvalidProtocolBuffer}; - if (!payload_chunk.has_offset() || payload_chunk.offset() < 0) + } + if (!payload_chunk.has_offset() || payload_chunk.offset() < 0) { + LOG(ERROR) << "Invalid payload chunk offset"; return {Exception::kInvalidProtocolBuffer}; + } if (totalSize != InternalPayload::kIndeterminateSize && totalSize < payload_chunk.offset()) { + LOG(ERROR) << "Payload chunk offset > totalSize"; return {Exception::kInvalidProtocolBuffer}; } @@ -112,10 +120,13 @@ Exception EnsureValidPayloadTransferDataFrame(const PayloadChunk& payload_chunk, Exception EnsureValidPayloadTransferControlFrame( const ControlMessage& control_message, std::int64_t totalSize) { - if (!control_message.has_offset() || control_message.offset() < 0) + if (!control_message.has_offset() || control_message.offset() < 0) { + LOG(ERROR) << "Invalid control message offset"; return {Exception::kInvalidProtocolBuffer}; + } if (totalSize != InternalPayload::kIndeterminateSize && totalSize < control_message.offset()) { + LOG(ERROR) << "Control message offset > totalSize"; return {Exception::kInvalidProtocolBuffer}; } @@ -124,21 +135,83 @@ Exception EnsureValidPayloadTransferControlFrame( return {Exception::kSuccess}; } +bool CheckForIllegalCharacters(std::string toBeValidated, + const absl::string_view illegalPatterns[], + size_t illegalPatternsSize) { + if (toBeValidated.empty()) { + return false; + } + + CHECK_GT(illegalPatternsSize, 0); + + size_t found = 0; + for (int index = 0; index < illegalPatternsSize; index++) { + found = toBeValidated.find(std::string(illegalPatterns[index])); + + if (found != std::string::npos) { + // TODO(jfcarroll): Find a way to issue a log statement here. + // Currently, this breaks the fuzzer, as a logging dep is not + // included for it in the BUILD file. + // NEARBY_LOGS(ERROR) << "In path " << toBeValidated + // << " found illegal character/pattern " + // << illegalPatterns[index]; + return true; + } + } + return false; +} + Exception EnsureValidPayloadTransferFrame(const PayloadTransferFrame& frame) { - if (!frame.has_payload_header()) return {Exception::kInvalidProtocolBuffer}; + if (!frame.has_payload_header()) { + LOG(ERROR) << "Missing payload header"; + return {Exception::kInvalidProtocolBuffer}; + } + if (frame.packet_type() == PayloadTransferFrame::PAYLOAD_ACK) { + // Phone side code doesn't set "total_size" for "payload_header", so skip + // checking it. + return {Exception::kSuccess}; + } if (!frame.payload_header().has_total_size() || (frame.payload_header().total_size() < 0 && frame.payload_header().total_size() != - InternalPayload::kIndeterminateSize)) + InternalPayload::kIndeterminateSize)) { + LOG(ERROR) << "Invalid payload header size"; return {Exception::kInvalidProtocolBuffer}; - if (!frame.has_packet_type()) return {Exception::kInvalidProtocolBuffer}; - + } + if (frame.payload_header().has_type() && + frame.payload_header().type() == + location::nearby::connections::PayloadTransferFrame:: + PayloadHeader::FILE) { + if (frame.payload_header() + .has_file_name()) { + if (CheckForIllegalCharacters(frame.payload_header() + .file_name(), + kIllegalFileNamePatterns, + kIllegalFileNamePatternsSize)) { + return {Exception::kIllegalCharacters}; + } + } + if (frame.payload_header() + .has_parent_folder()) { + if (CheckForIllegalCharacters(frame.payload_header() + .parent_folder(), + kIllegalParentFolderPatterns, + kIllegalParentFolderPatternsSize)) { + return {Exception::kIllegalCharacters}; + } + } + } + if (!frame.has_packet_type()) { + LOG(ERROR) << "Missing packet type"; + return {Exception::kInvalidProtocolBuffer}; + } switch (frame.packet_type()) { case PayloadTransferFrame::DATA: if (frame.has_payload_chunk()) { return EnsureValidPayloadTransferDataFrame( frame.payload_chunk(), frame.payload_header().total_size()); } + LOG(ERROR) << "Missing payload chunk"; return {Exception::kInvalidProtocolBuffer}; case PayloadTransferFrame::CONTROL: @@ -146,6 +219,7 @@ Exception EnsureValidPayloadTransferFrame(const PayloadTransferFrame& frame) { return EnsureValidPayloadTransferControlFrame( frame.control_message(), frame.payload_header().total_size()); } + LOG(ERROR) << "Missing control message"; return {Exception::kInvalidProtocolBuffer}; default: @@ -341,32 +415,6 @@ Exception EnsureValidBandwidthUpgradeNegotiationFrame( return {Exception::kSuccess}; } -bool CheckForIllegalCharacters(std::string toBeValidated, - const absl::string_view illegalPatterns[], - size_t illegalPatternsSize) { - if (toBeValidated.empty()) { - return false; - } - - CHECK_GT(illegalPatternsSize, 0); - - size_t found = 0; - for (int index = 0; index < illegalPatternsSize; index++) { - found = toBeValidated.find(std::string(illegalPatterns[index])); - - if (found != std::string::npos) { - // TODO(jfcarroll): Find a way to issue a log statement here. - // Currently, this breaks the fuzzer, as a logging dep is not - // included for it in the BUILD file. - // NEARBY_LOGS(ERROR) << "In path " << toBeValidated - // << " found illegal character/pattern " - // << illegalPatterns[index]; - return true; - } - } - return false; -} - } // namespace Exception EnsureValidOfflineFrame( @@ -379,6 +427,7 @@ Exception EnsureValidOfflineFrame( return EnsureValidConnectionRequestFrame( offline_frame.v1().connection_request()); } + LOG(ERROR) << "Missing connection request"; return {Exception::kInvalidProtocolBuffer}; case V1Frame::CONNECTION_RESPONSE: @@ -387,46 +436,15 @@ Exception EnsureValidOfflineFrame( return EnsureValidConnectionResponseFrame( offline_frame.v1().connection_response()); } + LOG(ERROR) << "Missing connection response"; return {Exception::kInvalidProtocolBuffer}; case V1Frame::PAYLOAD_TRANSFER: - if (offline_frame.has_v1() && - (offline_frame.v1().payload_transfer().payload_header().has_type() && - offline_frame.v1().payload_transfer().payload_header().type() == - location::nearby::connections:: - PayloadTransferFrame_PayloadHeader_PayloadType:: - PayloadTransferFrame_PayloadHeader_PayloadType_FILE)) { - if (offline_frame.v1() - .payload_transfer() - .payload_header() - .has_file_name()) { - if (CheckForIllegalCharacters(offline_frame.v1() - .payload_transfer() - .payload_header() - .file_name(), - kIllegalFileNamePatterns, - kIllegalFileNamePatternsSize)) { - return {Exception::kIllegalCharacters}; - } - } - if (offline_frame.v1() - .payload_transfer() - .payload_header() - .has_parent_folder()) { - if (CheckForIllegalCharacters(offline_frame.v1() - .payload_transfer() - .payload_header() - .parent_folder(), - kIllegalParentFolderPatterns, - kIllegalParentFolderPatternsSize)) { - return {Exception::kIllegalCharacters}; - } - } - } if (offline_frame.has_v1() && offline_frame.v1().has_payload_transfer()) { return EnsureValidPayloadTransferFrame( offline_frame.v1().payload_transfer()); } + LOG(ERROR) << "Missing payload transfer"; return {Exception::kInvalidProtocolBuffer}; case V1Frame::BANDWIDTH_UPGRADE_NEGOTIATION: @@ -435,6 +453,7 @@ Exception EnsureValidOfflineFrame( return EnsureValidBandwidthUpgradeNegotiationFrame( offline_frame.v1().bandwidth_upgrade_negotiation()); } + LOG(ERROR) << "Missing bandwidth upgrade negotiation"; return {Exception::kInvalidProtocolBuffer}; case V1Frame::KEEP_ALIVE: diff --git a/connections/implementation/offline_frames_validator_test.cc b/connections/implementation/offline_frames_validator_test.cc index 27fd5036..c963cc28 100644 --- a/connections/implementation/offline_frames_validator_test.cc +++ b/connections/implementation/offline_frames_validator_test.cc @@ -48,6 +48,7 @@ constexpr absl::string_view kWifiDirectPassword = "WIFIDIRECT123456"; constexpr absl::string_view kGateway = "192.168.1.1"; constexpr int kWifiDirectFrequency = 2412; constexpr int kPort = 1000; +constexpr int kHotspotFrequency = 2412; constexpr bool kSupportsDisablingEncryption = true; constexpr std::array kMediums = { Medium::MDNS, Medium::BLUETOOTH, Medium::WIFI_HOTSPOT, @@ -109,7 +110,24 @@ TEST_F(OfflineFramesConnectionRequestTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); +} + +TEST_F(OfflineFramesConnectionRequestTest, + ValidatesAsFailWithEmptyEndpointIdInConnectionRequestFrame) { + connection_info_.local_endpoint_id = ""; + ByteArray bytes = ForConnectionRequestConnections({}, connection_info_); + location::nearby::connections::OfflineFrame frame; + frame.ParseFromString(bytes.AsStringView()); + frame.mutable_v1()->mutable_connection_request()->set_endpoint_id(""); + ASSERT_TRUE(frame.v1().connection_request().has_endpoint_id()); + + OfflineFrame offline_frame; + offline_frame.ParseFromString(frame.SerializeAsString()); + + auto ret_value = EnsureValidOfflineFrame(offline_frame); + + EXPECT_FALSE(ret_value.Ok()); } TEST_F(OfflineFramesConnectionRequestTest, @@ -156,7 +174,8 @@ TEST(OfflineFramesValidatorTest, OfflineFrame offline_frame; OsInfo os_info; - ByteArray bytes = ForConnectionResponse(kStatusAccepted, os_info); + ByteArray bytes = ForConnectionResponse(kStatusAccepted, os_info, + /*multiplex_socket_bitmask=*/0); offline_frame.ParseFromString(std::string(bytes)); auto ret_value = EnsureValidOfflineFrame(offline_frame); @@ -169,7 +188,8 @@ TEST(OfflineFramesValidatorTest, OfflineFrame offline_frame; OsInfo os_info; - ByteArray bytes = ForConnectionResponse(kStatusAccepted, os_info); + ByteArray bytes = ForConnectionResponse(kStatusAccepted, os_info, + /*multiplex_socket_bitmask=*/0); offline_frame.ParseFromString(std::string(bytes)); auto* v1_frame = offline_frame.mutable_v1(); @@ -185,7 +205,8 @@ TEST(OfflineFramesValidatorTest, OfflineFrame offline_frame; OsInfo os_info; - ByteArray bytes = ForConnectionResponse(-1, os_info); + ByteArray bytes = + ForConnectionResponse(-1, os_info, /*multiplex_socket_bitmask=*/0); offline_frame.ParseFromString(std::string(bytes)); auto ret_value = EnsureValidOfflineFrame(offline_frame); @@ -288,7 +309,7 @@ TEST(OfflineFramesValidatorTest, ValidatesAsFailedTypeFileWithIllegalFilePath) { auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_TRUE(ret_value.value == Exception::kIllegalCharacters); + EXPECT_EQ(ret_value.value, Exception::kIllegalCharacters); } TEST(OfflineFramesValidatorTest, ValidatesAsOkTypeFileWithLegalParentFolder) { @@ -313,7 +334,7 @@ TEST(OfflineFramesValidatorTest, ValidatesAsOkTypeFileWithLegalParentFolder) { auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_TRUE(ret_value.Ok()); + EXPECT_TRUE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -339,8 +360,9 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_TRUE(ret_value.value == Exception::kIllegalCharacters); + EXPECT_EQ(ret_value.value, Exception::kIllegalCharacters); } + TEST(OfflineFramesValidatorTest, ValidatesAsFailWithNullPayloadTransferFrame) { PayloadTransferFrame::PayloadHeader header; PayloadTransferFrame::PayloadChunk chunk; @@ -358,7 +380,7 @@ TEST(OfflineFramesValidatorTest, ValidatesAsFailWithNullPayloadTransferFrame) { auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -383,7 +405,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -404,7 +426,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -429,7 +451,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -450,7 +472,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -471,7 +493,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -497,7 +519,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -522,7 +544,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -542,7 +564,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -562,7 +584,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -570,13 +592,13 @@ TEST(OfflineFramesValidatorTest, OfflineFrame offline_frame; ByteArray bytes = ForBwuWifiHotspotPathAvailable( - std::string(kSsid), std::string(kPassword), kPort, + std::string(kSsid), std::string(kPassword), kPort, kHotspotFrequency, std::string(kWifiHotspotGateway), kSupportsDisablingEncryption); offline_frame.ParseFromString(std::string(bytes)); auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_TRUE(ret_value.Ok()); + EXPECT_TRUE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -584,7 +606,7 @@ TEST(OfflineFramesValidatorTest, OfflineFrame offline_frame; ByteArray bytes = ForBwuWifiHotspotPathAvailable( - std::string(kSsid), std::string(kPassword), kPort, + std::string(kSsid), std::string(kPassword), kPort, kHotspotFrequency, std::string(kWifiHotspotGateway), kSupportsDisablingEncryption); offline_frame.ParseFromString(std::string(bytes)); auto* v1_frame = offline_frame.mutable_v1(); @@ -593,7 +615,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, ValidatesAsOkBandwidthUpgradeWifiDirect) { @@ -607,7 +629,7 @@ TEST(OfflineFramesValidatorTest, ValidatesAsOkBandwidthUpgradeWifiDirect) { auto ret_value = EnsureValidOfflineFrame(offline_frame); - ASSERT_TRUE(ret_value.Ok()); + EXPECT_TRUE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -623,7 +645,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame_1); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); // But -1 itself is not invalid bytes = ForBwuWifiDirectPathAvailable( @@ -633,7 +655,7 @@ TEST(OfflineFramesValidatorTest, ret_value = EnsureValidOfflineFrame(offline_frame_2); - ASSERT_TRUE(ret_value.Ok()); + EXPECT_TRUE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -650,7 +672,7 @@ TEST(OfflineFramesValidatorTest, auto ret_value = EnsureValidOfflineFrame(offline_frame_1); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); std::string wifi_direct_ssid_wrong_length = std::string{kWifiDirectSsid} + "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"; @@ -662,7 +684,7 @@ TEST(OfflineFramesValidatorTest, ret_value = EnsureValidOfflineFrame(offline_frame_2); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } TEST(OfflineFramesValidatorTest, @@ -692,7 +714,7 @@ TEST(OfflineFramesValidatorTest, ret_value = EnsureValidOfflineFrame(offline_frame_2); - ASSERT_FALSE(ret_value.Ok()); + EXPECT_FALSE(ret_value.Ok()); } } // namespace diff --git a/connections/implementation/offline_service_controller.cc b/connections/implementation/offline_service_controller.cc index edd2cce5..13182f25 100644 --- a/connections/implementation/offline_service_controller.cc +++ b/connections/implementation/offline_service_controller.cc @@ -14,11 +14,26 @@ #include "connections/implementation/offline_service_controller.h" +#include #include #include #include #include "absl/strings/str_join.h" +#include "absl/strings/string_view.h" +#include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" +#include "connections/implementation/client_proxy.h" +#include "connections/listeners.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/params.h" +#include "connections/payload.h" +#include "connections/status.h" +#include "connections/v3/connection_listening_options.h" +#include "connections/v3/listeners.h" +#include "internal/interop/device.h" +#include "internal/platform/logging.h" namespace nearby { namespace connections { @@ -39,7 +54,8 @@ Status OfflineServiceController::StartAdvertising( const ConnectionRequestInfo& info) { if (stop_) return {Status::kOutOfOrderApiCall}; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested advertising to start."; + << " requested to start advertising for service_id " + << service_id; return pcp_manager_.StartAdvertising(client, service_id, advertising_options, info); } @@ -47,25 +63,27 @@ Status OfflineServiceController::StartAdvertising( void OfflineServiceController::StopAdvertising(ClientProxy* client) { if (stop_) return; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested advertising to stop."; + << " requested to stop advertising for service_id " + << client->GetAdvertisingServiceId(); pcp_manager_.StopAdvertising(client); } Status OfflineServiceController::StartDiscovery( ClientProxy* client, const std::string& service_id, - const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener) { + const DiscoveryOptions& discovery_options, DiscoveryListener listener) { if (stop_) return {Status::kOutOfOrderApiCall}; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested discovery to start."; + << " requested to start discovery for service_id " + << service_id; return pcp_manager_.StartDiscovery(client, service_id, discovery_options, - listener); + std::move(listener)); } void OfflineServiceController::StopDiscovery(ClientProxy* client) { if (stop_) return; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested discovery to stop."; + << " requested to stop discovery for service_id " + << client->GetDiscoveryServiceId(); pcp_manager_.StopDiscovery(client); } @@ -74,12 +92,18 @@ OfflineServiceController::StartListeningForIncomingConnections( ClientProxy* client, absl::string_view service_id, v3::ConnectionListener listener, const v3::ConnectionListeningOptions& options) { + NEARBY_LOGS(INFO) << "Client " << client->GetClientId() + << " requested to start listening for service_id " + << service_id; return pcp_manager_.StartListeningForIncomingConnections( client, service_id, std::move(listener), options); } void OfflineServiceController::StopListeningForIncomingConnections( ClientProxy* client) { + NEARBY_LOGS(INFO) << "Client " << client->GetClientId() + << " requested to stop listening for service_id " + << client->GetListeningForIncomingConnectionsServiceId(); pcp_manager_.StopListeningForIncomingConnections(client); } @@ -87,6 +111,13 @@ void OfflineServiceController::InjectEndpoint( ClientProxy* client, const std::string& service_id, const OutOfBandConnectionMetadata& metadata) { if (stop_) return; + NEARBY_LOGS(INFO) << "Client " << client->GetClientId() + << " requested to inject endpoint {endpoint_id:" + << metadata.endpoint_id << ", endpoint_info:" + << metadata.endpoint_info.AsStringView() + << ",remote_bluetooth_mac_address:" + << metadata.remote_bluetooth_mac_address.AsStringView() + << "} for service_id " << service_id; pcp_manager_.InjectEndpoint(client, service_id, metadata); } @@ -96,17 +127,29 @@ Status OfflineServiceController::RequestConnection( const ConnectionOptions& connection_options) { if (stop_) return {Status::kOutOfOrderApiCall}; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested a connection to endpoint_id=" << endpoint_id; + << " requested a connection to endpoint_id " << endpoint_id; return pcp_manager_.RequestConnection(client, endpoint_id, info, connection_options); } +Status OfflineServiceController::RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) { + if (stop_) return {Status::kOutOfOrderApiCall}; + NEARBY_LOGS(INFO) << "Client " << client->GetClientId() + << " requested a connection to endpoint_id " + << remote_device.GetEndpointId(); + return pcp_manager_.RequestConnectionV3(client, remote_device, info, + connection_options); +} + Status OfflineServiceController::AcceptConnection( ClientProxy* client, const std::string& endpoint_id, PayloadListener listener) { if (stop_) return {Status::kOutOfOrderApiCall}; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " accepted the connection with endpoint_id=" + << " accepted the connection from endpoint_id " << endpoint_id; return pcp_manager_.AcceptConnection(client, endpoint_id, std::move(listener)); @@ -116,7 +159,7 @@ Status OfflineServiceController::RejectConnection( ClientProxy* client, const std::string& endpoint_id) { if (stop_) return {Status::kOutOfOrderApiCall}; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " rejected the connection with endpoint_id=" + << " rejected the connection from endpoint_id " << endpoint_id; return pcp_manager_.RejectConnection(client, endpoint_id); } @@ -125,7 +168,7 @@ void OfflineServiceController::InitiateBandwidthUpgrade( ClientProxy* client, const std::string& endpoint_id) { if (stop_) return; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " initiated a manual bandwidth upgrade with endpoint_id=" + << " initiated a manual bandwidth upgrade with endpoint_id " << endpoint_id; bwu_manager_.InitiateBwuForEndpoint(client, endpoint_id); } @@ -135,8 +178,8 @@ void OfflineServiceController::SendPayload( Payload payload) { if (stop_) return; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " is sending payload_id=" << payload.GetId() - << " to endpoint_ids={" << absl::StrJoin(endpoint_ids, ",") + << " is sending payload " << payload.GetId() + << " to endpoint_ids {" << absl::StrJoin(endpoint_ids, ",") << "}"; payload_manager_.SendPayload(client, endpoint_ids, std::move(payload)); } @@ -145,7 +188,7 @@ Status OfflineServiceController::CancelPayload(ClientProxy* client, std::int64_t payload_id) { if (stop_) return {Status::kOutOfOrderApiCall}; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " cancelled payload_id=" << payload_id; + << " cancelled payload " << payload_id; return payload_manager_.CancelPayload(client, payload_id); } @@ -153,7 +196,7 @@ void OfflineServiceController::DisconnectFromEndpoint( ClientProxy* client, const std::string& endpoint_id) { if (stop_) return; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested a disconnection from endpoint_id=" + << " requested a disconnection from endpoint_id " << endpoint_id; endpoint_manager_.UnregisterEndpoint(client, endpoint_id); } @@ -162,6 +205,10 @@ Status OfflineServiceController::UpdateAdvertisingOptions( ClientProxy* client, absl::string_view service_id, const AdvertisingOptions& advertising_options) { if (stop_) return {Status::kOutOfOrderApiCall}; + NEARBY_LOGS(INFO) + << "Client " << client->GetClientId() + << " requested to update advertising options for service_id " + << service_id; return pcp_manager_.UpdateAdvertisingOptions(client, service_id, advertising_options); } @@ -170,6 +217,9 @@ Status OfflineServiceController::UpdateDiscoveryOptions( ClientProxy* client, absl::string_view service_id, const DiscoveryOptions& discovery_options) { if (stop_) return {Status::kOutOfOrderApiCall}; + NEARBY_LOGS(INFO) << "Client " << client->GetClientId() + << " requested to update discovery options for service_id " + << service_id; return pcp_manager_.UpdateDiscoveryOptions(client, service_id, discovery_options); } @@ -178,11 +228,12 @@ void OfflineServiceController::SetCustomSavePath(ClientProxy* client, const std::string& path) { if (stop_) return; NEARBY_LOGS(INFO) << "Client " << client->GetClientId() - << " requested to set custom save path: " << path; + << " requested to set custom save path to " << path; payload_manager_.SetCustomSavePath(client, path); } void OfflineServiceController::ShutdownBwuManagerExecutors() { + NEARBY_LOGS(INFO) << "Shutting down BwuManager executors."; bwu_manager_.ShutdownExecutors(); } diff --git a/connections/implementation/offline_service_controller.h b/connections/implementation/offline_service_controller.h index dd7e4ae7..9331aa35 100644 --- a/connections/implementation/offline_service_controller.h +++ b/connections/implementation/offline_service_controller.h @@ -49,7 +49,7 @@ class OfflineServiceController : public ServiceController { Status StartDiscovery(ClientProxy* client, const std::string& service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener) override; + DiscoveryListener listener) override; void StopDiscovery(ClientProxy* client) override; void InjectEndpoint(ClientProxy* client, const std::string& service_id, @@ -67,6 +67,11 @@ class OfflineServiceController : public ServiceController { ClientProxy* client, const std::string& endpoint_id, const ConnectionRequestInfo& info, const ConnectionOptions& connection_options) override; + + Status RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) override; Status AcceptConnection(ClientProxy* client, const std::string& endpoint_id, PayloadListener listener) override; Status RejectConnection(ClientProxy* client, diff --git a/connections/implementation/offline_service_controller_test.cc b/connections/implementation/offline_service_controller_test.cc index 5173dc1f..1da10e42 100644 --- a/connections/implementation/offline_service_controller_test.cc +++ b/connections/implementation/offline_service_controller_test.cc @@ -25,6 +25,7 @@ #include "connections/advertising_options.h" #include "connections/discovery_options.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/mock_device.h" #include "connections/implementation/offline_simulation_user.h" #include "connections/listeners.h" #include "connections/medium_selector.h" @@ -106,18 +107,18 @@ class OfflineServiceControllerTest EXPECT_EQ(user_b.GetDiscovered().service_id, kServiceId); EXPECT_EQ(user_b.GetDiscovered().endpoint_info, user_a.GetInfo()); EXPECT_FALSE(user_b.GetDiscovered().endpoint_id.empty()); - NEARBY_LOG(INFO, "EP-B: [discovered] %s", - user_b.GetDiscovered().endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "EP-B: [discovered] " + << user_b.GetDiscovered().endpoint_id; user_b.RequestConnection(&connect_latch_); EXPECT_TRUE(connect_latch_.Await(kLongTimeout)); EXPECT_FALSE(user_a.GetDiscovered().endpoint_id.empty()); - NEARBY_LOG(INFO, "EP-A: [discovered] %s", - user_a.GetDiscovered().endpoint_id.c_str()); - NEARBY_LOG(INFO, "Both users discovered their peers."); + NEARBY_LOGS(INFO) << "EP-A: [discovered] " + << user_a.GetDiscovered().endpoint_id; + NEARBY_LOGS(INFO) << "Both users discovered their peers."; user_a.AcceptConnection(&accept_latch_); user_b.AcceptConnection(&accept_latch_); EXPECT_TRUE(accept_latch_.Await(kLongTimeout)); - NEARBY_LOG(INFO, "Both users reached connected state."); + NEARBY_LOGS(INFO) << "Both users reached connected state."; return user_a.IsConnected() && user_b.IsConnected(); } @@ -249,6 +250,26 @@ TEST_P(OfflineServiceControllerTest, CanConnect) { env_.Stop(); } +TEST_P(OfflineServiceControllerTest, CanConnectV3) { + env_.Start(); + OfflineSimulationUser user_a(kDeviceA, GetParam()); + OfflineSimulationUser user_b(kDeviceB, GetParam()); + EXPECT_THAT(user_a.StartAdvertising(std::string(kServiceId), &connect_latch_), + Eq(Status{Status::kSuccess})); + EXPECT_THAT(user_b.StartDiscovery(std::string(kServiceId), &discover_latch_), + Eq(Status{Status::kSuccess})); + EXPECT_TRUE(discover_latch_.Await(kLongTimeout)); + auto remote_device = MockNearbyDevice(); + ON_CALL(remote_device, GetEndpointId) + .WillByDefault(testing::Return(user_b.GetDiscovered().endpoint_id)); + EXPECT_THAT(user_b.RequestConnectionV3(&connect_latch_, remote_device), + Eq(Status{Status::kSuccess})); + EXPECT_TRUE(connect_latch_.Await(kLongTimeout)); + user_a.Stop(); + user_b.Stop(); + env_.Stop(); +} + TEST_P(OfflineServiceControllerTest, CanAcceptConnection) { env_.Start(); OfflineSimulationUser user_a(kDeviceA, GetParam()); diff --git a/connections/implementation/offline_simulation_user.cc b/connections/implementation/offline_simulation_user.cc index ae31da9f..2e259cea 100644 --- a/connections/implementation/offline_simulation_user.cc +++ b/connections/implementation/offline_simulation_user.cc @@ -17,8 +17,10 @@ #include "absl/functional/any_invocable.h" #include "absl/functional/bind_front.h" #include "connections/listeners.h" +#include "internal/interop/device.h" #include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/logging.h" #include "internal/platform/system_clock.h" namespace nearby { @@ -28,9 +30,9 @@ void OfflineSimulationUser::OnConnectionInitiated( const std::string& endpoint_id, const ConnectionResponseInfo& info, bool is_outgoing) { if (is_outgoing) { - NEARBY_LOG(INFO, "RequestConnection: initiated_cb called"); + NEARBY_LOGS(INFO) << "RequestConnection: initiated_cb called"; } else { - NEARBY_LOG(INFO, "StartAdvertising: initiated_cb called"); + NEARBY_LOGS(INFO) << "StartAdvertising: initiated_cb called"; discovered_ = DiscoveredInfo{ .endpoint_id = endpoint_id, .endpoint_info = GetInfo(), @@ -60,7 +62,7 @@ void OfflineSimulationUser::OnEndpointDisconnect( void OfflineSimulationUser::OnEndpointFound(const std::string& endpoint_id, const ByteArray& endpoint_info, const std::string& service_id) { - NEARBY_LOG(INFO, "Device discovered: id=%s", endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Device discovered: id=" << endpoint_id; discovered_ = DiscoveredInfo{ .endpoint_id = endpoint_id, .endpoint_info = endpoint_info, @@ -186,6 +188,30 @@ Status OfflineSimulationUser::RequestConnection(CountDownLatch* latch) { connection_options_); } +Status OfflineSimulationUser::RequestConnectionV3( + CountDownLatch* latch, const NearbyDevice& remote_device) { + initiated_latch_ = latch; + ConnectionListener listener = { + .initiated_cb = + std::bind(&OfflineSimulationUser::OnConnectionInitiated, this, + std::placeholders::_1, std::placeholders::_2, true), + .accepted_cb = + absl::bind_front(&OfflineSimulationUser::OnConnectionAccepted, this), + .rejected_cb = + absl::bind_front(&OfflineSimulationUser::OnConnectionRejected, this), + .disconnected_cb = + absl::bind_front(&OfflineSimulationUser::OnEndpointDisconnect, this), + }; + client_.AddCancellationFlag(remote_device.GetEndpointId()); + return ctrl_.RequestConnectionV3( + &client_, remote_device, + { + .endpoint_info = discovered_.endpoint_info, + .listener = std::move(listener), + }, + connection_options_); +} + Status OfflineSimulationUser::AcceptConnection(CountDownLatch* latch) { accept_latch_ = latch; PayloadListener listener = { diff --git a/connections/implementation/offline_simulation_user.h b/connections/implementation/offline_simulation_user.h index 12e46d60..e5ba3673 100644 --- a/connections/implementation/offline_simulation_user.h +++ b/connections/implementation/offline_simulation_user.h @@ -22,6 +22,7 @@ #include "absl/strings/string_view.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/offline_service_controller.h" +#include "internal/interop/device.h" #include "internal/platform/atomic_boolean.h" #include "internal/platform/condition_variable.h" #include "internal/platform/count_down_latch.h" @@ -108,6 +109,12 @@ class OfflineSimulationUser { // callback. Status RequestConnection(CountDownLatch* latch); + // Calls PcpManager::RequestConnectionV3. + // If latch is provided, latch->CountDown() will be called in the initiated_cb + // callback. + Status RequestConnectionV3(CountDownLatch* latch, + const NearbyDevice& remote_device); + // Calls PcpManager::AcceptConnection. // If latch is provided, latch->CountDown() will be called in the accepted_cb // callback. diff --git a/connections/implementation/p2p_cluster_pcp_handler.cc b/connections/implementation/p2p_cluster_pcp_handler.cc index da91affa..06714df8 100644 --- a/connections/implementation/p2p_cluster_pcp_handler.cc +++ b/connections/implementation/p2p_cluster_pcp_handler.cc @@ -15,6 +15,7 @@ #include "connections/implementation/p2p_cluster_pcp_handler.h" #include +#include #include #include #include @@ -22,23 +23,47 @@ #include "absl/functional/bind_front.h" #include "absl/strings/escaping.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "connections/advertising_options.h" +#include "connections/discovery_options.h" #include "connections/implementation/base_pcp_handler.h" #include "connections/implementation/ble_advertisement.h" #include "connections/implementation/ble_endpoint_channel.h" #include "connections/implementation/ble_v2_endpoint_channel.h" +#include "connections/implementation/bluetooth_device_name.h" #include "connections/implementation/bluetooth_endpoint_channel.h" #include "connections/implementation/bwu_manager.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_manager.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/injected_bluetooth_device_store.h" +#include "connections/implementation/mediums/bluetooth_classic.h" +#include "connections/implementation/mediums/mediums.h" #include "connections/implementation/mediums/utils.h" +#include "connections/implementation/pcp.h" +#include "connections/implementation/pcp_handler.h" #include "connections/implementation/wifi_lan_endpoint_channel.h" +#include "connections/implementation/wifi_lan_service_info.h" #include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" #include "connections/power_level.h" #include "connections/status.h" +#include "connections/v3/connection_listening_options.h" #include "internal/flags/nearby_flags.h" #include "internal/interop/device.h" +#include "internal/platform/ble.h" +#include "internal/platform/ble_v2.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/bluetooth_classic.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/implementation/platform.h" #include "internal/platform/logging.h" #include "internal/platform/nsd_service_info.h" +#include "internal/platform/os_name.h" #include "internal/platform/types.h" +#include "internal/platform/wifi_lan.h" #include "proto/connections_enums.pb.h" namespace nearby { @@ -76,7 +101,7 @@ P2pClusterPcpHandler::P2pClusterPcpHandler( injected_bluetooth_device_store_(injected_bluetooth_device_store) {} P2pClusterPcpHandler::~P2pClusterPcpHandler() { - NEARBY_LOGS(VERBOSE) << __func__; + NEARBY_VLOG(1) << __func__; Shutdown(); } @@ -140,9 +165,58 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( local_endpoint_info, web_rtc_state); if (bluetooth_medium != location::nearby::proto::connections::UNKNOWN_MEDIUM) { - NEARBY_LOG(INFO, "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"); - mediums_started_successfully.push_back(bluetooth_medium); - bluetooth_classic_advertiser_client_id_ = client->GetClientId(); + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::StartAdvertisingImpl: BT started"; + + // TODO(hais): update this after ble_v2 refactor. + if (api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kChromeOS && + !NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableBleV2)) { + if (ble_medium_.StartLegacyAdvertising( + service_id, local_endpoint_id, + advertising_options.fast_advertisement_service_uuid)) { + NEARBY_LOGS(INFO) << "P2pClusterPcpHandler::StartAdvertisingImpl: " + "Ble legacy started advertising"; + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"; + mediums_started_successfully.push_back(bluetooth_medium); + bluetooth_classic_advertiser_client_id_ = client->GetClientId(); + } else { + // TODO(hais): update this after ble_v2 refactor. + NEARBY_LOGS(WARNING) << "P2pClusterPcpHandler::StartAdvertisingImpl: " + "BLE legacy failed, revert BTC"; + bluetooth_medium_.TurnOffDiscoverability(); + bluetooth_medium_.StopAcceptingConnections(service_id); + } + } else if ((api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kChromeOS || + api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kLinux) && + NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableBleV2)) { + if (ble_v2_medium_.StartLegacyAdvertising( + service_id, local_endpoint_id, + advertising_options.fast_advertisement_service_uuid)) { + NEARBY_LOGS(INFO) + << __func__ << "Ble v2 started advertising for legacy device."; + mediums_started_successfully.push_back(bluetooth_medium); + NEARBY_LOGS(INFO) << __func__ << "After Ble v2, BT added"; + bluetooth_classic_advertiser_client_id_ = client->GetClientId(); + } else { + NEARBY_LOGS(WARNING) << "P2pClusterPcpHandler::StartAdvertisingImpl: " + "BLE legacy failed, revert BTC"; + bluetooth_medium_.TurnOffDiscoverability(); + bluetooth_medium_.StopAcceptingConnections(service_id); + } + } else { + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::StartAdvertisingImpl: BT added"; + mediums_started_successfully.push_back(bluetooth_medium); + bluetooth_classic_advertiser_client_id_ = client->GetClientId(); + } } } @@ -192,6 +266,20 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartAdvertisingImpl( Status P2pClusterPcpHandler::StopAdvertisingImpl(ClientProxy* client) { if (client->GetClientId() == bluetooth_classic_advertiser_client_id_) { bluetooth_medium_.TurnOffDiscoverability(); + // TODO(hais): update this after ble_v2 refactor. + if (api::ImplementationPlatform::GetCurrentOS() == api::OSName::kChromeOS && + !NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)) { + ble_medium_.StopLegacyAdvertising(client->GetAdvertisingServiceId()); + } else if ((api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kChromeOS || + api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kLinux) && + NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableBleV2)) { + ble_v2_medium_.StopLegacyAdvertising(client->GetAdvertisingServiceId()); + } bluetooth_classic_advertiser_client_id_ = 0; } else { NEARBY_LOGS(INFO) << "Skipped BT TurnOffDiscoverability for client=" @@ -409,20 +497,6 @@ void P2pClusterPcpHandler::BluetoothDeviceLostHandler( bool P2pClusterPcpHandler::IsRecognizedBleEndpoint( const std::string& service_id, const BleAdvertisement& advertisement) const { - if (!advertisement.IsValid()) { - NEARBY_LOGS(INFO) - << "BleAdvertisement doesn't conform to the format, discarding."; - return false; - } - - if (advertisement.GetVersion() != kBleAdvertisementVersion) { - NEARBY_LOGS(INFO) << "BleAdvertisement has an unknown version; expected " - << static_cast(kBleAdvertisementVersion) - << ", found " - << static_cast(advertisement.GetVersion()); - return false; - } - if (advertisement.GetPcp() != GetPcp()) { NEARBY_LOGS(INFO) << "BleAdvertisement doesn't match on Pcp; expected " << PcpToStrategy(GetPcp()).GetName() << ", found " @@ -467,8 +541,13 @@ void P2pClusterPcpHandler::BlePeripheralDiscoveredHandler( return; } - // Parse the BLE advertisement bytes. - BleAdvertisement advertisement(fast_advertisement, advertisement_bytes); + auto ble_status_or = BleAdvertisement::CreateBleAdvertisement( + fast_advertisement, advertisement_bytes); + if (!ble_status_or.ok()) { + NEARBY_LOGS(ERROR) << ble_status_or.status().ToString(); + return; + } + const auto& advertisement = ble_status_or.value(); // Make sure the BLE advertisement points to a valid // endpoint we're discovering. @@ -541,8 +620,7 @@ void P2pClusterPcpHandler::BlePeripheralLostHandler( ClientProxy* client, BlePeripheral& peripheral, const std::string& service_id) { std::string peripheral_name = peripheral.GetName(); - NEARBY_LOG(INFO, "Ble: [LOST, SCHED] peripheral_name=%s", - peripheral_name.c_str()); + NEARBY_LOGS(INFO) << "Ble: [LOST, SCHED] peripheral_name=" << peripheral_name; RunOnPcpHandlerThread( "p2p-ble-device-lost", [this, client, service_id, &peripheral]() RUN_ON_PCP_HANDLER_THREAD() { @@ -639,16 +717,27 @@ void P2pClusterPcpHandler::BleV2PeripheralDiscoveredHandler( return; } - // Parse the BLE advertisement bytes. - BleAdvertisement advertisement(fast_advertisement, advertisement_bytes); + if (client->GetDiscoveryOptions() + .fast_advertisement_service_uuid.empty() && + fast_advertisement) { + NEARBY_LOGS(INFO) << "Ignore the fast advertisement due to cient " + "doesn't receive it."; + return; + } + + auto ble_status_or = BleAdvertisement::CreateBleAdvertisement( + fast_advertisement, advertisement_bytes); + if (!ble_status_or.ok()) { + NEARBY_LOGS(ERROR) << ble_status_or.status(); + return; + } + const auto& advertisement = ble_status_or.value(); // Make sure the BLE advertisement points to a valid // endpoint we're discovering. if (!IsRecognizedBleV2Endpoint(service_id, advertisement)) return; // Report the discovered endpoint to the client. - // BleV2EndpointState ble_endpoint_state(/*ble=*/true, /*l2cap=*/false, - // /*bt=alse*/false); BleV2EndpointState ble_endpoint_state; ByteArray peripheral_id = peripheral.GetId(); found_endpoints_in_ble_discover_cb_.insert( @@ -697,6 +786,7 @@ void P2pClusterPcpHandler::BleV2PeripheralDiscoveredHandler( found_endpoints_in_ble_discover_cb_[peripheral_id] = ble_endpoint_state; StopEndpointLostByMediumAlarm(advertisement.GetEndpointId(), Medium::BLUETOOTH); + OnEndpointFound(client, std::make_shared(BluetoothEndpoint{ { @@ -729,8 +819,13 @@ void P2pClusterPcpHandler::BleV2PeripheralLostHandler( return; } - // Parse the BLE advertisement bytes. - BleAdvertisement advertisement(fast_advertisement, advertisement_bytes); + auto ble_status_or = BleAdvertisement::CreateBleAdvertisement( + fast_advertisement, advertisement_bytes); + if (!ble_status_or.ok()) { + NEARBY_LOGS(ERROR) << ble_status_or.status(); + return; + } + const auto& advertisement = ble_status_or.value(); // Make sure the BLE advertisement points to a valid // endpoint we're discovering. @@ -783,6 +878,92 @@ void P2pClusterPcpHandler::BleV2PeripheralLostHandler( }); } +void P2pClusterPcpHandler::BleV2InstantLostHandler( + ClientProxy* client, BleV2Peripheral peripheral, + const std::string& service_id, const ByteArray& advertisement_bytes, + bool fast_advertisement) { + RunOnPcpHandlerThread( + "p2p-ble-peripheral-instant-lost", + [this, client, service_id, peripheral = std::move(peripheral), + advertisement_bytes, fast_advertisement]() RUN_ON_PCP_HANDLER_THREAD() { + std::string service_id = client->GetDiscoveryServiceId(); + + if (!client->IsDiscovering() || stop_.Get()) { + NEARBY_LOGS(WARNING) + << "Ignoring instant lost BlePeripheral " + << absl::BytesToHexString(peripheral.GetId().data()) + << " because we are no longer discovering."; + return; + } + + NEARBY_LOGS(INFO) << "Processing instant lost on BlePeripheral " + << absl::BytesToHexString(peripheral.GetId().data()); + auto ble_status_or = BleAdvertisement::CreateBleAdvertisement( + fast_advertisement, advertisement_bytes); + if (!ble_status_or.ok()) { + NEARBY_LOGS(ERROR) << ble_status_or.status(); + return; + } + const auto& advertisement = ble_status_or.value(); + + // Make sure the BLE advertisement points to a valid + // endpoint we're discovering. + if (!IsRecognizedBleV2Endpoint(service_id, advertisement)) return; + + // Remove this BlePeripheral from found_ble_endpoints_, and + // report the endpoint as lost to the client. + auto const item = + found_endpoints_in_ble_discover_cb_.find(peripheral.GetId()); + if (item == found_endpoints_in_ble_discover_cb_.end()) { + return; + } + + found_endpoints_in_ble_discover_cb_.erase(item); + + // Report the instant lost endpoint. + OnInstantLost(client, advertisement.GetEndpointId(), + advertisement.GetEndpointInfo()); + }); +} + +void P2pClusterPcpHandler::BleV2LegacyDeviceDiscoveredHandler() { + if (!NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning)) { + return; + } + + RunOnPcpHandlerThread( + "p2p-ble-legacy-peripheral-discovered", + [this]() RUN_ON_PCP_HANDLER_THREAD() { + if (paused_bluetooth_clients_discoveries_.empty()) { + return; + } + + NEARBY_LOGS(INFO) << "Found nearby legacy BLE device, pending " + "bluetooth discovery size :" + << paused_bluetooth_clients_discoveries_.size(); + + for (auto& paused_bluetooth_client : + paused_bluetooth_clients_discoveries_) { + if (!paused_bluetooth_client.second->IsDiscoveringServiceId( + paused_bluetooth_client.first)) { + NEARBY_LOGS(INFO) << "Do not start bluetooth scanning since client " + "is no longer discovering for service id: " + << paused_bluetooth_client.first; + continue; + } + + // Start the paused bluetooth discovery. + StartBluetoothDiscovery(paused_bluetooth_client.second, + paused_bluetooth_client.first); + } + + // Remove all pending bluetooth clients. + paused_bluetooth_clients_discoveries_.clear(); + }); +} + bool P2pClusterPcpHandler::IsRecognizedWifiLanEndpoint( const std::string& service_id, const WifiLanServiceInfo& wifi_lan_service_info) const { @@ -929,16 +1110,6 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartDiscoveryImpl( } } - if (discovery_options.allowed.bluetooth) { - Medium bluetooth_medium = StartBluetoothDiscovery(client, service_id); - if (bluetooth_medium != - location::nearby::proto::connections::UNKNOWN_MEDIUM) { - NEARBY_LOG(INFO, "P2pClusterPcpHandler::StartDiscoveryImpl: BT added"); - mediums_started_successfully.push_back(bluetooth_medium); - bluetooth_classic_discoverer_client_id_ = client->GetClientId(); - } - } - if (discovery_options.allowed.ble) { if (NearbyFlags::GetInstance().GetBoolFlag( config_package_nearby::nearby_connections_feature::kEnableBleV2)) { @@ -947,7 +1118,7 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartDiscoveryImpl( if (ble_v2_medium != location::nearby::proto::connections::UNKNOWN_MEDIUM) { NEARBY_LOGS(INFO) - << "P2pClusterPcpHandler::StartDiscoveryImpl: Ble added."; + << "P2pClusterPcpHandler::StartDiscoveryImpl: Ble v2 added."; mediums_started_successfully.push_back(ble_v2_medium); } } else { @@ -962,6 +1133,25 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartDiscoveryImpl( } } + if (discovery_options.allowed.bluetooth) { + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning)) { + StartBluetoothDiscoveryWithPause(client, service_id, discovery_options, + mediums_started_successfully); + } else { + Medium bluetooth_medium = StartBluetoothDiscovery(client, service_id); + if (bluetooth_medium != + location::nearby::proto::connections::UNKNOWN_MEDIUM) { + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::StartDiscoveryImpl: BT added"; + mediums_started_successfully.push_back(bluetooth_medium); + bluetooth_classic_client_id_to_service_id_map_.insert( + {client->GetClientId(), service_id}); + } + } + } + if (mediums_started_successfully.empty()) { NEARBY_LOGS(ERROR) << "Failed StartDiscovery() for client=" << client->GetClientId() @@ -981,14 +1171,16 @@ BasePcpHandler::StartOperationResult P2pClusterPcpHandler::StartDiscoveryImpl( Status P2pClusterPcpHandler::StopDiscoveryImpl(ClientProxy* client) { wifi_lan_medium_.StopDiscovery(client->GetDiscoveryServiceId()); - if (client->GetClientId() == bluetooth_classic_discoverer_client_id_) { - bluetooth_medium_.StopDiscovery(); - bluetooth_classic_discoverer_client_id_ = 0; + if (bluetooth_classic_client_id_to_service_id_map_.contains( + client->GetClientId())) { + bluetooth_medium_.StopDiscovery( + bluetooth_classic_client_id_to_service_id_map_.at( + client->GetClientId())); + bluetooth_classic_client_id_to_service_id_map_.erase(client->GetClientId()); } else { NEARBY_LOGS(INFO) << "Skipped BT StopDiscovery for client=" << client->GetClientId() - << ", client that started discovery is " - << bluetooth_classic_discoverer_client_id_; + << " because it is not in discovery."; } if (NearbyFlags::GetInstance().GetBoolFlag( @@ -997,6 +1189,14 @@ Status P2pClusterPcpHandler::StopDiscoveryImpl(ClientProxy* client) { } else { ble_medium_.StopScanning(client->GetDiscoveryServiceId()); } + + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning)) { + paused_bluetooth_clients_discoveries_.erase( + client->GetDiscoveryServiceId()); + } + return {Status::kSuccess}; } @@ -1018,7 +1218,7 @@ Status P2pClusterPcpHandler::InjectEndpointImpl( GetPcp()); if (!remote_bluetooth_device.IsValid()) { - NEARBY_LOG(WARNING, "InjectEndpointImpl: Invalid parameters."); + NEARBY_LOGS(WARNING) << "InjectEndpointImpl: Invalid parameters."; return {Status::kError}; } @@ -1235,6 +1435,19 @@ P2pClusterPcpHandler::UpdateAdvertisingOptionsImpl( mediums_->GetBluetoothClassic().TurnOffDiscoverability(); mediums_->GetBluetoothClassic().StopAcceptingConnections( std::string(service_id)); + // TODO(hais): update this after ble_v2 refactor. + if (api::ImplementationPlatform::GetCurrentOS() == api::OSName::kChromeOS) { + mediums_->GetBle().StopLegacyAdvertising(std::string(service_id)); + } else if ((api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kChromeOS || + api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kLinux) && + NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableBleV2)) { + mediums_->GetBleV2().StopLegacyAdvertising( + client->GetAdvertisingServiceId()); + } } // restart @@ -1300,7 +1513,55 @@ P2pClusterPcpHandler::UpdateAdvertisingOptionsImpl( std::string(local_endpoint_id), ByteArray(std::string(local_endpoint_info)), web_rtc_state) != Medium::UNKNOWN_MEDIUM) { - restarted_mediums.push_back(Medium::BLUETOOTH); + // TODO(hais): update this after ble_v2 refactor. + if (api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kChromeOS && + !NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableBleV2)) { + if (ble_medium_.StartLegacyAdvertising( + std::string(service_id), std::string(local_endpoint_id), + advertising_options.fast_advertisement_service_uuid)) { + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::UpdateAdvertisingOptionsImpl: " + "Ble legacy started advertising"; + NEARBY_LOGS(INFO) << "P2pClusterPcpHandler::" + "UpdateAdvertisingOptionsImpl: BT added"; + restarted_mediums.push_back(Medium::BLUETOOTH); + } else { + NEARBY_LOGS(WARNING) + << "P2pClusterPcpHandler::UpdateAdvertisingOptionsImpl: BLE " + "legacy failed, revert BTC"; + bluetooth_medium_.TurnOffDiscoverability(); + bluetooth_medium_.StopAcceptingConnections(std::string(service_id)); + } + } else if ((api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kChromeOS || + api::ImplementationPlatform::GetCurrentOS() == + api::OSName::kLinux) && + NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kEnableBleV2)) { + if (ble_v2_medium_.StartLegacyAdvertising( + std::string(service_id), std::string(local_endpoint_id), + advertising_options.fast_advertisement_service_uuid)) { + NEARBY_LOGS(INFO) + << __func__ << "Ble v2 started advertising for legacy device."; + restarted_mediums.push_back(Medium::BLUETOOTH); + NEARBY_LOGS(INFO) << __func__ + << "After Ble v2 started advertising, for " + "legacy, BT added to restarted mediums"; + } else { + NEARBY_LOGS(WARNING) + << __func__ + << "BLE v2 failed advertising for legacy device, revert BTC"; + bluetooth_medium_.TurnOffDiscoverability(); + bluetooth_medium_.StopAcceptingConnections(std::string(service_id)); + } + + } else { + restarted_mediums.push_back(Medium::BLUETOOTH); + } } else { return StartOperationResult{.status = {Status::kBluetoothError}, .mediums = restarted_mediums}; @@ -1335,7 +1596,7 @@ P2pClusterPcpHandler::UpdateDiscoveryOptionsImpl( if (NeedsToTurnOffDiscoveryMedium(Medium::BLUETOOTH, old_options, discovery_options) || needs_restart) { - bluetooth_medium_.StopDiscovery(); + bluetooth_medium_.StopDiscovery(std::string(service_id)); StartEndpointLostByMediumAlarms(client, Medium::BLUETOOTH); } // wifi lan @@ -1350,21 +1611,6 @@ P2pClusterPcpHandler::UpdateDiscoveryOptionsImpl( bool should_start_discovery = false; auto new_mediums = discovery_options.allowed; auto old_mediums = old_options.allowed; - // bt classic - if (new_mediums.bluetooth && !discovery_options.low_power) { - should_start_discovery = true; - if (!needs_restart && old_mediums.bluetooth) { - restarted_mediums.push_back(Medium::BLUETOOTH); - } else { - if (StartBluetoothDiscovery(client, std::string(service_id)) != - location::nearby::proto::connections::UNKNOWN_MEDIUM) { - restarted_mediums.push_back(Medium::BLUETOOTH); - } else { - NEARBY_LOGS(WARNING) - << "UpdateDiscoveryOptionsImpl: unable to restart bt scanning"; - } - } - } // ble if (new_mediums.ble) { should_start_discovery = true; @@ -1379,8 +1625,8 @@ P2pClusterPcpHandler::UpdateDiscoveryOptionsImpl( location::nearby::proto::connections::UNKNOWN_MEDIUM) { restarted_mediums.push_back(Medium::BLE); } else { - NEARBY_LOGS(WARNING) - << "UpdateDiscoveryOptionsImpl: unable to restart blev2 scanning"; + NEARBY_LOGS(WARNING) << "UpdateDiscoveryOptionsImpl: unable to " + "restart blev2 scanning"; } } else { if (StartBleScanning( @@ -1395,6 +1641,28 @@ P2pClusterPcpHandler::UpdateDiscoveryOptionsImpl( } } } + // bt classic + if (new_mediums.bluetooth && !discovery_options.low_power) { + should_start_discovery = true; + if (!needs_restart && old_mediums.bluetooth) { + restarted_mediums.push_back(Medium::BLUETOOTH); + } else { + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning)) { + StartBluetoothDiscoveryWithPause(client, std::string(service_id), + discovery_options, restarted_mediums); + } else { + if (StartBluetoothDiscovery(client, std::string(service_id)) != + location::nearby::proto::connections::UNKNOWN_MEDIUM) { + restarted_mediums.push_back(Medium::BLUETOOTH); + } else { + NEARBY_LOGS(WARNING) + << "UpdateDiscoveryOptionsImpl: unable to restart bt scanning"; + } + } + } + } // wifi lan if (new_mediums.wifi_lan && !discovery_options.low_power) { should_start_discovery = true; @@ -1450,10 +1718,9 @@ Medium P2pClusterPcpHandler::StartBluetoothAdvertising( const ByteArray& local_endpoint_info, WebRtcState web_rtc_state) { // Start listening for connections before advertising in case a connection // request comes in very quickly. - NEARBY_LOG( - INFO, - "P2pClusterPcpHandler::StartBluetoothAdvertising: service=%s: start", - service_id.c_str()); + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::StartBluetoothAdvertising: service=" + << service_id << ": start"; if (!bluetooth_medium_.IsAcceptingConnections(service_id)) { if (!bluetooth_radio_.Enable() || !bluetooth_medium_.StartAcceptingConnections( @@ -1531,17 +1798,19 @@ Medium P2pClusterPcpHandler::StartBluetoothAdvertising( Medium P2pClusterPcpHandler::StartBluetoothDiscovery( ClientProxy* client, const std::string& service_id) { if (bluetooth_radio_.Enable() && - bluetooth_medium_.StartDiscovery({ - .device_discovered_cb = absl::bind_front( - &P2pClusterPcpHandler::BluetoothDeviceDiscoveredHandler, this, - client, service_id), - .device_name_changed_cb = absl::bind_front( - &P2pClusterPcpHandler::BluetoothNameChangedHandler, this, client, - service_id), - .device_lost_cb = absl::bind_front( - &P2pClusterPcpHandler::BluetoothDeviceLostHandler, this, client, - service_id), - })) { + bluetooth_medium_.StartDiscovery( + service_id, + { + .device_discovered_cb = absl::bind_front( + &P2pClusterPcpHandler::BluetoothDeviceDiscoveredHandler, this, + client, service_id), + .device_name_changed_cb = absl::bind_front( + &P2pClusterPcpHandler::BluetoothNameChangedHandler, this, + client, service_id), + .device_lost_cb = absl::bind_front( + &P2pClusterPcpHandler::BluetoothDeviceLostHandler, this, + client, service_id), + })) { NEARBY_LOGS(INFO) << "In StartBluetoothDiscovery(), client=" << client->GetClientId() << " started scanning for Bluetooth for service_id=" @@ -1556,11 +1825,57 @@ Medium P2pClusterPcpHandler::StartBluetoothDiscovery( } } +void P2pClusterPcpHandler::StartBluetoothDiscoveryWithPause( + ClientProxy* client, const std::string& service_id, + const DiscoveryOptions& discovery_options, + std::vector& mediums_started_successfully) { + if (bluetooth_radio_.IsEnabled()) { + if (ble_v2_medium_.IsExtendedAdvertisementsAvailable() && + std::find(mediums_started_successfully.begin(), + mediums_started_successfully.end(), + location::nearby::proto::connections::BLE) != + mediums_started_successfully.end()) { + if (bluetooth_medium_.IsDiscovering(service_id)) { + // If we are already discovering, we don't need to start again. + Medium bluetooth_medium = StartBluetoothDiscovery(client, service_id); + if (bluetooth_medium != + location::nearby::proto::connections::UNKNOWN_MEDIUM) { + NEARBY_LOGS(INFO) << "P2pClusterPcpHandler::" + "StartBluetoothDiscoveryWithPause: BT added"; + mediums_started_successfully.push_back(bluetooth_medium); + bluetooth_classic_client_id_to_service_id_map_.insert( + {client->GetClientId(), service_id}); + } + } else { + NEARBY_LOGS(INFO) << "Pause bluetooth discovery for service id : " + << service_id; + paused_bluetooth_clients_discoveries_.insert({service_id, client}); + } + } else { + // Always start bluetooth discovery if BLE doesn't support extended + // advertisements. + Medium bluetooth_medium = StartBluetoothDiscovery(client, service_id); + if (bluetooth_medium != + location::nearby::proto::connections::UNKNOWN_MEDIUM) { + NEARBY_LOGS(INFO) << "P2pClusterPcpHandler::" + "StartBluetoothDiscoveryWithPause: BT added"; + mediums_started_successfully.push_back(bluetooth_medium); + bluetooth_classic_client_id_to_service_id_map_.insert( + {client->GetClientId(), service_id}); + } + } + } else { + NEARBY_LOGS(WARNING) << "Ignore to discover on bluetooth for service id: " + << service_id + << " because bluetooth is disabled or low power mode."; + } +} + BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::BluetoothConnectImpl( ClientProxy* client, BluetoothEndpoint* endpoint) { - NEARBY_LOGS(VERBOSE) << "Client " << client->GetClientId() - << " is attempting to connect to endpoint(id=" - << endpoint->endpoint_id << ") over Bluetooth Classic."; + NEARBY_VLOG(1) << "Client " << client->GetClientId() + << " is attempting to connect to endpoint(id=" + << endpoint->endpoint_id << ") over Bluetooth Classic."; BluetoothDevice& device = endpoint->bluetooth_device; BluetoothSocket bluetooth_socket = bluetooth_medium_.Connect( @@ -1579,9 +1894,10 @@ BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::BluetoothConnectImpl( auto channel = std::make_unique( endpoint->service_id, /*channel_name=*/endpoint->endpoint_id, bluetooth_socket); - NEARBY_LOGS(VERBOSE) << "Client" << client->GetClientId() - << " created Bluetooth endpoint channel to endpoint(id=" - << endpoint->endpoint_id << ")."; + NEARBY_VLOG(1) << "Client" << client->GetClientId() + << " created Bluetooth endpoint channel to endpoint(id=" + << endpoint->endpoint_id << ")."; + client->SetBluetoothMacAddress(endpoint->endpoint_id, device.GetMacAddress()); return BasePcpHandler::ConnectImplResult{ .medium = Medium::BLUETOOTH, .status = {Status::kSuccess}, @@ -1726,7 +2042,8 @@ Medium P2pClusterPcpHandler::StartBleAdvertising( << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " generated BleAdvertisement with service_id=" - << service_id; + << service_id << ", bytes: " + << absl::BytesToHexString(advertisement_bytes.data()); if (!ble_medium_.StartAdvertising( service_id, advertisement_bytes, @@ -1742,6 +2059,7 @@ Medium P2pClusterPcpHandler::StartBleAdvertising( } NEARBY_LOGS(INFO) << "In startBleAdvertising(" << absl::BytesToHexString(local_endpoint_info.data()) + << ", fast_advertisement: " << fast_advertisement << "), client=" << client->GetClientId() << " started BLE Advertising with BleAdvertisement " << absl::BytesToHexString(advertisement_bytes.data()); @@ -1778,9 +2096,9 @@ Medium P2pClusterPcpHandler::StartBleScanning( BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::BleConnectImpl( ClientProxy* client, BleEndpoint* endpoint) { - NEARBY_LOGS(VERBOSE) << "Client " << client->GetClientId() - << " is attempting to connect to endpoint(id=" - << endpoint->endpoint_id << ") over BLE."; + NEARBY_VLOG(1) << "Client " << client->GetClientId() + << " is attempting to connect to endpoint(id=" + << endpoint->endpoint_id << ") over BLE."; BlePeripheral& peripheral = endpoint->ble_peripheral; @@ -1838,8 +2156,9 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( // request comes in very quickly. BLE allows connecting over BLE itself, as // well as advertising the Bluetooth MAC address to allow connecting over // Bluetooth Classic. - NEARBY_LOGS(INFO) << "P2pClusterPcpHandler::StartBleAdvertising: service_id=" - << service_id << " : start"; + NEARBY_LOGS(INFO) + << "P2pClusterPcpHandler::StartBleV2Advertising: service_id=" + << service_id << " : start"; if (!ble_v2_medium_.IsAcceptingConnections(service_id)) { if (!bluetooth_radio_.Enable() || !ble_v2_medium_.StartAcceptingConnections( @@ -1849,7 +2168,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( client, local_endpoint_info.AsStringView(), NearbyDevice::Type::kConnectionsDevice))) { NEARBY_LOGS(WARNING) - << "In StartBleAdvertising(" + << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " failed to start accepting for incoming BLE connections to " @@ -1858,7 +2177,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( return location::nearby::proto::connections::UNKNOWN_MEDIUM; } NEARBY_LOGS(INFO) - << "In StartBleAdvertising(" + << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " started accepting for incoming BLE connections to service_id=" @@ -1880,7 +2199,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( this, client, local_endpoint_info.AsStringView(), NearbyDevice::Type::kConnectionsDevice))) { NEARBY_LOGS(WARNING) - << "In BT StartBleAdvertising(" + << "In BT StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " failed to start accepting for incoming BLE connections to " @@ -1890,7 +2209,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( return location::nearby::proto::connections::UNKNOWN_MEDIUM; } NEARBY_LOGS(INFO) - << "In BT StartBleAdvertising(" + << "In BT StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " started accepting for incoming BLE connections to service_id=" @@ -1898,7 +2217,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( } } - NEARBY_LOGS(INFO) << "In StartBleAdvertising(" + NEARBY_LOGS(INFO) << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " start to generate BleAdvertisement with service_id=" @@ -1927,7 +2246,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( /*uwb_address=*/ByteArray{}, web_rtc_state)); } if (advertisement_bytes.Empty()) { - NEARBY_LOGS(WARNING) << "In StartBleAdvertising(" + NEARBY_LOGS(WARNING) << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " failed to create an advertisement."; @@ -1935,7 +2254,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( return location::nearby::proto::connections::UNKNOWN_MEDIUM; } - NEARBY_LOGS(INFO) << "In StartBleAdvertising(" + NEARBY_LOGS(INFO) << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " generated BleAdvertisement with service_id=" @@ -1945,7 +2264,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( service_id, advertisement_bytes, power_level, !advertising_options.fast_advertisement_service_uuid.empty())) { NEARBY_LOGS(WARNING) - << "In StartBleAdvertising(" + << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " couldn't start BLE Advertising with BleAdvertisement " @@ -1953,7 +2272,7 @@ Medium P2pClusterPcpHandler::StartBleV2Advertising( ble_v2_medium_.StopAcceptingConnections(service_id); return location::nearby::proto::connections::UNKNOWN_MEDIUM; } - NEARBY_LOGS(INFO) << "In startBleAdvertising(" + NEARBY_LOGS(INFO) << "In StartBleV2Advertising(" << absl::BytesToHexString(local_endpoint_info.data()) << "), client=" << client->GetClientId() << " started BLE Advertising with BleAdvertisement " @@ -1976,14 +2295,20 @@ Medium P2pClusterPcpHandler::StartBleV2Scanning( .peripheral_lost_cb = absl::bind_front( &P2pClusterPcpHandler::BleV2PeripheralLostHandler, this, client), + .instant_lost_cb = absl::bind_front( + &P2pClusterPcpHandler::BleV2InstantLostHandler, this, client), + .legacy_device_discovered_cb = absl::bind_front( + &P2pClusterPcpHandler::BleV2LegacyDeviceDiscoveredHandler, + this), })) { NEARBY_LOGS(INFO) - << "In StartBleScanning(), client=" << client->GetClientId() + << "In StartBleV2Scanning(), client=" << client->GetClientId() << " started scanning for BLE advertisements for service_id=" << service_id; return location::nearby::proto::connections::BLE; } - NEARBY_LOGS(INFO) << "In StartBleScanning(), client=" << client->GetClientId() + NEARBY_LOGS(INFO) << "In StartBleV2Scanning(), client=" + << client->GetClientId() << " couldn't start scanning on BLE for service_id=" << service_id; @@ -1992,9 +2317,9 @@ Medium P2pClusterPcpHandler::StartBleV2Scanning( BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::BleV2ConnectImpl( ClientProxy* client, BleV2Endpoint* endpoint) { - NEARBY_LOGS(VERBOSE) << "Client " << client->GetClientId() - << " is attempting to connect to endpoint(id=" - << endpoint->endpoint_id << ") over BLE."; + NEARBY_VLOG(1) << "Client " << client->GetClientId() + << " is attempting to connect to endpoint(id=" + << endpoint->endpoint_id << ") over BLE."; BleV2Peripheral& peripheral = endpoint->ble_peripheral; @@ -2003,7 +2328,7 @@ BasePcpHandler::ConnectImplResult P2pClusterPcpHandler::BleV2ConnectImpl( client->GetCancellationFlag(endpoint->endpoint_id)); if (!ble_socket.IsValid()) { NEARBY_LOGS(ERROR) - << "In BleConnectImpl(), failed to connect to BLE device " + << "In BleV2ConnectImpl(), failed to connect to BLE device " << absl::BytesToHexString(peripheral.GetId().data()) << " for endpoint(id=" << endpoint->endpoint_id << ")."; return BasePcpHandler::ConnectImplResult{ diff --git a/connections/implementation/p2p_cluster_pcp_handler.h b/connections/implementation/p2p_cluster_pcp_handler.h index aa1c3950..606b7816 100644 --- a/connections/implementation/p2p_cluster_pcp_handler.h +++ b/connections/implementation/p2p_cluster_pcp_handler.h @@ -15,10 +15,15 @@ #ifndef CORE_INTERNAL_P2P_CLUSTER_PCP_HANDLER_H_ #define CORE_INTERNAL_P2P_CLUSTER_PCP_HANDLER_H_ -#include +#include +#include #include #include +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "connections/advertising_options.h" +#include "connections/discovery_options.h" #include "connections/implementation/base_pcp_handler.h" #include "connections/implementation/ble_advertisement.h" #include "connections/implementation/bluetooth_device_name.h" @@ -27,8 +32,26 @@ #include "connections/implementation/endpoint_channel_manager.h" #include "connections/implementation/endpoint_manager.h" #include "connections/implementation/injected_bluetooth_device_store.h" +#include "connections/implementation/mediums/ble.h" +#include "connections/implementation/mediums/ble_v2.h" #include "connections/implementation/mediums/bluetooth_classic.h" +#include "connections/implementation/mediums/bluetooth_radio.h" #include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/mediums/wifi_direct.h" +#include "connections/implementation/mediums/wifi_hotspot.h" +#include "connections/implementation/mediums/wifi_lan.h" +#include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/power_level.h" +#include "connections/status.h" +#include "connections/v3/connection_listening_options.h" +#include "internal/interop/device.h" +#include "internal/platform/ble.h" +#include "internal/platform/ble_v2.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/bluetooth_classic.h" +#include "internal/platform/nsd_service_info.h" +#include "internal/platform/wifi_lan.h" #ifdef NO_WEBRTC #include "connections/implementation/mediums/webrtc_socket_stub.h" #include "connections/implementation/mediums/webrtc_stub.h" @@ -123,7 +146,8 @@ class P2pClusterPcpHandler : public BasePcpHandler { // in to BasePCPHandler::onEndpointFound(). struct BleEndpointState { public: - BleEndpointState(const string& endpoint_id, const ByteArray& endpoint_info) + BleEndpointState(const std::string& endpoint_id, + const ByteArray& endpoint_info) : endpoint_id(endpoint_id), endpoint_info(endpoint_info) {} std::string endpoint_id; @@ -178,6 +202,10 @@ class P2pClusterPcpHandler : public BasePcpHandler { const ByteArray& local_endpoint_info, WebRtcState web_rtc_state); location::nearby::proto::connections::Medium StartBluetoothDiscovery( ClientProxy* client, const std::string& service_id); + void StartBluetoothDiscoveryWithPause( + ClientProxy* client, const std::string& service_id, + const DiscoveryOptions& discovery_options, + std::vector& mediums_started_successfully); BasePcpHandler::ConnectImplResult BluetoothConnectImpl( ClientProxy* client, BluetoothEndpoint* endpoint); @@ -220,6 +248,12 @@ class P2pClusterPcpHandler : public BasePcpHandler { const std::string& service_id, const ByteArray& advertisement_bytes, bool fast_advertisement); + void BleV2InstantLostHandler(ClientProxy* client, BleV2Peripheral peripheral, + const std::string& service_id, + const ByteArray& advertisement_bytes, + bool fast_advertisement); + void BleV2LegacyDeviceDiscoveredHandler(); + void BleV2ConnectionAcceptedHandler(ClientProxy* client, absl::string_view local_endpoint_info, NearbyDevice::Type device_type, @@ -270,7 +304,10 @@ class P2pClusterPcpHandler : public BasePcpHandler { WifiDirect& wifi_direct_medium_; mediums::WebRtc& webrtc_medium_; InjectedBluetoothDeviceStore& injected_bluetooth_device_store_; - std::int64_t bluetooth_classic_discoverer_client_id_{0}; + // Maintains a map of client_id to service_id for bluetooth classic + // discoverer. + absl::flat_hash_map + bluetooth_classic_client_id_to_service_id_map_; std::int64_t bluetooth_classic_advertiser_client_id_{0}; // Maps a BlePeripheral to its corresponding BleEndpointState. @@ -279,6 +316,10 @@ class P2pClusterPcpHandler : public BasePcpHandler { // Maps a BlePeripheral.Id_ to its corresponding BleEndpointState. absl::flat_hash_map found_endpoints_in_ble_discover_cb_; + + // Maps service id to its client. + absl::flat_hash_map + paused_bluetooth_clients_discoveries_; }; } // namespace connections diff --git a/connections/implementation/p2p_cluster_pcp_handler_test.cc b/connections/implementation/p2p_cluster_pcp_handler_test.cc index 5ca45ecf..b8714525 100644 --- a/connections/implementation/p2p_cluster_pcp_handler_test.cc +++ b/connections/implementation/p2p_cluster_pcp_handler_test.cc @@ -14,22 +14,32 @@ #include "connections/implementation/p2p_cluster_pcp_handler.h" -#include +#include #include #include -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/time/clock.h" #include "absl/time/time.h" #include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" #include "connections/implementation/bluetooth_device_name.h" #include "connections/implementation/bwu_manager.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_manager.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/injected_bluetooth_device_store.h" +#include "connections/implementation/mediums/bluetooth_radio.h" +#include "connections/implementation/mediums/mediums.h" +#include "connections/listeners.h" #include "connections/medium_selector.h" +#include "connections/status.h" +#include "connections/strategy.h" #include "connections/v3/connection_listening_options.h" #include "internal/flags/nearby_flags.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" @@ -67,29 +77,195 @@ constexpr BooleanMediumSelector kTestCases[] = { }, }; -// Combines the bool `kEnableBleV2` as param testing but should revert it back -// if ble_v2 is done and ble will be replaced by ble_v2. -class P2pClusterPcpHandlerTest - : public testing::TestWithParam> { +class P2pClusterPcpHandlerTest : public testing::Test { protected: void SetUp() override { - NEARBY_LOG(INFO, "SetUp: begin"); + NEARBY_LOGS(INFO) << "SetUp: begin"; + SetBleExtendedAdvertisementsAvailable(true); + SetDisableBluetoothClassicScanning(true); + SetBleV2Enabled(true); + } + + void SetBleExtendedAdvertisementsAvailable(bool available) { + env_.SetBleExtendedAdvertisementsAvailable(false); + } + + void SetDisableBluetoothClassicScanning(bool disable) { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning, + disable); + } + + void SetBleV2Enabled(bool enabled) { NearbyFlags::GetInstance().OverrideBoolFlagValue( config_package_nearby::nearby_connections_feature::kEnableBleV2, - std::get<1>(GetParam())); + enabled); + } + + AdvertisingOptions GetBluetoothOnlyAdvertisingOptions() { + return AdvertisingOptions{ + {Strategy::kP2pCluster, + BooleanMediumSelector{ + .bluetooth = true, + }}, + }; + } + + AdvertisingOptions GetBluetoothAndBleAdvertisingOptions() { + return AdvertisingOptions{ + {Strategy::kP2pCluster, + BooleanMediumSelector{ + .bluetooth = true, + .ble = true, + }}, + }; + } + + DiscoveryOptions GetBluetoothOnlyDiscoveryOptions() { + return DiscoveryOptions{ + {Strategy::kP2pCluster, + BooleanMediumSelector{ + .bluetooth = true, + }}, + }; + } + + DiscoveryOptions GetBluetoothAndBleDiscoveryOptions() { + return DiscoveryOptions{ + {Strategy::kP2pCluster, + BooleanMediumSelector{ + .bluetooth = true, + .ble = true, + }}, + }; + } + + ClientProxy client_a_; + ClientProxy client_b_; + ClientProxy client_c_; + std::string service_id_{"service"}; + MediumEnvironment& env_{MediumEnvironment::Instance()}; +}; + +TEST_F(P2pClusterPcpHandlerTest, NoBluetoothDiscoveryWhenRadioIsOff) { + env_.Start(); + Mediums mediums; + EndpointChannelManager ecm; + EndpointManager em(&ecm); + BwuManager bwu(mediums, em, ecm, {}, {}); + InjectedBluetoothDeviceStore ibds; + P2pClusterPcpHandler handler(&mediums, &em, &ecm, &bwu, ibds); + mediums.GetBluetoothRadio().Disable(); + handler.StartDiscovery(&client_a_, service_id_, + GetBluetoothOnlyDiscoveryOptions(), {}); + EXPECT_FALSE(mediums.GetBluetoothClassic().IsDiscovering(service_id_)); + handler.StopDiscovery(&client_a_); + + handler.StartDiscovery(&client_a_, service_id_, + GetBluetoothAndBleDiscoveryOptions(), {}); + EXPECT_FALSE(mediums.GetBluetoothClassic().IsDiscovering(service_id_)); + EXPECT_TRUE(mediums.GetBleV2().IsScanning(service_id_)); + + mediums.GetBluetoothRadio().Enable(); + handler.StopDiscovery(&client_a_); + env_.Stop(); +} + +TEST_F(P2pClusterPcpHandlerTest, + BluetoothCanDiscoveryWhenBluetoothDiscoveryRunning) { + std::string endpoint_name{"endpoint_name"}; + + env_.Start(); + // Enable BLE V2 extended advertisement for client_a_. + env_.SetBleExtendedAdvertisementsAvailable(true); + Mediums mediums_a; + EndpointChannelManager ecm_a; + EndpointManager em_a(&ecm_a); + InjectedBluetoothDeviceStore ibds_a; + BwuManager bwu_a(mediums_a, em_a, ecm_a, {}, {}); + P2pClusterPcpHandler handler_a(&mediums_a, &em_a, &ecm_a, &bwu_a, ibds_a); + + // Disable BLE V2 extended advertisement for client_b_. + env_.SetBleExtendedAdvertisementsAvailable(false); + Mediums mediums_b; + EndpointChannelManager ecm_b; + EndpointManager em_b(&ecm_b); + BwuManager bwu_b(mediums_b, em_b, ecm_b, {}, {}); + InjectedBluetoothDeviceStore ibds_b; + P2pClusterPcpHandler handler_b(&mediums_b, &em_b, &ecm_b, &bwu_b, ibds_b); + CountDownLatch latch(1); + + EXPECT_EQ(handler_a.StartDiscovery(&client_a_, service_id_, + GetBluetoothOnlyDiscoveryOptions(), {}), + Status{Status::kSuccess}); + + EXPECT_TRUE(mediums_a.GetBluetoothClassic().IsDiscovering(service_id_)); + + // Start another service discovery + EXPECT_EQ( + handler_a.StartDiscovery( + &client_c_, "new_service_id", GetBluetoothAndBleDiscoveryOptions(), + { + .endpoint_found_cb = + [&latch](const std::string& endpoint_id, + const ByteArray& endpoint_info, + const std::string& service_id) { + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id; + latch.CountDown(); + }, + }), + Status{Status::kSuccess}); + + // Start Bluetooth discovery when found legacy device. + EXPECT_EQ( + handler_b.StartAdvertising(&client_b_, "new_service_id", + GetBluetoothAndBleAdvertisingOptions(), + {.endpoint_info = ByteArray{endpoint_name}}), + Status{Status::kSuccess}); + + EXPECT_TRUE(latch.Await(absl::Milliseconds(1000)).result()); + + handler_a.StopDiscovery(&client_a_); + env_.Stop(); +} + +// Combines the bool `kEnableBleV2` as param testing but should revert it back +// if ble_v2 is done and ble will be replaced by ble_v2. +class P2pClusterPcpHandlerTestWithParam + : public testing::TestWithParam< + /*mediums=*/std::tuple> { + protected: + void SetUp() override { + NEARBY_LOGS(INFO) << "SetUp: begin"; + env_.SetBleExtendedAdvertisementsAvailable(false); + bool ble_v2_enabled = std::get<1>(GetParam()); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableBleV2, + ble_v2_enabled); + bool is_disable_bluetooth_scanning = std::get<2>(GetParam()); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature:: + kDisableBluetoothClassicScanning, + is_disable_bluetooth_scanning); if (advertising_options_.allowed.ble) { - NEARBY_LOG(INFO, "SetUp: BLE enabled"); + NEARBY_LOGS(INFO) << "SetUp: BLE enabled"; } if (advertising_options_.allowed.bluetooth) { - NEARBY_LOG(INFO, "SetUp: BT enabled"); + NEARBY_LOGS(INFO) << "SetUp: BT enabled"; } if (advertising_options_.allowed.wifi_lan) { - NEARBY_LOG(INFO, "SetUp: WifiLan enabled"); + NEARBY_LOGS(INFO) << "SetUp: WifiLan enabled"; } if (advertising_options_.allowed.web_rtc) { - NEARBY_LOG(INFO, "SetUp: WebRTC enabled"); + NEARBY_LOGS(INFO) << "SetUp: WebRTC enabled"; } - NEARBY_LOG(INFO, "SetUp: end"); + NEARBY_LOGS(INFO) << "SetUp: ble v2 enabled: " << ble_v2_enabled; + NEARBY_LOGS(INFO) << "SetUp: is_disable_bluetooth_scanning: " + << is_disable_bluetooth_scanning; + NEARBY_LOGS(INFO) << "SetUp: end"; } ClientProxy client_a_; @@ -116,7 +292,7 @@ class P2pClusterPcpHandlerTest MediumEnvironment& env_{MediumEnvironment::Instance()}; }; -TEST_P(P2pClusterPcpHandlerTest, CanConstructOne) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanConstructOne) { env_.Start(); Mediums mediums; EndpointChannelManager ecm; @@ -127,7 +303,7 @@ TEST_P(P2pClusterPcpHandlerTest, CanConstructOne) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanConstructMultiple) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanConstructMultiple) { env_.Start(); Mediums mediums_a; Mediums mediums_b; @@ -144,7 +320,7 @@ TEST_P(P2pClusterPcpHandlerTest, CanConstructMultiple) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanAdvertise) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanAdvertise) { env_.Start(); std::string endpoint_name{"endpoint_name"}; Mediums mediums_a; @@ -157,10 +333,39 @@ TEST_P(P2pClusterPcpHandlerTest, CanAdvertise) { handler_a.StartAdvertising(&client_a_, service_id_, advertising_options_, {.endpoint_info = ByteArray{endpoint_name}}), Status{Status::kSuccess}); + handler_a.StopAdvertising(&client_a_); env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptions) { +TEST_P(P2pClusterPcpHandlerTestWithParam, AdvertiseForLegacyDeviceWithBt) { + env_.Start(); + std::string endpoint_name{"endpoint_name"}; + Mediums mediums_a; + EndpointChannelManager ecm_a; + EndpointManager em_a(&ecm_a); + BwuManager bwu_a(mediums_a, em_a, ecm_a, {}, {}); + InjectedBluetoothDeviceStore ibds_a; + P2pClusterPcpHandler handler_a(&mediums_a, &em_a, &ecm_a, &bwu_a, ibds_a); + EXPECT_EQ( + handler_a.StartAdvertising(&client_a_, service_id_, advertising_options_, + {.endpoint_info = ByteArray{endpoint_name}}), + Status{Status::kSuccess}); + // advertising for legacy device depends on both BT and BLE V2 enabled. + if (std::get<0>(GetParam()).bluetooth && std::get<1>(GetParam())) { + EXPECT_TRUE(mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } else { + EXPECT_FALSE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } + handler_a.StopAdvertising(&client_a_); + if (std::get<0>(GetParam()).bluetooth && std::get<1>(GetParam())) { + EXPECT_FALSE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } + env_.Stop(); +} + +TEST_P(P2pClusterPcpHandlerTestWithParam, CanUpdateAdvertisingOptions) { bool ble_v2_enabled = std::get<1>(GetParam()); if (!ble_v2_enabled) { // Just don't run the test if ble_v2 is disabled. @@ -188,11 +393,15 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptions) { ASSERT_FALSE(mediums_a.GetBleV2().IsAcceptingConnections(service_id_)); mediums_a.GetBleV2().StopAdvertising(service_id_); ASSERT_FALSE(mediums_a.GetBleV2().IsAdvertising(service_id_)); + BooleanMediumSelector enabled = advertising_options_.allowed; + if (ble_v2_enabled && enabled.bluetooth) { + EXPECT_FALSE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } EXPECT_EQ( handler_a.StartAdvertising(&client_a_, service_id_, advertising_options_, {.endpoint_info = ByteArray{endpoint_name}}), Status{Status::kSuccess}); - BooleanMediumSelector enabled = advertising_options_.allowed; EXPECT_EQ(enabled.ble, mediums_a.GetBleV2().IsAdvertising(service_id_)); EXPECT_EQ(enabled.wifi_lan, mediums_a.GetWifiLan().IsAdvertising(service_id_)); @@ -201,6 +410,9 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptions) { mediums_a.GetBluetoothClassic().IsAcceptingConnections(service_id_)); EXPECT_EQ(enabled.bluetooth, mediums_a.GetBluetoothClassic().TurnOffDiscoverability()); + if (ble_v2_enabled && enabled.bluetooth) { + EXPECT_TRUE(mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } // Turn discoverability back on mediums_a.GetBluetoothClassic().TurnOnDiscoverability(service_id_); AdvertisingOptions new_options{ @@ -217,6 +429,11 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptions) { Status{Status::kSuccess}); if (ble_v2_enabled) { EXPECT_EQ(enabled.ble, mediums_a.GetBleV2().IsAdvertising(service_id_)); + // Low power won't restart BT, nor BLE advertising for legacy device. + if (enabled.bluetooth) { + EXPECT_FALSE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } } else { EXPECT_EQ(enabled.ble, mediums_a.GetBle().IsAdvertising(service_id_)); } @@ -228,7 +445,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptions) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptionsNoLowPower) { +TEST_P(P2pClusterPcpHandlerTestWithParam, + CanUpdateAdvertisingOptionsNoLowPower) { bool ble_v2_enabled = std::get<1>(GetParam()); if (!ble_v2_enabled) { // Just don't run the test if ble_v2 is disabled. @@ -267,6 +485,10 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptionsNoLowPower) { true, // low_power false, // enable_bluetooth_listening }; + if (ble_v2_enabled && enabled.bluetooth) { + EXPECT_FALSE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } EXPECT_EQ( handler_a.StartAdvertising(&client_a_, service_id_, old_options, {.endpoint_info = ByteArray{endpoint_name}}), @@ -277,6 +499,9 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptionsNoLowPower) { EXPECT_EQ( enabled.bluetooth, mediums_a.GetBluetoothClassic().IsAcceptingConnections(service_id_)); + if (ble_v2_enabled && enabled.bluetooth) { + EXPECT_TRUE(mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } EXPECT_EQ(enabled.bluetooth, mediums_a.GetBluetoothClassic().TurnOffDiscoverability()); EXPECT_EQ(handler_a.UpdateAdvertisingOptions(&client_a_, service_id_, @@ -284,6 +509,10 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptionsNoLowPower) { Status{Status::kSuccess}); if (ble_v2_enabled) { EXPECT_EQ(enabled.ble, mediums_a.GetBleV2().IsAdvertising(service_id_)); + if (enabled.bluetooth) { + EXPECT_TRUE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } } else { EXPECT_EQ(enabled.ble, mediums_a.GetBle().IsAdvertising(service_id_)); } @@ -295,10 +524,14 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateAdvertisingOptionsNoLowPower) { enabled.bluetooth || enabled.ble, mediums_a.GetBluetoothClassic().IsAcceptingConnections(service_id_)); handler_a.StopAdvertising(&client_a_); + if (ble_v2_enabled && enabled.bluetooth) { + EXPECT_FALSE( + mediums_a.GetBleV2().IsAdvertisingForLegacyDevice(service_id_)); + } env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanDiscover) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanDiscover) { env_.Start(); std::string endpoint_name{"endpoint_name"}; Mediums mediums_a; @@ -325,8 +558,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanDiscover) { [&latch](const std::string& endpoint_id, const ByteArray& endpoint_info, const std::string& service_id) { - NEARBY_LOG(INFO, "Device discovered: id=%s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id; latch.CountDown(); }, }), @@ -338,7 +571,147 @@ TEST_P(P2pClusterPcpHandlerTest, CanDiscover) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanBluetoothDiscoverChangeName) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanDiscoverLegacy) { + env_.Start(); + std::string endpoint_name{"endpoint_name"}; + Mediums mediums_a; + Mediums mediums_b; + EndpointChannelManager ecm_a; + EndpointChannelManager ecm_b; + EndpointManager em_a(&ecm_a); + EndpointManager em_b(&ecm_b); + BwuManager bwu_a(mediums_a, em_a, ecm_a, {}, {}); + BwuManager bwu_b(mediums_b, em_b, ecm_b, {}, {}); + InjectedBluetoothDeviceStore ibds_a; + InjectedBluetoothDeviceStore ibds_b; + P2pClusterPcpHandler handler_a(&mediums_a, &em_a, &ecm_a, &bwu_a, ibds_a); + P2pClusterPcpHandler handler_b(&mediums_b, &em_b, &ecm_b, &bwu_b, ibds_b); + CountDownLatch latch(1); + EXPECT_EQ( + handler_a.StartAdvertising(&client_a_, service_id_, advertising_options_, + {.endpoint_info = ByteArray{endpoint_name}}), + Status{Status::kSuccess}); + EXPECT_EQ(handler_b.StartDiscovery( + &client_b_, service_id_, discovery_options_, + { + .endpoint_found_cb = + [&latch](const std::string& endpoint_id, + const ByteArray& endpoint_info, + const std::string& service_id) { + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id; + latch.CountDown(); + }, + }), + Status{Status::kSuccess}); + // advertising for legacy device depends on both BT and BLE V2 enabled. + // if (std::get<0>(GetParam()).bluetooth && std::get<1>(GetParam())) { + EXPECT_TRUE(latch.Await(absl::Milliseconds(1000)).result()); + /* } else { + EXPECT_FALSE(latch.Await(absl::Milliseconds(1000)).result()); + }*/ + // We discovered endpoint over one medium. Before we finish the test, we have + // to stop discovery for other mediums that may be still ongoing. + handler_b.StopDiscovery(&client_b_); + env_.Stop(); +} + +TEST_P(P2pClusterPcpHandlerTestWithParam, PauseBluetoothClassicDiscovery) { + // Skip the case which not disable bluetooth scanning. + if (!std::get<2>(GetParam()) || !std::get<1>(GetParam()) || + !advertising_options_.allowed.bluetooth || + !advertising_options_.allowed.ble) { + return; + } + + env_.SetBleExtendedAdvertisementsAvailable(true); + env_.Start(); + std::string endpoint_name{"endpoint_name"}; + Mediums mediums_a; + EndpointChannelManager ecm_a; + EndpointManager em_a(&ecm_a); + BwuManager bwu_a(mediums_a, em_a, ecm_a, {}, {}); + InjectedBluetoothDeviceStore ibds_a; + P2pClusterPcpHandler handler_a(&mediums_a, &em_a, &ecm_a, &bwu_a, ibds_a); + + EXPECT_EQ( + handler_a.StartDiscovery(&client_a_, service_id_, discovery_options_, {}), + Status{Status::kSuccess}); + + EXPECT_TRUE(mediums_a.GetBleV2().IsScanning(service_id_)); + EXPECT_FALSE(mediums_a.GetBluetoothClassic().IsDiscovering(service_id_)); + // Before we finish the test, we have to stop discovery for other mediums that + // may be still ongoing. + handler_a.StopDiscovery(&client_a_); + env_.Stop(); +} + +TEST_P(P2pClusterPcpHandlerTestWithParam, ResumeBluetoothClassicDiscovery) { + // Skip the case which not disable bluetooth scanning. + if (!std::get<2>(GetParam()) || !std::get<1>(GetParam()) || + !advertising_options_.allowed.bluetooth || + !advertising_options_.allowed.ble) { + return; + } + + std::string endpoint_name{"endpoint_name"}; + + env_.Start(); + // Enable BLE V2 extended advertisement for client_a_. + env_.SetBleExtendedAdvertisementsAvailable(true); + Mediums mediums_a; + EndpointChannelManager ecm_a; + EndpointManager em_a(&ecm_a); + InjectedBluetoothDeviceStore ibds_a; + BwuManager bwu_a(mediums_a, em_a, ecm_a, {}, {}); + P2pClusterPcpHandler handler_a(&mediums_a, &em_a, &ecm_a, &bwu_a, ibds_a); + + // Disable BLE V2 extended advertisement for client_b_. + env_.SetBleExtendedAdvertisementsAvailable(false); + Mediums mediums_b; + EndpointChannelManager ecm_b; + EndpointManager em_b(&ecm_b); + BwuManager bwu_b(mediums_b, em_b, ecm_b, {}, {}); + InjectedBluetoothDeviceStore ibds_b; + P2pClusterPcpHandler handler_b(&mediums_b, &em_b, &ecm_b, &bwu_b, ibds_b); + CountDownLatch latch(1); + + EXPECT_EQ(handler_a.StartDiscovery( + &client_a_, service_id_, discovery_options_, + { + .endpoint_found_cb = + [&latch](const std::string& endpoint_id, + const ByteArray& endpoint_info, + const std::string& service_id) { + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id; + latch.CountDown(); + }, + }), + Status{Status::kSuccess}); + + EXPECT_TRUE(mediums_a.GetBleV2().IsScanning(service_id_)); + EXPECT_FALSE(mediums_a.GetBluetoothClassic().IsDiscovering(service_id_)); + + EXPECT_EQ( + handler_b.StartAdvertising(&client_b_, service_id_, advertising_options_, + {.endpoint_info = ByteArray{endpoint_name}}), + Status{Status::kSuccess}); + + EXPECT_TRUE(latch.Await(absl::Milliseconds(1000)).result()); + absl::SleepFor(absl::Milliseconds(100)); + + EXPECT_TRUE(mediums_a.GetBleV2().IsScanning(service_id_)); + EXPECT_TRUE(mediums_a.GetBluetoothClassic().IsDiscovering(service_id_)); + + // Before we finish the test, we have to stop discovery for other mediums that + // may be still ongoing. + handler_b.StopAdvertising(&client_b_); + handler_a.StopDiscovery(&client_a_); + env_.Stop(); +} + +TEST_P(P2pClusterPcpHandlerTestWithParam, CanBluetoothDiscoverChangeName) { env_.Start(); std::string endpoint_name{"endpoint_name"}; Mediums mediums_a; @@ -388,8 +761,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanBluetoothDiscoverChangeName) { [&](const std::string& endpoint_id, const ByteArray& endpoint_info, const std::string& service_id) { - NEARBY_LOG(INFO, "Device discovered: id=%s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id; if (!first) { first_found_latch.CountDown(); first = true; @@ -399,7 +772,7 @@ TEST_P(P2pClusterPcpHandlerTest, CanBluetoothDiscoverChangeName) { }, .endpoint_lost_cb = [&](const std::string& id) { - NEARBY_LOG(INFO, "Device lost: id=%s", id.c_str()); + NEARBY_LOGS(INFO) << "Device lost: id=" << id; lost_latch.CountDown(); }, }), @@ -420,7 +793,7 @@ TEST_P(P2pClusterPcpHandlerTest, CanBluetoothDiscoverChangeName) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanUpdateDiscoveryOptions) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanUpdateDiscoveryOptions) { env_.Start(); std::string endpoint_name{"endpoint_name"}; Mediums mediums_a; @@ -465,7 +838,7 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateDiscoveryOptions) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanUpdateDiscoveryOptionsNoLowPower) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanUpdateDiscoveryOptionsNoLowPower) { env_.Start(); std::string endpoint_name{"endpoint_name"}; Mediums mediums_a; @@ -507,7 +880,7 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateDiscoveryOptionsNoLowPower) { EXPECT_EQ(old_enabled.wifi_lan, mediums_a.GetWifiLan().IsDiscovering(service_id_)); EXPECT_EQ(old_enabled.bluetooth, - mediums_a.GetBluetoothClassic().StopDiscovery()); + mediums_a.GetBluetoothClassic().StopDiscovery(service_id_)); NEARBY_LOGS(INFO) << "started discovery"; // Update discovery options EXPECT_TRUE( @@ -522,12 +895,13 @@ TEST_P(P2pClusterPcpHandlerTest, CanUpdateDiscoveryOptionsNoLowPower) { EXPECT_EQ(new_enabled.wifi_lan, mediums_a.GetWifiLan().IsDiscovering(service_id_)); EXPECT_EQ(new_enabled.bluetooth, - mediums_a.GetBluetoothClassic().StopDiscovery()); + mediums_a.GetBluetoothClassic().StopDiscovery(service_id_)); handler_a.StopDiscovery(&client_a_); env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, UpdateDiscoveryOptionsSkipMediumRestart) { +TEST_P(P2pClusterPcpHandlerTestWithParam, + UpdateDiscoveryOptionsSkipMediumRestart) { env_.Start(); std::string endpoint_name{"endpoint_name"}; Mediums mediums_a; @@ -560,7 +934,8 @@ TEST_P(P2pClusterPcpHandlerTest, UpdateDiscoveryOptionsSkipMediumRestart) { } EXPECT_EQ(enabled.wifi_lan, mediums_a.GetWifiLan().IsDiscovering(service_id_)); - EXPECT_EQ(enabled.bluetooth, mediums_a.GetBluetoothClassic().StopDiscovery()); + EXPECT_EQ(enabled.bluetooth, + mediums_a.GetBluetoothClassic().StopDiscovery(service_id_)); // Update discovery options auto result = handler_a.UpdateDiscoveryOptions(&client_a_, service_id_, discovery_options_); @@ -574,12 +949,12 @@ TEST_P(P2pClusterPcpHandlerTest, UpdateDiscoveryOptionsSkipMediumRestart) { EXPECT_EQ(enabled.wifi_lan, mediums_a.GetWifiLan().IsDiscovering(service_id_)); // We didn't restart the medium. - EXPECT_FALSE(mediums_a.GetBluetoothClassic().StopDiscovery()); + EXPECT_FALSE(mediums_a.GetBluetoothClassic().StopDiscovery(service_id_)); handler_a.StopDiscovery(&client_a_); env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanConnect) { +TEST_P(P2pClusterPcpHandlerTestWithParam, CanConnect) { env_.Start(); std::string endpoint_name_a{"endpoint_name"}; Mediums mediums_a; @@ -617,8 +992,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanConnect) { .initiated_cb = [&connect_latch](const std::string& endpoint_id, const ConnectionResponseInfo& info) { - NEARBY_LOG(INFO, - "StartAdvertising: initiated_cb called"); + NEARBY_LOGS(INFO) + << "StartAdvertising: initiated_cb called"; connect_latch.CountDown(); }, }, @@ -632,11 +1007,10 @@ TEST_P(P2pClusterPcpHandlerTest, CanConnect) { const std::string& endpoint_id, const ByteArray& endpoint_info, const std::string& service_id) { - NEARBY_LOG( - INFO, - "Device discovered: id=%s, endpoint_info=%s", - endpoint_id.c_str(), - std::string{endpoint_info}.c_str()); + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id + << ", endpoint_info=" + << std::string{endpoint_info}; discovered = { .endpoint_id = endpoint_id, .endpoint_info = endpoint_info, @@ -669,7 +1043,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanConnect) { .initiated_cb = [&connect_latch](const std::string& endpoint_id, const ConnectionResponseInfo& info) { - NEARBY_LOG(INFO, "RequestConnection: initiated_cb called"); + NEARBY_LOGS(INFO) + << "RequestConnection: initiated_cb called"; connect_latch.CountDown(); }, }}, @@ -697,7 +1072,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanConnect) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanStartListeningForIncomingConnections) { +TEST_P(P2pClusterPcpHandlerTestWithParam, + CanStartListeningForIncomingConnections) { env_.Start(); std::string endpoint_name_a{"endpoint_name"}; Mediums mediums_a; @@ -750,7 +1126,8 @@ TEST_P(P2pClusterPcpHandlerTest, CanStartListeningForIncomingConnections) { env_.Stop(); } -TEST_P(P2pClusterPcpHandlerTest, CanStopListeningForIncomingConnections) { +TEST_P(P2pClusterPcpHandlerTestWithParam, + CanStopListeningForIncomingConnections) { env_.Start(); std::string endpoint_name_a{"endpoint_name"}; Mediums mediums_a; @@ -802,9 +1179,11 @@ TEST_P(P2pClusterPcpHandlerTest, CanStopListeningForIncomingConnections) { env_.Stop(); } -INSTANTIATE_TEST_SUITE_P(ParametrisedPcpHandlerTest, P2pClusterPcpHandlerTest, - ::testing::Combine(::testing::ValuesIn(kTestCases), - ::testing::Bool())); +INSTANTIATE_TEST_SUITE_P( + ParametrisedPcpHandlerTest, P2pClusterPcpHandlerTestWithParam, + ::testing::Combine(/*mediums=*/::testing::ValuesIn(kTestCases), + /*ble_v2_enabled=*/::testing::Bool(), + /*disable_bluetooth_scanning=*/::testing::Bool())); } // namespace } // namespace connections diff --git a/connections/implementation/p2p_point_to_point_pcp_handler.cc b/connections/implementation/p2p_point_to_point_pcp_handler.cc index 1aa15b79..e6614b25 100644 --- a/connections/implementation/p2p_point_to_point_pcp_handler.cc +++ b/connections/implementation/p2p_point_to_point_pcp_handler.cc @@ -16,6 +16,9 @@ #include +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "internal/flags/nearby_flags.h" + namespace nearby { namespace connections { @@ -46,8 +49,15 @@ P2pPointToPointPcpHandler::GetConnectionMediumsByPriority() { if (mediums_->GetBluetoothClassic().IsAvailable()) { mediums.push_back(location::nearby::proto::connections::BLUETOOTH); } - if (mediums_->GetBle().IsAvailable()) { - mediums.push_back(location::nearby::proto::connections::BLE); + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)) { + if (mediums_->GetBleV2().IsAvailable()) { + mediums.push_back(location::nearby::proto::connections::BLE); + } + } else { + if (mediums_->GetBle().IsAvailable()) { + mediums.push_back(location::nearby::proto::connections::BLE); + } } return mediums; } diff --git a/connections/implementation/p2p_point_to_point_pcp_handler_test.cc b/connections/implementation/p2p_point_to_point_pcp_handler_test.cc index d9ee395f..0287f001 100644 --- a/connections/implementation/p2p_point_to_point_pcp_handler_test.cc +++ b/connections/implementation/p2p_point_to_point_pcp_handler_test.cc @@ -77,26 +77,26 @@ class P2pPointToPointPcpHandlerTest : public testing::TestWithParam> { protected: void SetUp() override { - NEARBY_LOG(INFO, "SetUp: begin"); + NEARBY_LOGS(INFO) << "SetUp: begin"; NearbyFlags::GetInstance().OverrideBoolFlagValue( config_package_nearby::nearby_connections_feature::kEnableBleV2, std::get<1>(GetParam())); if (advertising_options_.allowed.ble) { - NEARBY_LOG(INFO, "SetUp: BLE enabled"); + NEARBY_LOGS(INFO) << "SetUp: BLE enabled"; } if (advertising_options_.allowed.bluetooth) { - NEARBY_LOG(INFO, "SetUp: BT enabled"); + NEARBY_LOGS(INFO) << "SetUp: BT enabled"; } if (advertising_options_.allowed.wifi_lan) { - NEARBY_LOG(INFO, "SetUp: WifiLan enabled"); + NEARBY_LOGS(INFO) << "SetUp: WifiLan enabled"; } if (advertising_options_.allowed.wifi_hotspot) { - NEARBY_LOG(INFO, "SetUp: WifiLan enabled"); + NEARBY_LOGS(INFO) << "SetUp: WifiLan enabled"; } if (advertising_options_.allowed.web_rtc) { - NEARBY_LOG(INFO, "SetUp: WebRTC enabled"); + NEARBY_LOGS(INFO) << "SetUp: WebRTC enabled"; } - NEARBY_LOG(INFO, "SetUp: end"); + NEARBY_LOGS(INFO) << "SetUp: end"; } ClientProxy client_a_; @@ -172,8 +172,8 @@ TEST_P(P2pPointToPointPcpHandlerTest, CanConnect) { .initiated_cb = [&connect_latch](const std::string& endpoint_id, const ConnectionResponseInfo& info) { - NEARBY_LOG(INFO, - "StartAdvertising: initiated_cb called"); + NEARBY_LOGS(INFO) + << "StartAdvertising: initiated_cb called"; connect_latch.CountDown(); }, }, @@ -187,11 +187,10 @@ TEST_P(P2pPointToPointPcpHandlerTest, CanConnect) { const std::string& endpoint_id, const ByteArray& endpoint_info, const std::string& service_id) { - NEARBY_LOG( - INFO, - "Device discovered: id=%s, endpoint_info=%s", - endpoint_id.c_str(), - std::string{endpoint_info}.c_str()); + NEARBY_LOGS(INFO) + << "Device discovered: id=" << endpoint_id + << ", endpoint_info=" + << endpoint_info.AsStringView(); discovered = { .endpoint_id = endpoint_id, .endpoint_info = endpoint_info, @@ -224,7 +223,8 @@ TEST_P(P2pPointToPointPcpHandlerTest, CanConnect) { .initiated_cb = [&connect_latch](const std::string& endpoint_id, const ConnectionResponseInfo& info) { - NEARBY_LOG(INFO, "RequestConnection: initiated_cb called"); + NEARBY_LOGS(INFO) + << "RequestConnection: initiated_cb called"; connect_latch.CountDown(); }, }}, diff --git a/connections/implementation/p2p_star_pcp_handler.cc b/connections/implementation/p2p_star_pcp_handler.cc index 2af6f0ad..0582cc28 100644 --- a/connections/implementation/p2p_star_pcp_handler.cc +++ b/connections/implementation/p2p_star_pcp_handler.cc @@ -16,6 +16,8 @@ #include +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/logging.h" namespace nearby { @@ -49,8 +51,15 @@ P2pStarPcpHandler::GetConnectionMediumsByPriority() { if (mediums_->GetBluetoothClassic().IsAvailable()) { mediums.push_back(location::nearby::proto::connections::BLUETOOTH); } - if (mediums_->GetBle().IsAvailable()) { - mediums.push_back(location::nearby::proto::connections::BLE); + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)) { + if (mediums_->GetBleV2().IsAvailable()) { + mediums.push_back(location::nearby::proto::connections::BLE); + } + } else { + if (mediums_->GetBle().IsAvailable()) { + mediums.push_back(location::nearby::proto::connections::BLE); + } } return mediums; } diff --git a/connections/implementation/payload_manager.cc b/connections/implementation/payload_manager.cc index 349b8cb2..a5dcb9ef 100644 --- a/connections/implementation/payload_manager.cc +++ b/connections/implementation/payload_manager.cc @@ -15,6 +15,7 @@ #include "connections/implementation/payload_manager.h" #include +#include #include #include #include @@ -30,10 +31,15 @@ #include "connections/implementation/analytics/throughput_recorder.h" #include "connections/implementation/client_proxy.h" #include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_manager.h" #include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/internal_payload_factory.h" +#include "connections/implementation/proto/offline_wire_formats.pb.h" +#include "connections/listeners.h" +#include "connections/payload.h" #include "connections/payload_type.h" #include "internal/flags/nearby_flags.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/exception.h" #include "internal/platform/feature_flags.h" @@ -59,7 +65,7 @@ constexpr absl::Duration PayloadManager::kWaitCloseTimeout; bool PayloadManager::SendPayloadLoop( ClientProxy* client, PendingPayload& pending_payload, PayloadTransferFrame::PayloadHeader& payload_header, - std::int64_t& next_chunk_offset, size_t resume_offset) { + std::int64_t& next_chunk_offset, size_t resume_offset, int index) { // in lieu of structured binding: auto pair = GetAvailableAndUnavailableEndpoints(pending_payload); const EndpointIds& available_endpoint_ids = @@ -76,21 +82,19 @@ bool PayloadManager::SendPayloadLoop( // Update the still-active recipients of this payload. if (available_endpoint_ids.empty()) { - NEARBY_LOGS(INFO) - << "PayloadManager short-circuiting payload_id=" - << pending_payload.GetInternalPayload()->GetId() << " after sending " - << next_chunk_offset - << " bytes because none of the endpoints are available anymore."; + LOG(INFO) << "PayloadManager short-circuiting payload_id=" + << pending_payload.GetInternalPayload()->GetId() + << " after sending " << next_chunk_offset + << " bytes because none of the endpoints are available anymore."; return false; } // Check if the payload has been cancelled by the client and, if so, // notify the remaining recipients. if (pending_payload.IsLocallyCanceled()) { - NEARBY_LOGS(INFO) << "Aborting send of payload_id=" - << pending_payload.GetInternalPayload()->GetId() - << " at offset " << next_chunk_offset - << " since it is marked canceled."; + LOG(INFO) << "Aborting send of payload_id=" + << pending_payload.GetInternalPayload()->GetId() << " at offset " + << next_chunk_offset << " since it is marked canceled."; HandleFinishedOutgoingPayload(client, available_endpoint_ids, payload_header, next_chunk_offset, location::nearby::proto::connections:: @@ -107,17 +111,17 @@ bool PayloadManager::SendPayloadLoop( pending_payload.GetInternalPayload()->SkipToOffset(resume_offset); if (!real_offset.ok()) { // Stop sending since it may cause remote file merging failed. - NEARBY_LOGS(WARNING) << "PayloadManager failed to skip offset " - << resume_offset << " on payload_id " - << pending_payload.GetInternalPayload()->GetId(); + LOG(WARNING) << "PayloadManager failed to skip offset " << resume_offset + << " on payload_id " + << pending_payload.GetInternalPayload()->GetId(); HandleFinishedOutgoingPayload( client, available_endpoint_ids, payload_header, next_chunk_offset, location::nearby::proto::connections::PayloadStatus::LOCAL_ERROR); return false; } - NEARBY_LOGS(VERBOSE) << "PayloadManager successfully skipped " - << real_offset.GetResult() << " bytes on payload_id " - << pending_payload.GetInternalPayload()->GetId(); + NEARBY_VLOG(1) << "PayloadManager successfully skipped " + << real_offset.GetResult() << " bytes on payload_id " + << pending_payload.GetInternalPayload()->GetId(); next_chunk_offset = real_offset.GetResult(); } for (const auto& endpoint_id : available_endpoint_ids) { @@ -138,8 +142,8 @@ bool PayloadManager::SendPayloadLoop( pending_payload.GetInternalPayload()->GetTotalSize() > 0 && pending_payload.GetInternalPayload()->GetTotalSize() < next_chunk_offset) { - NEARBY_LOGS(INFO) << "Payload xfer failed: payload_id=" - << pending_payload.GetInternalPayload()->GetId(); + LOG(INFO) << "Payload xfer failed: payload_id=" + << pending_payload.GetInternalPayload()->GetId(); HandleFinishedOutgoingPayload( client, available_endpoint_ids, payload_header, next_chunk_offset, location::nearby::proto::connections::PayloadStatus::LOCAL_ERROR); @@ -151,14 +155,14 @@ bool PayloadManager::SendPayloadLoop( // In other cases, the offset should only be used in both side logs when error // happened. PayloadTransferFrame::PayloadChunk payload_chunk(CreatePayloadChunk( - next_chunk_offset - resume_offset, std::move(next_chunk))); + next_chunk_offset - resume_offset, std::move(next_chunk), index)); const EndpointIds& failed_endpoint_ids = endpoint_manager_->SendPayloadChunk( payload_header, payload_chunk, available_endpoint_ids, packet_meta_data); // Check whether at least one endpoint failed. if (!failed_endpoint_ids.empty()) { - NEARBY_LOGS(INFO) << "Payload xfer: endpoints failed: payload_id=" - << payload_header.id() << "; endpoint_ids={" - << ToString(failed_endpoint_ids) << "}", + LOG(INFO) << "Payload xfer: endpoints failed: payload_id=" + << payload_header.id() << "; endpoint_ids={" + << ToString(failed_endpoint_ids) << "}", HandleFinishedOutgoingPayload(client, failed_endpoint_ids, payload_header, next_chunk_offset, location::nearby::proto::connections:: @@ -183,16 +187,16 @@ bool PayloadManager::SendPayloadLoop( payload_chunk.offset(), payload_chunk.body().size()); } } - NEARBY_LOGS(VERBOSE) << "PayloadManager done sending chunk at offset " - << next_chunk_offset << " of payload_id=" - << pending_payload.GetInternalPayload()->GetId(); + NEARBY_VLOG(1) << "PayloadManager done sending chunk at offset " + << next_chunk_offset << " of payload_id=" + << pending_payload.GetInternalPayload()->GetId(); next_chunk_offset += next_chunk_size; if (!next_chunk_size) { // That was the last chunk, we're outta here. - NEARBY_LOGS(INFO) << "Payload xfer done: payload_id=" - << pending_payload.GetInternalPayload()->GetId() - << "; size=" << next_chunk_offset; + LOG(INFO) << "Payload xfer done: payload_id=" + << pending_payload.GetInternalPayload()->GetId() + << "; size=" << next_chunk_offset; ThroughputRecorderContainer::GetInstance() .GetTPRecorder(pending_payload.GetInternalPayload()->GetId(), PayloadDirection::OUTGOING_PAYLOAD) @@ -291,7 +295,7 @@ Payload::Id PayloadManager::CreateOutgoingPayload( Payload payload, const EndpointIds& endpoint_ids) { auto internal_payload{CreateOutgoingInternalPayload(std::move(payload))}; Payload::Id payload_id = internal_payload->GetId(); - NEARBY_LOGS(INFO) << "CreateOutgoingPayload: payload_id=" << payload_id; + LOG(INFO) << "CreateOutgoingPayload: payload_id=" << payload_id; MutexLock lock(&mutex_); pending_payloads_.StartTrackingPayload( payload_id, @@ -310,7 +314,7 @@ PayloadManager::PayloadManager(EndpointManager& endpoint_manager) } void PayloadManager::CancelAllPayloads() { - NEARBY_LOG(INFO, "PayloadManager: canceling payloads; self=%p", this); + LOG(INFO) << "PayloadManager: canceling payloads; self=" << this; { MutexLock lock(&mutex_); int pending_outgoing_payloads = 0; @@ -326,9 +330,9 @@ void PayloadManager::CancelAllPayloads() { } } if (shutdown_barrier_) { - NEARBY_LOG(INFO, - "PayloadManager: waiting for pending outgoing payloads; self=%p", - this); + LOG(INFO) << "PayloadManager: waiting for pending outgoing " + "payloads; self=" + << this; shutdown_barrier_->Await(); } } @@ -340,42 +344,40 @@ void PayloadManager::DisconnectFromEndpointManager() { } PayloadManager::~PayloadManager() { - NEARBY_LOG(INFO, "PayloadManager: going down; self=%p", this); + LOG(INFO) << "PayloadManager: going down; self=" << this; ThroughputRecorderContainer::GetInstance().Shutdown(); DisconnectFromEndpointManager(); CancelAllPayloads(); - NEARBY_LOG(INFO, "PayloadManager: turn down payload executors; self=%p", - this); + LOG(INFO) << "PayloadManager: turn down payload executors; self=" << this; bytes_payload_executor_.Shutdown(); stream_payload_executor_.Shutdown(); file_payload_executor_.Shutdown(); + send_payload_ack_executor_.Shutdown(); CountDownLatch stop_latch(1); // Clear our tracked pending payloads. RunOnStatusUpdateThread( "~payload-manager", [this, &stop_latch]() RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() { - NEARBY_LOG(INFO, "PayloadManager: stop tracking payloads; self=%p", - this); + LOG(INFO) << "PayloadManager: stop tracking payloads; self=" << this; MutexLock lock(&mutex_); pending_payloads_.StopTrackingAllPayloads(); stop_latch.CountDown(); }); stop_latch.Await(); - NEARBY_LOG(INFO, "PayloadManager: turn down notification executor; self=%p", - this); + LOG(INFO) << "PayloadManager: turn down notification executor; self=" << this; // Stop all the ongoing Runnables (as gracefully as possible). payload_status_update_executor_.Shutdown(); - NEARBY_LOG(INFO, "PayloadManager: down; self=%p", this); + LOG(INFO) << "PayloadManager: down; self=" << this; } bool PayloadManager::NotifyShutdown() { MutexLock lock(&mutex_); if (!shutdown_.Get()) return false; if (!shutdown_barrier_) return false; - NEARBY_LOG(INFO, "PayloadManager [shutdown mode]"); + LOG(INFO) << "PayloadManager [shutdown mode]"; shutdown_barrier_->CountDown(); return true; } @@ -384,8 +386,7 @@ void PayloadManager::SendPayload(ClientProxy* client, const EndpointIds& endpoint_ids, Payload payload) { if (shutdown_.Get()) return; - NEARBY_LOG(INFO, "SendPayload: endpoint_ids={%s}", - ToString(endpoint_ids).c_str()); + LOG(INFO) << "SendPayload: endpoint_ids={" << ToString(endpoint_ids) << "}"; // Before transfer to internal payload, retrieves the Payload size for // analytics. std::int64_t payload_total_size; @@ -410,10 +411,10 @@ void PayloadManager::SendPayload(ClientProxy* client, RecordInvalidPayloadAnalytics(client, endpoint_ids, payload.GetId(), payload.GetType(), payload.GetOffset(), payload_total_size); - NEARBY_LOGS(INFO) - << "PayloadManager failed to determine the right executor for " - "outgoing payload_id=" - << payload.GetId() << ", payload_type=" << ToString(payload.GetType()); + LOG(INFO) << "PayloadManager failed to determine the right executor for " + "outgoing payload_id=" + << payload.GetId() + << ", payload_type=" << ToString(payload.GetType()); return; } @@ -429,55 +430,56 @@ void PayloadManager::SendPayload(ClientProxy* client, Payload::Id payload_id = CreateOutgoingPayload(std::move(payload), endpoint_ids); - executor->Execute( - "send-payload", [this, client, endpoint_ids, payload_id, payload_type, - resume_offset, payload_total_size]() { - if (shutdown_.Get()) return; - PendingPayloadHandle pending_payload = GetPayload(payload_id); - if (!pending_payload) { - RecordInvalidPayloadAnalytics(client, endpoint_ids, payload_id, - payload_type, resume_offset, - payload_total_size); - NEARBY_LOGS(INFO) - << "PayloadManager failed to create InternalPayload for outgoing " - "payload_id=" - << payload_id << ", payload_type=" << ToString(payload_type) - << ", aborting sendPayload()."; - return; - } - auto* internal_payload = pending_payload->GetInternalPayload(); - if (!internal_payload) return; + executor->Execute("send-payload", [this, client, endpoint_ids, payload_id, + payload_type, resume_offset, + payload_total_size]() { + if (shutdown_.Get()) return; + PendingPayloadHandle pending_payload = GetPayload(payload_id); + if (!pending_payload) { + RecordInvalidPayloadAnalytics(client, endpoint_ids, payload_id, + payload_type, resume_offset, + payload_total_size); + LOG(INFO) + << "PayloadManager failed to create InternalPayload for outgoing " + "payload_id=" + << payload_id << ", payload_type=" << ToString(payload_type) + << ", aborting sendPayload()."; + return; + } + auto* internal_payload = pending_payload->GetInternalPayload(); + if (!internal_payload) return; - RecordPayloadStartedAnalytics(client, endpoint_ids, payload_id, - payload_type, resume_offset, - internal_payload->GetTotalSize()); + RecordPayloadStartedAnalytics(client, endpoint_ids, payload_id, + payload_type, resume_offset, + internal_payload->GetTotalSize()); - PayloadTransferFrame::PayloadHeader payload_header{ - CreatePayloadHeader(*internal_payload, resume_offset, - internal_payload->GetParentFolder(), - internal_payload->GetFileName())}; + PayloadTransferFrame::PayloadHeader payload_header{CreatePayloadHeader( + *internal_payload, resume_offset, internal_payload->GetParentFolder(), + internal_payload->GetFileName())}; - bool should_continue = true; - std::int64_t next_chunk_offset = 0; + bool should_continue = true; + std::int64_t next_chunk_offset = 0; + int index = 0; - ThroughputRecorderContainer::GetInstance() - .GetTPRecorder(payload_id, PayloadDirection::OUTGOING_PAYLOAD) - ->Start(payload_type, PayloadDirection::OUTGOING_PAYLOAD); - while (should_continue && !shutdown_.Get()) { - should_continue = - SendPayloadLoop(client, *pending_payload, payload_header, - next_chunk_offset, resume_offset); - } + ThroughputRecorderContainer::GetInstance() + .GetTPRecorder(payload_id, PayloadDirection::OUTGOING_PAYLOAD) + ->Start(payload_type, PayloadDirection::OUTGOING_PAYLOAD); + while (should_continue && !shutdown_.Get()) { + should_continue = + SendPayloadLoop(client, *pending_payload, payload_header, + next_chunk_offset, resume_offset, index); + index++; + } - RunOnStatusUpdateThread("destroy-payload", - [this, payload_id]() - RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() { - DestroyPendingPayload(payload_id); - }); - }); - NEARBY_LOGS(INFO) << "PayloadManager: xfer scheduled: self=" << this - << "; payload_id=" << payload_id - << ", payload_type=" << ToString(payload_type); + RunOnStatusUpdateThread("destroy-payload", + [this, payload_id]() + RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() { + DestroyPendingPayload(payload_id); + }); + }); + LOG(INFO) << "PayloadManager: xfer scheduled: self=" << this + << "; payload_id=" << payload_id + << ", payload_type=" << ToString(payload_type); } PayloadManager::PendingPayloadHandle PayloadManager::GetPayload( @@ -489,17 +491,16 @@ Status PayloadManager::CancelPayload(ClientProxy* client, Payload::Id payload_id) { PendingPayloadHandle canceled_payload = GetPayload(payload_id); if (!canceled_payload) { - NEARBY_LOGS(INFO) << "Client requested cancel for unknown payload_id=" - << payload_id << ", ignoring."; + LOG(INFO) << "Client requested cancel for unknown payload_id=" << payload_id + << ", ignoring."; return {Status::kPayloadUnknown}; } // Mark the payload as canceled. canceled_payload->MarkLocallyCanceled(); - NEARBY_LOGS(INFO) << "Cancelling " - << (canceled_payload->IsIncoming() ? "incoming" - : "outgoing") - << " payload_id=" << payload_id << " at request of client."; + LOG(INFO) << "Cancelling " + << (canceled_payload->IsIncoming() ? "incoming" : "outgoing") + << " payload_id=" << payload_id << " at request of client."; // Return SUCCESS immediately. Remaining cleanup and updates will be sent // in SendPayload() or OnIncomingFrame() @@ -515,20 +516,46 @@ void PayloadManager::OnIncomingFrame( PayloadTransferFrame& frame = *offline_frame.mutable_v1()->mutable_payload_transfer(); + // Block any payload before the connection been accepted by both sides + // to prevent unauthorized transfer. + if (!to_client->IsConnectedToEndpoint(from_endpoint_id)) { + if (frame.packet_type() == PayloadTransferFrame::DATA) { + PendingPayloadHandle pending_payload = + pending_payloads_.GetPayload(frame.payload_header().id()); + bool is_last = IsLastChunk(frame.payload_chunk()); + // If payload need to be ack'd receiving, then send back the ACK frame. + if (pending_payload && is_last && + IsPayloadReceivedAckEnabled(to_client, from_endpoint_id, + *pending_payload)) { + SendPayloadReceivedAck(to_client, *pending_payload, from_endpoint_id, + is_last); + } + } + LOG(INFO) + << "PayloadManager skipped process payloads before PCP connected, " + << frame.payload_header().id(); + return; + } + switch (frame.packet_type()) { case PayloadTransferFrame::CONTROL: - NEARBY_LOGS(INFO) << "PayloadManager::OnIncomingFrame [CONTROL]: self=" - << this << "; endpoint_id=" << from_endpoint_id; + LOG(INFO) << "PayloadManager::OnIncomingFrame [CONTROL]: self=" << this + << "; endpoint_id=" << from_endpoint_id; ProcessControlPacket(to_client, from_endpoint_id, frame); break; case PayloadTransferFrame::DATA: ProcessDataPacket(to_client, from_endpoint_id, frame, current_medium, packet_meta_data); break; + case PayloadTransferFrame::PAYLOAD_ACK: + LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender " + "received payload ack from " + << from_endpoint_id; + ProcessPayloadAckPacket(from_endpoint_id, frame); + break; default: - NEARBY_LOGS(WARNING) - << "PayloadManager: invalid frame; remote endpoint: self=" << this - << "; endpoint_id=" << from_endpoint_id; + LOG(WARNING) << "PayloadManager: invalid frame; remote endpoint: self=" + << this << "; endpoint_id=" << from_endpoint_id; break; } } @@ -544,8 +571,8 @@ void PayloadManager::OnEndpointDisconnect(ClientProxy* client, } RunOnStatusUpdateThread( "payload-manager-on-disconnect", - [this, client, endpoint_id, - barrier, reason]() RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() mutable { + [this, client, endpoint_id, barrier, + reason]() RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() mutable { // Iterate through all our payloads and look for payloads associated // with this endpoint. MutexLock lock(&mutex_); @@ -574,20 +601,19 @@ void PayloadManager::OnEndpointDisconnect(ClientProxy* client, // Send a client notification of a payload transfer failure. client->OnPayloadProgress(endpoint_id, update); - PayloadStatus payload_status; - switch (reason) { - case DisconnectionReason::LOCAL_DISCONNECTION: - payload_status = PayloadStatus::LOCAL_CLIENT_DISCONNECTION; - break; - case DisconnectionReason::REMOTE_DISCONNECTION: - payload_status = PayloadStatus::REMOTE_CLIENT_DISCONNECTION; - break; - case DisconnectionReason::IO_ERROR: - default: - payload_status = PayloadStatus::ENDPOINT_IO_ERROR; - break; - } - + PayloadStatus payload_status; + switch (reason) { + case DisconnectionReason::LOCAL_DISCONNECTION: + payload_status = PayloadStatus::LOCAL_CLIENT_DISCONNECTION; + break; + case DisconnectionReason::REMOTE_DISCONNECTION: + payload_status = PayloadStatus::REMOTE_CLIENT_DISCONNECTION; + break; + case DisconnectionReason::IO_ERROR: + default: + payload_status = PayloadStatus::ENDPOINT_IO_ERROR; + break; + } if (pending_payload->IsIncoming()) { client->GetAnalyticsRecorder().OnIncomingPayloadDone( @@ -613,7 +639,7 @@ PayloadManager::EndpointInfoStatusToPayloadStatus(EndpointInfo::Status status) { case EndpointInfo::Status::kAvailable: return location::nearby::proto::connections::PayloadStatus::SUCCESS; default: - NEARBY_LOGS(INFO) << "PayloadManager: Unknown PayloadStatus"; + LOG(INFO) << "PayloadManager: Unknown PayloadStatus"; return location::nearby::proto::connections::PayloadStatus:: UNKNOWN_PAYLOAD_STATUS; } @@ -629,7 +655,7 @@ PayloadManager::ControlMessageEventToPayloadStatus( return location::nearby::proto::connections::PayloadStatus:: REMOTE_CANCELLATION; default: - NEARBY_LOG(INFO, "PayloadManager: unknown event=%d", event); + LOG(INFO) << "PayloadManager: unknown event=" << event; return location::nearby::proto::connections::PayloadStatus:: UNKNOWN_PAYLOAD_STATUS; } @@ -694,7 +720,8 @@ PayloadTransferFrame::PayloadHeader PayloadManager::CreatePayloadHeader( } PayloadTransferFrame::PayloadChunk PayloadManager::CreatePayloadChunk( - std::int64_t payload_chunk_offset, ByteArray payload_chunk_body) { + std::int64_t payload_chunk_offset, ByteArray payload_chunk_body, + int index) { PayloadTransferFrame::PayloadChunk payload_chunk; payload_chunk.set_offset(payload_chunk_offset); @@ -705,6 +732,7 @@ PayloadTransferFrame::PayloadChunk PayloadManager::CreatePayloadChunk( payload_chunk.set_flags(payload_chunk.flags() | PayloadTransferFrame::PayloadChunk::LAST_CHUNK); } + payload_chunk.set_index(index); return payload_chunk; } @@ -718,7 +746,7 @@ PayloadManager::PendingPayloadHandle PayloadManager::CreateIncomingPayload( } Payload::Id payload_id = internal_payload->GetId(); - NEARBY_LOGS(INFO) << "CreateIncomingPayload: payload_id=" << payload_id; + LOG(INFO) << "CreateIncomingPayload: payload_id=" << payload_id; pending_payloads_.StartTrackingPayload( payload_id, std::make_unique( @@ -728,8 +756,8 @@ PayloadManager::PendingPayloadHandle PayloadManager::CreateIncomingPayload( } void PayloadManager::OnPendingPayloadDestroy(const PendingPayload* payload) { - NEARBY_LOGS(INFO) << "PayloadManager: destroying " << payload->ToString() - << " self=" << this; + LOG(INFO) << "PayloadManager: destroying " << payload->ToString() + << " self=" << this; ThroughputRecorderContainer::GetInstance().StopTPRecorder( payload->GetId(), payload->IsIncoming() ? PayloadDirection::INCOMING_PAYLOAD @@ -829,23 +857,26 @@ void PayloadManager::SendControlMessage( endpoint_ids); } -void PayloadManager::SendPayloadReceivedAck( - ClientProxy* client, PendingPayload& pending_payload, - const std::string& endpoint_id, - const PayloadTransferFrame::PayloadHeader& payload_header, - std::int64_t chunk_size, bool is_last_chunk) { +void PayloadManager::SendPayloadReceivedAck(ClientProxy* client, + PendingPayload& pending_payload, + const std::string& endpoint_id, + bool is_last_chunk) { if (!is_last_chunk || !IsPayloadReceivedAckEnabled(client, endpoint_id, pending_payload)) { return; } - // Send the PAYLOAD_RECEIVED_ACK to the remote endpoint for the sender asap. - NEARBY_LOGS(INFO) - << "[PAYLOAD_RECEIVED_ACK] isLastChunk, receiver send ack to " - << endpoint_id; - SendControlMessage( - {endpoint_id}, payload_header, chunk_size, - PayloadTransferFrame::ControlMessage::PAYLOAD_RECEIVED_ACK); + send_payload_ack_executor_.Execute( + "send_payload_ack", [this, &pending_payload, endpoint_id]() { + endpoint_manager_->SendPayloadAck(pending_payload.GetId(), + {endpoint_id}); + LOG(INFO) << "[safe-to-disconnect] Send " + "PAYLOAD_RECEIVED_ACK frame to: " + << endpoint_id << " done"; + }); + // Send the PAYLOAD_RECEIVED_ACK to the remote endpoint for the sender asap. + LOG(INFO) << "[safe-to-disconnect] " << pending_payload.GetId() + << " isLastChunk, receiver send ack to " << endpoint_id; } bool PayloadManager::WaitForReceivedAck( @@ -858,19 +889,25 @@ bool PayloadManager::WaitForReceivedAck( return true; } - NEARBY_LOGS(INFO) << "[safe-to-disconnect] Last Chunk, sender wait for " - "PAYLOAD_RECEIVED_ACK frame from: " - << endpoint_id; + LOG(INFO) << "[safe-to-disconnect] Last Chunk, sender wait for " + "PAYLOAD_RECEIVED_ACK frame from: " + << endpoint_id; while (true) { PendingPayloadHandle latest_pending_payload = GetPayload(payload_header.id()); // Make sure we're still tracking this payload and its associated endpoint. if (!latest_pending_payload) { + LOG(INFO) << "[safe-to-disconnect] short-circuiting " + "latest_pending_payload is null for " + << payload_header.id() << ", stop wait ack."; return false; } auto* endpoint_info = latest_pending_payload->GetEndpoint(endpoint_id); if (endpoint_info == nullptr) { + LOG(INFO) << "[safe-to-disconnect] short-circuiting " + "endpointInfo is null for " + << payload_header.id() << ", stop wait ack."; return false; } @@ -880,6 +917,9 @@ bool PayloadManager::WaitForReceivedAck( payload_chunk_offset, location::nearby::proto::connections:: PayloadStatus::LOCAL_CANCELLATION); + LOG(INFO) << "[safe-to-disconnect] short-circuiting local " + "payload cancellation for " + << payload_header.id() << ", stop wait ack."; return false; } // Remote payload cancellation, etc @@ -888,11 +928,17 @@ bool PayloadManager::WaitForReceivedAck( HandleFinishedOutgoingPayload( client, {endpoint_id}, payload_header, payload_chunk_offset, EndpointInfoStatusToPayloadStatus(endpoint_info->status.Get())); + LOG(INFO) << "[safe-to-disconnect] short-circuiting remote " + "payload cancellation for " + << payload_header.id() << ", stop wait ack."; return false; } { MutexLock lock(&endpoint_info->payload_received_ack_mutex); if (endpoint_info->is_payload_received_ack) { + LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender already" + " received payload ack from " + << endpoint_id << ", stop wait PAYLOAD_RECEIVED_ACK."; endpoint_info->is_payload_received_ack = false; return true; } @@ -900,11 +946,27 @@ bool PayloadManager::WaitForReceivedAck( FeatureFlags::GetInstance() .GetFlags() .wait_payload_received_ack_millis); - endpoint_info->is_payload_received_ack = false; if (!wait_exception.Ok()) { + endpoint_info->is_payload_received_ack = false; + LOG(INFO) + << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender wait for " + "received payload ack from " + << endpoint_id << " end with exception: " << wait_exception.value; + return false; + } + if (endpoint_info->is_payload_received_ack) { + LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] Received " + "notification that sender " + "received payload ack from " + << endpoint_id; + endpoint_info->is_payload_received_ack = false; + return true; + } else { + LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender doesn't" + " received payload ack from " + << endpoint_id << ", end with timeout."; return false; } - return true; } } return true; @@ -940,9 +1002,8 @@ void PayloadManager::HandleFinishedOutgoingPayload( break; case location::nearby::proto::connections::PayloadStatus:: LOCAL_CANCELLATION: - NEARBY_LOGS(INFO) - << "Sending PAYLOAD_CANCEL to receiver side; payload_id=" - << payload_header.id(); + LOG(INFO) << "Sending PAYLOAD_CANCEL to receiver side; payload_id=" + << payload_header.id(); SendControlMessage( finished_endpoint_ids, payload_header, num_bytes_successfully_transferred, @@ -962,10 +1023,9 @@ void PayloadManager::HandleFinishedOutgoingPayload( // No special handling needed for these. break; default: - NEARBY_LOGS(INFO) - << "PayloadManager: Unhandled finished outgoing payload with " - "payload_status=" - << status; + LOG(INFO) << "PayloadManager: Unhandled finished outgoing payload with " + "payload_status=" + << status; break; } } @@ -990,9 +1050,8 @@ void PayloadManager::HandleFinishedIncomingPayload( PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED); break; default: - NEARBY_LOGS(INFO) << "Unhandled finished incoming payload_id=" - << payload_header.id() - << " with payload_status=" << status; + LOG(INFO) << "Unhandled finished incoming payload_id=" + << payload_header.id() << " with payload_status=" << status; break; } } @@ -1029,8 +1088,8 @@ void PayloadManager::HandleSuccessfulOutgoingChunk( PayloadTransferFrame::PayloadTransferFrame::PayloadHeader:: FILE) { if (!is_last_chunk && payload_chunk_offset != 0) { - NEARBY_LOGS(INFO) << "Skip the outgoing chunk update with offset=" - << payload_chunk_offset; + LOG(INFO) << "Skip the outgoing chunk update with offset=" + << payload_chunk_offset; client->GetAnalyticsRecorder().OnPayloadChunkSent( endpoint_id, payload_header.id(), payload_chunk_body_size); return; @@ -1040,10 +1099,9 @@ void PayloadManager::HandleSuccessfulOutgoingChunk( PendingPayloadHandle pending_payload = GetPayload(payload_header.id()); if (!pending_payload || !pending_payload->GetEndpoint(endpoint_id)) { - NEARBY_LOGS(INFO) - << "HandleSuccessfulOutgoingChunk: endpoint not found: " - "endpoint_id=" - << endpoint_id; + LOG(INFO) << "HandleSuccessfulOutgoingChunk: endpoint not found: " + "endpoint_id=" + << endpoint_id; return; } @@ -1113,8 +1171,8 @@ void PayloadManager::HandleSuccessfulIncomingChunk( PayloadTransferFrame::PayloadTransferFrame::PayloadHeader:: FILE) { if (!is_last_chunk && payload_chunk_offset != 0) { - NEARBY_LOGS(INFO) << "Skip the incoming chunk update with offset=" - << payload_chunk_offset; + LOG(INFO) << "Skip the incoming chunk update with offset=" + << payload_chunk_offset; client->GetAnalyticsRecorder().OnPayloadChunkReceived( endpoint_id, payload_header.id(), payload_chunk_body_size); return; @@ -1140,6 +1198,7 @@ void PayloadManager::HandleSuccessfulIncomingChunk( // Analyze the success. if (is_last_chunk) { + DestroyPendingPayload(payload_header.id()); client->GetAnalyticsRecorder().OnIncomingPayloadDone( endpoint_id, payload_header.id(), location::nearby::proto::connections::SUCCESS); @@ -1159,10 +1218,20 @@ void PayloadManager::ProcessDataPacket( *payload_transfer_frame.mutable_payload_header(); PayloadTransferFrame::PayloadChunk& payload_chunk = *payload_transfer_frame.mutable_payload_chunk(); - NEARBY_LOGS(VERBOSE) << "PayloadManager got data OfflineFrame for payload_id=" - << payload_header.id() - << " from endpoint_id=" << from_endpoint_id - << " at offset " << payload_chunk.offset(); + NEARBY_VLOG(1) << "PayloadManager got data OfflineFrame for payload_id=" + << payload_header.id() + << " from endpoint_id=" << from_endpoint_id << " at offset " + << payload_chunk.offset(); + // We explicitly deny payloads with ID 0. + if (payload_header.id() == 0) { + LOG(WARNING) << "Denying payload with ID 0 for endpoint_id=" + << from_endpoint_id << ", aborting receipt."; + // Send the error to the remote endpoint. + SendControlMessage({from_endpoint_id}, payload_header, + payload_chunk.offset(), + PayloadTransferFrame::ControlMessage::PAYLOAD_ERROR); + return; + } Payload::Id payload_id = payload_header.id(); PendingPayloadHandle pending_payload; if (payload_chunk.offset() == 0) { @@ -1185,11 +1254,10 @@ void PayloadManager::ProcessDataPacket( pending_payload = CreateIncomingPayload(payload_transfer_frame, from_endpoint_id); if (!pending_payload) { - NEARBY_LOGS(WARNING) - << "PayloadManager failed to create InternalPayload from " - "PayloadTransferFrame with payload_id=" - << payload_header.id() << " and type " << payload_header.type() - << ", aborting receipt."; + LOG(WARNING) << "PayloadManager failed to create InternalPayload from " + "PayloadTransferFrame with payload_id=" + << payload_header.id() << " and type " + << payload_header.type() << ", aborting receipt."; // Send the error to the remote endpoint. SendControlMessage({from_endpoint_id}, payload_header, payload_chunk.offset(), @@ -1203,10 +1271,9 @@ void PayloadManager::ProcessDataPacket( pending_payload = GetPayload(payload_id)]() RUN_ON_PAYLOAD_STATUS_UPDATE_THREAD() { if (!pending_payload) return; - NEARBY_LOGS(INFO) - << "PayloadManager received new payload_id=" - << pending_payload->GetInternalPayload()->GetId() - << " from endpoint_id=" << from_endpoint_id; + LOG(INFO) << "PayloadManager received new payload_id=" + << pending_payload->GetInternalPayload()->GetId() + << " from endpoint_id=" << from_endpoint_id; to_client->OnPayload( from_endpoint_id, pending_payload->GetInternalPayload()->ReleasePayload()); @@ -1216,17 +1283,15 @@ void PayloadManager::ProcessDataPacket( } if (!pending_payload) { - NEARBY_LOGS(WARNING) << "ProcessDataPacket: [missing] endpoint_id=" - << from_endpoint_id - << "; payload_id=" << payload_header.id(); + LOG(WARNING) << "ProcessDataPacket: [missing] endpoint_id=" + << from_endpoint_id << "; payload_id=" << payload_header.id(); return; } if (pending_payload->IsLocallyCanceled()) { // This incoming payload was canceled by the client. Drop this frame and // do all the cleanup. See go/nc-cancel-payload - NEARBY_LOGS(INFO) << "ProcessDataPacket: [cancel] endpoint_id=" - << from_endpoint_id - << "; payload_id=" << pending_payload->GetId(); + LOG(INFO) << "ProcessDataPacket: [cancel] endpoint_id=" << from_endpoint_id + << "; payload_id=" << pending_payload->GetId(); HandleFinishedIncomingPayload(to_client, from_endpoint_id, payload_header, payload_chunk.offset(), location::nearby::proto::connections:: @@ -1249,9 +1314,9 @@ void PayloadManager::ProcessDataPacket( if (pending_payload->GetInternalPayload() ->AttachNextChunk(ByteArray(std::move(*payload_chunk.mutable_body()))) .Raised()) { - NEARBY_LOGS(ERROR) << "ProcessDataPacket: [data: error] endpoint_id=" - << from_endpoint_id - << "; payload_id=" << pending_payload->GetId(); + LOG(ERROR) << "ProcessDataPacket: [data: error] endpoint_id=" + << from_endpoint_id + << "; payload_id=" << pending_payload->GetId(); HandleFinishedIncomingPayload( to_client, from_endpoint_id, payload_header, payload_chunk.offset(), location::nearby::proto::connections::PayloadStatus::LOCAL_ERROR); @@ -1260,9 +1325,8 @@ void PayloadManager::ProcessDataPacket( packet_meta_data.StopFileIo(); bool is_last_chunk = (payload_chunk.flags() & PayloadTransferFrame::PayloadChunk::LAST_CHUNK) != 0; - SendPayloadReceivedAck( - to_client, *pending_payload, from_endpoint_id, payload_header, - payload_chunk.offset() + payload_body_size, is_last_chunk); + SendPayloadReceivedAck(to_client, *pending_payload, from_endpoint_id, + is_last_chunk); HandleSuccessfulIncomingChunk(to_client, from_endpoint_id, payload_header, payload_chunk.flags(), payload_chunk.offset(), @@ -1288,17 +1352,17 @@ void PayloadManager::ProcessControlPacket( payload_transfer_frame.control_message(); PendingPayloadHandle pending_payload = GetPayload(payload_header.id()); if (!pending_payload) { - NEARBY_LOGS(INFO) << "Got ControlMessage for unknown payload_id=" - << payload_header.id() - << ", ignoring: " << control_message.event(); + LOG(INFO) << "Got ControlMessage for unknown payload_id=" + << payload_header.id() + << ", ignoring: " << control_message.event(); return; } switch (control_message.event()) { case PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED: if (pending_payload->IsIncoming()) { - NEARBY_LOGS(INFO) << "Incoming PAYLOAD_CANCELED: from endpoint_id=" - << from_endpoint_id << "; self=" << this; + LOG(INFO) << "Incoming PAYLOAD_CANCELED: from endpoint_id=" + << from_endpoint_id << "; self=" << this; // No need to mark the pending payload as cancelled, since this is a // remote cancellation for an incoming payload -- we handle everything // inline here. @@ -1307,13 +1371,13 @@ void PayloadManager::ProcessControlPacket( control_message.offset(), ControlMessageEventToPayloadStatus(control_message.event())); } else { - NEARBY_LOGS(INFO) << "Outgoing PAYLOAD_CANCELED: from endpoint_id=" - << from_endpoint_id << "; self=" << this; + LOG(INFO) << "Outgoing PAYLOAD_CANCELED: from endpoint_id=" + << from_endpoint_id << "; self=" << this; // Mark the payload as canceled *for this endpoint*. pending_payload->SetEndpointStatusFromControlMessage(from_endpoint_id, control_message); } - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "Marked " << (pending_payload->IsIncoming() ? "incoming" : "outgoing") << " payload_id=" << pending_payload->GetInternalPayload()->GetId() @@ -1330,25 +1394,38 @@ void PayloadManager::ProcessControlPacket( control_message); } break; - case PayloadTransferFrame::ControlMessage::PAYLOAD_RECEIVED_ACK: - if (!pending_payload->IsIncoming() && - IsPayloadReceivedAckEnabled(to_client, from_endpoint_id, - *pending_payload)) { - NEARBY_LOGS(INFO) << "[safe-to-disconnect]Sender received " - "PAYLOAD_RECEIVED_ACK frame with id:" - << pending_payload->GetInternalPayload()->GetId() - << " from endpoint_id=" << from_endpoint_id; - pending_payload->MarkReceivedAckFromEndpoint(from_endpoint_id); - } - break; default: - NEARBY_LOGS(INFO) << "Unhandled control message " - << control_message.event() << " for payload_id=" - << pending_payload->GetInternalPayload()->GetId(); + LOG(INFO) << "Unhandled control message " << control_message.event() + << " for payload_id=" + << pending_payload->GetInternalPayload()->GetId(); break; } } +void PayloadManager::ProcessPayloadAckPacket( + const std::string& from_endpoint_id, + PayloadTransferFrame& payload_transfer_frame) { + auto payload_header = payload_transfer_frame.payload_header(); + PendingPayloadHandle pending_payload = GetPayload(payload_header.id()); + if (!pending_payload) { + LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] " + "short-circuiting got payload " + "ack for unknown payload " + << payload_header.id() << ", ignoring"; + return; + } + if (pending_payload->IsIncoming()) { + LOG(INFO) << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] " + "short-circuiting got Payload " + "ack for incoming payload " + << payload_header.id() << ", ignoring"; + } + LOG(INFO) + << "[safe-to-disconnect][PAYLOAD_RECEIVED_ACK] sender received payload " + << payload_header.id() << " ack from " << from_endpoint_id; + pending_payload->MarkReceivedAckFromEndpoint(from_endpoint_id); +} + // @PayloadManagerStatusUpdateThread void PayloadManager::NotifyClientOfIncomingPayloadProgressInfo( ClientProxy* client, const std::string& endpoint_id, @@ -1410,9 +1487,8 @@ PayloadManager::EndpointInfo::ControlMessageEventToEndpointInfoStatus( case PayloadTransferFrame::ControlMessage::PAYLOAD_CANCELED: return Status::kCanceled; default: - NEARBY_LOGS(INFO) - << "Unknown EndpointInfo.Status for ControlMessage.EventType " - << event; + LOG(INFO) << "Unknown EndpointInfo.Status for ControlMessage.EventType " + << event; return Status::kUnknown; } } @@ -1420,9 +1496,8 @@ PayloadManager::EndpointInfo::ControlMessageEventToEndpointInfoStatus( void PayloadManager::EndpointInfo::SetStatusFromControlMessage( const PayloadTransferFrame::ControlMessage& control_message) { status.Set(ControlMessageEventToEndpointInfoStatus(control_message.event())); - NEARBY_LOGS(VERBOSE) << "Marked endpoint " << id << " with status " - << ToString(status.Get()) - << " based on OOB ControlMessage"; + NEARBY_VLOG(1) << "Marked endpoint " << id << " with status " + << ToString(status.Get()) << " based on OOB ControlMessage"; } void PayloadManager::EndpointInfo::MarkReceivedAckFromEndpoint() { @@ -1564,7 +1639,7 @@ void PayloadManager::PendingPayloads::StartTrackingPayload( // If the |payload_id| is being re-used, always prefer the newer payload. Remove(pending_payloads_.find(payload_id)); - NEARBY_LOGS(INFO) << "StartTrackingPayload: " << pending_payload->ToString(); + LOG(INFO) << "StartTrackingPayload: " << pending_payload->ToString(); pending_payload->IncRefCount(); pending_payloads_[payload_id] = std::move(pending_payload); } @@ -1572,7 +1647,7 @@ void PayloadManager::PendingPayloads::StartTrackingPayload( void PayloadManager::PendingPayloads::StopTrackingPayload( Payload::Id payload_id) { MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << "StopTrackingPayload " << payload_id; + LOG(INFO) << "StopTrackingPayload " << payload_id; Remove(pending_payloads_.find(payload_id)); } @@ -1583,12 +1658,12 @@ void PayloadManager::PendingPayloads::Remove( int refcount = it->second->DecRefCount(); if (refcount == 0) { // Nobody is using the payload, we can remove it. - NEARBY_LOGS(VERBOSE) << "Erase payload " << it->second->ToString(); + NEARBY_VLOG(1) << "Erase payload " << it->second->ToString(); pending_payloads_.erase(it); } else { // Someone is still using the payload. Move it to the garbage bin. The // payload will be removed when they release it. - NEARBY_LOGS(VERBOSE) << "Bin payload " << it->second->ToString(); + NEARBY_VLOG(1) << "Bin payload " << it->second->ToString(); payload_garbage_bin_.push_back( std::move(pending_payloads_.extract(it).mapped())); } @@ -1630,7 +1705,7 @@ void PayloadManager::PendingPayloads::ForEachPayload( void PayloadManager::PendingPayloads::Release(PendingPayload* payload) { // Called when `PendingPayloadHandle` is destroyed. MutexLock lock(&mutex_); - NEARBY_LOGS(VERBOSE) << __func__ << " " << payload->ToString(); + NEARBY_VLOG(1) << __func__ << " " << payload->ToString(); auto it = pending_payloads_.find(payload->GetId()); if (it != pending_payloads_.end() && it->second.get() == payload) { // The payload is still tracked. diff --git a/connections/implementation/payload_manager.h b/connections/implementation/payload_manager.h index 768841d1..29d178c0 100644 --- a/connections/implementation/payload_manager.h +++ b/connections/implementation/payload_manager.h @@ -31,6 +31,7 @@ #include "connections/implementation/internal_payload.h" #include "connections/listeners.h" #include "connections/payload.h" +#include "connections/payload_type.h" #include "connections/status.h" #include "internal/platform/atomic_boolean.h" #include "internal/platform/atomic_reference.h" @@ -38,6 +39,7 @@ #include "internal/platform/condition_variable.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/mutex.h" +#include "internal/platform/single_thread_executor.h" namespace nearby { namespace connections { @@ -270,7 +272,8 @@ class PayloadManager : public EndpointManager::FrameProcessor { bool SendPayloadLoop(ClientProxy* client, PendingPayload& pending_payload, PayloadTransferFrame::PayloadHeader& payload_header, - std::int64_t& next_chunk_offset, size_t resume_offset); + std::int64_t& next_chunk_offset, size_t resume_offset, + int index); void SendClientCallbacksForFinishedIncomingPayloadRunnable( ClientProxy* client, const std::string& endpoint_id, const PayloadTransferFrame::PayloadHeader& payload_header, @@ -298,7 +301,8 @@ class PayloadManager : public EndpointManager::FrameProcessor { const std::string& parent_folder, const std::string& file_name); PayloadTransferFrame::PayloadChunk CreatePayloadChunk(std::int64_t offset, - ByteArray body); + ByteArray body, + int index); bool IsLastChunk(PayloadTransferFrame::PayloadChunk payload_chunk) { return ((payload_chunk.flags() & PayloadTransferFrame::PayloadChunk::LAST_CHUNK) != 0); @@ -331,9 +335,7 @@ class PayloadManager : public EndpointManager::FrameProcessor { void SendPayloadReceivedAck( ClientProxy* client, PendingPayload& pending_payload, - const std::string& endpoint_id, - const PayloadTransferFrame::PayloadHeader& payload_header, - std::int64_t chunk_size, bool is_last_chunk); + const std::string& endpoint_id, bool is_last_chunk); bool WaitForReceivedAck( ClientProxy* client, const std::string& endpoint_id, @@ -377,6 +379,8 @@ class PayloadManager : public EndpointManager::FrameProcessor { void ProcessControlPacket(ClientProxy* to_client, const std::string& from_endpoint_id, PayloadTransferFrame& payload_transfer_frame); + void ProcessPayloadAckPacket(const std::string& from_endpoint_id, + PayloadTransferFrame& payload_transfer_frame); void NotifyClientOfIncomingPayloadProgressInfo( ClientProxy* client, const std::string& endpoint_id, @@ -420,6 +424,7 @@ class PayloadManager : public EndpointManager::FrameProcessor { SingleThreadExecutor file_payload_executor_; SingleThreadExecutor stream_payload_executor_; SingleThreadExecutor payload_status_update_executor_; + SingleThreadExecutor send_payload_ack_executor_; PendingPayloads pending_payloads_; EndpointManager* endpoint_manager_; diff --git a/connections/implementation/payload_manager_test.cc b/connections/implementation/payload_manager_test.cc index f1984264..797b0b16 100644 --- a/connections/implementation/payload_manager_test.cc +++ b/connections/implementation/payload_manager_test.cc @@ -21,13 +21,18 @@ #include "gtest/gtest.h" #include "absl/strings/string_view.h" #include "absl/time/time.h" +#include "connections/implementation/analytics/packet_meta_data.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "connections/implementation/offline_frames.h" #include "connections/implementation/simulation_user.h" #include "connections/listeners.h" #include "connections/medium_selector.h" #include "connections/payload.h" #include "connections/status.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" #include "internal/platform/pipe.h" @@ -35,6 +40,9 @@ namespace nearby { namespace connections { namespace { +using ::location::nearby::connections::OfflineFrame; +using ::nearby::analytics::PacketMetaData; +using ::location::nearby::proto::connections::Medium; constexpr size_t kChunkSize = 64 * 1024; constexpr absl::string_view kServiceId = "service-id"; @@ -90,6 +98,29 @@ class PayloadSimulationUser : public SimulationUser { pm_.SendPayload(&client_, {discovered_.endpoint_id}, std::move(payload)); } + void ReceivePayload(Payload payload, std::string from_payload_id) { + PayloadTransferFrame::PayloadHeader header; + header.set_id(payload.GetId()); + header.set_type(PayloadTransferFrame::PayloadHeader::FILE); + header.set_total_size(payload.AsBytes().size()); + header.set_file_name("test_file.txt"); + header.set_parent_folder(""); + PayloadTransferFrame::PayloadChunk chunk; + chunk.set_body(payload.AsBytes().data()); + chunk.set_offset(payload.GetOffset()); + chunk.set_flags(1); + + OfflineFrame offline_frame; + + ByteArray bytes = parser::ForDataPayloadTransfer(header, chunk); + offline_frame.ParseFromString(std::string(bytes)); + + PacketMetaData packet_meta_data; + + pm_.OnIncomingFrame(offline_frame, from_payload_id, &client_, + Medium::WIFI_HOTSPOT, packet_meta_data); + } + Status CancelPayload() { if (sender_payload_id_) { return pm_.CancelPayload(&client_, sender_payload_id_); @@ -117,18 +148,18 @@ class PayloadManagerTest EXPECT_EQ(user_b.GetDiscovered().service_id, kServiceId); EXPECT_EQ(user_b.GetDiscovered().endpoint_info, user_a.GetInfo()); EXPECT_FALSE(user_b.GetDiscovered().endpoint_id.empty()); - NEARBY_LOG(INFO, "EP-B: [discovered] %s", - user_b.GetDiscovered().endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "EP-B: [discovered] " + << user_b.GetDiscovered().endpoint_id; user_b.RequestConnection(&connection_latch_); EXPECT_TRUE(connection_latch_.Await(kDefaultTimeout).result()); EXPECT_FALSE(user_a.GetDiscovered().endpoint_id.empty()); - NEARBY_LOG(INFO, "EP-A: [discovered] %s", - user_a.GetDiscovered().endpoint_id.c_str()); - NEARBY_LOG(INFO, "Both users discovered their peers."); + NEARBY_LOGS(INFO) << "EP-A: [discovered] " + << user_a.GetDiscovered().endpoint_id; + NEARBY_LOGS(INFO) << "Both users discovered their peers."; user_a.AcceptConnection(&accept_latch_); user_b.AcceptConnection(&accept_latch_); EXPECT_TRUE(accept_latch_.Await(kDefaultTimeout).result()); - NEARBY_LOG(INFO, "Both users reached connected state."); + NEARBY_LOGS(INFO) << "Both users reached connected state."; return user_a.IsConnected() && user_b.IsConnected(); } @@ -162,7 +193,22 @@ TEST_P(PayloadManagerTest, CanSendBytePayload) { user_b.SendPayload(Payload(ByteArray{std::string(kMessage)})); EXPECT_TRUE(payload_latch_.Await(kDefaultTimeout).result()); EXPECT_EQ(user_a.GetPayload().AsBytes(), ByteArray(std::string(kMessage))); - NEARBY_LOG(INFO, "Test completed."); + NEARBY_LOGS(INFO) << "Test completed."; + + user_a.Stop(); + user_b.Stop(); + env_.Stop(); +} + +TEST_P(PayloadManagerTest, PayloadId0IsError) { + env_.Start(); + PayloadSimulationUser user_a(kDeviceA, GetParam()); + PayloadSimulationUser user_b(kDeviceB, GetParam()); + ASSERT_TRUE(SetupConnection(user_a, user_b)); + + user_a.ExpectPayload(payload_latch_); + user_b.SendPayload(Payload(0, ByteArray{std::string(kMessage)})); + EXPECT_FALSE(payload_latch_.Await(kDefaultTimeout).result()); user_a.Stop(); user_b.Stop(); @@ -186,7 +232,7 @@ TEST_P(PayloadManagerTest, CanSendStreamPayload) { ASSERT_TRUE(payload_latch_.Await(kDefaultTimeout).result()); ASSERT_NE(user_a.GetPayload().AsStream(), nullptr); InputStream& rx = *user_a.GetPayload().AsStream(); - NEARBY_LOG(INFO, "Stream extracted."); + NEARBY_LOGS(INFO) << "Stream extracted."; EXPECT_TRUE(user_a.WaitForProgress( [&message](const PayloadProgressInfo& info) { @@ -195,7 +241,7 @@ TEST_P(PayloadManagerTest, CanSendStreamPayload) { kProgressTimeout)); ByteArray result = rx.Read(kChunkSize).result(); EXPECT_EQ(result, message); - NEARBY_LOG(INFO, "Packet 1 handled."); + NEARBY_LOGS(INFO) << "Packet 1 handled."; tx->Write(message); EXPECT_TRUE(user_a.WaitForProgress( @@ -205,11 +251,11 @@ TEST_P(PayloadManagerTest, CanSendStreamPayload) { kProgressTimeout)); ByteArray result2 = rx.Read(kChunkSize).result(); EXPECT_EQ(result2, message); - NEARBY_LOG(INFO, "Packet 2 handled."); + NEARBY_LOGS(INFO) << "Packet 2 handled."; rx.Close(); tx->Close(); - NEARBY_LOG(INFO, "Test completed."); + NEARBY_LOGS(INFO) << "Test completed."; user_a.Stop(); user_b.Stop(); env_.Stop(); @@ -229,7 +275,7 @@ TEST_P(PayloadManagerTest, CanCancelPayloadOnReceiverSide) { ASSERT_TRUE(payload_latch_.Await(kDefaultTimeout).result()); ASSERT_NE(user_a.GetPayload().AsStream(), nullptr); InputStream& rx = *user_a.GetPayload().AsStream(); - NEARBY_LOG(INFO, "Stream extracted."); + NEARBY_LOGS(INFO) << "Stream extracted."; EXPECT_TRUE(user_a.WaitForProgress( [&message](const PayloadProgressInfo& info) { @@ -238,10 +284,10 @@ TEST_P(PayloadManagerTest, CanCancelPayloadOnReceiverSide) { kProgressTimeout)); ByteArray result = rx.Read(kChunkSize).result(); EXPECT_EQ(result, message); - NEARBY_LOG(INFO, "Packet 1 handled."); + NEARBY_LOGS(INFO) << "Packet 1 handled."; EXPECT_EQ(user_a.CancelPayload(), Status{Status::kSuccess}); - NEARBY_LOG(INFO, "Stream canceled on receiver side."); + NEARBY_LOGS(INFO) << "Stream canceled on receiver side."; // Sender will only handle cancel event if it is sending. // Once cancel is handled, write will fail. @@ -257,12 +303,12 @@ TEST_P(PayloadManagerTest, CanCancelPayloadOnReceiverSide) { [status = PayloadProgressInfo::Status::kCanceled]( const PayloadProgressInfo& info) { return info.status == status; }, kProgressTimeout)); - NEARBY_LOG(INFO, "Stream cancelation received."); + NEARBY_LOGS(INFO) << "Stream cancelation received."; tx->Close(); rx.Close(); - NEARBY_LOG(INFO, "Test completed."); + NEARBY_LOGS(INFO) << "Test completed."; user_a.Stop(); user_b.Stop(); env_.Stop(); @@ -282,7 +328,7 @@ TEST_P(PayloadManagerTest, CanCancelPayloadOnSenderSide) { ASSERT_TRUE(payload_latch_.Await(kDefaultTimeout).result()); ASSERT_NE(user_a.GetPayload().AsStream(), nullptr); InputStream& rx = *user_a.GetPayload().AsStream(); - NEARBY_LOG(INFO, "Stream extracted."); + NEARBY_LOGS(INFO) << "Stream extracted."; EXPECT_TRUE(user_a.WaitForProgress( [&message](const PayloadProgressInfo& info) { @@ -291,10 +337,10 @@ TEST_P(PayloadManagerTest, CanCancelPayloadOnSenderSide) { kProgressTimeout)); ByteArray result = rx.Read(kChunkSize).result(); EXPECT_EQ(result, message); - NEARBY_LOG(INFO, "Packet 1 handled."); + NEARBY_LOGS(INFO) << "Packet 1 handled."; EXPECT_EQ(user_b.CancelPayload(), Status{Status::kSuccess}); - NEARBY_LOG(INFO, "Stream canceled on sender side."); + NEARBY_LOGS(INFO) << "Stream canceled on sender side."; // Sender will only handle cancel event if it is sending. // Once cancel is handled, write will fail. @@ -310,12 +356,12 @@ TEST_P(PayloadManagerTest, CanCancelPayloadOnSenderSide) { [status = PayloadProgressInfo::Status::kCanceled]( const PayloadProgressInfo& info) { return info.status == status; }, kProgressTimeout)); - NEARBY_LOG(INFO, "Stream cancelation received."); + NEARBY_LOGS(INFO) << "Stream cancelation received."; tx->Close(); rx.Close(); - NEARBY_LOG(INFO, "Test completed."); + NEARBY_LOGS(INFO) << "Test completed."; user_a.Stop(); user_b.Stop(); env_.Stop(); @@ -340,7 +386,7 @@ TEST_P(PayloadManagerTest, SendPayloadWithSkip_StreamPayload) { ASSERT_TRUE(payload_latch_.Await(kDefaultTimeout).result()); ASSERT_NE(user_a.GetPayload().AsStream(), nullptr); InputStream& rx = *user_a.GetPayload().AsStream(); - NEARBY_LOG(INFO, "Stream extracted."); + NEARBY_LOGS(INFO) << "Stream extracted."; EXPECT_TRUE(user_a.WaitForProgress( [&message](const PayloadProgressInfo& info) { @@ -349,7 +395,7 @@ TEST_P(PayloadManagerTest, SendPayloadWithSkip_StreamPayload) { kProgressTimeout)); ByteArray result = rx.Read(kChunkSize).result(); EXPECT_EQ(result, ByteArray("sage")); - NEARBY_LOG(INFO, "Packet 1 handled."); + NEARBY_LOGS(INFO) << "Packet 1 handled."; tx->Write(message); EXPECT_TRUE(user_a.WaitForProgress( @@ -359,16 +405,29 @@ TEST_P(PayloadManagerTest, SendPayloadWithSkip_StreamPayload) { kProgressTimeout)); ByteArray result2 = rx.Read(kChunkSize).result(); EXPECT_EQ(result2, message); - NEARBY_LOG(INFO, "Packet 2 handled."); + NEARBY_LOGS(INFO) << "Packet 2 handled."; rx.Close(); tx->Close(); - NEARBY_LOG(INFO, "Test completed."); + NEARBY_LOGS(INFO) << "Test completed."; user_a.Stop(); user_b.Stop(); env_.Stop(); } +TEST_P(PayloadManagerTest, OfflineFrame_BeforeConnected_ShouldDrop) { + env_.Start(); + PayloadSimulationUser user(kDeviceB, GetParam()); + auto [input, tx] = CreatePipe(); + const ByteArray message{std::string(kMessage)}; + tx->Write(message); + Payload payload(std::move(input)); + user.ReceivePayload(std::move(payload), "1234"); + ASSERT_EQ(user.GetPayload().AsStream(), nullptr); + user.Stop(); + env_.Stop(); +} + INSTANTIATE_TEST_SUITE_P(ParametrisedPayloadManagerTest, PayloadManagerTest, ::testing::ValuesIn(kTestCases)); diff --git a/connections/implementation/pcp_handler.h b/connections/implementation/pcp_handler.h index 8a738e8f..16d9273a 100644 --- a/connections/implementation/pcp_handler.h +++ b/connections/implementation/pcp_handler.h @@ -25,6 +25,7 @@ #include "connections/params.h" #include "connections/status.h" #include "connections/strategy.h" +#include "internal/interop/device.h" namespace nearby { namespace connections { @@ -82,7 +83,7 @@ class PcpHandler { virtual Status StartDiscovery(ClientProxy* client, const std::string& service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener) = 0; + DiscoveryListener listener) = 0; // If Discovery is active, stop it, and change CLientProxy state, // otherwise do nothing. @@ -109,6 +110,11 @@ class PcpHandler { const ConnectionRequestInfo& info, const ConnectionOptions& connection_options) = 0; + virtual Status RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) = 0; + // Either party may call this to accept connection on their part. // Until both parties call it, connection will not reach a data phase. // Update state in ClientProxy. diff --git a/connections/implementation/pcp_manager.cc b/connections/implementation/pcp_manager.cc index 2c78f57c..999de6e4 100644 --- a/connections/implementation/pcp_manager.cc +++ b/connections/implementation/pcp_manager.cc @@ -14,12 +14,36 @@ #include "connections/implementation/pcp_manager.h" +#include +#include +#include #include +#include "absl/strings/string_view.h" +#include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" +#include "connections/implementation/bwu_manager.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_manager.h" +#include "connections/implementation/injected_bluetooth_device_store.h" +#include "connections/implementation/mediums/mediums.h" #include "connections/implementation/p2p_cluster_pcp_handler.h" #include "connections/implementation/p2p_point_to_point_pcp_handler.h" #include "connections/implementation/p2p_star_pcp_handler.h" +#include "connections/implementation/pcp.h" #include "connections/implementation/pcp_handler.h" +#include "connections/listeners.h" +#include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/params.h" +#include "connections/status.h" +#include "connections/strategy.h" +#include "connections/v3/connection_listening_options.h" +#include "connections/v3/listeners.h" +#include "internal/interop/device.h" +#include "internal/platform/logging.h" namespace nearby { namespace connections { @@ -55,13 +79,16 @@ PcpManager::~PcpManager() { } Status PcpManager::StartAdvertising( - ClientProxy* client, const string& service_id, + ClientProxy* client, const std::string& service_id, const AdvertisingOptions& advertising_options, const ConnectionRequestInfo& info) { if (!SetCurrentPcpHandler(advertising_options.strategy)) { return {Status::kError}; } + client->SetWebRtcNonCellular(GetWebRtcNonCellular( + advertising_options.CompatibleOptions().allowed.GetMediums(true))); + return current_->StartAdvertising(client, service_id, advertising_options, info); } @@ -72,7 +99,8 @@ void PcpManager::StopAdvertising(ClientProxy* client) { } } -Status PcpManager::StartDiscovery(ClientProxy* client, const string& service_id, +Status PcpManager::StartDiscovery(ClientProxy* client, + const std::string& service_id, const DiscoveryOptions& discovery_options, DiscoveryListener listener) { if (!SetCurrentPcpHandler(discovery_options.strategy)) { @@ -116,19 +144,35 @@ void PcpManager::InjectEndpoint(ClientProxy* client, } Status PcpManager::RequestConnection( - ClientProxy* client, const string& endpoint_id, + ClientProxy* client, const std::string& endpoint_id, const ConnectionRequestInfo& info, const ConnectionOptions& connection_options) { if (!current_) { return {Status::kOutOfOrderApiCall}; } + client->SetWebRtcNonCellular( + GetWebRtcNonCellular(connection_options.GetMediums())); + return current_->RequestConnection(client, endpoint_id, info, connection_options); } +Status PcpManager::RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) { + // TODO(b/300174495): Add test coverage for when |current_| is nullptr. + if (!current_) { + return {Status::kOutOfOrderApiCall}; + } + + return current_->RequestConnectionV3(client, remote_device, info, + connection_options); +} + Status PcpManager::AcceptConnection(ClientProxy* client, - const string& endpoint_id, + const std::string& endpoint_id, PayloadListener payload_listener) { if (!current_) { return {Status::kOutOfOrderApiCall}; @@ -139,7 +183,7 @@ Status PcpManager::AcceptConnection(ClientProxy* client, } Status PcpManager::RejectConnection(ClientProxy* client, - const string& endpoint_id) { + const std::string& endpoint_id) { if (!current_) { return {Status::kOutOfOrderApiCall}; } @@ -171,8 +215,8 @@ bool PcpManager::SetCurrentPcpHandler(Strategy strategy) { current_ = GetPcpHandler(StrategyToPcp(strategy)); if (!current_) { - NEARBY_LOG(ERROR, "Failed to set current PCP handler: strategy=%s", - strategy.GetName().c_str()); + NEARBY_LOGS(ERROR) << "Failed to set current PCP handler: strategy=" + << strategy.GetName(); } return current_; @@ -183,5 +227,14 @@ PcpHandler* PcpManager::GetPcpHandler(Pcp pcp) const { return item != handlers_.end() ? item->second.get() : nullptr; } +bool PcpManager::GetWebRtcNonCellular(const std::vector& mediums) { + for (const auto& medium : mediums) { + if (medium == Medium::WEB_RTC_NON_CELLULAR) { + return true; + } + } + return false; +} + } // namespace connections } // namespace nearby diff --git a/connections/implementation/pcp_manager.h b/connections/implementation/pcp_manager.h index 5e59a6c5..7649f304 100644 --- a/connections/implementation/pcp_manager.h +++ b/connections/implementation/pcp_manager.h @@ -15,9 +15,16 @@ #ifndef CORE_INTERNAL_PCP_MANAGER_H_ #define CORE_INTERNAL_PCP_MANAGER_H_ +#include #include +#include +#include #include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "connections/advertising_options.h" +#include "connections/connection_options.h" +#include "connections/discovery_options.h" #include "connections/implementation/base_pcp_handler.h" #include "connections/implementation/bwu_manager.h" #include "connections/implementation/client_proxy.h" @@ -25,9 +32,16 @@ #include "connections/implementation/endpoint_manager.h" #include "connections/implementation/injected_bluetooth_device_store.h" #include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/pcp.h" +#include "connections/implementation/pcp_handler.h" #include "connections/listeners.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/params.h" #include "connections/status.h" #include "connections/strategy.h" +#include "connections/v3/connection_listening_options.h" +#include "connections/v3/listeners.h" +#include "internal/interop/device.h" #include "internal/platform/atomic_boolean.h" namespace nearby { @@ -47,12 +61,12 @@ class PcpManager { InjectedBluetoothDeviceStore& injected_bluetooth_device_store); ~PcpManager(); - Status StartAdvertising(ClientProxy* client, const string& service_id, + Status StartAdvertising(ClientProxy* client, const std::string& service_id, const AdvertisingOptions& advertising_options, const ConnectionRequestInfo& info); void StopAdvertising(ClientProxy* client); - Status StartDiscovery(ClientProxy* client, const string& service_id, + Status StartDiscovery(ClientProxy* client, const std::string& service_id, const DiscoveryOptions& discovery_options, DiscoveryListener listener); void StopDiscovery(ClientProxy* client); @@ -68,12 +82,17 @@ class PcpManager { void InjectEndpoint(ClientProxy* client, const std::string& service_id, const OutOfBandConnectionMetadata& metadata); - Status RequestConnection(ClientProxy* client, const string& endpoint_id, + Status RequestConnection(ClientProxy* client, const std::string& endpoint_id, const ConnectionRequestInfo& info, const ConnectionOptions& connection_options); - Status AcceptConnection(ClientProxy* client, const string& endpoint_id, + + Status RequestConnectionV3(ClientProxy* client, + const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options); + Status AcceptConnection(ClientProxy* client, const std::string& endpoint_id, PayloadListener payload_listener); - Status RejectConnection(ClientProxy* client, const string& endpoint_id); + Status RejectConnection(ClientProxy* client, const std::string& endpoint_id); Status UpdateAdvertisingOptions( ClientProxy* client, absl::string_view service_id, @@ -89,6 +108,7 @@ class PcpManager { private: bool SetCurrentPcpHandler(Strategy strategy); PcpHandler* GetPcpHandler(Pcp pcp) const; + bool GetWebRtcNonCellular(const std::vector& mediums); AtomicBoolean shutdown_{false}; absl::flat_hash_map> handlers_; diff --git a/connections/implementation/pcp_manager_test.cc b/connections/implementation/pcp_manager_test.cc index abaac561..518e7bdb 100644 --- a/connections/implementation/pcp_manager_test.cc +++ b/connections/implementation/pcp_manager_test.cc @@ -16,15 +16,21 @@ #include #include +#include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/time/time.h" #include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/mock_device.h" #include "connections/implementation/simulation_user.h" #include "connections/medium_selector.h" +#include "connections/out_of_band_connection_metadata.h" +#include "connections/status.h" +#include "connections/strategy.h" #include "connections/v3/connection_listening_options.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/medium_environment.h" @@ -32,6 +38,8 @@ namespace nearby { namespace connections { namespace { +using ::testing::Return; + constexpr std::array kFakeMacAddress = {'a', 'b', 'c', 'd', 'e', 'f'}; constexpr char kServiceId[] = "service-id"; constexpr char kDeviceA[] = "device-A"; @@ -203,6 +211,27 @@ TEST_P(PcpManagerTest, StartListeningForIncomingConnectionsFailsNoStrategy) { env_.Stop(); } +TEST_P(PcpManagerTest, CanConnectV3) { + env_.Start(); + SimulationUser user_a("device-a", GetParam()); + SimulationUser user_b("device-b", GetParam()); + CountDownLatch discovery_latch(1); + CountDownLatch connection_latch(2); + user_a.StartAdvertising(kServiceId, &connection_latch); + user_b.StartDiscovery(kServiceId, &discovery_latch); + EXPECT_TRUE(discovery_latch.Await(absl::Milliseconds(1000)).result()); + EXPECT_EQ(user_b.GetDiscovered().service_id, kServiceId); + EXPECT_EQ(user_b.GetDiscovered().endpoint_info, user_a.GetInfo()); + auto remote_device = MockNearbyDevice(); + EXPECT_CALL(remote_device, GetEndpointId) + .WillRepeatedly(Return(std::string(user_b.GetDiscovered().endpoint_id))); + user_b.RequestConnectionV3(&connection_latch, remote_device); + EXPECT_TRUE(connection_latch.Await(absl::Milliseconds(1000)).result()); + user_a.Stop(); + user_b.Stop(); + env_.Stop(); +} + INSTANTIATE_TEST_SUITE_P(ParametrisedPcpManagerTest, PcpManagerTest, ::testing::ValuesIn(kTestCases)); @@ -218,6 +247,7 @@ TEST_F(PcpManagerTest, InjectEndpoint) { .remote_bluetooth_mac_address = ByteArray(kFakeMacAddress), }); + user_a.StopDiscovery(); user_a.Stop(); env_.Stop(); } diff --git a/connections/implementation/proto/BUILD b/connections/implementation/proto/BUILD index be1bba96..1e73b2ec 100644 --- a/connections/implementation/proto/BUILD +++ b/connections/implementation/proto/BUILD @@ -13,6 +13,7 @@ # limitations under the License. load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") licenses(["notice"]) @@ -21,9 +22,7 @@ proto_library( srcs = [ "offline_wire_formats.proto", ], - visibility = [ - "//visibility:private", # Only private by automation, not intent. Owner may accept CLs adding visibility. See go/scheuklappen#explicit-private. - ], + visibility = ["//visibility:private"], ) cc_proto_library( diff --git a/connections/implementation/proto/offline_wire_formats.proto b/connections/implementation/proto/offline_wire_formats.proto index d0d226bd..f4a68e14 100644 --- a/connections/implementation/proto/offline_wire_formats.proto +++ b/connections/implementation/proto/offline_wire_formats.proto @@ -16,6 +16,8 @@ syntax = "proto2"; package location.nearby.connections; +// import "storage/datapol/annotations/proto/semantic_annotations.proto"; + option optimize_for = LITE_RUNTIME; option java_outer_classname = "OfflineWireFormatsProto"; option java_package = "com.google.location.nearby.connections.proto"; @@ -82,6 +84,14 @@ message ConnectionRequestFrame { WEB_RTC = 9; BLE_L2CAP = 10; USB = 11; + WEB_RTC_NON_CELLULAR = 12; + } + // LINT.ThenChange(//depot/google3/third_party/nearby/proto/connections_enums.proto) + + // LINT.IfChange + enum ConnectionMode { + LEGACY = 0; + INSTANT = 1; } // LINT.ThenChange(//depot/google3/third_party/nearby/proto/connections_enums.proto) @@ -109,6 +119,7 @@ message ConnectionRequestFrame { ConnectionsDevice connections_device = 12; PresenceDevice presence_device = 13; } + optional ConnectionMode connection_mode = 14; } message ConnectionResponseFrame { @@ -149,6 +160,7 @@ message PayloadTransferFrame { UNKNOWN_PACKET_TYPE = 0; DATA = 1; CONTROL = 2; + PAYLOAD_ACK = 3; } message PayloadHeader { @@ -183,7 +195,8 @@ message PayloadTransferFrame { UNKNOWN_EVENT_TYPE = 0; PAYLOAD_ERROR = 1; PAYLOAD_CANCELED = 2; - PAYLOAD_RECEIVED_ACK = 3; + // Use PacketType.PAYLOAD_ACK instead + PAYLOAD_RECEIVED_ACK = 3 [deprecated = true]; } optional EventType event = 1; @@ -225,12 +238,14 @@ message BandwidthUpgradeNegotiationFrame { WEB_RTC = 9; // 10 is reserved. USB = 11; + WEB_RTC_NON_CELLULAR = 12; } // Accompanies Medium.WIFI_HOTSPOT. message WifiHotspotCredentials { optional string ssid = 1; - optional string password = 2; + optional string password = 2 + /* type = ST_ACCOUNT_CREDENTIAL */; optional int32 port = 3; optional string gateway = 4 [default = "0.0.0.0"]; // This field can be a band or frequency @@ -253,13 +268,15 @@ message BandwidthUpgradeNegotiationFrame { message WifiAwareCredentials { optional string service_id = 1; optional bytes service_info = 2; - optional string password = 3; + optional string password = 3 + /* type = ST_ACCOUNT_CREDENTIAL */; } // Accompanies Medium.WIFI_DIRECT. message WifiDirectCredentials { optional string ssid = 1; - optional string password = 2; + optional string password = 2 + /* type = ST_ACCOUNT_CREDENTIAL */; optional int32 port = 3; optional int32 frequency = 4; optional string gateway = 5 [default = "0.0.0.0"]; @@ -292,6 +309,11 @@ message BandwidthUpgradeNegotiationFrame { optional bool supports_client_introduction_ack = 9; } + // Accompanies SAFE_TO_CLOSE_PRIOR_CHANNEL events. + message SafeToClosePriorChannel { + optional int32 sta_frequency = 1; + } + // Accompanies CLIENT_INTRODUCTION events. message ClientIntroduction { optional string endpoint_id = 1; @@ -307,6 +329,7 @@ message BandwidthUpgradeNegotiationFrame { optional UpgradePathInfo upgrade_path_info = 2; optional ClientIntroduction client_introduction = 3; optional ClientIntroductionAck client_introduction_ack = 4; + optional SafeToClosePriorChannel safe_to_close_prior_channel = 5; } message BandwidthUpgradeRetryFrame { @@ -325,6 +348,7 @@ message BandwidthUpgradeRetryFrame { WEB_RTC = 9; BLE_L2CAP = 10; USB = 11; + WEB_RTC_NON_CELLULAR = 12; } // LINT.ThenChange(//depot/google3/third_party/nearby/proto/connections_enums.proto) diff --git a/connections/implementation/reconnect_manager.cc b/connections/implementation/reconnect_manager.cc new file mode 100644 index 00000000..c0e5b5c7 --- /dev/null +++ b/connections/implementation/reconnect_manager.cc @@ -0,0 +1,859 @@ +// Copyright 2023 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. + +#include "connections/implementation/reconnect_manager.h" + +#include +#include +#include +#include + +#include "securegcm/ukey2_handshake.h" +#include "absl/functional/any_invocable.h" +#include "absl/functional/bind_front.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "connections/implementation/bluetooth_endpoint_channel.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/encryption_runner.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/offline_frames.h" +#include "connections/implementation/service_id_constants.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/bluetooth_classic.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancelable_alarm.h" +#include "internal/platform/cancellation_flag_listener.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/system_clock.h" +#include "internal/platform/logging.h" +#include "internal/platform/mutex.h" +#include "internal/platform/mutex_lock.h" +#include "proto/connections_enums.pb.h" + +namespace nearby { +namespace connections { +constexpr absl::string_view TAG = "[ReconnectManager]"; + +ReconnectManager::ReconnectManager(Mediums& mediums, + EndpointChannelManager& channel_manager) + : mediums_(&mediums), channel_manager_(&channel_manager) {} + +ReconnectManager::~ReconnectManager() { Shutdown(); } + +bool ReconnectManager::AutoReconnect( + ClientProxy* client, const std::string& endpoint_id, + AutoReconnectCallback& callback, + bool send_disconnection_notification, + DisconnectionReason disconnection_reason) { + if (!client->IsAutoReconnectEnabled(endpoint_id)) { + return false; + } + + if (resumed_endpoints_.contains(endpoint_id)) { + NEARBY_LOGS(INFO) << TAG << "AutoReconnect is not needed for endpoint_id = " + << endpoint_id + << ", since it's just reconnected successfully."; + return true; + } + + auto endpoint_channel = channel_manager_->GetChannelForEndpoint(endpoint_id); + if (endpoint_channel == nullptr) { + NEARBY_LOGS(INFO) + << TAG << " endpoint_channel shouldn't be null for endpoint_id = " + << endpoint_id; + return false; + } + Medium medium = endpoint_channel->GetMedium(); + + bool is_incoming = client->IsIncomingConnection(endpoint_id); + if (is_incoming == client->IsOutgoingConnection(endpoint_id)) { + NEARBY_LOGS(INFO) + << TAG << " autoReconnect failed for medium: " + << location::nearby::proto::connections::Medium_Name(medium) + << " because there is no existing incoming/outgoing connection, " + "is_incoming_connection = " + << is_incoming << ", is_outgoing_connection = " + << client->IsOutgoingConnection(endpoint_id); + return false; + } + std::string reconnect_service_id = + WrapInitiatorReconnectServiceId(endpoint_channel->GetServiceId()); + endpoint_id_metadata_map_.emplace( + endpoint_id, + ReconnectMetadata(is_incoming, std::move(callback), + send_disconnection_notification, disconnection_reason, + reconnect_service_id)); + NEARBY_LOGS(INFO) << TAG << "add a new endpoint_id " << endpoint_id + << " into metadata_by_service_id_map."; + + if (Start(is_incoming, client, endpoint_id, reconnect_service_id, medium)) { + resumed_endpoints_.emplace(endpoint_id); + + auto time_out = FeatureFlags::GetInstance() + .GetFlags() + .auto_reconnect_skip_duplicated_endpoint_duration; + std::make_unique( + absl::StrCat("RemoveSuccessfulResumedEndpointId for ", endpoint_id), + [this, endpoint_id, time_out]() { + NEARBY_LOGS(INFO) + << TAG << "Timeout after " << time_out + << "ms. RemoveSuccessfulResumedEndpointId for " << endpoint_id; + resumed_endpoints_.erase(endpoint_id); + }, + time_out, &alarm_executor_); + + return true; + } + + ClearReconnectData(client, reconnect_service_id, is_incoming); + return false; +} + +bool ReconnectManager::Start(bool is_incoming, ClientProxy* client, + const std::string& endpoint_id, + const std::string& reconnect_service_id, + Medium medium) { + auto retry_delay_millis = + FeatureFlags::GetInstance().GetFlags().auto_reconnect_retry_delay_millis; + auto reconnect_retry_num = + FeatureFlags::GetInstance().GetFlags().auto_reconnect_retry_attempts; + NEARBY_LOGS(INFO) << TAG << " " << (is_incoming ? "rehost" : "reconnect") + << " for medium: " + << location::nearby::proto::connections::Medium_Name( + medium) + << " for endpoint_id " << endpoint_id << " started..."; + bool final_result = false; + CountDownLatch latch(1); + reconnect_executor_.Execute( + "reconnect-start", + [this, &final_result, is_incoming, client, endpoint_id, + &reconnect_service_id, retry_delay_millis, reconnect_retry_num, medium, + &latch]() mutable { + for (int i = 0; i < reconnect_retry_num; ++i) { + if (client->GetCancellationFlag(endpoint_id)->Cancelled()) { + NEARBY_LOGS(INFO) + << TAG << " Stop retry, Endpoint connection is cancelled"; + break; + } + if (RunOnce(is_incoming, client, endpoint_id, reconnect_service_id, + medium)) { + final_result = true; + break; + } + SystemClock::Sleep(retry_delay_millis); + } + NEARBY_LOGS(INFO) << "Reconnect " + << (final_result ? "succeeded" : "failed"); + latch.CountDown(); + }); + latch.Await(); + return final_result; +} + +bool ReconnectManager::RunOnce(bool is_incoming, ClientProxy* client, + const std::string& endpoint_id, + const std::string& reconnect_service_id, + Medium medium) { + bool result = false; + switch (medium) { + case Medium::BLUETOOTH: { + BluetoothImpl bluetooth_impl(client, endpoint_id, reconnect_service_id, + is_incoming, medium, mediums_, + channel_manager_, *this); + result = bluetooth_impl.Run(); + } break; + + default: + NEARBY_LOGS(INFO) << "AutoReconnect not implemented yet for " + << location::nearby::proto::connections::Medium_Name( + medium); + + break; + } + return result; +} + +void ReconnectManager::ClearReconnectData( + ClientProxy* client, const std::string& reconnect_service_id, + bool is_incoming) { + for (auto& item : endpoint_id_metadata_map_) { + if (item.second.reconnect_service_id == reconnect_service_id && + item.second.is_incoming == is_incoming) { + if (item.second.reconnect_cb.on_reconnect_failure_cb) { + item.second.reconnect_cb.on_reconnect_failure_cb( + client, item.first, item.second.send_disconnection_notification, + item.second.disconnection_reason); + } + } + NEARBY_LOGS(INFO) << TAG << "erase endpoint_id " << item.first; + endpoint_id_metadata_map_.erase(item.first); + } +} + +void ReconnectManager::Shutdown() { + NEARBY_LOGS(INFO) << TAG << "Initiating shutdown of ReconnectManager."; + { + MutexLock lock(&mutex_); + listen_timeout_alarm_by_service_id_.clear(); + } + new_endpoint_channels_.clear(); + endpoint_id_metadata_map_.clear(); + resumed_endpoints_.clear(); + + alarm_executor_.Shutdown(); + reconnect_executor_.Shutdown(); + encryption_cb_executor_.Shutdown(); + incoming_connection_cb_executor_.Shutdown(); + NEARBY_LOGS(INFO) << TAG << "ReconnectManager has shut down."; +} + +bool ReconnectManager::BaseMediumImpl::Run() { + if (!IsMediumRadioOn()) { + NEARBY_LOGS(INFO) << TAG + << location::nearby::proto::connections::Medium_Name( + medium_) + << " radio is turned off, try later"; + return false; + } + + if (client_->IsConnectedToEndpoint(endpoint_id_)) { + NEARBY_LOGS(INFO) << TAG + << "ReconnectBluetooth is not needed since it's already " + "connected to the RemoteDevice: "; + return true; + } + + auto previou_channel = channel_manager_->GetChannelForEndpoint(endpoint_id_); + if (previou_channel == nullptr) { + NEARBY_LOGS(INFO) + << TAG + << "ReconnectionManager didn't find a previous EndpointChannel " + "for " + << endpoint_id_ << " in this run, stop Reconnection!"; + return false; + } + previou_channel->Close( + DisconnectionReason::PREV_CHANNEL_DISCONNECTION_IN_RECONNECT); + + return is_incoming_ ? RehostForIncomingConnections() + : ReconnectToRemoteDevice(); +} + +bool ReconnectManager::BaseMediumImpl::RehostForIncomingConnections() { + auto time_out = + FeatureFlags::GetInstance().GetFlags().auto_reconnect_timeout_millis; + auto cancellation_flag = client_->GetCancellationFlag(endpoint_id_); + if (!IsListeningForIncomingConnections()) { + NEARBY_LOGS(INFO) << "Start rehosting for: " << reconnect_service_id_; + if (!StartListeningForIncomingConnections()) { + NEARBY_LOGS(ERROR) + << TAG + << "Rehost failed since " + "StartListeningForIncomingConnections return false."; + return false; + } + { + MutexLock lock(&reconnect_manager_.mutex_); + reconnect_manager_ + .listen_timeout_alarm_by_service_id_[reconnect_service_id_] = + std::make_unique( + absl::StrCat("Rehost listen timeout for ", reconnect_service_id_), + [this, time_out]() { + NEARBY_LOGS(INFO) + << "Timeout after " << time_out + << "ms. Stop listening for incoming " + "Connections for serviceId " + << reconnect_service_id_ << " for rehost, initiated by " + << endpoint_id_ + << ", unregister all still not connected endpointIds."; + StopListeningIfAllConnected( + reconnect_service_id_, + [this]() { StopListeningForIncomingConnections(); }, + /* forceStop= */ true); + }, + time_out, &reconnect_manager_.alarm_executor_); + } + } else { + NEARBY_LOGS(INFO) << "Rehosting is not needed since it's already " + "rehosts for: " + << reconnect_service_id_; + } + + if (cancellation_flag == nullptr) { + return true; + } + if (cancellation_flag->Cancelled()) { + StopListeningIfAllConnected( + reconnect_service_id_, + [this]() { StopListeningForIncomingConnections(); }, + /* forceStop= */ false); + return false; + } + auto cancellation_listener = + std::make_unique( + cancellation_flag, [this]() { + NEARBY_LOGS(INFO) << "Calling CancellationFlagListener."; + ProcessFailedReconnection(endpoint_id_, [this]() { + StopListeningForIncomingConnections(); + }); + }); + + std::make_unique( + absl::StrCat(TAG, " unregisterOnCancelListener"), + [cancellation_listener = std::move(cancellation_listener)]() mutable { + // clean up the listener after auto reconnect is done. + cancellation_listener.reset(); + }, + time_out, &reconnect_manager_.alarm_executor_); + return true; +} + +bool ReconnectManager::BaseMediumImpl::ReconnectToRemoteDevice() { + if (!ConnectOverMedium()) { + NEARBY_LOGS(INFO) << TAG << "Connect over medium " + << location::nearby::proto::connections::Medium_Name( + medium_) + << " failed."; + return false; + } + NEARBY_LOGS(INFO) << TAG << "Write CLIENT_INTRODUCTION frame"; + Exception write_exception = reconnect_channel_->Write( + parser::ForAutoReconnectIntroduction(endpoint_id_)); + if (!write_exception.Ok()) { + NEARBY_LOGS(ERROR) + << TAG << "Failed to write forAutoReconnectClientIntroductionEvent."; + QuietlyCloseChannelAndSocket(); + return false; + } + if (!ReadClientIntroductionAckFrame(reconnect_channel_.get())) { + NEARBY_LOGS(ERROR) << TAG << "Failed to read ClientIntroductionAck frame."; + QuietlyCloseChannelAndSocket(); + return false; + } + if (ReplaceChannelForEndpoint(client_, endpoint_id_, + std::move(reconnect_channel_), + SupportEncryptionDisabled(), nullptr)) { + NEARBY_LOGS(INFO) << TAG + << " successfully rebuild the outgoing connection with " + << location::nearby::proto::connections::Medium_Name( + medium_) + << " for the endpointId:" << endpoint_id_; + return true; + } + NEARBY_LOGS(INFO) + << TAG << " ReplaceChannelForEndpoint for the outgoing connection with " + << location::nearby::proto::connections::Medium_Name(medium_) + << " for the endpointId:" << endpoint_id_ << " failed. Please retry"; + return false; +} + +void ReconnectManager::BaseMediumImpl::OnIncomingConnection( + const std::string& reconnect_service_id) { + NEARBY_LOGS(INFO) << TAG << "Received reconnection successfully"; + reconnect_manager_.incoming_connection_cb_executor_.Execute( + "OnIncomingConnection", [this]() { + auto incoming_endpoin_id = + ReadClientIntroductionFrame(reconnect_channel_.get()); + if (incoming_endpoin_id.empty()) { + NEARBY_LOGS(ERROR) << TAG << "read ClientIntroductionFrame failed"; + QuietlyCloseChannelAndSocket(); + return; + } + NEARBY_LOGS(INFO) << TAG << "Write CLIENT_INTRODUCTION_ACK frame"; + Exception write_exception = reconnect_channel_->Write( + parser::ForAutoReconnectIntroductionAck(endpoint_id_)); + if (!write_exception.Ok()) { + NEARBY_LOGS(ERROR) + << TAG + << "Failed to write forAutoReconnectClientIntroductionAckEvent."; + QuietlyCloseChannelAndSocket(); + return; + } + if (ReplaceChannelForEndpoint( + client_, endpoint_id_, std::move(reconnect_channel_), + SupportEncryptionDisabled(), + [this]() { StopListeningForIncomingConnections(); })) { + NEARBY_LOGS(INFO) + << TAG << " successfully rebuild the incoming connection with " + << location::nearby::proto::connections::Medium_Name(medium_) + << " for the endpointId:" << endpoint_id_; + return; + } + QuietlyCloseChannelAndSocket(); + NEARBY_LOGS(INFO) + << TAG + << " ReplaceChannelForEndpoint for the incoming connection with " + << location::nearby::proto::connections::Medium_Name(medium_) + << " for the endpointId:" << endpoint_id_ + << " failed. Please retry"; + return; + }); +} + +std::string ReconnectManager::BaseMediumImpl::ReadClientIntroductionFrame( + EndpointChannel* endpoint_channel) { + NEARBY_LOGS(INFO) << TAG << "Read CLIENT_INTRODUCTION frame"; + + auto timeout = FeatureFlags::GetInstance() + .GetFlags() + .safe_to_disconnect_auto_resume_timeout_millis; + CancelableAlarm timeout_alarm( + "ReconnectManager::ReadClientIntroductionFrame", + [timeout, endpoint_channel]() { + NEARBY_LOGS(ERROR) << "In ReconnectManager, failed to read the " + "ClientIntroductionFrame after " + << timeout + << ". Timing out and closing EndpointChannel " + << endpoint_channel->GetType(); + endpoint_channel->Close(); + }, + timeout, &reconnect_manager_.alarm_executor_); + + auto data = endpoint_channel->Read(); + timeout_alarm.Cancel(); + if (!data.ok()) { + NEARBY_LOGS(ERROR) + << "Data read fail when expecting a ClientIntroductionFrame from " + "EndpointChannel " + << endpoint_channel->GetType(); + return {}; + } + auto transfer(parser::FromBytes(data.result())); + if (!transfer.ok()) { + NEARBY_LOGS(ERROR) << "Attempted to read a ClientIntroductionFrame from " + "EndpointChannel " + << endpoint_channel->GetType() + << ", but was unable to obtain any OfflineFrame."; + return {}; + } + OfflineFrame frame = transfer.result(); + if (!frame.has_v1() || !frame.v1().has_auto_reconnect()) { + NEARBY_LOGS(ERROR) << "In ReadClientIntroductionFrame(), eExpected a " + "AUTO_RECONNECT v1 OfflineFrame but got a " + << parser::GetFrameType(frame) << " frame instead."; + return {}; + } + if (frame.v1().auto_reconnect().event_type() != + AutoReconnectFrame::CLIENT_INTRODUCTION) { + NEARBY_LOGS(ERROR) << "In ReadClientIntroductionFrame(), expected a " + "CLIENT_INTRODUCTION " + "v1 OfflineFrame but got a AUTO_RECONNECT frame " + "with eventType " + << frame.v1().auto_reconnect().event_type() + << " instead."; + return {}; + } + return frame.v1().auto_reconnect().endpoint_id(); +} + +bool ReconnectManager::BaseMediumImpl::ReadClientIntroductionAckFrame( + EndpointChannel* endpoint_channel) { + NEARBY_LOGS(INFO) << TAG << "Read CLIENT_INTRODUCTION_ACK frame"; + + auto timeout = FeatureFlags::GetInstance() + .GetFlags() + .safe_to_disconnect_auto_resume_timeout_millis; + CancelableAlarm timeout_alarm( + "ReconnectManager::ReadClientIntroductionAckFrame", + [timeout, endpoint_channel]() { + NEARBY_LOGS(ERROR) << "In ReconnectManager, failed to read the " + "ClientIntroductionAckFrame after " + << timeout + << ". Timing out and closing EndpointChannel " + << endpoint_channel->GetType(); + endpoint_channel->Close(); + }, + timeout, &reconnect_manager_.alarm_executor_); + + auto data = endpoint_channel->Read(); + timeout_alarm.Cancel(); + if (!data.ok()) return false; + auto transfer(parser::FromBytes(data.result())); + if (!transfer.ok()) { + NEARBY_LOGS(ERROR) << "Attempted to read a ClientIntroductionAckFrame from " + "EndpointChannel " + << endpoint_channel->GetType() + << ", but was unable to obtain any OfflineFrame."; + return false; + } + OfflineFrame frame = transfer.result(); + if (!frame.has_v1() || !frame.v1().has_auto_reconnect()) { + NEARBY_LOGS(ERROR) << "In ReadClientIntroductionAckFrame(), eExpected a " + "AUTO_RECONNECT v1 OfflineFrame but got a " + << parser::GetFrameType(frame) << " frame instead."; + return false; + } + if (frame.v1().auto_reconnect().event_type() != + AutoReconnectFrame::CLIENT_INTRODUCTION_ACK) { + NEARBY_LOGS(ERROR) << "In ReadClientIntroductionAckFrame(), expected a " + "CLIENT_INTRODUCTION_ACK " + "v1 OfflineFrame but got a AUTO_RECONNECT frame " + "with eventType " + << frame.v1().auto_reconnect().event_type() + << " instead."; + return false; + } + return true; +} + +bool ReconnectManager::BaseMediumImpl::ReplaceChannelForEndpoint( + ClientProxy* client, const std::string& endpoint_id, + std::unique_ptr new_channel, + bool support_encryption_disabled, + absl::AnyInvocable stop_listening_incoming_connection) { + auto& endpoint_id_metadata_map = reconnect_manager_.endpoint_id_metadata_map_; + auto reconnect_metadata = endpoint_id_metadata_map.find(endpoint_id); + if (reconnect_metadata == endpoint_id_metadata_map.end()) { + NEARBY_LOGS(ERROR) << TAG << "ReconnectMetadata is null for endpointId: " + << endpoint_id << " ,please retry!"; + return false; + } + + EndpointChannel* endpoint_channel = + reconnect_manager_.new_endpoint_channels_ + .emplace(endpoint_id, std::move(new_channel)) + .first->second.get(); + replace_channel_succeed_ = false; + wait_encryption_to_finish_ = std::make_unique(1); + if (reconnect_metadata->second.is_incoming) { + reconnect_manager_.encryption_runner_.StartServer( + client, endpoint_id, endpoint_channel, GetResultListener()); + } else { + reconnect_manager_.encryption_runner_.StartClient( + client, endpoint_id, endpoint_channel, GetResultListener()); + } + wait_encryption_to_finish_->Await( + FeatureFlags::GetInstance().GetFlags().auto_reconnect_timeout_millis); + + NEARBY_LOGS(INFO) << TAG + << "replace_channel_succeed_: " << replace_channel_succeed_ + << " for endpointId: " << endpoint_id; + + if (replace_channel_succeed_) { + ProcessSuccessfulReconnection( + endpoint_id, [this]() { StopListeningForIncomingConnections(); }); + client->GetAnalyticsRecorder().OnConnectionEstablished( + endpoint_id, endpoint_channel->GetMedium(), + client->GetConnectionToken(endpoint_id)); + } else { + ProcessFailedReconnection( + endpoint_id, [this]() { StopListeningForIncomingConnections(); }); + } + reconnect_manager_.new_endpoint_channels_.erase(endpoint_id); + return replace_channel_succeed_; +} + +EncryptionRunner::ResultListener +ReconnectManager::BaseMediumImpl::GetResultListener() { + return { + .on_success_cb = + [this](const std::string& endpoint_id, + std::unique_ptr ukey2, + const std::string& auth_token, + const ByteArray& raw_auth_token) { + reconnect_manager_.encryption_cb_executor_.Execute( + "encryption-success", + [this, endpoint_id, raw_ukey2 = ukey2.release(), auth_token, + raw_auth_token]() mutable { + OnEncryptionSuccessRunnable( + endpoint_id, + std::unique_ptr(raw_ukey2), + auth_token, raw_auth_token); + wait_encryption_to_finish_->CountDown(); + }); + }, + .on_failure_cb = + [this](const std::string& endpoint_id, EndpointChannel* channel) { + reconnect_manager_.encryption_cb_executor_.Execute( + "encryption-failure", [this, endpoint_id, channel]() mutable { + NEARBY_LOGS(ERROR) + << "Encryption failed for endpoint_id=" << endpoint_id + << " on medium=" + << location::nearby::proto::connections::Medium_Name( + channel->GetMedium()); + OnEncryptionFailureRunnable(endpoint_id, channel); + wait_encryption_to_finish_->CountDown(); + }); + }, + }; +} + +void ReconnectManager::BaseMediumImpl::OnEncryptionSuccessRunnable( + const std::string& endpoint_id, + std::unique_ptr ukey2, + const std::string& auth_token, const ByteArray& raw_auth_token) { + auto item = reconnect_manager_.new_endpoint_channels_.find(endpoint_id); + if (item == reconnect_manager_.new_endpoint_channels_.end()) { + NEARBY_LOGS(INFO) << "TAG" + << "OnEncryptionSuccess failed, new_endpoint_channel is " + "null for Endpoint:" + << endpoint_id; + return; + } + if (!ukey2) { + NEARBY_LOGS(INFO) + << "TAG" + << "OnEncryptionSuccess failed, ukey2 is null for Endpoint:" + << endpoint_id; + return; + } + + // After both parties accepted connection (presumably after verifying & + // matching security tokens), we are allowed to extract the shared key. + bool succeeded = ukey2->VerifyHandshake(); + CHECK(succeeded); // If this fails, it's a UKEY2 protocol bug. + auto context = ukey2->ToConnectionContext(); + CHECK(context); // there is no way how this can fail, if Verify succeeded. + // If it did, it's a UKEY2 protocol bug. + + if (!reconnect_manager_.channel_manager_->EncryptChannelForEndpoint( + endpoint_id, std::move(context))) { + NEARBY_LOGS(INFO) << "TAG" + << "new_endpoint_channel failed to update " + "EncryptionContext for Endpoint:" + << endpoint_id; + return; + } + auto previous_channel = + reconnect_manager_.channel_manager_->GetChannelForEndpoint(endpoint_id); + if (previous_channel == nullptr) { + NEARBY_LOGS(INFO) + << "TAG" + << "ReconnectionManager didn't find a previous EndpointChannel for " + << endpoint_id + << " when registering the new EndpointChannel, stop Reconnection!"; + item->second->Close(DisconnectionReason::UNFINISHED); + return; + } + reconnect_manager_.channel_manager_->ReplaceChannelForEndpoint( + client_, endpoint_id, std::move(item->second), + SupportEncryptionDisabled()); + replace_channel_succeed_ = true; +} + +void ReconnectManager::BaseMediumImpl::OnEncryptionFailureRunnable( + const std::string& endpoint_id, EndpointChannel* endpoint_channel) { + NEARBY_LOGS(INFO) + << "TAG" + << "new_endpoint_channel failed to use encryption for Endpoint:" + << endpoint_id; +} + +void ReconnectManager::BaseMediumImpl::ProcessSuccessfulReconnection( + const std::string& endpoint_id, + absl::AnyInvocable stop_listening_incoming_connection) { + auto& endpoint_id_metadata_map = reconnect_manager_.endpoint_id_metadata_map_; + auto reconnect_metadata = endpoint_id_metadata_map.find(endpoint_id); + if (reconnect_metadata == endpoint_id_metadata_map.end()) { + NEARBY_LOGS(ERROR) << TAG + << "when ProcessSuccessfulReconnection, endpoint_id: " + << endpoint_id + << " is already removed fromendpoint_id_metadata_map."; + return; + } + + auto medatdata = std::move(reconnect_metadata->second); + endpoint_id_metadata_map.erase(reconnect_metadata); + auto& callback = medatdata.reconnect_cb; + if (callback.on_reconnect_success_cb) { + callback.on_reconnect_success_cb(client_, endpoint_id); + } else { + NEARBY_LOGS(ERROR) << TAG + << "when ProcessSuccessfulReconnection, endpoint_id: " + << endpoint_id + << " callback.on_reconnect_success_cb is null"; + } + + if (medatdata.is_incoming && + stop_listening_incoming_connection) { + StopListeningIfAllConnected(medatdata.reconnect_service_id, + std::move(stop_listening_incoming_connection), + /* forceStop= */ false); + } +} +void ReconnectManager::BaseMediumImpl::ProcessFailedReconnection( + const std::string& endpoint_id, + absl::AnyInvocable stop_listening_incoming_connection) {} + +void ReconnectManager::BaseMediumImpl::StopListeningIfAllConnected( + const std::string& reconnect_service_id, + absl::AnyInvocable stop_listening_incoming_connection, + bool force_stop) { + if (!force_stop && HasPendingIncomingConnections(reconnect_service_id)) { + return; + } + CancelClearHostTimeoutAlarm(reconnect_service_id); + stop_listening_incoming_connection(); + ClearReconnectData(reconnect_service_id, /* is_incoming= */ true); + NEARBY_LOGS(INFO) << TAG + << " No more pending incoming connections, " + "stop_listening_incoming_connection for " + << reconnect_service_id << " before timeout."; +} + +bool ReconnectManager::BaseMediumImpl::HasPendingIncomingConnections( + const std::string& reconnect_service_id) { + for (auto& item : reconnect_manager_.endpoint_id_metadata_map_) { + if (item.second.reconnect_service_id == reconnect_service_id && + item.second.is_incoming) { + return true; + } + } + return false; +} + +void ReconnectManager::BaseMediumImpl:: + CancelClearHostTimeoutAlarm(const std::string& service_id) { + MutexLock lock(&reconnect_manager_.mutex_); + auto item = + reconnect_manager_.listen_timeout_alarm_by_service_id_.find(service_id); + if (item == reconnect_manager_.listen_timeout_alarm_by_service_id_.end()) + return; + + if (item->second->IsValid()) { + item->second->Cancel(); + item->second.reset(); + } + reconnect_manager_.listen_timeout_alarm_by_service_id_.erase(item); +} +void ReconnectManager::BaseMediumImpl:: + ClearReconnectData(const std::string& service_id, bool is_incoming) { + auto& metadata_map = reconnect_manager_.endpoint_id_metadata_map_; + for (auto item = metadata_map.begin(); item != metadata_map.end(); ) { + if (item->second.reconnect_service_id == service_id && is_incoming) { + auto& callback = item->second.reconnect_cb.on_reconnect_failure_cb; + if (callback) + callback(client_, item->first, + item->second.send_disconnection_notification, + item->second.disconnection_reason); + metadata_map.erase(item); + } else { + ++item; + } + } +} + +bool ReconnectManager::BluetoothImpl::IsMediumRadioOn() const { + return bluetooth_medium_.IsAvailable(); +} + +bool ReconnectManager::BluetoothImpl::IsListeningForIncomingConnections() + const { + return bluetooth_medium_.IsAcceptingConnections(reconnect_service_id_); +} + +bool ReconnectManager::BluetoothImpl::StartListeningForIncomingConnections() { + if (!bluetooth_medium_.StartAcceptingConnections( + reconnect_service_id_, + absl::bind_front( + &ReconnectManager::BluetoothImpl::OnIncomingBluetoothConnection, this, + client_))) { + NEARBY_LOGS(ERROR) + << "ReconnectManager::BluetoothImpl couldn't initiate the " + "BLUETOOTH reconnect for endpoint " + << endpoint_id_ + << " because it failed to start listening for " + "incoming Bluetooth connections."; + return false; + } + NEARBY_LOGS(INFO) << "ReconnectManager::BluetoothImpl successfully started " + "listening for incoming " + "reconnection on service_id=" + << reconnect_service_id_ << " for endpoint " + << endpoint_id_; + return true; +} + +void ReconnectManager::BluetoothImpl::OnIncomingBluetoothConnection( + ClientProxy* client, const std::string& upgrade_service_id, + BluetoothSocket socket) { + reconnect_channel_ = std::make_unique( + upgrade_service_id, /*channel_name=*/upgrade_service_id, socket); + if (reconnect_channel_ == nullptr) { + NEARBY_LOGS(ERROR) << TAG + << "Create new endpointChannel for incoming socket " + "failed, close the socket"; + + socket.Close(); + return; + } + bluetooth_socket_ = std::move(socket); + + NEARBY_LOGS(INFO) + << TAG << "Create new endpointChannel successfully for incoming socket."; + + OnIncomingConnection(upgrade_service_id); +} + +void ReconnectManager::BluetoothImpl::StopListeningForIncomingConnections() { + bluetooth_medium_.StopAcceptingConnections(reconnect_service_id_); +} + +bool ReconnectManager::BluetoothImpl::ConnectOverMedium() { + std::optional remote_mac_address = + client_->GetBluetoothMacAddress(endpoint_id_); + if (!remote_mac_address.has_value()) { + NEARBY_LOGS(INFO) + << "ReconnectBluetooth failed since remoteMacAddress is empty"; + return false; + } + auto& bluetooth_medium = mediums_->GetBluetoothClassic(); + BluetoothDevice remote_bluetooth_device = + bluetooth_medium.GetRemoteDevice(remote_mac_address.value()); + if (!remote_bluetooth_device.IsValid()) { + NEARBY_LOGS(INFO) + << "ReconnectBluetooth failed since remoteBluetoothDevice is null: " + << remote_mac_address.value(); + return false; + } + + bluetooth_socket_ = + bluetooth_medium.Connect(remote_bluetooth_device, reconnect_service_id_, + client_->GetCancellationFlag(endpoint_id_)); + + if (!bluetooth_socket_.IsValid()) { + NEARBY_LOGS(ERROR) << "Failed to reconnect to Bluetooth device " + << remote_bluetooth_device.GetName() + << " for endpoint(id=" << endpoint_id_ << ")."; + return false; + } + + reconnect_channel_ = std::make_unique( + UnWrapInitiatorReconnectServiceId(reconnect_service_id_), + /*channel_name=*/endpoint_id_, bluetooth_socket_); + if (reconnect_channel_ == nullptr) { + NEARBY_LOGS(ERROR) << "ReconnectBluetooth Failed to get the Bluetooth " + "channel, please retry "; + bluetooth_socket_.Close(); + return false; + } + return true; +} + +bool ReconnectManager::BluetoothImpl::SupportEncryptionDisabled() { + return false; +} + +void ReconnectManager::BluetoothImpl::QuietlyCloseChannelAndSocket() { + reconnect_channel_->Close(DisconnectionReason::UNFINISHED); + bluetooth_socket_.Close(); +} + +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/reconnect_manager.h b/connections/implementation/reconnect_manager.h new file mode 100644 index 00000000..ecc29646 --- /dev/null +++ b/connections/implementation/reconnect_manager.h @@ -0,0 +1,237 @@ +// Copyright 2023 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_INTERNAL_RECONNECTION_MANAGER_H_ +#define CORE_INTERNAL_RECONNECTION_MANAGER_H_ + +#include +#include +#include + +#include "securegcm/ukey2_handshake.h" +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/functional/any_invocable.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/encryption_runner.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/mediums/bluetooth_classic.h" +#include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/proto/offline_wire_formats.pb.h" +#include "internal/platform/bluetooth_classic.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancelable_alarm.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/mutex.h" +#include "internal/platform/scheduled_executor.h" +#include "internal/platform/single_thread_executor.h" + +namespace nearby { +namespace connections { +using AutoReconnectFrame = ::location::nearby::connections::AutoReconnectFrame; +using OfflineFrame = ::location::nearby::connections::OfflineFrame; +using Medium = ::location::nearby::proto::connections::Medium; +using DisconnectionReason = + ::location::nearby::proto::connections::DisconnectionReason; + +class ReconnectManager { + public: + ReconnectManager(Mediums& mediums, EndpointChannelManager& channel_manager); + ~ReconnectManager(); + + struct AutoReconnectCallback { + absl::AnyInvocable + on_reconnect_success_cb; + absl::AnyInvocable + on_reconnect_failure_cb; + }; + + struct ReconnectMetadata { + ReconnectMetadata(bool is_incoming, AutoReconnectCallback callback, + bool send_disconnection_notification, + DisconnectionReason disconnection_reason, + const std::string& reconnect_service_id) + : reconnect_service_id(reconnect_service_id), + is_incoming(is_incoming), + send_disconnection_notification(send_disconnection_notification), + disconnection_reason(disconnection_reason) { + reconnect_cb = std::move(callback); + } + ~ReconnectMetadata() noexcept = default; + ReconnectMetadata(ReconnectMetadata&&) = default; + ReconnectMetadata& operator=(ReconnectMetadata&&) = default; + + AutoReconnectCallback reconnect_cb; + std::string reconnect_service_id; + bool is_incoming; + bool send_disconnection_notification; + DisconnectionReason disconnection_reason = + DisconnectionReason::UNKNOWN_DISCONNECTION_REASON; + }; + + // The entry point for AutoReconect, this API will do the auto reconnect for + // specified "endpoint_id" which connection was lost before. + bool AutoReconnect(ClientProxy* client, const std::string& endpoint_id, + AutoReconnectCallback& callback, + bool send_disconnection_notification, + DisconnectionReason disconnection_reason); + + private: + class MediumConnectionProcessor { + public: + virtual ~MediumConnectionProcessor() = default; + + virtual bool IsMediumRadioOn() const = 0; + virtual bool IsListeningForIncomingConnections() const = 0; + virtual bool StartListeningForIncomingConnections() = 0; + virtual void StopListeningForIncomingConnections() = 0; + virtual bool ConnectOverMedium() = 0; + virtual bool SupportEncryptionDisabled() = 0; + virtual void QuietlyCloseChannelAndSocket() = 0; + }; + + class BaseMediumImpl : public MediumConnectionProcessor { + public: + BaseMediumImpl(ClientProxy* client, const std::string& endpoint_id, + const std::string& reconnect_service_id, bool is_incoming, + Medium medium, Mediums* mediums, + EndpointChannelManager* channel_manager, + ReconnectManager& reconnect_manager) + : client_(client), + endpoint_id_(endpoint_id), + reconnect_service_id_(reconnect_service_id), + is_incoming_(is_incoming), + medium_(medium), + mediums_(mediums), + channel_manager_(channel_manager), + reconnect_manager_(reconnect_manager) {} + ~BaseMediumImpl() override = default; + + bool Run(); + + protected: + ClientProxy* client_; + std::string endpoint_id_; + std::string reconnect_service_id_; + bool is_incoming_; + Medium medium_ = Medium::UNKNOWN_MEDIUM; + Mediums* mediums_; + EndpointChannelManager* channel_manager_; + std::unique_ptr reconnect_channel_; + ReconnectManager& reconnect_manager_; + void OnIncomingConnection(const std::string& reconnect_service_id); + + private: + bool RehostForIncomingConnections(); + bool ReconnectToRemoteDevice(); + + std::string ReadClientIntroductionFrame(EndpointChannel* endpoint_channel); + bool ReadClientIntroductionAckFrame(EndpointChannel* endpoint_channel); + bool ReplaceChannelForEndpoint( + ClientProxy* client, const std::string& endpoint_id, + std::unique_ptr new_channel, + bool support_encryption_disabled, + absl::AnyInvocable stop_listening_incoming_connection); + EncryptionRunner::ResultListener GetResultListener(); + void OnEncryptionSuccessRunnable( + const std::string& endpoint_id, + std::unique_ptr ukey2, + const std::string& auth_token, const ByteArray& raw_auth_token); + void OnEncryptionFailureRunnable(const std::string& endpoint_id, + EndpointChannel* endpoint_channel); + void ProcessSuccessfulReconnection( + const std::string& endpoint_id, + absl::AnyInvocable stop_listening_incoming_connection); + void ProcessFailedReconnection( + const std::string& endpoint_id, + absl::AnyInvocable stop_listening_incoming_connection); + void StopListeningIfAllConnected( + const std::string& reconnect_service_id, + absl::AnyInvocable stop_listening_incoming_connection, + bool force_stop); + bool HasPendingIncomingConnections(const std::string& reconnect_service_id); + void CancelClearHostTimeoutAlarm(const std::string& service_id); + void ClearReconnectData(const std::string& service_id, bool is_incoming); + + std::unique_ptr wait_encryption_to_finish_; + bool replace_channel_succeed_; + }; + + class BluetoothImpl : public BaseMediumImpl { + public: + BluetoothImpl(ClientProxy* client_proxy, const std::string& endpoint_id, + const std::string& reconnect_service_id, bool is_incoming, + Medium medium, Mediums* mediums, + EndpointChannelManager* channel_manager, + ReconnectManager& reconnect_manager) + : BaseMediumImpl(client_proxy, endpoint_id, reconnect_service_id, + is_incoming, medium, mediums, channel_manager, + reconnect_manager), + bluetooth_medium_(mediums_->GetBluetoothClassic()) {} + + bool IsMediumRadioOn() const override; + bool IsListeningForIncomingConnections() const override; + bool StartListeningForIncomingConnections() override; + void StopListeningForIncomingConnections() override; + bool ConnectOverMedium() override; + bool SupportEncryptionDisabled() override; + void QuietlyCloseChannelAndSocket() override; + + private: + void OnIncomingBluetoothConnection(ClientProxy* client, + const std::string& upgrade_service_id, + BluetoothSocket socket); + + BluetoothClassic& bluetooth_medium_; + BluetoothSocket bluetooth_socket_; + }; + + bool Start(bool is_incoming, ClientProxy* client_proxy, + const std::string& endpoint_id, + const std::string& reconnect_service_id, Medium medium); + bool RunOnce(bool is_incoming, ClientProxy* client, + const std::string& endpoint_id, + const std::string& reconnect_service_id, Medium medium); + + void ClearReconnectData(ClientProxy* client, + const std::string& reconnect_service_id, + bool is_incoming); + void Shutdown(); + + Mediums* mediums_; + EndpointChannelManager* channel_manager_; + EncryptionRunner encryption_runner_; + + SingleThreadExecutor reconnect_executor_; + ScheduledExecutor alarm_executor_; + SingleThreadExecutor incoming_connection_cb_executor_; + SingleThreadExecutor encryption_cb_executor_; + + mutable RecursiveMutex mutex_; + absl::flat_hash_map> + listen_timeout_alarm_by_service_id_ ABSL_GUARDED_BY(mutex_); + absl::flat_hash_map> + new_endpoint_channels_; + absl::flat_hash_map endpoint_id_metadata_map_; + absl::flat_hash_set resumed_endpoints_; +}; + +} // namespace connections +} // namespace nearby + +#endif // CORE_INTERNAL_RECONNECTION_MANAGER_H_ diff --git a/connections/implementation/reconnect_manager_test.cc b/connections/implementation/reconnect_manager_test.cc new file mode 100644 index 00000000..739a7d3a --- /dev/null +++ b/connections/implementation/reconnect_manager_test.cc @@ -0,0 +1,149 @@ +// Copyright 2023 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. + +#include "connections/implementation/reconnect_manager.h" + +#include +#include + +#include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/simulation_user.h" +#include "connections/medium_selector.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/logging.h" +#include "internal/platform/medium_environment.h" + +namespace nearby { +namespace connections { +namespace { + +constexpr absl::string_view kServiceId = "service-id"; +constexpr absl::string_view kDeviceA = "device-a"; +constexpr absl::string_view kDeviceB = "device-b"; +constexpr absl::Duration kDefaultTimeout = absl::Milliseconds(1000); + +constexpr BooleanMediumSelector kTestCases[] = { + BooleanMediumSelector{ + .bluetooth = true + }, +}; + +class ReconnectSimulatorUser : public SimulationUser { + public: + explicit ReconnectSimulatorUser( + absl::string_view name, + BooleanMediumSelector allowed = BooleanMediumSelector()) + : SimulationUser(std::string(name), allowed, + SetSafeToDisconnect(true, true, false, 3)) {} + ~ReconnectSimulatorUser() override { + NEARBY_LOGS(INFO) << "ReconnectSimulatorUser: [down] name=" << info_.data(); + } + + bool IsConnected() const { + return client_.IsConnectedToEndpoint(discovered_.endpoint_id); + } + + protected: +}; + +class ReconnectManagerTest + : public ::testing::TestWithParam { + protected: + bool SetupConnection(ReconnectSimulatorUser& user_a, + ReconnectSimulatorUser& user_b) { + user_a.StartAdvertising(std::string(kServiceId), &connection_latch_); + user_b.StartDiscovery(std::string(kServiceId), &discovery_latch_); + EXPECT_TRUE(discovery_latch_.Await(kDefaultTimeout).result()); + EXPECT_EQ(user_b.GetDiscovered().service_id, kServiceId); + EXPECT_EQ(user_b.GetDiscovered().endpoint_info, user_a.GetInfo()); + EXPECT_FALSE(user_b.GetDiscovered().endpoint_id.empty()); + NEARBY_LOGS(INFO) << "EP-B: [discovered]" + << user_b.GetDiscovered().endpoint_id; + user_b.RequestConnection(&connection_latch_); + EXPECT_TRUE(connection_latch_.Await(kDefaultTimeout).result()); + EXPECT_FALSE(user_a.GetDiscovered().endpoint_id.empty()); + NEARBY_LOGS(INFO) << "EP-A: [discovered]" + << user_a.GetDiscovered().endpoint_id; + NEARBY_LOGS(INFO) << "Both users discovered their peers."; + user_a.AcceptConnection(&accept_latch_); + user_b.AcceptConnection(&accept_latch_); + EXPECT_TRUE(accept_latch_.Await(kDefaultTimeout).result()); + NEARBY_LOGS(INFO) << "Both users reached connected state."; + return user_a.IsConnected() && user_b.IsConnected(); + } + + CountDownLatch discovery_latch_{1}; + CountDownLatch connection_latch_{2}; + CountDownLatch accept_latch_{2}; + CountDownLatch reject_latch_{1}; + MediumEnvironment& env_{MediumEnvironment::Instance()}; +}; + +TEST_P(ReconnectManagerTest, AllowReconnect) { + env_.Start(); + ReconnectSimulatorUser user_a(kDeviceA, GetParam()); + ReconnectSimulatorUser user_b(kDeviceB, GetParam()); + ASSERT_TRUE(SetupConnection(user_a, user_b)); + + Mediums mediums; + ReconnectManager::AutoReconnectCallback auto_reconnect_callback = { + .on_reconnect_success_cb = + [&](ClientProxy* client, const std::string& endpoint_id) { + NEARBY_LOGS(INFO) + << " Reconnect successfully for endpoint_id: " << endpoint_id; + }, + .on_reconnect_failure_cb = + [&](ClientProxy* client, const std::string& endpoint_id, + bool send_disconnection_notification, + DisconnectionReason disconnection_reason) { + NEARBY_LOGS(INFO) + << " Reconnect failed for endpoint_id: " << endpoint_id; + }, + }; + + auto& client_a = user_a.GetClient(); + auto& client_b = user_b.GetClient(); + EndpointChannelManager& ecm_a = user_a.GetEndpointChannelManager(); + EndpointChannelManager& ecm_b = user_b.GetEndpointChannelManager(); + + auto reconnect_manager_a = std::make_unique(mediums, ecm_a); + auto reconnect_manager_b = std::make_unique(mediums, ecm_b); + EXPECT_TRUE(reconnect_manager_a->AutoReconnect( + &client_a, user_a.GetDiscovered().endpoint_id, auto_reconnect_callback, + /*send_disconnection_notification=*/false, + DisconnectionReason::UNFINISHED)); + EXPECT_TRUE(reconnect_manager_b->AutoReconnect( + &client_b, user_b.GetDiscovered().endpoint_id, auto_reconnect_callback, + /*send_disconnection_notification=*/false, + DisconnectionReason::UNFINISHED)); + + NEARBY_LOGS(INFO) << "Test completed."; + user_a.Stop(); + user_b.Stop(); + env_.Stop(); +} + +INSTANTIATE_TEST_SUITE_P(ParametrisedReconnectManagerTest, ReconnectManagerTest, + ::testing::ValuesIn(kTestCases)); + +// More test will be added later. + +} // namespace +} // namespace connections +} // namespace nearby diff --git a/connections/implementation/service_controller.h b/connections/implementation/service_controller.h index c8ca7742..e0dbbf31 100644 --- a/connections/implementation/service_controller.h +++ b/connections/implementation/service_controller.h @@ -29,6 +29,7 @@ #include "connections/status.h" #include "connections/v3/connection_listening_options.h" #include "connections/v3/listeners.h" +#include "internal/interop/device.h" namespace nearby { namespace connections { @@ -73,7 +74,7 @@ class ServiceController { virtual Status StartDiscovery(ClientProxy* client, const std::string& service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener) = 0; + DiscoveryListener listener) = 0; virtual void StopDiscovery(ClientProxy* client) = 0; virtual void InjectEndpoint(ClientProxy* client, @@ -92,6 +93,11 @@ class ServiceController { ClientProxy* client, const std::string& endpoint_id, const ConnectionRequestInfo& info, const ConnectionOptions& connection_options) = 0; + + virtual Status RequestConnectionV3( + ClientProxy* client, const NearbyDevice& remote_device, + const ConnectionRequestInfo& info, + const ConnectionOptions& connection_options) = 0; virtual Status AcceptConnection(ClientProxy* client, const std::string& endpoint_id, PayloadListener listener) = 0; diff --git a/connections/implementation/service_controller_router.cc b/connections/implementation/service_controller_router.cc index e50a3999..d57ccbed 100644 --- a/connections/implementation/service_controller_router.cc +++ b/connections/implementation/service_controller_router.cc @@ -19,8 +19,9 @@ #include #include -#include "absl/memory/memory.h" +#include "connections/discovery_options.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/offline_service_controller.h" #include "connections/listeners.h" #include "connections/params.h" @@ -29,6 +30,8 @@ #include "connections/v3/connection_result.h" #include "connections/v3/connections_device.h" #include "connections/v3/listening_result.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/logging.h" // TODO(b/285657711): Add tests for uncovered logic, even if trivial. @@ -75,6 +78,7 @@ v3::Quality ServiceControllerRouter::GetMediumQuality(Medium medium) { case location::nearby::proto::connections::WIFI_AWARE: case location::nearby::proto::connections::WIFI_DIRECT: case location::nearby::proto::connections::WEB_RTC: + case location::nearby::proto::connections::WEB_RTC_NON_CELLULAR: return v3::Quality::kHigh; default: return v3::Quality::kUnknown; @@ -85,6 +89,24 @@ ServiceControllerRouter::ServiceControllerRouter() { NEARBY_LOGS(INFO) << "ServiceControllerRouter going up."; } +// Constructor called by the CrOS platform implementation to override the +// kEnableBleV2 flag. +ServiceControllerRouter::ServiceControllerRouter(bool enable_ble_v2) + : ServiceControllerRouter() { + if (NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2) != + enable_ble_v2) { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableBleV2, + enable_ble_v2); + // CrOS uses the async signature for Scanning and has no support for the + // sync version. + // TODO(b/333408829): Enable async advertising flag once supported. + const_cast(FeatureFlags::GetInstance()) + .SetFlags({.enable_ble_v2_async_scanning = true}); + } +} + ServiceControllerRouter::~ServiceControllerRouter() { NEARBY_LOGS(INFO) << "ServiceControllerRouter going down."; @@ -127,19 +149,20 @@ void ServiceControllerRouter::StopAdvertising(ClientProxy* client, void ServiceControllerRouter::StartDiscovery( ClientProxy* client, absl::string_view service_id, - const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener, ResultCallback callback) { + const DiscoveryOptions& discovery_options, DiscoveryListener listener, + ResultCallback callback) { RouteToServiceController( "scr-start-discovery", [this, client, service_id = std::string(service_id), discovery_options, - listener, callback = std::move(callback)]() mutable { + listener = std::move(listener), + callback = std::move(callback)]() mutable { if (client->IsDiscovering()) { callback({Status::kAlreadyDiscovering}); return; } callback(GetServiceController()->StartDiscovery( - client, service_id, discovery_options, listener)); + client, service_id, discovery_options, std::move(listener))); }); } @@ -400,10 +423,10 @@ void ServiceControllerRouter::RequestConnectionV3( client->AddCancellationFlag(remote_device.GetEndpointId()); RouteToServiceController( - "scr-request-connection", - [this, client, endpoint_id = remote_device.GetEndpointId(), - v3_info = std::move(info), connection_options, - callback = std::move(callback)]() mutable { + "scr-request-connection-v3", + [this, client, &remote_device, v3_info = std::move(info), + connection_options, callback = std::move(callback)]() mutable { + std::string endpoint_id = remote_device.GetEndpointId(); if (client->HasPendingConnectionToEndpoint(endpoint_id) || client->IsConnectedToEndpoint(endpoint_id)) { callback({Status::kAlreadyConnectedToEndpoint}); @@ -420,7 +443,7 @@ void ServiceControllerRouter::RequestConnectionV3( ConnectionListener listener = { .initiated_cb = - [&v3_info]( + [&v3_info, &remote_device]( const std::string& endpoint_id, const ConnectionResponseInfo& response_info) mutable { v3::InitialConnectionInfo new_info = { @@ -430,11 +453,10 @@ void ServiceControllerRouter::RequestConnectionV3( response_info.raw_authentication_token.string_data(), .is_incoming_connection = response_info.is_incoming_connection, + .authentication_status = + response_info.authentication_status, }; - v3::ConnectionsDevice device( - endpoint_id, - response_info.remote_endpoint_info.AsStringView(), {}); - v3_info.listener.initiated_cb(device, new_info); + v3_info.listener.initiated_cb(remote_device, new_info); }, .accepted_cb = [result_cb = v3_info.listener.result_cb]( @@ -473,8 +495,8 @@ void ServiceControllerRouter::RequestConnectionV3( .endpoint_info = ByteArray(endpoint_info), .listener = std::move(listener), }; - Status status = GetServiceController()->RequestConnection( - client, endpoint_id, std::move(old_info), connection_options); + Status status = GetServiceController()->RequestConnectionV3( + client, remote_device, std::move(old_info), connection_options); if (!status.Ok()) { NEARBY_LOGS(WARNING) << "Unable to request connection to endpoint " << endpoint_id << ": " << status.ToString(); diff --git a/connections/implementation/service_controller_router.h b/connections/implementation/service_controller_router.h index 9b3ee470..31f7a9c3 100644 --- a/connections/implementation/service_controller_router.h +++ b/connections/implementation/service_controller_router.h @@ -58,6 +58,7 @@ namespace connections { class ServiceControllerRouter { public: ServiceControllerRouter(); + explicit ServiceControllerRouter(bool enable_ble_v2); virtual ~ServiceControllerRouter(); // Not copyable or movable ServiceControllerRouter(const ServiceControllerRouter&) = delete; @@ -76,7 +77,7 @@ class ServiceControllerRouter { virtual void StartDiscovery(ClientProxy* client, absl::string_view service_id, const DiscoveryOptions& discovery_options, - const DiscoveryListener& listener, + DiscoveryListener listener, ResultCallback callback); virtual void StopDiscovery(ClientProxy* client, ResultCallback callback); diff --git a/connections/implementation/service_controller_router_test.cc b/connections/implementation/service_controller_router_test.cc index be3c7e0a..7d8599ba 100644 --- a/connections/implementation/service_controller_router_test.cc +++ b/connections/implementation/service_controller_router_test.cc @@ -26,6 +26,7 @@ #include "gtest/gtest.h" #include "absl/types/span.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" #include "connections/implementation/mock_service_controller.h" #include "connections/listeners.h" #include "connections/params.h" @@ -35,6 +36,8 @@ #include "connections/v3/connections_device.h" #include "connections/v3/listening_result.h" #include "connections/v3/params.h" +#include "internal/interop/authentication_status.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/byte_array.h" #include "internal/platform/condition_variable.h" #include "internal/platform/count_down_latch.h" @@ -56,10 +59,10 @@ class FakeNearbyDevice : public NearbyDevice { NearbyDevice::Type GetType() const override { return NearbyDevice::Type::kUnknownDevice; } - MOCK_METHOD(std::string, GetEndpointId, (), (const override)); + MOCK_METHOD(std::string, GetEndpointId, (), (const, override)); MOCK_METHOD(std::vector, GetConnectionInfos, (), - (const override)); - MOCK_METHOD(std::string, ToProtoBytes, (), (const override)); + (const, override)); + MOCK_METHOD(std::string, ToProtoBytes, (), (const, override)); }; // This class must be in the same namespace as ServiceControllerRouter for @@ -104,20 +107,19 @@ class ServiceControllerRouterTest : public testing::Test { void StartDiscovery(ClientProxy* client, std::string service_id, DiscoveryOptions discovery_options, - const DiscoveryListener& listener, - ResultCallback callback) { + DiscoveryListener listener, ResultCallback callback) { EXPECT_CALL(*mock_, StartDiscovery) .WillOnce(Return(Status{Status::kSuccess})); { MutexLock lock(&mutex_); complete_ = false; - router_.StartDiscovery(client, kServiceId, discovery_options, listener, + router_.StartDiscovery(client, kServiceId, discovery_options, {}, std::move(callback)); while (!complete_) cond_.Wait(); EXPECT_EQ(result_, Status{Status::kSuccess}); } - client->StartedDiscovery(service_id, discovery_options.strategy, listener, - absl::MakeSpan(mediums_)); + client->StartedDiscovery(service_id, discovery_options.strategy, + std::move(listener), absl::MakeSpan(mediums_)); EXPECT_TRUE(client->IsDiscovering()); } @@ -185,8 +187,7 @@ class ServiceControllerRouterTest : public testing::Test { while (!complete_) cond_.Wait(); EXPECT_EQ(result_, Status{Status::kSuccess}); } - client->LocalEndpointAcceptedConnection(endpoint_id, - {}); + client->LocalEndpointAcceptedConnection(endpoint_id, {}); client->RemoteEndpointAcceptedConnection(endpoint_id); EXPECT_TRUE(client->IsConnectionAccepted(endpoint_id)); client->OnConnectionAccepted(endpoint_id); @@ -278,18 +279,28 @@ class ServiceControllerRouterTest : public testing::Test { v3::ConnectionRequestInfo request_info, ResultCallback callback, bool call_all_cb, bool check_result = true, - bool endpoint_info_present = true) { + bool endpoint_info_present = true, + AuthenticationStatus authentication_status = + AuthenticationStatus::kSuccess) { + ConnectionResponseInfo response_info{ + .remote_endpoint_info = ByteArray{"endpoint_name"}, + .authentication_token = "auth_token", + .raw_authentication_token = ByteArray{"auth_token"}, + .is_incoming_connection = true, + .authentication_status = authentication_status, + }; + // If we set check_result to false, we expect that RequestConnection will // not be called. if (check_result) { - EXPECT_CALL(*mock_, RequestConnection) - .WillOnce([call_all_cb, endpoint_info_present, this]( - ClientProxy*, const std::string&, + EXPECT_CALL(*mock_, RequestConnectionV3) + .WillOnce([call_all_cb, endpoint_info_present, response_info, this]( + ClientProxy*, const NearbyDevice&, const ConnectionRequestInfo& info, const ConnectionOptions&) { EXPECT_EQ(info.endpoint_info.Empty(), !endpoint_info_present); if (call_all_cb) { - info.listener.initiated_cb(kRemoteEndpointId, {}); + info.listener.initiated_cb(kRemoteEndpointId, response_info); info.listener.accepted_cb(kRemoteEndpointId); info.listener.rejected_cb(kRemoteEndpointId, Status{Status::kConnectionRejected}); @@ -312,12 +323,6 @@ class ServiceControllerRouterTest : public testing::Test { EXPECT_EQ(result_, Status{Status::kSuccess}); } } - ConnectionResponseInfo response_info{ - .remote_endpoint_info = ByteArray{"endpoint_name"}, - .authentication_token = "auth_token", - .raw_authentication_token = ByteArray{"auth_token"}, - .is_incoming_connection = true, - }; if (client->HasPendingConnectionToEndpoint(kRemoteDevice.GetEndpointId())) { // we are calling this again, and do not need to rerun the below behavior. return; @@ -506,8 +511,6 @@ class ServiceControllerRouterTest : public testing::Test { .listener = ConnectionListener(), }; - DiscoveryListener discovery_listener_; - Mutex mutex_; ConditionVariable cond_{&mutex_}; Status result_ ABSL_GUARDED_BY(mutex_) = {Status::kError}; @@ -534,6 +537,32 @@ TEST_F(ServiceControllerRouterTest, QualityConversionWorks) { EXPECT_EQ(router_.GetMediumQuality(Medium::WIFI_AWARE), v3::Quality::kHigh); } +TEST_F(ServiceControllerRouterTest, EnableBleV2InConstructor) { + // This constructor is used to allow the platform to set the value + // of kEnableBleV2 to |enable_ble_v2|. + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableBleV2, false); + EXPECT_FALSE(NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)); + ServiceControllerRouter ble_v2_enabled_router = + ServiceControllerRouter(/*enable_ble_v2=*/true); + EXPECT_TRUE(NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)); +} + +TEST_F(ServiceControllerRouterTest, DisableBleV2InConstructor) { + // This constructor is used to allow the platform to set the value + // of kEnableBleV2 to |enable_ble_v2|. + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableBleV2, true); + EXPECT_TRUE(NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)); + ServiceControllerRouter ble_v2_disabled_router = + ServiceControllerRouter(/*enable_ble_v2=*/false); + EXPECT_FALSE(NearbyFlags::GetInstance().GetBoolFlag( + config_package_nearby::nearby_connections_feature::kEnableBleV2)); +} + TEST_F(ServiceControllerRouterTest, StartAdvertisingCalled) { StartAdvertising(&client_, kServiceId, kAdvertisingOptions, kConnectionRequestInfo, [this](Status status) { @@ -561,7 +590,7 @@ TEST_F(ServiceControllerRouterTest, StopAdvertisingCalled) { } TEST_F(ServiceControllerRouterTest, StartDiscoveryCalled) { - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -571,7 +600,7 @@ TEST_F(ServiceControllerRouterTest, StartDiscoveryCalled) { } TEST_F(ServiceControllerRouterTest, StopDiscoveryCalled) { - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -587,7 +616,7 @@ TEST_F(ServiceControllerRouterTest, StopDiscoveryCalled) { } TEST_F(ServiceControllerRouterTest, InjectEndpointCalled) { - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -611,7 +640,7 @@ TEST_F(ServiceControllerRouterTest, InjectEndpointCalled) { TEST_F(ServiceControllerRouterTest, RequestConnectionCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -629,7 +658,7 @@ TEST_F(ServiceControllerRouterTest, RequestConnectionCalled) { TEST_F(ServiceControllerRouterTest, AcceptConnectionCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -655,7 +684,7 @@ TEST_F(ServiceControllerRouterTest, AcceptConnectionCalled) { TEST_F(ServiceControllerRouterTest, RejectConnectionCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -681,7 +710,7 @@ TEST_F(ServiceControllerRouterTest, RejectConnectionCalled) { TEST_F(ServiceControllerRouterTest, InitiateBandwidthUpgradeCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -714,7 +743,7 @@ TEST_F(ServiceControllerRouterTest, InitiateBandwidthUpgradeCalled) { TEST_F(ServiceControllerRouterTest, SendPayloadCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -748,7 +777,7 @@ TEST_F(ServiceControllerRouterTest, SendPayloadCalled) { TEST_F(ServiceControllerRouterTest, CancelPayloadCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -783,7 +812,7 @@ TEST_F(ServiceControllerRouterTest, CancelPayloadCalled) { TEST_F(ServiceControllerRouterTest, DisconnectFromEndpointCalled) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -816,7 +845,7 @@ TEST_F(ServiceControllerRouterTest, DisconnectFromEndpointCalled) { TEST_F(ServiceControllerRouterTest, RequestConnectionCalledV3) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -838,7 +867,9 @@ TEST_F(ServiceControllerRouterTest, RequestConnectionCalledV3) { .listener = { .initiated_cb = [&initiated_latch](const NearbyDevice&, - const v3::InitialConnectionInfo&) { + const v3::InitialConnectionInfo& info) { + EXPECT_EQ(info.authentication_status, + AuthenticationStatus::kSuccess); initiated_latch.CountDown(); }, .result_cb = @@ -868,9 +899,67 @@ TEST_F(ServiceControllerRouterTest, RequestConnectionCalledV3) { EXPECT_TRUE(bandwidth_changed_latch.Await().Ok()); } +TEST_F(ServiceControllerRouterTest, + RequestConnectionCalledV3_AuthenticationStatusFail) { + // Either Advertising, or Discovery should be ongoing. + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, + [this](Status status) { + MutexLock lock(&mutex_); + result_ = status; + complete_ = true; + cond_.Notify(); + }); + // Establish connection. + auto local_device = + v3::ConnectionsDevice(client_.GetLocalEndpointId(), kRequestorName, {}); + // Testing callback wrapping as well. + CountDownLatch initiated_latch(1); + CountDownLatch result_latch(2); + CountDownLatch disconnected_latch(1); + CountDownLatch bandwidth_changed_latch(1); + + RequestConnectionV3( + &client_, kRemoteDevice, + v3::ConnectionRequestInfo{ + .local_device = local_device, + .listener = { + .initiated_cb = + [&initiated_latch](const NearbyDevice&, + const v3::InitialConnectionInfo& info) { + EXPECT_EQ(info.authentication_status, + AuthenticationStatus::kFailure); + initiated_latch.CountDown(); + }, + .result_cb = + [&result_latch](const NearbyDevice&, v3::ConnectionResult) { + result_latch.CountDown(); + }, + .disconnected_cb = + [&disconnected_latch](const NearbyDevice&) { + disconnected_latch.CountDown(); + }, + .bandwidth_changed_cb = + [&bandwidth_changed_latch](const NearbyDevice&, + v3::BandwidthInfo) { + bandwidth_changed_latch.CountDown(); + }}, + }, + [this](Status status) { + MutexLock lock(&mutex_); + result_ = status; + complete_ = true; + cond_.Notify(); + }, + true, true, true, AuthenticationStatus::kFailure); + EXPECT_TRUE(initiated_latch.Await().Ok()); + EXPECT_TRUE(result_latch.Await().Ok()); + EXPECT_TRUE(disconnected_latch.Await().Ok()); + EXPECT_TRUE(bandwidth_changed_latch.Await().Ok()); +} + TEST_F(ServiceControllerRouterTest, RequestConnectionV3FakeDevice) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -923,7 +1012,7 @@ TEST_F(ServiceControllerRouterTest, RequestConnectionV3FakeDevice) { TEST_F(ServiceControllerRouterTest, RequestConnectionV3TwiceFails) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -967,7 +1056,7 @@ TEST_F(ServiceControllerRouterTest, RequestConnectionV3TwiceFails) { TEST_F(ServiceControllerRouterTest, AcceptConnectionCalledV3) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -1001,7 +1090,7 @@ TEST_F(ServiceControllerRouterTest, AcceptConnectionCalledV3) { TEST_F(ServiceControllerRouterTest, RejectConnectionCalledV3) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -1035,7 +1124,7 @@ TEST_F(ServiceControllerRouterTest, RejectConnectionCalledV3) { TEST_F(ServiceControllerRouterTest, InitiateBandwidthUpgradeCalledV3) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -1076,7 +1165,7 @@ TEST_F(ServiceControllerRouterTest, InitiateBandwidthUpgradeCalledV3) { TEST_F(ServiceControllerRouterTest, SendPayloadCalledV3) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -1118,7 +1207,7 @@ TEST_F(ServiceControllerRouterTest, SendPayloadCalledV3) { TEST_F(ServiceControllerRouterTest, DisconnectFromDeviceCalledV3) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; @@ -1159,7 +1248,7 @@ TEST_F(ServiceControllerRouterTest, DisconnectFromDeviceCalledV3) { TEST_F(ServiceControllerRouterTest, CancelPayloadV3Called) { // Either Advertising, or Discovery should be ongoing. - StartDiscovery(&client_, kServiceId, kDiscoveryOptions, discovery_listener_, + StartDiscovery(&client_, kServiceId, kDiscoveryOptions, DiscoveryListener{}, [this](Status status) { MutexLock lock(&mutex_); result_ = status; diff --git a/connections/implementation/service_id_constants.h b/connections/implementation/service_id_constants.h index 42728228..dace640c 100644 --- a/connections/implementation/service_id_constants.h +++ b/connections/implementation/service_id_constants.h @@ -19,6 +19,7 @@ #include "absl/strings/match.h" #include "absl/strings/string_view.h" +#include "absl/strings/strip.h" namespace nearby { namespace connections { @@ -28,6 +29,7 @@ constexpr absl::string_view kUnknownServiceId = "UNKNOWN_SERVICE"; // A suffix appended to service IDs when initiating a bandwidth upgrade to // distinguish the mediums from those used for advertising/discovery. constexpr absl::string_view kInitiatorUpgradeServiceIdPostfix = "_UPGRADE"; +constexpr absl::string_view kInitiatorReconnectServiceIdPostfix = "_RECONNECT"; // Returns true if |service_id| not empty and has the initiator's upgrade // postfix. @@ -47,6 +49,37 @@ inline std::string WrapInitiatorUpgradeServiceId(absl::string_view service_id) { std::string(kInitiatorUpgradeServiceIdPostfix); } +// Returns true if |service_id| not empty and has the initiator's reconnect +// postfix. +inline bool IsInitiatorReconnectServiceId(absl::string_view service_id) { + return !service_id.empty() && + absl::EndsWith(service_id, kInitiatorReconnectServiceIdPostfix); +} + +// Appends the kInitiatorReconnectServiceIdPostfix to |service_id| if necessary. +inline std::string WrapInitiatorReconnectServiceId( + absl::string_view service_id) { + // If |service_id| is empty or already has the reconnect postfix, do nothing. + if (service_id.empty() || IsInitiatorReconnectServiceId(service_id)) { + return std::string(service_id); + } + + return std::string(service_id) + + std::string(kInitiatorReconnectServiceIdPostfix); +} + +// Appends the kInitiatorReconnectServiceIdPostfix to |service_id| if necessary. +inline std::string UnWrapInitiatorReconnectServiceId( + absl::string_view service_id) { + // If |service_id| is empty or already has the reconnect postfix, do nothing. + if (service_id.empty() || !IsInitiatorReconnectServiceId(service_id)) { + return std::string(service_id); + } + + return std::string( + absl::StripSuffix(service_id, kInitiatorReconnectServiceIdPostfix)); +} + } // namespace connections } // namespace nearby diff --git a/connections/implementation/simulation_user.cc b/connections/implementation/simulation_user.cc index 0c6dd570..5f2bf108 100644 --- a/connections/implementation/simulation_user.cc +++ b/connections/implementation/simulation_user.cc @@ -16,8 +16,9 @@ #include "absl/functional/bind_front.h" #include "connections/listeners.h" +#include "internal/interop/device.h" #include "internal/platform/count_down_latch.h" -#include "internal/platform/system_clock.h" +#include "internal/platform/logging.h" namespace nearby { namespace connections { @@ -26,9 +27,9 @@ void SimulationUser::OnConnectionInitiated(const std::string& endpoint_id, const ConnectionResponseInfo& info, bool is_outgoing) { if (is_outgoing) { - NEARBY_LOG(INFO, "RequestConnection: initiated_cb called"); + NEARBY_LOGS(INFO) << "RequestConnection: initiated_cb called"; } else { - NEARBY_LOG(INFO, "StartAdvertising: initiated_cb called"); + NEARBY_LOGS(INFO) << "StartAdvertising: initiated_cb called"; discovered_ = DiscoveredInfo{ .endpoint_id = endpoint_id, .endpoint_info = GetInfo(), @@ -50,7 +51,7 @@ void SimulationUser::OnConnectionRejected(const std::string& endpoint_id, void SimulationUser::OnEndpointFound(const std::string& endpoint_id, const ByteArray& endpoint_info, const std::string& service_id) { - NEARBY_LOG(INFO, "Device discovered: id=%s", endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "Device discovered: id=" << endpoint_id; discovered_ = DiscoveredInfo{ .endpoint_id = endpoint_id, .endpoint_info = endpoint_info, @@ -163,6 +164,29 @@ void SimulationUser::RequestConnection(CountDownLatch* latch) { .Ok()); } +void SimulationUser::RequestConnectionV3(CountDownLatch* latch, + const NearbyDevice& remote_device) { + initiated_latch_ = latch; + ConnectionListener listener = { + .initiated_cb = + std::bind(&SimulationUser::OnConnectionInitiated, this, + std::placeholders::_1, std::placeholders::_2, true), + .accepted_cb = + absl::bind_front(&SimulationUser::OnConnectionAccepted, this), + .rejected_cb = + absl::bind_front(&SimulationUser::OnConnectionRejected, this), + }; + client_.AddCancellationFlag(remote_device.GetEndpointId()); + EXPECT_TRUE( + mgr_.RequestConnectionV3(&client_, remote_device, + { + .endpoint_info = discovered_.endpoint_info, + .listener = std::move(listener), + }, + connection_options_) + .Ok()); +} + void SimulationUser::AcceptConnection(CountDownLatch* latch) { accept_latch_ = latch; PayloadListener listener = { diff --git a/connections/implementation/simulation_user.h b/connections/implementation/simulation_user.h index 7a66e4b7..417ab2f8 100644 --- a/connections/implementation/simulation_user.h +++ b/connections/implementation/simulation_user.h @@ -15,6 +15,7 @@ #ifndef CORE_INTERNAL_SIMULATION_USER_H_ #define CORE_INTERNAL_SIMULATION_USER_H_ +#include #include #include @@ -27,6 +28,7 @@ #include "connections/implementation/injected_bluetooth_device_store.h" #include "connections/implementation/payload_manager.h" #include "connections/implementation/pcp_manager.h" +#include "connections/v3/connections_device.h" #include "internal/flags/nearby_flags.h" #include "internal/platform/condition_variable.h" #include "internal/platform/count_down_latch.h" @@ -44,13 +46,16 @@ namespace connections { class SetSafeToDisconnect { public: - explicit SetSafeToDisconnect(bool safe_to_disconnect, + explicit SetSafeToDisconnect(bool safe_to_disconnect, bool auto_reconnect, bool payload_received_ack, std::int32_t safe_to_disconnect_version) { NearbyFlags::GetInstance().OverrideBoolFlagValue( config_package_nearby::nearby_connections_feature:: kEnableSafeToDisconnect, safe_to_disconnect); + NearbyFlags::GetInstance().OverrideBoolFlagValue( + config_package_nearby::nearby_connections_feature::kEnableAutoReconnect, + auto_reconnect); NearbyFlags::GetInstance().OverrideBoolFlagValue( config_package_nearby::nearby_connections_feature:: kEnablePayloadReceivedAck, @@ -73,9 +78,10 @@ class SimulationUser { void Clear() { endpoint_id.clear(); } }; - explicit SimulationUser( - const std::string& device_name, - BooleanMediumSelector allowed = BooleanMediumSelector()) + SimulationUser(const std::string& device_name, + BooleanMediumSelector allowed = BooleanMediumSelector(), + SetSafeToDisconnect set_safe_to_disconnect = + SetSafeToDisconnect(true, false, true, 5)) : info_{ByteArray{device_name}}, advertising_options_{ { @@ -96,7 +102,8 @@ class SimulationUser { Strategy::kP2pCluster, allowed, }, - } {} + }, + set_safe_to_disconnect_(set_safe_to_disconnect) {} virtual ~SimulationUser() { Stop(); } void Stop() { pm_.DisconnectFromEndpointManager(); @@ -128,6 +135,12 @@ class SimulationUser { // callback. void RequestConnection(CountDownLatch* latch); + // Calls PcpManager::RequestConnectionV3. + // If latch is provided, latch->CountDown() will be called in the initiated_cb + // callback. + void RequestConnectionV3(CountDownLatch* latch, + const NearbyDevice& remote_device); + // Calls PcpManager::AcceptConnection. // If latch is provided, latch->CountDown() will be called in the accepted_cb // callback. @@ -161,6 +174,9 @@ class SimulationUser { absl::AnyInvocable pred, absl::Duration timeout); + ClientProxy& GetClient() { return client_; } + EndpointChannelManager& GetEndpointChannelManager() { return ecm_; } + protected: // ConnectionListener callbacks void OnConnectionInitiated(const std::string& endpoint_id, @@ -199,7 +215,7 @@ class SimulationUser { AdvertisingOptions advertising_options_; ConnectionOptions connection_options_; DiscoveryOptions discovery_options_; - SetSafeToDisconnect set_safe_to_disconnect_{true, true, 2}; + SetSafeToDisconnect set_safe_to_disconnect_; ClientProxy client_; EndpointChannelManager ecm_; EndpointManager em_{&ecm_}; diff --git a/connections/implementation/webrtc_bwu_handler.cc b/connections/implementation/webrtc_bwu_handler.cc index 1fbdbb21..8d2b0652 100644 --- a/connections/implementation/webrtc_bwu_handler.cc +++ b/connections/implementation/webrtc_bwu_handler.cc @@ -16,16 +16,23 @@ #include "connections/implementation/webrtc_bwu_handler.h" +#include #include #include #include "absl/functional/bind_front.h" +#include "absl/strings/str_cat.h" #include "connections/implementation/base_bwu_handler.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/mediums/mediums.h" #include "connections/implementation/mediums/utils.h" #include "connections/implementation/mediums/webrtc_peer_id.h" +#include "connections/implementation/mediums/webrtc_socket.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/webrtc_endpoint_channel.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/logging.h" namespace nearby { namespace connections { @@ -60,35 +67,34 @@ WebrtcBwuHandler::CreateUpgradedEndpointChannel( if (web_rtc_credentials.has_location_hint()) { location_hint = web_rtc_credentials.location_hint(); } - NEARBY_LOG(INFO, - "WebRtcBwuHandler is attempting to connect to remote peer %s, " - "location hint %s", - peer_id.GetId().c_str(), location_hint.DebugString().c_str()); + NEARBY_LOGS(INFO) + << "WebRtcBwuHandler is attempting to connect to remote peer " + << peer_id.GetId() << ", location hint " + << absl::StrCat(location_hint.location()); - mediums::WebRtcSocketWrapper socket = - webrtc_.Connect(service_id, peer_id, location_hint, - client->GetCancellationFlag(endpoint_id)); + mediums::WebRtcSocketWrapper socket = webrtc_.Connect( + service_id, peer_id, location_hint, + client->GetCancellationFlag(endpoint_id), client->GetWebRtcNonCellular()); if (!socket.IsValid()) { - NEARBY_LOG(ERROR, - "WebRtcBwuHandler failed to connect to remote peer (%s) on " - "endpoint %s, aborting upgrade.", - peer_id.GetId().c_str(), endpoint_id.c_str()); + NEARBY_LOGS(ERROR) << "WebRtcBwuHandler failed to connect to remote peer (" + << peer_id.GetId() << ") on endpoint " << endpoint_id + << ", aborting upgrade."; return nullptr; } - NEARBY_LOG(INFO, - "WebRtcBwuHandler successfully connected to remote " - "peer (%s) while upgrading endpoint %s.", - peer_id.GetId().c_str(), endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "WebRtcBwuHandler successfully connected to remote " + "peer (" + << peer_id.GetId() << ") while upgrading endpoint " + << endpoint_id; // Create a new WebRtcEndpointChannel. auto channel = std::make_unique( service_id, /*channel_name=*/service_id, socket); if (channel == nullptr) { socket.Close(); - NEARBY_LOG(ERROR, - "WebRtcBwuHandler failed to create new EndpointChannel for " - "outgoing socket, aborting upgrade."); + NEARBY_LOGS(ERROR) + << "WebRtcBwuHandler failed to create new EndpointChannel for " + "outgoing socket, aborting upgrade."; } return channel; @@ -116,18 +122,18 @@ ByteArray WebrtcBwuHandler::HandleInitializeUpgradedMediumForEndpoint( if (!webrtc_.StartAcceptingConnections( upgrade_service_id, self_id, location_hint, absl::bind_front(&WebrtcBwuHandler::OnIncomingWebrtcConnection, - this, client))) { - NEARBY_LOG(ERROR, - "WebRtcBwuHandler couldn't initiate the WEB_RTC upgrade for " - "endpoint %s because it failed to start listening for " - "incoming WebRTC connections.", - endpoint_id.c_str()); + this, client), + client->GetWebRtcNonCellular())) { + NEARBY_LOGS(ERROR) << "WebRtcBwuHandler couldn't initiate the WEB_RTC " + "upgrade for endpoint " + << endpoint_id + << " because it failed to start listening for " + "incoming WebRTC connections."; return {}; } - NEARBY_LOG(INFO, - "WebRtcBwuHandler successfully started listening for incoming " - "WebRTC connections while upgrading endpoint %s", - endpoint_id.c_str()); + NEARBY_LOGS(INFO) << "WebRtcBwuHandler successfully started listening for " + "incoming WebRTC connections while upgrading endpoint " + << endpoint_id; } return parser::ForBwuWebrtcPathAvailable(self_id.GetId(), location_hint); diff --git a/connections/implementation/webrtc_bwu_handler.h b/connections/implementation/webrtc_bwu_handler.h index c45f7946..97e6cf44 100644 --- a/connections/implementation/webrtc_bwu_handler.h +++ b/connections/implementation/webrtc_bwu_handler.h @@ -17,13 +17,18 @@ #ifndef NO_WEBRTC +#include #include #include "connections/implementation/base_bwu_handler.h" +#include "connections/implementation/bwu_handler.h" #include "connections/implementation/client_proxy.h" -#include "connections/implementation/endpoint_channel_manager.h" +#include "connections/implementation/endpoint_channel.h" #include "connections/implementation/mediums/mediums.h" +#include "connections/implementation/mediums/webrtc.h" #include "connections/implementation/mediums/webrtc_socket.h" +#include "connections/medium_selector.h" +#include "internal/platform/byte_array.h" namespace nearby { namespace connections { diff --git a/connections/implementation/wifi_direct_bwu_handler.cc b/connections/implementation/wifi_direct_bwu_handler.cc index 0ff387c1..742aa002 100644 --- a/connections/implementation/wifi_direct_bwu_handler.cc +++ b/connections/implementation/wifi_direct_bwu_handler.cc @@ -14,15 +14,22 @@ #include "connections/implementation/wifi_direct_bwu_handler.h" +#include #include #include #include #include #include "absl/functional/bind_front.h" +#include "connections/implementation/base_bwu_handler.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/mediums/mediums.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/wifi_direct_endpoint_channel.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/logging.h" +#include "internal/platform/wifi_credential.h" #include "internal/platform/wifi_direct.h" namespace nearby { @@ -128,7 +135,7 @@ WifiDirectBwuHandler::CreateUpgradedEndpointChannel( return nullptr; } - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "WifiDirectBwuHandler successfully connected to WifiDirect service (" << port << ") while upgrading endpoint " << endpoint_id; diff --git a/connections/implementation/wifi_hotspot_bwu_handler.cc b/connections/implementation/wifi_hotspot_bwu_handler.cc index 9479924d..4e8b1247 100644 --- a/connections/implementation/wifi_hotspot_bwu_handler.cc +++ b/connections/implementation/wifi_hotspot_bwu_handler.cc @@ -14,16 +14,24 @@ #include "connections/implementation/wifi_hotspot_bwu_handler.h" +#include #include #include #include #include #include "absl/functional/bind_front.h" +#include "connections/implementation/base_bwu_handler.h" #include "connections/implementation/client_proxy.h" +#include "connections/implementation/endpoint_channel.h" +#include "connections/implementation/mediums/mediums.h" #include "connections/implementation/mediums/utils.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/wifi_hotspot_endpoint_channel.h" +#include "connections/strategy.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/logging.h" +#include "internal/platform/wifi_credential.h" #include "internal/platform/wifi_hotspot.h" namespace nearby { @@ -74,15 +82,16 @@ ByteArray WifiHotspotBwuHandler::HandleInitializeUpgradedMediumForEndpoint( std::string password = hotspot_crendential->GetPassword(); std::string gateway = hotspot_crendential->GetGateway(); std::int32_t port = hotspot_crendential->GetPort(); + std::int32_t frequency = hotspot_crendential->GetFrequency(); NEARBY_LOGS(INFO) << "Start SoftAP with SSID:" << ssid << ", Password:" << password << ", Port:" << port - << ", Gateway:" << gateway; + << ", Gateway:" << gateway << ", Frequency:" << frequency; bool disabling_encryption = (client->GetAdvertisingOptions().strategy == Strategy::kP2pPointToPoint); return parser::ForBwuWifiHotspotPathAvailable( - ssid, password, port, gateway, + ssid, password, port, frequency, gateway, /* supports_disabling_encryption */ disabling_encryption); } @@ -114,12 +123,13 @@ WifiHotspotBwuHandler::CreateUpgradedEndpointChannel( const std::string& password = upgrade_path_info_credentials.password(); const std::string& gateway = upgrade_path_info_credentials.gateway(); std::int32_t port = upgrade_path_info_credentials.port(); + std::int32_t frequency = upgrade_path_info_credentials.frequency(); NEARBY_LOGS(INFO) << "Received Hotspot credential SSID: " << ssid << ", Password:" << password << ", Port:" << port - << ", Gateway:" << gateway; + << ", Gateway:" << gateway << ", Frequency:" << frequency; - if (!wifi_hotspot_medium_.ConnectWifiHotspot(ssid, password)) { + if (!wifi_hotspot_medium_.ConnectWifiHotspot(ssid, password, frequency)) { NEARBY_LOGS(ERROR) << "Connect to Hotspot failed"; return nullptr; } @@ -133,7 +143,7 @@ WifiHotspotBwuHandler::CreateUpgradedEndpointChannel( return nullptr; } - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "WifiHotspotBwuHandler successfully connected to WifiHotspot service (" << gateway << ":" << port << ") while upgrading endpoint " << endpoint_id; diff --git a/connections/implementation/wifi_hotspot_test.cc b/connections/implementation/wifi_hotspot_bwu_test.cc similarity index 100% rename from connections/implementation/wifi_hotspot_test.cc rename to connections/implementation/wifi_hotspot_bwu_test.cc diff --git a/connections/implementation/wifi_lan_bwu_handler.cc b/connections/implementation/wifi_lan_bwu_handler.cc index 2a455e0c..b1cb3650 100644 --- a/connections/implementation/wifi_lan_bwu_handler.cc +++ b/connections/implementation/wifi_lan_bwu_handler.cc @@ -14,7 +14,6 @@ #include "connections/implementation/wifi_lan_bwu_handler.h" -#include #include #include @@ -22,8 +21,9 @@ #include "connections/implementation/client_proxy.h" #include "connections/implementation/offline_frames.h" #include "connections/implementation/wifi_lan_endpoint_channel.h" +#include "internal/platform/implementation/wifi_utils.h" +#include "internal/platform/logging.h" #include "internal/platform/wifi_lan.h" -#include "internal/platform/wifi_utils.h" namespace nearby { namespace connections { @@ -46,16 +46,16 @@ WifiLanBwuHandler::CreateUpgradedEndpointChannel( upgrade_path_info.wifi_lan_socket(); if (!upgrade_path_info_socket.has_ip_address() || !upgrade_path_info_socket.has_wifi_port()) { - NEARBY_LOG(ERROR, "WifiLanBwuHandler failed to parse UpgradePathInfo."); + NEARBY_LOGS(ERROR) << "WifiLanBwuHandler failed to parse UpgradePathInfo."; return nullptr; } const std::string& ip_address = upgrade_path_info_socket.ip_address(); std::int32_t port = upgrade_path_info_socket.wifi_port(); - NEARBY_LOGS(VERBOSE) << "WifiLanBwuHandler is attempting to connect to " - << "available WifiLan service (" << ip_address << ":" - << port << ") for endpoint " << endpoint_id; + NEARBY_VLOG(1) << "WifiLanBwuHandler is attempting to connect to " + << "available WifiLan service (" << ip_address << ":" << port + << ") for endpoint " << endpoint_id; WifiLanSocket socket = wifi_lan_medium_.Connect( service_id, ip_address, port, client->GetCancellationFlag(endpoint_id)); @@ -67,7 +67,7 @@ WifiLanBwuHandler::CreateUpgradedEndpointChannel( return nullptr; } - NEARBY_LOGS(VERBOSE) + NEARBY_VLOG(1) << "WifiLanBwuHandler successfully connected to WifiLan service (" << ip_address << ":" << port << ") while upgrading endpoint " << endpoint_id; diff --git a/connections/implementation/wifi_lan_service_info.cc b/connections/implementation/wifi_lan_service_info.cc index af687065..50986aba 100644 --- a/connections/implementation/wifi_lan_service_info.cc +++ b/connections/implementation/wifi_lan_service_info.cc @@ -68,29 +68,28 @@ WifiLanServiceInfo::WifiLanServiceInfo(const NsdServiceInfo& nsd_service_info) { if (!txt_endpoint_info_name.empty()) { endpoint_info_ = Base64Utils::Decode(txt_endpoint_info_name); if (endpoint_info_.size() > kMaxEndpointInfoLength) { - NEARBY_LOG(INFO, - "Cannot deserialize EndpointInfo: expecting endpoint info " - "max %d raw bytes, got %" PRIu64, - kMaxEndpointInfoLength, endpoint_info_.size()); + NEARBY_LOGS(INFO) + << "Cannot deserialize EndpointInfo: expecting endpoint info max " + << kMaxEndpointInfoLength << " raw bytes, got " + << endpoint_info_.size(); return; } } - auto service_info_name = nsd_service_info.GetServiceName(); + std::string service_info_name = nsd_service_info.GetServiceName(); ByteArray service_info_bytes = Base64Utils::Decode(service_info_name); if (service_info_bytes.Empty()) { - NEARBY_LOG( - INFO, - "Cannot deserialize WifiLanServiceInfo: failed Base64 decoding of %s", - std::string(service_info_name).c_str()); + NEARBY_LOGS(INFO) + << "Cannot deserialize WifiLanServiceInfo: failed Base64 decoding of " + << service_info_name; return; } if (service_info_bytes.size() < kMinLanServiceNameLength) { - NEARBY_LOG(INFO, - "Cannot deserialize WifiLanServiceInfo: expecting min %d raw " - "bytes, got %" PRIu64, - kMinLanServiceNameLength, service_info_bytes.size()); + NEARBY_LOGS(INFO) << "Cannot deserialize WifiLanServiceInfo: expecting min " + << kMinLanServiceNameLength + << " raw bytes, got " + << service_info_bytes.size(); return; } @@ -101,9 +100,9 @@ WifiLanServiceInfo::WifiLanServiceInfo(const NsdServiceInfo& nsd_service_info) { version_ = static_cast((version_and_pcp_byte & kVersionBitmask) >> 5); if (version_ != Version::kV1) { - NEARBY_LOG(INFO, - "Cannot deserialize WifiLanServiceInfo: unsupported Version %d", - version_); + NEARBY_LOGS(INFO) + << "Cannot deserialize WifiLanServiceInfo: unsupported Version " + << static_cast(version_); return; } // The lower 5 bits are supposed to be the Pcp. @@ -114,9 +113,9 @@ WifiLanServiceInfo::WifiLanServiceInfo(const NsdServiceInfo& nsd_service_info) { case Pcp::kP2pPointToPoint: break; default: - NEARBY_LOG(INFO, - "Cannot deserialize WifiLanServiceInfo: unsupported V1 PCP %d", - pcp_); + NEARBY_LOGS(INFO) + << "Cannot deserialize WifiLanServiceInfo: unsupported V1 PCP " + << static_cast(pcp_); } // The next 4 bytes are supposed to be the endpoint_id. @@ -135,10 +134,10 @@ WifiLanServiceInfo::WifiLanServiceInfo(const NsdServiceInfo& nsd_service_info) { uwb_address_ = base_input_stream.ReadBytes(expected_uwb_address_length); if (uwb_address_.Empty() || uwb_address_.size() != expected_uwb_address_length) { - NEARBY_LOG(INFO, - "Cannot deserialize WifiLanServiceInfo: expected " - "uwbAddress size to be %d bytes, got %" PRIu64, - expected_uwb_address_length, uwb_address_.size()); + NEARBY_LOGS(INFO) << "Cannot deserialize WifiLanServiceInfo: expected " + "uwbAddress size to be " + << expected_uwb_address_length << " bytes, got " + << uwb_address_.size(); // Clear enpoint_id for validity. endpoint_id_.clear(); return; diff --git a/connections/listeners.h b/connections/listeners.h index 15ed72f7..ad909594 100644 --- a/connections/listeners.h +++ b/connections/listeners.h @@ -31,6 +31,7 @@ #include "connections/connection_options.h" #include "connections/payload.h" #include "connections/status.h" +#include "internal/interop/authentication_status.h" #include "internal/platform/byte_array.h" #include "internal/platform/byte_utils.h" @@ -56,6 +57,10 @@ struct ConnectionResponseInfo { ByteArray raw_authentication_token; bool is_incoming_connection = false; bool is_connection_verified = false; + + // Result of authentication via the DeviceProvider, if available. Only used + // for `RequestConnectionV3()`. + AuthenticationStatus authentication_status = AuthenticationStatus::kUnknown; }; struct PayloadProgressInfo { @@ -136,9 +141,9 @@ struct DiscoveryListener { // endpoint_id - The ID of the remote endpoint that was discovered. // endpoint_info - The info of the remote endpoint representd by ByteArray. // service_id - The ID of the service advertised by the remote endpoint. - std::function + absl::AnyInvocable endpoint_found_cb = [](const std::string&, const ByteArray&, const std::string&) {}; @@ -147,7 +152,7 @@ struct DiscoveryListener { // #onEndpointFound(String, DiscoveredEndpointInfo)}. // // endpoint_id - The ID of the remote endpoint that was lost. - std::function endpoint_lost_cb = + absl::AnyInvocable endpoint_lost_cb = [](const std::string&) {}; // Called when a remote endpoint is found with an updated distance. @@ -155,7 +160,7 @@ struct DiscoveryListener { // arguments: // endpoint_id - The ID of the remote endpoint that was lost. // info - The distance info, encoded as enum value. - std::function + absl::AnyInvocable endpoint_distance_changed_cb = [](const std::string&, DistanceInfo) {}; }; diff --git a/connections/medium_selector.h b/connections/medium_selector.h index 11c9dc34..d6237166 100644 --- a/connections/medium_selector.h +++ b/connections/medium_selector.h @@ -26,18 +26,22 @@ using Medium = ::location::nearby::proto::connections::Medium; struct BooleanMediumSelector { bool bluetooth = false; bool ble = false; + bool web_rtc_no_cellular = false; bool web_rtc = false; bool wifi_lan = false; bool wifi_hotspot = false; bool wifi_direct = false; + constexpr bool Any(bool value) const { - return bluetooth == value || ble == value || web_rtc == value || - wifi_lan == value || wifi_hotspot == value || wifi_direct == value; + return bluetooth == value || ble == value || web_rtc_no_cellular == value || + web_rtc == value || wifi_lan == value || wifi_hotspot == value || + wifi_direct == value; } constexpr bool All(bool value) const { - return bluetooth == value && ble == value && web_rtc == value && + return bluetooth == value && ble == value && + (web_rtc == value || web_rtc_no_cellular == value) && wifi_lan == value && wifi_hotspot == value && wifi_direct == value; } @@ -48,7 +52,7 @@ struct BooleanMediumSelector { if (wifi_lan == value) count++; if (wifi_hotspot == value) count++; if (wifi_direct == value) count++; - if (web_rtc == value) count++; + if (web_rtc == value || web_rtc_no_cellular == value) count++; return count; } @@ -68,7 +72,15 @@ struct BooleanMediumSelector { if (wifi_lan == value) mediums.push_back(Medium::WIFI_LAN); if (wifi_direct == value) mediums.push_back(Medium::WIFI_DIRECT); if (wifi_hotspot == value) mediums.push_back(Medium::WIFI_HOTSPOT); - if (web_rtc == value) mediums.push_back(Medium::WEB_RTC); + // if both web_rtc and web_rtc_no_cellular are true/false, we only add one + // web_rtc medium. + if (web_rtc == value && web_rtc_no_cellular == value) { + mediums.push_back(Medium::WEB_RTC); + } else { + if (web_rtc == value) mediums.push_back(Medium::WEB_RTC); + if (web_rtc_no_cellular == value) + mediums.push_back(Medium::WEB_RTC_NON_CELLULAR); + } if (bluetooth == value) mediums.push_back(Medium::BLUETOOTH); if (ble == value) mediums.push_back(Medium::BLE); return mediums; diff --git a/connections/payload.cc b/connections/payload.cc index 8b43133f..c92d38e5 100644 --- a/connections/payload.cc +++ b/connections/payload.cc @@ -17,23 +17,24 @@ #include #include #include +#include #include #include #include #include +#include "absl/random/random.h" #include "connections/payload_type.h" #include "internal/platform/byte_array.h" #include "internal/platform/file.h" #include "internal/platform/input_stream.h" -#include "internal/platform/prng.h" namespace nearby { namespace connections { namespace { -std::string getFileName(const std::string& s) { +std::string FormatFileName(const std::string& s) { std::string s_copy(s); std::replace(s_copy.begin(), s_copy.end(), '\\', '/'); // replace all '\\' to '/' @@ -65,13 +66,7 @@ Payload::Payload(const ByteArray& bytes) Payload::Payload(InputFile input_file) : id_(std::hash()(input_file.GetFilePath())), - file_name_(getFileName(input_file.GetFilePath())), - type_(PayloadType::kFile), - content_(std::move(input_file)) {} - -Payload::Payload(Id id, InputFile input_file) - : id_(id), - file_name_(getFileName(input_file.GetFilePath())), + file_name_(FormatFileName(input_file.GetFilePath())), type_(PayloadType::kFile), content_(std::move(input_file)) {} @@ -93,6 +88,12 @@ Payload::Payload(Id id, ByteArray&& bytes) Payload::Payload(Id id, const ByteArray& bytes) : id_(id), type_(PayloadType::kBytes), content_(bytes) {} +Payload::Payload(Id id, InputFile input_file) + : id_(id), + file_name_(FormatFileName(input_file.GetFilePath())), + type_(PayloadType::kFile), + content_(std::move(input_file)) {} + Payload::Payload(Id id, std::string parent_folder, std::string file_name, InputFile input_file) : id_(id), @@ -138,7 +139,11 @@ void Payload::SetOffset(size_t offset) { size_t Payload::GetOffset() { return offset_; } // Generate Payload Id; to be passed to outgoing file constructor. -Payload::Id Payload::GenerateId() { return Prng().NextInt64(); } +Payload::Id Payload::GenerateId() { + absl::BitGen bitgen; + return absl::Uniform(absl::IntervalOpenClosed, bitgen, 0, + std::numeric_limits::max()); +} PayloadType Payload::FindType() const { return static_cast(content_.index()); diff --git a/connections/payload_type.h b/connections/payload_type.h index 17fddfa6..eeca1ebd 100644 --- a/connections/payload_type.h +++ b/connections/payload_type.h @@ -18,8 +18,8 @@ namespace nearby { namespace connections { -enum class PayloadType { kUnknown = 0, kBytes = 1, kStream = 2, kFile = 3 }; -enum PayloadDirection { +enum class PayloadType { kUnknown = 0, kBytes = 1, kFile = 2, kStream = 3 }; +enum class PayloadDirection { UNKNOWN_DIRECTION_PAYLOAD = 0, INCOMING_PAYLOAD = 1, OUTGOING_PAYLOAD = 2, diff --git a/connections/swift/NearbyConnections/BUILD b/connections/swift/NearbyConnections/BUILD index 008e6358..f4b9d582 100644 --- a/connections/swift/NearbyConnections/BUILD +++ b/connections/swift/NearbyConnections/BUILD @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("//third_party/nearby:minimum_os.bzl", "IOS_LATEST_TEST_RUNNER", "IOS_MINIMUM_OS") load("//tools/build_defs/apple:ios.bzl", "ios_unit_test") load("//tools/build_defs/swift:swift_library.bzl", "swift_library") -load("//third_party/nearby:minimum_os.bzl", "IOS_LATEST_TEST_RUNNER", "IOS_MINIMUM_OS") licenses(["notice"]) diff --git a/connections/swift/NearbyConnections/Example/iOS Example/Model/Model.swift b/connections/swift/NearbyConnections/Example/iOS Example/Model/Model.swift index 6128816c..df9bd086 100644 --- a/connections/swift/NearbyConnections/Example/iOS Example/Model/Model.swift +++ b/connections/swift/NearbyConnections/Example/iOS Example/Model/Model.swift @@ -120,10 +120,13 @@ class Model: ObservableObject { extension Model: DiscovererDelegate { func discoverer(_ discoverer: Discoverer, didFind endpointID: EndpointID, with context: Data) { + guard let endpointName = String(data: context, encoding: .utf8) else { + return + } let endpoint = DiscoveredEndpoint( id: UUID(), endpointID: endpointID, - endpointName: String(data: context, encoding: .utf8)! + endpointName: endpointName ) endpoints.insert(endpoint, at: 0) } @@ -138,10 +141,13 @@ extension Model: DiscovererDelegate { extension Model: AdvertiserDelegate { func advertiser(_ advertiser: Advertiser, didReceiveConnectionRequestFrom endpointID: EndpointID, with context: Data, connectionRequestHandler: @escaping (Bool) -> Void) { + guard let endpointName = String(data: context, encoding: .utf8) else { + return + } let endpoint = DiscoveredEndpoint( id: UUID(), endpointID: endpointID, - endpointName: String(data: context, encoding: .utf8)! + endpointName: endpointName ) endpoints.insert(endpoint, at: 0) connectionRequestHandler(true) diff --git a/connections/swift/NearbyConnections/Tests/BuildTests.swift b/connections/swift/NearbyConnections/Tests/BuildTests.swift index 0ca3f19d..318a4aa7 100644 --- a/connections/swift/NearbyConnections/Tests/BuildTests.swift +++ b/connections/swift/NearbyConnections/Tests/BuildTests.swift @@ -1,3 +1,17 @@ +// Copyright 2023 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. + import NearbyConnections import XCTest diff --git a/connections/swift/NearbyConnections/Tests/EntryPointTest.swift b/connections/swift/NearbyConnections/Tests/EntryPointTest.swift index de0644c0..81570a61 100644 --- a/connections/swift/NearbyConnections/Tests/EntryPointTest.swift +++ b/connections/swift/NearbyConnections/Tests/EntryPointTest.swift @@ -1,3 +1,17 @@ +// Copyright 2023 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. + import NearbyConnections @main diff --git a/connections/swift/NearbyCoreAdapter/BUILD b/connections/swift/NearbyCoreAdapter/BUILD index e6103c51..7b588d83 100644 --- a/connections/swift/NearbyCoreAdapter/BUILD +++ b/connections/swift/NearbyCoreAdapter/BUILD @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +load("//third_party/nearby:minimum_os.bzl", "IOS_LATEST_TEST_RUNNER", "IOS_MINIMUM_OS") load("//tools/build_defs/apple:ios.bzl", "ios_unit_test") load("//tools/build_defs/swift:swift_library.bzl", "swift_library") -load("//third_party/nearby:minimum_os.bzl", "IOS_LATEST_TEST_RUNNER", "IOS_MINIMUM_OS") licenses(["notice"]) @@ -33,6 +33,8 @@ objc_library( deps = [ "//connections:core", "//connections:core_types", + "//connections/implementation/flags:connections_flags", + "//internal/flags:nearby_flags", "//internal/platform:base", "//internal/platform/implementation/apple", # buildcleaner: keep "//third_party/apple_frameworks:Foundation", diff --git a/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm b/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm index ef72eded..6ed239f3 100644 --- a/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm +++ b/connections/swift/NearbyCoreAdapter/Sources/GNCCoreAdapter.mm @@ -199,13 +199,14 @@ GNCStatus GNCStatusFromCppStatus(Status status) { DiscoveryOptions discovery_options = [discoveryOptions toCpp]; DiscoveryListener listener; - listener.endpoint_found_cb = ^(const std::string &endpoint_id, const ByteArray &endpoint_info, - const std::string &service_id) { + listener.endpoint_found_cb = [delegate](const std::string &endpoint_id, + const ByteArray &endpoint_info, + const std::string &service_id) { NSString *endpointID = @(endpoint_id.c_str()); NSData *info = [NSData dataWithBytes:endpoint_info.data() length:endpoint_info.size()]; [delegate foundEndpoint:endpointID withEndpointInfo:info]; }; - listener.endpoint_lost_cb = ^(const std::string &endpoint_id) { + listener.endpoint_lost_cb = [delegate](const std::string &endpoint_id) { NSString *endpointID = @(endpoint_id.c_str()); [delegate lostEndpoint:endpointID]; }; @@ -290,30 +291,30 @@ GNCStatus GNCStatusFromCppStatus(Status status) { GNCPayload *gncPayload = [GNCPayload fromCpp:std::move(payload)]; [delegate receivedPayload:gncPayload fromEndpoint:endpointID]; }; - listener.payload_progress_cb = - [delegate](absl::string_view endpoint_id, const PayloadProgressInfo &info) { - NSString *endpointID = @(std::string(endpoint_id).c_str()); - GNCPayloadStatus status; - switch (info.status) { - case PayloadProgressInfo::Status::kSuccess: - status = GNCPayloadStatusSuccess; - break; - case PayloadProgressInfo::Status::kFailure: - status = GNCPayloadStatusFailure; - break; - case PayloadProgressInfo::Status::kInProgress: - status = GNCPayloadStatusInProgress; - break; - case PayloadProgressInfo::Status::kCanceled: - status = GNCPayloadStatusCanceled; - break; - } - [delegate receivedProgressUpdateForPayload:info.payload_id - withStatus:status - fromEndpoint:endpointID - bytesTransfered:info.bytes_transferred - totalBytes:info.total_bytes]; - }; + listener.payload_progress_cb = [delegate](absl::string_view endpoint_id, + const PayloadProgressInfo &info) { + NSString *endpointID = @(std::string(endpoint_id).c_str()); + GNCPayloadStatus status; + switch (info.status) { + case PayloadProgressInfo::Status::kSuccess: + status = GNCPayloadStatusSuccess; + break; + case PayloadProgressInfo::Status::kFailure: + status = GNCPayloadStatusFailure; + break; + case PayloadProgressInfo::Status::kInProgress: + status = GNCPayloadStatusInProgress; + break; + case PayloadProgressInfo::Status::kCanceled: + status = GNCPayloadStatusCanceled; + break; + } + [delegate receivedProgressUpdateForPayload:info.payload_id + withStatus:status + fromEndpoint:endpointID + bytesTransfered:info.bytes_transferred + totalBytes:info.total_bytes]; + }; ResultListener result = [completionHandler](Status status) { NSError *err = NSErrorFromCppStatus(status); diff --git a/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm b/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm new file mode 100644 index 00000000..7b5cb6ba --- /dev/null +++ b/connections/swift/NearbyCoreAdapter/Sources/GNCFlags.mm @@ -0,0 +1,36 @@ +// Copyright 2024 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. + +#import "connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/GNCFlags.h" + +#import + +#include + +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "internal/flags/nearby_flags.h" + +@implementation GNCFlags + ++ (BOOL)enableBLEV2 { + return nearby::NearbyFlags::GetInstance().GetBoolFlag( + nearby::connections::config_package_nearby::nearby_connections_feature::kEnableBleV2); +} + ++ (void)setEnableBLEV2:(BOOL)value { + nearby::NearbyFlags::GetInstance().OverrideBoolFlagValue( + nearby::connections::config_package_nearby::nearby_connections_feature::kEnableBleV2, value); +} + +@end diff --git a/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/GNCFlags.h b/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/GNCFlags.h new file mode 100644 index 00000000..19b953a5 --- /dev/null +++ b/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/GNCFlags.h @@ -0,0 +1,23 @@ +// Copyright 2024 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. + +#import + +/** A utility class for accessing and overriding Nearby feature flags. */ +@interface GNCFlags : NSObject + +/** Whether BLE v2 is enabled in the Nearby Connections SDK. */ +@property(nonatomic, class) BOOL enableBLEV2; + +@end diff --git a/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/NearbyCoreAdapter.h b/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/NearbyCoreAdapter.h index 26d37bbc..1c034feb 100644 --- a/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/NearbyCoreAdapter.h +++ b/connections/swift/NearbyCoreAdapter/Sources/Public/NearbyCoreAdapter/NearbyCoreAdapter.h @@ -19,6 +19,7 @@ #import "GNCDiscoveryDelegate.h" #import "GNCDiscoveryOptions.h" #import "GNCError.h" +#import "GNCFlags.h" #import "GNCPayload.h" #import "GNCPayloadDelegate.h" #import "GNCStrategy.h" diff --git a/connections/swift/NearbyCoreAdapter/Tests/BuildTests.swift b/connections/swift/NearbyCoreAdapter/Tests/BuildTests.swift index 9e40bf62..e96de001 100644 --- a/connections/swift/NearbyCoreAdapter/Tests/BuildTests.swift +++ b/connections/swift/NearbyCoreAdapter/Tests/BuildTests.swift @@ -1,3 +1,17 @@ +// Copyright 2023 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. + import NearbyCoreAdapter import XCTest diff --git a/connections/v3/BUILD b/connections/v3/BUILD index 9b6d02e6..ba01d4b0 100644 --- a/connections/v3/BUILD +++ b/connections/v3/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + cc_library( name = "v3_types", srcs = [ @@ -21,9 +35,10 @@ cc_library( deps = [ "//connections:core_types", "//connections/implementation/proto:offline_wire_formats_cc_proto", - "//internal/crypto_cros", + "//internal/interop:authentication_status", "//internal/interop:device", "//internal/platform:connection_info", + "//internal/platform:types", "//proto:connections_enums_cc_proto", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/strings", diff --git a/connections/v3/advertising_options.h b/connections/v3/advertising_options.h index 4e22c552..42eb8010 100644 --- a/connections/v3/advertising_options.h +++ b/connections/v3/advertising_options.h @@ -39,6 +39,8 @@ struct AdvertisingOptions { // If Nearby Connections should auto-upgrade bandwidth. bool auto_upgrade_bandwidth = true; bool enforce_topology_constraints = true; + // Indicates whether the endpoint id should be stable. + bool use_stable_endpoint_id = false; std::string fast_advertisement_service_uuid; BooleanMediumSelector advertising_mediums; BooleanMediumSelector upgrade_mediums; diff --git a/connections/v3/connection_result.h b/connections/v3/connection_result.h index dc45efb8..afded1d0 100644 --- a/connections/v3/connection_result.h +++ b/connections/v3/connection_result.h @@ -18,6 +18,7 @@ #include #include "connections/status.h" +#include "internal/interop/authentication_status.h" namespace nearby { namespace connections { @@ -35,6 +36,9 @@ struct InitialConnectionInfo { std::string raw_authentication_token; // Specifies if the connection is incoming or outgoing. bool is_incoming_connection = false; + // Result of authentication via the DeviceProvider, if available. Only used + // for `RequestConnectionV3()`. + AuthenticationStatus authentication_status = AuthenticationStatus::kUnknown; }; } // namespace v3 diff --git a/connections/v3/connections_device.h b/connections/v3/connections_device.h index 49d2bddb..629ae41a 100644 --- a/connections/v3/connections_device.h +++ b/connections/v3/connections_device.h @@ -18,9 +18,9 @@ #include #include -#include "internal/crypto_cros/random.h" #include "internal/interop/device.h" #include "internal/platform/connection_info.h" +#include "internal/platform/crypto.h" namespace nearby { namespace connections { @@ -59,8 +59,8 @@ class ConnectionsDevice : public nearby::NearbyDevice { private: std::string GenerateRandomEndpointId() { std::string result(kEndpointIdLength, 0); - crypto::RandBytes(const_cast(result.data()), - result.size()); + RandBytes(const_cast(result.data()), + result.size()); return result; } diff --git a/connections/v3/connections_device_provider_test.cc b/connections/v3/connections_device_provider_test.cc index 408435ce..510a2881 100644 --- a/connections/v3/connections_device_provider_test.cc +++ b/connections/v3/connections_device_provider_test.cc @@ -27,8 +27,8 @@ constexpr absl::string_view kEndpointId = "ABCD"; constexpr absl::string_view kEndpointInfo = "NC endpoint"; class MockAuthenticationTransport : public AuthenticationTransport { - MOCK_METHOD(void, WriteMessage, (absl::string_view), (const override)); - MOCK_METHOD(std::string, ReadMessage, (), (const override)); + MOCK_METHOD(void, WriteMessage, (absl::string_view), (const, override)); + MOCK_METHOD(std::string, ReadMessage, (), (const, override)); }; TEST(ConnectionsDeviceProviderTest, TestProviderWorksTwoArgs) { diff --git a/embedded/build.sh b/embedded/build.sh index f23c12e0..7c2f68cd 100755 --- a/embedded/build.sh +++ b/embedded/build.sh @@ -1,4 +1,18 @@ #!/bin/sh +# Copyright 2022 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. + # # Parameters: # ${1} architecture (default: gLinux) diff --git a/fastpair/BUILD b/fastpair/BUILD index 453b6db5..7f5f5799 100644 --- a/fastpair/BUILD +++ b/fastpair/BUILD @@ -112,6 +112,8 @@ cc_library( "//internal/platform:base", "//internal/platform:types", "//internal/platform/flags:platform_flags", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation:types", "//internal/preferences", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/status", @@ -132,7 +134,7 @@ cc_test( "//fastpair/internal", "//fastpair/message_stream:fake_provider", "//fastpair/plugins:fake_fast_pair_plugin", - "//internal/account:test_support", + "//internal/account", "//internal/network:types", "//internal/platform:test_util", "//internal/platform:types", diff --git a/fastpair/analytics/BUILD b/fastpair/analytics/BUILD index d1f7f1cf..e076f3ed 100644 --- a/fastpair/analytics/BUILD +++ b/fastpair/analytics/BUILD @@ -29,7 +29,6 @@ cc_library( "//internal/analytics:event_logger", "//internal/proto/analytics:fast_pair_log_cc_proto", "//proto:fast_pair_enums_cc_proto", - "//third_party/protobuf:protobuf_lite", ], ) @@ -38,10 +37,9 @@ cc_test( srcs = ["analytics_recorder_test.cc"], deps = [ ":analytics", - "//internal/analytics:event_logger", + "//internal/analytics:mock_event_logger", "//internal/proto/analytics:fast_pair_log_cc_proto", "//proto:fast_pair_enums_cc_proto", - "//third_party/protobuf:protobuf_lite", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_googletest//:gtest_main", ], diff --git a/fastpair/analytics/analytics_recorder.cc b/fastpair/analytics/analytics_recorder.cc index dfdeabb9..c6ac23ef 100644 --- a/fastpair/analytics/analytics_recorder.cc +++ b/fastpair/analytics/analytics_recorder.cc @@ -19,7 +19,6 @@ #include "internal/analytics/event_logger.h" #include "internal/proto/analytics/fast_pair_log.proto.h" #include "proto/fast_pair_enums.proto.h" -#include "third_party/protobuf/message_lite.h" namespace nearby { namespace fastpair { @@ -118,7 +117,7 @@ void AnalyticsRecorder::NewKeyBasedPairingInfo(int request_flag, // start private methods -void AnalyticsRecorder::LogEvent(const ::google::protobuf::MessageLite& message) { +void AnalyticsRecorder::LogEvent(const FastPairLog& message) { if (event_logger_ == nullptr) { return; } diff --git a/fastpair/analytics/analytics_recorder.h b/fastpair/analytics/analytics_recorder.h index dc8d7b92..14f6da00 100644 --- a/fastpair/analytics/analytics_recorder.h +++ b/fastpair/analytics/analytics_recorder.h @@ -20,7 +20,6 @@ #include "internal/analytics/event_logger.h" #include "internal/proto/analytics/fast_pair_log.proto.h" #include "proto/fast_pair_enums.proto.h" -#include "third_party/protobuf/message_lite.h" namespace nearby { namespace fastpair { @@ -35,8 +34,7 @@ class AnalyticsRecorder { void NewGattEvent(int error_from_os); void NewBrEdrHandoverEvent( - ::nearby::proto::fastpair::FastPairEvent::BrEdrHandoverErrorCode - error_code + nearby::proto::fastpair::FastPairEvent::BrEdrHandoverErrorCode error_code ); @@ -45,7 +43,7 @@ class AnalyticsRecorder { int unbond_reason); void NewConnectEvent( - ::nearby::proto::fastpair::FastPairEvent::ConnectErrorCode error_code, + nearby::proto::fastpair::FastPairEvent::ConnectErrorCode error_code, int profile_uuid); void NewProviderInfo(int number_account_keys_on_provider); @@ -56,10 +54,9 @@ class AnalyticsRecorder { int response_flag, int response_device_count); private: - std::unique_ptr<::nearby::proto::fastpair::FastPairLog> createFastPairLog(); - void LogEvent(const ::google::protobuf::MessageLite& message); + void LogEvent(const nearby::proto::fastpair::FastPairLog& message); - ::nearby::analytics::EventLogger* event_logger_ = nullptr; + nearby::analytics::EventLogger* event_logger_ = nullptr; }; } // namespace analytics diff --git a/fastpair/analytics/analytics_recorder_test.cc b/fastpair/analytics/analytics_recorder_test.cc index 4eb68d40..ea0dfcb8 100644 --- a/fastpair/analytics/analytics_recorder_test.cc +++ b/fastpair/analytics/analytics_recorder_test.cc @@ -14,38 +14,29 @@ #include "fastpair/analytics/analytics_recorder.h" -#include - #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" -#include "internal/analytics/event_logger.h" +#include "internal/analytics/mock_event_logger.h" #include "internal/proto/analytics/fast_pair_log.proto.h" #include "proto/fast_pair_enums.proto.h" -#include "third_party/protobuf/message_lite.h" namespace nearby { namespace fastpair { namespace analytics { namespace { +using ::nearby::analytics::MockEventLogger; using ::nearby::proto::fastpair::FastPairEvent; using ::nearby::proto::fastpair::FastPairLog; - -class MockEventLogger : public ::nearby::analytics::EventLogger { - public: - MockEventLogger() = default; - ~MockEventLogger() override = default; - - MOCK_METHOD(void, Log, (const ::google::protobuf::MessageLite& message), (override)); -}; +using ::testing::An; class AnalyticsRecorderTest : public ::testing::Test { public: AnalyticsRecorderTest() = default; ~AnalyticsRecorderTest() override = default; - const MockEventLogger& event_logger() { return event_logger_; } + MockEventLogger& event_logger() { return event_logger_; } AnalyticsRecorder analytics_recoder() { return analytics_recorder_; } @@ -55,22 +46,18 @@ class AnalyticsRecorderTest : public ::testing::Test { }; TEST_F(AnalyticsRecorderTest, NewGattEvent) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - EXPECT_EQ(log->gatt_event().error_from_os(), 1); + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + EXPECT_EQ(message.gatt_event().error_from_os(), 1); }); analytics_recoder().NewGattEvent(1); } TEST_F(AnalyticsRecorderTest, NewBrEdrHandoverEvent) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - ASSERT_EQ(log->br_edr_handover_event().error_code(), + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + ASSERT_EQ(message.br_edr_handover_event().error_code(), FastPairEvent::BLUETOOTH_MAC_INVALID); }); analytics_recoder().NewBrEdrHandoverEvent( @@ -78,58 +65,50 @@ TEST_F(AnalyticsRecorderTest, NewBrEdrHandoverEvent) { } TEST_F(AnalyticsRecorderTest, NewCreateBondEvent) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - ASSERT_EQ(log->bond_event().error_code(), FastPairEvent::NO_PERMISSION); - ASSERT_EQ(log->bond_event().unbond_reason(), 12); + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + ASSERT_EQ(message.bond_event().error_code(), + FastPairEvent::NO_PERMISSION); + ASSERT_EQ(message.bond_event().unbond_reason(), 12); }); analytics_recoder().NewCreateBondEvent(FastPairEvent::NO_PERMISSION, 12); } TEST_F(AnalyticsRecorderTest, NewConnectEvent) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - ASSERT_EQ(log->connect_event().error_code(), + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + ASSERT_EQ(message.connect_event().error_code(), FastPairEvent::GET_PROFILE_PROXY_FAILED); - ASSERT_EQ(log->connect_event().profile_uuid(), 13); + ASSERT_EQ(message.connect_event().profile_uuid(), 13); }); analytics_recoder().NewConnectEvent(FastPairEvent::GET_PROFILE_PROXY_FAILED, 13); } TEST_F(AnalyticsRecorderTest, NewProviderInfo) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - ASSERT_EQ(log->provider_info().number_account_keys_on_provider(), 14); + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + ASSERT_EQ(message.provider_info().number_account_keys_on_provider(), + 14); }); analytics_recoder().NewProviderInfo(14); } TEST_F(AnalyticsRecorderTest, NewFootprintsInfo) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - ASSERT_EQ(log->footprints_info().number_devices_on_footprints(), 15); + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + ASSERT_EQ(message.footprints_info().number_devices_on_footprints(), 15); }); analytics_recoder().NewFootprintsInfo(15); } TEST_F(AnalyticsRecorderTest, NewKeyBasedPairingInfo) { - EXPECT_CALL(event_logger(), Log) - .WillOnce([=](const ::google::protobuf::MessageLite& message) { - auto log = dynamic_cast(&message); - ASSERT_NE(log, nullptr); - ASSERT_EQ(log->key_based_pairing_info().request_flag(), 16); - ASSERT_EQ(log->key_based_pairing_info().response_type(), 17); - ASSERT_EQ(log->key_based_pairing_info().response_flag(), 18); - ASSERT_EQ(log->key_based_pairing_info().response_device_count(), 19); + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([=](const FastPairLog& message) { + ASSERT_EQ(message.key_based_pairing_info().request_flag(), 16); + ASSERT_EQ(message.key_based_pairing_info().response_type(), 17); + ASSERT_EQ(message.key_based_pairing_info().response_flag(), 18); + ASSERT_EQ(message.key_based_pairing_info().response_device_count(), 19); }); analytics_recoder().NewKeyBasedPairingInfo(16, 17, 18, 19); } diff --git a/fastpair/common/BUILD b/fastpair/common/BUILD index c377b405..ab62e395 100644 --- a/fastpair/common/BUILD +++ b/fastpair/common/BUILD @@ -1,3 +1,17 @@ +# Copyright 2022 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. + licenses(["notice"]) cc_library( diff --git a/fastpair/common/account_key.h b/fastpair/common/account_key.h index ec8d9a4a..fd07aa7e 100644 --- a/fastpair/common/account_key.h +++ b/fastpair/common/account_key.h @@ -22,7 +22,7 @@ #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" #include "fastpair/common/constant.h" -#include "internal/crypto_cros/random.h" +#include "internal/platform/crypto.h" namespace nearby { namespace fastpair { @@ -37,7 +37,7 @@ class AccountKey { static AccountKey CreateRandomKey() { std::string key(kAccountKeySize, 0); - ::crypto::RandBytes(key.data(), kAccountKeySize); + RandBytes(key.data(), kAccountKeySize); return AccountKey(key); } diff --git a/fastpair/crypto/BUILD b/fastpair/crypto/BUILD index 674826a6..ffa91bf5 100644 --- a/fastpair/crypto/BUILD +++ b/fastpair/crypto/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + cc_library( name = "crypto", srcs = [ diff --git a/fastpair/dataparser/BUILD b/fastpair/dataparser/BUILD index 76f520e6..dea9c0be 100644 --- a/fastpair/dataparser/BUILD +++ b/fastpair/dataparser/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + licenses(["notice"]) cc_library( diff --git a/fastpair/fast_pair_service.h b/fastpair/fast_pair_service.h index ee5e4520..10c95cf0 100644 --- a/fastpair/fast_pair_service.h +++ b/fastpair/fast_pair_service.h @@ -27,10 +27,10 @@ #include "fastpair/server_access/fast_pair_client.h" #include "fastpair/server_access/fast_pair_http_notifier.h" #include "fastpair/repository/fast_pair_repository.h" -#include "internal/account/account_manager.h" #include "internal/auth/authentication_manager.h" #include "internal/network/http_client.h" #include "internal/platform/device_info.h" +#include "internal/platform/implementation/account_manager.h" #include "internal/platform/single_thread_executor.h" #include "internal/platform/task_runner.h" #include "internal/preferences/preferences_manager.h" diff --git a/fastpair/fast_pair_service_test.cc b/fastpair/fast_pair_service_test.cc index 8a3407a6..7ab94f97 100644 --- a/fastpair/fast_pair_service_test.cc +++ b/fastpair/fast_pair_service_test.cc @@ -25,11 +25,12 @@ #include "fastpair/internal/fast_pair_seeker_impl.h" #include "fastpair/message_stream/fake_provider.h" #include "fastpair/plugins/fake_fast_pair_plugin.h" -#include "internal/account/fake_account_manager.h" +#include "internal/account/account_manager_impl.h" #include "internal/network/http_client.h" #include "internal/platform/device_info.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" +#include "internal/test/fake_account_manager.h" #include "internal/test/fake_device_info.h" #include "internal/test/fake_http_client.h" #include "internal/test/google3_only/fake_authentication_manager.h" @@ -48,8 +49,9 @@ using ::testing::status::StatusIs; class FastPairServiceTest : public ::testing::Test { protected: FastPairServiceTest() { - AccountManagerImpl::Factory::SetFactoryForTesting( - &account_manager_factory_); + AccountManagerImpl::Factory::SetFactoryForTesting([]() { + return std::make_unique(); + }); http_client_ = std::make_unique(); device_info_ = std::make_unique(); authentication_manager_ = @@ -61,7 +63,10 @@ class FastPairServiceTest : public ::testing::Test { GetAuthManager()->EnableSyncMode(); } - void TearDown() override { MediumEnvironment::Instance().Stop(); } + void TearDown() override { + AccountManagerImpl::Factory::SetFactoryForTesting(nullptr); + MediumEnvironment::Instance().Stop(); + } nearby::FakeAuthenticationManager* GetAuthManager() { return reinterpret_cast( @@ -84,7 +89,6 @@ class FastPairServiceTest : public ::testing::Test { GetHttpClient()->SetResponseForSyncRequest(response); } - FakeAccountManager::Factory account_manager_factory_; std::unique_ptr authentication_manager_; std::unique_ptr http_client_; std::unique_ptr device_info_; diff --git a/fastpair/internal/BUILD b/fastpair/internal/BUILD index 3742f983..646418a8 100644 --- a/fastpair/internal/BUILD +++ b/fastpair/internal/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + licenses(["notice"]) cc_library( @@ -44,11 +58,10 @@ cc_test( "//fastpair/repository", "//fastpair/repository:device_repository", "//fastpair/repository:test_support", - "//internal/account:test_support", "//internal/platform:test_util", "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep - "//internal/test/google3_only:test", + "//internal/test", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", diff --git a/fastpair/internal/fast_pair_seeker_impl_test.cc b/fastpair/internal/fast_pair_seeker_impl_test.cc index 09556b8e..f49f262b 100644 --- a/fastpair/internal/fast_pair_seeker_impl_test.cc +++ b/fastpair/internal/fast_pair_seeker_impl_test.cc @@ -26,7 +26,6 @@ #include "absl/status/status.h" #include "absl/strings/escaping.h" #include "fastpair/common/fast_pair_device.h" -#include "fastpair/common/fast_pair_prefs.h" #include "fastpair/fast_pair_events.h" #include "fastpair/fast_pair_seeker.h" #include "fastpair/message_stream/fake_gatt_callbacks.h" @@ -36,13 +35,11 @@ #include "fastpair/repository/fake_fast_pair_repository.h" #include "fastpair/repository/fast_pair_device_repository.h" #include "fastpair/repository/fast_pair_repository.h" -#include "internal/account/fake_account_manager.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" #include "internal/platform/single_thread_executor.h" -#include "internal/platform/task_runner_impl.h" -#include "internal/test/google3_only/fake_authentication_manager.h" +#include "internal/test/fake_account_manager.h" namespace nearby { namespace fastpair { @@ -58,8 +55,6 @@ constexpr absl::string_view kBobPublicKey = "F7D496A62ECA416351540AA343BC690A6109F551500666B83B1251FB84FA2860795EBD63D3" "B8836F44A9A3E28BB34017E015F5979305D849FDF8DE10123B61D2"; constexpr absl::string_view kPasskey = "123456"; -constexpr absl::string_view kFastPairPreferencesFilePath = - "Google/Nearby/FastPair"; constexpr absl::string_view kTestAccountId = "test_account_id"; using ::testing::status::StatusIs; @@ -85,12 +80,7 @@ class FastPairRepositoryObserver : public FastPairRepository::Observer { class FastPairSeekerImplTest : public testing::Test { protected: - FastPairSeekerImplTest() { - task_runner_ = std::make_unique(1); - preferences_manager_ = std::make_unique( - kFastPairPreferencesFilePath); - authentication_manager_ = std::make_unique(); - } + FastPairSeekerImplTest() = default; void SetUp() override { NEARBY_LOG_SET_SEVERITY(VERBOSE); @@ -98,9 +88,7 @@ class FastPairSeekerImplTest : public testing::Test { kModelId, absl::HexStringToBytes(kBobPublicKey)); repository_->SetResultOfIsDeviceSavedToAccount( absl::NotFoundError("not found")); - account_manager_ = std::make_unique( - preferences_manager_.get(), prefs::kNearbyFastPairUsersName, - authentication_manager_.get(), task_runner_.get()); + account_manager_ = std::make_unique(); AccountManager::Account account; account.id = kTestAccountId; account_manager_->SetAccount(account); @@ -116,9 +104,6 @@ class FastPairSeekerImplTest : public testing::Test { MediumEnvironmentStarter env_; SingleThreadExecutor executor_; - std::unique_ptr preferences_manager_; - std::unique_ptr authentication_manager_; - std::unique_ptr task_runner_; std::unique_ptr account_manager_; FastPairDeviceRepository devices_{&executor_}; std::unique_ptr repository_; @@ -135,7 +120,7 @@ TEST_F(FastPairSeekerImplTest, StartAndStopFastPairScan) { EXPECT_OK(fast_pair_seeker_->StopFastPairScan()); } -TEST_F(FastPairSeekerImplTest, DiscoverDevice) { +TEST_F(FastPairSeekerImplTest, DISABLED_DiscoverDevice) { FakeProvider provider; CountDownLatch latch(1); fast_pair_seeker_ = std::make_unique( diff --git a/fastpair/internal/impl/windows/BUILD b/fastpair/internal/impl/windows/BUILD index 98bf332a..06ba234b 100644 --- a/fastpair/internal/impl/windows/BUILD +++ b/fastpair/internal/impl/windows/BUILD @@ -1,3 +1,17 @@ +# Copyright 2022 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. + licenses(["notice"]) cc_library( @@ -20,7 +34,5 @@ cc_library( "wtsapi32.lib", "version.lib", ], - visibility = [ - "//visibility:private", # Only private by automation, not intent. Owner may accept CLs adding visibility. See go/scheuklappen#explicit-private. - ], + visibility = ["//visibility:private"], ) diff --git a/fastpair/internal/mediums/ble.cc b/fastpair/internal/mediums/ble.cc index 14c790da..764af969 100644 --- a/fastpair/internal/mediums/ble.cc +++ b/fastpair/internal/mediums/ble.cc @@ -109,7 +109,7 @@ bool Ble::StopScanning(const std::string& service_id) { return false; } - NEARBY_LOG(INFO, "Stop BLE scanning with service id=%s", service_id.c_str()); + NEARBY_LOGS(INFO) << "Stop BLE scanning with service id=" << service_id; bool ret = medium_.StopScanning(service_id); is_scanning_ = false; return ret; diff --git a/fastpair/internal/mediums/bluetooth_radio.cc b/fastpair/internal/mediums/bluetooth_radio.cc index bde56849..2d85fbcb 100644 --- a/fastpair/internal/mediums/bluetooth_radio.cc +++ b/fastpair/internal/mediums/bluetooth_radio.cc @@ -32,7 +32,7 @@ BluetoothRadio::~BluetoothRadio() { NEARBY_LOGS(INFO) << "BT adapter was not used. Not touching HW."; return; } - NEARBY_LOG(INFO, "Bring BT adapter to original state"); + NEARBY_LOGS(INFO) << "Bring BT adapter to original state"; if (!SetBluetoothState(originally_enabled_.Get())) { NEARBY_LOGS(INFO) << "Failed to restore BT adapter original state."; } diff --git a/fastpair/internal/test/BUILD b/fastpair/internal/test/BUILD index 3ea07c91..86c35257 100644 --- a/fastpair/internal/test/BUILD +++ b/fastpair/internal/test/BUILD @@ -1,3 +1,17 @@ +# Copyright 2022 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. + licenses(["notice"]) cc_library( @@ -8,9 +22,7 @@ cc_library( copts = [ "-Ithird_party", ], - visibility = [ - "//fastpair:__subpackages__", - ], + visibility = ["//visibility:private"], deps = [ "//internal/network:types", "@com_google_absl//absl/functional:any_invocable", diff --git a/fastpair/internal/test/fast_pair_fake_http_client.h b/fastpair/internal/test/fast_pair_fake_http_client.h index 1bd12bb5..4723edf5 100644 --- a/fastpair/internal/test/fast_pair_fake_http_client.h +++ b/fastpair/internal/test/fast_pair_fake_http_client.h @@ -15,15 +15,20 @@ #ifndef THIRD_PARTY_NEARBY_FASTPAIR_INTERNAL_TEST_FAST_PAIR_FAKE_HTTP_CLIENT_H_ #define THIRD_PARTY_NEARBY_FASTPAIR_INTERNAL_TEST_FAST_PAIR_FAKE_HTTP_CLIENT_H_ -#include +#include #include #include #include #include #include +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" #include "absl/status/statusor.h" #include "internal/network/http_client.h" +#include "internal/network/http_request.h" +#include "internal/network/http_response.h" +#include "internal/network/http_status_code.h" namespace nearby { namespace network { @@ -32,7 +37,7 @@ class FastPairFakeHttpClient : public HttpClient { public: struct RequestInfo { HttpRequest request; - std::function&)> callback; + absl::AnyInvocable&)> callback; }; FastPairFakeHttpClient() = default; @@ -44,18 +49,19 @@ class FastPairFakeHttpClient : public HttpClient { FastPairFakeHttpClient(FastPairFakeHttpClient&&) = default; FastPairFakeHttpClient& operator=(FastPairFakeHttpClient&&) = default; - void StartRequest(const HttpRequest& request, - std::function&)> - callback) override { + void StartRequest( + const HttpRequest& request, + absl::AnyInvocable&)> callback) + override { RequestInfo request_info; request_info.request = request; - request_info.callback = callback; + request_info.callback = std::move(callback); request_infos_.push_back(std::move(request_info)); } void StartCancellableRequest( std::unique_ptr request, - std::function&)> callback) + absl::AnyInvocable&)> callback) override {} absl::StatusOr GetResponse( @@ -70,8 +76,8 @@ class FastPairFakeHttpClient : public HttpClient { return; } - auto request_info = request_infos_.at(pos); - if (request_info.callback != nullptr) { + auto& request_info = request_infos_.at(pos); + if (request_info.callback) { request_info.callback(response); } diff --git a/fastpair/message_stream/BUILD b/fastpair/message_stream/BUILD index 0ec782b2..acc4504c 100644 --- a/fastpair/message_stream/BUILD +++ b/fastpair/message_stream/BUILD @@ -97,10 +97,7 @@ cc_library( hdrs = [ "fake_medium_observer.h", ], - visibility = [ - "//:__subpackages__", - "//fastpair:__subpackages__", - ], + visibility = ["//fastpair:__subpackages__"], deps = [ ":message_stream", "//fastpair/common", diff --git a/fastpair/message_stream/fake_provider.h b/fastpair/message_stream/fake_provider.h index 47bd2bb2..36d71ac4 100644 --- a/fastpair/message_stream/fake_provider.h +++ b/fastpair/message_stream/fake_provider.h @@ -99,8 +99,7 @@ class FakeProvider { seeker_medium.StartDiscovery(BluetoothClassicMedium::DiscoveryCallback{ .device_discovered_cb = [&](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", - device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); found_latch.CountDown(); }, }); diff --git a/fastpair/pairing/BUILD b/fastpair/pairing/BUILD index 65a485aa..04ab38a1 100644 --- a/fastpair/pairing/BUILD +++ b/fastpair/pairing/BUILD @@ -24,18 +24,16 @@ cc_library( "pairer_broker_impl.h", ], compatible_with = ["//buildenv/target:non_prod"], - visibility = [ - "//fastpair:__subpackages__", - "//internal:__subpackages__", - ], + visibility = ["//fastpair:__subpackages__"], deps = [ "//fastpair/common", "//fastpair/handshake", "//fastpair/internal/mediums", "//fastpair/pairing/fastpair:pairing", - "//internal/account", "//internal/base", "//internal/platform:types", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation:types", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/functional:bind_front", "@com_google_absl//absl/synchronization", @@ -60,14 +58,13 @@ cc_test( "//fastpair/proto:fastpair_cc_proto", "//fastpair/repository:test_support", "//internal/account", - "//internal/account:test_support", "//internal/auth:credential", "//internal/base:bluetooth_address", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep - "//internal/test/google3_only:test", + "//internal/test", "@boringssl//:crypto", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/functional:bind_front", diff --git a/fastpair/pairing/fastpair/BUILD b/fastpair/pairing/fastpair/BUILD index c748b211..005c84c5 100644 --- a/fastpair/pairing/fastpair/BUILD +++ b/fastpair/pairing/fastpair/BUILD @@ -24,19 +24,17 @@ cc_library( "fast_pair_pairer_impl.h", ], compatible_with = ["//buildenv/target:non_prod"], - visibility = [ - "//fastpair:__subpackages__", - "//internal:__subpackages__", - ], + visibility = ["//fastpair:__subpackages__"], deps = [ "//fastpair/common", "//fastpair/crypto", "//fastpair/handshake", "//fastpair/internal/mediums", "//fastpair/repository", - "//internal/account", "//internal/platform:comm", "//internal/platform:types", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation:types", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/time", ], @@ -58,14 +56,13 @@ cc_test( "//fastpair/proto:fastpair_cc_proto", "//fastpair/repository:test_support", "//internal/account", - "//internal/account:test_support", "//internal/auth:credential", "//internal/base:bluetooth_address", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep - "//internal/test/google3_only:test", + "//internal/test", "@boringssl//:crypto", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/functional:any_invocable", diff --git a/fastpair/pairing/fastpair/fast_pair_pairer_impl.h b/fastpair/pairing/fastpair/fast_pair_pairer_impl.h index 9024e636..dd7d87c9 100644 --- a/fastpair/pairing/fastpair/fast_pair_pairer_impl.h +++ b/fastpair/pairing/fastpair/fast_pair_pairer_impl.h @@ -26,8 +26,8 @@ #include "fastpair/handshake/fast_pair_handshake.h" #include "fastpair/internal/mediums/mediums.h" #include "fastpair/pairing/fastpair/fast_pair_pairer.h" -#include "internal/account/account_manager.h" #include "internal/platform/bluetooth_classic.h" +#include "internal/platform/implementation/account_manager.h" #include "internal/platform/single_thread_executor.h" #include "internal/platform/timer_impl.h" diff --git a/fastpair/pairing/fastpair/fast_pair_pairer_impl_test.cc b/fastpair/pairing/fastpair/fast_pair_pairer_impl_test.cc index d2eac0e5..19e31b5d 100644 --- a/fastpair/pairing/fastpair/fast_pair_pairer_impl_test.cc +++ b/fastpair/pairing/fastpair/fast_pair_pairer_impl_test.cc @@ -34,7 +34,6 @@ #include "fastpair/common/account_key.h" #include "fastpair/common/device_metadata.h" #include "fastpair/common/fast_pair_device.h" -#include "fastpair/common/fast_pair_prefs.h" #include "fastpair/common/fast_pair_version.h" #include "fastpair/common/protocol.h" #include "fastpair/crypto/decrypted_passkey.h" @@ -47,15 +46,13 @@ #include "fastpair/pairing/fastpair/fast_pair_pairer.h" #include "fastpair/proto/fastpair_rpcs.proto.h" #include "fastpair/repository/fake_fast_pair_repository.h" -#include "internal/account/fake_account_manager.h" #include "internal/base/bluetooth_address.h" #include "internal/platform/ble_v2.h" #include "internal/platform/bluetooth_adapter.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/medium_environment.h" #include "internal/platform/single_thread_executor.h" -#include "internal/platform/task_runner_impl.h" -#include "internal/test/google3_only/fake_authentication_manager.h" +#include "internal/test/fake_account_manager.h" namespace nearby { namespace fastpair { @@ -137,18 +134,12 @@ class FastPairPairerImplTest : public testing::Test { FastPairPairerImplTest() { FastPairDataEncryptorImpl::Factory::SetFactoryForTesting( &fake_data_encryptor_factory_); - task_runner_ = std::make_unique(1); - preferences_manager_ = std::make_unique( - kFastPairPreferencesFilePath); - authentication_manager_ = std::make_unique(); } void SetUp() override { env_.Start(); // Setups seeker device. mediums_ = std::make_unique(); - account_manager_ = std::make_unique( - preferences_manager_.get(), prefs::kNearbyFastPairUsersName, - authentication_manager_.get(), task_runner_.get()); + account_manager_ = std::make_unique(); // Setups provider device. adapter_provider_ = std::make_unique(); @@ -384,9 +375,6 @@ class FastPairPairerImplTest : public testing::Test { private: MediumEnvironment& env_{MediumEnvironment::Instance()}; Mutex mutex_; - std::unique_ptr preferences_manager_; - std::unique_ptr authentication_manager_; - std::unique_ptr task_runner_; std::unique_ptr bt_provider_; std::unique_ptr adapter_provider_; std::unique_ptr gatt_server_; diff --git a/fastpair/pairing/pairer_broker_impl.h b/fastpair/pairing/pairer_broker_impl.h index 0c88d975..3fc28106 100644 --- a/fastpair/pairing/pairer_broker_impl.h +++ b/fastpair/pairing/pairer_broker_impl.h @@ -24,8 +24,8 @@ #include "fastpair/internal/mediums/mediums.h" #include "fastpair/pairing/fastpair/fast_pair_pairer.h" #include "fastpair/pairing/pairer_broker.h" -#include "internal/account/account_manager.h" #include "internal/base/observer_list.h" +#include "internal/platform/implementation/account_manager.h" #include "internal/platform/single_thread_executor.h" #include "internal/platform/timer_impl.h" diff --git a/fastpair/pairing/pairer_broker_impl_test.cc b/fastpair/pairing/pairer_broker_impl_test.cc index d1d98648..4a138f31 100644 --- a/fastpair/pairing/pairer_broker_impl_test.cc +++ b/fastpair/pairing/pairer_broker_impl_test.cc @@ -24,7 +24,6 @@ #include "gtest/gtest.h" #include "absl/functional/bind_front.h" #include "fastpair//handshake/fast_pair_handshake_lookup.h" -#include "fastpair/common/fast_pair_prefs.h" #include "fastpair/common/pair_failure.h" #include "fastpair/crypto/decrypted_passkey.h" #include "fastpair/crypto/decrypted_response.h" @@ -37,13 +36,11 @@ #include "fastpair/internal/mediums/mediums.h" #include "fastpair/proto/fastpair_rpcs.proto.h" #include "fastpair/repository/fake_fast_pair_repository.h" -#include "internal/account/fake_account_manager.h" #include "internal/base/bluetooth_address.h" #include "internal/platform/ble_v2.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/medium_environment.h" -#include "internal/platform/task_runner_impl.h" -#include "internal/test/google3_only/fake_authentication_manager.h" +#include "internal/test/fake_account_manager.h" namespace nearby { namespace fastpair { @@ -180,19 +177,13 @@ class PairerBrokerImplTest : public testing::Test { PairerBrokerImplTest() { FastPairDataEncryptorImpl::Factory::SetFactoryForTesting( &fake_data_encryptor_factory_); - task_runner_ = std::make_unique(1); - preferences_manager_ = std::make_unique( - kFastPairPreferencesFilePath); - authentication_manager_ = std::make_unique(); } void SetUp() override { env_.Start(); // Setups seeker device. mediums_ = std::make_unique(); - account_manager_ = std::make_unique( - preferences_manager_.get(), prefs::kNearbyFastPairUsersName, - authentication_manager_.get(), task_runner_.get()); + account_manager_ = std::make_unique(); // Setups provider device. adapter_provider_ = std::make_unique(); @@ -416,9 +407,6 @@ class PairerBrokerImplTest : public testing::Test { private: MediumEnvironment& env_{MediumEnvironment::Instance()}; Mutex mutex_; - std::unique_ptr preferences_manager_; - std::unique_ptr authentication_manager_; - std::unique_ptr task_runner_; std::unique_ptr bt_provider_; std::unique_ptr adapter_provider_; std::unique_ptr gatt_server_; diff --git a/fastpair/plugins/BUILD b/fastpair/plugins/BUILD index 2b88e45f..33cda443 100644 --- a/fastpair/plugins/BUILD +++ b/fastpair/plugins/BUILD @@ -23,7 +23,7 @@ cc_library( name = "fake_initial_pair_plugin", hdrs = ["fake_initial_pair_plugin.h"], compatible_with = ["//buildenv/target:non_prod"], - visibility = ["//:__subpackages__"], + visibility = ["//visibility:private"], deps = [ "//fastpair:fast_pair_events", "//fastpair:fast_pair_plugin", diff --git a/fastpair/proto/BUILD b/fastpair/proto/BUILD index 1ef59ebb..deec2ea6 100644 --- a/fastpair/proto/BUILD +++ b/fastpair/proto/BUILD @@ -1,4 +1,19 @@ +# Copyright 2022 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. + load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") licenses(["notice"]) diff --git a/fastpair/proto/fastpair_rpcs.proto b/fastpair/proto/fastpair_rpcs.proto index 40d28f02..eb28d6ce 100644 --- a/fastpair/proto/fastpair_rpcs.proto +++ b/fastpair/proto/fastpair_rpcs.proto @@ -16,6 +16,7 @@ syntax = "proto3"; package nearby.fastpair.proto; +// import "storage/datapol/annotations/proto/semantic_annotations.proto"; import "third_party/nearby/fastpair/proto/data.proto"; // Represents the type of device that is being registered. @@ -126,7 +127,7 @@ message Device { // broadcasting legitimately. message AntiSpoofingKeyPair { // The private key (restricted to only be viewable by trusted clients). - bytes private_key = 1; + bytes private_key = 1 /* type = ST_SECURITY_KEY */; // The public key. bytes public_key = 2; diff --git a/fastpair/repository/BUILD b/fastpair/repository/BUILD index 1f1afc60..52569105 100644 --- a/fastpair/repository/BUILD +++ b/fastpair/repository/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + licenses(["notice"]) cc_library( diff --git a/fastpair/retroactive/BUILD b/fastpair/retroactive/BUILD index 63315b12..3b0676aa 100644 --- a/fastpair/retroactive/BUILD +++ b/fastpair/retroactive/BUILD @@ -38,10 +38,11 @@ cc_library( "//fastpair/pairing", "//fastpair/repository", "//fastpair/repository:device_repository", - "//internal/account", "//internal/base", "//internal/platform:comm", "//internal/platform:types", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation:types", "//third_party/magic_enum", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/status", diff --git a/fastpair/retroactive/retroactive_pairing_detector_impl.cc b/fastpair/retroactive/retroactive_pairing_detector_impl.cc index 40b4c579..5bcffb73 100644 --- a/fastpair/retroactive/retroactive_pairing_detector_impl.cc +++ b/fastpair/retroactive/retroactive_pairing_detector_impl.cc @@ -22,7 +22,7 @@ #include "fastpair/internal/mediums/mediums.h" #include "fastpair/repository/fast_pair_repository.h" -#include "internal/account/account_manager.h" +#include "internal/platform/implementation/account_manager.h" namespace nearby { namespace fastpair { diff --git a/fastpair/retroactive/retroactive_pairing_detector_impl.h b/fastpair/retroactive/retroactive_pairing_detector_impl.h index 7c876f86..796fb347 100644 --- a/fastpair/retroactive/retroactive_pairing_detector_impl.h +++ b/fastpair/retroactive/retroactive_pairing_detector_impl.h @@ -19,9 +19,9 @@ #include "fastpair/internal/mediums/mediums.h" #include "fastpair/repository/fast_pair_device_repository.h" #include "fastpair/retroactive/retroactive_pairing_detector.h" -#include "internal/account/account_manager.h" #include "internal/base/observer_list.h" #include "internal/platform/bluetooth_classic.h" +#include "internal/platform/implementation/account_manager.h" #include "internal/platform/single_thread_executor.h" namespace nearby { diff --git a/fastpair/rust/bluetooth/src/api/mod.rs b/fastpair/rust/bluetooth/src/api/mod.rs index 0e410749..64c382d0 100644 --- a/fastpair/rust/bluetooth/src/api/mod.rs +++ b/fastpair/rust/bluetooth/src/api/mod.rs @@ -1,3 +1,17 @@ +// Copyright 2023 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. + mod adapter; mod device; diff --git a/fastpair/rust/demo/analysis_options.yaml b/fastpair/rust/demo/analysis_options.yaml index 61b6c4de..6c5d26c5 100644 --- a/fastpair/rust/demo/analysis_options.yaml +++ b/fastpair/rust/demo/analysis_options.yaml @@ -1,3 +1,17 @@ +# Copyright 2023 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. + # This file configures the analyzer, which statically analyzes Dart code to # check for errors, warnings, and lints. # diff --git a/fastpair/rust/demo/pubspec.lock b/fastpair/rust/demo/pubspec.lock index a6087902..b475ef49 100644 --- a/fastpair/rust/demo/pubspec.lock +++ b/fastpair/rust/demo/pubspec.lock @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: archive - sha256: "0c8368c9b3f0abbc193b9d6133649a614204b528982bebc7026372d61677ce3a" + sha256: "49b1fad315e57ab0bbc15bcbb874e83116a1d78f77ebd500a4af6c9407d6b28e" url: "https://pub.dev" source: hosted - version: "3.3.7" + version: "3.3.8" args: dependency: transitive description: @@ -165,10 +165,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.2" convert: dependency: transitive description: @@ -375,18 +375,18 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: @@ -516,10 +516,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -564,10 +564,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.0" timing: dependency: transitive description: @@ -616,6 +616,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" web_socket_channel: dependency: transitive description: diff --git a/fastpair/rust/demo/pubspec.yaml b/fastpair/rust/demo/pubspec.yaml index 3ae724d4..1264ee3c 100644 --- a/fastpair/rust/demo/pubspec.yaml +++ b/fastpair/rust/demo/pubspec.yaml @@ -1,3 +1,17 @@ +# Copyright 2023 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. + name: demo description: FLutter UI demo for Fast Pair Windows written in Rust. # The following line prevents the package from being accidentally published to diff --git a/fastpair/rust/demo/rust/Cargo.toml b/fastpair/rust/demo/rust/Cargo.toml index 4d736a04..e9769834 100644 --- a/fastpair/rust/demo/rust/Cargo.toml +++ b/fastpair/rust/demo/rust/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["lib", "cdylib", "staticlib"] [dependencies] bluetooth = { version = "0.1", path = "../../bluetooth" } -flutter_rust_bridge = "1" +flutter_rust_bridge = "=1.80.1" futures = { version = "0.3", features = ["executor"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/fastpair/rust/demo/windows/CMakeLists.txt b/fastpair/rust/demo/windows/CMakeLists.txt index 172a9862..c08df44a 100644 --- a/fastpair/rust/demo/windows/CMakeLists.txt +++ b/fastpair/rust/demo/windows/CMakeLists.txt @@ -1,3 +1,17 @@ +# Copyright 2023 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. + # Project-level configuration. cmake_minimum_required(VERSION 3.14) project(demo LANGUAGES CXX) diff --git a/fastpair/rust/demo/windows/flutter/CMakeLists.txt b/fastpair/rust/demo/windows/flutter/CMakeLists.txt index 930d2071..1230e03e 100644 --- a/fastpair/rust/demo/windows/flutter/CMakeLists.txt +++ b/fastpair/rust/demo/windows/flutter/CMakeLists.txt @@ -1,3 +1,17 @@ +# Copyright 2023 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. + # This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.14) diff --git a/fastpair/rust/demo/windows/runner/CMakeLists.txt b/fastpair/rust/demo/windows/runner/CMakeLists.txt index 394917c0..f498e23e 100644 --- a/fastpair/rust/demo/windows/runner/CMakeLists.txt +++ b/fastpair/rust/demo/windows/runner/CMakeLists.txt @@ -1,3 +1,17 @@ +# Copyright 2023 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. + cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) diff --git a/fastpair/rust/demo/windows/rust.cmake b/fastpair/rust/demo/windows/rust.cmake index 4931b359..74a7bf9b 100644 --- a/fastpair/rust/demo/windows/rust.cmake +++ b/fastpair/rust/demo/windows/rust.cmake @@ -1,3 +1,17 @@ +# Copyright 2023 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. + # We include Corrosion inline here, but ideally in a project with # many dependencies we would need to install Corrosion on the system. # See instructions on https://github.com/AndrewGaspar/corrosion#cmake-install diff --git a/fastpair/scanning/scanner_broker_impl_test.cc b/fastpair/scanning/scanner_broker_impl_test.cc index 6e00d9a4..aed8f916 100644 --- a/fastpair/scanning/scanner_broker_impl_test.cc +++ b/fastpair/scanning/scanner_broker_impl_test.cc @@ -21,6 +21,7 @@ #include "gtest/gtest.h" #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" +#include "fastpair/common/account_key.h" #include "fastpair/common/fast_pair_device.h" #include "fastpair/common/protocol.h" #include "fastpair/internal/mediums/mediums.h" @@ -145,7 +146,7 @@ TEST_F(ScannerBrokerImplTest, FoundDiscoverableAdvertisement) { scanning_session.reset(); } -TEST_F(ScannerBrokerImplTest, FoundNonDiscoverableAdvertisement) { +TEST_F(ScannerBrokerImplTest, DISABLED_FoundNonDiscoverableAdvertisement) { SingleThreadExecutor executor; FastPairDeviceRepository devices{&executor}; diff --git a/fastpair/server_access/BUILD b/fastpair/server_access/BUILD index 89bfffa7..e4fa40f4 100644 --- a/fastpair/server_access/BUILD +++ b/fastpair/server_access/BUILD @@ -32,11 +32,15 @@ cc_library( "//fastpair/common", "//fastpair/proto:fastpair_cc_proto", "//fastpair/proto:proto_to_json", - "//internal/account", + "//internal/auth:credential", "//internal/auth:types", "//internal/base", "//internal/network:types", + "//internal/network:url", "//internal/platform:types", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation:types", + "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", @@ -89,15 +93,21 @@ cc_test( "//fastpair/common", "//fastpair/proto:fastpair_cc_proto", "//fastpair/proto:proto_builder", - "//internal/account", - "//internal/account:test_support", "//internal/auth:credential", + "//internal/auth:types", "//internal/network:types", + "//internal/network:url", "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep "//internal/test", "//internal/test/google3_only:test", "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:string_view", "@com_google_googletest//:gtest_main", ], ) diff --git a/fastpair/server_access/fast_pair_client_impl.cc b/fastpair/server_access/fast_pair_client_impl.cc index 8a5960e8..515c65f1 100644 --- a/fastpair/server_access/fast_pair_client_impl.cc +++ b/fastpair/server_access/fast_pair_client_impl.cc @@ -14,20 +14,28 @@ #include "fastpair/server_access/fast_pair_client_impl.h" -#include #include #include #include #include +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "absl/synchronization/notification.h" #include "fastpair/common/fast_pair_switches.h" -#include "internal/account/account_manager.h" +#include "fastpair/server_access/fast_pair_http_notifier.h" +#include "internal/auth/auth_status_util.h" +#include "internal/auth/authentication_manager.h" #include "internal/network/http_client.h" +#include "internal/network/http_request.h" +#include "internal/network/http_response.h" #include "internal/network/url.h" +#include "internal/platform/device_info.h" +#include "internal/platform/implementation/account_manager.h" +#include "internal/platform/implementation/device_info.h" #include "internal/platform/logging.h" namespace nearby { @@ -274,19 +282,15 @@ absl::StatusOr FastPairClientImpl::GetAccessToken() { absl::StatusOr result; absl::Notification notification; authentication_manager_->FetchAccessToken( - account->id, { - .success_cb = - [&](absl::string_view access_token) { - result = std::string(access_token); - notification.Notify(); - }, - .failure_cb = - [&](auth::AuthStatus status) { - result = absl::UnknownError( - absl::StrCat(static_cast(status))); - notification.Notify(); - }, - }); + account->id, + [&](auth::AuthStatus status, absl::string_view access_token) { + if (status == auth::AuthStatus::SUCCESS) { + result = std::string(access_token); + } else { + result = absl::UnknownError(absl::StrCat(static_cast(status))); + } + notification.Notify(); + }); notification.WaitForNotification(); return result; } diff --git a/fastpair/server_access/fast_pair_client_impl.h b/fastpair/server_access/fast_pair_client_impl.h index d86e8276..f24a965d 100644 --- a/fastpair/server_access/fast_pair_client_impl.h +++ b/fastpair/server_access/fast_pair_client_impl.h @@ -24,11 +24,11 @@ #include "absl/strings/string_view.h" #include "fastpair/server_access/fast_pair_client.h" #include "fastpair/server_access/fast_pair_http_notifier.h" -#include "internal/account/account_manager.h" #include "internal/auth/authentication_manager.h" #include "internal/network/http_client.h" #include "internal/network/url.h" #include "internal/platform/device_info.h" +#include "internal/platform/implementation/account_manager.h" namespace nearby { namespace fastpair { diff --git a/fastpair/server_access/fast_pair_client_impl_test.cc b/fastpair/server_access/fast_pair_client_impl_test.cc index f2c2c0b3..e8b86a60 100644 --- a/fastpair/server_access/fast_pair_client_impl_test.cc +++ b/fastpair/server_access/fast_pair_client_impl_test.cc @@ -25,23 +25,34 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/functional/any_invocable.h" +#include "absl/log/check.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/ascii.h" +#include "absl/strings/escaping.h" +#include "absl/strings/numbers.h" +#include "absl/strings/string_view.h" +#include "fastpair/common/account_key.h" +#include "fastpair/common/device_metadata.h" #include "fastpair/common/fast_pair_device.h" -#include "fastpair/common/fast_pair_prefs.h" #include "fastpair/common/fast_pair_switches.h" +#include "fastpair/common/protocol.h" #include "fastpair/proto/data.proto.h" #include "fastpair/proto/enum.proto.h" #include "fastpair/proto/fast_pair_string.proto.h" #include "fastpair/proto/proto_builder.h" +#include "fastpair/server_access/fast_pair_client.h" #include "fastpair/server_access/fast_pair_http_notifier.h" -#include "internal/account/account_manager.h" -#include "internal/account/fake_account_manager.h" #include "internal/auth/auth_status_util.h" +#include "internal/auth/authentication_manager.h" #include "internal/network/http_client.h" #include "internal/network/http_request.h" #include "internal/network/http_response.h" #include "internal/network/http_status_code.h" #include "internal/network/url.h" -#include "internal/platform/task_runner_impl.h" +#include "internal/platform/device_info.h" +#include "internal/test/fake_account_manager.h" #include "internal/test/fake_device_info.h" #include "internal/test/google3_only/fake_authentication_manager.h" @@ -89,11 +100,11 @@ class MockHttpClient : public HttpClient { public: MOCK_METHOD(void, StartRequest, (const HttpRequest& request, - std::function&)>), + absl::AnyInvocable&)>), (override)); MOCK_METHOD(void, StartCancellableRequest, (std::unique_ptr request, - std::function&)>), + absl::AnyInvocable&)>), (override)); MOCK_METHOD(absl::StatusOr, GetResponse, (const HttpRequest&), (override)); @@ -119,9 +130,10 @@ std::vector ExpectQueryStringValues( // A gMock matcher to match proto values. Use this matcher like: // request/response proto, expected_proto; // EXPECT_THAT(proto, MatchesProto(expected_proto)); -MATCHER_P(MatchesProto, expected_proto, - absl::StrCat(negation ? "does not match" : "matches", - testing::PrintToString(expected_proto.SerializeAsString()))) { +MATCHER_P( + MatchesProto, expected_proto, + absl::StrCat(negation ? "does not match" : "matches", + testing::PrintToString(expected_proto.SerializeAsString()))) { return arg.has_value() && arg->SerializeAsString() == expected_proto.SerializeAsString(); } @@ -130,16 +142,11 @@ class FastPairClientImplTest : public ::testing::Test, public FastPairHttpNotifier::Observer { protected: FastPairClientImplTest() { - preferences_manager_ = std::make_unique( - kFastPairPreferencesFilePath); authentication_manager_ = std::make_unique(); AccountManager::Account account; account.id = kTestAccountId; - account_manager_ = std::make_unique( - preferences_manager_.get(), prefs::kNearbyFastPairUsersName, - authentication_manager_.get(), task_runner_.get()); + account_manager_ = std::make_unique(); account_manager_->SetAccount(account); - task_runner_ = std::make_unique(1); device_info_ = std::make_unique(); } @@ -218,12 +225,10 @@ class FastPairClientImplTest : public ::testing::Test, std::optional delete_device_request_; std::optional delete_device_response_; - std::unique_ptr preferences_manager_; std::unique_ptr authentication_manager_; std::unique_ptr account_manager_; std::unique_ptr fast_pair_client_; std::unique_ptr device_info_; - std::unique_ptr task_runner_; ::testing::NiceMock* http_client_; std::unique_ptr mock_http_client_; FastPairHttpNotifier notifier_; diff --git a/gen_proto.sh b/gen_proto.sh new file mode 100755 index 00000000..09a33ed5 --- /dev/null +++ b/gen_proto.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Copyright 2024 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. + +COMPILED_PROTO_PATH="compiled_proto" + +${PROTOC} --cpp_out=${COMPILED_PROTO_PATH} internal/proto/analytics/connections_log.proto +${PROTOC} --cpp_out=${COMPILED_PROTO_PATH} internal/proto/analytics/fast_pair_log.proto +${PROTOC} --cpp_out=${COMPILED_PROTO_PATH} sharing/proto/analytics/nearby_sharing_log.proto +${PROTOC} --cpp_out=${COMPILED_PROTO_PATH} proto/fast_pair_enums.proto +${PROTOC} --cpp_out=${COMPILED_PROTO_PATH} proto/sharing_enums.proto diff --git a/internal/analytics/BUILD b/internal/analytics/BUILD index 4d6bfc2d..b39ce583 100644 --- a/internal/analytics/BUILD +++ b/internal/analytics/BUILD @@ -23,8 +23,27 @@ cc_library( "//fastpair:__subpackages__", "//location/nearby/analytics/cpp:__subpackages__", "//location/nearby/cpp/experiments:__subpackages__", - "//location/nearby/cpp/sharing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + "//internal/proto/analytics:connections_log_cc_proto", + "//internal/proto/analytics:fast_pair_log_cc_proto", + "//sharing/proto/analytics:sharing_log_cc_proto", + ], +) + +cc_library( + name = "mock_event_logger", + testonly = True, + hdrs = [ + "mock_event_logger.h", + "sharing_log_matchers.h", + ], + compatible_with = ["//buildenv/target:non_prod"], + visibility = ["//visibility:public"], + deps = [ + ":event_logger", + "@com_google_googletest//:gtest_for_library_testonly", + "@com_google_protobuf//:protobuf_lite", ], - deps = ["@com_google_protobuf//:protobuf"], ) diff --git a/internal/analytics/event_logger.h b/internal/analytics/event_logger.h index e90ae41b..49962d48 100644 --- a/internal/analytics/event_logger.h +++ b/internal/analytics/event_logger.h @@ -15,7 +15,9 @@ #ifndef NEARBY_ANALYTICS_EVENT_LOGGER_H_ #define NEARBY_ANALYTICS_EVENT_LOGGER_H_ -#include "google/protobuf/message_lite.h" +#include "internal/proto/analytics/connections_log.pb.h" +#include "internal/proto/analytics/fast_pair_log.pb.h" +#include "sharing/proto/analytics/nearby_sharing_log.pb.h" namespace nearby { namespace analytics { @@ -29,7 +31,10 @@ class EventLogger { // Logs the proto details. Might block to do I/O, e.g. upload // synchronously to some metrics server. - virtual void Log(const ::google::protobuf::MessageLite& message) = 0; + virtual void Log( + const location::nearby::analytics::proto::ConnectionsLog& message) = 0; + virtual void Log(const sharing::analytics::proto::SharingLog& message) = 0; + virtual void Log(const nearby::proto::fastpair::FastPairLog& message) = 0; }; } // namespace analytics diff --git a/internal/analytics/mock_event_logger.h b/internal/analytics/mock_event_logger.h new file mode 100644 index 00000000..36e443e7 --- /dev/null +++ b/internal/analytics/mock_event_logger.h @@ -0,0 +1,40 @@ +// Copyright 2024 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_INTERNAL_ANALYTICS_MOCK_EVENT_LOGGER_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_ANALYTICS_MOCK_EVENT_LOGGER_H_ + +#include "gmock/gmock.h" +#include "internal/analytics/event_logger.h" + +namespace nearby::analytics { + +class MockEventLogger : public ::nearby::analytics::EventLogger { + public: + MockEventLogger() = default; + ~MockEventLogger() override = default; + + MOCK_METHOD( + void, Log, + (const location::nearby::analytics::proto::ConnectionsLog& message), + (override)); + MOCK_METHOD(void, Log, (const sharing::analytics::proto::SharingLog& message), + (override)); + MOCK_METHOD(void, Log, (const nearby::proto::fastpair::FastPairLog& message), + (override)); +}; + +} // namespace nearby::analytics + +#endif // THIRD_PARTY_NEARBY_INTERNAL_ANALYTICS_MOCK_EVENT_LOGGER_H_ diff --git a/internal/analytics/sharing_log_matchers.h b/internal/analytics/sharing_log_matchers.h new file mode 100644 index 00000000..ce01eb84 --- /dev/null +++ b/internal/analytics/sharing_log_matchers.h @@ -0,0 +1,64 @@ +// Copyright 2024 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_INTERNAL_ANALYTICS_SHARING_LOG_MATCHERS_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_ANALYTICS_SHARING_LOG_MATCHERS_H_ + +#include "gmock/gmock.h" + +namespace nearby::analytics { + +MATCHER_P(HasCategory, category, "has category") { + return arg.event_category() == category; +} + +MATCHER_P(HasEventType, event_type, "has event type") { + return arg.event_type() == event_type; +} + +MATCHER_P(HasAction, action, "has action") { + return arg.action() == action; +} + +MATCHER_P(HasSessionId, session_id, "has session id") { + return arg.session_id() == session_id; +} + +MATCHER_P(HasDurationMillis, duration_millis, "has duration millis") { + return arg.duration_millis() == duration_millis; +} + +MATCHER_P(SharingLogHasStatus, status, "has status") { + return arg.status() == status; +} + +MATCHER_P(HasRpcName, rpc_name, "has rpc_name") { + return arg.rpc_name() == rpc_name; +} + +MATCHER_P(HasDirection, direction, "has direction") { + return arg.direction() == direction; +} + +MATCHER_P(HasErrorCode, error_code, "has error_code") { + return arg.error_code() == error_code; +} + +MATCHER_P(HasLatencyMillis, latency_millis, "has latency_millis") { + return arg.latency_millis() == latency_millis; +} + +} // namespace nearby::analytics + +#endif // THIRD_PARTY_NEARBY_INTERNAL_ANALYTICS_SHARING_LOG_MATCHERS_H_ diff --git a/internal/base/BUILD b/internal/base/BUILD index a07f30d3..689613f9 100644 --- a/internal/base/BUILD +++ b/internal/base/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + licenses(["notice"]) cc_library( @@ -7,17 +21,12 @@ cc_library( hdrs = [ "observer_list.h", ], - copts = [ - "-Ithird_party", - ], visibility = [ "//fastpair:__subpackages__", "//internal/account:__subpackages__", - "//internal/interop:__pkg__", "//internal/platform:__pkg__", - "//location/nearby/cpp/experiments:__subpackages__", - "//location/nearby/cpp/sharing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//internal/test:__pkg__", + "//sharing:__subpackages__", ], deps = [ "//internal/platform:types", @@ -34,14 +43,10 @@ cc_library( hdrs = [ "bluetooth_address.h", ], - copts = [ - "-Ithird_party", - ], visibility = [ "//fastpair:__subpackages__", "//internal:__subpackages__", - "//location/nearby/cpp/sharing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ "@com_google_absl//absl/strings", @@ -51,6 +56,13 @@ cc_library( ], ) +cc_library( + name = "files", + srcs = ["files.cc"], + hdrs = ["files.h"], + visibility = ["//visibility:public"], +) + cc_test( name = "base_test", size = "small", @@ -58,10 +70,6 @@ cc_test( srcs = [ "bluetooth_address_test.cc", ], - copts = [ - "-Ithird_party", - ], - shard_count = 8, deps = [ ":bluetooth_address", "@com_github_protobuf_matchers//protobuf-matchers", @@ -70,3 +78,17 @@ cc_test( "@com_google_googletest//:gtest_main", ], ) + +cc_test( + name = "files_test", + size = "small", + timeout = "short", + srcs = [ + "files_test.cc", + ], + deps = [ + ":files", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/internal/base/files.cc b/internal/base/files.cc new file mode 100644 index 00000000..b0302848 --- /dev/null +++ b/internal/base/files.cc @@ -0,0 +1,118 @@ +// Copyright 2024 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. + +#include "internal/base/files.h" + +#include +#include // NOLINT(build/c++17) +#include +#include // NOLINT(build/c++11) + +namespace nearby::sharing { + +bool FileExists(const std::filesystem::path& path) { + std::error_code error_code; + if (std::filesystem::exists(path, error_code) && + !std::filesystem::is_directory(path, error_code)) { + // is_directory returns false on error. + return (!error_code); + } + return false; +} + +std::optional GetFileSize(const std::filesystem::path& path) { + if (!FileExists(path)) { + return std::nullopt; + } + std::error_code error_code; + uintmax_t size = std::filesystem::file_size(path, error_code); + if (size == static_cast(-1)) { + return std::nullopt; + } + return size; +} + +bool DirectoryExists(const std::filesystem::path& path) { + std::error_code error_code; + if (std::filesystem::exists(path, error_code) && + std::filesystem::is_directory(path, error_code)) { + return true; + } + return false; +} + +bool RemoveFile(const std::filesystem::path& path) { + if (!FileExists(path)) { + return false; + } + std::error_code error_code; + return std::filesystem::remove(path, error_code); +} + +std::optional GetTemporaryDirectory() { + std::error_code error_code; + std::filesystem::path temp_dir = + std::filesystem::temp_directory_path(error_code); + if (temp_dir.empty()) { + return std::nullopt; + } + return temp_dir; +} + +std::filesystem::path CurrentDirectory() { + // temp_directory_path() returns empty path on error. + std::error_code error_code; + return std::filesystem::current_path(error_code); +} + +bool Rename(const std::filesystem::path& old_path, + const std::filesystem::path& new_path) { + std::error_code error_code; + std::filesystem::rename(old_path, new_path, error_code); + if (error_code) { + return false; + } + return true; +} + +bool CreateDirectories(const std::filesystem::path& path) { + std::error_code error_code; + std::filesystem::create_directories(path, error_code); + if (error_code) { + return false; + } + return true; +} + +bool CreateHardLink(const std::filesystem::path& target, + const std::filesystem::path& link_path) { + std::error_code error_code; + std::filesystem::create_hard_link(target, link_path, error_code); + if (error_code) { + return false; + } + return true; +} + +bool CopyFileSafely(const std::filesystem::path& old_path, + const std::filesystem::path& new_path) { + std::error_code error_code; + std::filesystem::copy(old_path, new_path, error_code); + if (error_code) { + return false; + } + return true; +} + +} // namespace nearby::sharing diff --git a/internal/base/files.h b/internal/base/files.h new file mode 100644 index 00000000..40b1a976 --- /dev/null +++ b/internal/base/files.h @@ -0,0 +1,66 @@ +// Copyright 2024 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_INTERNAL_BASE_FILES_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_BASE_FILES_H_ + +#include +#include // NOLINT(build/c++17) +#include + +// This file contains exception safe wrappers to access common std::filesystem +// functions. +namespace nearby::sharing { + +// Returns true if path exists and is not a directory. +bool FileExists(const std::filesystem::path& path); + +// Returns the size of the file at path, or nullopt if not found or not a file. +std::optional GetFileSize(const std::filesystem::path& path); + +// Returns true if path exists and is a directory. +bool DirectoryExists(const std::filesystem::path& path); + +// Removes the file at path and returns true. +// Returns false if path does not exist, is not a file or cannot be removed. +bool RemoveFile(const std::filesystem::path& path); + +// Returns path to a temporary directory if available. +std::optional GetTemporaryDirectory(); + +// Returns path to the current directory. On failure returns an empty path. +std::filesystem::path CurrentDirectory(); + +// Renames the file at old_path to new_path. +// Returns true on success. +bool Rename(const std::filesystem::path& old_path, + const std::filesystem::path& new_path); + +// Creates all directory leading to path. +// Returns true on success. +bool CreateDirectories(const std::filesystem::path& path); + +// Creates a hard link to target at link_path. +// Returns true on success. +bool CreateHardLink(const std::filesystem::path& target, + const std::filesystem::path& link_path); + +// Copies the file at old_path to new_path. +// Returns true on success. +bool CopyFileSafely(const std::filesystem::path& old_path, + const std::filesystem::path& new_path); + +} // namespace nearby::sharing + +#endif // THIRD_PARTY_NEARBY_INTERNAL_BASE_FILES_H_ diff --git a/internal/base/files_test.cc b/internal/base/files_test.cc new file mode 100644 index 00000000..7a8e1530 --- /dev/null +++ b/internal/base/files_test.cc @@ -0,0 +1,48 @@ +// Copyright 2024 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. + +#include "internal/base/files.h" + +#include +#include // NOLINT +#include +#include +#include + +#include "gtest/gtest.h" + +namespace nearby::sharing { +namespace { + +TEST(FilesTest, CreateHardLinkSuccess) { + std::filesystem::path temp_dir = testing::TempDir(); + std::filesystem::path target = temp_dir / "target"; + RemoveFile(target); + std::ofstream ofstream(target, std::ios::app); + ASSERT_EQ(ofstream.rdstate(), std::ios_base::goodbit); + ofstream << "Hello world"; + ofstream.flush(); + std::optional size = GetFileSize(target); + ASSERT_TRUE(size.has_value()); + EXPECT_EQ(size.value(), 11); + std::filesystem::path link_path = temp_dir / "link_path"; + EXPECT_TRUE(CreateHardLink(target, link_path)); + EXPECT_TRUE(FileExists(link_path)); + EXPECT_EQ(GetFileSize(link_path), 11); + RemoveFile(link_path); + RemoveFile(target); +} + +} // namespace +} // namespace nearby::sharing diff --git a/internal/crypto/BUILD b/internal/crypto/BUILD index d301d989..1f8f3d3c 100644 --- a/internal/crypto/BUILD +++ b/internal/crypto/BUILD @@ -29,12 +29,12 @@ cc_library( ], deps = [ "//internal/crypto_cros", + "//internal/platform:types", "@boringssl//:crypto", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", - "@com_google_absl//absl/types:span", ], ) @@ -50,6 +50,7 @@ cc_test( ], deps = [ ":crypto", + "//internal/platform/implementation/g3", # fixdeps: keep "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/strings", "@com_google_absl//absl/types:span", diff --git a/internal/crypto/ed25519.cc b/internal/crypto/ed25519.cc index 88d8b79b..35c17a0a 100644 --- a/internal/crypto/ed25519.cc +++ b/internal/crypto/ed25519.cc @@ -20,12 +20,13 @@ #include #include "absl/status/status.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" -#include "internal/crypto_cros/random.h" +#include "internal/platform/crypto.h" #include #include -namespace crypto { +namespace nearby::crypto { constexpr size_t kEd25519SignatureSize = 64; constexpr size_t kEd25519PrivateKeySize = 32; @@ -97,7 +98,7 @@ absl::StatusOr Ed25519Signer::CreateNewKeyPair( absl::StatusOr Ed25519Signer::CreateNewKeyPair() { uint8_t key_seed[kEd25519KeySeedSize] = {0}; - RandBytes(key_seed, kEd25519KeySeedSize); + nearby::RandBytes(key_seed, kEd25519KeySeedSize); return CreateNewKeyPair( std::string(reinterpret_cast(key_seed), kEd25519KeySeedSize)); } @@ -180,4 +181,4 @@ absl::Status Ed25519Verifier::Verify(absl::string_view data, : absl::InternalError("Signature is invalid."); } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto/ed25519.h b/internal/crypto/ed25519.h index 9fee90e9..06c75266 100644 --- a/internal/crypto/ed25519.h +++ b/internal/crypto/ed25519.h @@ -25,7 +25,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { #ifdef OPENSSL_IS_BORINGSSL using CryptoKeyUniquePtr = ::bssl::UniquePtr; @@ -73,6 +73,6 @@ class CRYPTO_EXPORT Ed25519Verifier { CryptoKeyUniquePtr public_key_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_ED25519_H_ diff --git a/internal/crypto/ed25519_unittest.cc b/internal/crypto/ed25519_unittest.cc index 5d580c4a..97be492d 100644 --- a/internal/crypto/ed25519_unittest.cc +++ b/internal/crypto/ed25519_unittest.cc @@ -21,7 +21,7 @@ #include "gtest/gtest.h" #include "absl/strings/escaping.h" -namespace crypto { +namespace nearby::crypto { namespace { using ::absl::StatusCode; @@ -211,4 +211,4 @@ TEST(Ed25519SignerVerifierTest, NewKeypairFromRandomSeedRoundtrip) { } } // namespace -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/BUILD b/internal/crypto_cros/BUILD index 7083f705..86029b3b 100644 --- a/internal/crypto_cros/BUILD +++ b/internal/crypto_cros/BUILD @@ -39,7 +39,6 @@ cc_library( "hmac.cc", "nearby_base.cc", "openssl_util.cc", - "random.cc", "rsa_private_key.cc", "secure_hash.cc", "secure_util.cc", @@ -58,7 +57,6 @@ cc_library( "hmac.h", "nearby_base.h", "openssl_util.h", - "random.h", "rsa_private_key.h", "secure_hash.h", "secure_util.h", @@ -93,7 +91,6 @@ cc_test( "ec_signature_creator_unittest.cc", "encryptor_unittest.cc", "hmac_unittest.cc", - "random_unittest.cc", "rsa_private_key_unittest.cc", "secure_hash_unittest.cc", "sha2_unittest.cc", diff --git a/internal/crypto_cros/aead.cc b/internal/crypto_cros/aead.cc index 7e0868f9..f25699ee 100644 --- a/internal/crypto_cros/aead.cc +++ b/internal/crypto_cros/aead.cc @@ -32,10 +32,9 @@ #include "absl/types/span.h" #include "internal/crypto_cros/nearby_base.h" #include "internal/crypto_cros/openssl_util.h" -#include -#include +#include -namespace crypto { +namespace nearby::crypto { Aead::Aead(AeadAlgorithm algorithm) { EnsureOpenSSLInit(); @@ -187,4 +186,4 @@ bool Aead::Open(absl::Span plaintext, return true; } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/aead.h b/internal/crypto_cros/aead.h index fca3ac91..6ed16bbd 100644 --- a/internal/crypto_cros/aead.h +++ b/internal/crypto_cros/aead.h @@ -26,10 +26,9 @@ #include "absl/types/optional.h" #include "absl/types/span.h" #include "internal/crypto_cros/crypto_export.h" +#include -struct evp_aead_st; - -namespace crypto { +namespace nearby::crypto { // This class exposes the AES-128-CTR-HMAC-SHA256 and AES_256_GCM AEAD. Note // that there are two versions of most methods: an historical version based @@ -87,9 +86,9 @@ class CRYPTO_EXPORT Aead { size_t* output_length, size_t max_output_length) const; absl::optional> key_; - const evp_aead_st* aead_; + const EVP_AEAD* aead_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_AEAD_H_ diff --git a/internal/crypto_cros/aead_unittest.cc b/internal/crypto_cros/aead_unittest.cc index 9474eb33..df1c4750 100644 --- a/internal/crypto_cros/aead_unittest.cc +++ b/internal/crypto_cros/aead_unittest.cc @@ -20,6 +20,7 @@ #include "gtest/gtest.h" +namespace nearby { namespace { const crypto::Aead::AeadAlgorithm kAllAlgorithms[]{ @@ -98,3 +99,4 @@ TEST_P(AeadTest, SealOpenWrongKey) { } } // namespace +} // namespace nearby diff --git a/internal/crypto_cros/ec_private_key.cc b/internal/crypto_cros/ec_private_key.cc index 3e937c2a..14af7a8f 100644 --- a/internal/crypto_cros/ec_private_key.cc +++ b/internal/crypto_cros/ec_private_key.cc @@ -40,7 +40,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { ECPrivateKey::~ECPrivateKey() = default; @@ -186,4 +186,4 @@ bool ECPrivateKey::ExportRawPublicKey(std::string* output) const { ECPrivateKey::ECPrivateKey() = default; -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/ec_private_key.h b/internal/crypto_cros/ec_private_key.h index 9b1dd1b9..fd4e9efa 100644 --- a/internal/crypto_cros/ec_private_key.h +++ b/internal/crypto_cros/ec_private_key.h @@ -26,7 +26,7 @@ #include "internal/crypto_cros/crypto_export.h" #include -namespace crypto { +namespace nearby::crypto { // Encapsulates an elliptic curve (EC) private key. Can be used to generate new // keys, export keys to other formats, or to extract a public key. @@ -91,6 +91,6 @@ class CRYPTO_EXPORT ECPrivateKey { bssl::UniquePtr key_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_EC_PRIVATE_KEY_H_ diff --git a/internal/crypto_cros/ec_private_key_unittest.cc b/internal/crypto_cros/ec_private_key_unittest.cc index 43c6dcbb..e1ff8f94 100644 --- a/internal/crypto_cros/ec_private_key_unittest.cc +++ b/internal/crypto_cros/ec_private_key_unittest.cc @@ -23,6 +23,7 @@ #include "gtest/gtest.h" +namespace nearby { namespace { void ExpectKeysEqual(const crypto::ECPrivateKey* keypair1, @@ -331,3 +332,5 @@ TEST(ECPrivateKeyUnitTest, LoadOldOpenSSLKeyTest) { EXPECT_TRUE(keypair_openssl); } + +} // namespace nearby diff --git a/internal/crypto_cros/ec_signature_creator.cc b/internal/crypto_cros/ec_signature_creator.cc index dcf41083..75b89661 100644 --- a/internal/crypto_cros/ec_signature_creator.cc +++ b/internal/crypto_cros/ec_signature_creator.cc @@ -18,7 +18,7 @@ #include "internal/crypto_cros/ec_signature_creator_impl.h" -namespace crypto { +namespace nearby::crypto { // static std::unique_ptr ECSignatureCreator::Create( @@ -26,4 +26,4 @@ std::unique_ptr ECSignatureCreator::Create( return std::make_unique(key); } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/ec_signature_creator.h b/internal/crypto_cros/ec_signature_creator.h index f0dfd790..90b738e5 100644 --- a/internal/crypto_cros/ec_signature_creator.h +++ b/internal/crypto_cros/ec_signature_creator.h @@ -24,7 +24,7 @@ #include "absl/types/span.h" #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { class ECPrivateKey; class ECSignatureCreator; @@ -60,6 +60,6 @@ class CRYPTO_EXPORT ECSignatureCreator { std::vector* out_raw_sig) = 0; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_EC_SIGNATURE_CREATOR_H_ diff --git a/internal/crypto_cros/ec_signature_creator_impl.cc b/internal/crypto_cros/ec_signature_creator_impl.cc index a7b20a88..ad904191 100644 --- a/internal/crypto_cros/ec_signature_creator_impl.cc +++ b/internal/crypto_cros/ec_signature_creator_impl.cc @@ -27,7 +27,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) : key_(key) { EnsureOpenSSLInit(); @@ -80,4 +80,4 @@ bool ECSignatureCreatorImpl::DecodeSignature( return true; } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/ec_signature_creator_impl.h b/internal/crypto_cros/ec_signature_creator_impl.h index 8024bbc8..79b66dd5 100644 --- a/internal/crypto_cros/ec_signature_creator_impl.h +++ b/internal/crypto_cros/ec_signature_creator_impl.h @@ -22,7 +22,7 @@ #include "absl/types/span.h" #include "internal/crypto_cros/ec_signature_creator.h" -namespace crypto { +namespace nearby::crypto { class ECSignatureCreatorImpl : public ECSignatureCreator { public: @@ -43,6 +43,6 @@ class ECSignatureCreatorImpl : public ECSignatureCreator { ECPrivateKey* key_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_EC_SIGNATURE_CREATOR_IMPL_H_ diff --git a/internal/crypto_cros/ec_signature_creator_unittest.cc b/internal/crypto_cros/ec_signature_creator_unittest.cc index 753f4e73..48ea4c5b 100644 --- a/internal/crypto_cros/ec_signature_creator_unittest.cc +++ b/internal/crypto_cros/ec_signature_creator_unittest.cc @@ -26,6 +26,8 @@ #include "internal/crypto_cros/nearby_base.h" #include "internal/crypto_cros/signature_verifier.h" +namespace nearby { + TEST(ECSignatureCreatorTest, BasicTest) { // Do a verify round trip. std::unique_ptr key_original( @@ -59,3 +61,5 @@ TEST(ECSignatureCreatorTest, BasicTest) { verifier.VerifyUpdate(nearbybase::as_bytes(absl::MakeSpan(data))); ASSERT_TRUE(verifier.VerifyFinal()); } + +} // namespace nearby diff --git a/internal/crypto_cros/encryptor.cc b/internal/crypto_cros/encryptor.cc index b901ea96..2eaede2c 100644 --- a/internal/crypto_cros/encryptor.cc +++ b/internal/crypto_cros/encryptor.cc @@ -28,11 +28,9 @@ #include "internal/platform/logging.h" #else #include "absl/log/check.h" // nogncheck -#endif - -#ifndef NEARBY_SWIFTPM #include "absl/log/log.h" // nogncheck #endif + #include "absl/strings/string_view.h" #include "absl/types/span.h" #include "internal/crypto_cros/nearby_base.h" @@ -41,7 +39,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { namespace { @@ -225,4 +223,4 @@ absl::optional Encryptor::CryptCTR(bool do_encrypt, return input.size(); } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/encryptor.h b/internal/crypto_cros/encryptor.h index ce100d5c..6fe5c877 100644 --- a/internal/crypto_cros/encryptor.h +++ b/internal/crypto_cros/encryptor.h @@ -28,7 +28,7 @@ #include "absl/types/span.h" #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { class SymmetricKey; @@ -105,6 +105,6 @@ class CRYPTO_EXPORT Encryptor { std::vector iv_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_ENCRYPTOR_H_ diff --git a/internal/crypto_cros/encryptor_unittest.cc b/internal/crypto_cros/encryptor_unittest.cc index 207911c0..dff9cd00 100644 --- a/internal/crypto_cros/encryptor_unittest.cc +++ b/internal/crypto_cros/encryptor_unittest.cc @@ -27,6 +27,8 @@ #include "internal/crypto_cros/nearby_base.h" #include "internal/crypto_cros/symmetric_key.h" +namespace nearby { + TEST(EncryptorTest, EncryptDecrypt) { std::unique_ptr key( crypto::SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2( @@ -570,3 +572,5 @@ TEST(EncryptorTest, CipherTextNotMultipleOfBlockSize) { EXPECT_FALSE( encryptor.Decrypt(absl::string_view(ciphertext.get(), 1), &plaintext)); } + +} // namespace nearby diff --git a/internal/crypto_cros/hkdf.cc b/internal/crypto_cros/hkdf.cc index 1e50ea6d..781e2476 100644 --- a/internal/crypto_cros/hkdf.cc +++ b/internal/crypto_cros/hkdf.cc @@ -34,7 +34,7 @@ #include "internal/crypto_cros/hmac.h" #include -namespace crypto { +namespace nearby::crypto { std::string HkdfSha256(absl::string_view secret, absl::string_view salt, absl::string_view info, size_t derived_key_size) { @@ -62,4 +62,4 @@ std::vector HkdfSha256(absl::Span secret, return ret; } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/hkdf.h b/internal/crypto_cros/hkdf.h index 31740218..9ee35570 100644 --- a/internal/crypto_cros/hkdf.h +++ b/internal/crypto_cros/hkdf.h @@ -24,7 +24,7 @@ #include "absl/types/span.h" #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { CRYPTO_EXPORT std::string HkdfSha256(absl::string_view secret, absl::string_view salt, @@ -36,6 +36,6 @@ std::vector HkdfSha256(absl::Span secret, absl::Span info, size_t derived_key_size); -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_HKDF_H_ diff --git a/internal/crypto_cros/hmac.cc b/internal/crypto_cros/hmac.cc index 78d6f998..94bf37b5 100644 --- a/internal/crypto_cros/hmac.cc +++ b/internal/crypto_cros/hmac.cc @@ -33,7 +33,7 @@ #include "internal/crypto_cros/secure_util.h" #include "internal/crypto_cros/symmetric_key.h" -namespace crypto { +namespace nearby::crypto { HMAC::HMAC(HashAlgorithm hash_alg) : hash_alg_(hash_alg), initialized_(false) { // Only SHA-1 and SHA-256 hash algorithms are supported now. @@ -118,4 +118,4 @@ bool HMAC::VerifyTruncated(absl::Span data, return SecureMemEqual(digest.data(), computed_digest, digest.size()); } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/hmac.h b/internal/crypto_cros/hmac.h index 12c806ba..f2d46cbd 100644 --- a/internal/crypto_cros/hmac.h +++ b/internal/crypto_cros/hmac.h @@ -31,7 +31,7 @@ #include "internal/crypto_cros/crypto_export.h" #include "internal/crypto_cros/nearby_base.h" -namespace crypto { +namespace nearby::crypto { // Simplify the interface and reduce includes by abstracting out the internals. class SymmetricKey; @@ -120,6 +120,6 @@ class CRYPTO_EXPORT HMAC { std::vector key_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_HMAC_H_ diff --git a/internal/crypto_cros/hmac_unittest.cc b/internal/crypto_cros/hmac_unittest.cc index 5676f3be..8faf0b07 100644 --- a/internal/crypto_cros/hmac_unittest.cc +++ b/internal/crypto_cros/hmac_unittest.cc @@ -26,6 +26,8 @@ #include "absl/strings/string_view.h" #include "absl/types/span.h" +namespace nearby { + static const size_t kSHA1DigestSize = 20; static const size_t kSHA256DigestSize = 32; @@ -376,3 +378,5 @@ TEST(HMACTest, Bytes) { EXPECT_FALSE(hmac.VerifyTruncated( data, absl::MakeSpan(calculated_hmac, kSHA256DigestSize / 2))); } + +} // namespace nearby diff --git a/internal/crypto_cros/openssl_util.cc b/internal/crypto_cros/openssl_util.cc index ac7b62e1..c533f287 100644 --- a/internal/crypto_cros/openssl_util.cc +++ b/internal/crypto_cros/openssl_util.cc @@ -30,7 +30,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { void EnsureOpenSSLInit() { // CRYPTO_library_init may be safely called concurrently. @@ -41,4 +41,4 @@ void ClearOpenSSLERRStack() { ERR_clear_error(); } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/openssl_util.h b/internal/crypto_cros/openssl_util.h index 07bbe8dc..58ab000c 100644 --- a/internal/crypto_cros/openssl_util.h +++ b/internal/crypto_cros/openssl_util.h @@ -20,7 +20,7 @@ #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { // Provides a buffer of at least MIN_SIZE bytes, for use when calling OpenSSL's // SHA256, HMAC, etc functions, adapting the buffer sizing rules to meet those @@ -98,6 +98,6 @@ class OpenSSLErrStackTracer { ~OpenSSLErrStackTracer() { ClearOpenSSLERRStack(); } }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_OPENSSL_UTIL_H_ diff --git a/internal/crypto_cros/random.h b/internal/crypto_cros/random.h deleted file mode 100644 index 86f247a3..00000000 --- a/internal/crypto_cros/random.h +++ /dev/null @@ -1,42 +0,0 @@ -// 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. - -//*** WARNING!!! Do not add more functions and Data types to this file. *** -// This file needs to be in sync with: -// https://source.chromium.org/chromium/chromium/src/+/main:crypto/random.h - -#ifndef THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_RANDOM_H_ -#define THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_RANDOM_H_ - -#include - -#include -#include - -#include "absl/types/span.h" -#include "internal/crypto_cros/crypto_export.h" - -namespace crypto { - -// Fills the given buffer with |length| random bytes of cryptographically -// secure random numbers. -// |length| must be positive. -CRYPTO_EXPORT void RandBytes(void *bytes, size_t length); - -// Fills |bytes| with cryptographically-secure random bits. -CRYPTO_EXPORT void RandBytes(absl::Span bytes); - -} // namespace crypto - -#endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_RANDOM_H_ diff --git a/internal/crypto_cros/random_unittest.cc b/internal/crypto_cros/random_unittest.cc deleted file mode 100644 index 201518f5..00000000 --- a/internal/crypto_cros/random_unittest.cc +++ /dev/null @@ -1,68 +0,0 @@ -// 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. - -#include "internal/crypto_cros/random.h" - -#include - -#include - -#include "gtest/gtest.h" -#include "internal/crypto_cros/nearby_base.h" -#include "internal/platform/implementation/crypto.h" - -// Basic functionality tests. Does NOT test the security of the random data. - -namespace crypto { -namespace { - -// Ensures we don't have all trivial data, i.e. that the data is indeed random. -// Currently, that means the bytes cannot be all the same (e.g. all zeros). -bool IsTrivial(const std::string& bytes) { - for (size_t i = 0; i < bytes.size(); i++) { - if (bytes[i] != bytes[0]) { - return false; - } - } - return true; -} - -TEST(RandBytes, RandBytes) { - std::string bytes(16, '\0'); - RandBytes(nearbybase::WriteInto(&bytes, bytes.size()), bytes.size()); - EXPECT_TRUE(!IsTrivial(bytes)); -} - -TEST(RandBytes, RandomString) { - constexpr size_t kSize = 30; - - std::string bytes(kSize, 0); - RandBytes(const_cast(bytes.data()), bytes.size()); - - EXPECT_EQ(bytes.size(), kSize); - EXPECT_TRUE(!IsTrivial(bytes)); -} - -TEST(RandBytes, RandData) { - uint64_t x = nearby::RandData(); - uint64_t y = nearby::RandData(); - - // Once in a billion years, consecutively generated random numbers will be - // the same and the test will fail. - EXPECT_NE(x, y); - EXPECT_NE(x >> 32, x & 0xFFFFFFFF); -} - -} // namespace -} // namespace crypto diff --git a/internal/crypto_cros/rsa_private_key.cc b/internal/crypto_cros/rsa_private_key.cc index b275954e..da217146 100644 --- a/internal/crypto_cros/rsa_private_key.cc +++ b/internal/crypto_cros/rsa_private_key.cc @@ -36,7 +36,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { // static std::unique_ptr RSAPrivateKey::Create(uint16_t num_bits) { @@ -126,4 +126,4 @@ bool RSAPrivateKey::ExportPublicKey(std::vector* output) const { return true; } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/rsa_private_key.h b/internal/crypto_cros/rsa_private_key.h index 5aaeb59b..be52bdf1 100644 --- a/internal/crypto_cros/rsa_private_key.h +++ b/internal/crypto_cros/rsa_private_key.h @@ -25,7 +25,7 @@ #include "internal/crypto_cros/crypto_export.h" #include -namespace crypto { +namespace nearby::crypto { // Encapsulates an RSA private key. Can be used to generate new keys, export // keys to other formats, or to extract a public key. @@ -69,6 +69,6 @@ class CRYPTO_EXPORT RSAPrivateKey { bssl::UniquePtr key_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_RSA_PRIVATE_KEY_H_ diff --git a/internal/crypto_cros/rsa_private_key_unittest.cc b/internal/crypto_cros/rsa_private_key_unittest.cc index e5202b03..de7988a6 100644 --- a/internal/crypto_cros/rsa_private_key_unittest.cc +++ b/internal/crypto_cros/rsa_private_key_unittest.cc @@ -21,6 +21,7 @@ #include "gtest/gtest.h" +namespace nearby { namespace { const uint8_t kTestPrivateKeyInfo[] = { @@ -364,7 +365,7 @@ TEST(RSAPrivateKeyUnitTest, ShortIntegers) { TEST(RSAPrivateKeyUnitTest, CreateFromKeyTest) { std::unique_ptr key_pair( - crypto::RSAPrivateKey::Create(512)); + crypto::RSAPrivateKey::Create(2048)); ASSERT_TRUE(key_pair.get()); std::unique_ptr key_copy( @@ -384,3 +385,5 @@ TEST(RSAPrivateKeyUnitTest, CreateFromKeyTest) { ASSERT_EQ(privkey, privkey_copy); ASSERT_EQ(pubkey, pubkey_copy); } + +} // namespace nearby diff --git a/internal/crypto_cros/secure_hash.cc b/internal/crypto_cros/secure_hash.cc index bf19c338..09e55808 100644 --- a/internal/crypto_cros/secure_hash.cc +++ b/internal/crypto_cros/secure_hash.cc @@ -22,7 +22,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { namespace { @@ -73,4 +73,4 @@ std::unique_ptr SecureHash::Create(Algorithm algorithm) { } } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/secure_hash.h b/internal/crypto_cros/secure_hash.h index 1f5ec9e1..34bd0164 100644 --- a/internal/crypto_cros/secure_hash.h +++ b/internal/crypto_cros/secure_hash.h @@ -21,7 +21,7 @@ #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { // A wrapper to calculate secure hashes incrementally, allowing to // be used when the full input is not known in advance. The end result will the @@ -52,6 +52,6 @@ class CRYPTO_EXPORT SecureHash { SecureHash() {} }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_SECURE_HASH_H_ diff --git a/internal/crypto_cros/secure_hash_unittest.cc b/internal/crypto_cros/secure_hash_unittest.cc index ea6a55b5..bcdb012e 100644 --- a/internal/crypto_cros/secure_hash_unittest.cc +++ b/internal/crypto_cros/secure_hash_unittest.cc @@ -23,6 +23,8 @@ #include "gtest/gtest.h" #include "internal/crypto_cros/sha2.h" +namespace nearby { + TEST(SecureHashTest, TestUpdate) { // Example B.3 from FIPS 180-2: long message. std::string input3(500000, 'a'); // 'a' repeated half a million times @@ -115,3 +117,5 @@ TEST(SecureHashTest, Equality) { // The hash should be the same. EXPECT_EQ(0, memcmp(output1, output2, crypto::kSHA256Length)); } + +} // namespace nearby diff --git a/internal/crypto_cros/secure_util.cc b/internal/crypto_cros/secure_util.cc index a026810e..89842539 100644 --- a/internal/crypto_cros/secure_util.cc +++ b/internal/crypto_cros/secure_util.cc @@ -16,10 +16,10 @@ #include -namespace crypto { +namespace nearby::crypto { bool SecureMemEqual(const void* s1, const void* s2, size_t n) { return CRYPTO_memcmp(s1, s2, n) == 0; } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/secure_util.h b/internal/crypto_cros/secure_util.h index 64322eca..ae7eae15 100644 --- a/internal/crypto_cros/secure_util.h +++ b/internal/crypto_cros/secure_util.h @@ -19,7 +19,7 @@ #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { // Performs a constant-time comparison of two strings, returning true if the // strings are equal. @@ -33,6 +33,6 @@ namespace crypto { // http://groups.google.com/group/keyczar-discuss/browse_thread/thread/5571eca0948b2a13 CRYPTO_EXPORT bool SecureMemEqual(const void* s1, const void* s2, size_t n); -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_SECURE_UTIL_H_ diff --git a/internal/crypto_cros/sha2.cc b/internal/crypto_cros/sha2.cc index 77407f2b..1932376c 100644 --- a/internal/crypto_cros/sha2.cc +++ b/internal/crypto_cros/sha2.cc @@ -24,7 +24,7 @@ #include "internal/crypto_cros/secure_hash.h" #include -namespace crypto { +namespace nearby::crypto { std::array SHA256Hash(absl::Span input) { std::array digest; @@ -44,4 +44,4 @@ std::string SHA256HashString(absl::string_view str) { return output; } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/sha2.h b/internal/crypto_cros/sha2.h index ca9e7fb8..d06ebf8a 100644 --- a/internal/crypto_cros/sha2.h +++ b/internal/crypto_cros/sha2.h @@ -25,7 +25,7 @@ #include "absl/types/span.h" #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { // These functions perform SHA-256 operations. // @@ -47,6 +47,6 @@ CRYPTO_EXPORT std::string SHA256HashString(absl::string_view str); CRYPTO_EXPORT void SHA256HashString(absl::string_view str, void* output, size_t len); -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_SHA2_H_ diff --git a/internal/crypto_cros/sha2_unittest.cc b/internal/crypto_cros/sha2_unittest.cc index 65c869ae..2dec9a62 100644 --- a/internal/crypto_cros/sha2_unittest.cc +++ b/internal/crypto_cros/sha2_unittest.cc @@ -21,6 +21,8 @@ #include "gtest/gtest.h" +namespace nearby { + TEST(Sha256Test, Test1) { // Example B.1 from FIPS 180-2: one-block message. std::string input1 = "abc"; @@ -96,3 +98,5 @@ TEST(Sha256Test, Test3) { for (size_t i = 0; i < sizeof(output_truncated3); i++) EXPECT_EQ(expected3[i], static_cast(output_truncated3[i])); } + +} // namespace nearby diff --git a/internal/crypto_cros/signature_verifier.cc b/internal/crypto_cros/signature_verifier.cc index 01cbe278..31899499 100644 --- a/internal/crypto_cros/signature_verifier.cc +++ b/internal/crypto_cros/signature_verifier.cc @@ -30,7 +30,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { struct SignatureVerifier::VerifyContext { bssl::ScopedEVP_MD_CTX ctx; @@ -119,4 +119,4 @@ void SignatureVerifier::Reset() { signature_.clear(); } -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/signature_verifier.h b/internal/crypto_cros/signature_verifier.h index 6ce8af2f..eff0083b 100644 --- a/internal/crypto_cros/signature_verifier.h +++ b/internal/crypto_cros/signature_verifier.h @@ -23,7 +23,7 @@ #include "absl/types/span.h" #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { // The SignatureVerifier class verifies a signature using a bare public key // (as opposed to a certificate). @@ -76,6 +76,6 @@ class CRYPTO_EXPORT SignatureVerifier { std::unique_ptr verify_context_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_SIGNATURE_VERIFIER_H_ diff --git a/internal/crypto_cros/signature_verifier_unittest.cc b/internal/crypto_cros/signature_verifier_unittest.cc index c6f7bd82..09f4f8f9 100644 --- a/internal/crypto_cros/signature_verifier_unittest.cc +++ b/internal/crypto_cros/signature_verifier_unittest.cc @@ -23,6 +23,8 @@ #include "gtest/gtest.h" #include "absl/types/span.h" +namespace nearby { + TEST(SignatureVerifierTest, BasicTest) { // The input data in this test comes from real certificates. // @@ -422,3 +424,5 @@ TEST(SignatureVerifierTest, VerifyRSAPSS) { verifier.VerifyUpdate(kPSSMessage); EXPECT_FALSE(verifier.VerifyFinal()); } + +} // namespace nearby diff --git a/internal/crypto_cros/symmetric_key.cc b/internal/crypto_cros/symmetric_key.cc index 06178d1e..e69d56ce 100644 --- a/internal/crypto_cros/symmetric_key.cc +++ b/internal/crypto_cros/symmetric_key.cc @@ -35,7 +35,7 @@ #include #include -namespace crypto { +namespace nearby::crypto { namespace { @@ -144,4 +144,4 @@ std::unique_ptr SymmetricKey::Import(Algorithm algorithm, SymmetricKey::SymmetricKey() = default; -} // namespace crypto +} // namespace nearby::crypto diff --git a/internal/crypto_cros/symmetric_key.h b/internal/crypto_cros/symmetric_key.h index cdcc2d8a..e86ed97e 100644 --- a/internal/crypto_cros/symmetric_key.h +++ b/internal/crypto_cros/symmetric_key.h @@ -22,7 +22,7 @@ #include "internal/crypto_cros/crypto_export.h" -namespace crypto { +namespace nearby::crypto { // Wraps a platform-specific symmetric key and allows it to be held in a // scoped_ptr. @@ -84,6 +84,6 @@ class CRYPTO_EXPORT SymmetricKey { std::string key_; }; -} // namespace crypto +} // namespace nearby::crypto #endif // THIRD_PARTY_NEARBY_INTERNAL_CRYPTO_SYMMETRIC_KEY_H_ diff --git a/internal/crypto_cros/symmetric_key_unittest.cc b/internal/crypto_cros/symmetric_key_unittest.cc index ad3e684d..71fe8649 100644 --- a/internal/crypto_cros/symmetric_key_unittest.cc +++ b/internal/crypto_cros/symmetric_key_unittest.cc @@ -21,6 +21,8 @@ #include "absl/strings/ascii.h" #include "internal/crypto_cros/nearby_base.h" +namespace nearby { + TEST(SymmetricKeyTest, GenerateRandomKey) { std::unique_ptr key( crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES, 256)); @@ -260,3 +262,5 @@ INSTANTIATE_TEST_SUITE_P(All, SymmetricKeyDeriveKeyFromPasswordUsingPbkdf2Test, INSTANTIATE_TEST_SUITE_P(All, SymmetricKeyDeriveKeyFromPasswordUsingScryptTest, testing::ValuesIn(kTestVectorsScrypt)); + +} // namespace nearby diff --git a/internal/data/BUILD b/internal/data/BUILD index 8628ea53..9eb465ac 100644 --- a/internal/data/BUILD +++ b/internal/data/BUILD @@ -1,4 +1,19 @@ +# Copyright 2023 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. + load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") licenses(["notice"]) @@ -9,20 +24,19 @@ package(default_visibility = [ cc_library( name = "data_manager", hdrs = [ - "data_manager.h", "data_set.h", "leveldb_data_set.h", - "memory_data_set.h", ], deps = [ "//internal/platform:types", "//third_party/leveldb:db", "//third_party/leveldb:table", "//third_party/leveldb:util", - "//third_party/protobuf:protobuf_lite", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", + "@com_google_protobuf//:protobuf_lite", ], ) @@ -42,7 +56,6 @@ cc_test( timeout = "short", srcs = [ "leveldb_data_set_test.cc", - "memory_data_set_test.cc", ], shard_count = 8, deps = [ diff --git a/internal/data/data_manager.h b/internal/data/data_manager.h deleted file mode 100644 index 3f42f456..00000000 --- a/internal/data/data_manager.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2022 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_INTERNAL_DATA_DATA_MANAGER_H_ -#define THIRD_PARTY_NEARBY_INTERNAL_DATA_DATA_MANAGER_H_ - -#include - -#include "absl/strings/string_view.h" -#include "internal/data/data_set.h" -#include "internal/data/leveldb_data_set.h" -#include "internal/data/memory_data_set.h" - -namespace nearby { -namespace data { - -class DataManager { - public: - enum class DataStorageType : int { kMemory = 0, kLevelDb = 1 }; - explicit DataManager(DataStorageType data_storage_type) - : data_storage_type_(data_storage_type) {} - ~DataManager() = default; - - template - std::unique_ptr> GetDataSet(absl::string_view path) { - if (data_storage_type_ == DataStorageType::kMemory) { - return std::make_unique>(path); - } else if (data_storage_type_ == DataStorageType::kLevelDb) { - return std::make_unique>(path); - } else { - return nullptr; - } - } - - private: - DataStorageType data_storage_type_; -}; - -} // namespace data -} // namespace nearby - -#endif // THIRD_PARTY_NEARBY_INTERNAL_DATA_DATA_MANAGER_H_ diff --git a/internal/data/data_set.h b/internal/data/data_set.h index c87492a4..65ce127d 100644 --- a/internal/data/data_set.h +++ b/internal/data/data_set.h @@ -15,12 +15,13 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_DATA_DATA_SET_H_ #define THIRD_PARTY_NEARBY_INTERNAL_DATA_DATA_SET_H_ -#include #include #include #include #include +#include "absl/functional/any_invocable.h" + namespace nearby { namespace data { @@ -43,12 +44,13 @@ class DataSet { // Asynchronously initializes the object, which must have been created by the // DataManager::GetDataSet function. |callback| will be invoked on the // calling thread when complete. - virtual void Initialize(std::function callback) = 0; + virtual void Initialize(absl::AnyInvocable callback) = 0; // Asynchronously loads all entries from the database and invokes |callback| // when complete. virtual void LoadEntries( - std::function>)> callback) = 0; + absl::AnyInvocable>) &&> + callback) = 0; // Asynchronously saves |entries_to_save| and deletes entries from // |keys_to_remove| from the database. |callback| will be invoked on the @@ -57,11 +59,11 @@ class DataSet { virtual void UpdateEntries( std::unique_ptr entries_to_save, std::unique_ptr> keys_to_remove, - std::function callback) = 0; + absl::AnyInvocable callback) = 0; // Asynchronously destroys the database. Use this call only if the database // needs to be destroyed for this particular profile. - virtual void Destroy(std::function callback) = 0; + virtual void Destroy(absl::AnyInvocable callback) = 0; }; } // namespace data diff --git a/internal/data/leveldb_data_set.h b/internal/data/leveldb_data_set.h index c55a57bc..5a27efef 100644 --- a/internal/data/leveldb_data_set.h +++ b/internal/data/leveldb_data_set.h @@ -15,14 +15,13 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_DATA_LEVELDB_DATA_SET_H_ #define THIRD_PARTY_NEARBY_INTERNAL_DATA_LEVELDB_DATA_SET_H_ -#include #include -#include #include #include #include #include +#include "absl/functional/any_invocable.h" #include "absl/strings/string_view.h" #include "third_party/leveldb/include/db.h" #include "third_party/leveldb/include/iterator.h" @@ -31,7 +30,7 @@ #include "third_party/leveldb/include/status.h" #include "internal/data/data_set.h" #include "internal/platform/logging.h" -#include "third_party/protobuf/message_lite.h" +#include "google/protobuf/message_lite.h" namespace nearby { namespace data { @@ -47,17 +46,19 @@ class LeveldbDataSet : public DataSet { explicit LeveldbDataSet(absl::string_view path) : path_(path) {} ~LeveldbDataSet() override = default; - void Initialize(std::function callback) override; - void LoadEntries(std::function>)> - callback) override; + void Initialize(absl::AnyInvocable callback) override; + void LoadEntries( + absl::AnyInvocable>) &&> + callback) override; void LoadEntriesWithKeys( - std::function< - void(bool, std::unique_ptr>>)> + absl::AnyInvocable< + void(bool, + std::unique_ptr>>) &&> callback); void UpdateEntries(std::unique_ptr entries_to_save, std::unique_ptr> keys_to_remove, - std::function callback) override; - void Destroy(std::function callback) override; + absl::AnyInvocable callback) override; + void Destroy(absl::AnyInvocable callback) override; private: void Serialize(T const& value, std::string& str); @@ -73,7 +74,7 @@ template ::value, bool> isMessageLite> void LeveldbDataSet::Initialize( - std::function callback) { + absl::AnyInvocable callback) { leveldb::Options options; options.create_if_missing = true; @@ -99,7 +100,8 @@ template ::value, bool> isMessageLite> void LeveldbDataSet::LoadEntries( - std::function>)> callback) { + absl::AnyInvocable>) &&> + callback) { auto result = std::make_unique>(); if (status_ != InitStatus::kOK) { std::move(callback)(false, std::move(result)); @@ -130,8 +132,8 @@ template ::value, bool> isMessageLite> void LeveldbDataSet::LoadEntriesWithKeys( - std::function>>)> + absl::AnyInvocable< + void(bool, std::unique_ptr>>) &&> callback) { auto result = std::make_unique>>(); if (status_ != InitStatus::kOK) { @@ -165,7 +167,7 @@ template ::UpdateEntries( std::unique_ptr entries_to_save, std::unique_ptr> keys_to_remove, - std::function callback) { + absl::AnyInvocable callback) { NEARBY_LOGS(INFO) << "UpdateEntries is called."; if (status_ != InitStatus::kOK) { std::move(callback)(false); @@ -193,7 +195,7 @@ template ::value, bool> isMessageLite> void LeveldbDataSet::Destroy( - std::function callback) { + absl::AnyInvocable callback) { NEARBY_LOGS(INFO) << "Destroy is called."; db_.reset(); leveldb::DestroyDB(path_, leveldb::Options()); diff --git a/internal/data/memory_data_set.h b/internal/data/memory_data_set.h deleted file mode 100644 index 48074573..00000000 --- a/internal/data/memory_data_set.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2022 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_INTERNAL_DATA_MEMORY_DATA_SET_H_ -#define THIRD_PARTY_NEARBY_INTERNAL_DATA_MEMORY_DATA_SET_H_ - -#include -#include -#include -#include -#include - -#include "absl/container/flat_hash_map.h" -#include "absl/strings/string_view.h" -#include "absl/synchronization/mutex.h" -#include "internal/data/data_set.h" - -namespace nearby { -namespace data { - -template -class MemoryDataSet : public DataSet { - public: - using KeyEntryVector = std::vector>; - - explicit MemoryDataSet(absl::string_view path) : path_(path) {} - ~MemoryDataSet() override = default; - - void Initialize(std::function callback) override; - void LoadEntries(std::function>)> - callback) override; - void UpdateEntries(std::unique_ptr entries_to_save, - std::unique_ptr> keys_to_remove, - std::function callback) override; - void Destroy(std::function callback) override; - - private: - std::string path_; - - absl::Mutex mutex_; - absl::flat_hash_map entries_; -}; - -template -void MemoryDataSet::Initialize(std::function callback) { - std::move(callback)(InitStatus::kOK); -} - -template -void MemoryDataSet::LoadEntries( - std::function>)> callback) { - auto result = std::make_unique>(); - auto it = entries_.begin(); - while (it != entries_.end()) { - result->push_back(it->second); - ++it; - } - - std::move(callback)(true, std::move(result)); -} - -template -void MemoryDataSet::UpdateEntries( - std::unique_ptr entries_to_save, - std::unique_ptr> keys_to_remove, - std::function callback) { - if (entries_to_save != nullptr) { - auto it = entries_to_save->begin(); - while (it != entries_to_save->end()) { - entries_.emplace(it->first, it->second); - ++it; - } - } - - if (keys_to_remove != nullptr) { - auto it = keys_to_remove->begin(); - while (it != keys_to_remove->end()) { - entries_.erase(*it); - ++it; - } - } - - std::move(callback)(true); -} - -template -void MemoryDataSet::Destroy(std::function callback) { - entries_.clear(); - std::move(callback)(true); -} - -} // namespace data -} // namespace nearby - -#endif // THIRD_PARTY_NEARBY_INTERNAL_DATA_MEMORY_DATA_SET_H_ diff --git a/internal/data/memory_data_set_test.cc b/internal/data/memory_data_set_test.cc deleted file mode 100644 index e5e3a13d..00000000 --- a/internal/data/memory_data_set_test.cc +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 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. - -#include "internal/data/memory_data_set.h" - -#include -#include -#include -#include -#include - -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" -#include "gtest/gtest.h" - -namespace nearby { -namespace data { -namespace { - -TEST(MemoryDataSet, TestUpdateEntries) { - bool result = false; - MemoryDataSet string_set{""}; - - auto temp = MemoryDataSet::KeyEntryVector( - {{"id1", "string1"}, {"id2", "string2"}}); - - auto data = - std::make_unique::KeyEntryVector>(temp); - string_set.UpdateEntries(std::move(data), nullptr, - [&result](bool res) { result = res; }); - EXPECT_TRUE(result); -} - -TEST(MemoryDataSet, TestLoadEntries) { - std::vector result = {}; - MemoryDataSet string_set{""}; - - auto temp = MemoryDataSet::KeyEntryVector( - {{"id1", "string1"}, {"id2", "string2"}}); - auto data = - std::make_unique::KeyEntryVector>(temp); - - string_set.UpdateEntries(std::move(data), nullptr, [](bool ans) {}); - string_set.LoadEntries( - [&result](bool ans, std::unique_ptr> res) { - auto it = res->begin(); - while (it != res->end()) { - result.push_back(*it); - ++it; - } - }); - - EXPECT_THAT(result, testing::SizeIs(2)); - std::sort(result.begin(), result.end()); - EXPECT_EQ(result, std::vector({"string1", "string2"})); -} - -} // namespace -} // namespace data -} // namespace nearby diff --git a/internal/flags/BUILD b/internal/flags/BUILD index 0eb21889..ff551340 100644 --- a/internal/flags/BUILD +++ b/internal/flags/BUILD @@ -42,11 +42,13 @@ cc_library( ], visibility = [ "//:__subpackages__", + "//googlemac/iPhone/Shared/Identity/SmartSetup:__subpackages__", "//location/nearby/cpp:__subpackages__", + "//location/nearby/sharing/sdk:__subpackages__", + "//location/nearby/testing:__subpackages__", ], deps = [ ":flag_reader", - "//internal/platform:types", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", @@ -60,7 +62,6 @@ cc_test( deps = [ ":flag_reader", ":nearby_flags", - "//internal/platform/implementation/g3", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest", diff --git a/internal/flags/nearby_flags.cc b/internal/flags/nearby_flags.cc index 5348ed15..ebab8bfa 100644 --- a/internal/flags/nearby_flags.cc +++ b/internal/flags/nearby_flags.cc @@ -14,10 +14,13 @@ #include "internal/flags/nearby_flags.h" +#include #include -#include "internal/platform/mutex.h" -#include "internal/platform/mutex_lock.h" +#include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" +#include "internal/flags/flag.h" +#include "internal/flags/flag_reader.h" namespace nearby { @@ -27,7 +30,7 @@ NearbyFlags& NearbyFlags::GetInstance() { } bool NearbyFlags::GetBoolFlag(const flags::Flag& flag) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); const auto& it = overrided_bool_flag_values_.find(flag.name()); if (it != overrided_bool_flag_values_.end()) { @@ -41,7 +44,7 @@ bool NearbyFlags::GetBoolFlag(const flags::Flag& flag) { } int64_t NearbyFlags::GetInt64Flag(const flags::Flag& flag) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); const auto& it = overrided_int64_flag_values_.find(flag.name()); if (it != overrided_int64_flag_values_.end()) { @@ -55,7 +58,7 @@ int64_t NearbyFlags::GetInt64Flag(const flags::Flag& flag) { } double NearbyFlags::GetDoubleFlag(const flags::Flag& flag) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); const auto& it = overrided_double_flag_values_.find(flag.name()); if (it != overrided_double_flag_values_.end()) { @@ -70,7 +73,7 @@ double NearbyFlags::GetDoubleFlag(const flags::Flag& flag) { std::string NearbyFlags::GetStringFlag( const flags::Flag& flag) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); const auto& it = overrided_string_flag_values_.find(flag.name()); if (it != overrided_string_flag_values_.end()) { @@ -84,36 +87,36 @@ std::string NearbyFlags::GetStringFlag( } void NearbyFlags::SetFlagReader(flags::FlagReader& flag_reader) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); flag_reader_ = &flag_reader; } void NearbyFlags::OverrideBoolFlagValue(const flags::Flag& flag, bool new_value) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); overrided_bool_flag_values_[flag.name()] = new_value; } void NearbyFlags::OverrideInt64FlagValue(const flags::Flag& flag, int64_t new_value) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); overrided_int64_flag_values_[flag.name()] = new_value; } void NearbyFlags::OverrideDoubleFlagValue(const flags::Flag& flag, double new_value) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); overrided_double_flag_values_[flag.name()] = new_value; } void NearbyFlags::OverrideStringFlagValue( const flags::Flag& flag, absl::string_view new_value) { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); overrided_string_flag_values_[flag.name()] = std::string(new_value); } void NearbyFlags::ResetOverridedValues() { - MutexLock lock(&mutex_); + absl::MutexLock lock(&mutex_); overrided_bool_flag_values_.clear(); overrided_int64_flag_values_.clear(); overrided_double_flag_values_.clear(); diff --git a/internal/flags/nearby_flags.h b/internal/flags/nearby_flags.h index c8f5c1f2..28fe80ba 100644 --- a/internal/flags/nearby_flags.h +++ b/internal/flags/nearby_flags.h @@ -15,13 +15,16 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_FLAGS_NEARBY_FLAGS_H_ #define THIRD_PARTY_NEARBY_INTERNAL_FLAGS_NEARBY_FLAGS_H_ +#include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" #include "internal/flags/default_flag_reader.h" +#include "internal/flags/flag.h" #include "internal/flags/flag_reader.h" -#include "internal/platform/mutex.h" namespace nearby { @@ -65,7 +68,7 @@ class NearbyFlags final : public nearby::flags::FlagReader { absl::string_view new_value) ABSL_LOCKS_EXCLUDED(mutex_); - // Reset all overrided values. + // Reset all overridden values. void ResetOverridedValues() ABSL_LOCKS_EXCLUDED(mutex_); private: @@ -74,7 +77,7 @@ class NearbyFlags final : public nearby::flags::FlagReader { flags::FlagReader* flag_reader_ = nullptr; flags::DefaultFlagReader default_flag_reader_; - mutable Mutex mutex_; + mutable absl::Mutex mutex_; absl::flat_hash_map overrided_bool_flag_values_ ABSL_GUARDED_BY(mutex_); diff --git a/internal/interop/BUILD b/internal/interop/BUILD index 9abb983b..53a1cc16 100644 --- a/internal/interop/BUILD +++ b/internal/interop/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + cc_library( name = "authentication_transport_interface", hdrs = [ @@ -22,6 +36,7 @@ cc_library( "//presence:__subpackages__", ], deps = [ + ":authentication_status", ":authentication_transport_interface", "//internal/platform:connection_info", "//internal/platform:types", @@ -29,3 +44,36 @@ cc_library( "@com_google_absl//absl/types:variant", ], ) + +cc_library( + name = "authentication_status", + hdrs = [ + "authentication_status.h", + ], + visibility = [ + "//connections:__subpackages__", + "//presence:__subpackages__", + "//sharing:__subpackages__", + ], +) + +cc_library( + name = "test_support", + testonly = 1, + srcs = [ + "fake_device_provider.cc", + ], + hdrs = [ + "fake_device_provider.h", + ], + compatible_with = ["//buildenv/target:non_prod"], + visibility = [ + "//presence:__subpackages__", + ], + deps = [ + ":authentication_status", + ":authentication_transport_interface", + ":device", + "@com_google_absl//absl/strings:string_view", + ], +) diff --git a/internal/interop/authentication_status.h b/internal/interop/authentication_status.h new file mode 100644 index 00000000..fc1f9a16 --- /dev/null +++ b/internal/interop/authentication_status.h @@ -0,0 +1,28 @@ +// Copyright 2022 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_AUTHENTICATION_STATUS_H_ +#define THIRD_PARTY_NEARBY_CONNECTIONS_AUTHENTICATION_STATUS_H_ + +namespace nearby { + +enum class AuthenticationStatus { + kUnknown = 0, + kSuccess = 1, + kFailure = 2, +}; + +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_CONNECTIONS_AUTHENTICATION_STATUS_H_ diff --git a/internal/interop/device_provider.h b/internal/interop/device_provider.h index 380e5c0c..5e80ffd5 100644 --- a/internal/interop/device_provider.h +++ b/internal/interop/device_provider.h @@ -15,17 +15,12 @@ #ifndef THIRD_PARTY_NEARBY_CONNECTIONS_DEVICE_PROVIDER_H_ #define THIRD_PARTY_NEARBY_CONNECTIONS_DEVICE_PROVIDER_H_ +#include "internal/interop/authentication_status.h" #include "internal/interop/authentication_transport.h" #include "internal/interop/device.h" namespace nearby { -enum class AuthenticationStatus { - kUnknown = 0, - kSuccess = 1, - kFailure = 2, -}; - // The base device provider class for use with the Nearby Connections V3 APIs. // This class currently provides a function to get the local device for whatever // client implements it. diff --git a/internal/interop/fake_device_provider.cc b/internal/interop/fake_device_provider.cc new file mode 100644 index 00000000..9fddecfb --- /dev/null +++ b/internal/interop/fake_device_provider.cc @@ -0,0 +1,40 @@ +// Copyright 2024 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. + +#include "internal/interop/fake_device_provider.h" + +#include "absl/strings/string_view.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/authentication_transport.h" +#include "internal/interop/device.h" + +namespace nearby { + +FakeDeviceProvider::FakeDeviceProvider() = default; + +const NearbyDevice* FakeDeviceProvider::GetLocalDevice() { return nullptr; } + +AuthenticationStatus FakeDeviceProvider::AuthenticateAsInitiator( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const { + return AuthenticationStatus::kSuccess; +} + +AuthenticationStatus FakeDeviceProvider::AuthenticateAsResponder( + absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const { + return AuthenticationStatus::kSuccess; +} + +} // namespace nearby diff --git a/internal/interop/fake_device_provider.h b/internal/interop/fake_device_provider.h new file mode 100644 index 00000000..d9fa83a5 --- /dev/null +++ b/internal/interop/fake_device_provider.h @@ -0,0 +1,45 @@ +// Copyright 2024 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_PRESENCE_FAKE_DEVICE_PROVIDER_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_FAKE_DEVICE_PROVIDER_H_ + +#include "absl/strings/string_view.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/authentication_transport.h" +#include "internal/interop/device.h" +#include "internal/interop/device_provider.h" + +namespace nearby { + +class FakeDeviceProvider : public NearbyDeviceProvider { + public: + FakeDeviceProvider(); + FakeDeviceProvider(const FakeDeviceProvider&) = delete; + FakeDeviceProvider& operator=(const FakeDeviceProvider&) = delete; + + const NearbyDevice* GetLocalDevice() override; + + AuthenticationStatus AuthenticateAsInitiator( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const override; + + AuthenticationStatus AuthenticateAsResponder( + absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const override; +}; + +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_FAKE_DEVICE_PROVIDER_H_ diff --git a/internal/network/BUILD b/internal/network/BUILD index 9a1b24f5..564d85d7 100644 --- a/internal/network/BUILD +++ b/internal/network/BUILD @@ -1,21 +1,26 @@ +# Copyright 2022 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. + licenses(["notice"]) cc_library( - name = "types", + name = "url", srcs = [ - "http_request.cc", - "http_response.cc", - "http_status_code.cc", "url.cc", "utils.cc", ], hdrs = [ - "http_body.h", - "http_client.h", - "http_client_factory.h", - "http_request.h", - "http_response.h", - "http_status_code.h", "url.h", "utils.h", ], @@ -24,11 +29,43 @@ cc_library( "//internal:__pkg__", "//internal:__subpackages__", "//location/nearby/cpp/sharing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + ], +) + +cc_library( + name = "types", + srcs = [ + "http_request.cc", + "http_response.cc", + "http_status_code.cc", + ], + hdrs = [ + "http_body.h", + "http_client.h", + "http_client_factory.h", + "http_request.h", + "http_response.h", + "http_status_code.h", + ], + visibility = [ + "//fastpair:__subpackages__", + "//internal:__pkg__", + "//internal:__subpackages__", + "//location/nearby/cpp/sharing:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + ":url", "//internal/platform:types", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", @@ -50,19 +87,17 @@ cc_library( "//fastpair:__subpackages__", "//internal:__pkg__", "//internal:__subpackages__", - "//location/nearby/cpp/sharing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ ":types", "//internal/platform:types", - "//internal/platform/implementation:platform", + "//internal/platform/implementation:comm", "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/strings", ], ) @@ -82,9 +117,10 @@ cc_test( deps = [ ":nearby_http_client", ":types", + ":url", "//internal/platform/implementation:comm", "//internal/platform/implementation:platform", - "//internal/platform/implementation/g3", + "//internal/platform/implementation/g3", # fixdeps: keep "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/status", diff --git a/internal/network/http_client.h b/internal/network/http_client.h index 156ca091..4e2bbedc 100644 --- a/internal/network/http_client.h +++ b/internal/network/http_client.h @@ -15,12 +15,15 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_NETWORK_HTTP_CLIENT_H_ #define THIRD_PARTY_NEARBY_INTERNAL_NETWORK_HTTP_CLIENT_H_ -#include #include +#include "absl/base/thread_annotations.h" +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" #include "absl/status/statusor.h" #include "internal/network/http_request.h" #include "internal/network/http_response.h" +#include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" namespace nearby { @@ -60,12 +63,14 @@ class HttpClient { // Starts HTTP request in asynchronization mode. virtual void StartRequest( const HttpRequest& request, - std::function&)> callback) = 0; + absl::AnyInvocable&)> + callback) = 0; // Starts cancellable request in asynchronization mode. virtual void StartCancellableRequest( std::unique_ptr request, - std::function&)> callback) = 0; + absl::AnyInvocable&)> + callback) = 0; // Gets HTTP response in synchronization mode. virtual absl::StatusOr GetResponse( diff --git a/internal/network/http_client_impl.cc b/internal/network/http_client_impl.cc index 9a59c769..ff7c2ef1 100644 --- a/internal/network/http_client_impl.cc +++ b/internal/network/http_client_impl.cc @@ -14,14 +14,20 @@ #include "internal/network/http_client_impl.h" -#include #include #include #include #include +#include "absl/functional/any_invocable.h" #include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/str_cat.h" #include "internal/network/debug.h" +#include "internal/network/http_request.h" +#include "internal/network/http_response.h" +#include "internal/network/http_status_code.h" +#include "internal/platform/implementation/http_loader.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" #include "internal/platform/single_thread_executor.h" @@ -31,10 +37,10 @@ namespace network { void NearbyHttpClient::StartRequest( const HttpRequest& request, - std::function&)> callback) { + absl::AnyInvocable&)> callback) { MutexLock lock(&mutex_); executor_.Execute( - [request = std::move(request), callback = std::move(callback)]() { + [request = std::move(request), callback = std::move(callback)]() mutable { NEARBY_LOGS(INFO) << __func__ << ": Start async request to url=" << request.GetUrl().GetUrlPath(); absl::StatusOr response = InternalGetResponse(request); @@ -58,7 +64,7 @@ void NearbyHttpClient::StartRequest( void NearbyHttpClient::StartCancellableRequest( std::unique_ptr cancellable_request, - std::function&)> callback) { + absl::AnyInvocable&)> callback) { MutexLock lock(&mutex_); if (cancellable_request == nullptr) { NEARBY_LOGS(ERROR) << __func__ << ": invalid cancellable request."; @@ -68,7 +74,7 @@ void NearbyHttpClient::StartCancellableRequest( executor_ .Execute( [cancellable_request = std::move(cancellable_request), - callback = std::move(callback)]() { + callback = std::move(callback)]() mutable { NEARBY_LOGS(INFO) << __func__ << ": Start async request to url=" << cancellable_request->http_request().GetUrl().GetUrlPath(); @@ -149,7 +155,7 @@ absl::StatusOr NearbyHttpClient::InternalGetResponse( request_stream << std::endl; request_stream << "body size: " << request.GetBody().GetRawData().size() << std::endl; - NEARBY_LOGS(VERBOSE) << request_stream.str(); + NEARBY_VLOG(1) << request_stream.str(); } absl::StatusOr web_response = @@ -170,7 +176,7 @@ absl::StatusOr NearbyHttpClient::InternalGetResponse( } response_stream << std::endl; response_stream << "body size: " << web_response->body.size() << std::endl; - NEARBY_LOGS(VERBOSE) << response_stream.str(); + NEARBY_VLOG(1) << response_stream.str(); } HttpResponse response; diff --git a/internal/network/http_client_impl.h b/internal/network/http_client_impl.h index 904c6ced..f10f245b 100644 --- a/internal/network/http_client_impl.h +++ b/internal/network/http_client_impl.h @@ -37,13 +37,14 @@ class NearbyHttpClient : public HttpClient { NearbyHttpClient(NearbyHttpClient&&) = default; NearbyHttpClient& operator=(NearbyHttpClient&&) = default; - void StartRequest(const HttpRequest& request, - std::function&)> - callback) override ABSL_LOCKS_EXCLUDED(mutex_); + void StartRequest( + const HttpRequest& request, + absl::AnyInvocable&)> callback) + override ABSL_LOCKS_EXCLUDED(mutex_); void StartCancellableRequest( std::unique_ptr request, - std::function&)> callback) + absl::AnyInvocable&)> callback) override ABSL_LOCKS_EXCLUDED(mutex_); // Gets HTTP response in synchronization mode. diff --git a/internal/platform/BUILD b/internal/platform/BUILD index c1c1e3ef..98c92c00 100644 --- a/internal/platform/BUILD +++ b/internal/platform/BUILD @@ -16,13 +16,27 @@ licenses(["notice"]) +cc_library( + name = "logging", + hdrs = [ + "logging.h", + ], + visibility = [ + "//:__subpackages__", + ], + deps = [ + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/log:globals", + ], +) + cc_library( name = "base", srcs = [ "base64_utils.cc", "bluetooth_utils.cc", "input_stream.cc", - "nsd_service_info.cc", "prng.cc", ], hdrs = [ @@ -46,20 +60,14 @@ cc_library( ], copts = ["-DCORE_ADAPTER_DLL"], visibility = [ - "//connections:__subpackages__", - "//fastpair:__subpackages__", - "//internal/auth:__subpackages__", - "//internal/platform:__subpackages__", - "//internal/platform/implementation:__subpackages__", - "//internal/preferences:__subpackages__", - "//internal/weave:__subpackages__", - "//location/nearby/cpp:__subpackages__", - "//presence:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//:__subpackages__", + "//chrome/chromeos/assistant/data_migration/lib:__pkg__", ], deps = [ "//proto:connections_enums_cc_proto", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/meta:type_traits", "@com_google_absl//absl/strings", @@ -77,7 +85,6 @@ cc_library( ], hdrs = [ "base_input_stream.h", - "base_mutex_lock.h", "byte_utils.h", ], visibility = [ @@ -86,7 +93,6 @@ cc_library( ], deps = [ ":base", - "//internal/platform/implementation:types", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/strings:str_format", ], @@ -113,37 +119,6 @@ cc_library( ], ) -cc_library( - name = "connection_info", - srcs = [ - "ble_connection_info.cc", - "bluetooth_connection_info.cc", - "connection_info.cc", - "wifi_lan_connection_info.cc", - ], - hdrs = [ - "ble_connection_info.h", - "bluetooth_connection_info.h", - "connection_info.h", - "wifi_lan_connection_info.h", - ], - visibility = [ - "//connections/implementation:__pkg__", - "//connections/v3:__pkg__", - "//internal/interop:__pkg__", - "//presence:__subpackages__", - ], - deps = [ - ":types", - "//proto:connections_enums_cc_proto", - "@com_google_absl//absl/status", - "@com_google_absl//absl/status:statusor", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:variant", - ], -) - cc_library( name = "error_code_recorder", srcs = [ @@ -155,7 +130,7 @@ cc_library( ], visibility = ["//connections/implementation:__subpackages__"], deps = [ - ":types", + ":logging", "//proto:connections_enums_cc_proto", "//proto/errorcode:error_code_enums_cc_proto", "@com_google_absl//absl/functional:any_invocable", @@ -177,11 +152,196 @@ cc_library( "//presence:__subpackages__", ], deps = [ - "//internal/platform/implementation:types", + ":base", + "@boringssl//:crypto", "@com_google_absl//absl/strings", ], ) +cc_library( + name = "connection_info", + srcs = [ + "ble_connection_info.cc", + "bluetooth_connection_info.cc", + "connection_info.cc", + "wifi_lan_connection_info.cc", + ], + hdrs = [ + "ble_connection_info.h", + "bluetooth_connection_info.h", + "connection_info.h", + "wifi_lan_connection_info.h", + ], + visibility = [ + "//connections/implementation:__pkg__", + "//connections/v3:__pkg__", + "//internal/interop:__pkg__", + "//presence:__subpackages__", + ], + deps = [ + ":logging", + "//proto:connections_enums_cc_proto", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/types:variant", + ], +) + +cc_library( + name = "types", + srcs = [ + "blocking_queue_stream.cc", + "clock_impl.cc", + "device_info_impl.cc", + "monitored_runnable.cc", + "pending_job_registry.cc", + "pipe.cc", + "task_runner_impl.cc", + "timer_impl.cc", + ], + hdrs = [ + "array_blocking_queue.h", + "atomic_boolean.h", + "atomic_reference.h", + "blocking_queue_stream.h", + "borrowable.h", + "cancelable.h", + "cancelable_alarm.h", + "cancellable_task.h", + "clock.h", + "clock_impl.h", + "condition_variable.h", + "count_down_latch.h", + "crypto.h", + "device_info.h", + "device_info_impl.h", + "direct_executor.h", + "file.h", + "future.h", + "lockable.h", + "logging.h", + "monitored_runnable.h", + "multi_thread_executor.h", + "mutex.h", + "mutex_lock.h", + "pending_job_registry.h", + "pipe.h", + "scheduled_executor.h", + "settable_future.h", + "single_thread_executor.h", + "submittable_executor.h", + "system_clock.h", + "task_runner.h", + "task_runner_impl.h", + "thread_check_callable.h", + "thread_check_runnable.h", + "timer.h", + "timer_impl.h", + ], + visibility = [ + "//connections:__subpackages__", + "//fastpair:__subpackages__", + "//internal/account:__subpackages__", + "//internal/auth:__subpackages__", + "//internal/auth/credential_store:__subpackages__", + "//internal/base:__subpackages__", + "//internal/crypto:__subpackages__", + "//internal/data:__subpackages__", + "//internal/flags:__subpackages__", + "//internal/interop:__pkg__", + "//internal/network:__subpackages__", + "//internal/platform:__subpackages__", + "//internal/platform/implementation/g3:__pkg__", + "//internal/platform/implementation/windows:__subpackages__", + "//internal/preferences:__subpackages__", + "//internal/proto/analytics:__subpackages__", + "//internal/test:__subpackages__", + "//internal/weave:__subpackages__", + "//location/nearby/apps:__subpackages__", + "//location/nearby/cpp:__subpackages__", + "//location/nearby/sharing/sdk:__subpackages__", + "//location/nearby/testing/nearby_native:__subpackages__", + "//presence:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + ":base", + ":util", + "//internal/base:files", + "//internal/crypto_cros", + "//internal/flags:nearby_flags", + "//internal/platform/flags:platform_flags", + "//internal/platform/implementation:platform", + "//internal/platform/implementation:types", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/log", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/log:globals", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + ], +) + +cc_library( + name = "comm", + srcs = [ + "ble.cc", + "ble_v2.cc", + "bluetooth_classic.cc", + "credential_storage_impl.cc", + "file.cc", + "wifi_direct.cc", + "wifi_hotspot.cc", + "wifi_lan.cc", + ], + hdrs = [ + "ble.h", + "ble_v2.h", + "bluetooth_adapter.h", + "bluetooth_classic.h", + "credential_storage_impl.h", + "webrtc.h", + "wifi.h", + "wifi_direct.h", + "wifi_hotspot.h", + "wifi_lan.h", + ], + copts = [ + "-DCORE_ADAPTER_DLL", + "-DNO_WEBRTC", + ], + visibility = [ + "//connections:__subpackages__", + "//fastpair:__subpackages__", + "//internal/platform/implementation:__subpackages__", + "//internal/test:__subpackages__", + "//presence:__subpackages__", + ], + deps = [ + ":base", + ":cancellation_flag", + ":types", + ":uuid", + "//internal/base", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:platform", + "//internal/platform/implementation:wifi_utils", + # TODO: Support WebRTC + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/status", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", + ], +) + cc_library( name = "test_util", testonly = True, @@ -196,7 +356,6 @@ cc_library( "//fastpair:__subpackages__", "//internal/platform/implementation:__subpackages__", "//presence:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", ], deps = [ ":base", @@ -205,10 +364,13 @@ cc_library( "//internal/base", "//internal/platform/implementation:comm", "//internal/test", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/time", "@com_google_absl//absl/types:optional", ], ) @@ -275,150 +437,55 @@ cc_test( ], ) -cc_library( - name = "types", +cc_test( + name = "public_device_test", + size = "small", + timeout = "moderate", srcs = [ - "clock_impl.cc", - "device_info_impl.cc", - "monitored_runnable.cc", - "pending_job_registry.cc", - "pipe.cc", - "task_runner_impl.cc", - "timer_impl.cc", - ], - hdrs = [ - "atomic_boolean.h", - "atomic_reference.h", - "borrowable.h", - "cancelable.h", - "cancelable_alarm.h", - "cancellable_task.h", - "clock.h", - "clock_impl.h", - "condition_variable.h", - "count_down_latch.h", - "crypto.h", - "device_info.h", - "device_info_impl.h", - "direct_executor.h", - "file.h", - "future.h", - "lockable.h", - "logging.h", - "monitored_runnable.h", - "multi_thread_executor.h", - "mutex.h", - "mutex_lock.h", - "pending_job_registry.h", - "pipe.h", - "scheduled_executor.h", - "settable_future.h", - "single_thread_executor.h", - "submittable_executor.h", - "system_clock.h", - "task_runner.h", - "task_runner_impl.h", - "thread_check_callable.h", - "thread_check_runnable.h", - "timer.h", - "timer_impl.h", - ], - visibility = [ - "//connections:__subpackages__", - "//fastpair:__subpackages__", - "//internal/account:__subpackages__", - "//internal/auth:__subpackages__", - "//internal/auth/credential_store:__subpackages__", - "//internal/base:__subpackages__", - "//internal/data:__subpackages__", - "//internal/flags:__subpackages__", - "//internal/interop:__pkg__", - "//internal/network:__subpackages__", - "//internal/platform:__subpackages__", - "//internal/platform/implementation/g3:__pkg__", - "//internal/platform/implementation/linux:__subpackages__", - "//internal/platform/implementation/windows:__subpackages__", - "//internal/preferences:__subpackages__", - "//internal/proto/analytics:__subpackages__", - "//internal/test:__subpackages__", - "//internal/weave:__subpackages__", - "//location/nearby/analytics/cpp:__subpackages__", - "//location/nearby/apps:__subpackages__", - "//location/nearby/cpp:__subpackages__", - "//location/nearby/testing/nearby_native:__subpackages__", - "//presence:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", - ], - deps = [ - ":base", - ":util", - "//internal/crypto_cros", - "//internal/platform/implementation:platform", - "//internal/platform/implementation:types", - "@com_google_absl//absl/base:core_headers", - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/log:check", - "@com_google_absl//absl/strings", - "@com_google_absl//absl/synchronization", - "@com_google_absl//absl/time", - "@com_google_glog//:glog", - ], -) - -cc_library( - name = "comm", - srcs = [ - "ble.cc", - "ble_v2.cc", - "bluetooth_classic.cc", - "credential_storage_impl.cc", - "file.cc", - "wifi_direct.cc", - "wifi_hotspot.cc", - "wifi_lan.cc", - "wifi_utils.cc", - ], - hdrs = [ - "ble.h", - "ble_v2.h", - "bluetooth_adapter.h", - "bluetooth_classic.h", - "credential_storage_impl.h", - "webrtc.h", - "wifi.h", - "wifi_direct.h", - "wifi_hotspot.h", - "wifi_lan.h", - "wifi_utils.h", - ], - copts = [ - "-DCORE_ADAPTER_DLL", - "-DNO_WEBRTC", - ], - visibility = [ - "//connections:__subpackages__", - "//fastpair:__subpackages__", - "//internal/platform/implementation:__subpackages__", - "//internal/test:__subpackages__", - "//presence:__subpackages__", + "ble_connection_info_test.cc", + "ble_test.cc", + "ble_v2_test.cc", + "bluetooth_adapter_test.cc", + "bluetooth_classic_test.cc", + "bluetooth_connection_info_test.cc", + "pipe_test.cc", + "wifi_direct_test.cc", + "wifi_hotspot_test.cc", + "wifi_lan_connection_info_test.cc", + "wifi_lan_test.cc", + "wifi_test.cc", ], deps = [ ":base", ":cancellation_flag", + ":comm", + ":connection_info", + ":test_util", ":types", - ":uuid", - "//internal/base", "//internal/platform/implementation:comm", - "//internal/platform/implementation:platform", - # TODO: Support WebRTC - "@com_google_absl//absl/container:flat_hash_map", - "@com_google_absl//absl/container:flat_hash_set", - "@com_google_absl//absl/functional:any_invocable", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//proto:connections_enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/status", "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", - "@com_google_absl//absl/types:optional", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "credential_storage_impl_test", + srcs = ["credential_storage_impl_test.cc"], + deps = [ + ":comm", + "//internal/platform/implementation:comm", + "//internal/platform/implementation/g3", # build_cleaner: keep + "//internal/proto:credential_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings:string_view", + "@com_google_googletest//:gtest_main", ], ) @@ -429,38 +496,22 @@ cc_test( srcs = [ "atomic_boolean_test.cc", "atomic_reference_test.cc", - "ble_connection_info_test.cc", - "ble_test.cc", - "ble_v2_test.cc", - "bluetooth_adapter_test.cc", - "bluetooth_classic_test.cc", - "bluetooth_connection_info_test.cc", "borrowable_test.cc", "cancelable_alarm_test.cc", "condition_variable_test.cc", "connection_info_test.cc", "count_down_latch_test.cc", - "credential_storage_impl_test.cc", "crypto_test.cc", "direct_executor_test.cc", "future_test.cc", - "logging_test.cc", "multi_thread_executor_test.cc", "mutex_test.cc", - "pipe_test.cc", "scheduled_executor_test.cc", "single_thread_executor_test.cc", "task_runner_impl_test.cc", "timer_impl_test.cc", "uuid_test.cc", - "wifi_direct_test.cc", - "wifi_hotspot_test.cc", - "wifi_lan_connection_info_test.cc", - "wifi_lan_test.cc", - "wifi_test.cc", - "wifi_utils_test.cc", ], - copts = ["-DCORE_ADAPTER_DLL"], shard_count = 16, deps = [ ":base", @@ -470,16 +521,29 @@ cc_test( ":test_util", ":types", ":uuid", + "//internal/crypto_cros", + "//internal/flags:nearby_flags", + "//internal/platform/flags:platform_flags", "//internal/platform/implementation:comm", - "//internal/platform/implementation/g3", # build_cleaner: keep "//internal/proto:credential_cc_proto", + "//internal/test", "//proto:connections_enums_cc_proto", "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/log", "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:variant", "@com_google_googletest//:gtest_main", - ], + ] + select({ + "@platforms//os:windows": [ + "//internal/platform/implementation/windows", + ], + "//conditions:default": [ + "//internal/platform/implementation/g3", + ], + }), ) diff --git a/internal/platform/array_blocking_queue.h b/internal/platform/array_blocking_queue.h new file mode 100644 index 00000000..1752d8cc --- /dev/null +++ b/internal/platform/array_blocking_queue.h @@ -0,0 +1,104 @@ +// Copyright 2024 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 PLATFORM_PUBLIC_ARRAY_BLOCKING_QUEUE_H_ +#define PLATFORM_PUBLIC_ARRAY_BLOCKING_QUEUE_H_ + +#include +#include +#include + +#include "internal/platform/condition_variable.h" +#include "internal/platform/logging.h" +#include "internal/platform/mutex.h" +#include "internal/platform/mutex_lock.h" + +namespace nearby { + +/** + * Payload from different services/clients will be put into an + * ArrayBlockingQueue before sending to ensure each client has equal chance to + * send its data. Since C++ doesn't provide ArrayBlockingQueue as Java, we + * implement one here. + */ +template +class ArrayBlockingQueue { + public: + explicit ArrayBlockingQueue(size_t capacity) : capacity_(capacity) {} + + void Put(const T& value) { + MutexLock lock(&queue_mutex_); + if (queue_.size() >= capacity_) { + has_space_.Wait(); + } + queue_.push(value); + NEARBY_LOGS(INFO) << "ArrayBlockingQueue::Put()"; + has_data_.Notify(); + } + + T Take() { + MutexLock lock(&queue_mutex_); + if (queue_.empty()) { + has_data_.Wait(); + } + T front = queue_.front(); + queue_.pop(); + NEARBY_LOGS(INFO) << "ArrayBlockingQueue::Take()"; + has_space_.Notify(); + return front; + } + + bool TryPut(const T& value) { + MutexLock lock(&queue_mutex_); + if (queue_.size() < capacity_) { + queue_.push(value); + has_data_.Notify(); + return true; + } + return false; + } + + // Returns std::nullopt if the queue is empty. + std::optional TryTake() { + MutexLock lock(&queue_mutex_); + if (!queue_.empty()) { + T front = queue_.front(); + queue_.pop(); + has_space_.Notify(); + return front; + } + return std::nullopt; + } + + size_t Size() const { + MutexLock lock(&queue_mutex_); + return queue_.size(); + } + + bool Empty() const { + MutexLock lock(&queue_mutex_); + return queue_.empty(); + } + + private: + std::queue queue_; + mutable Mutex queue_mutex_; + ConditionVariable has_data_{&queue_mutex_}; + ConditionVariable has_space_{&queue_mutex_}; + const size_t capacity_; +}; + +} // namespace nearby + +#endif // PLATFORM_PUBLIC_ARRAY_BLOCKING_QUEUE_H_ diff --git a/internal/platform/atomic_boolean.h b/internal/platform/atomic_boolean.h index 41be6b94..40a745c4 100644 --- a/internal/platform/atomic_boolean.h +++ b/internal/platform/atomic_boolean.h @@ -27,9 +27,8 @@ namespace nearby { // cpp/platform/api/atomic_boolean.h class AtomicBoolean final : public api::AtomicBoolean { public: - using Platform = api::ImplementationPlatform; explicit AtomicBoolean(bool value = false) - : impl_(Platform::CreateAtomicBoolean(value)) {} + : impl_(api::ImplementationPlatform::CreateAtomicBoolean(value)) {} ~AtomicBoolean() override = default; AtomicBoolean(AtomicBoolean&&) = default; AtomicBoolean& operator=(AtomicBoolean&&) = default; diff --git a/internal/platform/atomic_boolean_test.cc b/internal/platform/atomic_boolean_test.cc index b83449d7..10a8ef1c 100644 --- a/internal/platform/atomic_boolean_test.cc +++ b/internal/platform/atomic_boolean_test.cc @@ -14,8 +14,6 @@ #include "internal/platform/atomic_boolean.h" -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" namespace nearby { diff --git a/internal/platform/base64_utils.cc b/internal/platform/base64_utils.cc index 2ff77f41..b4834d0e 100644 --- a/internal/platform/base64_utils.cc +++ b/internal/platform/base64_utils.cc @@ -14,8 +14,16 @@ #include "internal/platform/base64_utils.h" +#include +#include +#include + #include "absl/strings/escaping.h" +#include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/output_stream.h" namespace nearby { @@ -36,4 +44,39 @@ ByteArray Base64Utils::Decode(absl::string_view base64_string) { return ByteArray(decoded_string.data(), decoded_string.size()); } +std::int32_t Base64Utils::BytesToInt(const ByteArray& bytes) { + const char* int_bytes = bytes.data(); + + std::int32_t result = 0; + result |= (static_cast(int_bytes[0]) & 0x0FF) << 24; + result |= (static_cast(int_bytes[1]) & 0x0FF) << 16; + result |= (static_cast(int_bytes[2]) & 0x0FF) << 8; + result |= (static_cast(int_bytes[3]) & 0x0FF); + + return result; +} + +ByteArray Base64Utils::IntToBytes(std::int32_t value) { + char int_bytes[sizeof(std::int32_t)]; + int_bytes[0] = static_cast((value >> 24) & 0x0FF); + int_bytes[1] = static_cast((value >> 16) & 0x0FF); + int_bytes[2] = static_cast((value >> 8) & 0x0FF); + int_bytes[3] = static_cast((value) & 0x0FF); + + return ByteArray(int_bytes, sizeof(int_bytes)); +} + +ExceptionOr Base64Utils::ReadInt(InputStream* reader) { + ExceptionOr read_bytes = reader->ReadExactly(sizeof(std::int32_t)); + if (!read_bytes.ok()) { + return ExceptionOr(read_bytes.exception()); + } + return ExceptionOr( + BytesToInt(std::move(read_bytes.result()))); +} + +Exception Base64Utils::WriteInt(OutputStream* writer, std::int32_t value) { + return writer->Write(IntToBytes(value)); +} + } // namespace nearby diff --git a/internal/platform/base64_utils.h b/internal/platform/base64_utils.h index 3002890c..f673e8db 100644 --- a/internal/platform/base64_utils.h +++ b/internal/platform/base64_utils.h @@ -15,8 +15,13 @@ #ifndef PLATFORM_BASE_BASE64_UTILS_H_ #define PLATFORM_BASE_BASE64_UTILS_H_ +#include +#include #include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/output_stream.h" namespace nearby { @@ -24,6 +29,10 @@ class Base64Utils { public: static std::string Encode(const ByteArray& bytes); static ByteArray Decode(absl::string_view base64_string); + static std::int32_t BytesToInt(const ByteArray& bytes); + static ByteArray IntToBytes(std::int32_t value); + static ExceptionOr ReadInt(InputStream* reader); + static Exception WriteInt(OutputStream* writer, std::int32_t value); }; } // namespace nearby diff --git a/internal/platform/base_input_stream.h b/internal/platform/base_input_stream.h index a7116de3..02e05bc3 100644 --- a/internal/platform/base_input_stream.h +++ b/internal/platform/base_input_stream.h @@ -15,6 +15,10 @@ #ifndef PLATFORM_BASE_BASE_INPUT_STREAM_H_ #define PLATFORM_BASE_BASE_INPUT_STREAM_H_ +#include +#include +#include + #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" #include "internal/platform/input_stream.h" diff --git a/internal/platform/ble.cc b/internal/platform/ble.cc index d6792c22..94090661 100644 --- a/internal/platform/ble.cc +++ b/internal/platform/ble.cc @@ -14,6 +14,13 @@ #include "internal/platform/ble.h" +#include +#include +#include + +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/implementation/ble.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" @@ -49,13 +56,11 @@ bool BleMedium::StartScanning( auto pair = peripherals_.emplace( &peripheral, absl::make_unique()); auto& context = *pair.first->second; - if (pair.second) { - context.peripheral = BlePeripheral(&peripheral); - discovered_peripheral_callback_.peripheral_discovered_cb( - context.peripheral, service_id, - context.peripheral.GetAdvertisementBytes(service_id), - fast_advertisement); - } + context.peripheral = BlePeripheral(&peripheral); + discovered_peripheral_callback_.peripheral_discovered_cb( + context.peripheral, service_id, + context.peripheral.GetAdvertisementBytes(service_id), + fast_advertisement); }, .peripheral_lost_cb = [this](api::BlePeripheral& peripheral, @@ -64,8 +69,9 @@ bool BleMedium::StartScanning( if (peripherals_.empty()) return; auto context = peripherals_.find(&peripheral); if (context == peripherals_.end()) return; - NEARBY_LOG(INFO, "Removing peripheral=%p, impl=%p", - &(context->second->peripheral), &peripheral); + NEARBY_LOGS(INFO) << "Removing peripheral=" + << context->second->peripheral.GetName() + << ", impl=" << &peripheral; discovered_peripheral_callback_.peripheral_lost_cb( context->second->peripheral, service_id); }, @@ -77,7 +83,7 @@ bool BleMedium::StopScanning(const std::string& service_id) { MutexLock lock(&mutex_); discovered_peripheral_callback_ = {}; peripherals_.clear(); - NEARBY_LOG(INFO, "Ble Scanning disabled: impl=%p", &GetImpl()); + NEARBY_LOGS(INFO) << "Ble Scanning disabled: impl=" << &GetImpl(); } return impl_->StopScanning(service_id); } @@ -96,12 +102,12 @@ bool BleMedium::StartAcceptingConnections(const std::string& service_id, &socket, std::make_unique()); auto& context = *pair.first->second; if (!pair.second) { - NEARBY_LOG(INFO, "Accepting (again) socket=%p, impl=%p", - &context.socket, &socket); + NEARBY_LOGS(INFO) << "Accepting (again) socket=" << &context.socket + << ", impl=" << &socket; } else { context.socket = BleSocket(&socket); - NEARBY_LOG(INFO, "Accepting socket=%p, impl=%p", &context.socket, - &socket); + NEARBY_LOGS(INFO) + << "Accepting socket=" << &context.socket << ", impl=" << &socket; } if (accepted_connection_callback_) { accepted_connection_callback_(context.socket, service_id); @@ -114,7 +120,8 @@ bool BleMedium::StopAcceptingConnections(const std::string& service_id) { MutexLock lock(&mutex_); accepted_connection_callback_ = nullptr; sockets_.clear(); - NEARBY_LOG(INFO, "Ble accepted connection disabled: impl=%p", &GetImpl()); + NEARBY_LOGS(INFO) << "Ble accepted connection disabled: impl=" + << &GetImpl(); } return impl_->StopAcceptingConnections(service_id); } @@ -124,8 +131,9 @@ BleSocket BleMedium::Connect(BlePeripheral& peripheral, CancellationFlag* cancellation_flag) { { MutexLock lock(&mutex_); - NEARBY_LOG(INFO, "BleMedium::Connect: peripheral=%p [impl=%p]", &peripheral, - &peripheral.GetImpl()); + NEARBY_LOGS(INFO) << "BleMedium::Connect: peripheral=" + << peripheral.GetName() + << ",impl=" << &peripheral.GetImpl(); } return BleSocket( impl_->Connect(peripheral.GetImpl(), service_id, cancellation_flag)); diff --git a/internal/platform/ble_test.cc b/internal/platform/ble_test.cc index 8f48b908..20ecce73 100644 --- a/internal/platform/ble_test.cc +++ b/internal/platform/ble_test.cc @@ -15,10 +15,14 @@ #include "internal/platform/ble.h" #include +#include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" @@ -74,11 +78,10 @@ TEST_P(BleMediumTest, CanStartAcceptingConnectionsAndConnect) { BlePeripheral& peripheral, const std::string& service_id, const ByteArray& advertisement_bytes, bool fast_advertisement) { - NEARBY_LOG( - INFO, - "Peripheral discovered: %s, %p, fast advertisement: %d", - peripheral.GetName().c_str(), &peripheral, - fast_advertisement); + NEARBY_LOGS(INFO) + << "Discovered peripheral=" << peripheral.GetName() + << ", impl=" << &peripheral.GetImpl() + << ", fast advertisement=" << fast_advertisement; discovered_peripheral = &peripheral; found_latch.CountDown(); }, @@ -87,8 +90,8 @@ TEST_P(BleMediumTest, CanStartAcceptingConnectionsAndConnect) { fast_advertisement_service_uuid); ble_b.StartAcceptingConnections( service_id, [&](BleSocket socket, const std::string& service_id) { - NEARBY_LOG(INFO, "Connection accepted: socket=%p, service_id=%s", - &socket, service_id.c_str()); + NEARBY_LOGS(INFO) << "Connection accepted: socket=" << &socket + << ", service_id=" << service_id; accepted_latch.CountDown(); }); EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); @@ -133,11 +136,10 @@ TEST_P(BleMediumTest, CanCancelConnect) { BlePeripheral& peripheral, const std::string& service_id, const ByteArray& advertisement_bytes, bool fast_advertisement) { - NEARBY_LOG( - INFO, - "Peripheral discovered: %s, %p, fast advertisement: %d", - peripheral.GetName().c_str(), &peripheral, - fast_advertisement); + NEARBY_LOGS(INFO) + << "Discovered peripheral=" << peripheral.GetName() + << ", impl=" << &peripheral.GetImpl() + << ", fast advertisement=" << fast_advertisement; discovered_peripheral = &peripheral; found_latch.CountDown(); }, @@ -146,8 +148,8 @@ TEST_P(BleMediumTest, CanCancelConnect) { fast_advertisement_service_uuid); ble_b.StartAcceptingConnections( service_id, [&](BleSocket socket, const std::string& service_id) { - NEARBY_LOG(INFO, "Connection accepted: socket=%p, service_id=%s", - &socket, service_id.c_str()); + NEARBY_LOGS(INFO) << "Connection accepted: socket=" << &socket + << ", service_id=" << service_id; accepted_latch.CountDown(); }); EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); diff --git a/internal/platform/ble_v2.cc b/internal/platform/ble_v2.cc index fbe765d4..2a0e9593 100644 --- a/internal/platform/ble_v2.cc +++ b/internal/platform/ble_v2.cc @@ -22,6 +22,7 @@ #include "internal/platform/implementation/ble_v2.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/uuid.h" namespace nearby { @@ -43,26 +44,6 @@ bool BleV2Medium::StartAdvertising( bool BleV2Medium::StopAdvertising() { return impl_->StopAdvertising(); } -std::unique_ptr -BleV2Medium::StartAdvertisingTmp( - const api::ble_v2::BleAdvertisementData& advertising_data, - api::ble_v2::AdvertiseParameters advertise_set_parameters, - api::ble_v2::BleMedium::AdvertisingCallback callback) { - if (impl_->StartAdvertising(advertising_data, advertise_set_parameters)) { - callback.start_advertising_result(absl::OkStatus()); - } else { - callback.start_advertising_result( - absl::InternalError("Failed to start advertising")); - return nullptr; - } - return std::make_unique( - api::ble_v2::BleMedium::AdvertisingSession{.stop_advertising = [this] { - return impl_->StopAdvertising() - ? absl::OkStatus() - : absl::InternalError("Failed to stop advertising"); - }}); -} - std::unique_ptr BleV2Medium::StartAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, @@ -111,7 +92,7 @@ bool BleV2Medium::StartScanning(const Uuid& service_uuid, // prevent the stale data in cache. peripherals_.clear(); scanning_enabled_ = true; - NEARBY_LOG(INFO, "Ble Scanning enabled; impl=%p", GetImpl()); + NEARBY_LOGS(INFO) << "Ble Scanning enabled; impl=" << GetImpl(); } return success; } @@ -126,51 +107,15 @@ bool BleV2Medium::StopScanning() { scanning_enabled_ = false; peripherals_.clear(); scan_callback_ = {}; - NEARBY_LOG(INFO, "Ble Scanning disabled: impl=%p", GetImpl()); + NEARBY_LOGS(INFO) << "Ble Scanning disabled: impl=" << GetImpl(); return impl_->StopScanning(); } -std::unique_ptr -BleV2Medium::StartScanningTmp( - const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, - api::ble_v2::BleMedium::ScanningCallback callback) { - MutexLock lock(&mutex_); - - if (impl_->StartScanning( - service_uuid, tx_power_level, - api::ble_v2::BleMedium::ScanCallback{ - .advertisement_found_cb = - [this, - found_callback = std::move(callback.advertisement_found_cb)]( - api::ble_v2::BlePeripheral& peripheral, - BleAdvertisementData advertisement_data) mutable { - MutexLock lock(&mutex_); - if (!peripherals_.contains(&peripheral)) { - NEARBY_LOGS(INFO) - << "Peripheral impl=" << &peripheral - << " does not exist; add it to the map."; - peripherals_.insert(&peripheral); - } - found_callback(peripheral, advertisement_data); - }, - })) { - callback.start_scanning_result(absl::OkStatus()); - } else { - callback.start_scanning_result(absl::InternalError("Failed to start scan")); - return nullptr; - } - return std::make_unique( - api::ble_v2::BleMedium::ScanningSession{.stop_scanning = [this]() { - return impl_->StopScanning() - ? absl::OkStatus() - : absl::InternalError("Failed to stop advertising"); - }}); -} std::unique_ptr BleV2Medium::StartScanning(const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, api::ble_v2::BleMedium::ScanningCallback callback) { - NEARBY_LOG(INFO, "platform mutex: %p", &mutex_); + NEARBY_LOGS(INFO) << "platform mutex: " << &mutex_; return impl_->StartScanning( service_uuid, tx_power_level, api::ble_v2::BleMedium::ScanningCallback{ @@ -187,6 +132,7 @@ BleV2Medium::StartScanning(const Uuid& service_uuid, start_scanning_result(status); }, .advertisement_found_cb = std::move(callback.advertisement_found_cb), + .advertisement_lost_cb = std::move(callback.advertisement_lost_cb), }); } @@ -280,7 +226,7 @@ BleV2Socket BleV2Medium::Connect(const std::string& service_id, } bool BleV2Medium::IsExtendedAdvertisementsAvailable() { - return impl_->IsExtendedAdvertisementsAvailable(); + return IsValid() && impl_->IsExtendedAdvertisementsAvailable(); } BleV2Peripheral BleV2Medium::GetRemotePeripheral( diff --git a/internal/platform/ble_v2.h b/internal/platform/ble_v2.h index 80ec417d..b4a5b3d3 100644 --- a/internal/platform/ble_v2.h +++ b/internal/platform/ble_v2.h @@ -375,7 +375,7 @@ class BleV2Medium final { // Returns true once the BLE advertising has been initiated. // This interface will be deprecated soon. // TODO(b/271305977) remove this function. - // Use 'unique_ptr StartAdvertisingTmp' instead. + // Use 'unique_ptr StartAdvertising' instead. bool StartAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, api::ble_v2::AdvertiseParameters advertise_parameters); @@ -383,14 +383,6 @@ class BleV2Medium final { // TODO(b/271305977) remove this function. bool StopAdvertising(); - // Temp interface for windows client to use before windows has native impl - // for 'unique_ptr StartAdvertising'. - // TODO(b/271305977) remove this function. - std::unique_ptr - StartAdvertisingTmp(const api::ble_v2::BleAdvertisementData& advertising_data, - api::ble_v2::AdvertiseParameters advertise_set_parameters, - api::ble_v2::BleMedium::AdvertisingCallback callback); - std::unique_ptr StartAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, api::ble_v2::AdvertiseParameters advertise_set_parameters, @@ -398,8 +390,6 @@ class BleV2Medium final { // Returns true once the BLE scan has been initiated. // This interface will be deprecated soon. - // TODO(b/271305977) remove this function. - // Use 'unique_ptr StartScanningTmp' instead. bool StartScanning(const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, ScanCallback callback); @@ -411,13 +401,6 @@ class BleV2Medium final { const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, api::ble_v2::BleMedium::ScanningCallback callback); - // Temp interface for windows client to use before windows has native impl - // for 'unique_ptr StartScanning'. - // TODO(b/271305977) remove this function. - std::unique_ptr StartScanningTmp( - const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, - api::ble_v2::BleMedium::ScanningCallback callback); - // Starts Gatt Server for waiting to client connection. std::unique_ptr StartGattServer( ServerGattConnectionCallback callback); diff --git a/internal/platform/ble_v2_test.cc b/internal/platform/ble_v2_test.cc index 2f7989dc..040eba76 100644 --- a/internal/platform/ble_v2_test.cc +++ b/internal/platform/ble_v2_test.cc @@ -434,56 +434,6 @@ TEST_F(BleV2MediumTest, CanStartAsyncScanningAndAdvertising) { env_.Stop(); } -TEST_F(BleV2MediumTest, CanStartAsyncScanningAndAdvertisingWithTmpImpl) { - env_.Start(); - BluetoothAdapter adapter_a; - BluetoothAdapter adapter_b; - BleV2Medium ble_a(adapter_a); - BleV2Medium ble_b(adapter_b); - Uuid service_uuid(1234, 5678); - ByteArray advertisement_bytes{std::string(kAdvertisementString)}; - ByteArray advertisement_header_bytes{std::string(kAdvertisementHeaderString)}; - CountDownLatch found_latch(1); - - std::unique_ptr scanning_session = - ble_a.StartScanningTmp( - service_uuid, kTxPowerLevel, - api::ble_v2::BleMedium::ScanningCallback{ - .advertisement_found_cb = - [&](api::ble_v2::BlePeripheral& peripheral, - BleAdvertisementData advertisement_data) -> void { - found_latch.CountDown(); - }, - }); - - // Succeed to start regular advertisement. - BleAdvertisementData advertising_data; - advertising_data.is_extended_advertisement = false; - advertising_data.service_data = {{service_uuid, advertisement_header_bytes}}; - std::unique_ptr adv_session = - ble_b.StartAdvertisingTmp( - advertising_data, - {.tx_power_level = kTxPowerLevel, .is_connectable = true}, - {.start_advertising_result = [](absl::Status) {}}); - EXPECT_NE(adv_session, nullptr); - - EXPECT_TRUE(env_.GetBleV2MediumStatus(*ble_a.GetImpl()).value().is_scanning); - EXPECT_TRUE( - env_.GetBleV2MediumStatus(*ble_b.GetImpl()).value().is_advertising); - EXPECT_TRUE(found_latch.Await(kWaitDuration).result()); - EXPECT_OK(scanning_session->stop_scanning()); - - EXPECT_OK(adv_session->stop_advertising()); - EXPECT_FALSE(env_.GetBleV2MediumStatus(*ble_a.GetImpl()).value().is_scanning); - EXPECT_FALSE( - env_.GetBleV2MediumStatus(*ble_b.GetImpl()).value().is_advertising); - env_.UnregisterBleV2Medium(*ble_a.GetImpl()); - env_.UnregisterBleV2Medium(*ble_b.GetImpl()); - EXPECT_EQ(env_.GetBleV2MediumStatus(*ble_a.GetImpl()), absl::nullopt); - EXPECT_EQ(env_.GetBleV2MediumStatus(*ble_b.GetImpl()), absl::nullopt); - env_.Stop(); -} - TEST_F(BleV2MediumTest, CanStartGattServer) { env_.Start(); BluetoothAdapter adapter; diff --git a/internal/platform/blocking_queue_stream.cc b/internal/platform/blocking_queue_stream.cc new file mode 100644 index 00000000..005355ee --- /dev/null +++ b/internal/platform/blocking_queue_stream.cc @@ -0,0 +1,72 @@ +// Copyright 2024 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. + +#include "internal/platform/blocking_queue_stream.h" + +#include + +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/logging.h" + +namespace nearby { + +BlockingQueueStream::BlockingQueueStream() { + NEARBY_LOGS(INFO) << "Create a BlockingQueueStream with size " + << FeatureFlags::GetInstance() + .GetFlags() + .blocking_queue_stream_queue_capacity; +} + +ExceptionOr BlockingQueueStream::Read(std::int64_t size) { + if (is_closed_) { + NEARBY_LOGS(INFO) + << "Failed to read BlockingQueueStream because it was closed."; + return ExceptionOr(Exception::kInterrupted); + } + NEARBY_LOGS(INFO) << "BlockingQueueStream expect to read " << size + << " bytes"; + return ExceptionOr(blocking_queue_.Take()); +} + +void BlockingQueueStream::Write(const ByteArray& bytes) { + if (is_closed_) { + NEARBY_LOGS(INFO) + << "Failed to write BlockingQueueStream because it was closed."; + return; + } + is_writing_ = true; + blocking_queue_.Put(bytes); + is_writing_ = false; + NEARBY_VLOG(1) << "BlockingQueueStream wrote " << bytes.size() << " bytes"; +} + +Exception BlockingQueueStream::Close() { + if (is_closed_) { + NEARBY_LOGS(INFO) << "InputBlockingQueueStream has already been closed."; + return {Exception::kSuccess}; + } + if (is_writing_) { + NEARBY_LOGS(INFO) + << "BlockingQueueStream is waiting for writing, read first to unblock"; + blocking_queue_.TryTake(); + } + blocking_queue_.TryPut(queue_end_); + is_closed_ = true; + NEARBY_LOGS(INFO) << "InputBlockingQueueStream is closed."; + return {Exception::kSuccess}; +} + +} // namespace nearby diff --git a/internal/platform/blocking_queue_stream.h b/internal/platform/blocking_queue_stream.h new file mode 100644 index 00000000..72d76c14 --- /dev/null +++ b/internal/platform/blocking_queue_stream.h @@ -0,0 +1,52 @@ +// Copyright 2024 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 PLATFORM_PUBLIC_BLOCKING_QUEUE_STREAM_H_ +#define PLATFORM_PUBLIC_BLOCKING_QUEUE_STREAM_H_ + +#include + +#include "internal/platform/array_blocking_queue.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/mutex.h" + +namespace nearby { +class BlockingQueueStream : public InputStream { + public: + BlockingQueueStream(); + ~BlockingQueueStream() override = default; + + ExceptionOr Read(std::int64_t size) override; + void Write(const ByteArray& bytes); + Exception Close() override; + bool IsWriting() const { + return is_writing_; + } + + private: + mutable Mutex mutex_; + ArrayBlockingQueue blocking_queue_{FeatureFlags::GetInstance() + .GetFlags() + .blocking_queue_stream_queue_capacity}; + ByteArray queue_end_{0}; + bool is_writing_ = false; + bool is_closed_ = false; +}; +} // namespace nearby + +#endif // #ifndef PLATFORM_PUBLIC_BLOCKING_QUEUE_STREAM_H_ + diff --git a/internal/platform/bluetooth_classic.cc b/internal/platform/bluetooth_classic.cc index df8b1157..20d0e305 100644 --- a/internal/platform/bluetooth_classic.cc +++ b/internal/platform/bluetooth_classic.cc @@ -14,76 +14,132 @@ #include "internal/platform/bluetooth_classic.h" +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/logging.h" #include "internal/platform/mutex_lock.h" +#include "internal/platform/output_stream.h" +#include "internal/platform/socket.h" namespace nearby { +using location::nearby::proto::connections::Medium; + +MediumSocket* BluetoothSocket::CreateVirtualSocket(OutputStream* outputstream) { + if (IsVirtualSocket()) { + LOG(WARNING) + << "Creating the virtual socket on a virtual socket is not allowed."; + return nullptr; + } + auto virtual_socket = std::make_shared(outputstream); + return virtual_socket.get(); +} + +MediumSocket* BluetoothSocket::CreateVirtualSocket( + const std::string& salted_service_id_hash_key, OutputStream* outputstream, + Medium medium, + absl::flat_hash_map>* + virtual_sockets_ptr) { + if (IsVirtualSocket()) { + LOG(WARNING) + << "Creating the virtual socket on a virtual socket is not allowed."; + return nullptr; + } + + auto virtual_socket = std::make_shared(outputstream); + virtual_socket->impl_ = this->impl_; + LOG(WARNING) << "Created the virtual socket for Medium: " + << Medium_Name(virtual_socket->GetMedium()); + + if (virtual_sockets_ptr_ == nullptr) { + virtual_sockets_ptr_ = virtual_sockets_ptr; + } + + (*virtual_sockets_ptr_)[salted_service_id_hash_key] = virtual_socket; + LOG(INFO) << "virtual_sockets_ size: " << virtual_sockets_ptr_->size(); + return virtual_socket.get(); +} BluetoothClassicMedium::~BluetoothClassicMedium() { + LOG(INFO) << "~BluetoothClassicMedium: observer_list_ size: " + << observer_list_.size(); if (!observer_list_.empty()) { impl_->RemoveObserver(this); } StopDiscovery(); + LOG(INFO) << "eof ~BluetoothClassicMedium"; } BluetoothSocket BluetoothClassicMedium::ConnectToService( BluetoothDevice& remote_device, const std::string& service_uuid, CancellationFlag* cancellation_flag) { - NEARBY_LOG(INFO, - "BluetoothClassicMedium::ConnectToService: device=%p [impl=%p]", - &remote_device, &remote_device.GetImpl()); + LOG(INFO) << "BluetoothClassicMedium::ConnectToService: " + "service_uuid=" + << service_uuid << ", device=" << remote_device.GetMacAddress() + << ", [impl=" << &remote_device.GetImpl() << "]"; return BluetoothSocket(impl_->ConnectToService( remote_device.GetImpl(), service_uuid, cancellation_flag)); } bool BluetoothClassicMedium::StartDiscovery(DiscoveryCallback callback) { + LOG(INFO) << "BluetoothClassicMedium::StartDiscovery"; MutexLock lock(&mutex_); if (discovery_enabled_) { - NEARBY_LOG(INFO, "BT Discovery already enabled; impl=%p", &GetImpl()); + LOG(INFO) << "BT Discovery already enabled; impl=" << &GetImpl(); return false; } bool success = impl_->StartDiscovery({ .device_discovered_cb = [this](api::BluetoothDevice& device) { + VLOG(1) << "BT .device_discovered_cb for " << device.GetName(); MutexLock lock(&mutex_); auto pair = devices_.emplace( - &device, absl::make_unique()); + &device, std::make_unique()); auto& context = *pair.first->second; if (!pair.second) { - NEARBY_LOG(INFO, "Adding (again) device=%p, impl=%p", - &context.device, &device); + LOG(INFO) << "Adding (again) device=" + << context.device.GetMacAddress() + << ",impl=" << &device; return; } context.device = BluetoothDevice(&device); - NEARBY_LOG(INFO, "Adding device=%p, impl=%p", &context.device, - &device); + LOG(INFO) << "Adding device=" << context.device.GetMacAddress() + << ",impl=" << &device; if (!discovery_enabled_) return; discovery_callback_.device_discovered_cb(context.device); }, .device_name_changed_cb = [this](api::BluetoothDevice& device) { + VLOG(1) << "BT .device_name_changed_cb for " << device.GetName(); MutexLock lock(&mutex_); // If the device is not already in devices_, we should not be able // to change its name. if (devices_.find(&device) == devices_.end()) return; auto& context = *devices_[&device]; - NEARBY_LOG(INFO, "Renaming device=%p, impl=%p", &context.device, - &device); + LOG(INFO) << "Renaming device=" << context.device.GetMacAddress() + << ",impl=" << &device; if (!discovery_enabled_) return; discovery_callback_.device_name_changed_cb(context.device); }, .device_lost_cb = [this](api::BluetoothDevice& device) { + VLOG(1) << "BT .device_lost_cb for " << device.GetMacAddress(); MutexLock lock(&mutex_); auto item = devices_.extract(&device); if (!item) { - NEARBY_LOGS(WARNING) - << "Removing unknown device: " << device.GetMacAddress(); + LOG(WARNING) << "Removing unknown device: " + << device.GetMacAddress(); return; } auto& context = *item.mapped(); - NEARBY_LOG(INFO, "Removing device=%p, impl=%p", &context.device, - &device); + LOG(INFO) << "Removing device=" << context.device.GetMacAddress() + << ",impl=" << &device; if (!discovery_enabled_) return; discovery_callback_.device_lost_cb(context.device); }, @@ -92,44 +148,54 @@ bool BluetoothClassicMedium::StartDiscovery(DiscoveryCallback callback) { discovery_callback_ = std::move(callback); devices_.clear(); discovery_enabled_ = true; - NEARBY_LOG(INFO, "BT Discovery enabled; impl=%p", &GetImpl()); } + LOG(INFO) << "BT StartDiscovery result:" << success + << ", impl=" << &GetImpl(); return success; } bool BluetoothClassicMedium::StopDiscovery() { + LOG(INFO) << "BT StopDiscovery; impl=" << &GetImpl(); MutexLock lock(&mutex_); if (!discovery_enabled_) return true; discovery_enabled_ = false; discovery_callback_ = {}; devices_.clear(); - NEARBY_LOG(INFO, "BT Discovery disabled: impl=%p", &GetImpl()); + LOG(INFO) << "BT Discovery disabled: impl=" << &GetImpl(); return impl_->StopDiscovery(); } void BluetoothClassicMedium::AddObserver(Observer* observer) { + LOG(INFO) << "BT AddObserver; impl=" << &GetImpl(); MutexLock lock(&mutex_); if (observer_list_.empty()) { impl_->AddObserver(this); } observer_list_.AddObserver(observer); + LOG(INFO) << "BT AddObserver done"; } void BluetoothClassicMedium::RemoveObserver(Observer* observer) { + LOG(INFO) << "BT RemoveObserver; impl=" << &GetImpl(); MutexLock lock(&mutex_); observer_list_.RemoveObserver(observer); if (observer_list_.empty()) { impl_->RemoveObserver(this); } + LOG(INFO) << "BT RemoveObserver done"; } // api::BluetoothClassicMedium::Observer methods void BluetoothClassicMedium::DeviceAdded(api::BluetoothDevice& device) { + VLOG(1) << "BT DeviceAdded; name=" << device.GetName() + << ", address=" << device.GetMacAddress(); BluetoothDevice bt_device(&device); for (auto* observer : observer_list_.GetObservers()) { observer->DeviceAdded(bt_device); } } void BluetoothClassicMedium::DeviceRemoved(api::BluetoothDevice& device) { + VLOG(1) << "BT DeviceRemoved; name=" << device.GetName() + << ", address=" << device.GetMacAddress(); BluetoothDevice bt_device(&device); for (auto* observer : observer_list_.GetObservers()) { observer->DeviceRemoved(bt_device); @@ -137,6 +203,9 @@ void BluetoothClassicMedium::DeviceRemoved(api::BluetoothDevice& device) { } void BluetoothClassicMedium::DeviceAddressChanged( api::BluetoothDevice& device, absl::string_view old_address) { + VLOG(1) << "BT DeviceAddressChanged; name=" << device.GetName() + << ", address=" << device.GetMacAddress() + << ", old_address=" << old_address; BluetoothDevice bt_device(&device); for (auto* observer : observer_list_.GetObservers()) { observer->DeviceAddressChanged(bt_device, old_address); @@ -144,6 +213,9 @@ void BluetoothClassicMedium::DeviceAddressChanged( } void BluetoothClassicMedium::DevicePairedChanged(api::BluetoothDevice& device, bool new_paired_status) { + VLOG(1) << "BT DevicePairedChanged; name=" << device.GetName() + << ", address=" << device.GetMacAddress() + << ", status=" << new_paired_status; BluetoothDevice bt_device(&device); for (auto* observer : observer_list_.GetObservers()) { observer->DevicePairedChanged(bt_device, new_paired_status); @@ -151,6 +223,9 @@ void BluetoothClassicMedium::DevicePairedChanged(api::BluetoothDevice& device, } void BluetoothClassicMedium::DeviceConnectedStateChanged( api::BluetoothDevice& device, bool connected) { + VLOG(1) << "BT DeviceConnectedStateChanged: name=" << device.GetName() + << ", address=" << device.GetMacAddress() + << ", connected=" << connected; BluetoothDevice bt_device(&device); for (auto* observer : observer_list_.GetObservers()) { observer->DeviceConnectedStateChanged(bt_device, connected); diff --git a/internal/platform/bluetooth_classic.h b/internal/platform/bluetooth_classic.h index 1a6b81df..6e47dade 100644 --- a/internal/platform/bluetooth_classic.h +++ b/internal/platform/bluetooth_classic.h @@ -15,14 +15,19 @@ #ifndef PLATFORM_PUBLIC_BLUETOOTH_CLASSIC_H_ #define PLATFORM_PUBLIC_BLUETOOTH_CLASSIC_H_ +#include + #include #include #include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" -#include "absl/container/flat_hash_set.h" +#include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" #include "internal/base/observer_list.h" +#include "internal/platform/blocking_queue_stream.h" #include "internal/platform/bluetooth_adapter.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancellation_flag.h" @@ -34,29 +39,79 @@ #include "internal/platform/logging.h" #include "internal/platform/mutex.h" #include "internal/platform/output_stream.h" +#include "internal/platform/socket.h" namespace nearby { // https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html. -class BluetoothSocket final { +class BluetoothSocket : public MediumSocket { public: - BluetoothSocket() = default; + BluetoothSocket() + : MediumSocket(location::nearby::proto::connections::Medium::BLUETOOTH) { + }; BluetoothSocket(const BluetoothSocket&) = default; BluetoothSocket& operator=(const BluetoothSocket&) = default; + + // Creates a physical BluetoothSocket from a platform implementation. explicit BluetoothSocket(std::unique_ptr socket) - : impl_(socket.release()) {} - ~BluetoothSocket() = default; + : MediumSocket(location::nearby::proto::connections::Medium::BLUETOOTH), + impl_(socket.release()) {} + + // Creates a virtual BluetoothSocket from a virtual output stream. + explicit BluetoothSocket(OutputStream* virtual_output_stream) + : MediumSocket(location::nearby::proto::connections::Medium::BLUETOOTH), + blocking_queue_input_stream_(std::make_shared()), + virtual_output_stream_(virtual_output_stream), + is_virtual_socket_(true) {} + + ~BluetoothSocket() override = default; // Returns the InputStream of this connected BluetoothSocket. - InputStream& GetInputStream() { return impl_->GetInputStream(); } + InputStream& GetInputStream() override { + return IsVirtualSocket() ? *blocking_queue_input_stream_ + : impl_->GetInputStream(); + } // Returns the OutputStream of this connected BluetoothSocket. - OutputStream& GetOutputStream() { return impl_->GetOutputStream(); } + OutputStream& GetOutputStream() override { + return IsVirtualSocket() ? *virtual_output_stream_ + : impl_->GetOutputStream(); + } // Closes both input and output streams, marks Socket as closed. // After this call object should be treated as not connected. // Returns Exception::kIo on error, Exception::kSuccess otherwise. - Exception Close() { return impl_->Close(); } + Exception Close() override { + if (IsVirtualSocket()) { + NEARBY_LOGS(INFO) << "Multiplex: Closing virtual socket: " << this; + blocking_queue_input_stream_->Close(); + virtual_output_stream_->Close(); + CloseLocal(); + return {Exception::kSuccess}; + } + NEARBY_LOGS(INFO) << "Multiplex: Closing physical socket: " << this; + return impl_->Close(); + } + + // Returns true if this is a virtual socket. + bool IsVirtualSocket() override { return is_virtual_socket_; } + + // Creates a virtual socket only with outputstream. + MediumSocket* CreateVirtualSocket(OutputStream* outputstream) override; + MediumSocket* CreateVirtualSocket( + const std::string& salted_service_id_hash_key, OutputStream* outputstream, + location::nearby::proto::connections::Medium medium, + absl::flat_hash_map>* + virtual_sockets_ptr) override; + + /** Feeds the received incoming data to the client. */ + void FeedIncomingData(ByteArray data) override { + if (!IsVirtualSocket()) { + NEARBY_LOGS(INFO) << "Feeding data on a physical socket is not allowed."; + return; + } + blocking_queue_input_stream_->Write(data); + } // https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html#getRemoteDevice() BluetoothDevice GetRemoteDevice() { @@ -73,7 +128,10 @@ class BluetoothSocket final { // BluetoothServerSocket::Accept(). // These methods may also return an invalid socket if connection failed for // any reason. - bool IsValid() const { return impl_ != nullptr; } + bool IsValid() const { + if (is_virtual_socket_) return true; + return impl_ != nullptr; + } // Returns reference to platform implementation. // This is used to communicate with platform code, and for debugging purposes. @@ -84,6 +142,11 @@ class BluetoothSocket final { private: std::shared_ptr impl_; + absl::flat_hash_map>* + virtual_sockets_ptr_ = nullptr; + std::shared_ptr blocking_queue_input_stream_ = nullptr; + OutputStream* virtual_output_stream_ = nullptr; + bool is_virtual_socket_ = false; }; // https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html. diff --git a/internal/platform/bluetooth_classic_test.cc b/internal/platform/bluetooth_classic_test.cc index 3eabdb03..8c3a5f3a 100644 --- a/internal/platform/bluetooth_classic_test.cc +++ b/internal/platform/bluetooth_classic_test.cc @@ -129,7 +129,7 @@ TEST_P(BluetoothClassicMediumTest, CanConnectToService) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch, &discovered_device](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); @@ -178,7 +178,7 @@ TEST_P(BluetoothClassicMediumTest, CanCancelConnect) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch, &discovered_device](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); @@ -234,7 +234,7 @@ TEST_F(BluetoothClassicMediumTest, SendData) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch, &discovered_device](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); @@ -281,7 +281,7 @@ TEST_F(BluetoothClassicMediumTest, IoOnClosedSocketReturnsEmpty) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch, &discovered_device](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); @@ -350,13 +350,13 @@ TEST_F(BluetoothClassicMediumTest, CanStartDiscovery) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); found_latch.CountDown(); }, .device_lost_cb = [this, &lost_latch](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device lost: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device lost: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); lost_latch.CountDown(); }, @@ -379,13 +379,13 @@ TEST_F(BluetoothClassicMediumTest, CanStopDiscovery) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); found_latch.CountDown(); }, .device_lost_cb = [this, &lost_latch](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device lost: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device lost: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); lost_latch.CountDown(); }, @@ -406,7 +406,7 @@ TEST_F(BluetoothClassicMediumTest, CanListenForService) { bt_a_->StartDiscovery(DiscoveryCallback{ .device_discovered_cb = [this, &found_latch](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); found_latch.CountDown(); }, @@ -435,7 +435,7 @@ TEST_F(BluetoothClassicMediumTest, BluetoothPairingSuccess) { CountDownLatch found_latch(1); bt_a_->StartDiscovery( DiscoveryCallback{.device_discovered_cb = [&](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); @@ -507,7 +507,7 @@ TEST_F(BluetoothClassicMediumTest, BluetoothPairingFailure) { CountDownLatch found_latch(1); bt_a_->StartDiscovery( DiscoveryCallback{.device_discovered_cb = [&](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); @@ -569,9 +569,9 @@ TEST_F(BluetoothClassicMediumTest, CancelBluetoothPairing) { CountDownLatch found_latch(1); bt_a_->StartDiscovery( DiscoveryCallback{.device_discovered_cb = [&](BluetoothDevice& device) { - NEARBY_LOG(INFO, "Device discovered: %s", device.GetName().c_str()); - NEARBY_LOG(INFO, "Device discovered address: %s", - device.GetMacAddress().c_str()); + NEARBY_LOGS(INFO) << "Device discovered: " << device.GetName(); + NEARBY_LOGS(INFO) << "Device discovered address: " + << device.GetMacAddress(); EXPECT_EQ(device.GetName(), adapter_b_->GetName()); discovered_device = &device; found_latch.CountDown(); diff --git a/internal/platform/bluetooth_utils.cc b/internal/platform/bluetooth_utils.cc index 18f97b3f..39826a36 100644 --- a/internal/platform/bluetooth_utils.cc +++ b/internal/platform/bluetooth_utils.cc @@ -15,9 +15,15 @@ #include "internal/platform/bluetooth_utils.h" #include +#include +#include +#include "absl/strings/ascii.h" #include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" namespace nearby { diff --git a/internal/platform/bluetooth_utils.h b/internal/platform/bluetooth_utils.h index 83da1993..10d21b85 100644 --- a/internal/platform/bluetooth_utils.h +++ b/internal/platform/bluetooth_utils.h @@ -15,6 +15,9 @@ #ifndef PLATFORM_BASE_BLUETOOTH_UTILS_H_ #define PLATFORM_BASE_BLUETOOTH_UTILS_H_ +#include +#include + #include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" diff --git a/internal/platform/borrowable.h b/internal/platform/borrowable.h index 93fa73c7..f9a07401 100644 --- a/internal/platform/borrowable.h +++ b/internal/platform/borrowable.h @@ -37,14 +37,7 @@ #include #include -#ifdef NEARBY_CHROMIUM -#include "base/check.h" -#elif defined(NEARBY_SWIFTPM) #include "internal/platform/logging.h" -#else -#include "absl/log/check.h" // nogncheck -#endif - #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" diff --git a/internal/platform/byte_array.h b/internal/platform/byte_array.h index 944e5258..2212c0f5 100644 --- a/internal/platform/byte_array.h +++ b/internal/platform/byte_array.h @@ -24,6 +24,7 @@ #include #include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" namespace nearby { diff --git a/internal/platform/byte_utils.cc b/internal/platform/byte_utils.cc index dd2a54d7..19cb771f 100644 --- a/internal/platform/byte_utils.cc +++ b/internal/platform/byte_utils.cc @@ -15,9 +15,11 @@ #include "internal/platform/byte_utils.h" #include +#include #include "absl/strings/str_format.h" #include "internal/platform/base_input_stream.h" +#include "internal/platform/byte_array.h" namespace nearby { diff --git a/internal/platform/byte_utils.h b/internal/platform/byte_utils.h index 9d4690a5..a69ef2d3 100644 --- a/internal/platform/byte_utils.h +++ b/internal/platform/byte_utils.h @@ -15,6 +15,7 @@ #ifndef PLATFORM_BASE_BYTE_UTILS_H_ #define PLATFORM_BASE_BYTE_UTILS_H_ +#include #include "internal/platform/byte_array.h" namespace nearby { diff --git a/internal/platform/condition_variable_test.cc b/internal/platform/condition_variable_test.cc index 9a743a4c..7562d265 100644 --- a/internal/platform/condition_variable_test.cc +++ b/internal/platform/condition_variable_test.cc @@ -14,8 +14,8 @@ #include "internal/platform/condition_variable.h" -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" +#include + #include "gtest/gtest.h" #include "absl/time/time.h" #include "internal/platform/logging.h" @@ -25,6 +25,7 @@ namespace nearby { namespace { +constexpr absl::Duration kWaitTime = absl::Milliseconds(500); TEST(ConditionVariableTest, CanCreate) { Mutex mutex; @@ -36,17 +37,17 @@ TEST(ConditionVariableTest, CanWakeupWaiter) { ConditionVariable cond{&mutex}; bool done = false; bool waiting = false; - NEARBY_LOG(INFO, "At start; done=%d", done); + NEARBY_LOGS(INFO) << "At start; done=" << done; { SingleThreadExecutor executor; executor.Execute([&cond, &mutex, &done, &waiting]() { MutexLock lock(&mutex); - NEARBY_LOG(INFO, "Before cond.Wait(); done=%d", done); + NEARBY_LOGS(INFO) << "Before cond.Wait(); done=" << done; waiting = true; cond.Wait(); waiting = false; done = true; - NEARBY_LOG(INFO, "After cond.Wait(); done=%d", done); + NEARBY_LOGS(INFO) << "After cond.Wait(); done=" << done; }); while (true) { { @@ -61,7 +62,7 @@ TEST(ConditionVariableTest, CanWakeupWaiter) { EXPECT_FALSE(done); } } - NEARBY_LOG(INFO, "After executor shutdown: done=%d", done); + NEARBY_LOGS(INFO) << "After executor shutdown: done=" << done; EXPECT_TRUE(done); } @@ -70,11 +71,13 @@ TEST(ConditionVariableTest, WaitTerminatesOnTimeoutWithoutNotify) { ConditionVariable cond{&mutex}; MutexLock lock(&mutex); - const absl::Duration kWaitTime = absl::Milliseconds(100); absl::Time start = SystemClock::ElapsedRealtime(); cond.Wait(kWaitTime); - absl::Duration duration = SystemClock::ElapsedRealtime() - start; - EXPECT_GE(duration, kWaitTime); + int64_t bias = absl::ToInt64Milliseconds(SystemClock::ElapsedRealtime() - + start - kWaitTime); + + // Windows cannot guarantee the exact time of the timeout. + EXPECT_GE(bias, -100); } } // namespace diff --git a/internal/platform/credential_storage_impl_test.cc b/internal/platform/credential_storage_impl_test.cc index a3a6339c..3089c046 100644 --- a/internal/platform/credential_storage_impl_test.cc +++ b/internal/platform/credential_storage_impl_test.cc @@ -14,10 +14,7 @@ #include "internal/platform/credential_storage_impl.h" -#include -#include #include -#include #include #include @@ -25,6 +22,7 @@ #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "internal/platform/implementation/credential_callbacks.h" #include "internal/proto/credential.pb.h" @@ -67,19 +65,19 @@ SharedCredential CreatePublicCredential(absl::string_view secret_id, std::vector BuildPrivateCreds(absl::string_view secret_id) { std::vector private_credentials = { - CreateLocalCredential(secret_id, IdentityType::IDENTITY_TYPE_PRIVATE), - CreateLocalCredential(secret_id, IdentityType::IDENTITY_TYPE_TRUSTED), CreateLocalCredential(secret_id, - IdentityType::IDENTITY_TYPE_PROVISIONED)}; + IdentityType::IDENTITY_TYPE_PRIVATE_GROUP), + CreateLocalCredential(secret_id, + IdentityType::IDENTITY_TYPE_CONTACTS_GROUP)}; return private_credentials; } std::vector BuildPublicCreds(absl::string_view secret_id) { std::vector public_credentials = { - CreatePublicCredential(secret_id, IdentityType::IDENTITY_TYPE_PRIVATE), - CreatePublicCredential(secret_id, IdentityType::IDENTITY_TYPE_TRUSTED), CreatePublicCredential(secret_id, - IdentityType::IDENTITY_TYPE_PROVISIONED)}; + IdentityType::IDENTITY_TYPE_PRIVATE_GROUP), + CreatePublicCredential(secret_id, + IdentityType::IDENTITY_TYPE_CONTACTS_GROUP)}; return public_credentials; } @@ -450,9 +448,10 @@ TEST_P(IdentityFilterTest, FilterLocalCredentialsByIdentityType) { TEST_P(IdentityFilterTest, FilterLocalCredentialsFailsWhenNoCredentialsMatch) { IdentityType identity_type = GetParam(); // Create a credential of a different identity type than the one we query. - IdentityType other_type = identity_type == IdentityType::IDENTITY_TYPE_PRIVATE - ? IdentityType::IDENTITY_TYPE_TRUSTED - : IdentityType::IDENTITY_TYPE_PRIVATE; + IdentityType other_type = + identity_type == IdentityType::IDENTITY_TYPE_PRIVATE_GROUP + ? IdentityType::IDENTITY_TYPE_CONTACTS_GROUP + : IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; std::vector private_creds = { CreateLocalCredential(kSecretId, other_type)}; CredentialStorageImpl credential_storage; @@ -486,9 +485,10 @@ TEST_P(IdentityFilterTest, FilterPublicCredentialsByIdentityType) { TEST_P(IdentityFilterTest, FilterPublicCredentialsFailsWhenNoCredentialsMatch) { IdentityType identity_type = GetParam(); // Create a credential of a different identity type than the one we query. - IdentityType other_type = identity_type == IdentityType::IDENTITY_TYPE_PRIVATE - ? IdentityType::IDENTITY_TYPE_TRUSTED - : IdentityType::IDENTITY_TYPE_PRIVATE; + IdentityType other_type = + identity_type == IdentityType::IDENTITY_TYPE_PRIVATE_GROUP + ? IdentityType::IDENTITY_TYPE_CONTACTS_GROUP + : IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; std::vector public_creds = { CreatePublicCredential(kSecretId, other_type)}; CredentialStorageImpl credential_storage; @@ -503,9 +503,8 @@ TEST_P(IdentityFilterTest, FilterPublicCredentialsFailsWhenNoCredentialsMatch) { INSTANTIATE_TEST_SUITE_P( CredentialStorageImplTest, IdentityFilterTest, - testing::Values(IdentityType::IDENTITY_TYPE_PRIVATE, - IdentityType::IDENTITY_TYPE_TRUSTED, - IdentityType::IDENTITY_TYPE_PROVISIONED)); + testing::Values(IdentityType::IDENTITY_TYPE_PRIVATE_GROUP, + IdentityType::IDENTITY_TYPE_CONTACTS_GROUP)); } // namespace } // namespace nearby diff --git a/internal/platform/crypto.h b/internal/platform/crypto.h index 0b0bc6aa..1c4b5cb8 100644 --- a/internal/platform/crypto.h +++ b/internal/platform/crypto.h @@ -15,6 +15,6 @@ #ifndef PLATFORM_PUBLIC_CRYPTO_H_ #define PLATFORM_PUBLIC_CRYPTO_H_ -#include "internal/platform/implementation/crypto.h" +#include "internal/platform/implementation/crypto.h" // IWYU pragma: export #endif // PLATFORM_PUBLIC_CRYPTO_H_ diff --git a/internal/platform/crypto_test.cc b/internal/platform/crypto_test.cc index 4967900f..e6e1dff1 100644 --- a/internal/platform/crypto_test.cc +++ b/internal/platform/crypto_test.cc @@ -14,12 +14,29 @@ #include "internal/platform/crypto.h" +#include + +#include +#include + #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "internal/crypto_cros/nearby_base.h" #include "internal/platform/byte_array.h" namespace nearby { +namespace { +// Ensures we don't have all trivial data, i.e. that the data is indeed random. +// Currently, that means the bytes cannot be all the same (e.g. all zeros). +bool IsTrivial(const std::string& bytes) { + for (size_t i = 0; i < bytes.size(); i++) { + if (bytes[i] != bytes[0]) { + return false; + } + } + return true; +} TEST(CryptoTest, Md5GeneratesHash) { const ByteArray expected_md5( @@ -44,4 +61,33 @@ TEST(CryptoTest, Sha256ReturnsEmptyOnError) { EXPECT_EQ(Crypto::Sha256(""), ByteArray{}); } +// Basic functionality tests. Does NOT test the security of the random data. + +TEST(CryptoTest, RandBytes) { + std::string bytes(16, '\0'); + RandBytes(nearbybase::WriteInto(&bytes, bytes.size()), bytes.size()); + EXPECT_TRUE(!IsTrivial(bytes)); +} + +TEST(CryptoTest, RandomString) { + constexpr size_t kSize = 30; + + std::string bytes(kSize, 0); + RandBytes(const_cast(bytes.data()), bytes.size()); + + EXPECT_EQ(bytes.size(), kSize); + EXPECT_TRUE(!IsTrivial(bytes)); +} + +TEST(CryptoTest, RandData) { + uint64_t x = nearby::RandData(); + uint64_t y = nearby::RandData(); + + // Once in a billion years, consecutively generated random numbers will be + // the same and the test will fail. + EXPECT_NE(x, y); + EXPECT_NE(x >> 32, x & 0xFFFFFFFF); +} + +} // namespace } // namespace nearby diff --git a/internal/platform/device_info.h b/internal/platform/device_info.h index c95f592d..8e913ad2 100644 --- a/internal/platform/device_info.h +++ b/internal/platform/device_info.h @@ -15,14 +15,14 @@ #ifndef PLATFORM_PUBLIC_DEVICE_INFO_H_ #define PLATFORM_PUBLIC_DEVICE_INFO_H_ -#include +#include +#include // NOLINT #include #include #include #include "absl/strings/string_view.h" #include "internal/platform/implementation/device_info.h" -#include "internal/platform/implementation/platform.h" namespace nearby { @@ -30,17 +30,16 @@ class DeviceInfo { public: virtual ~DeviceInfo() = default; - virtual std::u16string GetOsDeviceName() const = 0; + // All strings are UTF-8 encoded. + virtual std::string GetOsDeviceName() const = 0; virtual api::DeviceInfo::DeviceType GetDeviceType() const = 0; virtual api::DeviceInfo::OsType GetOsType() const = 0; - virtual std::optional GetFullName() const = 0; - virtual std::optional GetGivenName() const = 0; - virtual std::optional GetLastName() const = 0; - virtual std::optional GetProfileUserName() const = 0; + virtual std::optional GetGivenName() const = 0; virtual std::filesystem::path GetDownloadPath() const = 0; virtual std::filesystem::path GetAppDataPath() const = 0; virtual std::filesystem::path GetTemporaryPath() const = 0; + virtual std::filesystem::path GetLogPath() const = 0; virtual std::optional GetAvailableDiskSpaceInBytes( const std::filesystem::path& path) const = 0; @@ -55,18 +54,18 @@ class DeviceInfo { virtual bool PreventSleep() = 0; virtual bool AllowSleep() = 0; - // Returns localized device name depends on device type. - std::u16string GetDeviceTypeName() const { + // Returns UTF-8 encoded localized device name depending on device type. + std::string GetDeviceTypeName() const { // TODO(b/230132370): return localized device name. switch (GetDeviceType()) { case api::DeviceInfo::DeviceType::kPhone: - return u"Phone"; + return "Phone"; case api::DeviceInfo::DeviceType::kTablet: - return u"Tablet"; + return "Tablet"; case api::DeviceInfo::DeviceType::kLaptop: - return u"PC"; + return "PC"; default: - return u"Unknown"; + return "Unknown"; } } }; diff --git a/internal/platform/device_info_impl.cc b/internal/platform/device_info_impl.cc index 6ac551d5..915b91a9 100644 --- a/internal/platform/device_info_impl.cc +++ b/internal/platform/device_info_impl.cc @@ -14,21 +14,25 @@ #include "internal/platform/device_info_impl.h" +#include +#include // NOLINT #include #include #include -#include +#include "absl/strings/string_view.h" +#include "internal/base/files.h" +#include "internal/platform/implementation/device_info.h" namespace nearby { -std::u16string DeviceInfoImpl::GetOsDeviceName() const { - std::optional device_name = +std::string DeviceInfoImpl::GetOsDeviceName() const { + std::optional device_name = device_info_impl_->GetOsDeviceName(); if (device_name.has_value()) { return *device_name; } - return u"unknown"; + return "unknown"; } api::DeviceInfo::DeviceType DeviceInfoImpl::GetDeviceType() const { @@ -39,29 +43,18 @@ api::DeviceInfo::OsType DeviceInfoImpl::GetOsType() const { return device_info_impl_->GetOsType(); } -std::optional DeviceInfoImpl::GetFullName() const { - return device_info_impl_->GetFullName(); -} - -std::optional DeviceInfoImpl::GetGivenName() const { +std::optional DeviceInfoImpl::GetGivenName() const { return device_info_impl_->GetGivenName(); } -std::optional DeviceInfoImpl::GetLastName() const { - return device_info_impl_->GetLastName(); -} - -std::optional DeviceInfoImpl::GetProfileUserName() const { - return device_info_impl_->GetProfileUserName(); -} - std::filesystem::path DeviceInfoImpl::GetDownloadPath() const { std::optional path = device_info_impl_->GetDownloadPath(); if (path.has_value()) { return *path; } - return std::filesystem::temp_directory_path(); + return nearby::sharing::GetTemporaryDirectory().value_or( + nearby::sharing::CurrentDirectory()); } std::filesystem::path DeviceInfoImpl::GetAppDataPath() const { @@ -70,7 +63,8 @@ std::filesystem::path DeviceInfoImpl::GetAppDataPath() const { if (path.has_value()) { return *path; } - return std::filesystem::temp_directory_path(); + return nearby::sharing::GetTemporaryDirectory().value_or( + nearby::sharing::CurrentDirectory()); } std::filesystem::path DeviceInfoImpl::GetTemporaryPath() const { @@ -79,7 +73,13 @@ std::filesystem::path DeviceInfoImpl::GetTemporaryPath() const { if (path.has_value()) { return *path; } - return std::filesystem::temp_directory_path(); + return nearby::sharing::GetTemporaryDirectory().value_or( + nearby::sharing::CurrentDirectory()); +} + +std::filesystem::path DeviceInfoImpl::GetLogPath() const { + std::optional path = device_info_impl_->GetLogPath(); + return path.value_or(GetTemporaryPath()); } std::optional DeviceInfoImpl::GetAvailableDiskSpaceInBytes( diff --git a/internal/platform/device_info_impl.h b/internal/platform/device_info_impl.h index 98e6032f..eb50f3e7 100644 --- a/internal/platform/device_info_impl.h +++ b/internal/platform/device_info_impl.h @@ -15,13 +15,16 @@ #ifndef PLATFORM_PUBLIC_DEVICE_INFO_IMPL_H_ #define PLATFORM_PUBLIC_DEVICE_INFO_IMPL_H_ -#include +#include +#include // NOLINT #include #include #include #include +#include "absl/strings/string_view.h" #include "internal/platform/device_info.h" +#include "internal/platform/implementation/device_info.h" #include "internal/platform/implementation/platform.h" namespace nearby { @@ -31,18 +34,16 @@ class DeviceInfoImpl : public DeviceInfo { DeviceInfoImpl() : device_info_impl_(api::ImplementationPlatform::CreateDeviceInfo()) {} - std::u16string GetOsDeviceName() const override; + std::string GetOsDeviceName() const override; api::DeviceInfo::DeviceType GetDeviceType() const override; api::DeviceInfo::OsType GetOsType() const override; - std::optional GetFullName() const override; - std::optional GetGivenName() const override; - std::optional GetLastName() const override; - std::optional GetProfileUserName() const override; + std::optional GetGivenName() const override; std::filesystem::path GetDownloadPath() const override; std::filesystem::path GetAppDataPath() const override; std::filesystem::path GetTemporaryPath() const override; + std::filesystem::path GetLogPath() const override; std::optional GetAvailableDiskSpaceInBytes( const std::filesystem::path& path) const override; diff --git a/internal/platform/feature_flags.h b/internal/platform/feature_flags.h index d4202188..f1237202 100644 --- a/internal/platform/feature_flags.h +++ b/internal/platform/feature_flags.h @@ -17,6 +17,7 @@ #include +#include "absl/base/thread_annotations.h" #include "absl/synchronization/mutex.h" #include "absl/time/time.h" @@ -45,7 +46,7 @@ class FeatureFlags { bool enable_send_payload_offset = true; // Provide better bookkeeping for bandwidth upgrade initiation. This is // necessary to properly support multiple BWU mediums, multiple service, and - // multiple endpionts. + // multiple endpoints. bool support_multiple_bwu_mediums = true; // Allows the code to change the bluetooth radio state bool enable_set_radio_state = false; @@ -53,7 +54,7 @@ class FeatureFlags { // create connection with remote device in a duration. bool enable_connection_timeout = true; // Controls enable or disable to track the status of Bluetooth classic - // conncetion. + // connection. bool enable_bluetooth_connection_status_track = true; // Controls enable or disable BLE scan advertisement for fast pair // service uuid 0x2cfe @@ -62,18 +63,58 @@ class FeatureFlags { // requested service id before attempting to connect over rfcomm. SDP fails // on Windows when connecting to FP service id but the rfcomm is successful. bool skip_service_discovery_before_connecting_to_rfcomm = false; + // Controls enable or disable the use of async methods for StartScanning + // and StopScanning for BLE V2. + // TODO(b/333408829): Add flag to control async advertising. + bool enable_ble_v2_async_scanning = false; + // Enable legacy device discovered callback being used inside ble v2 + // DiscoverPeripheralTracker flow. + bool enable_invoking_legacy_device_discovered_cb = false; + + // Enable 1. safe-to-disconnect check 2. reserved 3. auto-reconnect 4. + // auto-resume 5. non-distance-constraint-recovery 6. payload_ack std::int32_t min_nc_version_supports_safe_to_disconnect = 1; + std::int32_t min_nc_version_supports_auto_reconnect = 3; + absl::Duration auto_reconnect_retry_delay_millis = absl::Milliseconds(5000); + absl::Duration auto_reconnect_timeout_millis = absl::Milliseconds(30000); + std::int32_t auto_reconnect_retry_attempts = 3; + absl::Duration auto_reconnect_skip_duplicated_endpoint_duration = + absl::Milliseconds(4000); // Android code won't be able to launch "payload_received_ack" feature for // in near future, so change "payload_received_ack" version from "2" to "5" // after auto-reconnect and auto-resume. - std::int32_t min_nc_version_supports_payload_received_ack = 5; + std::int32_t min_nc_version_supports_payload_received_ack = 6; // If the other part doesn't ack the safe_to_disconnect request, the // initiator will end the connection in 30s. absl::Duration safe_to_disconnect_ack_delay_millis = absl::Milliseconds(30000); + absl::Duration safe_to_disconnect_remote_disc_delay_millis = + absl::Milliseconds(10000); + absl::Duration safe_to_disconnect_auto_resume_timeout_millis = + absl::Milliseconds(60000); // If the receiver doesn't ack with payload_received_ack frame in 1s, the // sender will timeout the waiting. absl::Duration wait_payload_received_ack_millis = absl::Milliseconds(1000); + + // Multiplex related flags + // Timeout value for read frame operation in endpoint channel. + absl::Duration mediums_frame_read_timeout_millis = + absl::Milliseconds(15000); + // Timeout value for write frame operation in endpoint channel. + absl::Duration mediums_frame_write_timeout_millis = + absl::Milliseconds(15000); + // The timeout for waiting on connection request response. + absl::Duration multiplex_socket_connection_response_timeout_millis = + absl::Milliseconds(3000); + // The capacity of the middle priority queue inner MultiplexOutputStream. + // The new outgoing frame with the middle priority will wait for space to + // become available if the queue is full.' + std::uint32_t multiplex_socket_middle_priority_queue_capacity = 50; + // The maximum size of frame we'll attempt to read, to avoid a remote device + // from triggering an OutOfMemory error. + std::uint32_t connection_max_frame_length = 1048576; + std::uint32_t blocking_queue_stream_queue_capacity = 10; + bool support_web_rtc_non_cellular_medium = false; }; static const FeatureFlags& GetInstance() { diff --git a/internal/platform/feature_flags_test.cc b/internal/platform/feature_flags_test.cc index e6e4eedd..c4f24ee6 100644 --- a/internal/platform/feature_flags_test.cc +++ b/internal/platform/feature_flags_test.cc @@ -25,6 +25,15 @@ constexpr FeatureFlags::Flags kTestFeatureFlags{ .keep_alive_interval_millis = 5000, .keep_alive_timeout_millis = 30000}; +TEST(FeatureFlagsTest, CastUpdateWorks) { + const FeatureFlags& features = FeatureFlags::GetInstance(); + EXPECT_TRUE(features.GetFlags().enable_async_bandwidth_upgrade); + const_cast(FeatureFlags::GetInstance()) + .SetFlags({.enable_async_bandwidth_upgrade = false}); + + EXPECT_FALSE(features.GetFlags().enable_async_bandwidth_upgrade); +} + TEST(FeatureFlagsTest, ToSetFeatureWorks) { const FeatureFlags& features = FeatureFlags::GetInstance(); EXPECT_TRUE(features.GetFlags().enable_cancellation_flag); diff --git a/internal/platform/flags/BUILD b/internal/platform/flags/BUILD index 327cf1d6..f652d6ae 100644 --- a/internal/platform/flags/BUILD +++ b/internal/platform/flags/BUILD @@ -19,10 +19,10 @@ cc_library( "nearby_platform_feature_flags.h", ], visibility = [ - "//connections:__subpackages__", "//fastpair:__subpackages__", "//internal:__subpackages__", "//location/nearby/cpp:__subpackages__", + "//location/nearby/testing:__subpackages__", ], deps = [ "//internal/flags:flag_reader", diff --git a/internal/platform/flags/nearby_platform_feature_flags.h b/internal/platform/flags/nearby_platform_feature_flags.h index 934574e8..6236fd6b 100644 --- a/internal/platform/flags/nearby_platform_feature_flags.h +++ b/internal/platform/flags/nearby_platform_feature_flags.h @@ -65,6 +65,18 @@ constexpr auto kWifiHotspotConnectionIntervalMillis = constexpr auto kWifiHotspotConnectionTimeoutMillis = flags::Flag(kConfigPackage, "45415888", 10000); +// Enable/Disable Intel PIe SDK to query/set WIFI feature. +constexpr auto kEnableIntelPieSdk = + flags::Flag(kConfigPackage, "45428547", false); + +// Enable/Disable new Bluetooth refactor +constexpr auto kEnableNewBluetoothRefactor = + flags::Flag(kConfigPackage, "45615156", false); + +// Enable/Disable task scheduler for ScheduledExecutor and timer +constexpr auto kEnableTaskScheduler = + flags::Flag(kConfigPackage, "45643835", false); + } // namespace nearby_platform_feature } // namespace config_package_nearby } // namespace platform diff --git a/internal/platform/future.h b/internal/platform/future.h index 9c7b44c4..9cd2a2c0 100644 --- a/internal/platform/future.h +++ b/internal/platform/future.h @@ -15,8 +15,12 @@ #ifndef PLATFORM_PUBLIC_FUTURE_H_ #define PLATFORM_PUBLIC_FUTURE_H_ +#include #include +#include "absl/time/time.h" +#include "internal/platform/exception.h" +#include "internal/platform/implementation/executor.h" #include "internal/platform/settable_future.h" namespace nearby { diff --git a/internal/platform/future_test.cc b/internal/platform/future_test.cc index 821a9dc5..c7c75d3c 100644 --- a/internal/platform/future_test.cc +++ b/internal/platform/future_test.cc @@ -78,7 +78,7 @@ TEST(FutureTest, SupportScopedEnum) { } TEST(FutureTest, SetTakesCopyOfValue) { - // Default constructor is zero-initalizing all data in BigSizedStruct. + // Default constructor is zero-initializing all data in BigSizedStruct. BigSizedStruct v1; Future future; v1.data[0] = 5; // Changing value before calling Set() will affect stored diff --git a/internal/platform/implementation/BUILD b/internal/platform/implementation/BUILD index d1743993..e9aee3bf 100644 --- a/internal/platform/implementation/BUILD +++ b/internal/platform/implementation/BUILD @@ -13,6 +13,25 @@ # limitations under the License. licenses(["notice"]) +cc_library( + name = "account_manager", + hdrs = ["account_manager.h"], + visibility = [ + "//fastpair:__subpackages__", + "//internal/account:__pkg__", + "//internal/platform/implementation:__subpackages__", + "//internal/test:__subpackages__", + "//location/nearby/cpp/sharing/clients/cpp:__subpackages__", + "//location/nearby/sharing/sdk/quick_share_server:__pkg__", + "//sharing:__subpackages__", + ], + deps = [ + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/status", + "@com_google_absl//absl/strings:string_view", + ], +) + cc_library( name = "types", hdrs = [ @@ -39,6 +58,7 @@ cc_library( "timer.h", ], visibility = [ + "//connections/implementation:__subpackages__", "//connections/implementation/analytics:__subpackages__", "//fastpair:__subpackages__", "//internal/crypto_cros:__pkg__", @@ -47,14 +67,14 @@ cc_library( "//internal/preferences:__subpackages__", "//internal/test:__subpackages__", "//location/nearby/analytics/cpp:__subpackages__", - "//location/nearby/cpp/common:__subpackages__", "//location/nearby/cpp/sharing:__subpackages__", "//presence:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ "//internal/crypto_cros", "//internal/platform:base", + "//internal/platform/implementation/shared:crypto", # Non-chromium impl "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/strings", @@ -64,6 +84,24 @@ cc_library( ], ) +cc_library( + name = "wifi_utils", + srcs = [ + "wifi_utils.cc", + ], + hdrs = [ + "wifi.h", + "wifi_utils.h", + ], + visibility = [ + "//:__subpackages__", + ], + deps = [ + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + ], +) + cc_library( name = "comm", hdrs = [ @@ -84,11 +122,11 @@ cc_library( copts = ["-DNO_WEBRTC"], visibility = [ "//connections/implementation:__subpackages__", - "//fastpair/internal:__pkg__", "//fastpair/internal/mediums:__pkg__", "//internal/network:__subpackages__", "//internal/platform:__pkg__", "//internal/platform/implementation:__subpackages__", + "//presence:__subpackages__", "//presence/implementation:__subpackages__", ], deps = [ @@ -121,8 +159,9 @@ cc_library( "//internal/platform:__pkg__", "//internal/platform/implementation:__subpackages__", "//location/nearby/analytics/cpp:__subpackages__", + "//location/nearby/apps/better_together/plugins/preferences_native:__subpackages__", "//location/nearby/cpp/sharing:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ ":comm", @@ -132,3 +171,17 @@ cc_library( "@com_google_absl//absl/strings", ], ) + +cc_test( + name = "wifi_utils_test", + size = "small", + timeout = "moderate", + srcs = ["wifi_utils_test.cc"], + shard_count = 8, + deps = [ + ":wifi_utils", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/internal/platform/implementation/account_manager.h b/internal/platform/implementation/account_manager.h new file mode 100644 index 00000000..366efdd8 --- /dev/null +++ b/internal/platform/implementation/account_manager.h @@ -0,0 +1,104 @@ +// Copyright 2022 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 PLATFORM_API_ACCOUNT_MANAGER_H_ +#define PLATFORM_API_ACCOUNT_MANAGER_H_ + +#include +#include +#include + +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" +#include "absl/strings/string_view.h" + +namespace nearby { + +// AccountManager manages the accounts are used to access Nearby backend. +// In current design, AccountManager only support one active account. +class AccountManager { + public: + // Describes a Nearby account. The account class will have more properties + // and methods in the future based on the new feature added. + struct Account { + std::string id; // The unique identify of the account. + std::string display_name; + std::string family_name; + std::string given_name; + std::string picture_url; + std::string email; + }; + + // Observes the activity of the account manager. + class Observer { + public: + virtual ~Observer() = default; + + virtual void OnLoginSucceeded(absl::string_view account_id) = 0; + // |credential_error| is true if the logout is due to critical auth error. + virtual void OnLogoutSucceeded(absl::string_view account_id, + bool credential_error) = 0; + }; + + virtual ~AccountManager() = default; + + // Gets current active account. If no login user, return std::nullopt. + virtual std::optional GetCurrentAccount() = 0; + + // Initializes the login process for a Google account from 1P client. + // |login_success_callback| is called when the login succeeded. Account + // information is passed to callback. + // |login_failure_callback| is called when the login fails. + virtual void Login( + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback) = 0; + + // Initializes the login process for a Google account from an oauth client. + // |client_id| GCP client_id of the client + // |client_secret| GCP client_secret of the client + // |login_success_callback| is called when the login succeeded. Account + // information is passed to callback. + // |login_failure_callback| is called when the login fails. + virtual void Login( + absl::string_view client_id, absl::string_view client_secret, + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback) = 0; + + // Logs out current active account. |logout_callback| is called when logout is + // completed. + virtual void Logout( + absl::AnyInvocable logout_callback) = 0; + + // Gets access token for the active account. + // |success_callback| is called when an access token is fetched successfully. + // |failure_callback| is called when fetching an access token failed. + // + // Returns false if account_id is empty or callback is null. + virtual bool GetAccessToken( + absl::string_view account_id, + absl::AnyInvocable success_callback, + absl::AnyInvocable failure_callback) = 0; + + // Returns a pair containing the client id and client secret used in the most + // recent Login request. + // If no current user is logged in, returns empty string for both. + virtual std::pair GetOAuthClientCredential() = 0; + + virtual void AddObserver(Observer* observer) = 0; + virtual void RemoveObserver(Observer* observer) = 0; +}; + +} // namespace nearby + +#endif // PLATFORM_API_ACCOUNT_MANAGER_H_ diff --git a/internal/platform/implementation/apple/BUILD b/internal/platform/implementation/apple/BUILD index 0e2b044e..14912f31 100644 --- a/internal/platform/implementation/apple/BUILD +++ b/internal/platform/implementation/apple/BUILD @@ -17,7 +17,7 @@ package(default_visibility = [ "//connections:__subpackages__", "//internal/platform/implementation/apple:__subpackages__", "//location/nearby:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ]) objc_library( @@ -25,7 +25,6 @@ objc_library( srcs = [ "crypto.mm", "device_info.mm", - "log_message.mm", "multi_thread_executor.mm", "platform.mm", "preferences_manager.mm", @@ -35,7 +34,6 @@ objc_library( ], hdrs = [ "device_info.h", - "log_message.h", "multi_thread_executor.h", "preferences_manager.h", "scheduled_executor.h", @@ -50,23 +48,25 @@ objc_library( ":Platform_cc", ":Shared", ":ble_v2", - "//internal/platform:base", - "//internal/platform/implementation:comm", - "//internal/platform/implementation:platform", - "//internal/platform/implementation:types", - "//internal/platform/implementation/apple/Mediums", - "//internal/platform/implementation/shared:file", - "//third_party/apple_frameworks:CoreBluetooth", - "//third_party/apple_frameworks:Foundation", - "//third_party/apple_frameworks:Network", - "//third_party/objective_c/google_toolbox_for_mac:GTM_Logger", + # Required Reason API File: third_party/nearby/internal/platform/implementation/apple/preferences_manager.mm + "//releasetools/apple/privacy/privacymanifests/requiredreasonsapi:user_defaults-user_defaults-read_write_app_data_ca92_1", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:span", + "//third_party/apple_frameworks:CoreBluetooth", + "//third_party/apple_frameworks:Foundation", + "//third_party/apple_frameworks:Network", "@nlohmann_json//:json", + "//internal/platform:base", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:platform", + "//internal/platform/implementation:types", + "//internal/platform/implementation/apple/Mediums", + "//internal/platform/implementation/shared:file", + "//third_party/objective_c/google_toolbox_for_mac:GTM_Logger", ] + select({ "@platforms//os:platform_ios": [ "//third_party/apple_frameworks:UIKit", @@ -148,8 +148,10 @@ cc_library( "mutex.h", ], deps = [ + "//internal/platform:base", "//internal/platform/implementation:platform", "//internal/platform/implementation:types", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", @@ -168,6 +170,7 @@ cc_test( shard_count = 16, deps = [ ":Platform_cc", + "//internal/platform/implementation/g3:crypto", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", diff --git a/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h b/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h index f41f8f00..fd35919e 100644 --- a/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h +++ b/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h @@ -49,6 +49,14 @@ typedef void (^GNCGetCharacteristicCompletionHandler)( typedef void (^GNCReadCharacteristicValueCompletionHandler)(NSData *_Nullable value, NSError *_Nullable error); +/** + * A block to be invoked after a call to @c disconnect, requesting that the local connection to the + * remote peripheral be cancelled. + * + * @param peripheral The remote peripheral to disconnect from. + */ +typedef void (^GNCRequestDisconnectionHandler)(id peripheral); + /** * An object that can be used to discover, explore, and interact with GATT services and * characteristics available on a remote peripheral. @@ -64,8 +72,11 @@ typedef void (^GNCReadCharacteristicValueCompletionHandler)(NSData *_Nullable va * Initializes the GATT client with a specified peripheral. * * @param peripheral The peripheral instance. + * @param requestDisconnectionHandler Called on a private queue with @c peripheral when the + * connection to the peripheral should be cancelled. */ -- (instancetype)initWithPeripheral:(id)peripheral; +- (instancetype)initWithPeripheral:(id)peripheral + requestDisconnectionHandler:(GNCRequestDisconnectionHandler)requestDisconnectionHandler; /** * Discovers the specified characteristics of a service. @@ -112,6 +123,9 @@ typedef void (^GNCReadCharacteristicValueCompletionHandler)(NSData *_Nullable va completionHandler: (nullable GNCReadCharacteristicValueCompletionHandler)completionHandler; +/** Cancels an active or pending local connection to a peripheral. */ +- (void)disconnect; + @end NS_ASSUME_NONNULL_END diff --git a/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.m b/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.m index 8b91c879..8f23477a 100644 --- a/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.m +++ b/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.m @@ -49,6 +49,7 @@ static NSError *AlreadyReadingCharacteristicError() { @implementation GNCBLEGATTClient { dispatch_queue_t _queue; id _peripheral; + GNCRequestDisconnectionHandler _requestDisconnectionHandler; /** * A map of service UUIDs with each service holding a map of a list of characterisitcs to a @@ -70,15 +71,18 @@ static NSError *AlreadyReadingCharacteristicError() { *_readCharacteristicValueCompletionHandlers; } -- (instancetype)initWithPeripheral:(id)peripheral { - return [self - initWithPeripheral:peripheral - queue:dispatch_queue_create(kGNCBLEGATTClientQueueLabel, DISPATCH_QUEUE_SERIAL)]; +- (instancetype)initWithPeripheral:(id)peripheral + requestDisconnectionHandler:(GNCRequestDisconnectionHandler)requestDisconnectionHandler { + return [self initWithPeripheral:peripheral + queue:dispatch_queue_create(kGNCBLEGATTClientQueueLabel, + DISPATCH_QUEUE_SERIAL) + requestDisconnectionHandler:requestDisconnectionHandler]; }; // Private. - (instancetype)initWithPeripheral:(id)peripheral - queue:(nullable dispatch_queue_t)queue { + queue:(nullable dispatch_queue_t)queue + requestDisconnectionHandler:(GNCRequestDisconnectionHandler)requestDisconnectionHandler { self = [super init]; if (self) { _queue = queue ?: dispatch_get_main_queue(); @@ -86,6 +90,7 @@ static NSError *AlreadyReadingCharacteristicError() { _peripheral.peripheralDelegate = self; _discoverCharacteristicsCompletionHandlers = [[NSMutableDictionary alloc] init]; _readCharacteristicValueCompletionHandlers = [[NSMutableDictionary alloc] init]; + _requestDisconnectionHandler = requestDisconnectionHandler; } return self; }; @@ -173,6 +178,12 @@ static NSError *AlreadyReadingCharacteristicError() { }); } +- (void)disconnect { + dispatch_async(_queue, ^{ + _requestDisconnectionHandler(_peripheral); + }); +} + #pragma mark - Internal - (CBCharacteristic *)synchronousCharacteristicWithUUID:(CBUUID *)characteristicUUID diff --git a/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.m b/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.m index 139b5169..7c7d96ef 100644 --- a/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.m +++ b/internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEMedium.m @@ -245,7 +245,13 @@ static NSError *AlreadyScanningError() { GNCGATTConnectionCompletionHandler handler = _connectionCompletionHandlers[peripheral.identifier]; _connectionCompletionHandlers[peripheral.identifier] = nil; if (handler) { - GNCBLEGATTClient *client = [[GNCBLEGATTClient alloc] initWithPeripheral:peripheral]; + GNCBLEGATTClient *client = + [[GNCBLEGATTClient alloc] initWithPeripheral:peripheral + requestDisconnectionHandler:^(id peripheral) { + dispatch_async(_queue, ^{ + [_centralManager cancelPeripheralConnection:peripheral]; + }); + }]; handler(client, nil); } } diff --git a/internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h b/internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h index 770377ea..13057c39 100644 --- a/internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h +++ b/internal/platform/implementation/apple/Mediums/BLEv2/GNCCentralManager.h @@ -79,6 +79,21 @@ NS_ASSUME_NONNULL_BEGIN - (void)connectPeripheral:(id)peripheral options:(nullable NSDictionary *)options; +/** + * Cancels an active or pending local connection to a peripheral. + * + * This method is nonblocking, and any @c CBPeripheral class commands that are still pending to + * @c peripheral may not complete. Because other apps may still have a connection to the peripheral, + * canceling a local connection doesn’t guarantee that the underlying physical link is immediately + * disconnected. From the app’s perspective, however, the peripheral is effectively disconnected, + * and the central manager object calls the @c centralManager:didDisconnectPeripheral:error: method + * of its delegate object. + * + * @param peripheral The peripheral to which the central manager is either trying to connect or has + * already connected. + */ +- (void)cancelPeripheralConnection:(id)peripheral; + /** Asks the central manager to stop scanning for peripherals. */ - (void)stopScan; diff --git a/internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.mm b/internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.mm index 34e78407..05b01341 100644 --- a/internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.mm +++ b/internal/platform/implementation/apple/Mediums/Ble/GNCMBleUtils.mm @@ -50,7 +50,7 @@ NSData *GNCMGenerateBLEFramesIntroductionPacket(NSData *serviceIDHash) { return packet; } -NSData *GNCMParseBLEFramesIntroductionPacket(NSData *data) { +NSData *_Nullable GNCMParseBLEFramesIntroductionPacket(NSData *data) { ::location::nearby::mediums::SocketControlFrame socket_control_frame; NSUInteger prefixLength = sizeof(kGNCMControlPacketServiceIDHash); NSData *packet = [data subdataWithRange:NSMakeRange(prefixLength, data.length - prefixLength)]; diff --git a/internal/platform/implementation/apple/Mediums/Ble/Sockets/BUILD b/internal/platform/implementation/apple/Mediums/Ble/Sockets/BUILD index 255b6a1b..20053ca3 100644 --- a/internal/platform/implementation/apple/Mediums/Ble/Sockets/BUILD +++ b/internal/platform/implementation/apple/Mediums/Ble/Sockets/BUILD @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//tools/build_defs/swift:swift_explicit_module_build_test.bzl", "swift_explicit_module_build_test") load("//third_party/nearby:minimum_os.bzl", "IOS_MINIMUM_OS") +load("//tools/build_defs/swift:swift_explicit_module_build_test.bzl", "swift_explicit_module_build_test") licenses(["notice"]) @@ -32,9 +32,7 @@ objc_library( deps = [ ":Shared", "//third_party/apple_frameworks:CoreBluetooth", - "//third_party/apple_frameworks:CoreFoundation", "//third_party/apple_frameworks:Foundation", - "//third_party/apple_frameworks:QuartzCore", "//third_party/objective_c/google_toolbox_for_mac:GTM_Logger", ], ) diff --git a/internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.m b/internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.m index e53475b8..4e481a3c 100644 --- a/internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.m +++ b/internal/platform/implementation/apple/Mediums/Ble/Sockets/Source/Central/GNSCentralPeerManager.m @@ -728,7 +728,11 @@ static NSString *PeripheralStateString(CBPeripheralState state) { packet.version); [_connectionConfirmTimer invalidate]; _connectionConfirmTimer = nil; - _socket.packetSize = packet.packetSize; + // Weave is using `CBCharacteristicWriteWithResponse` for writes, so we must query max value since + // it can have a smaller value than the `GNSWeaveConnectionConfirmPacket` size. + NSUInteger maxWriteLength = + [_socket.peerAsPeripheral maximumWriteValueLengthForType:CBCharacteristicWriteWithResponse]; + _socket.packetSize = MIN(packet.packetSize, maxWriteLength); [_socket didConnect]; if (packet.data) { // According to the Weave BLE protocol the data received during the connection handshake should diff --git a/internal/platform/implementation/apple/Tests/BUILD b/internal/platform/implementation/apple/Tests/BUILD index d10e8cc3..c11daf73 100644 --- a/internal/platform/implementation/apple/Tests/BUILD +++ b/internal/platform/implementation/apple/Tests/BUILD @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("//tools/build_defs/apple:ios.bzl", "ios_unit_test") load("//third_party/nearby:minimum_os.bzl", "IOS_LATEST_TEST_RUNNER", "IOS_MINIMUM_OS") +load("//tools/build_defs/apple:ios.bzl", "ios_unit_test") licenses(["notice"]) diff --git a/internal/platform/implementation/apple/Tests/GNCBLEGATTClient+Testing.h b/internal/platform/implementation/apple/Tests/GNCBLEGATTClient+Testing.h index a3a52f65..035138fd 100644 --- a/internal/platform/implementation/apple/Tests/GNCBLEGATTClient+Testing.h +++ b/internal/platform/implementation/apple/Tests/GNCBLEGATTClient+Testing.h @@ -31,9 +31,12 @@ NS_ASSUME_NONNULL_BEGIN * @param peripheral The peripheral instance. * @param queue The queue to run on, this must match the queue that the peripheral's delegate is * running on. Defaults to the main queue when @c nil. + * @param requestDisconnectionHandler Called on a private queue with @c peripheral when the + * connection to the peripheral should be cancelled. */ - (instancetype)initWithPeripheral:(id)peripheral - queue:(nullable dispatch_queue_t)queue; + queue:(nullable dispatch_queue_t)queue + requestDisconnectionHandler:(GNCRequestDisconnectionHandler)requestDisconnectionHandler; @end diff --git a/internal/platform/implementation/apple/Tests/GNCBLEGATTClientTest.m b/internal/platform/implementation/apple/Tests/GNCBLEGATTClientTest.m index b53cdef7..4fca9a78 100644 --- a/internal/platform/implementation/apple/Tests/GNCBLEGATTClientTest.m +++ b/internal/platform/implementation/apple/Tests/GNCBLEGATTClientTest.m @@ -19,6 +19,7 @@ #import #import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTCharacteristic.h" +#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h" #import "internal/platform/implementation/apple/Tests/GNCBLEGATTClient+Testing.h" #import "internal/platform/implementation/apple/Tests/GNCFakePeripheral.h" @@ -37,8 +38,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testDiscoverCharacteristics { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -64,8 +68,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 fakePeripheral.discoverServicesError = [NSError errorWithDomain:@"fake" code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -97,8 +104,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -123,8 +133,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testDuplicateDiscoverCharacteristics { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -163,8 +176,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testDiscoverCharacteristicsMultipleCallsWithDifferentServices { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID1 = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *serviceUUID2 = [CBUUID UUIDWithString:kServiceUUID2]; @@ -209,8 +225,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testDiscoverCharacteristicsMultipleCallsWithDifferentCharacteristics { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID1 = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -256,8 +275,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testGetCharacteristic { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -287,8 +309,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 fakePeripheral.discoverServicesError = [NSError errorWithDomain:@"fake" code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -324,8 +349,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -353,8 +381,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testDuplicateGetCharacteristic { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -400,8 +431,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testGetNonExistentCharacteristic { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -425,8 +459,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testReadValueForCharacteristic { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -461,8 +498,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 fakePeripheral.discoverServicesError = [NSError errorWithDomain:@"fake" code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -503,8 +543,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -541,8 +584,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 code:0 userInfo:nil]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -576,8 +622,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testDuplicateReadValueForCharacteristic { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -630,8 +679,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testReadValueForMultipleCharacteristics { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID1 = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -691,8 +743,11 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 - (void)testReadValueForUndiscoveredCharacteristic { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; @@ -714,13 +769,33 @@ static NSString *const kCharacteristicUUID2 = @"00000000-0000-3000-8000-00000000 [self waitForExpectations:@[ expectation ] timeout:3]; } +- (void)testDisconnect { + GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; + XCTestExpectation *expectation = [[XCTestExpectation alloc] initWithDescription:@"Disconnect."]; + + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id peripheral) { + XCTAssertNotNil(peripheral); + [expectation fulfill]; + }]; + + [gattClient disconnect]; + + [self waitForExpectations:@[ expectation ] timeout:3]; +} + #pragma mark - Delegate Calls - (void)testUnexpectedDelegateCalls { GNCFakePeripheral *fakePeripheral = [[GNCFakePeripheral alloc] init]; - GNCBLEGATTClient *gattClient = [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral - queue:nil]; + GNCBLEGATTClient *gattClient = + [[GNCBLEGATTClient alloc] initWithPeripheral:fakePeripheral + queue:nil + requestDisconnectionHandler:^(id __unused peripheral){ + }]; CBUUID *serviceUUID = [CBUUID UUIDWithString:kServiceUUID1]; CBUUID *characteristicUUID = [CBUUID UUIDWithString:kCharacteristicUUID1]; diff --git a/internal/platform/implementation/apple/Tests/GNCBLEMediumTest.m b/internal/platform/implementation/apple/Tests/GNCBLEMediumTest.m index 47121133..33cea03b 100644 --- a/internal/platform/implementation/apple/Tests/GNCBLEMediumTest.m +++ b/internal/platform/implementation/apple/Tests/GNCBLEMediumTest.m @@ -18,6 +18,7 @@ #import #import +#import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTClient.h" #import "internal/platform/implementation/apple/Mediums/BLEv2/GNCBLEGATTServer.h" #import "internal/platform/implementation/apple/Mediums/BLEv2/GNCPeripheral.h" #import "internal/platform/implementation/apple/Tests/GNCBLEMedium+Testing.h" @@ -313,8 +314,6 @@ static NSString *const kServiceUUID = @"0000FEF3-0000-1000-8000-00805F9B34FB"; - (void)testDisconnect { GNCFakeCentralManager *fakeCentralManager = [[GNCFakeCentralManager alloc] init]; GNCBLEMedium *medium = [[GNCBLEMedium alloc] initWithCentralManager:fakeCentralManager queue:nil]; - XCTestExpectation *connectExpectation = - [[XCTestExpectation alloc] initWithDescription:@"Connect."]; XCTestExpectation *disconnectExpectation = [[XCTestExpectation alloc] initWithDescription:@"Disconnect."]; @@ -327,13 +326,9 @@ static NSString *const kServiceUUID = @"0000FEF3-0000-1000-8000-00805F9B34FB"; completionHandler:^(GNCBLEGATTClient *client, NSError *error) { XCTAssertNotNil(client); XCTAssertNil(error); - [connectExpectation fulfill]; + [client disconnect]; }]; - [self waitForExpectations:@[ connectExpectation ] timeout:3]; - - [fakeCentralManager simulateCentralManagerDidDisconnectPeripheral:peripheral]; - [self waitForExpectations:@[ disconnectExpectation ] timeout:3]; } diff --git a/internal/platform/implementation/apple/Tests/GNCFakeCentralManager.m b/internal/platform/implementation/apple/Tests/GNCFakeCentralManager.m index dc080f7e..30867e1b 100644 --- a/internal/platform/implementation/apple/Tests/GNCFakeCentralManager.m +++ b/internal/platform/implementation/apple/Tests/GNCFakeCentralManager.m @@ -56,6 +56,10 @@ [centralDelegate gnc_centralManager:self didConnectPeripheral:peripheral]; } +- (void)cancelPeripheralConnection:(id)peripheral { + [centralDelegate gnc_centralManager:self didDisconnectPeripheral:peripheral error:nil]; +} + - (void)stopScan { } diff --git a/internal/platform/implementation/apple/ble_gatt_client.mm b/internal/platform/implementation/apple/ble_gatt_client.mm index 13cbb684..a5dc5055 100644 --- a/internal/platform/implementation/apple/ble_gatt_client.mm +++ b/internal/platform/implementation/apple/ble_gatt_client.mm @@ -127,8 +127,9 @@ bool GattClient::SetCharacteristicSubscription( return false; } -// TODO(b/290385712): Implement. -void GattClient::Disconnect() {} +void GattClient::Disconnect() { + [gatt_client_ disconnect]; +} } // namespace apple } // namespace nearby diff --git a/internal/platform/implementation/apple/ble_medium.mm b/internal/platform/implementation/apple/ble_medium.mm index 9c1f6a55..f7bb3b0a 100644 --- a/internal/platform/implementation/apple/ble_medium.mm +++ b/internal/platform/implementation/apple/ble_medium.mm @@ -145,9 +145,15 @@ void BleMedium::HandleAdvertisementFound(id peripheral, std::unique_ptr BleMedium::StartScanning( const Uuid &service_uuid, api::ble_v2::TxPowerLevel tx_power_level, api::ble_v2::BleMedium::ScanningCallback callback) { + absl::MutexLock lock(&peripherals_mutex_); CBUUID *serviceUUID = CBUUID128FromCPP(service_uuid); scanning_cb_ = std::move(callback); + // Clear the map of discovered peripherals only when we are starting a new scan. If we cleared the + // map every time we stopped a scan, we would not be able to connect to peripherals that we + // discovered in that scan session. + peripherals_.clear(); + socketCentralManager_ = [[GNSCentralManager alloc] initWithSocketServiceUUID:serviceUUID]; [socketCentralManager_ startNoScanModeWithAdvertisedServiceUUIDs:@[ serviceUUID ]]; @@ -171,9 +177,15 @@ std::unique_ptr BleMedium::StartScannin bool BleMedium::StartScanning(const Uuid &service_uuid, api::ble_v2::TxPowerLevel tx_power_level, api::ble_v2::BleMedium::ScanCallback callback) { + absl::MutexLock lock(&peripherals_mutex_); CBUUID *serviceUUID = CBUUID128FromCPP(service_uuid); scan_cb_ = std::move(callback); + // Clear the map of discovered peripherals only when we are starting a new scan. If we cleared the + // map every time we stopped a scan, we would not be able to connect to peripherals that we + // discovered in that scan session. + peripherals_.clear(); + socketCentralManager_ = [[GNSCentralManager alloc] initWithSocketServiceUUID:serviceUUID]; [socketCentralManager_ startNoScanModeWithAdvertisedServiceUUIDs:@[ serviceUUID ]]; diff --git a/internal/platform/implementation/apple/count_down_latch.cc b/internal/platform/implementation/apple/count_down_latch.cc index e081e9a9..98c8de8f 100644 --- a/internal/platform/implementation/apple/count_down_latch.cc +++ b/internal/platform/implementation/apple/count_down_latch.cc @@ -13,6 +13,9 @@ // limitations under the License. #include "internal/platform/implementation/apple/count_down_latch.h" +#include "absl/synchronization/mutex.h" +#include "absl/time/time.h" +#include "internal/platform/exception.h" namespace nearby { namespace apple { diff --git a/internal/platform/implementation/apple/count_down_latch.h b/internal/platform/implementation/apple/count_down_latch.h index 7504df19..ff54ca77 100644 --- a/internal/platform/implementation/apple/count_down_latch.h +++ b/internal/platform/implementation/apple/count_down_latch.h @@ -15,7 +15,10 @@ #ifndef PLATFORM_IMPL_APPLE_COUNT_DOWN_LATCH_H_ #define PLATFORM_IMPL_APPLE_COUNT_DOWN_LATCH_H_ +#include "absl/base/thread_annotations.h" #include "absl/synchronization/mutex.h" +#include "absl/time/time.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/count_down_latch.h" namespace nearby { diff --git a/internal/platform/implementation/apple/count_down_latch_test.cc b/internal/platform/implementation/apple/count_down_latch_test.cc index 50012813..77b655be 100644 --- a/internal/platform/implementation/apple/count_down_latch_test.cc +++ b/internal/platform/implementation/apple/count_down_latch_test.cc @@ -14,7 +14,10 @@ #include "internal/platform/implementation/apple/count_down_latch.h" +#include + #include "gtest/gtest.h" +#include "absl/time/time.h" #include "thread/fiber/fiber.h" namespace nearby { @@ -56,11 +59,11 @@ TEST(CountDownLatchTest, LatchAwaitWithTimeoutCanExpire) { auto response = latch.Await(absl::Milliseconds(100)); - EXPECT_TRUE(response.ok()); + EXPECT_FALSE(response.ok()); EXPECT_FALSE(response.result()); } -TEST(CountDownLatchTest, InitialCountZero_AwaitDoesNotBlock) { +TEST(CountDownLatchTest, InitialCountZeroAwaitDoesNotBlock) { CountDownLatch latch(0); auto response = latch.Await(); @@ -68,7 +71,7 @@ TEST(CountDownLatchTest, InitialCountZero_AwaitDoesNotBlock) { EXPECT_TRUE(response.Ok()); } -TEST(CountDownLatchTest, InitialCountNegative_AwaitDoesNotBlock) { +TEST(CountDownLatchTest, InitialCountNegativeAwaitDoesNotBlock) { CountDownLatch latch(-1); auto response = latch.Await(); diff --git a/internal/platform/implementation/apple/device_info.h b/internal/platform/implementation/apple/device_info.h index 4315040c..2a238989 100644 --- a/internal/platform/implementation/apple/device_info.h +++ b/internal/platform/implementation/apple/device_info.h @@ -28,16 +28,13 @@ namespace apple { class DeviceInfo : public api::DeviceInfo { public: - std::optional GetOsDeviceName() const override; + std::optional GetOsDeviceName() const override; api::DeviceInfo::DeviceType GetDeviceType() const override; api::DeviceInfo::OsType GetOsType() const override; - std::optional GetFullName() const override; - std::optional GetGivenName() const override; - std::optional GetLastName() const override; - std::optional GetProfileUserName() const override; + std::optional GetGivenName() const override; std::optional GetDownloadPath() const override; diff --git a/internal/platform/implementation/apple/device_info.mm b/internal/platform/implementation/apple/device_info.mm index 6a8d09ee..885ad93b 100644 --- a/internal/platform/implementation/apple/device_info.mm +++ b/internal/platform/implementation/apple/device_info.mm @@ -33,15 +33,15 @@ namespace nearby { namespace apple { -std::optional DeviceInfo::GetOsDeviceName() const { +std::optional DeviceInfo::GetOsDeviceName() const { #if TARGET_OS_IPHONE NSString *name = UIDevice.currentDevice.name; - const char16_t *cName = (const char16_t *)[name cStringUsingEncoding:NSUTF16StringEncoding]; - return std::u16string(cName); + const char *cName = (const char *)[name cStringUsingEncoding:NSUTF8StringEncoding]; + return std::string(cName); #elif TARGET_OS_OSX NSString *name = NSHost.currentHost.localizedName; - const char16_t *cName = (const char16_t *)[name cStringUsingEncoding:NSUTF16StringEncoding]; - return std::u16string(cName); + const char *cName = (const char *)[name cStringUsingEncoding:NSUTF8StringEncoding]; + return std::string(cName); #else return std::nullopt; #endif @@ -78,10 +78,7 @@ api::DeviceInfo::OsType DeviceInfo::GetOsType() const { #endif } -std::optional DeviceInfo::GetFullName() const { return std::nullopt; } -std::optional DeviceInfo::GetGivenName() const { return std::nullopt; } -std::optional DeviceInfo::GetLastName() const { return std::nullopt; } -std::optional DeviceInfo::GetProfileUserName() const { return std::nullopt; } +std::optional DeviceInfo::GetGivenName() const { return std::nullopt; } std::optional DeviceInfo::GetDownloadPath() const { NSFileManager *manager = [NSFileManager defaultManager]; diff --git a/internal/platform/implementation/apple/log_message.h b/internal/platform/implementation/apple/log_message.h deleted file mode 100644 index 3cc117fb..00000000 --- a/internal/platform/implementation/apple/log_message.h +++ /dev/null @@ -1,65 +0,0 @@ -// 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 PLATFORM_IMPL_APPLE_LOG_MESSAGE_H_ -#define PLATFORM_IMPL_APPLE_LOG_MESSAGE_H_ - -#include -#include -#include - -#include "absl/strings/string_view.h" -#include "internal/platform/implementation/log_message.h" -#include "GoogleToolboxForMac/GTMLogger.h" - -namespace nearby { -namespace apple { - -class LogStreamer final { - public: - explicit LogStreamer(GTMLoggerLevel severity, absl::string_view func); - - ~LogStreamer(); - - std::ostream& stream() { return stream_; } - - private: - GTMLoggerLevel severity_; - std::string func_; - std::ostringstream stream_; -}; - -// Concrete LogMessage implementation -class LogMessage : public api::LogMessage { - public: - LogMessage(const char* file, int line, Severity severity); - ~LogMessage() override = default; - - LogMessage(const LogMessage&) = delete; - LogMessage& operator=(const LogMessage&) = delete; - - void Print(const char* format, ...) override; - - std::ostream& Stream() override; - - private: - LogStreamer log_streamer_; - GTMLoggerLevel severity_; - std::string func_; -}; - -} // namespace apple -} // namespace nearby - -#endif // PLATFORM_IMPL_APPLE_LOG_MESSAGE_H_ diff --git a/internal/platform/implementation/apple/log_message.mm b/internal/platform/implementation/apple/log_message.mm deleted file mode 100644 index afb5afba..00000000 --- a/internal/platform/implementation/apple/log_message.mm +++ /dev/null @@ -1,117 +0,0 @@ -// 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. - -#include "internal/platform/implementation/apple/log_message.h" - -#include -#include - -#include "internal/platform/implementation/log_message.h" - -namespace nearby { -namespace apple { - -api::LogMessage::Severity gMinLogSeverity = api::LogMessage::Severity::kInfo; - -GTMLoggerLevel ConvertSeverity(api::LogMessage::Severity severity) { - switch (severity) { - case api::LogMessage::Severity::kVerbose: - return kGTMLoggerLevelDebug; - case api::LogMessage::Severity::kInfo: - return kGTMLoggerLevelInfo; - case api::LogMessage::Severity::kWarning: - return kGTMLoggerLevelInfo; - case api::LogMessage::Severity::kError: - return kGTMLoggerLevelError; - case api::LogMessage::Severity::kFatal: - return kGTMLoggerLevelAssert; - } -} - -// GTMLogger expects a function name, but we only have file and line. So format the info as -// {basename(file)}:{line} and use that as the function name. -std::string ConvertFileAndLine(absl::string_view filepath, int line) { - size_t path = filepath.find_last_of('/'); - if (path != filepath.npos) filepath.remove_prefix(path + 1); - return std::string(filepath) + ":" + std::to_string(line); -} - -LogStreamer::LogStreamer(GTMLoggerLevel severity, absl::string_view func) - : severity_(severity), func_(func) {} - -LogStreamer::~LogStreamer() { - switch (severity_) { - case kGTMLoggerLevelDebug: - [[GTMLogger sharedLogger] logFuncDebug:func_.c_str() msg:@"%@", @(stream_.str().c_str())]; - break; - case kGTMLoggerLevelInfo: - [[GTMLogger sharedLogger] logFuncInfo:func_.c_str() msg:@"%@", @(stream_.str().c_str())]; - break; - case kGTMLoggerLevelError: - [[GTMLogger sharedLogger] logFuncError:func_.c_str() msg:@"%@", @(stream_.str().c_str())]; - break; - case kGTMLoggerLevelAssert: - [[GTMLogger sharedLogger] logFuncAssert:func_.c_str() msg:@"%@", @(stream_.str().c_str())]; - break; - case kGTMLoggerLevelUnknown: - // no-op - break; - } -} - -LogMessage::LogMessage(const char* file, int line, Severity severity) - : log_streamer_(ConvertSeverity(severity), ConvertFileAndLine(file, line)), - severity_(ConvertSeverity(severity)), - func_(ConvertFileAndLine(file, line)) {} - -void LogMessage::Print(const char* format, ...) { - va_list ap; - va_start(ap, format); - NSString *msg = [[NSString alloc] initWithFormat:@(format) arguments:ap]; - switch (severity_) { - case kGTMLoggerLevelDebug: - [[GTMLogger sharedLogger] logFuncDebug:func_.c_str() msg:@"%@", msg]; - break; - case kGTMLoggerLevelInfo: - [[GTMLogger sharedLogger] logFuncInfo:func_.c_str() msg:@"%@", msg]; - break; - case kGTMLoggerLevelError: - [[GTMLogger sharedLogger] logFuncError:func_.c_str() msg:@"%@", msg]; - break; - case kGTMLoggerLevelAssert: - [[GTMLogger sharedLogger] logFuncAssert:func_.c_str() msg:@"%@", msg]; - break; - case kGTMLoggerLevelUnknown: - // no-op - break; - } - va_end(ap); -} - -std::ostream& LogMessage::Stream() { return log_streamer_.stream(); } - -} // namespace apple - -namespace api { - -// static -void LogMessage::SetMinLogSeverity(Severity severity) { apple::gMinLogSeverity = severity; } - -// static -bool LogMessage::ShouldCreateLogMessage(Severity severity) { - return severity >= apple::gMinLogSeverity; -} - -} // namespace api -} // namespace nearby diff --git a/internal/platform/implementation/apple/platform.mm b/internal/platform/implementation/apple/platform.mm index 781a50ea..8c7b7e21 100644 --- a/internal/platform/implementation/apple/platform.mm +++ b/internal/platform/implementation/apple/platform.mm @@ -26,7 +26,6 @@ #include "internal/platform/implementation/apple/condition_variable.h" #include "internal/platform/implementation/apple/count_down_latch.h" #include "internal/platform/implementation/apple/device_info.h" -#import "internal/platform/implementation/apple/log_message.h" #import "internal/platform/implementation/apple/multi_thread_executor.h" #include "internal/platform/implementation/apple/mutex.h" #include "internal/platform/implementation/apple/preferences_manager.h" @@ -135,11 +134,6 @@ std::unique_ptr ImplementationPlatform::CreateOutputFile(const std:: return shared::IOFile::CreateOutputFile(file_path); } -std::unique_ptr ImplementationPlatform::CreateLogMessage( - const char* file, int line, LogMessage::Severity severity) { - return std::make_unique(file, line, severity); -} - // Java-like Executors std::unique_ptr ImplementationPlatform::CreateSingleThreadExecutor() { return std::make_unique(); @@ -228,7 +222,7 @@ absl::StatusOr ImplementationPlatform::SendRequest(const WebRequest [condition unlock]; if (blockResponse == nil) { - return absl::UnknownError([[blockError localizedDescription] UTF8String]); + return absl::FailedPreconditionError([[blockError localizedDescription] UTF8String]); } WebResponse webResponse; diff --git a/internal/platform/implementation/ble_v2.h b/internal/platform/implementation/ble_v2.h index f1a31b14..31d2cbbe 100644 --- a/internal/platform/implementation/ble_v2.h +++ b/internal/platform/implementation/ble_v2.h @@ -460,12 +460,14 @@ class BleMedium { absl::AnyInvocable advertisement_found_cb = [](BlePeripheral&, BleAdvertisementData) {}; + absl::AnyInvocable + advertisement_lost_cb = [](BlePeripheral&) {}; }; // Async interface for StartScanning. - // Result status will be passed to start_advertising_result callback. - // To stop advertising, invoke the stop_advertising callback in - // AdvertisingSession. + // Result status will be passed to start_scanning_result callback. + // To stop scanning, invoke the stop_scanning callback in + // ScanningSession. virtual std::unique_ptr StartScanning( const Uuid& service_uuid, TxPowerLevel tx_power_level, ScanningCallback callback) = 0; diff --git a/internal/platform/implementation/crypto.h b/internal/platform/implementation/crypto.h index 6bd16e52..71b63c69 100644 --- a/internal/platform/implementation/crypto.h +++ b/internal/platform/implementation/crypto.h @@ -15,12 +15,11 @@ #ifndef PLATFORM_API_CRYPTO_H_ #define PLATFORM_API_CRYPTO_H_ +#include +#include + #include "absl/strings/string_view.h" -#ifdef NEARBY_CHROMIUM -#include "crypto/random.h" -#else -#include "internal/crypto_cros/random.h" -#endif +#include "absl/types/span.h" #include "internal/platform/byte_array.h" namespace nearby { @@ -36,12 +35,23 @@ class Crypto { static ByteArray Sha256(absl::string_view input); }; +// Fills the given buffer with |length| random bytes of cryptographically +// secure random numbers. +// |length| must be positive. +// +// TODO(crbug.com/40284755): Convert all callers in Nearby to use spans +// and remove this RandBytes overload. +void RandBytes(void *bytes, size_t length); + +// Fills |bytes| with cryptographically-secure random bits. +void RandBytes(absl::Span bytes); + // Creates an object of type T initialized with random data. // This template should be used for simple data types: int, char, etc. template T RandData() { T data; - ::crypto::RandBytes(&data, sizeof(data)); + RandBytes(&data, sizeof(data)); return data; } diff --git a/internal/platform/implementation/device_info.h b/internal/platform/implementation/device_info.h index 7b48c608..05fc160f 100644 --- a/internal/platform/implementation/device_info.h +++ b/internal/platform/implementation/device_info.h @@ -41,15 +41,12 @@ class DeviceInfo { virtual ~DeviceInfo() = default; // Gets device name. - virtual std::optional GetOsDeviceName() const = 0; + virtual std::optional GetOsDeviceName() const = 0; virtual DeviceType GetDeviceType() const = 0; virtual OsType GetOsType() const = 0; // Gets basic information of current user. - virtual std::optional GetFullName() const = 0; - virtual std::optional GetGivenName() const = 0; - virtual std::optional GetLastName() const = 0; - virtual std::optional GetProfileUserName() const = 0; + virtual std::optional GetGivenName() const = 0; // Gets known paths of current user. virtual std::optional GetDownloadPath() const = 0; diff --git a/internal/platform/implementation/g3/BUILD b/internal/platform/implementation/g3/BUILD index 9a4359d6..de2e7688 100644 --- a/internal/platform/implementation/g3/BUILD +++ b/internal/platform/implementation/g3/BUILD @@ -17,7 +17,6 @@ cc_library( name = "types", testonly = True, srcs = [ - "log_message.cc", "preferences_manager.cc", "scheduled_executor.cc", "system_clock.cc", @@ -27,7 +26,6 @@ cc_library( "atomic_reference.h", "condition_variable.h", "device_info.h", - "log_message.h", "multi_thread_executor.h", "mutex.h", "preferences_manager.h", @@ -35,17 +33,12 @@ cc_library( "single_thread_executor.h", "timer.h", ], - visibility = [ - "//internal/test:__subpackages__", - "//location/nearby/cpp:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", - ], + visibility = ["//visibility:private"], deps = [ ":preferences_repository", "//internal/platform:base", "//internal/platform:test_util", "//internal/platform:types", - "//internal/platform:util", "//internal/platform/implementation:types", "//internal/platform/implementation/shared:count_down_latch", "//internal/platform/implementation/shared:posix_mutex", @@ -53,11 +46,12 @@ cc_library( "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:btree", "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/log:log_streamer", "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:span", - "@com_google_glog//:glog", "@com_google_nisaba//nisaba/port:thread_pool", "@nlohmann_json//:json", ], @@ -73,7 +67,6 @@ cc_library( "bluetooth_adapter.cc", "bluetooth_classic.cc", "credential_storage_impl.cc", - "webrtc.cc", "wifi_direct.cc", "wifi_hotspot.cc", "wifi_lan.cc", @@ -85,7 +78,6 @@ cc_library( "bluetooth_classic.h", "credential_storage_impl.h", "socket_base.h", - "webrtc.h", "wifi.h", "wifi_direct.h", "wifi_hotspot.h", @@ -94,6 +86,16 @@ cc_library( visibility = ["//visibility:private"], deps = [ ":types", + "//internal/platform:base", + "//internal/platform:cancellation_flag", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform:uuid", + "//internal/platform/implementation:comm", + "//internal/platform/implementation/shared:count_down_latch", + "//internal/proto:credential_cc_proto", + # TODO: Support WebRTC + "//third_party/webrtc/files/stable/webrtc/api:scoped_refptr", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", @@ -104,17 +106,7 @@ cc_library( "@com_google_absl//absl/strings", "@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/synchronization", - "//internal/platform:base", - "//internal/platform:cancellation_flag", - "//internal/platform:test_util", - "//internal/platform:types", - "//internal/platform:uuid", - "//internal/platform/implementation:comm", - "//internal/platform/implementation/shared:count_down_latch", - "//internal/proto:credential_cc_proto", - # TODO: Support WebRTC - "//third_party/webrtc/files/stable/webrtc/api/task_queue:default_task_queue_factory", - "//third_party/webrtc/files/stable/webrtc/rtc_base:checks", + "@com_google_absl//absl/time", ], ) @@ -124,7 +116,7 @@ cc_library( srcs = [ "crypto.cc", ], - visibility = ["//visibility:private"], + visibility = ["//internal/platform/implementation:__subpackages__"], deps = [ "//internal/platform:base", "//internal/platform/implementation:types", @@ -140,11 +132,13 @@ cc_library( srcs = [ "platform.cc", ], + defines = ["NO_WEBRTC"], visibility = [ "//connections:__subpackages__", "//fastpair:__subpackages__", "//internal/account:__subpackages__", "//internal/auth:__subpackages__", + "//internal/crypto:__subpackages__", "//internal/data:__subpackages__", "//internal/flags:__subpackages__", "//internal/network:__subpackages__", @@ -154,24 +148,28 @@ cc_library( "//internal/test:__subpackages__", "//internal/weave:__subpackages__", "//location/nearby/cpp:__subpackages__", + "//location/nearby/sharing/sdk:__subpackages__", "//presence:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ ":comm", ":crypto", # build_cleaner: keep ":types", - "//file/base:path", + "//internal/platform:base", "//internal/platform:test_util", "//internal/platform/implementation:comm", "//internal/platform/implementation:platform", "//internal/platform/implementation:types", "//internal/platform/implementation/shared:count_down_latch", "//internal/platform/implementation/shared:file", + "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/memory", + "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/time", + "@com_google_nisaba//nisaba/port:thread_pool", ], ) diff --git a/internal/platform/implementation/g3/ble.cc b/internal/platform/implementation/g3/ble.cc index f60b2391..e61e6ce1 100644 --- a/internal/platform/implementation/g3/ble.cc +++ b/internal/platform/implementation/g3/ble.cc @@ -21,6 +21,7 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" +#include "absl/strings/escaping.h" #include "absl/synchronization/mutex.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancellation_flag.h" @@ -64,8 +65,8 @@ bool BleServerSocket::Connect(BleSocket& socket) { absl::MutexLock lock(&mutex_); if (closed_) return false; if (socket.IsConnected()) { - NEARBY_LOG(ERROR, - "Failed to connect to Ble server socket: already connected"); + NEARBY_LOGS(ERROR) + << "Failed to connect to Ble server socket: already connected"; return true; // already connected. } // add client socket to the pending list @@ -126,8 +127,8 @@ BleMedium::~BleMedium() { StopScanning(scanning_info_.service_id); accept_loops_runner_.Shutdown(); - NEARBY_LOG(INFO, "BleMedium dtor advertising_accept_thread_running_ = %d", - acceptance_thread_running_.load()); + NEARBY_LOGS(INFO) << "BleMedium dtor advertising_accept_thread_running_ = " + << acceptance_thread_running_.load(); // If acceptance thread is still running, wait to finish. if (acceptance_thread_running_) { while (acceptance_thread_running_) { @@ -142,10 +143,11 @@ bool BleMedium::StartAdvertising( const std::string& service_id, const ByteArray& advertisement_bytes, const std::string& fast_advertisement_service_uuid) { NEARBY_LOGS(INFO) << "G3 Ble StartAdvertising: service_id=" << service_id - << ", advertisement bytes=" << advertisement_bytes.data() + << ", advertisement bytes=" + << absl::BytesToHexString(std::string(advertisement_bytes)) << "(" << advertisement_bytes.size() << ")," - << " fast advertisement service uuid=" - << fast_advertisement_service_uuid; + << ", fast advertisement service uuid=" + << absl::BytesToHexString(fast_advertisement_service_uuid); auto& env = MediumEnvironment::Instance(); auto& peripheral = adapter_->GetPeripheral(); peripheral.SetAdvertisementBytes(service_id, advertisement_bytes); @@ -159,14 +161,13 @@ bool BleMedium::StartAdvertising( acceptance_thread_running_.exchange(true); accept_loops_runner_.Execute([&env, this, service_id]() mutable { - if (!accept_loops_runner_.InShutdown()) { - while (true) { - auto client_socket = - server_socket_->Accept(&(this->adapter_->GetPeripheral())); - if (client_socket == nullptr) break; - env.CallBleAcceptedConnectionCallback(*this, *(client_socket.release()), - service_id); - } + while (true) { + if (accept_loops_runner_.InShutdown()) break; + auto client_socket = + server_socket_->Accept(&(this->adapter_->GetPeripheral())); + if (client_socket == nullptr) break; + env.CallBleAcceptedConnectionCallback(*this, *(client_socket.release()), + service_id); } acceptance_thread_running_.exchange(false); }); @@ -262,11 +263,10 @@ bool BleMedium::StopAcceptingConnections(const std::string& service_id) { std::unique_ptr BleMedium::Connect( api::BlePeripheral& remote_peripheral, const std::string& service_id, CancellationFlag* cancellation_flag) { - NEARBY_LOG(INFO, - "G3 Ble Connect [self]: medium=%p, adapter=%p, peripheral=%p, " - "service_id=%s", - this, &GetAdapter(), &GetAdapter().GetPeripheral(), - service_id.c_str()); + NEARBY_LOGS(INFO) << "G3 Ble Connect [self]: medium=" << this + << ", adapter=" << &GetAdapter() + << ", peripheral=" << &GetAdapter().GetPeripheral() + << ", service_id=" << service_id; // First, find an instance of remote medium, that exposed this peripheral. auto& adapter = static_cast(remote_peripheral).GetAdapter(); auto* medium = static_cast(adapter.GetBleMedium()); @@ -274,10 +274,10 @@ std::unique_ptr BleMedium::Connect( if (!medium) return {}; // Can't find medium. Bail out. BleServerSocket* remote_server_socket = nullptr; - NEARBY_LOG(INFO, - "G3 Ble Connect [peer]: medium=%p, adapter=%p, peripheral=%p, " - "service_id=%s", - medium, &adapter, &remote_peripheral, service_id.c_str()); + NEARBY_LOGS(INFO) << "G3 Ble Connect [peer]: medium=" << medium + << ", adapter=" << &adapter + << ", peripheral=" << &remote_peripheral + << ", service_id=" << service_id; // Then, find our server socket context in this medium. { absl::MutexLock medium_lock(&medium->mutex_); @@ -312,7 +312,7 @@ std::unique_ptr BleMedium::Connect( return {}; } - NEARBY_LOG(INFO, "G3 Ble Connect: connected: socket=%p", socket.get()); + NEARBY_LOGS(INFO) << "G3 Ble Connect: connected: socket=" << socket.get(); return socket; } diff --git a/internal/platform/implementation/g3/ble.h b/internal/platform/implementation/g3/ble.h index 243468ff..e6637005 100644 --- a/internal/platform/implementation/g3/ble.h +++ b/internal/platform/implementation/g3/ble.h @@ -184,7 +184,7 @@ class BleMedium : public api::BleMedium { std::atomic_bool acceptance_thread_running_ = false; // A thread pool dedicated to wait to complete the accept_loops_runner_. - MultiThreadExecutor close_accept_loops_runner_{kMaxConcurrentAcceptLoops}; + MultiThreadExecutor close_accept_loops_runner_{1}; // A server socket is established when start advertising. std::unique_ptr server_socket_; diff --git a/internal/platform/implementation/g3/ble_v2.cc b/internal/platform/implementation/g3/ble_v2.cc index dce7d554..bf053e01 100644 --- a/internal/platform/implementation/g3/ble_v2.cc +++ b/internal/platform/implementation/g3/ble_v2.cc @@ -160,6 +160,8 @@ Exception BleV2ServerSocket::DoClose() { BleV2Medium::BleV2Medium(api::BluetoothAdapter& adapter) : adapter_(static_cast(&adapter)) { adapter_->SetBleV2Medium(this); + is_extended_advertisements_available_ = + MediumEnvironment::Instance().IsBleExtendedAdvertisementsAvailable(); MediumEnvironment::Instance().RegisterBleV2Medium(*this, &peripheral_); } @@ -180,7 +182,7 @@ bool BleV2Medium::StartAdvertising( << TxPowerLevelToName(advertise_parameters.tx_power_level) << ", is_connectable=" << advertise_parameters.is_connectable; if (advertising_data.is_extended_advertisement && - !is_support_extended_advertisement_) { + !IsExtendedAdvertisementsAvailable()) { NEARBY_LOGS(INFO) << "G3 Ble StartAdvertising does not support extended advertisement"; return false; @@ -215,7 +217,7 @@ std::unique_ptr BleV2Medium::StartAdvertising( << TxPowerLevelToName(advertise_parameters.tx_power_level) << ", is_connectable=" << advertise_parameters.is_connectable; if (advertising_data.is_extended_advertisement && - !is_support_extended_advertisement_) { + !IsExtendedAdvertisementsAvailable()) { NEARBY_LOGS(INFO) << "G3 Ble StartAdvertising does not support extended advertisement"; return nullptr; @@ -326,7 +328,7 @@ std::unique_ptr BleV2Medium::ConnectToGattServer( } bool BleV2Medium::IsExtendedAdvertisementsAvailable() { - return is_support_extended_advertisement_; + return is_extended_advertisements_available_; } bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address, diff --git a/internal/platform/implementation/g3/ble_v2.h b/internal/platform/implementation/g3/ble_v2.h index 2165c014..80972c4c 100644 --- a/internal/platform/implementation/g3/ble_v2.h +++ b/internal/platform/implementation/g3/ble_v2.h @@ -23,15 +23,24 @@ #include #include +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" #include "internal/platform/borrowable.h" #include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/g3/bluetooth_adapter.h" #include "internal/platform/implementation/g3/socket_base.h" -#include "internal/platform/medium_environment.h" -#include "internal/platform/prng.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/output_stream.h" #include "internal/platform/uuid.h" namespace nearby { @@ -323,8 +332,7 @@ class BleV2Medium : public api::ble_v2::BleMedium { ABSL_GUARDED_BY(mutex_); absl::flat_hash_set> scanning_internal_session_ids_ ABSL_GUARDED_BY(mutex_); - // TODO(edwinwu): Adds extended advertisement for testing. - bool is_support_extended_advertisement_ = false; + bool is_extended_advertisements_available_ = false; }; } // namespace g3 diff --git a/internal/platform/implementation/g3/bluetooth_classic.cc b/internal/platform/implementation/g3/bluetooth_classic.cc index a4d7b121..e8377304 100644 --- a/internal/platform/implementation/g3/bluetooth_classic.cc +++ b/internal/platform/implementation/g3/bluetooth_classic.cc @@ -217,6 +217,16 @@ std::unique_ptr BluetoothClassicMedium::ConnectToService( << service_uuid; return {}; } + + if (cancellation_flag->Cancelled()) { + NEARBY_LOGS(ERROR) + << "G3 Bluetooth Connect: Has been cancelled after connected: " + "service_uuid=" + << service_uuid; + socket->Close(); + return {}; + } + NEARBY_LOGS(INFO) << "G3 ConnectToService: connected: socket=" << socket.get(); return socket; diff --git a/internal/platform/implementation/g3/credential_storage_impl.cc b/internal/platform/implementation/g3/credential_storage_impl.cc index 9a7c5898..7dd7057d 100644 --- a/internal/platform/implementation/g3/credential_storage_impl.cc +++ b/internal/platform/implementation/g3/credential_storage_impl.cc @@ -70,7 +70,6 @@ void CredentialStorageImpl::SaveCredentials( NEARBY_LOGS(INFO) << "G3 Save Private Credentials for account: [" << account_name << "], manager app ID:[" << manager_app_id << "]"; - absl::MutexLock lock(&private_mutex_); SaveLocalCredentialsLocked(manager_app_id, account_name, private_credentials); } @@ -83,7 +82,6 @@ void CredentialStorageImpl::SaveCredentials( NEARBY_LOGS(INFO) << "G3 Save Public Credentials for account: [" << account_name << "], manager app ID:[" << manager_app_id << "]"; - absl::MutexLock lock(&public_mutex_); PublicCredentialKey key = CreatePublicCredentialKey( manager_app_id, account_name, public_credential_type); auto public_result = @@ -116,7 +114,6 @@ void CredentialStorageImpl::UpdateLocalCredential( NEARBY_LOGS(INFO) << "G3 Update Private Credential for for account: [" << account_name << "], manager app ID:[" << manager_app_id << "]"; - absl::MutexLock lock(&private_mutex_); absl::StatusOr> credentials = GetLocalCredentialsLocked(CredentialSelector{ .manager_app_id = std::string(manager_app_id), @@ -126,10 +123,9 @@ void CredentialStorageImpl::UpdateLocalCredential( NEARBY_LOGS(WARNING) << credentials.status(); credentials = std::vector(); } - auto it = std::find_if(credentials->begin(), credentials->end(), - [&](const LocalCredential& a) { - return a.secret_id() == credential.secret_id(); - }); + auto it = std::find_if( + credentials->begin(), credentials->end(), + [&](const LocalCredential& a) { return a.id() == credential.id(); }); if (it == credentials->end()) { credentials->push_back(std::move(credential)); } else { @@ -143,7 +139,6 @@ void CredentialStorageImpl::GetLocalCredentials( const CredentialSelector& credential_selector, GetLocalCredentialsResultCallback callback) { NEARBY_LOGS(INFO) << "G3 Get Private Credentials for " << credential_selector; - absl::MutexLock lock(&private_mutex_); std::move(callback.credentials_fetched_cb)( GetLocalCredentialsLocked(credential_selector)); } @@ -174,7 +169,6 @@ void CredentialStorageImpl::GetPublicCredentials( PublicCredentialType public_credential_type, GetPublicCredentialsResultCallback callback) { NEARBY_LOGS(INFO) << "G3 Get Public Credentials for " << credential_selector; - absl::MutexLock lock(&public_mutex_); PublicCredentialKey key = CreatePublicCredentialKey( credential_selector.manager_app_id, credential_selector.account_name, public_credential_type); diff --git a/internal/platform/implementation/g3/device_info.h b/internal/platform/implementation/g3/device_info.h index 87d6a958..9b2ad21b 100644 --- a/internal/platform/implementation/g3/device_info.h +++ b/internal/platform/implementation/g3/device_info.h @@ -30,8 +30,8 @@ namespace g3 { class DeviceInfo : public api::DeviceInfo { public: - std::optional GetOsDeviceName() const override { - return u"Windows"; + std::optional GetOsDeviceName() const override { + return "Windows"; } api::DeviceInfo::DeviceType GetDeviceType() const override { @@ -42,16 +42,7 @@ class DeviceInfo : public api::DeviceInfo { return api::DeviceInfo::OsType::kChromeOs; } - std::optional GetFullName() const override { - return u"nearby"; - } - std::optional GetGivenName() const override { - return u"nearby"; - } - std::optional GetLastName() const override { - return u"nearby"; - } - std::optional GetProfileUserName() const override { + std::optional GetGivenName() const override { return "nearby"; } diff --git a/internal/platform/implementation/g3/log_message.cc b/internal/platform/implementation/g3/log_message.cc deleted file mode 100644 index 27ccb7d4..00000000 --- a/internal/platform/implementation/g3/log_message.cc +++ /dev/null @@ -1,84 +0,0 @@ -// 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. - -#include "internal/platform/implementation/g3/log_message.h" - -#include -#include - -namespace nearby { -namespace g3 { - -namespace { - -// This is a partial copy of base::StringAppendV for OSS compilation. -void NearbyStringAppendV(std::string* dst, const char* format, va_list ap) { - // Fixed size buffer 1024 should be big enough. - static const int kSpaceLength = 1024; - char space[kSpaceLength]; - int result = vsnprintf(space, kSpaceLength, format, ap); - va_end(ap); - dst->append(space, result); -} -} // namespace - -api::LogMessage::Severity g_min_log_severity = api::LogMessage::Severity::kInfo; - -inline absl::LogSeverity ConvertSeverity(api::LogMessage::Severity severity) { - switch (severity) { - // api::LogMessage::Severity kVerbose and kInfo is mapped to - // absl::LogSeverity kInfo since absl::LogSeverity doesn't have kVerbose - // level. - case api::LogMessage::Severity::kVerbose: - case api::LogMessage::Severity::kInfo: - return absl::LogSeverity::kInfo; - case api::LogMessage::Severity::kWarning: - return absl::LogSeverity::kWarning; - case api::LogMessage::Severity::kError: - return absl::LogSeverity::kError; - case api::LogMessage::Severity::kFatal: - return absl::LogSeverity::kFatal; - } -} - -LogMessage::LogMessage(const char* file, int line, Severity severity) - : log_streamer_(ConvertSeverity(severity), file, line) {} - -LogMessage::~LogMessage() = default; - -void LogMessage::Print(const char* format, ...) { - va_list ap; - va_start(ap, format); - std::string result; - NearbyStringAppendV(&result, format, ap); - log_streamer_.stream() << result; - va_end(ap); -} - -std::ostream& LogMessage::Stream() { return log_streamer_.stream(); } - -} // namespace g3 - -namespace api { - -void LogMessage::SetMinLogSeverity(Severity severity) { - g3::g_min_log_severity = severity; -} - -bool LogMessage::ShouldCreateLogMessage(Severity severity) { - return severity >= g3::g_min_log_severity; -} - -} // namespace api -} // namespace nearby diff --git a/internal/platform/implementation/g3/platform.cc b/internal/platform/implementation/g3/platform.cc index 6c753394..a2b81be0 100644 --- a/internal/platform/implementation/g3/platform.cc +++ b/internal/platform/implementation/g3/platform.cc @@ -15,28 +15,45 @@ #include "internal/platform/implementation/platform.h" #include +#include #include #include #include -#include "file/base/path.h" +#include "absl/base/attributes.h" #include "absl/memory/memory.h" +#include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/time/time.h" #include "internal/platform/implementation/atomic_boolean.h" #include "internal/platform/implementation/atomic_reference.h" +#include "internal/platform/implementation/ble.h" +#include "internal/platform/implementation/ble_v2.h" #include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/implementation/condition_variable.h" +#include "internal/platform/implementation/count_down_latch.h" +#include "internal/platform/implementation/credential_storage.h" +#include "internal/platform/implementation/device_info.h" +#include "internal/platform/implementation/http_loader.h" +#include "internal/platform/implementation/input_file.h" #include "internal/platform/implementation/log_message.h" #include "internal/platform/implementation/mutex.h" +#include "internal/platform/implementation/output_file.h" #include "internal/platform/implementation/preferences_manager.h" #include "internal/platform/implementation/scheduled_executor.h" #include "internal/platform/implementation/server_sync.h" #include "internal/platform/implementation/shared/count_down_latch.h" #include "internal/platform/implementation/submittable_executor.h" +#include "internal/platform/implementation/timer.h" +#include "internal/platform/implementation/wifi_direct.h" +#include "internal/platform/implementation/wifi_hotspot.h" +#include "internal/platform/implementation/wifi_lan.h" +#include "internal/platform/os_name.h" +#include "internal/platform/payload_id.h" +#include "thread/thread.h" #ifndef NO_WEBRTC #include "internal/platform/implementation/g3/webrtc.h" #include "internal/platform/implementation/webrtc.h" @@ -50,7 +67,6 @@ #include "internal/platform/implementation/g3/condition_variable.h" #include "internal/platform/implementation/g3/credential_storage_impl.h" #include "internal/platform/implementation/g3/device_info.h" -#include "internal/platform/implementation/g3/log_message.h" #include "internal/platform/implementation/g3/multi_thread_executor.h" #include "internal/platform/implementation/g3/mutex.h" #include "internal/platform/implementation/g3/preferences_manager.h" @@ -70,14 +86,12 @@ namespace api { std::string ImplementationPlatform::GetCustomSavePath( const std::string& parent_folder, const std::string& file_name) { - return file::JoinPath(parent_folder, file_name); + return absl::StrCat(parent_folder, file_name); } std::string ImplementationPlatform::GetDownloadPath( const std::string& parent_folder, const std::string& file_name) { - std::string fullPath("/tmp"); - - return file::JoinPath("/tmp", file_name); + return absl::StrCat("/tmp/", file_name); } OSName ImplementationPlatform::GetCurrentOS() { return OSName::kLinux; } @@ -153,7 +167,7 @@ std::unique_ptr ImplementationPlatform::CreateOutputFile( std::unique_ptr ImplementationPlatform::CreateLogMessage( const char* file, int line, LogMessage::Severity severity) { - return std::make_unique(file, line, severity); + return nullptr; } std::unique_ptr diff --git a/internal/platform/implementation/g3/scheduled_executor.cc b/internal/platform/implementation/g3/scheduled_executor.cc index e2994064..b23ef77a 100644 --- a/internal/platform/implementation/g3/scheduled_executor.cc +++ b/internal/platform/implementation/g3/scheduled_executor.cc @@ -16,8 +16,12 @@ #include #include +#include #include +#include "absl/strings/str_format.h" +#include "absl/synchronization/mutex.h" +#include "absl/time/time.h" #include "internal/platform/implementation/cancelable.h" #include "internal/platform/medium_environment.h" #include "internal/platform/runnable.h" @@ -32,13 +36,14 @@ class ScheduledCancelable : public api::Cancelable { public: bool Cancel() override { Status expected = kNotRun; - while (expected == kNotRun) { - if (status_.compare_exchange_strong(expected, kCanceled)) { - return true; - } + if (status_.compare_exchange_strong(expected, kCanceled)) { + return true; } return false; } + + bool IsCanceled() const { return status_ == kCanceled; } + bool MarkExecuted() { Status expected = kNotRun; while (expected == kNotRun) { @@ -61,7 +66,7 @@ class ScheduledCancelable : public api::Cancelable { } // namespace ScheduledExecutor::ScheduledExecutor() { - absl::optional fake_clock = + std::optional fake_clock = MediumEnvironment::Instance().GetSimulatedClock(); if (fake_clock.has_value()) { name_ = absl::StrFormat("G3 scheduled executor %p", this); @@ -70,7 +75,7 @@ ScheduledExecutor::ScheduledExecutor() { } ScheduledExecutor::~ScheduledExecutor() { - absl::optional fake_clock = + std::optional fake_clock = MediumEnvironment::Instance().GetSimulatedClock(); if (fake_clock.has_value()) { (*fake_clock)->RemoveObserver(name_); @@ -86,11 +91,12 @@ std::shared_ptr ScheduledExecutor::Schedule( } Runnable task = [this, scheduled_cancelable, runnable = std::move(runnable)]() mutable { - if (!executor_.InShutdown() && scheduled_cancelable->MarkExecuted()) { + if (!executor_.InShutdown() && !scheduled_cancelable->IsCanceled() && + scheduled_cancelable->MarkExecuted()) { runnable(); } }; - absl::optional fake_clock = + std::optional fake_clock = MediumEnvironment::Instance().GetSimulatedClock(); if (fake_clock.has_value()) { absl::Time trigger_time = (*fake_clock)->Now() + delay; @@ -104,7 +110,7 @@ std::shared_ptr ScheduledExecutor::Schedule( } void ScheduledExecutor::RunReadyTasks() { - absl::optional fake_clock = + std::optional fake_clock = MediumEnvironment::Instance().GetSimulatedClock(); if (executor_.InShutdown()) { return; diff --git a/internal/platform/implementation/g3/webrtc.cc b/internal/platform/implementation/g3/webrtc.cc index 596c97ca..02d692c1 100644 --- a/internal/platform/implementation/g3/webrtc.cc +++ b/internal/platform/implementation/g3/webrtc.cc @@ -15,9 +15,17 @@ #include "internal/platform/implementation/g3/webrtc.h" #include +#include +#include #include +#include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/implementation/webrtc.h" #include "internal/platform/medium_environment.h" +#include "webrtc/api/peer_connection_interface.h" +#include "webrtc/api/scoped_refptr.h" #include "webrtc/api/task_queue/default_task_queue_factory.h" #include "webrtc/rtc_base/checks.h" @@ -56,6 +64,12 @@ const std::string WebRtcMedium::GetDefaultCountryCode() { return "US"; } void WebRtcMedium::CreatePeerConnection( webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) { + CreatePeerConnection(std::nullopt, observer, std::move(callback)); +} + +void WebRtcMedium::CreatePeerConnection( + std::optional options, + webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) { auto& env = MediumEnvironment::Instance(); if (!env.GetUseValidPeerConnection()) { callback(nullptr); @@ -75,10 +89,17 @@ void WebRtcMedium::CreatePeerConnection( webrtc::CreateDefaultTaskQueueFactory(); factory_dependencies.signaling_thread = signaling_thread.release(); + rtc::scoped_refptr + peer_connection_factory = webrtc::CreateModularPeerConnectionFactory( + std::move(factory_dependencies)); + RTC_CHECK(peer_connection_factory != nullptr) + << "Failed to create peer connection factory"; + if (options.has_value()) { + peer_connection_factory->SetOptions(options.value()); + } auto peer_connection_or_error = - webrtc::CreateModularPeerConnectionFactory( - std::move(factory_dependencies)) - ->CreatePeerConnectionOrError(rtc_config, std::move(dependencies)); + peer_connection_factory->CreatePeerConnectionOrError( + rtc_config, std::move(dependencies)); RTC_CHECK(peer_connection_or_error.ok()) << "Failed to create peer connection"; diff --git a/internal/platform/implementation/g3/webrtc.h b/internal/platform/implementation/g3/webrtc.h index bb88a0cc..cc630254 100644 --- a/internal/platform/implementation/g3/webrtc.h +++ b/internal/platform/implementation/g3/webrtc.h @@ -16,8 +16,11 @@ #define PLATFORM_IMPL_G3_WEBRTC_H_ #include +#include +#include #include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" #include "internal/platform/implementation/webrtc.h" #include "internal/platform/implementation/g3/single_thread_executor.h" #include "webrtc/api/peer_connection_interface.h" @@ -63,6 +66,13 @@ class WebRtcMedium : public api::WebRtcMedium { void CreatePeerConnection(webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) override; + // Creates and returns a new webrtc::PeerConnectionInterface object via + // |callback| with |PeerConnectionFactoryInterface::Options|. + void CreatePeerConnection( + std::optional options, + webrtc::PeerConnectionObserver* observer, + PeerConnectionCallback callback) override; + // Returns a signaling messenger for sending WebRTC signaling messages. std::unique_ptr GetSignalingMessenger( absl::string_view self_id, diff --git a/internal/platform/implementation/shared/BUILD b/internal/platform/implementation/shared/BUILD index 5fba4f98..b66deb11 100644 --- a/internal/platform/implementation/shared/BUILD +++ b/internal/platform/implementation/shared/BUILD @@ -13,6 +13,18 @@ # limitations under the License. licenses(["notice"]) +cc_library( + name = "crypto", + srcs = [ + "crypto.cc", + ], + visibility = ["//internal/platform/implementation:__subpackages__"], + deps = [ + "@boringssl//:crypto", + "@com_google_absl//absl/types:span", + ], +) + cc_library( name = "posix_mutex", srcs = [ @@ -45,10 +57,7 @@ cc_library( name = "file", srcs = ["file.cc"], hdrs = ["file.h"], - visibility = [ - "//connections/implementation:__subpackages__", - "//internal/platform/implementation:__subpackages__", - ], + visibility = ["//internal/platform/implementation:__subpackages__"], deps = [ "//internal/platform:base", "//internal/platform/implementation:types", diff --git a/internal/crypto_cros/random.cc b/internal/platform/implementation/shared/crypto.cc similarity index 70% rename from internal/crypto_cros/random.cc rename to internal/platform/implementation/shared/crypto.cc index 6889182a..f79a1a74 100644 --- a/internal/crypto_cros/random.cc +++ b/internal/platform/implementation/shared/crypto.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,22 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "internal/crypto_cros/random.h" - #include +#include -#include - +#include "absl/types/span.h" #include -namespace crypto { +namespace nearby { -void RandBytes(void *bytes, size_t length) { - RAND_bytes(reinterpret_cast(bytes), length); +void RandBytes(void* bytes, size_t length) { + RAND_bytes(reinterpret_cast(bytes), length); } void RandBytes(absl::Span bytes) { - RandBytes(bytes.data(), bytes.size()); + RAND_bytes(bytes.data(), bytes.size()); } -} // namespace crypto +} // namespace nearby diff --git a/internal/platform/implementation/shared/file.cc b/internal/platform/implementation/shared/file.cc index 97ffe947..a78ca9f2 100644 --- a/internal/platform/implementation/shared/file.cc +++ b/internal/platform/implementation/shared/file.cc @@ -14,7 +14,6 @@ #include "internal/platform/implementation/shared/file.h" -#include #include #include #include @@ -37,7 +36,7 @@ IOFile::IOFile(const absl::string_view file_path, size_t size) : file_(std::string(file_path.data(), file_path.size()), std::ios::binary | std::ios::in | std::ios::ate), path_(file_path), - total_size_(file_.tellg()) { + total_size_(size) { file_.seekg(0); } diff --git a/internal/platform/implementation/webrtc.h b/internal/platform/implementation/webrtc.h index 1c0bb04e..820348b7 100644 --- a/internal/platform/implementation/webrtc.h +++ b/internal/platform/implementation/webrtc.h @@ -18,8 +18,10 @@ #ifndef NO_WEBRTC #include +#include #include +#include "absl/functional/any_invocable.h" #include "absl/strings/string_view.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" #include "internal/platform/byte_array.h" @@ -60,6 +62,13 @@ class WebRtcMedium { virtual void CreatePeerConnection(webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) = 0; + // Creates and returns a new webrtc::PeerConnectionInterface object via + // |callback| with |PeerConnectionFactoryInterface::Options|. + virtual void CreatePeerConnection( + std::optional options, + webrtc::PeerConnectionObserver* observer, + PeerConnectionCallback callback) = 0; + // Returns a signaling messenger for sending WebRTC signaling messages. virtual std::unique_ptr GetSignalingMessenger( absl::string_view self_id, diff --git a/internal/platform/implementation/wifi_lan.h b/internal/platform/implementation/wifi_lan.h index 39fd6a6c..b967f4aa 100644 --- a/internal/platform/implementation/wifi_lan.h +++ b/internal/platform/implementation/wifi_lan.h @@ -17,6 +17,7 @@ #include +#include "absl/functional/any_invocable.h" #include "internal/platform/cancellation_flag.h" #include "internal/platform/input_stream.h" #include "internal/platform/listeners.h" @@ -99,10 +100,10 @@ class WifiLanMedium { // Callback that is invoked when a discovered service is found or lost. struct DiscoveredServiceCallback { - absl::AnyInvocable - service_discovered_cb = DefaultCallback(); - absl::AnyInvocable service_lost_cb = - DefaultCallback(); + absl::AnyInvocable + service_discovered_cb = DefaultCallback(); + absl::AnyInvocable + service_lost_cb = DefaultCallback(); }; // Starts the discovery of nearby WifiLan services. diff --git a/internal/platform/wifi_utils.cc b/internal/platform/implementation/wifi_utils.cc similarity index 97% rename from internal/platform/wifi_utils.cc rename to internal/platform/implementation/wifi_utils.cc index 14ca1139..0236f91b 100644 --- a/internal/platform/wifi_utils.cc +++ b/internal/platform/implementation/wifi_utils.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "internal/platform/wifi_utils.h" +#include "internal/platform/implementation/wifi_utils.h" #include #include @@ -21,6 +21,7 @@ #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "absl/strings/str_split.h" +#include "absl/strings/string_view.h" namespace nearby { diff --git a/internal/platform/wifi_utils.h b/internal/platform/implementation/wifi_utils.h similarity index 93% rename from internal/platform/wifi_utils.h rename to internal/platform/implementation/wifi_utils.h index 9b21ec73..572558bb 100644 --- a/internal/platform/wifi_utils.h +++ b/internal/platform/implementation/wifi_utils.h @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef PLATFORM_BASE_WIFI_UTILS_H_ -#define PLATFORM_BASE_WIFI_UTILS_H_ +#ifndef PLATFORM_PUBLIC_WIFI_UTILS_H_ +#define PLATFORM_PUBLIC_WIFI_UTILS_H_ #include +#include "absl/strings/string_view.h" #include "internal/platform/implementation/wifi.h" namespace nearby { @@ -57,4 +58,4 @@ class WifiUtils { } // namespace nearby -#endif // PLATFORM_BASE_WIFI_UTILS_H_ +#endif // PLATFORM_PUBLIC_WIFI_UTILS_H_ diff --git a/internal/platform/wifi_utils_test.cc b/internal/platform/implementation/wifi_utils_test.cc similarity index 98% rename from internal/platform/wifi_utils_test.cc rename to internal/platform/implementation/wifi_utils_test.cc index 01bc1b79..f87a22a5 100644 --- a/internal/platform/wifi_utils_test.cc +++ b/internal/platform/implementation/wifi_utils_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "internal/platform/wifi_utils.h" +#include "internal/platform/implementation/wifi_utils.h" #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" diff --git a/internal/platform/implementation/windows/BUILD b/internal/platform/implementation/windows/BUILD index 8f615664..5ebadaf8 100644 --- a/internal/platform/implementation/windows/BUILD +++ b/internal/platform/implementation/windows/BUILD @@ -18,7 +18,6 @@ cc_library( name = "types", srcs = [ "device_info.cc", - "log_message.cc", "timer.cc", ], hdrs = [ @@ -31,30 +30,30 @@ cc_library( "future.h", "input_file.h", "listenable_future.h", - "log_message.h", "mutex.h", "output_file.h", "preferences_manager.h", "scheduled_executor.h", "settable_future.h", "submittable_executor.h", + "task_scheduler.h", "timer.h", "utils.h", ], - copts = ["-Ithird_party/nearby/internal/platform/implementation/windows/generated"], defines = ["_SILENCE_CLANG_COROUTINE_MESSAGE"], - visibility = ["//third_party/nearby/sharing/internal/impl/windows:__pkg__"], + visibility = [ + "//sharing/internal/impl/windows:__pkg__", + ], deps = [ ":comm", - "//base", - "//base:stringprintf", "//internal/base:bluetooth_address", + "//internal/base:files", + "//internal/flags:nearby_flags", "//internal/platform:base", - "//internal/platform:types", + "//internal/platform:logging", "//internal/platform:uuid", "//internal/platform/implementation:types", "//internal/platform/implementation/windows/generated:types", - "//strings:strappendv", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/functional:any_invocable", @@ -102,16 +101,21 @@ cc_library( "wifi.h", "wifi_direct.h", "wifi_hotspot.h", + "wifi_intel.h", "wifi_lan.h", ], + copts = ["-DNO_INTEL_PIE"], visibility = ["//visibility:private"], deps = [ + "//connections/implementation/flags:connections_flags", + "//internal/flags:nearby_flags", "//internal/platform:base", - "//internal/platform:comm", - "//internal/platform:types", "//internal/platform:uuid", + "//internal/platform/flags:platform_flags", + "//internal/platform/implementation:account_manager", "//internal/platform/implementation:comm", - "//internal/platform/implementation:types", + "//internal/platform/implementation:wifi_utils", + "//internal/platform/implementation/shared:count_down_latch", "//internal/platform/implementation/windows/generated:types", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", @@ -141,6 +145,26 @@ cc_library( ], ) +cc_library( + name = "string_utils", + srcs = [ + "string_utils.cc", + ], + hdrs = [ + "string_utils.h", + ], + compatible_with = ["//buildenv/target:non_prod"], + visibility = [ + "//internal/platform:__subpackages__", + "//location/nearby:__subpackages__", + ], + deps = [ + "//internal/platform:logging", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + ], +) + cc_library( name = "windows", srcs = [ @@ -170,6 +194,7 @@ cc_library( "session_manager.cc", "submittable_executor.cc", "system_clock.cc", + "task_scheduler.cc", "thread_pool.cc", "utils.cc", "webrtc.cc", @@ -179,6 +204,7 @@ cc_library( "wifi_hotspot_medium.cc", "wifi_hotspot_server_socket.cc", "wifi_hotspot_socket.cc", + "wifi_intel.cc", "wifi_lan_medium.cc", "wifi_lan_server_socket.cc", "wifi_lan_socket.cc", @@ -186,30 +212,40 @@ cc_library( ], # This is the temporary solution to solve compilation error of Win32 WFDxxx() related API. # WFD API is only support after _WIN32_WINNT_WIN8, but the current lexan _WIN32_WINNT is set to _WIN32_WINNT_WIN7 - copts = ["-Ithird_party/nearby/internal/platform/implementation/windows/generated -D_WIN32_WINNT=_WIN32_WINNT_WIN10 -DWINVER=_WIN32_WINNT_WIN10"], + copts = [ + "-DNO_INTEL_PIE", + "-D_WIN32_WINNT=_WIN32_WINNT_WIN10 -DWINVER=_WIN32_WINNT_WIN10", + "-Wno-unused-variable", + "-Wno-unused-value", + ], defines = ["_SILENCE_CLANG_COROUTINE_MESSAGE"], visibility = [ + "//chrome/chromeos/assistant/data_migration/lib:__pkg__", "//connections:__subpackages__", "//fastpair:__subpackages__", + "//internal/platform:__subpackages__", "//location/nearby:__subpackages__", "//presence:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//sharing:__subpackages__", ], deps = [ ":comm", ":crypto", # build_cleaner: keep + ":string_utils", ":types", + "//connections/implementation/flags:connections_flags", "//internal/account", + "//internal/base:files", "//internal/flags:nearby_flags", "//internal/platform:base", "//internal/platform:cancellation_flag", - "//internal/platform:comm", - "//internal/platform:types", + "//internal/platform:logging", "//internal/platform:uuid", "//internal/platform/flags:platform_flags", "//internal/platform/implementation:comm", "//internal/platform/implementation:platform", "//internal/platform/implementation:types", + "//internal/platform/implementation:wifi_utils", "//internal/platform/implementation/shared:count_down_latch", "//internal/platform/implementation/shared:file", "//internal/platform/implementation/windows/generated:types", @@ -218,7 +254,6 @@ cc_library( "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/functional:any_invocable", - "@com_google_absl//absl/log:check", "@com_google_absl//absl/memory", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", @@ -240,9 +275,7 @@ cc_library( "test_data.h", "test_utils.h", ], - visibility = [ - "//visibility:private", # Only private by automation, not intent. Owner may accept CLs adding visibility. See go/scheuklappen#explicit-private. - ], + visibility = ["//visibility:private"], deps = [ "//internal/platform:base", "@nlohmann_json//:json", @@ -270,13 +303,16 @@ cc_test( "preferences_repository_test.cc", "scheduled_executor_test.cc", "submittable_executor_test.cc", + "task_scheduler_test.cc", "thread_pool_test.cc", "timer_test.cc", "utils_test.cc", "webrtc_test.cc", + "wifi_hotspot_test.cc", + "wifi_medium_test.cc", ], - copts = ["-Ithird_party/nearby/internal/platform/implementation/windows/generated -DCORE_ADAPTER_DLL"], - tags = ["notap"], + copts = ["-DCORE_ADAPTER_DLL"], + tags = ["nozapfhahn"], deps = [ ":comm", ":crypto", @@ -284,7 +320,7 @@ cc_test( ":types", ":windows", "//internal/platform:base", - "//internal/platform:types", + "//internal/platform:logging", "//internal/platform/implementation:comm", "//internal/platform/implementation:platform", "//internal/platform/implementation:types", @@ -300,3 +336,17 @@ cc_test( "@nlohmann_json//:json", ], ) + +cc_test( + name = "string_utils_test", + size = "small", + timeout = "short", + srcs = [ + "string_utils_test.cc", + ], + deps = [ + ":string_utils", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/internal/platform/implementation/windows/atomic_boolean.h b/internal/platform/implementation/windows/atomic_boolean.h index 119a48a1..08e2f4bd 100644 --- a/internal/platform/implementation/windows/atomic_boolean.h +++ b/internal/platform/implementation/windows/atomic_boolean.h @@ -25,6 +25,7 @@ namespace windows { // A boolean value that may be updated atomically. class AtomicBoolean : public api::AtomicBoolean { public: + explicit AtomicBoolean(bool value = false) : atomic_boolean_(value) {} ~AtomicBoolean() override = default; // Atomically read and return current value. diff --git a/internal/platform/implementation/windows/atomic_reference.h b/internal/platform/implementation/windows/atomic_reference.h index c6684074..f303c0ac 100644 --- a/internal/platform/implementation/windows/atomic_reference.h +++ b/internal/platform/implementation/windows/atomic_reference.h @@ -16,6 +16,7 @@ #define PLATFORM_IMPL_WINDOWS_ATOMIC_REFERENCE_H_ #include +#include #include "internal/platform/implementation/atomic_reference.h" @@ -25,6 +26,7 @@ namespace windows { // Type that allows 32-bit atomic reads and writes. class AtomicUint32 : public api::AtomicUint32 { public: + explicit AtomicUint32(std::uint32_t value = 0) : atomic_uint32_(value) {} ~AtomicUint32() override = default; // Atomically reads and returns stored value. diff --git a/internal/platform/implementation/windows/ble_gatt_client.cc b/internal/platform/implementation/windows/ble_gatt_client.cc index 41d56644..28d7a9cf 100644 --- a/internal/platform/implementation/windows/ble_gatt_client.cc +++ b/internal/platform/implementation/windows/ble_gatt_client.cc @@ -37,6 +37,7 @@ #include "internal/platform/byte_array.h" #include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/logging.h" #include "internal/platform/uuid.h" @@ -101,31 +102,42 @@ std::string GattCommunicationStatusToString(GattCommunicationStatus status) { BleGattClient::BleGattClient(BluetoothLEDevice ble_device) : ble_device_(ble_device) { - NEARBY_LOGS(VERBOSE) << __func__ << ": GATT client is created."; + if (ble_device_ == nullptr) { + LOG(WARNING) << __func__ << ": ble_device is null."; + } else { + LOG(INFO) << __func__ << ": GATT client is created, address: " + << uint64_to_mac_address_string(ble_device_.BluetoothAddress()); + } } BleGattClient::~BleGattClient() { - NEARBY_LOGS(VERBOSE) << __func__ << ": GATT client is released."; + LOG(INFO) << __func__ << ": GATT client is released."; Disconnect(); } bool BleGattClient::DiscoverServiceAndCharacteristics( const Uuid& service_uuid, const std::vector& characteristic_uuids) { + absl::MutexLock lock(&mutex_); if (!NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: kEnableBleV2Gatt)) { - auto windows_bluetooth_adapter_ = ::winrt::Windows::Devices::Bluetooth:: - BluetoothAdapter::GetDefaultAsync() - .get(); - if (windows_bluetooth_adapter_.IsExtendedAdvertisingSupported()) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT is disabled."; + BluetoothAdapter bluetooth_adapter; + if (bluetooth_adapter.IsExtendedAdvertisingSupported()) { + LOG(WARNING) << __func__ << ": GATT is disabled."; + return false; + } + + if (!bluetooth_adapter.IsCentralRoleSupported()) { + LOG(ERROR) << __func__ + << ": Bluetooth Hardware does not support Central " + "Role, which is required to start GATT client."; return false; } if (!NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: kEnableBleV2GattOnNonExtendedDevice)) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT is disabled."; + LOG(WARNING) << __func__ << ": GATT is disabled."; return false; } } @@ -135,13 +147,12 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( absl::StrAppend(out, std::string(uuid)); }); - NEARBY_LOGS(VERBOSE) << __func__ << ": Discover service_uuid=" - << std::string(service_uuid) - << " with characteristic_uuids=" << flat_characteristics; + VLOG(1) << __func__ << ": Discover service_uuid=" << std::string(service_uuid) + << " with characteristic_uuids=" << flat_characteristics; try { if (ble_device_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": BLE device is disconnected."; + LOG(ERROR) << __func__ << ": BLE device is disconnected."; return false; } @@ -155,23 +166,21 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( gatt_devices_services_result_ = get_gatt_services_async.GetResults(); break; case winrt::Windows::Foundation::AsyncStatus::Started: - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get GATT services due to timeout."; + LOG(ERROR) << __func__ + << ": Failed to get GATT services due to timeout."; get_gatt_services_async.Cancel(); return false; default: - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to get GATT services due to unknown reasons."; + LOG(ERROR) << __func__ + << ": Failed to get GATT services due to unknown reasons."; return false; } if (gatt_devices_services_result_.Status() != GattCommunicationStatus::Success) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get gatt service with error: " - << GattCommunicationStatusToString( - gatt_devices_services_result_.Status()); + LOG(ERROR) << __func__ << ": Failed to get gatt service with error: " + << GattCommunicationStatusToString( + gatt_devices_services_result_.Status()); gatt_devices_services_result_ = nullptr; return false; } @@ -185,9 +194,8 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( winrt::to_string(winrt::to_hstring(service.Uuid()))); }); - NEARBY_LOGS(VERBOSE) << __func__ - << ": Found GATT services=" << flat_services - << " from BLE device."; + LOG(INFO) << __func__ << ": Found GATT services=" << flat_services + << " from BLE device."; // Needs to check each service to make sure it includes all characteristic // uuids. Services may include duplicate service UUID, but each of them may @@ -196,27 +204,25 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( winrt::guid uuid = service.Uuid(); std::string uuid_string = winrt::to_string(winrt::to_hstring(uuid)); - NEARBY_LOGS(VERBOSE) << __func__ - << ": Found service UUID=" << uuid_string; + VLOG(1) << __func__ << ": Found service UUID=" << uuid_string; if (!is_nearby_uuid_equal_to_winrt_guid(service_uuid, uuid)) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << __func__ << ": Service uuid not match, continue check other services."; continue; } - NEARBY_LOGS(INFO) << __func__ - << ": Found the discovery service UUID=" << uuid_string; + LOG(INFO) << __func__ + << ": Found the discovery service UUID=" << uuid_string; // Try to check the characteristic uuids. GattCharacteristicsResult gatt_characteristics_result = service.GetCharacteristicsAsync(BluetoothCacheMode::Uncached).get(); if (gatt_characteristics_result.Status() != GattCommunicationStatus::Success) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get characteristics with error: " - << GattCommunicationStatusToString( - gatt_characteristics_result.Status()); + LOG(ERROR) << __func__ << ": Failed to get characteristics with error: " + << GattCommunicationStatusToString( + gatt_characteristics_result.Status()); continue; } @@ -227,8 +233,8 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( gatt_characteristic.Uuid()))); }); - NEARBY_LOGS(VERBOSE) << __func__ << ": Found GATT characteristics=" - << flat_characteristics; + VLOG(1) << __func__ + << ": Found GATT characteristics=" << flat_characteristics; bool found_all = true; @@ -246,8 +252,8 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( } } if (found == false) { - NEARBY_LOGS(WARNING) << __func__ << ": Cannot find characteristic: " - << std::string(characteristic_uuid); + LOG(WARNING) << __func__ << ": Cannot find characteristic: " + << std::string(characteristic_uuid); found_all = false; break; } @@ -258,21 +264,18 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( } // found all characteristics. - NEARBY_LOGS(VERBOSE) << __func__ << ": Found all characteristics."; + VLOG(1) << __func__ << ": Found all characteristics."; return true; } - NEARBY_LOGS(VERBOSE) << __func__ - << ": Failed to find service and all characteristics."; + LOG(ERROR) << __func__ + << ": Failed to find service and all characteristics."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get GATT services. exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Failed to get GATT services. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get GATT services. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Failed to get GATT services. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } return false; @@ -281,17 +284,16 @@ bool BleGattClient::DiscoverServiceAndCharacteristics( absl::optional BleGattClient::GetCharacteristic(const Uuid& service_uuid, const Uuid& characteristic_uuid) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Stared to get characteristic UUID=" - << std::string(characteristic_uuid) - << " in service UUID=" << std::string(service_uuid); absl::MutexLock lock(&mutex_); + VLOG(1) << __func__ << ": Stared to get characteristic UUID=" + << std::string(characteristic_uuid) + << " in service UUID=" << std::string(service_uuid); try { std::optional gatt_characteristic = GetNativeCharacteristic(service_uuid, characteristic_uuid); if (!gatt_characteristic.has_value()) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get native GATT characteristic."; + LOG(ERROR) << __func__ << ": Failed to get native GATT characteristic."; return absl::nullopt; } @@ -329,18 +331,17 @@ BleGattClient::GetCharacteristic(const Uuid& service_uuid, native_characteristic_map_[result].native_characteristic = gatt_characteristic; - NEARBY_LOGS(VERBOSE) << __func__ << ": Return Characteristic. uuid=" - << std::string(characteristic_uuid); + VLOG(1) << __func__ << ": Return Characteristic. uuid=" + << std::string(characteristic_uuid); return result; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get GATT characteristic. exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Failed to get GATT characteristic. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to get GATT characteristic. WinRT exception: " - << error.code() << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to get GATT characteristic. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } return absl::nullopt; @@ -348,33 +349,33 @@ BleGattClient::GetCharacteristic(const Uuid& service_uuid, absl::optional BleGattClient::ReadCharacteristic( const api::ble_v2::GattCharacteristic& characteristic) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Read characteristic=" - << std::string(characteristic.uuid); + absl::MutexLock lock(&mutex_); + VLOG(1) << __func__ + << ": Read characteristic=" << std::string(characteristic.uuid); try { std::optional gatt_characteristic = GetNativeCharacteristic(characteristic.service_uuid, characteristic.uuid); if (!gatt_characteristic.has_value()) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get native GATT characteristic."; + LOG(ERROR) << __func__ << ": Failed to get native GATT characteristic."; return absl::nullopt; } GattReadResult result = gatt_characteristic->ReadValueAsync(BluetoothCacheMode::Uncached).get(); if (result.Status() != GattCommunicationStatus::Success) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to read GATT characteristic with error: " - << GattCommunicationStatusToString(result.Status()); + LOG(ERROR) << __func__ + << ": Failed to read GATT characteristic with error: " + << GattCommunicationStatusToString(result.Status()); return absl::nullopt; } IBuffer buffer = result.Value(); int size = buffer.Length(); if (size == 0) { - NEARBY_LOGS(WARNING) << __func__ << ": No characteristic value."; - return absl::nullopt; + VLOG(1) << __func__ << ": No characteristic value."; + return ""; } DataReader data_reader = DataReader::FromBuffer(buffer); @@ -384,18 +385,17 @@ absl::optional BleGattClient::ReadCharacteristic( data.push_back(static_cast(data_reader.ReadByte())); } - NEARBY_LOGS(VERBOSE) << __func__ - << ": Got characteristic value length=" << data.size(); + VLOG(1) << __func__ << ": Got characteristic value length=" << data.size(); return data; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to read GATT characteristic. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to read GATT characteristic. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to read GATT characteristic. WinRT exception: " - << error.code() << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to read GATT characteristic. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } return absl::nullopt; @@ -404,16 +404,15 @@ absl::optional BleGattClient::ReadCharacteristic( bool BleGattClient::WriteCharacteristic( const api::ble_v2::GattCharacteristic& characteristic, absl::string_view value, api::ble_v2::GattClient::WriteType write_type) { - NEARBY_LOGS(VERBOSE) << __func__ << ": write characteristic: " - << std::string(characteristic.uuid); absl::MutexLock lock(&mutex_); + VLOG(1) << __func__ + << ": write characteristic: " << std::string(characteristic.uuid); try { std::optional gatt_characteristic = native_characteristic_map_[characteristic].native_characteristic; if (!gatt_characteristic.has_value()) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get native GATT characteristic."; + LOG(ERROR) << __func__ << ": Failed to get native GATT characteristic."; return false; } @@ -430,27 +429,25 @@ bool BleGattClient::WriteCharacteristic( gatt_characteristic->WriteValueAsync(buffer, write_option).get(); if (status != GattCommunicationStatus::Success) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to write data to GATT characteristic: " - << std::string(characteristic.uuid) << "with error: " - << GattCommunicationStatusToString(status); + LOG(ERROR) << __func__ + << ": Failed to write data to GATT characteristic: " + << std::string(characteristic.uuid) + << "with error: " << GattCommunicationStatusToString(status); return false; } else { - NEARBY_LOGS(VERBOSE) << __func__ - << ": Write data to GATT characteristic: " - << std::string(characteristic.uuid) - << ", bytes count: " << value.size(); + VLOG(1) << __func__ << ": Write data to GATT characteristic: " + << std::string(characteristic.uuid) + << ", bytes count: " << value.size(); return true; } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to write GATT characteristic. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to write GATT characteristic. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to write GATT characteristic. WinRT exception: " - << error.code() << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to write GATT characteristic. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } return false; } @@ -459,8 +456,8 @@ bool BleGattClient::SetCharacteristicSubscription( const api::ble_v2::GattCharacteristic& characteristic, bool enable, absl::AnyInvocable on_characteristic_changed_cb) { - NEARBY_LOGS(VERBOSE) << __func__ - << ": Started to set Characteristic Subscription."; + absl::MutexLock lock(&mutex_); + VLOG(1) << __func__ << ": Started to set Characteristic Subscription."; GattClientCharacteristicConfigurationDescriptorValue gcccd_value = GattClientCharacteristicConfigurationDescriptorValue::None; if ((characteristic.property & Property::kNotify) != Property::kNone) { @@ -470,22 +467,18 @@ bool BleGattClient::SetCharacteristicSubscription( gcccd_value = GattClientCharacteristicConfigurationDescriptorValue::Indicate; } else { - NEARBY_LOGS(WARNING) << "Characeristic: " - << std::string(characteristic.uuid) - << " supports neither notifications nor indications."; + LOG(WARNING) << "Characeristic: " << std::string(characteristic.uuid) + << " supports neither notifications nor indications."; return false; } std::optional gatt_characteristic; - { - absl::MutexLock lock(&mutex_); - gatt_characteristic = - native_characteristic_map_[characteristic].native_characteristic; - } + + gatt_characteristic = + native_characteristic_map_[characteristic].native_characteristic; if (!gatt_characteristic.has_value()) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get native GATT characteristic."; + LOG(ERROR) << __func__ << ": Failed to get native GATT characteristic."; return false; } @@ -498,7 +491,6 @@ bool BleGattClient::SetCharacteristicSubscription( return false; } - absl::MutexLock lock(&mutex_); // Set value changed handler try { if (enable) { @@ -513,27 +505,23 @@ bool BleGattClient::SetCharacteristicSubscription( }); if (!native_characteristic_map_[characteristic].notification_token) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to add value change handler."; + LOG(ERROR) << __func__ << ": Failed to add value change handler."; return false; } } else if (native_characteristic_map_[characteristic].notification_token) { gatt_characteristic->ValueChanged(std::exchange( native_characteristic_map_[characteristic].notification_token, {})); } - NEARBY_LOGS(ERROR) << __func__ - << ": Successfully set Characteristic Subscription."; + LOG(ERROR) << __func__ << ": Successfully set Characteristic Subscription."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set Characteristic Subscription." - << exception.what(); + LOG(ERROR) << __func__ << ": Failed to set Characteristic Subscription." + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set Characteristic Subscription." - " WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to set Characteristic Subscription." + " WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } return false; } @@ -541,38 +529,36 @@ bool BleGattClient::SetCharacteristicSubscription( void BleGattClient::Disconnect() { absl::MutexLock lock(&mutex_); try { - NEARBY_LOGS(VERBOSE) << __func__ << ": Disconnect is called."; + VLOG(1) << __func__ << ": Disconnect is called."; if (ble_device_ != nullptr) { ble_device_.Close(); ble_device_ = nullptr; } native_characteristic_map_.clear(); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to disconnect GATT device. exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Failed to disconnect GATT device. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to disconnect GATT device. WinRT exception: " - << error.code() << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to disconnect GATT device. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } } std::optional BleGattClient::GetNativeCharacteristic( const Uuid& service_uuid, const Uuid& characteristic_uuid) { - NEARBY_LOGS(VERBOSE) << __func__ - << ": Stared to get native characteristic UUID=" - << std::string(characteristic_uuid) - << " in service UUID=" << std::string(service_uuid); + VLOG(1) << __func__ << ": Stared to get native characteristic UUID=" + << std::string(characteristic_uuid) + << " in service UUID=" << std::string(service_uuid); try { if (ble_device_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": BLE device is disconnected."; + LOG(ERROR) << __func__ << ": BLE device is disconnected."; return absl::nullopt; } if (gatt_devices_services_result_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": No available GATT services."; + LOG(ERROR) << __func__ << ": No available GATT services."; return absl::nullopt; } @@ -582,10 +568,10 @@ std::optional BleGattClient::GetNativeCharacteristic( service.GetCharacteristicsAsync(BluetoothCacheMode::Cached).get(); if (gatt_characteristics_result.Status() != GattCommunicationStatus::Success) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to get characteristics with error: " - << GattCommunicationStatusToString( - gatt_characteristics_result.Status()); + LOG(ERROR) << __func__ + << ": Failed to get characteristics with error: " + << GattCommunicationStatusToString( + gatt_characteristics_result.Status()); continue; } @@ -593,9 +579,8 @@ std::optional BleGattClient::GetNativeCharacteristic( gatt_characteristics_result.Characteristics()) { if (is_nearby_uuid_equal_to_winrt_guid(characteristic_uuid, characteristic.Uuid())) { - NEARBY_LOGS(VERBOSE) - << __func__ << ": Return native Characteristic. uuid=" - << std::string(characteristic_uuid); + VLOG(1) << __func__ << ": Return native Characteristic. uuid=" + << std::string(characteristic_uuid); return characteristic; } @@ -603,13 +588,13 @@ std::optional BleGattClient::GetNativeCharacteristic( } } - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get native characteristic."; + LOG(ERROR) << __func__ << ": Failed to get native characteristic."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to get native GATT characteristic. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to get native GATT characteristic. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ": Failed to get native GATT characteristic. WinRT exception: " << error.code() << ": " << winrt::to_string(error.message()); @@ -621,9 +606,8 @@ std::optional BleGattClient::GetNativeCharacteristic( bool BleGattClient::WriteCharacteristicConfigurationDescriptor( GattCharacteristic& characteristic, GattClientCharacteristicConfigurationDescriptorValue value) { - NEARBY_LOGS(VERBOSE) - << __func__ - << ": Stared to write characteristic configuration descriptor"; + VLOG(1) << __func__ + << ": Stared to write characteristic configuration descriptor"; try { GattCommunicationStatus status = @@ -631,23 +615,23 @@ bool BleGattClient::WriteCharacteristicConfigurationDescriptor( .WriteClientCharacteristicConfigurationDescriptorAsync(value) .get(); if (status == GattCommunicationStatus::Success) { - NEARBY_LOGS(VERBOSE) << __func__ - << ": Successfully write client characteristic " - "configuration descriptor"; + VLOG(1) << __func__ + << ": Successfully write client characteristic " + "configuration descriptor"; return true; } - NEARBY_LOGS(VERBOSE) << __func__ - << ": Failed to write client characteristic " - "configuration descriptor with error: " - << GattCommunicationStatusToString(status); + LOG(ERROR) << __func__ + << ": Failed to write client characteristic " + "configuration descriptor with error: " + << GattCommunicationStatusToString(status); } catch (std::exception exception) { // This usually happens when a device reports that it support notify, but // it actually doesn't. - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to write client characteristic " - "configuration descriptor"; + LOG(ERROR) << __func__ + << ": Failed to write client characteristic " + "configuration descriptor"; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ": Failed to write client characteristic configuration descriptor." " WinRT exception: " @@ -659,7 +643,7 @@ bool BleGattClient::WriteCharacteristicConfigurationDescriptor( void BleGattClient::OnCharacteristicValueChanged( const api::ble_v2::GattCharacteristic& characteristic, GattValueChangedEventArgs args) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Gatt Characteristic value changed."; + VLOG(1) << __func__ << ": Gatt Characteristic value changed."; IBuffer buffer = args.CharacteristicValue(); int size = buffer.Length(); DataReader data_reader = DataReader::FromBuffer(buffer); @@ -668,8 +652,7 @@ void BleGattClient::OnCharacteristicValueChanged( for (int i = 0; i < size; ++i) { data.push_back(static_cast(data_reader.ReadByte())); } - NEARBY_LOGS(VERBOSE) << __func__ - << ": Got characteristic value length= " << data.size(); + VLOG(1) << __func__ << ": Got characteristic value length= " << data.size(); absl::AnyInvocable on_characteristic_changed_cb; @@ -678,8 +661,7 @@ void BleGattClient::OnCharacteristicValueChanged( if (!native_characteristic_map_.contains(characteristic) || !native_characteristic_map_[characteristic] .on_characteristic_changed_cb) { - NEARBY_LOGS(INFO) << __func__ - << ": No registered callback for characteristic."; + LOG(INFO) << __func__ << ": No registered callback for characteristic."; return; } on_characteristic_changed_cb = diff --git a/internal/platform/implementation/windows/ble_gatt_client.h b/internal/platform/implementation/windows/ble_gatt_client.h index 32b216db..473e5e2f 100644 --- a/internal/platform/implementation/windows/ble_gatt_client.h +++ b/internal/platform/implementation/windows/ble_gatt_client.h @@ -23,10 +23,15 @@ #include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" +#include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" +#include "absl/types/optional.h" #include "internal/platform/byte_array.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/uuid.h" #include "winrt/Windows.Devices.Bluetooth.GenericAttributeProfile.h" #include "winrt/Windows.Devices.Bluetooth.h" #include "winrt/base.h" @@ -42,25 +47,29 @@ class BleGattClient : public api::ble_v2::GattClient { bool DiscoverServiceAndCharacteristics( const Uuid& service_uuid, - const std::vector& characteristic_uuids) override; + const std::vector& characteristic_uuids) override + ABSL_LOCKS_EXCLUDED(mutex_); absl::optional GetCharacteristic( - const Uuid& service_uuid, const Uuid& characteristic_uuid) override; + const Uuid& service_uuid, const Uuid& characteristic_uuid) override + ABSL_LOCKS_EXCLUDED(mutex_); absl::optional ReadCharacteristic( - const api::ble_v2::GattCharacteristic& characteristic) override; + const api::ble_v2::GattCharacteristic& characteristic) override + ABSL_LOCKS_EXCLUDED(mutex_); bool WriteCharacteristic( const api::ble_v2::GattCharacteristic& characteristic, absl::string_view value, - api::ble_v2::GattClient::WriteType write_type) override; + api::ble_v2::GattClient::WriteType write_type) override + ABSL_LOCKS_EXCLUDED(mutex_); bool SetCharacteristicSubscription( const api::ble_v2::GattCharacteristic& characteristic, bool enable, absl::AnyInvocable - on_characteristic_changed_cb) override; + on_characteristic_changed_cb) override ABSL_LOCKS_EXCLUDED(mutex_); - void Disconnect() override; + void Disconnect() override ABSL_LOCKS_EXCLUDED(mutex_); private: // Used to save native data related to the GATT characteristic. @@ -75,13 +84,15 @@ class BleGattClient : public api::ble_v2::GattClient { std::optional<::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattCharacteristic> GetNativeCharacteristic(const Uuid& service_uuid, - const Uuid& characteristic_uuid); + const Uuid& characteristic_uuid) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); bool WriteCharacteristicConfigurationDescriptor( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattCharacteristic& characteristic, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattClientCharacteristicConfigurationDescriptorValue value); + GattClientCharacteristicConfigurationDescriptorValue value) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void OnCharacteristicValueChanged( const api::ble_v2::GattCharacteristic& characteristic, @@ -90,9 +101,11 @@ class BleGattClient : public api::ble_v2::GattClient { absl::Mutex mutex_; - ::winrt::Windows::Devices::Bluetooth::BluetoothLEDevice ble_device_; + ::winrt::Windows::Devices::Bluetooth::BluetoothLEDevice ble_device_ + ABSL_GUARDED_BY(mutex_); ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattDeviceServicesResult gatt_devices_services_result_ = nullptr; + GattDeviceServicesResult gatt_devices_services_result_ + ABSL_GUARDED_BY(mutex_) = nullptr; absl::flat_hash_map native_characteristic_map_ ABSL_GUARDED_BY(mutex_); diff --git a/internal/platform/implementation/windows/ble_gatt_server.cc b/internal/platform/implementation/windows/ble_gatt_server.cc index ea4ef93d..117068bf 100644 --- a/internal/platform/implementation/windows/ble_gatt_server.cc +++ b/internal/platform/implementation/windows/ble_gatt_server.cc @@ -15,6 +15,7 @@ #include "internal/platform/implementation/windows/ble_gatt_server.h" #include +#include #include #include #include @@ -25,15 +26,21 @@ #include #include "absl/container/flat_hash_map.h" -#include "absl/log/check.h" +#include "absl/functional/any_invocable.h" #include "absl/status/status.h" #include "absl/strings/escaping.h" #include "absl/strings/str_format.h" +#include "absl/synchronization/mutex.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" #include "absl/types/optional.h" #include "internal/platform/byte_array.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" +#include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/logging.h" +#include "internal/platform/uuid.h" #include "winrt/Windows.Foundation.Collections.h" #include "winrt/Windows.Storage.Streams.h" #include "winrt/base.h" @@ -81,6 +88,9 @@ using ::winrt::Windows::Storage::Streams::DataWriter; using Permission = api::ble_v2::GattCharacteristic::Permission; using Property = api::ble_v2::GattCharacteristic::Property; +constexpr absl::Duration kGattServerTimeout = absl::Milliseconds(500); +constexpr int kGattServerCheckIntervalInMills = 50; + std::string ConvertGattStatusToString( GattServiceProviderAdvertisementStatus status) { switch (status) { @@ -106,20 +116,22 @@ BleGattServer::BleGattServer(api::BluetoothAdapter* adapter, api::ble_v2::ServerGattConnectionCallback callback) : adapter_(dynamic_cast(adapter)), peripheral_(adapter_->GetMacAddress()), - gatt_connection_callback_(std::move(callback)) {} + gatt_connection_callback_(std::move(callback)) { + DCHECK(adapter_ != nullptr); +} absl::optional BleGattServer::CreateCharacteristic( const Uuid& service_uuid, const Uuid& characteristic_uuid, api::ble_v2::GattCharacteristic::Permission permission, api::ble_v2::GattCharacteristic::Property property) { - NEARBY_LOGS(VERBOSE) << __func__ << ": create characteristic, service_uuid: " - << std::string(service_uuid) << ", characteristic_uuid: " - << std::string(characteristic_uuid); + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": create characteristic, service_uuid: " + << std::string(service_uuid) + << ", characteristic_uuid: " << std::string(characteristic_uuid); if (!service_uuid_.IsEmpty() && service_uuid_ != service_uuid) { - NEARBY_LOGS(ERROR) << __func__ - << ": Only support one GATT service for now."; + LOG(ERROR) << __func__ << ": Only support one GATT service for now."; return absl::nullopt; } @@ -142,18 +154,18 @@ BleGattServer::CreateCharacteristic( bool BleGattServer::UpdateCharacteristic( const api::ble_v2::GattCharacteristic& characteristic, const nearby::ByteArray& value) { - NEARBY_LOGS(VERBOSE) << __func__ << ": update characteristic: " - << std::string(characteristic.uuid); + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ + << ": update characteristic: " << std::string(characteristic.uuid); if (characteristic.service_uuid != service_uuid_) { - NEARBY_LOGS(ERROR) << __func__ << ": Cannot found the GATT service."; + LOG(ERROR) << __func__ << ": Cannot found the GATT service."; return false; } for (auto& it : gatt_characteristic_datas_) { if (it.gatt_characteristic.uuid == characteristic.uuid) { - NEARBY_LOGS(VERBOSE) << __func__ - << ": Found the characteristic to update."; + VLOG(1) << __func__ << ": Found the characteristic to update."; it.data = value; // If it is in running, notify the value changed. @@ -165,8 +177,7 @@ bool BleGattServer::UpdateCharacteristic( is_indicate_characteristic = true; } - NEARBY_LOGS(INFO) << __func__ - << ": Notify characteristic value updated."; + LOG(INFO) << __func__ << ": Notify characteristic value updated."; if (is_indicate_characteristic) { NotifyValueChanged(it.gatt_characteristic); } @@ -176,7 +187,7 @@ bool BleGattServer::UpdateCharacteristic( } } - NEARBY_LOGS(ERROR) << __func__ << ": Failed to update the characteristic."; + LOG(ERROR) << __func__ << ": Failed to update the characteristic."; return false; } @@ -184,45 +195,75 @@ bool BleGattServer::UpdateCharacteristic( absl::Status BleGattServer::NotifyCharacteristicChanged( const api::ble_v2::GattCharacteristic& characteristic, bool confirm, const ByteArray& new_value) { + absl::MutexLock lock(&mutex_); // Currently, the method is not hooked up at platform layer. - NEARBY_LOGS(VERBOSE) << __func__ << ": Notify characteristic=" - << std::string(characteristic.uuid) << " changed."; + VLOG(1) << __func__ + << ": Notify characteristic=" << std::string(characteristic.uuid) + << " changed."; return absl::OkStatus(); } void BleGattServer::Stop() { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start to stop GATT server."; - try { - if (gatt_service_provider_ == nullptr) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT server already stopped."; - return; - } + absl::AnyInvocable close_notifier = nullptr; + { + absl::MutexLock lock(&mutex_); + VLOG(1) << __func__ << ": Start to stop GATT server."; + if (gatt_service_provider_ != nullptr) { + try { + if (is_advertising_) { + gatt_service_provider_.StopAdvertising(); + } - if (is_advertising_) { - gatt_service_provider_.StopAdvertising(); + gatt_characteristic_datas_.clear(); + service_uuid_ = Uuid(); + gatt_service_provider_ = nullptr; + } catch (std::exception exception) { + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); + } catch (const winrt::hresult_error& error) { + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); + } catch (...) { + LOG(ERROR) << __func__ << ": Unknown exception."; + } + } else { + LOG(WARNING) << __func__ << ": no GATT server is running."; } + close_notifier = std::move(close_notifier_); + } - gatt_characteristic_datas_.clear(); - service_uuid_ = Uuid(); - gatt_service_provider_ = nullptr; - } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); - } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); - } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + if (close_notifier != nullptr) { + close_notifier(); } } bool BleGattServer::InitializeGattServer() { try { // Create and advertise GATT service. - NEARBY_LOGS(VERBOSE) << __func__ << ": Create GATT service service_uuid=" - << std::string(service_uuid_); + VLOG(1) << __func__ << ": Create GATT service service_uuid=" + << std::string(service_uuid_); - if (adapter_ == nullptr || !adapter_->IsEnabled()) { - NEARBY_LOGS(ERROR) << __func__ << ": Bluetooth adapter is disabled."; + if (adapter_ == nullptr) { + LOG(ERROR) << __func__ << ": Bluetooth adapter is absent."; + return false; + } + + if (!adapter_->IsEnabled()) { + LOG(ERROR) << __func__ << ": Bluetooth adapter is disabled."; + return false; + } + + if (!adapter_->IsLowEnergySupported()) { + LOG(ERROR) << __func__ + << ": Bluetooth adapter does not support BLE, which " + "is needed to start GATT server."; + return false; + } + + if (!adapter_->IsPeripheralRoleSupported()) { + LOG(ERROR) + << __func__ + << ": Bluetooth Hardware does not support Peripheral Role, which is " + "required to start GATT server."; return false; } @@ -231,9 +272,8 @@ bool BleGattServer::InitializeGattServer() { GattServiceProvider::CreateAsync(service_uuid).get(); if (service_provider_result.Error() != BluetoothError::Success) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to create GATT service. Error: " - << static_cast(service_provider_result.Error()); + LOG(ERROR) << __func__ << ": Failed to create GATT service. Error: " + << static_cast(service_provider_result.Error()); return false; } @@ -242,7 +282,7 @@ bool BleGattServer::InitializeGattServer() { service_provider_advertisement_changed_token_ = gatt_service_provider_.AdvertisementStatusChanged( {this, &BleGattServer::ServiceProvider_AdvertisementStatusChanged}); - NEARBY_LOGS(INFO) << __func__ << ": GATT service created."; + LOG(INFO) << __func__ << ": GATT service created."; // Create GATT characteristics. for (auto& characteristic_data : gatt_characteristic_datas_) { @@ -276,12 +316,11 @@ bool BleGattServer::InitializeGattServer() { is_notify_supported = true; } - NEARBY_LOGS(VERBOSE) << __func__ - << ": GATT characteristic properties: read=" - << is_read_supported - << ",write=" << is_write_supported - << ",indicate=" << is_indicate_supported - << ",notify=" << is_notify_supported; + VLOG(1) << __func__ + << ": GATT characteristic properties: read=" << is_read_supported + << ",write=" << is_write_supported + << ",indicate=" << is_indicate_supported + << ",notify=" << is_notify_supported; gatt_characteristic_parameters.CharacteristicProperties(properties); gatt_characteristic_parameters.WriteProtectionLevel( @@ -290,10 +329,8 @@ bool BleGattServer::InitializeGattServer() { winrt::guid characteristic_uuid = nearby_uuid_to_winrt_guid( characteristic_data.gatt_characteristic.uuid); - NEARBY_LOGS(VERBOSE) << __func__ - << ": Create characteristic characteristic_uuid=" - << winrt::to_string( - winrt::to_hstring(characteristic_uuid)); + VLOG(1) << __func__ << ": Create characteristic characteristic_uuid=" + << winrt::to_string(winrt::to_hstring(characteristic_uuid)); GattLocalCharacteristicResult result = gatt_service_provider_.Service() @@ -302,9 +339,9 @@ bool BleGattServer::InitializeGattServer() { .get(); if (result.Error() != BluetoothError::Success) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to create GATT characteristic. Error: " - << static_cast(result.Error()); + LOG(ERROR) << __func__ + << ": Failed to create GATT characteristic. Error: " + << static_cast(result.Error()); return false; } @@ -312,9 +349,8 @@ bool BleGattServer::InitializeGattServer() { ::winrt::guid local_characteristic_guid = characteristic_data.local_characteristic.Uuid(); - NEARBY_LOGS(VERBOSE) << __func__ << ": Local GATT characteristic. uuid: " - << winrt::to_string( - winrt::to_hstring(local_characteristic_guid)); + VLOG(1) << __func__ << ": Local GATT characteristic. uuid: " + << winrt::to_string(winrt::to_hstring(local_characteristic_guid)); // Setup gatt local characteristic events. if (is_read_supported) { @@ -339,15 +375,15 @@ bool BleGattServer::InitializeGattServer() { is_gatt_server_inited_ = true; - NEARBY_LOGS(INFO) << __func__ << ": GATT service is initalized."; + LOG(INFO) << __func__ << ": GATT service is initalized."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } // Clean up. @@ -361,21 +397,31 @@ bool BleGattServer::InitializeGattServer() { bool BleGattServer::StartAdvertisement(const ByteArray& service_data, bool is_connectable) { + absl::MutexLock lock(&mutex_); + try { - NEARBY_LOGS(VERBOSE) << __func__ << ": service_data=" - << absl::BytesToHexString(service_data.AsStringView()) - << ", is_connectable=" << is_connectable; + VLOG(1) << __func__ << ": service_data=" + << absl::BytesToHexString(service_data.AsStringView()) + << ", is_connectable=" << is_connectable; if (is_advertising_) { - NEARBY_LOGS(ERROR) << ": GATT server is already in advertising."; + LOG(ERROR) << ": GATT server is already in advertising."; return false; } - is_advertising_ = true; - if (!is_gatt_server_inited_ && !InitializeGattServer()) { - NEARBY_LOGS(ERROR) << ":Failed to initalize GATT service."; - is_advertising_ = false; + LOG(ERROR) << ":Failed to initalize GATT service."; + return false; + } + + if (gatt_service_provider_ == nullptr) { + LOG(WARNING) << __func__ << ": no GATT server is running."; + return false; + } + + if (gatt_service_provider_.AdvertisementStatus() == + GattServiceProviderAdvertisementStatus::Started) { + LOG(WARNING) << __func__ << ": GATT server is already in advertising."; return false; } @@ -392,69 +438,96 @@ bool BleGattServer::StartAdvertisement(const ByteArray& service_data, advertisement_parameters.ServiceData(data_writer.DetachBuffer()); gatt_service_provider_.StartAdvertising(advertisement_parameters); - NEARBY_LOGS(INFO) << __func__ << ": GATT server started."; + + // Wait for the advertising to start. + int wait_milliseconds = 0; + while (gatt_service_provider_.AdvertisementStatus() != + GattServiceProviderAdvertisementStatus::Started) { + absl::SleepFor(absl::Milliseconds(kGattServerCheckIntervalInMills)); + wait_milliseconds += kGattServerCheckIntervalInMills; + if (absl::Milliseconds(wait_milliseconds) > kGattServerTimeout) { + LOG(ERROR) << __func__ + << ": Failed to start GATT advertising due to timeout."; + return false; + } + } + + is_advertising_ = true; + LOG(INFO) << __func__ << ": GATT server started."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } is_advertising_ = false; - NEARBY_LOGS(ERROR) << __func__ << ": Failed to advertise GATT server."; + LOG(ERROR) << __func__ << ": Failed to advertise GATT server."; return false; } bool BleGattServer::StopAdvertisement() { + absl::MutexLock lock(&mutex_); + try { - NEARBY_LOGS(INFO) << __func__ << ": stop advertisement."; + LOG(INFO) << __func__ << ": stop advertisement."; if (!is_advertising_) { - NEARBY_LOGS(WARNING) << __func__ << ": no GATT advertisement."; + LOG(WARNING) << __func__ << ": no GATT advertisement."; return true; } if (gatt_service_provider_ == nullptr) { - NEARBY_LOGS(WARNING) << __func__ << ": no GATT server is running."; + LOG(WARNING) << __func__ << ": no GATT server is running."; is_advertising_ = false; return true; } if (gatt_service_provider_.AdvertisementStatus() == GattServiceProviderAdvertisementStatus ::Stopped) { - NEARBY_LOGS(WARNING) << __func__ << ": no GATT advertisement is running."; + LOG(WARNING) << __func__ << ": no GATT advertisement is running."; is_advertising_ = false; return true; } gatt_service_provider_.StopAdvertising(); + + // Don't wait for the advertising to stop, because the advertisement status + // cannot back to stopped. Based on the observation, the advertisement + // status is stopped after the stop advertising is called. + is_advertising_ = false; - NEARBY_LOGS(INFO) << __func__ << ": GATT server stopped."; + LOG(INFO) << __func__ << ": GATT server stopped."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } +void BleGattServer::SetCloseNotifier(absl::AnyInvocable notifier) { + absl::MutexLock lock(&mutex_); + close_notifier_ = std::move(notifier); +} + ::winrt::fire_and_forget BleGattServer::Characteristic_ReadRequestedAsync( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattLocalCharacteristic const& gatt_local_characteristic, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattReadRequestedEventArgs args) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Read characteristic. uuid: " - << winrt::to_string(winrt::to_hstring( - gatt_local_characteristic.Uuid())); + LOG(INFO) << __func__ << ": Read characteristic. uuid: " + << winrt::to_string( + winrt::to_hstring(gatt_local_characteristic.Uuid())); auto deferral = args.GetDeferral(); @@ -464,15 +537,15 @@ bool BleGattServer::StopAdvertisement() { FindGattCharacteristicData(gatt_local_characteristic); if (characteristic_data == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to find characteristic=" - << ::winrt::to_string(::winrt::to_hstring( - gatt_local_characteristic.Uuid())); + LOG(ERROR) << __func__ << ": Failed to find characteristic=" + << ::winrt::to_string( + ::winrt::to_hstring(gatt_local_characteristic.Uuid())); return {}; } GattReadRequest request = args.GetRequestAsync().get(); if (request == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get GATT read request."; + LOG(ERROR) << __func__ << ": Failed to get GATT read request."; deferral.Complete(); return {}; } @@ -485,20 +558,20 @@ bool BleGattServer::StopAdvertisement() { request.RespondWithValue(buffer); deferral.Complete(); - NEARBY_LOGS(VERBOSE) << __func__ << ": Sent data to remote device."; + VLOG(1) << __func__ << ": Sent data to remote device."; return {}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } deferral.Complete(); - NEARBY_LOGS(ERROR) << __func__ << ": Failed to send data to remote device."; + LOG(ERROR) << __func__ << ": Failed to send data to remote device."; return {}; } @@ -507,7 +580,7 @@ bool BleGattServer::StopAdvertisement() { GattLocalCharacteristic const& gatt_local_characteristic, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattWriteRequestedEventArgs args) { - // In Nearby Connctions, don't support write charaterisctics right now. + // In Nearby Connections, don't support write characteristics right now. throw std::logic_error("Not implemented."); } @@ -515,10 +588,9 @@ void BleGattServer::Characteristic_SubscribedClientsChanged( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattLocalCharacteristic const& gatt_local_characteristic, ::winrt::Windows::Foundation::IInspectable const& args) { - NEARBY_LOGS(VERBOSE) << __func__ - << ": Subscribed clients changed. characteristic=" - << ::winrt::to_string(::winrt::to_hstring( - gatt_local_characteristic.Uuid())); + LOG(INFO) << __func__ << ": Subscribed clients changed. characteristic=" + << ::winrt::to_string( + ::winrt::to_hstring(gatt_local_characteristic.Uuid())); try { std::vector @@ -530,9 +602,9 @@ void BleGattServer::Characteristic_SubscribedClientsChanged( FindGattCharacteristicData(gatt_local_characteristic); if (characteristic_data == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to find characteristic=" - << ::winrt::to_string(::winrt::to_hstring( - gatt_local_characteristic.Uuid())); + LOG(ERROR) << __func__ << ": Failed to find characteristic=" + << ::winrt::to_string( + ::winrt::to_hstring(gatt_local_characteristic.Uuid())); return; } @@ -588,12 +660,12 @@ void BleGattServer::Characteristic_SubscribedClientsChanged( subscribed_characteristic); } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } } @@ -602,8 +674,9 @@ void BleGattServer::ServiceProvider_AdvertisementStatusChanged( GattServiceProvider const& sender, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattServiceProviderAdvertisementStatusChangedEventArgs const& args) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Advertisement status changed. status=" - << ConvertGattStatusToString(args.Status()); + LOG(INFO) << __func__ << ": Advertisement status changed. status=" + << ConvertGattStatusToString(args.Status()) + << ", error=" << static_cast(args.Error()); } void BleGattServer::NotifyValueChanged( @@ -613,8 +686,8 @@ void BleGattServer::NotifyValueChanged( FindGattCharacteristicData(gatt_characteristic); if (characteristic_data == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to find characteristic=" - << std::string(gatt_characteristic.uuid); + LOG(ERROR) << __func__ << ": Failed to find characteristic=" + << std::string(gatt_characteristic.uuid); return; } @@ -634,19 +707,19 @@ void BleGattServer::NotifyValueChanged( for (const auto& result : results) { if (result.Status() != GattCommunicationStatus::Success) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to notify value change. remote device id=" - << ::winrt::to_string( - result.SubscribedClient().Session().DeviceId().Id()); + LOG(ERROR) << __func__ + << ": Failed to notify value change. remote device id=" + << ::winrt::to_string( + result.SubscribedClient().Session().DeviceId().Id()); } } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } } diff --git a/internal/platform/implementation/windows/ble_gatt_server.h b/internal/platform/implementation/windows/ble_gatt_server.h index a6cf3b66..89bafde3 100644 --- a/internal/platform/implementation/windows/ble_gatt_server.h +++ b/internal/platform/implementation/windows/ble_gatt_server.h @@ -17,13 +17,20 @@ #include -#include +#include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" +#include "absl/synchronization/notification.h" +#include "absl/types/optional.h" #include "internal/platform/byte_array.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/windows/ble_v2_peripheral.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/uuid.h" @@ -37,26 +44,32 @@ namespace windows { class BleGattServer : public api::ble_v2::GattServer { public: + // Make sure the adapter parameter is not null. BleGattServer(api::BluetoothAdapter* adapter, api::ble_v2::ServerGattConnectionCallback callback); ~BleGattServer() override = default; absl::optional CreateCharacteristic( const Uuid& service_uuid, const Uuid& characteristic_uuid, api::ble_v2::GattCharacteristic::Permission permission, - api::ble_v2::GattCharacteristic::Property property) override; + api::ble_v2::GattCharacteristic::Property property) override + ABSL_LOCKS_EXCLUDED(mutex_); bool UpdateCharacteristic( const api::ble_v2::GattCharacteristic& characteristic, - const nearby::ByteArray& value) override; + const nearby::ByteArray& value) override ABSL_LOCKS_EXCLUDED(mutex_); absl::Status NotifyCharacteristicChanged( const api::ble_v2::GattCharacteristic& characteristic, bool confirm, - const ByteArray& new_value) override; + const ByteArray& new_value) override ABSL_LOCKS_EXCLUDED(mutex_); - void Stop() override; + void Stop() override ABSL_LOCKS_EXCLUDED(mutex_); - bool StartAdvertisement(const ByteArray& service_data, bool is_connectable); - bool StopAdvertisement(); + bool StartAdvertisement(const ByteArray& service_data, bool is_connectable) + ABSL_LOCKS_EXCLUDED(mutex_); + bool StopAdvertisement() ABSL_LOCKS_EXCLUDED(mutex_); + + void SetCloseNotifier(absl::AnyInvocable notifier) + ABSL_LOCKS_EXCLUDED(mutex_); api::ble_v2::BlePeripheral& GetBlePeripheral() override { return peripheral_; @@ -78,51 +91,65 @@ class BleGattServer : public api::ble_v2::GattServer { ::winrt::event_token subscribed_clients_changed_token{}; }; - bool InitializeGattServer(); + bool InitializeGattServer() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void NotifyValueChanged( - const api::ble_v2::GattCharacteristic& gatt_characteristic); + const api::ble_v2::GattCharacteristic& gatt_characteristic) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); GattCharacteristicData* FindGattCharacteristicData( const ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattLocalCharacteristic& gatt_local_characteristic); + GattLocalCharacteristic& gatt_local_characteristic) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); GattCharacteristicData* FindGattCharacteristicData( - const api::ble_v2::GattCharacteristic& gatt_characteristic); + const api::ble_v2::GattCharacteristic& gatt_characteristic) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); ::winrt::fire_and_forget Characteristic_ReadRequestedAsync( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattLocalCharacteristic const& gatt_local_characteristic, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattReadRequestedEventArgs args); + GattReadRequestedEventArgs args) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); ::winrt::fire_and_forget Characteristic_WriteRequestedAsync( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattLocalCharacteristic const& gatt_local_characteristic, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattWriteRequestedEventArgs args); + GattWriteRequestedEventArgs args) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void Characteristic_SubscribedClientsChanged( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattLocalCharacteristic const& gatt_local_characteristic, - ::winrt::Windows::Foundation::IInspectable const& args); + ::winrt::Windows::Foundation::IInspectable const& args) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void ServiceProvider_AdvertisementStatusChanged( ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: GattServiceProvider const& sender, ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattServiceProviderAdvertisementStatusChangedEventArgs const& args); + GattServiceProviderAdvertisementStatusChangedEventArgs const& args) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - BluetoothAdapter* adapter_ = nullptr; + absl::Mutex mutex_; + + BluetoothAdapter* const adapter_ = nullptr; BleV2Peripheral peripheral_; - - ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: - GattServiceProvider gatt_service_provider_ = nullptr; - - Uuid service_uuid_; - std::vector gatt_characteristic_datas_; - api::ble_v2::ServerGattConnectionCallback gatt_connection_callback_{}; - ::winrt::event_token service_provider_advertisement_changed_token_{}; - bool is_advertising_ = false; - bool is_gatt_server_inited_ = false; + ::winrt::Windows::Devices::Bluetooth::GenericAttributeProfile:: + GattServiceProvider gatt_service_provider_ ABSL_GUARDED_BY(mutex_) = + nullptr; + + absl::AnyInvocable close_notifier_ ABSL_GUARDED_BY(mutex_) = nullptr; + + Uuid service_uuid_ ABSL_GUARDED_BY(mutex_); + std::vector gatt_characteristic_datas_ + ABSL_GUARDED_BY(mutex_); + + bool is_advertising_ ABSL_GUARDED_BY(mutex_) = false; + bool is_gatt_server_inited_ ABSL_GUARDED_BY(mutex_) = false; + + ::winrt::event_token service_provider_advertisement_changed_token_ + ABSL_GUARDED_BY(mutex_) = {}; }; } // namespace windows diff --git a/internal/platform/implementation/windows/ble_gatt_server_test.cc b/internal/platform/implementation/windows/ble_gatt_server_test.cc index 406b283b..b374ef09 100644 --- a/internal/platform/implementation/windows/ble_gatt_server_test.cc +++ b/internal/platform/implementation/windows/ble_gatt_server_test.cc @@ -14,10 +14,13 @@ #include "internal/platform/implementation/windows/ble_gatt_server.h" +#include #include +#include #include "gtest/gtest.h" #include "absl/synchronization/notification.h" +#include "absl/time/time.h" #include "internal/platform/implementation/ble_v2.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" @@ -44,6 +47,23 @@ TEST(BleV2GattServer, DISABLED_Stop) { blev2_gatt_server.Stop(); } +TEST(BleV2GattServer, DISABLED_StopNotifierIsCalled) { + BluetoothAdapter bluetoothAdapter; + BleGattServer blev2_gatt_server(&bluetoothAdapter, {}); + bool is_close_notifier_called = false; + absl::Notification notification; + std::function notifier = [&is_close_notifier_called, + ¬ification]() { + is_close_notifier_called = true; + notification.Notify(); + }; + blev2_gatt_server.SetCloseNotifier(std::move(notifier)); + + blev2_gatt_server.Stop(); + notification.WaitForNotificationWithTimeout(absl::Seconds(1)); + EXPECT_TRUE(is_close_notifier_called); +} + TEST(BleV2GattServer, DISABLED_CreateCharacteristic) { BluetoothAdapter bluetoothAdapter; BleGattServer blev2_gatt_server(&bluetoothAdapter, {}); diff --git a/internal/platform/implementation/windows/ble_medium.cc b/internal/platform/implementation/windows/ble_medium.cc index 796afd98..b6fd51a2 100644 --- a/internal/platform/implementation/windows/ble_medium.cc +++ b/internal/platform/implementation/windows/ble_medium.cc @@ -15,6 +15,7 @@ #include "internal/platform/implementation/windows/ble_medium.h" #include // NOLINT +#include #include #include // NOLINT #include @@ -26,7 +27,9 @@ #include "absl/synchronization/mutex.h" #include "absl/synchronization/notification.h" #include "absl/time/time.h" +#include "internal/platform/byte_array.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/windows/ble_peripheral.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/utils.h" @@ -146,22 +149,20 @@ bool BleMedium::StartAdvertising( const std::string& fast_advertisement_service_uuid) { try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot start advertising because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot start advertising because the " + "bluetooth adapter is not enabled."; return false; } - NEARBY_LOGS(INFO) - << "Windows Ble StartAdvertising: service_id=" << service_id - << ", advertisement bytes= 0x" - << absl::BytesToHexString(advertisement_bytes.AsStringView()) << "(" - << advertisement_bytes.size() << ")," - << " fast advertisement service uuid= 0x" - << absl::BytesToHexString(fast_advertisement_service_uuid); + LOG(INFO) << "Windows Ble StartAdvertising: service_id=" << service_id + << ", advertisement bytes= 0x" + << absl::BytesToHexString(advertisement_bytes.AsStringView()) + << "(" << advertisement_bytes.size() << ")," + << " fast advertisement service uuid= 0x" + << absl::BytesToHexString(fast_advertisement_service_uuid); if (is_publisher_started_) { - NEARBY_LOGS(WARNING) - << "BLE cannot start to advertise again when it is running."; + LOG(WARNING) << "BLE cannot start to advertise again when it is running."; return false; } @@ -205,8 +206,8 @@ bool BleMedium::StartAdvertising( publisher_.UseExtendedAdvertisement(false); } else { // otherwise no-op - NEARBY_LOGS(INFO) << "Everyone Mode unavailable for hardware that does " - "not support Extended Advertising."; + LOG(INFO) << "Everyone Mode unavailable for hardware that does " + "not support Extended Advertising."; publisher_ = nullptr; return false; } @@ -217,21 +218,21 @@ bool BleMedium::StartAdvertising( publisher_.Start(); is_publisher_started_ = true; - NEARBY_LOGS(INFO) << "Windows Ble StartAdvertising started."; + LOG(INFO) << "Windows Ble StartAdvertising started."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to start BLE advertising: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to start BLE advertising: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to start BLE advertising: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to start BLE advertising: " << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -239,16 +240,15 @@ bool BleMedium::StartAdvertising( bool BleMedium::StopAdvertising(const std::string& service_id) { try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot stop advertising because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot stop advertising because the " + "bluetooth adapter is not enabled."; return false; } - NEARBY_LOGS(INFO) << "Windows Ble StopAdvertising: service_id=" - << service_id; + LOG(INFO) << "Windows Ble StopAdvertising: service_id=" << service_id; if (!is_publisher_started_) { - NEARBY_LOGS(WARNING) << "BLE advertising is not running."; + LOG(WARNING) << "BLE advertising is not running."; return false; } @@ -266,18 +266,18 @@ bool BleMedium::StopAdvertising(const std::string& service_id) { return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to stop BLE advertising: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to stop BLE advertising: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to stop BLE advertising: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to stop BLE advertising: " << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -288,16 +288,15 @@ bool BleMedium::StartScanning( DiscoveredPeripheralCallback callback) { try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot start scanning because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot start scanning because the " + "bluetooth adapter is not enabled."; return false; } - NEARBY_LOGS(INFO) << "Windows Ble StartScanning: service_id=" << service_id; + LOG(INFO) << "Windows Ble StartScanning: service_id=" << service_id; if (is_watcher_started_) { - NEARBY_LOGS(WARNING) - << "BLE cannot start to scan again when it is running."; + LOG(WARNING) << "BLE cannot start to scan again when it is running."; return false; } @@ -327,21 +326,20 @@ bool BleMedium::StartScanning( is_watcher_started_ = true; - NEARBY_LOGS(INFO) << "Windows Ble StartScanning started."; + LOG(INFO) << "Windows Ble StartScanning started."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to start BLE scanning: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to start BLE scanning: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to start BLE scanning: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": Exception to start BLE scanning: " << ex.code() + << ": " << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -349,15 +347,15 @@ bool BleMedium::StartScanning( bool BleMedium::StopScanning(const std::string& service_id) { try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot stop scanning because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot stop scanning because the " + "bluetooth adapter is not enabled."; return false; } - NEARBY_LOGS(INFO) << "Windows Ble StopScanning: service_id=" << service_id; + LOG(INFO) << "Windows Ble StopScanning: service_id=" << service_id; if (!is_watcher_started_) { - NEARBY_LOGS(WARNING) << "BLE scanning is not running."; + LOG(WARNING) << "BLE scanning is not running."; return false; } @@ -368,37 +366,35 @@ bool BleMedium::StopScanning(const std::string& service_id) { // stopping to finish. is_watcher_started_ = false; - NEARBY_LOGS(ERROR) - << "Windows Ble stoped scanning successfully for service_id=" - << service_id; + LOG(ERROR) << "Windows Ble stoped scanning successfully for service_id=" + << service_id; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to stop BLE scanning: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to stop BLE scanning: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to stop BLE scanning: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": Exception to stop BLE scanning: " << ex.code() + << ": " << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } bool BleMedium::StartAcceptingConnections(const std::string& service_id, AcceptedConnectionCallback callback) { - NEARBY_LOGS(INFO) << "Windows Ble StartAcceptingConnections: service_id=" - << service_id; + LOG(INFO) << "Windows Ble StartAcceptingConnections: service_id=" + << service_id; return true; } bool BleMedium::StopAcceptingConnections(const std::string& service_id) { - NEARBY_LOGS(INFO) << "Windows Ble StopAcceptingConnections: service_id=" - << service_id; + LOG(INFO) << "Windows Ble StopAcceptingConnections: service_id=" + << service_id; return true; } @@ -406,15 +402,15 @@ std::unique_ptr BleMedium::Connect( api::BlePeripheral& remote_peripheral, const std::string& service_id, CancellationFlag* cancellation_flag) { if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(ERROR) << "Windows BLE Connect: Has been cancelled: " - "service_id=" - << service_id; + LOG(ERROR) << "Windows BLE Connect: Has been cancelled: " + "service_id=" + << service_id; return {}; } - NEARBY_LOGS(ERROR) << "Windows Ble Connect: Cannot connect over BLE socket. " - "service_id=" - << service_id; + LOG(ERROR) << "Windows Ble Connect: Cannot connect over BLE socket. " + "service_id=" + << service_id; return {}; } @@ -424,75 +420,73 @@ void BleMedium::PublisherHandler( // This method is called when publisher's status is changed. switch (args.Status()) { case BluetoothLEAdvertisementPublisherStatus::Created: - NEARBY_LOGS(INFO) << "Nearby BLE Medium created to advertise."; + LOG(INFO) << "Nearby BLE Medium created to advertise."; return; case BluetoothLEAdvertisementPublisherStatus::Started: - NEARBY_LOGS(INFO) << "Nearby BLE Medium started to advertise."; + LOG(INFO) << "Nearby BLE Medium started to advertise."; return; case BluetoothLEAdvertisementPublisherStatus::Stopping: - NEARBY_LOGS(INFO) << "Nearby BLE Medium is stopping."; + LOG(INFO) << "Nearby BLE Medium is stopping."; return; case BluetoothLEAdvertisementPublisherStatus::Waiting: - NEARBY_LOGS(INFO) << "Nearby BLE Medium is waiting."; + LOG(INFO) << "Nearby BLE Medium is waiting."; return; case BluetoothLEAdvertisementPublisherStatus::Stopped: - NEARBY_LOGS(INFO) << "Nearby BLE Medium stopped to advertise."; + LOG(INFO) << "Nearby BLE Medium stopped to advertise."; break; case BluetoothLEAdvertisementPublisherStatus::Aborted: switch (args.Error()) { case BluetoothError::Success: if (publisher_.Status() == BluetoothLEAdvertisementPublisherStatus::Started) { - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium start advertising operation was " - "successfully completed or serviced."; + LOG(ERROR) << "Nearby BLE Medium start advertising operation was " + "successfully completed or serviced."; } if (publisher_.Status() == BluetoothLEAdvertisementPublisherStatus::Stopped) { - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stop advertising operation was " - "successfully completed or serviced."; + LOG(ERROR) << "Nearby BLE Medium stop advertising operation was " + "successfully completed or serviced."; } else { - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "unknown errors."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "unknown errors."; } break; case BluetoothError::RadioNotAvailable: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "radio not available."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "radio not available."; break; case BluetoothError::ResourceInUse: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "resource in use."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "resource in use."; break; case BluetoothError::DeviceNotConnected: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "remote device is not connected."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "remote device is not connected."; break; case BluetoothError::DisabledByPolicy: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "disabled by policy."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "disabled by policy."; break; case BluetoothError::DisabledByUser: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "disabled by user."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "disabled by user."; break; case BluetoothError::NotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "hardware not supported."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "hardware not supported."; break; case BluetoothError::TransportNotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "transport not supported."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "transport not supported."; break; case BluetoothError::ConsentRequired: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "consent required."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "consent required."; break; case BluetoothError::OtherError: default: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "unknown errors."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "unknown errors."; break; } break; @@ -502,7 +496,7 @@ void BleMedium::PublisherHandler( // The publisher is stopped. Clean up the running publisher if (publisher_ != nullptr) { - NEARBY_LOGS(ERROR) << "Nearby BLE Medium cleaned the publisher."; + LOG(ERROR) << "Nearby BLE Medium cleaned the publisher."; publisher_.StatusChanged(publisher_token_); publisher_ = nullptr; is_publisher_started_ = false; @@ -516,47 +510,42 @@ void BleMedium::WatcherHandler( // information on the reason. switch (args.Error()) { case BluetoothError::Success: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan successfully."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan successfully."; break; case BluetoothError::RadioNotAvailable: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to radio not available."; break; case BluetoothError::ResourceInUse: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to resource in use."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to resource in use."; break; case BluetoothError::DeviceNotConnected: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan due to " - "remote device is not connected."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to " + "remote device is not connected."; break; case BluetoothError::DisabledByPolicy: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to disabled by policy."; break; case BluetoothError::DisabledByUser: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to disabled by user."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to disabled by user."; break; case BluetoothError::NotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan due to " - "hardware not supported."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to " + "hardware not supported."; break; case BluetoothError::TransportNotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan due to " - "transport not supported."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to " + "transport not supported."; break; case BluetoothError::ConsentRequired: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to consent required."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to consent required."; break; case BluetoothError::OtherError: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to unknown errors."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to unknown errors."; break; default: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to unknown errors."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to unknown errors."; break; } @@ -564,7 +553,7 @@ void BleMedium::WatcherHandler( // The BLE V1 interface doesn't have an API to return the error to the upper // layer. if (watcher_ != nullptr) { - NEARBY_LOGS(ERROR) << "Nearby BLE Medium cleaned the watcher."; + LOG(ERROR) << "Nearby BLE Medium cleaned the watcher."; watcher_.Stopped(watcher_token_); watcher_.Received(advertisement_received_token_); watcher_ = nullptr; @@ -600,11 +589,10 @@ void BleMedium::AdvertisementReceivedHandler( ByteArray advertisement_data(data); - NEARBY_LOGS(VERBOSE) << "Nearby BLE Medium Advertisement discovered. " - "0x16 Service data: advertisement bytes= 0x" - << absl::BytesToHexString( - advertisement_data.AsStringView()) - << "(" << advertisement_data.size() << ")"; + VLOG(1) << "Nearby BLE Medium Advertisement discovered. " + "0x16 Service data: advertisement bytes= 0x" + << absl::BytesToHexString(advertisement_data.AsStringView()) + << "(" << advertisement_data.size() << ")"; std::string peripheral_name = uint64_to_mac_address_string(args.BluetoothAddress()); @@ -616,7 +604,7 @@ void BleMedium::AdvertisementReceivedHandler( if (peripheral_map_.contains(peripheral_name)) { if (peripheral_map_[peripheral_name]->GetAdvertisementBytes( service_id_) != advertisement_data) { - NEARBY_LOGS(INFO) << "BLE reports lost device: " << peripheral_name; + LOG(INFO) << "BLE reports lost device: " << peripheral_name; // Lost the device first and then the report discovered the // device. @@ -644,15 +632,13 @@ void BleMedium::AdvertisementReceivedHandler( // Received Fast Advertisement packet if (unconsumed_buffer_length <= 27) { - NEARBY_LOGS(INFO) - << "Sending Fast Advertisement packet for processing."; + LOG(INFO) << "Sending Fast Advertisement packet for processing."; advertisement_received_callback_.peripheral_discovered_cb( /*ble_peripheral*/ *peripheral_ptr, /*service_id*/ service_id_, /*is_fast_advertisement*/ true); } else { // Received Extended Advertising packet - NEARBY_LOGS(INFO) - << "Sending Extended Advertising packet for processing."; + LOG(INFO) << "Sending Extended Advertising packet for processing."; advertisement_received_callback_.peripheral_discovered_cb( /*ble_peripheral*/ *peripheral_ptr, /*service_id*/ service_id_, /*is_fast_advertisement*/ false); diff --git a/internal/platform/implementation/windows/ble_socket.cc b/internal/platform/implementation/windows/ble_socket.cc index 1b3210e6..216b7fd1 100644 --- a/internal/platform/implementation/windows/ble_socket.cc +++ b/internal/platform/implementation/windows/ble_socket.cc @@ -15,7 +15,10 @@ #include "internal/platform/implementation/windows/ble_socket.h" #include "absl/synchronization/mutex.h" -#include "internal/platform/implementation/ble.h" +#include "internal/platform/exception.h" +#include "internal/platform/implementation/windows/ble_peripheral.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { diff --git a/internal/platform/implementation/windows/ble_v2.cc b/internal/platform/implementation/windows/ble_v2.cc index eb607be1..92591ad6 100644 --- a/internal/platform/implementation/windows/ble_v2.cc +++ b/internal/platform/implementation/windows/ble_v2.cc @@ -16,6 +16,8 @@ #include #include +#include +#include #include #include #include @@ -23,23 +25,28 @@ #include #include +#include "absl/status/status.h" #include "absl/strings/escaping.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" +#include "absl/time/clock.h" #include "absl/time/time.h" #include "internal/flags/nearby_flags.h" -#include "internal/platform/bluetooth_adapter.h" #include "internal/platform/byte_array.h" #include "internal/platform/cancellation_flag.h" #include "internal/platform/cancellation_flag_listener.h" #include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/windows/ble_gatt_client.h" #include "internal/platform/implementation/windows/ble_gatt_server.h" +#include "internal/platform/implementation/windows/ble_v2_peripheral.h" #include "internal/platform/implementation/windows/ble_v2_server_socket.h" #include "internal/platform/implementation/windows/ble_v2_socket.h" +#include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/logging.h" #include "internal/platform/prng.h" @@ -89,6 +96,7 @@ using ::winrt::Windows::Devices::Bluetooth::Advertisement:: BluetoothLEScanningMode; using ::winrt::Windows::Foundation::TimeSpan; using ::winrt::Windows::Storage::Streams::Buffer; +using ::winrt::Windows::Storage::Streams::DataReader; using ::winrt::Windows::Storage::Streams::DataWriter; template @@ -114,6 +122,9 @@ static constexpr uint64_t kGenerateSessionIdRetryLimit = 3; // Indicating failed to generate unused session id. static constexpr uint64_t kFailedGenerateSessionId = 0; +constexpr absl::Duration kMediumTimeout = absl::Milliseconds(500); +constexpr int kMediumCheckIntervalInMills = 50; + // Remove lost/unused peripherals after a timeout. constexpr absl::Duration kPeripheralExpiryTime = absl::Minutes(15); // Prevent too frequent cleanup tasks. @@ -126,6 +137,7 @@ BleV2Medium::BleV2Medium(api::BluetoothAdapter& adapter) // Advertisement packet and populate accordingly. bool BleV2Medium::StartAdvertising(const BleAdvertisementData& advertising_data, AdvertiseParameters advertising_parameters) { + absl::MutexLock lock(&mutex_); std::string service_data_info; for (const auto& it : advertising_data.service_data) { service_data_info += "{uuid:" + std::string(it.first) + @@ -134,36 +146,35 @@ bool BleV2Medium::StartAdvertising(const BleAdvertisementData& advertising_data, absl::BytesToHexString(it.second.AsStringView()) + "}"; } - NEARBY_LOGS(INFO) << __func__ - << ": advertising_data.service_data=" << service_data_info - << ", tx_power_level=" - << TxPowerLevelToName( - advertising_parameters.tx_power_level); + LOG(INFO) << __func__ + << ": advertising_data.service_data=" << service_data_info + << ", tx_power_level=" + << TxPowerLevelToName(advertising_parameters.tx_power_level); if (advertising_data.is_extended_advertisement) { // In BLE v2, the flag is set when the Bluetooth adapter supports extended // advertising and GATT server is using. - NEARBY_LOGS(INFO) << __func__ - << ": BLE advertising using BLE extended feature."; + LOG(INFO) << __func__ << ": BLE advertising using BLE extended feature."; return StartBleAdvertising(advertising_data, advertising_parameters); } else { if (ble_gatt_server_ != nullptr) { - NEARBY_LOGS(INFO) << __func__ << ": BLE advertising on GATT server."; + LOG(INFO) << __func__ << ": BLE advertising on GATT server."; return StartGattAdvertising(advertising_data, advertising_parameters); } else { - NEARBY_LOGS(INFO) << __func__ << ": BLE fast advertising."; + LOG(INFO) << __func__ << ": BLE fast advertising."; return StartBleAdvertising(advertising_data, advertising_parameters); } } } bool BleV2Medium::StopAdvertising() { - NEARBY_LOGS(INFO) << __func__ << ": Stop advertising."; - bool result; + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": Stop advertising."; + bool result = true; if (is_gatt_publisher_started_) { bool stop_gatt_result = StopGattAdvertising(); if (!stop_gatt_result) { - NEARBY_LOGS(WARNING) << "Failed to stop GATT advertising."; + LOG(WARNING) << "Failed to stop GATT advertising."; } ble_gatt_server_ = nullptr; result = stop_gatt_result; @@ -172,7 +183,7 @@ bool BleV2Medium::StopAdvertising() { if (is_ble_publisher_started_) { bool stop_ble_result = StopBleAdvertising(); if (!stop_ble_result) { - NEARBY_LOGS(WARNING) << "Failed to stop BLE advertising."; + LOG(WARNING) << "Failed to stop BLE advertising."; } result = result && stop_ble_result; } @@ -180,40 +191,59 @@ bool BleV2Medium::StopAdvertising() { return result; } +// TODO(hais) manually verify the new api before switching async flags. std::unique_ptr BleV2Medium::StartAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, - api::ble_v2::AdvertiseParameters advertise_parameters, + api::ble_v2::AdvertiseParameters advertise_set_parameters, BleV2Medium::AdvertisingCallback callback) { - NEARBY_LOGS(INFO) << __func__ - << ": advertising_data.is_extended_advertisement=" - << advertising_data.is_extended_advertisement - << ", advertising_data.service_data size=" - << advertising_data.service_data.size() - << ", tx_power_level=" - << TxPowerLevelToName(advertise_parameters.tx_power_level) - << ", is_connectable=" - << advertise_parameters.is_connectable; - // TODO(hais): add real impl for windows StartAdvertising. - return nullptr; + LOG(INFO) << __func__ << ": advertising_data.is_extended_advertisement=" + << advertising_data.is_extended_advertisement + << ", advertising_data.service_data size=" + << advertising_data.service_data.size() << ", tx_power_level=" + << TxPowerLevelToName(advertise_set_parameters.tx_power_level) + << ", is_connectable=" << advertise_set_parameters.is_connectable; + if (StartAdvertising(advertising_data, advertise_set_parameters)) { + if (callback.start_advertising_result) { + callback.start_advertising_result(absl::OkStatus()); + } + } else { + if (callback.start_advertising_result) { + callback.start_advertising_result( + absl::InternalError("Failed to start advertising.")); + } + return nullptr; + } + + return std::make_unique( + BleV2Medium::AdvertisingSession{ + .stop_advertising = + [this]() { + if (StopAdvertising()) { + return absl::OkStatus(); + } else { + return absl::InternalError("Failed to stop advertising."); + } + }, + }); } bool BleV2Medium::StartScanning(const Uuid& service_uuid, TxPowerLevel tx_power_level, ScanCallback callback) { - NEARBY_LOGS(INFO) << __func__ - << ": service UUID: " << std::string(service_uuid) - << ", TxPowerLevel: " << TxPowerLevelToName(tx_power_level); + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": service UUID: " << std::string(service_uuid) + << ", TxPowerLevel: " << TxPowerLevelToName(tx_power_level); try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << __func__ - << "BLE cannot start scanning because the " - "Bluetooth adapter is not enabled."; + LOG(WARNING) << __func__ + << "BLE cannot start scanning because the " + "Bluetooth adapter is not enabled."; return false; } if (is_watcher_started_) { - NEARBY_LOGS(WARNING) - << __func__ << ": BLE cannot start to scan again when it is running."; + LOG(WARNING) << __func__ + << ": BLE cannot start to scan again when it is running."; return false; } @@ -248,23 +278,37 @@ bool BleV2Medium::StartScanning(const Uuid& service_uuid, watcher_.AdvertisementFilter(advertisement_filter); watcher_.Start(); + // Wait for the watcher to start. + int wait_milliseconds = 0; + while (watcher_.Status() != + BluetoothLEAdvertisementWatcherStatus::Started) { + absl::SleepFor(absl::Milliseconds(kMediumCheckIntervalInMills)); + wait_milliseconds += kMediumCheckIntervalInMills; + if (absl::Milliseconds(wait_milliseconds) > kMediumTimeout) { + LOG(ERROR) << __func__ << ": Failed to start BLE scan due to timeout.."; + watcher_.Stopped(watcher_token_); + watcher_.Received(advertisement_received_token_); + watcher_ = nullptr; + return false; + } + } + is_watcher_started_ = true; - NEARBY_LOGS(INFO) << __func__ << ": BLE scanning started."; + LOG(INFO) << __func__ << ": BLE scanning started."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to start BLE scanning: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to start BLE scanning: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to start BLE scanning: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": Exception to start BLE scanning: " << ex.code() + << ": " << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -272,17 +316,17 @@ bool BleV2Medium::StartScanning(const Uuid& service_uuid, std::unique_ptr BleV2Medium::StartScanning( const Uuid& service_uuid, TxPowerLevel tx_power_level, BleV2Medium::ScanningCallback callback) { - NEARBY_LOGS(INFO) << __func__ - << ": service UUID: " << std::string(service_uuid) - << ", TxPowerLevel: " << TxPowerLevelToName(tx_power_level); + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": service UUID: " << std::string(service_uuid) + << ", TxPowerLevel: " << TxPowerLevelToName(tx_power_level); if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << __func__ - << "BLE cannot start scanning because the " - "Bluetooth adapter is not enabled."; + LOG(WARNING) << __func__ + << "BLE cannot start scanning because the " + "Bluetooth adapter is not enabled."; return nullptr; } if (!is_watcher_started_) { - NEARBY_LOGS(WARNING) << __func__ << ": Starting BLE Scanning."; + LOG(WARNING) << __func__ << ": Starting BLE Scanning."; try { watcher_ = BluetoothLEAdvertisementWatcher(); watcher_token_ = watcher_.Stopped({this, &BleV2Medium::WatcherHandler}); @@ -304,35 +348,31 @@ std::unique_ptr BleV2Medium::StartScanning( watcher_.SignalStrengthFilter(filter); watcher_.Start(); is_watcher_started_ = true; - NEARBY_LOGS(INFO) << __func__ << ": BLE scanning started."; + LOG(INFO) << __func__ << ": BLE scanning started."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to start BLE scanning: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to start BLE scanning: " << exception.what(); return nullptr; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to start BLE scanning: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to start BLE scanning: " << ex.code() << ": " + << winrt::to_string(ex.message()); return nullptr; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return nullptr; } } else { - NEARBY_LOGS(WARNING) << __func__ << ": BLE Scanning already started."; + LOG(WARNING) << __func__ << ": BLE Scanning already started."; } uint64_t session_id = GenerateSessionId(); - // Save session id, service id and callback for this scan session. - { - absl::MutexLock lock(&map_mutex_); - auto iter = service_uuid_to_session_map_.find(service_uuid); - if (iter == service_uuid_to_session_map_.end()) { - service_uuid_to_session_map_[service_uuid].insert( - {session_id, std::move(callback)}); - } else { - iter->second.insert({session_id, std::move(callback)}); - } + auto iter = service_uuid_to_session_map_.find(service_uuid); + if (iter == service_uuid_to_session_map_.end()) { + service_uuid_to_session_map_[service_uuid].insert( + {session_id, std::move(callback)}); + } else { + iter->second.insert({session_id, std::move(callback)}); } // Generate and return ScanningSession. @@ -342,7 +382,7 @@ std::unique_ptr BleV2Medium::StartScanning( [this, session_id, service_uuid]() { size_t num_erased_from_service_and_session_map = 0u; { - absl::MutexLock lock(&map_mutex_); + absl::MutexLock lock(&mutex_); auto iter = service_uuid_to_session_map_.find(service_uuid); if (iter != service_uuid_to_session_map_.end()) { num_erased_from_service_and_session_map = @@ -359,27 +399,27 @@ std::unique_ptr BleV2Medium::StartScanning( // Stop discovery if there's no more on-going scan sessions. if (service_uuid_to_session_map_.empty()) { try { - NEARBY_LOGS(INFO) + LOG(INFO) << "No more scan sessions, stopping Ble scanning."; watcher_.Stop(); is_watcher_started_ = false; - NEARBY_LOGS(INFO) << "Ble stoped scanning successfully."; + LOG(INFO) << "Ble stoped scanning successfully."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ": Exception to stop BLE scanning: " << exception.what(); return absl::InternalError( "Bad status stopping Ble scanning"); } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ": Exception to stop BLE scanning: " << ex.code() << ": " << winrt::to_string(ex.message()); return absl::InternalError( "Bad status stopping Ble scanning"); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return absl::InternalError( "Bad status stopping Ble scanning"); } @@ -392,20 +432,21 @@ std::unique_ptr BleV2Medium::StartScanning( std::unique_ptr BleV2Medium::StartGattServer( api::ble_v2::ServerGattConnectionCallback callback) { - NEARBY_LOGS(INFO) << __func__ << ": Start GATT server."; + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": Start GATT server."; if (!NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: kEnableBleV2Gatt)) { if (adapter_->IsExtendedAdvertisingSupported()) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT is disabled."; + LOG(WARNING) << __func__ << ": GATT is disabled."; return nullptr; } if (!NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: kEnableBleV2GattOnNonExtendedDevice)) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT is disabled."; + LOG(WARNING) << __func__ << ": GATT is disabled."; return nullptr; } } @@ -413,6 +454,14 @@ std::unique_ptr BleV2Medium::StartGattServer( std::make_unique(adapter_, std::move(callback)); ble_gatt_server_ = gatt_server.get(); + ble_gatt_server_->SetCloseNotifier([this]() { + // In avoid to create a new thread to close the gatt server, we don't + // acquire the mutex here. The calling flow may cause deadlock due to + // StartGattAdvertising may run into the codes. It is not ideal, but it is + // hard to run in thread issues. + LOG(INFO) << __func__ << ": GATT server is closed."; + ble_gatt_server_ = nullptr; + }); return gatt_server; } @@ -420,22 +469,23 @@ std::unique_ptr BleV2Medium::StartGattServer( std::unique_ptr BleV2Medium::ConnectToGattServer( api::ble_v2::BlePeripheral& peripheral, TxPowerLevel tx_power_level, api::ble_v2::ClientGattConnectionCallback callback) { - NEARBY_LOGS(INFO) << "ConnectToGattServer is called, address: " - << peripheral.GetAddress() - << ", power:" << TxPowerLevelToName(tx_power_level); + absl::MutexLock lock(&mutex_); + LOG(INFO) << "ConnectToGattServer is called, address: " + << peripheral.GetAddress() + << ", power:" << TxPowerLevelToName(tx_power_level); if (!NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: kEnableBleV2Gatt)) { if (adapter_->IsExtendedAdvertisingSupported()) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT is disabled."; + LOG(WARNING) << __func__ << ": GATT is disabled."; return nullptr; } if (!NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: kEnableBleV2GattOnNonExtendedDevice)) { - NEARBY_LOGS(WARNING) << __func__ << ": GATT is disabled."; + LOG(WARNING) << __func__ << ": GATT is disabled."; return nullptr; } } @@ -448,68 +498,84 @@ std::unique_ptr BleV2Medium::ConnectToGattServer( return std::make_unique(ble_device); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return nullptr; } bool BleV2Medium::StopScanning() { - NEARBY_LOGS(INFO) << __func__ << ": BLE StopScanning: service_uuid: " - << std::string(service_uuid_); + absl::MutexLock lock(&mutex_); + + LOG(INFO) << __func__ << ": BLE StopScanning: service_uuid: " + << std::string(service_uuid_); try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot stop scanning because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot stop scanning because the " + "bluetooth adapter is not enabled."; return false; } if (!is_watcher_started_) { - NEARBY_LOGS(WARNING) << "BLE scanning is not running."; + LOG(WARNING) << "BLE scanning is not running."; return false; } watcher_.Stop(); - // Don't need to wait for the status becomes to `Stopped`. If application - // starts to scanning immediately, the scanning still needs to wait the - // stopping to finish. + // Wait for the watcher to stop. + int wait_milliseconds = 0; + while (watcher_.Status() != + BluetoothLEAdvertisementWatcherStatus::Stopped) { + absl::SleepFor(absl::Milliseconds(kMediumCheckIntervalInMills)); + wait_milliseconds += kMediumCheckIntervalInMills; + if (absl::Milliseconds(wait_milliseconds) > kMediumTimeout) { + LOG(ERROR) << __func__ << ": Failed to stop BLE scan due to timeout."; + watcher_.Stopped(watcher_token_); + watcher_.Received(advertisement_received_token_); + watcher_ = nullptr; + is_watcher_started_ = false; + return false; + } + } + + watcher_.Stopped(watcher_token_); + watcher_.Received(advertisement_received_token_); + watcher_ = nullptr; is_watcher_started_ = false; - NEARBY_LOGS(ERROR) - << "Windows Ble stoped scanning successfully for service UUID:" - << std::string(service_uuid_); + LOG(ERROR) << "Windows Ble stoped scanning successfully for service UUID:" + << std::string(service_uuid_); return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to stop BLE scanning: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to stop BLE scanning: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to stop BLE scanning: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": Exception to stop BLE scanning: " << ex.code() + << ": " << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } std::unique_ptr BleV2Medium::OpenServerSocket( const std::string& service_id) { - NEARBY_LOGS(INFO) << "OpenServerSocket is called"; + LOG(INFO) << "OpenServerSocket is called"; auto server_socket = std::make_unique(adapter_); if (!server_socket->Bind()) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to bing socket."; + LOG(ERROR) << __func__ << ": Failed to bing socket."; return nullptr; } @@ -520,17 +586,16 @@ std::unique_ptr BleV2Medium::Connect( const std::string& service_id, TxPowerLevel tx_power_level, api::ble_v2::BlePeripheral& remote_peripheral, CancellationFlag* cancellation_flag) { - NEARBY_LOGS(INFO) << __func__ << ": Connect to service_id=" << service_id; + LOG(INFO) << __func__ << ": Connect to service_id=" << service_id; if (cancellation_flag == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": cancellation_flag not specified."; + LOG(ERROR) << __func__ << ": cancellation_flag not specified."; return nullptr; } if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) << __func__ - << ": BLE socket connection cancelled for service: " - << service_id; + LOG(INFO) << __func__ << ": BLE socket connection cancelled for service: " + << service_id; return nullptr; } @@ -540,9 +605,8 @@ std::unique_ptr BleV2Medium::Connect( cancellation_flag, [socket = ble_socket.get()]() { socket->Close(); }); if (!ble_socket->Connect(&remote_peripheral)) { - NEARBY_LOGS(INFO) << __func__ - << ": BLE socket connection failed. service_id=" - << service_id; + LOG(INFO) << __func__ + << ": BLE socket connection failed. service_id=" << service_id; return nullptr; } @@ -556,23 +620,22 @@ bool BleV2Medium::IsExtendedAdvertisementsAvailable() { bool BleV2Medium::StartBleAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, api::ble_v2::AdvertiseParameters advertising_parameters) { - NEARBY_LOGS(INFO) << __func__ << ": Start BLE advertising."; + LOG(INFO) << __func__ << ": Start BLE advertising."; try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot start advertising because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot start advertising because the " + "bluetooth adapter is not enabled."; return false; } if (advertising_data.service_data.empty()) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << "BLE cannot start to advertise due to invalid service data."; return false; } if (is_ble_publisher_started_) { - NEARBY_LOGS(WARNING) - << "BLE cannot start to advertise again when it is running."; + LOG(WARNING) << "BLE cannot start to advertise again when it is running."; return false; } @@ -588,12 +651,11 @@ bool BleV2Medium::StartBleAdvertising( std::string uuid_string = it.first.Get16BitAsString(); int uuid; if (!absl::SimpleHexAtoi(uuid_string, &uuid)) { - NEARBY_LOGS(WARNING) << "BLE failed to get service UUID."; + LOG(WARNING) << "BLE failed to get service UUID."; return false; } - NEARBY_LOGS(WARNING) << "BLE service UUID: " - << absl::StrFormat("%#x", uuid); + LOG(WARNING) << "BLE service UUID: " << absl::StrFormat("%#x", uuid); data_writer.WriteUInt16(((uuid >> 8) & 0xff) | ((uuid & 0xff) << 8)); @@ -617,7 +679,7 @@ bool BleV2Medium::StartBleAdvertising( // string because the long format advertisement will be used if (advertising_data.is_extended_advertisement) { if (!adapter_->IsExtendedAdvertisingSupported()) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << "Cannot advertise extended advertisement on devie without BLE " "advertisement extention feature."; return false; @@ -627,8 +689,8 @@ bool BleV2Medium::StartBleAdvertising( publisher_.UseExtendedAdvertisement(true); } else { if (max_data_section_size > 27) { - NEARBY_LOGS(WARNING) << "Invalid advertisement data size for " - "non-extended advertisement."; + LOG(WARNING) << "Invalid advertisement data size for " + "non-extended advertisement."; return false; } @@ -640,66 +702,101 @@ bool BleV2Medium::StartBleAdvertising( publisher_.Start(); + // Wait for the publisher to start. + int wait_milliseconds = 0; + while (publisher_.Status() != + BluetoothLEAdvertisementPublisherStatus::Started) { + absl::SleepFor(absl::Milliseconds(kMediumCheckIntervalInMills)); + wait_milliseconds += kMediumCheckIntervalInMills; + if (absl::Milliseconds(wait_milliseconds) > kMediumTimeout) { + LOG(ERROR) << __func__ + << ": BLE advertising failed to start due to timeout."; + publisher_.StatusChanged(publisher_token_); + publisher_ = nullptr; + is_ble_publisher_started_ = false; + return false; + } + } + is_ble_publisher_started_ = true; - NEARBY_LOGS(INFO) << "BLE advertising started."; + LOG(INFO) << "BLE advertising started."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to start BLE advertising: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to start BLE advertising: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to start BLE advertising: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to start BLE advertising: " << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } bool BleV2Medium::StopBleAdvertising() { - NEARBY_LOGS(INFO) << __func__ << ": Stop BLE advertising."; + LOG(INFO) << __func__ << ": Stop BLE advertising."; try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot stop advertising because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot stop advertising because the " + "bluetooth adapter is not enabled."; return false; } if (!is_ble_publisher_started_) { - NEARBY_LOGS(WARNING) << "BLE advertising is not running."; + LOG(WARNING) << "BLE advertising is not running."; return false; } // publisher_ may be null when status changed during advertising. - if (publisher_ != nullptr && - publisher_.Status() == + if (publisher_ == nullptr || + publisher_.Status() != BluetoothLEAdvertisementPublisherStatus::Started) { - publisher_.Stop(); + LOG(WARNING) << "No started publisher is running."; + return false; } - // Don't need to wait for the status becomes to `Stopped`. If application - // starts to scanning immediately, the scanning still needs to wait the - // stopping to finish. + publisher_.Stop(); + + // Wait for the publisher to stop. + int wait_milliseconds = 0; + while (publisher_.Status() != + BluetoothLEAdvertisementPublisherStatus::Stopped) { + absl::SleepFor(absl::Milliseconds(kMediumCheckIntervalInMills)); + wait_milliseconds += kMediumCheckIntervalInMills; + if (absl::Milliseconds(wait_milliseconds) > kMediumTimeout) { + LOG(ERROR) << __func__ + << ": BLE advertising failed to stop due to timeout."; + publisher_.StatusChanged(publisher_token_); + publisher_ = nullptr; + is_ble_publisher_started_ = false; + return false; + } + } + + // Reset publisher. + publisher_.StatusChanged(publisher_token_); + publisher_ = nullptr; is_ble_publisher_started_ = false; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to stop BLE advertising: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to stop BLE advertising: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to stop BLE advertising: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to stop BLE advertising: " << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -707,28 +804,28 @@ bool BleV2Medium::StopBleAdvertising() { bool BleV2Medium::StartGattAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, api::ble_v2::AdvertiseParameters advertising_parameters) { - NEARBY_LOGS(INFO) << __func__ << ": Start GATT advertising."; + LOG(INFO) << __func__ << ": Start GATT advertising."; try { if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot start advertising because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot start GATT advertising because the " + "bluetooth adapter is not enabled."; return false; } if (advertising_data.service_data.empty()) { - NEARBY_LOGS(WARNING) - << "BLE cannot start to advertise due to invalid service data."; + LOG(WARNING) + << "BLE cannot start GATT advertising due to invalid service data."; return false; } if (is_gatt_publisher_started_) { - NEARBY_LOGS(WARNING) - << "BLE cannot start to advertise again when it is running."; + LOG(WARNING) + << "BLE cannot start GATT advertising again when it is running."; return false; } if (ble_gatt_server_ == nullptr) { - NEARBY_LOGS(WARNING) << "No Gatt server is running."; + LOG(WARNING) << "No Gatt server is running."; return false; } @@ -743,68 +840,68 @@ bool BleV2Medium::StartGattAdvertising( bool is_started = ble_gatt_server_->StartAdvertisement( service_data, advertising_parameters.is_connectable); if (!is_started) { - NEARBY_LOGS(WARNING) << "BLE cannot start to advertise."; + LOG(WARNING) << "BLE cannot start GATT advertising."; return false; } is_gatt_publisher_started_ = true; - NEARBY_LOGS(INFO) << "GATT advertising started."; + LOG(INFO) << "GATT advertising started."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to start GATT advertising: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception to start GATT advertising: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to start GATT advertising: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to start GATT advertising: " << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } bool BleV2Medium::StopGattAdvertising() { try { - NEARBY_LOGS(INFO) << __func__ << ": Stop GATT advertising."; + LOG(INFO) << __func__ << ": Stop GATT advertising."; if (!adapter_->IsEnabled()) { - NEARBY_LOGS(WARNING) << "BLE cannot stop advertising because the " - "bluetooth adapter is not enabled."; + LOG(WARNING) << "BLE cannot stop GATT advertising because the " + "bluetooth adapter is not enabled."; return false; } if (!is_gatt_publisher_started_) { - NEARBY_LOGS(WARNING) << "BLE advertising is not running."; + LOG(WARNING) << "BLE GATT advertising is not running."; return false; } if (ble_gatt_server_ == nullptr) { - NEARBY_LOGS(WARNING) << "No Gatt server is running."; + LOG(WARNING) << "No Gatt server is running."; return false; } bool stop_result = ble_gatt_server_->StopAdvertisement(); is_gatt_publisher_started_ = false; - NEARBY_LOGS(INFO) << "Stop GATT advertisement result=" << stop_result; + LOG(INFO) << "Stop GATT advertisement result=" << stop_result; return stop_result; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception to stop BLE advertising: " - << exception.what(); + LOG(ERROR) << __func__ << ": Exception to stop BLE GATT advertising: " + << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception to stop BLE advertising: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception to stop BLE GATT advertising: " << ex.code() + << ": " << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -815,74 +912,72 @@ void BleV2Medium::PublisherHandler( // This method is called when publisher's status is changed. switch (args.Status()) { case BluetoothLEAdvertisementPublisherStatus::Created: - NEARBY_LOGS(INFO) << "Nearby BLE Medium created to advertise."; + LOG(INFO) << "Nearby BLE Medium created to advertise."; return; case BluetoothLEAdvertisementPublisherStatus::Started: - NEARBY_LOGS(INFO) << "Nearby BLE Medium started to advertise."; + LOG(INFO) << "Nearby BLE Medium started to advertise."; return; case BluetoothLEAdvertisementPublisherStatus::Stopping: - NEARBY_LOGS(INFO) << "Nearby BLE Medium is stopping."; + LOG(INFO) << "Nearby BLE Medium is stopping."; return; case BluetoothLEAdvertisementPublisherStatus::Waiting: - NEARBY_LOGS(INFO) << "Nearby BLE Medium is waiting."; + LOG(INFO) << "Nearby BLE Medium is waiting."; return; case BluetoothLEAdvertisementPublisherStatus::Stopped: - NEARBY_LOGS(INFO) << "Nearby BLE Medium stopped to advertise."; + LOG(INFO) << "Nearby BLE Medium stopped to advertise."; break; case BluetoothLEAdvertisementPublisherStatus::Aborted: switch (args.Error()) { case BluetoothError::Success: - if (publisher_.Status() == + if (publisher.Status() == BluetoothLEAdvertisementPublisherStatus::Started) { - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium start advertising operation was " - "successfully completed or serviced."; + LOG(ERROR) << "Nearby BLE Medium start advertising operation was " + "successfully completed or serviced."; } - if (publisher_.Status() == + if (publisher.Status() == BluetoothLEAdvertisementPublisherStatus::Stopped) { - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stop advertising operation was " - "successfully completed or serviced."; + LOG(ERROR) << "Nearby BLE Medium stop advertising operation was " + "successfully completed or serviced."; } else { - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "unknown errors."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "unknown errors."; } break; case BluetoothError::RadioNotAvailable: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "radio not available."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "radio not available."; break; case BluetoothError::ResourceInUse: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium advertising failed due to resource in use."; break; case BluetoothError::DeviceNotConnected: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "remote device is not connected."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "remote device is not connected."; break; case BluetoothError::DisabledByPolicy: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "disabled by policy."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "disabled by policy."; break; case BluetoothError::DisabledByUser: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "disabled by user."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "disabled by user."; break; case BluetoothError::NotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "hardware not supported."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "hardware not supported."; break; case BluetoothError::TransportNotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "transport not supported."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "transport not supported."; break; case BluetoothError::ConsentRequired: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium advertising failed due to " - "consent required."; + LOG(ERROR) << "Nearby BLE Medium advertising failed due to " + "consent required."; break; case BluetoothError::OtherError: default: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium advertising failed due to unknown errors."; break; } @@ -890,14 +985,6 @@ void BleV2Medium::PublisherHandler( default: break; } - - // The publisher is stopped. Clean up the running publisher - if (publisher_ != nullptr) { - NEARBY_LOGS(ERROR) << "Nearby BLE Medium cleaned the publisher."; - publisher_.StatusChanged(publisher_token_); - publisher_ = nullptr; - is_ble_publisher_started_ = false; - } } void BleV2Medium::WatcherHandler( @@ -907,59 +994,44 @@ void BleV2Medium::WatcherHandler( // information on the reason. switch (args.Error()) { case BluetoothError::Success: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan successfully."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan successfully."; break; case BluetoothError::RadioNotAvailable: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to radio not available."; break; case BluetoothError::ResourceInUse: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to resource in use."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to resource in use."; break; case BluetoothError::DeviceNotConnected: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan due to " - "remote device is not connected."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to " + "remote device is not connected."; break; case BluetoothError::DisabledByPolicy: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to disabled by policy."; break; case BluetoothError::DisabledByUser: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to disabled by user."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to disabled by user."; break; case BluetoothError::NotSupported: - NEARBY_LOGS(ERROR) + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to hardware not supported."; break; case BluetoothError::TransportNotSupported: - NEARBY_LOGS(ERROR) << "Nearby BLE Medium stoped to scan due to " - "transport not supported."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to " + "transport not supported."; break; case BluetoothError::ConsentRequired: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to consent required."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to consent required."; break; case BluetoothError::OtherError: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to unknown errors."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to unknown errors."; break; default: - NEARBY_LOGS(ERROR) - << "Nearby BLE Medium stoped to scan due to unknown errors."; + LOG(ERROR) << "Nearby BLE Medium stoped to scan due to unknown errors."; break; } - - // No matter the reason, should clean up the watcher if it is not empty. - // The BLE V1 interface doesn't have API to return the error to upper layer. - if (watcher_ != nullptr) { - NEARBY_LOGS(ERROR) << "Nearby BLE Medium cleaned the watcher."; - watcher_.Stopped(watcher_token_); - watcher_.Received(advertisement_received_token_); - watcher_ = nullptr; - is_watcher_started_ = false; - } } void BleV2Medium::AdvertisementReceivedHandler( @@ -991,28 +1063,28 @@ void BleV2Medium::AdvertisementReceivedHandler( ByteArray advertisement_data(data); - NEARBY_LOGS(VERBOSE) << "Nearby BLE Medium " - << service_uuid_.Get16BitAsString() - << " Advertisement discovered. " - "0x16 Service data: advertisement bytes= 0x" - << absl::BytesToHexString( - advertisement_data.AsStringView()) - << "(" << advertisement_data.size() << ")"; + VLOG(1) << "Nearby BLE Medium " << service_uuid_.Get16BitAsString() + << " Advertisement discovered. " + "0x16 Service data: advertisement bytes= 0x" + << absl::BytesToHexString(advertisement_data.AsStringView()) + << "(" << advertisement_data.size() << ")"; std::string bluetooth_address = uint64_to_mac_address_string(args.BluetoothAddress()); - BleV2Peripheral* peripheral_ptr = - GetOrCreatePeripheral(bluetooth_address); - if (peripheral_ptr == nullptr) { - NEARBY_LOGS(ERROR) << "No BLE peripheral with address: " - << bluetooth_address; - return; + BleV2Peripheral* peripheral_ptr = nullptr; + { + absl::MutexLock lock(&mutex_); + peripheral_ptr = GetOrCreatePeripheral(bluetooth_address); + if (peripheral_ptr == nullptr) { + LOG(ERROR) << "No BLE peripheral with address: " << bluetooth_address; + return; + } } - NEARBY_LOGS(INFO) << "BLE peripheral with address: " << bluetooth_address; + LOG(INFO) << "BLE peripheral with address: " << bluetooth_address; // Received Advertisement packet - NEARBY_LOGS(INFO) << "unconsumed_buffer_length: " - << static_cast(unconsumed_buffer_length); + LOG(INFO) << "unconsumed_buffer_length: " + << static_cast(unconsumed_buffer_length); api::ble_v2::BleAdvertisementData ble_advertisement_data; if (unconsumed_buffer_length <= 27) { @@ -1036,7 +1108,7 @@ void BleV2Medium::AdvertisementFoundHandler( std::vector service_uuid_list; bool found_matching_service_uuid = false; { - absl::MutexLock lock(&map_mutex_); + absl::MutexLock lock(&mutex_); for (auto windows_service_uuid : advertisement.ServiceUuids()) { auto nearby_service_uuid = winrt_guid_to_nearby_uuid(windows_service_uuid); @@ -1070,8 +1142,8 @@ void BleV2Medium::AdvertisementFoundHandler( uint8_t unconsumed_buffer_length = data_reader.UnconsumedBufferLength(); if (unconsumed_buffer_length > 27) { - NEARBY_LOGS(INFO) << "Skipping extended advertisement with service " - << service_uuid.Get16BitAsString(); + LOG(INFO) << "Skipping extended advertisement with service " + << service_uuid.Get16BitAsString(); return; } for (int i = 0; i < unconsumed_buffer_length; i++) { @@ -1082,25 +1154,28 @@ void BleV2Medium::AdvertisementFoundHandler( } } if (ble_advertisement_data.service_data.empty()) { - NEARBY_LOGS(ERROR) << "Got matching Service UUID but found no " - "corresponding data, skipping"; + LOG(ERROR) << "Got matching Service UUID but found no " + "corresponding data, skipping"; return; } // Save the BleV2Peripheral. std::string bluetooth_address = uint64_to_mac_address_string(args.BluetoothAddress()); - BleV2Peripheral* peripheral_ptr = GetOrCreatePeripheral(bluetooth_address); - if (peripheral_ptr == nullptr) { - NEARBY_LOGS(ERROR) << "No BLE peripheral with address: " - << bluetooth_address; - return; + BleV2Peripheral* peripheral_ptr = nullptr; + { + absl::MutexLock lock(&mutex_); + peripheral_ptr = GetOrCreatePeripheral(bluetooth_address); + if (peripheral_ptr == nullptr) { + LOG(ERROR) << "No BLE peripheral with address: " << bluetooth_address; + return; + } } - NEARBY_LOGS(INFO) << "BLE peripheral with address: " << bluetooth_address; + LOG(INFO) << "BLE peripheral with address: " << bluetooth_address; // Invokes callbacks that matches the UUID. for (auto service_uuid : service_uuid_list) { { - absl::MutexLock lock(&map_mutex_); + absl::MutexLock lock(&mutex_); if (service_uuid_to_session_map_.find(service_uuid) != service_uuid_to_session_map_.end()) { for (auto& id_session_pair : @@ -1115,7 +1190,12 @@ void BleV2Medium::AdvertisementFoundHandler( bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address, GetRemotePeripheralCallback callback) { - BleV2Peripheral* peripheral = GetOrCreatePeripheral(mac_address); + BleV2Peripheral* peripheral = nullptr; + { + absl::MutexLock lock(&mutex_); + peripheral = GetOrCreatePeripheral(mac_address); + } + if (peripheral != nullptr && peripheral->Ok()) { callback(*peripheral); return true; @@ -1125,9 +1205,14 @@ bool BleV2Medium::GetRemotePeripheral(const std::string& mac_address, bool BleV2Medium::GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id, GetRemotePeripheralCallback callback) { - BleV2Peripheral* peripheral = GetPeripheral(id); + BleV2Peripheral* peripheral = nullptr; + { + absl::MutexLock lock(&mutex_); + peripheral = GetPeripheral(id); + } + if (peripheral == nullptr) { - NEARBY_LOGS(WARNING) << __func__ << ": No matched peripheral device."; + LOG(WARNING) << __func__ << ": No matched peripheral device."; return false; } callback(*peripheral); @@ -1135,7 +1220,6 @@ bool BleV2Medium::GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id, } uint64_t BleV2Medium::GenerateSessionId() { - absl::MutexLock lock(&map_mutex_); for (int i = 0; i < kGenerateSessionIdRetryLimit; i++) { uint64_t session_id = Prng().NextInt64(); if (session_id == kFailedGenerateSessionId) continue; @@ -1148,7 +1232,6 @@ uint64_t BleV2Medium::GenerateSessionId() { } BleV2Peripheral* BleV2Medium::GetOrCreatePeripheral(absl::string_view address) { - absl::MutexLock lock(&peripheral_map_mutex_); auto it = std::find_if( peripheral_map_.begin(), peripheral_map_.end(), [&](const auto& item) { return item.second.peripheral->GetAddress() == address; @@ -1164,17 +1247,16 @@ BleV2Peripheral* BleV2Medium::GetOrCreatePeripheral(absl::string_view address) { }; BleV2Peripheral* peripheral = peripheral_info.peripheral.get(); if (!peripheral->Ok()) { - NEARBY_LOGS(WARNING) << __func__ << "Invalid MAC address: " << address; + LOG(WARNING) << __func__ << "Invalid MAC address: " << address; return nullptr; } - NEARBY_LOGS(INFO) << "New BLE peripheral with address: " << address; + LOG(INFO) << "New BLE peripheral with address: " << address; peripheral_map_[peripheral->GetUniqueId()] = std::move(peripheral_info); return peripheral; } BleV2Peripheral* BleV2Medium::GetPeripheral(BleV2Peripheral::UniqueId id) { - absl::MutexLock lock(&peripheral_map_mutex_); auto it = peripheral_map_.find(id); if (it == peripheral_map_.end()) { return nullptr; diff --git a/internal/platform/implementation/windows/ble_v2.h b/internal/platform/implementation/windows/ble_v2.h index 5e6f8d53..1a8ee5f5 100644 --- a/internal/platform/implementation/windows/ble_v2.h +++ b/internal/platform/implementation/windows/ble_v2.h @@ -15,18 +15,24 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLE_V2_H_ #define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_BLE_V2_H_ +#include +#include #include #include +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" -#include "internal/platform/byte_array.h" +#include "absl/synchronization/notification.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/windows/ble_gatt_server.h" #include "internal/platform/implementation/windows/ble_v2_peripheral.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" -#include "internal/platform/implementation/windows/bluetooth_classic.h" -#include "internal/platform/input_stream.h" -#include "internal/platform/output_stream.h" #include "internal/platform/uuid.h" #include "winrt/Windows.Devices.Bluetooth.Advertisement.h" @@ -42,51 +48,59 @@ class BleV2Medium : public api::ble_v2::BleMedium { // Returns true once the Ble advertising has been initiated. bool StartAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, - api::ble_v2::AdvertiseParameters advertising_parameters) override; - bool StopAdvertising() override; + api::ble_v2::AdvertiseParameters advertising_parameters) override + ABSL_LOCKS_EXCLUDED(mutex_); + bool StopAdvertising() override ABSL_LOCKS_EXCLUDED(mutex_); std::unique_ptr StartAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, api::ble_v2::AdvertiseParameters advertise_set_parameters, - AdvertisingCallback callback) override; + AdvertisingCallback callback) override ABSL_LOCKS_EXCLUDED(mutex_); bool StartScanning(const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, - ScanCallback callback) override; - bool StopScanning() override; + ScanCallback callback) override + ABSL_LOCKS_EXCLUDED(mutex_); + bool StopScanning() override ABSL_LOCKS_EXCLUDED(mutex_); std::unique_ptr StartScanning( const Uuid& service_uuid, api::ble_v2::TxPowerLevel tx_power_level, ScanningCallback callback) override; std::unique_ptr StartGattServer( - api::ble_v2::ServerGattConnectionCallback callback) override; + api::ble_v2::ServerGattConnectionCallback callback) override + ABSL_LOCKS_EXCLUDED(mutex_); std::unique_ptr ConnectToGattServer( api::ble_v2::BlePeripheral& peripheral, api::ble_v2::TxPowerLevel tx_power_level, - api::ble_v2::ClientGattConnectionCallback callback) override; + api::ble_v2::ClientGattConnectionCallback callback) override + ABSL_LOCKS_EXCLUDED(mutex_); std::unique_ptr OpenServerSocket( - const std::string& service_id) override; + const std::string& service_id) override ABSL_LOCKS_EXCLUDED(mutex_); std::unique_ptr Connect( const std::string& service_id, api::ble_v2::TxPowerLevel tx_power_level, api::ble_v2::BlePeripheral& remote_peripheral, - CancellationFlag* cancellation_flag) override; + CancellationFlag* cancellation_flag) override ABSL_LOCKS_EXCLUDED(mutex_); bool IsExtendedAdvertisementsAvailable() override; bool GetRemotePeripheral(const std::string& mac_address, - GetRemotePeripheralCallback callback) override; + GetRemotePeripheralCallback callback) override + ABSL_LOCKS_EXCLUDED(mutex_); bool GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id, - GetRemotePeripheralCallback callback) override; + GetRemotePeripheralCallback callback) override + ABSL_LOCKS_EXCLUDED(mutex_); private: bool StartBleAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, - api::ble_v2::AdvertiseParameters advertising_parameters); - bool StopBleAdvertising(); + api::ble_v2::AdvertiseParameters advertising_parameters) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + bool StopBleAdvertising() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); bool StartGattAdvertising( const api::ble_v2::BleAdvertisementData& advertising_data, - api::ble_v2::AdvertiseParameters advertising_parameters); - bool StopGattAdvertising(); + api::ble_v2::AdvertiseParameters advertising_parameters) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + bool StopGattAdvertising() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); void PublisherHandler( winrt::Windows::Devices::Bluetooth::Advertisement:: @@ -111,50 +125,53 @@ class BleV2Medium : public api::ble_v2::BleMedium { winrt::Windows::Devices::Bluetooth::Advertisement:: BluetoothLEAdvertisementWatcherStoppedEventArgs args); - uint64_t GenerateSessionId(); + uint64_t GenerateSessionId() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Returns nullptr if `address` is invalid. - BleV2Peripheral* GetOrCreatePeripheral(absl::string_view address); + BleV2Peripheral* GetOrCreatePeripheral(absl::string_view address) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); // Returns nullptr if `id` does not match a known peripheral. - BleV2Peripheral* GetPeripheral(BleV2Peripheral::UniqueId id); + BleV2Peripheral* GetPeripheral(BleV2Peripheral::UniqueId id) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - void RemoveExpiredPeripherals() - ABSL_EXCLUSIVE_LOCKS_REQUIRED(peripheral_map_mutex_); + void RemoveExpiredPeripherals() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - BluetoothAdapter* adapter_; + absl::Mutex mutex_; + + BluetoothAdapter* const adapter_; Uuid service_uuid_; api::ble_v2::TxPowerLevel tx_power_level_; ScanCallback scan_callback_; - absl::Mutex map_mutex_; // std::map> absl::flat_hash_map> - service_uuid_to_session_map_ ABSL_GUARDED_BY(map_mutex_); + service_uuid_to_session_map_ ABSL_GUARDED_BY(mutex_); // WinRT objects ::winrt::Windows::Devices::Bluetooth::Advertisement:: - BluetoothLEAdvertisementPublisher publisher_ = nullptr; + BluetoothLEAdvertisementPublisher publisher_ ABSL_GUARDED_BY(mutex_) = + nullptr; ::winrt::Windows::Devices::Bluetooth::Advertisement:: - BluetoothLEAdvertisementWatcher watcher_ = nullptr; + BluetoothLEAdvertisementWatcher watcher_ ABSL_GUARDED_BY(mutex_) = + nullptr; - bool is_ble_publisher_started_ = false; - bool is_gatt_publisher_started_ = false; - bool is_watcher_started_ = false; + bool is_ble_publisher_started_ ABSL_GUARDED_BY(mutex_) = false; + bool is_gatt_publisher_started_ ABSL_GUARDED_BY(mutex_) = false; + bool is_watcher_started_ ABSL_GUARDED_BY(mutex_) = false; - ::winrt::event_token publisher_token_; - ::winrt::event_token watcher_token_; - ::winrt::event_token advertisement_received_token_; + ::winrt::event_token publisher_token_ ABSL_GUARDED_BY(mutex_); + ::winrt::event_token watcher_token_ ABSL_GUARDED_BY(mutex_); + ::winrt::event_token advertisement_received_token_ ABSL_GUARDED_BY(mutex_); BleGattServer* ble_gatt_server_ = nullptr; // Map to protect the pointer for BlePeripheral because // DiscoveredPeripheralCallback only keeps the pointer to the object - absl::Mutex peripheral_map_mutex_; struct PeripheralInfo { absl::Time last_access_time; std::unique_ptr peripheral; }; absl::flat_hash_map peripheral_map_ - ABSL_GUARDED_BY(peripheral_map_mutex_); - absl::Time cleanup_time_ ABSL_GUARDED_BY(peripheral_map_mutex_) = absl::Now(); + ABSL_GUARDED_BY(mutex_); + absl::Time cleanup_time_ ABSL_GUARDED_BY(mutex_) = absl::Now(); }; } // namespace windows diff --git a/internal/platform/implementation/windows/ble_v2_peripheral.cc b/internal/platform/implementation/windows/ble_v2_peripheral.cc index c6972c48..d0cc47dc 100644 --- a/internal/platform/implementation/windows/ble_v2_peripheral.cc +++ b/internal/platform/implementation/windows/ble_v2_peripheral.cc @@ -35,7 +35,7 @@ BleV2Peripheral::BleV2Peripheral(absl::string_view address) { bool BleV2Peripheral::SetAddress(absl::string_view address) { // The address must be in format "00:B0:D0:63:C2:26". if (address.size() != kMacAddressLength) { - NEARBY_LOGS(ERROR) << ": Invalid MAC address length."; + LOG(ERROR) << ": Invalid MAC address length."; return false; } @@ -52,7 +52,7 @@ bool BleV2Peripheral::SetAddress(absl::string_view address) { } } - NEARBY_LOGS(ERROR) << ": Invalid MAC address format."; + LOG(ERROR) << ": Invalid MAC address format."; return false; } diff --git a/internal/platform/implementation/windows/ble_v2_server_socket.cc b/internal/platform/implementation/windows/ble_v2_server_socket.cc index 0be7bd7f..6c438d92 100644 --- a/internal/platform/implementation/windows/ble_v2_server_socket.cc +++ b/internal/platform/implementation/windows/ble_v2_server_socket.cc @@ -18,10 +18,11 @@ #include #include -#include "absl/log/check.h" #include "absl/synchronization/mutex.h" #include "absl/synchronization/notification.h" #include "internal/platform/exception.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/windows/ble_v2_socket.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/utils.h" @@ -37,7 +38,7 @@ BleV2ServerSocket::BleV2ServerSocket(api::BluetoothAdapter* adapter) std::unique_ptr BleV2ServerSocket::Accept() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Accept is called."; + LOG(INFO) << __func__ << ": Accept is called."; while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); @@ -47,14 +48,14 @@ std::unique_ptr BleV2ServerSocket::Accept() { BleV2Socket ble_socket = pending_sockets_.front(); pending_sockets_.pop_front(); - NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection."; + LOG(INFO) << __func__ << ": Accepted a remote connection."; return std::make_unique(ble_socket); } Exception BleV2ServerSocket::Close() { // TODO(b/271031645): implement BLE socket using weave absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Close is called."; + LOG(INFO) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -68,7 +69,7 @@ Exception BleV2ServerSocket::Close() { bool BleV2ServerSocket::Bind() { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(ERROR) << __func__ << ": GATT socket started."; + LOG(ERROR) << __func__ << ": GATT socket started."; return true; } diff --git a/internal/platform/implementation/windows/ble_v2_socket.cc b/internal/platform/implementation/windows/ble_v2_socket.cc index 00e72e44..efc96f80 100644 --- a/internal/platform/implementation/windows/ble_v2_socket.cc +++ b/internal/platform/implementation/windows/ble_v2_socket.cc @@ -15,6 +15,7 @@ #include "internal/platform/implementation/windows/ble_v2_socket.h" #include +#include #include #include "absl/synchronization/mutex.h" @@ -22,8 +23,11 @@ #include "absl/time/time.h" #include "internal/platform/byte_array.h" #include "internal/platform/exception.h" +#include "internal/platform/implementation/ble_v2.h" #include "internal/platform/implementation/windows/utils.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { @@ -40,38 +44,38 @@ api::ble_v2::BlePeripheral* BleV2Socket::GetRemotePeripheral() { bool BleV2Socket::Connect(api::ble_v2::BlePeripheral* ble_peripheral) { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(VERBOSE) << __func__ << ": Connect to BLE peripheral=" - << ble_peripheral->GetAddress(); + VLOG(1) << __func__ + << ": Connect to BLE peripheral=" << ble_peripheral->GetAddress(); return false; } ExceptionOr BleV2Socket::BleInputStream::Read(std::int64_t size) { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(VERBOSE) << __func__ << ": Read data size=" << size; + VLOG(1) << __func__ << ": Read data size=" << size; return ExceptionOr(Exception::kIo); } Exception BleV2Socket::BleInputStream::Close() { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(VERBOSE) << __func__ << ": Close BLE input stream."; + VLOG(1) << __func__ << ": Close BLE input stream."; return {Exception::kSuccess}; } Exception BleV2Socket::BleOutputStream::Write(const ByteArray& data) { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(VERBOSE) << __func__ << ": Write data size=" << data.size(); + VLOG(1) << __func__ << ": Write data size=" << data.size(); return {Exception::kIo}; } Exception BleV2Socket::BleOutputStream::Flush() { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(INFO) << __func__ << ": Flush is called."; + LOG(INFO) << __func__ << ": Flush is called."; return {Exception::kSuccess}; } Exception BleV2Socket::BleOutputStream::Close() { // TODO(b/271031645): implement BLE socket using weave - NEARBY_LOGS(INFO) << __func__ << ": close is called."; + LOG(INFO) << __func__ << ": close is called."; return {Exception::kSuccess}; } diff --git a/internal/platform/implementation/windows/bluetooth_adapter.cc b/internal/platform/implementation/windows/bluetooth_adapter.cc index 0c2675e3..109b2159 100644 --- a/internal/platform/implementation/windows/bluetooth_adapter.cc +++ b/internal/platform/implementation/windows/bluetooth_adapter.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -32,12 +32,17 @@ #include #include +#include +#include #include +#include #include #include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" #include "third_party/json/src/json.hpp" #include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/platform.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Foundation.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/logging.h" @@ -85,8 +90,7 @@ BluetoothAdapter::BluetoothAdapter() : windows_bluetooth_adapter_(nullptr) { winrt::Windows::Devices::Bluetooth::BluetoothAdapter::GetDefaultAsync() .get(); if (windows_bluetooth_adapter_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": No Bluetooth adapter on this device."; + LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device."; } else { // Gets the radio represented by this Bluetooth adapter. // https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothadapter.getradioasync?view=winrt-20348 @@ -94,20 +98,20 @@ BluetoothAdapter::BluetoothAdapter() : windows_bluetooth_adapter_(nullptr) { windows_bluetooth_adapter_.GetRadioAsync().get(); } } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; } } // Synchronously sets the status of the BluetoothAdapter to 'status', and // returns true if the operation was a success. bool BluetoothAdapter::SetStatus(Status status) { - NEARBY_LOGS(ERROR) << __func__ << ": Set Bluetooth radio status to " - << (status == Status::kEnabled ? "On" : "Off"); + LOG(ERROR) << __func__ << ": Set Bluetooth radio status to " + << (status == Status::kEnabled ? "On" : "Off"); if (windows_bluetooth_radio_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": No Bluetooth radio on this device."; + LOG(ERROR) << __func__ << ": No Bluetooth radio on this device."; return false; } @@ -116,25 +120,23 @@ bool BluetoothAdapter::SetStatus(Status status) { if (status == Status::kDisabled && (radio_state == RadioState::Unknown || radio_state == RadioState::Off || radio_state == RadioState::Disabled)) { - NEARBY_LOGS(INFO) - << __func__ - << ": Skip set radio status kDisabled due to requested state is " - "already kDisabled."; + LOG(INFO) << __func__ + << ": Skip set radio status kDisabled due to requested state is " + "already kDisabled."; return true; } if (status == Status::kEnabled && radio_state == RadioState::On) { - NEARBY_LOGS(INFO) - << __func__ - << ": Skip set radio status kEnabled due to requested state is " - "already kEnabled."; + LOG(INFO) << __func__ + << ": Skip set radio status kEnabled due to requested state is " + "already kEnabled."; return true; } if (!FeatureFlags::GetInstance().GetFlags().enable_set_radio_state) { - NEARBY_LOGS(INFO) << __func__ - << ": Attempt to set the radio state while " - "FeatureFlags::enable_set_radio_state is false."; + LOG(INFO) << __func__ + << ": Attempt to set the radio state while " + "FeatureFlags::enable_set_radio_state is false."; return false; } @@ -148,22 +150,19 @@ bool BluetoothAdapter::SetStatus(Status status) { windows_bluetooth_radio_.SetStateAsync(RadioState::On).get(); } } catch (const winrt::hresult_error &ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set Bluetooth radio state to " - << (status == Status::kDisabled ? "kDisabled." - : "kEnabled.") - << "Exception: " << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": Failed to set Bluetooth radio state to " + << (status == Status::kDisabled ? "kDisabled." : "kEnabled.") + << "Exception: " << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; return false; } - NEARBY_LOGS(INFO) << __func__ << ": Successfully set the radio state to " - << (status == Status::kDisabled ? "kDisabled." - : "kEnabled."); + LOG(INFO) << __func__ << ": Successfully set the radio state to " + << (status == Status::kDisabled ? "kDisabled." : "kEnabled."); return true; } @@ -171,7 +170,7 @@ bool BluetoothAdapter::SetStatus(Status status) { // Status::Value::kEnabled. bool BluetoothAdapter::IsEnabled() const { if (windows_bluetooth_radio_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": No Bluetooth radio on this device."; + LOG(ERROR) << __func__ << ": No Bluetooth radio on this device."; return false; } try { @@ -179,14 +178,14 @@ bool BluetoothAdapter::IsEnabled() const { // https://docs.microsoft.com/en-us/uwp/api/windows.devices.radios.radio.state?view=winrt-20348 return windows_bluetooth_radio_.State() == RadioState::On; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << exception.what(); + LOG(ERROR) << __func__ << ": exception:" << exception.what(); return false; } catch (const winrt::hresult_error &ex) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; return false; } } @@ -195,7 +194,7 @@ bool BluetoothAdapter::IsEnabled() const { // Advertising bool BluetoothAdapter::IsExtendedAdvertisingSupported() const { if (windows_bluetooth_adapter_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": No Bluetooth adapter on this device."; + LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device."; return false; } try { @@ -204,14 +203,83 @@ bool BluetoothAdapter::IsExtendedAdvertisingSupported() const { // https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothadapter.isextendedadvertisingsupported?view=winrt-22621 return windows_bluetooth_adapter_.IsExtendedAdvertisingSupported(); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << exception.what(); + LOG(ERROR) << __func__ << ": exception:" << exception.what(); return false; } catch (const winrt::hresult_error &ex) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; + return false; + } +} + +// Returns true if the Bluetooth hardware supports BLE Central Role +bool BluetoothAdapter::IsCentralRoleSupported() const { + if (windows_bluetooth_adapter_ == nullptr) { + LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device."; + return false; + } + try { + // Indicates whether the adapter supports the BLE Central Role + // https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothadapter.iscentralrolesupported?view=winrt-22621 + return windows_bluetooth_adapter_.IsCentralRoleSupported(); + } catch (std::exception exception) { + LOG(ERROR) << __func__ << ": exception:" << exception.what(); + return false; + } catch (const winrt::hresult_error &ex) { + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); + return false; + } catch (...) { + LOG(ERROR) << __func__ << ": unknown error."; + return false; + } +} + +// Returns true if the Bluetooth hardware supports BLE Peripheral Role +bool BluetoothAdapter::IsPeripheralRoleSupported() const { + if (windows_bluetooth_adapter_ == nullptr) { + LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device."; + return false; + } + try { + // Indicates whether the adapter supports the BLE Peripheral Role + // https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothadapter.isperipheralrolesupported?view=winrt-22621 + return windows_bluetooth_adapter_.IsPeripheralRoleSupported(); + } catch (std::exception exception) { + LOG(ERROR) << __func__ << ": exception:" << exception.what(); + return false; + } catch (const winrt::hresult_error &ex) { + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); + return false; + } catch (...) { + LOG(ERROR) << __func__ << ": unknown error."; + return false; + } +} + +// Returns true if the Bluetooth hardware supports BLE +bool BluetoothAdapter::IsLowEnergySupported() const { + if (windows_bluetooth_adapter_ == nullptr) { + LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device."; + return false; + } + try { + // Indicates whether the adapter supports BLE + // https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothadapter.islowenergysupported?view=winrt-22621 + return windows_bluetooth_adapter_.IsLowEnergySupported(); + } catch (std::exception exception) { + LOG(ERROR) << __func__ << ": exception:" << exception.what(); + return false; + } catch (const winrt::hresult_error &ex) { + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); + return false; + } catch (...) { + LOG(ERROR) << __func__ << ": unknown error."; return false; } } @@ -248,13 +316,13 @@ void BluetoothAdapter::RestoreRadioNameIfNecessary() { auto settings_file = nearby::api::ImplementationPlatform::CreateInputFile(full_path, 0); if (settings_file == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to create input file."; + LOG(ERROR) << __func__ << ": Failed to create input file."; return; } auto total_size = settings_file->GetTotalSize(); if (total_size == 0) { - NEARBY_LOGS(WARNING) << __func__ << ": No data for local settings."; + LOG(WARNING) << __func__ << ": No data for local settings."; return; } @@ -264,7 +332,7 @@ void BluetoothAdapter::RestoreRadioNameIfNecessary() { settings_file->Close(); if (!raw_local_settings.ok()) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to read data file."; + LOG(ERROR) << __func__ << ": Failed to read data file."; return; } @@ -272,12 +340,11 @@ void BluetoothAdapter::RestoreRadioNameIfNecessary() { json::parse(raw_local_settings.GetResult().data(), nullptr, false); if (local_settings.is_discarded()) { - NEARBY_LOGS(ERROR) << __func__ << ": Invalid local settings data."; + LOG(ERROR) << __func__ << ": Invalid local settings data."; return; } - NEARBY_LOGS(VERBOSE) << __func__ - << ": loaded settings: " << local_settings.dump(); + VLOG(1) << __func__ << ": loaded settings: " << local_settings.dump(); LocalSettings settings = local_settings.get(); @@ -286,10 +353,10 @@ void BluetoothAdapter::RestoreRadioNameIfNecessary() { /* persist= */ true); } } catch (const winrt::hresult_error &ex) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; } } @@ -297,9 +364,8 @@ void BluetoothAdapter::StoreRadioNames(absl::string_view original_radio_name, absl::string_view nearby_radio_name) { try { if (original_radio_name.empty() || nearby_radio_name.empty()) { - NEARBY_LOGS(ERROR) - << __func__ - << ":Failed to save radio names due to invalid parameters."; + LOG(ERROR) << __func__ + << ":Failed to save radio names due to invalid parameters."; return; } @@ -311,7 +377,7 @@ void BluetoothAdapter::StoreRadioNames(absl::string_view original_radio_name, nearby::api::ImplementationPlatform::CreateOutputFile(full_path); if (settings_file == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to create output file."; + LOG(ERROR) << __func__ << ": Failed to create output file."; return; } @@ -320,18 +386,18 @@ void BluetoothAdapter::StoreRadioNames(absl::string_view original_radio_name, json encoded_local_settings; to_json(encoded_local_settings, local_settings); - NEARBY_LOGS(VERBOSE) << __func__ << ": saved settings: " - << encoded_local_settings.dump(); + VLOG(1) << __func__ + << ": saved settings: " << encoded_local_settings.dump(); ByteArray data(encoded_local_settings.dump()); settings_file->Write(data); settings_file->Close(); } catch (const winrt::hresult_error &ex) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; } } @@ -342,20 +408,22 @@ std::string BluetoothAdapter::GetName() const { return *device_name_; } - char *_instance_id = GetGenericBluetoothAdapterInstanceID(); - if (_instance_id == nullptr) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to get Generic Bluetooth Adapter InstanceID"; + std::optional adapter_instance_id = + GetGenericBluetoothAdapterInstanceID(); + if (!adapter_instance_id.has_value()) { + LOG(ERROR) << __func__ + << ": Failed to get Generic Bluetooth Adapter InstanceID"; return std::string(); } - std::string instance_id(_instance_id); + std::string instance_id = *adapter_instance_id; // Change radio module local name in registry HKEY hKey; // Retrieve the size required - size_t registry_query_size = absl::SNPrintF(nullptr, // output + char empty[0]; + size_t registry_query_size = absl::SNPrintF(empty, // output 0, // size REGISTRY_QUERY_FORMAT, // format instance_id.c_str()); // args @@ -410,18 +478,18 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { StoreRadioNames(GetName(), name); } if (name.size() > 248 * sizeof(char)) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set name for bluetooth adapter because " - "the name exceeded the 248 bytes limit for Windows."; + LOG(ERROR) << __func__ + << ": Failed to set name for bluetooth adapter because " + "the name exceeded the 248 bytes limit for Windows."; return false; } if (name.size() > kAndroidDiscoverableBluetoothNameMaxLength * sizeof(char)) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set name for bluetooth adapter because " - "Android cannot discover Windows bluetooth device " - "name that exceeded the 37 bytes limit (11 " - "characters in EndpointInfo)."; + LOG(ERROR) << __func__ + << ": Failed to set name for bluetooth adapter because " + "Android cannot discover Windows bluetooth device " + "name that exceeded the 37 bytes limit (11 " + "characters in EndpointInfo)."; device_name_ = std::string(name); return true; } @@ -429,19 +497,22 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { device_name_ = std::nullopt; if (registry_bluetooth_adapter_name_ == name) { - NEARBY_LOGS(INFO) << __func__ - << ": Tried to set name for bluetooth adapter to the " - "same name again."; + LOG(INFO) << __func__ + << ": Tried to set name for bluetooth adapter to the " + "same name again."; return true; } - std::string instance_id(GetGenericBluetoothAdapterInstanceID()); + std::optional adapter_instance_id = + GetGenericBluetoothAdapterInstanceID(); - if (instance_id.empty()) { - NEARBY_LOGS(ERROR) - << __func__ << ": Failed to get Generic Bluetooth Adapter InstanceID"; + if (!adapter_instance_id.has_value()) { + LOG(ERROR) << __func__ + << ": Failed to get Generic Bluetooth Adapter InstanceID"; return false; } + + std::string instance_id = *adapter_instance_id; // defined in usbiodef.h const GUID guid = GUID_DEVINTERFACE_USB_DEVICE; @@ -461,7 +532,7 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { StringFromGUID2(guid, guid_ole_str, guid_ole_str_size); if (conversionResult == 0) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to convert guid to string"; + LOG(ERROR) << __func__ << ": Failed to convert guid to string"; return false; } std::string guid_str; @@ -523,9 +594,9 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { // Convert the P&P instance id, to one that CreateFileA expects find_and_replace(instance_id_modified.data(), "\\", "#"); - size_t file_name_size = - absl::SNPrintF(nullptr, 0, "\\\\.\\%s#%s", instance_id_modified.c_str(), - guid_str.c_str()); + char empty[0]; + size_t file_name_size = absl::SNPrintF( + empty, 0, "\\\\.\\%s#%s", instance_id_modified.c_str(), guid_str.c_str()); std::string file_name; file_name.reserve(file_name_size + 1); @@ -552,15 +623,15 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { // access right. This parameter can be NULL. if (hDevice == INVALID_HANDLE_VALUE) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to open device. Error code: " - << GetLastError(); + LOG(ERROR) << __func__ + << ": Failed to open device. Error code: " << GetLastError(); return false; } // Change radio module local name in registry HKEY hKey; size_t buffer_size = - absl::SNPrintF(nullptr, 0, REGISTRY_QUERY_FORMAT, instance_id); + absl::SNPrintF(empty, 0, REGISTRY_QUERY_FORMAT, instance_id); std::string local_name_key; local_name_key.reserve(buffer_size + 1); @@ -582,9 +653,8 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { // key. if (status != ERROR_SUCCESS) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to open registry key. Error code: " - << status; + LOG(ERROR) << __func__ + << ": Failed to open registry key. Error code: " << status; return false; } @@ -610,9 +680,8 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { } if (status != ERROR_SUCCESS) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set/delete registry key. Error code: " - << status; + LOG(ERROR) << __func__ + << ": Failed to set/delete registry key. Error code: " << status; return false; } @@ -642,10 +711,9 @@ bool BluetoothAdapter::SetName(absl::string_view name, bool persist) { &bytes, // A pointer to a variable that receives the size of the // data stored in the output buffer, in bytes. NULL)) { // A pointer to an OVERLAPPED structure. - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to update radio module local name. Error code: " - << GetLastError(); + LOG(ERROR) << __func__ + << ": Failed to update radio module local name. Error code: " + << GetLastError(); return false; } @@ -679,8 +747,8 @@ void BluetoothAdapter::process_error() { break; } - NEARBY_LOGS(ERROR) << __func__ << ": Failed to convert guid to string " - << errorResult << " Error code:" << errorMessageID; + LOG(ERROR) << __func__ << ": Failed to convert guid to string " << errorResult + << " Error code:" << errorMessageID; } void BluetoothAdapter::find_and_replace(char *source, const char *strFind, @@ -697,7 +765,8 @@ void BluetoothAdapter::find_and_replace(char *source, const char *strFind, memcpy(source, s.c_str(), s.size()); } -char *BluetoothAdapter::GetGenericBluetoothAdapterInstanceID(void) const { +std::optional +BluetoothAdapter::GetGenericBluetoothAdapterInstanceID() const { unsigned i; CONFIGRET r; HDEVINFO hDevInfo; @@ -713,9 +782,9 @@ char *BluetoothAdapter::GetGenericBluetoothAdapterInstanceID(void) const { SetupDiGetClassDevsA(&GUID_DEVCLASS_BLUETOOTH, NULL, NULL, DIGCF_PRESENT); if (hDevInfo == INVALID_HANDLE_VALUE) { - NEARBY_LOGS(ERROR) << __func__ - << ": Could not find BluetoothDevice on this machine"; - return NULL; + LOG(ERROR) << __func__ + << ": Could not find BluetoothDevice on this machine"; + return std::nullopt; } // Get first Generic Bluetooth Adapter InstanceID @@ -741,34 +810,34 @@ char *BluetoothAdapter::GetGenericBluetoothAdapterInstanceID(void) const { // computer's USB ports. // https://docs.microsoft.com/en-us/windows-hardware/drivers/bluetooth/bluetooth-host-radio-support if (strncmp("USB", deviceInstanceID, 3) == 0) { - return deviceInstanceID; + SetupDiDestroyDeviceInfoList(hDevInfo); + return std::string(deviceInstanceID); } } - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get the generic bluetooth adapter id"; - - return NULL; + LOG(ERROR) << __func__ << ": Failed to get the generic bluetooth adapter id"; + SetupDiDestroyDeviceInfoList(hDevInfo); + return std::nullopt; } // Returns BT MAC address assigned to this adapter. std::string BluetoothAdapter::GetMacAddress() const { if (windows_bluetooth_adapter_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": No Bluetooth adapter on this device."; + LOG(ERROR) << __func__ << ": No Bluetooth adapter on this device."; return ""; } try { return uint64_to_mac_address_string( windows_bluetooth_adapter_.BluetoothAddress()); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << exception.what(); + LOG(ERROR) << __func__ << ": exception:" << exception.what(); return ""; } catch (const winrt::hresult_error &ex) { - NEARBY_LOGS(ERROR) << __func__ << ": exception:" << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": exception:" << ex.code() << ": " + << winrt::to_string(ex.message()); return ""; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": unknown error."; + LOG(ERROR) << __func__ << ": unknown error."; return ""; } } @@ -794,9 +863,8 @@ std::string BluetoothAdapter::GetNameFromRegistry(PHKEY hKey) const { // size of the buffer pointed to by the lpData // parameter, in bytes. if (status != ERROR_SUCCESS) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to get the required size of the local name buffer"; + LOG(ERROR) << __func__ + << ": Failed to get the required size of the local name buffer"; return ""; } unsigned char *local_name = new unsigned char[local_name_size]; @@ -834,7 +902,7 @@ std::string BluetoothAdapter::GetNameFromComputerName() const { return std::string(computer_name); } - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get any computer name"; + LOG(ERROR) << __func__ << ": Failed to get any computer name"; return ""; } diff --git a/internal/platform/implementation/windows/bluetooth_adapter.h b/internal/platform/implementation/windows/bluetooth_adapter.h index 9d5fbc0f..34923e48 100644 --- a/internal/platform/implementation/windows/bluetooth_adapter.h +++ b/internal/platform/implementation/windows/bluetooth_adapter.h @@ -40,7 +40,7 @@ using WindowsBluetoothAdapter = // Represents a radio device on the system. // https://docs.microsoft.com/en-us/uwp/api/windows.devices.radios.radio?view=winrt-20348 -using winrt::Windows::Devices::Radios::IRadio; +using winrt::Windows::Devices::Radios::Radio; // Enumeration that describes possible radio states. // https://docs.microsoft.com/en-us/uwp/api/windows.devices.radios.radiostate?view=winrt-20348 @@ -98,6 +98,16 @@ class BluetoothAdapter : public api::BluetoothAdapter { // Returns true if the Bluetooth hardware supports Bluetooth 5.0 Extended // Advertising bool IsExtendedAdvertisingSupported() const; + + // Returns true if the Bluetooth hardware supports BLE Central Role + bool IsCentralRoleSupported() const; + + // Returns true if the Bluetooth hardware supports BLE Peripheral Role + bool IsPeripheralRoleSupported() const; + + // Returns true if the Bluetooth hardware supports BLE + bool IsLowEnergySupported() const; + void RestoreRadioNameIfNecessary(); private: @@ -105,11 +115,11 @@ class BluetoothAdapter : public api::BluetoothAdapter { void StoreRadioNames(absl::string_view original_radio_name, absl::string_view nearby_radio_name); - WindowsBluetoothAdapter windows_bluetooth_adapter_; + WindowsBluetoothAdapter windows_bluetooth_adapter_ = nullptr; std::string registry_bluetooth_adapter_name_; - IRadio windows_bluetooth_radio_; - char *GetGenericBluetoothAdapterInstanceID() const; + Radio windows_bluetooth_radio_ = nullptr; + std::optional GetGenericBluetoothAdapterInstanceID() const; void find_and_replace(char *source, const char *strFind, const char *strReplace) const; ScanMode scan_mode_ = ScanMode::kNone; diff --git a/internal/platform/implementation/windows/bluetooth_adapter_test.cc b/internal/platform/implementation/windows/bluetooth_adapter_test.cc index 8c9c5ae1..32577ca2 100644 --- a/internal/platform/implementation/windows/bluetooth_adapter_test.cc +++ b/internal/platform/implementation/windows/bluetooth_adapter_test.cc @@ -183,6 +183,21 @@ TEST(BluetoothAdapter, DISABLED_IsExtendedAdvertisingSupported) { EXPECT_TRUE(bluetooth_adapter.IsExtendedAdvertisingSupported()); } +TEST(BluetoothAdapter, DISABLED_IsCentralRoleSupported) { + BluetoothAdapter bluetooth_adapter; + EXPECT_TRUE(bluetooth_adapter.IsCentralRoleSupported()); +} + +TEST(BluetoothAdapter, DISABLED_IsPeripheralRoleSupported) { + BluetoothAdapter bluetooth_adapter; + EXPECT_TRUE(bluetooth_adapter.IsPeripheralRoleSupported()); +} + +TEST(BluetoothAdapter, DISABLED_IsLowEnergySupported) { + BluetoothAdapter bluetooth_adapter; + EXPECT_TRUE(bluetooth_adapter.IsLowEnergySupported()); +} + TEST(BluetoothAdapter, DISABLED_GetNameFromComputerName) { BluetoothAdapter bluetooth_adapter; EXPECT_TRUE(!bluetooth_adapter.GetNameFromComputerName().empty()); diff --git a/internal/platform/implementation/windows/bluetooth_classic_device.cc b/internal/platform/implementation/windows/bluetooth_classic_device.cc index 707ebd62..954a4e58 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_device.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_device.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,12 +16,17 @@ #include +#include // NOLINT(build/c++11) #include #include #include #include #include "absl/strings/string_view.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Devices.Bluetooth.Rfcomm.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Devices.Bluetooth.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Devices.Enumeration.h" @@ -34,9 +39,11 @@ namespace nearby { namespace windows { namespace { -constexpr int kBluetoothTimeoutInSeconds = 10; - using ::winrt::Windows::Foundation::TimeSpan; + +constexpr int kBluetoothTimeoutInSeconds = 10; +constexpr int kCheckBluetoothServiceMaxTimes = 3; +constexpr absl::Duration kCheckBluetoothServiceInterval = absl::Seconds(1); } // namespace BluetoothDevice::~BluetoothDevice() {} @@ -71,10 +78,16 @@ std::string BluetoothDevice::GetMacAddress() const { return mac_address_; } // Checks cache first, will check uncached if no result. RfcommDeviceService BluetoothDevice::GetRfcommServiceForIdAsync( - const RfcommServiceId serviceId) { + RfcommServiceId serviceId) { + if (nearby::NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableNewBluetoothRefactor)) { + return GetRfcommServiceForIdWithRetryAsync(serviceId); + } + try { - NEARBY_LOGS(INFO) << __func__ << ": Get RF services for service id:" - << winrt::to_string(serviceId.AsString()); + LOG(INFO) << __func__ << ": Get RF services for service id:" + << winrt::to_string(serviceId.AsString()); RfcommDeviceServicesResult rfcomm_device_services = nullptr; // Try to get service from un cached mode. @@ -88,13 +101,12 @@ RfcommDeviceService BluetoothDevice::GetRfcommServiceForIdAsync( rfcomm_device_services = rfcomm_device_services_async.GetResults(); break; case winrt::Windows::Foundation::AsyncStatus::Started: - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to get RfcommDeviceService due to timeout."; + LOG(ERROR) << __func__ + << ": Failed to get RfcommDeviceService due to timeout."; rfcomm_device_services_async.Cancel(); return nullptr; default: - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ": Failed to get RfcommDeviceService due to unknown reasons."; return nullptr; @@ -102,35 +114,106 @@ RfcommDeviceService BluetoothDevice::GetRfcommServiceForIdAsync( if (rfcomm_device_services != nullptr && rfcomm_device_services.Services().Size() > 0) { - NEARBY_LOGS(INFO) << __func__ << ": Get " - << rfcomm_device_services.Services().Size() - << " services without cache."; + LOG(INFO) << __func__ << ": Get " + << rfcomm_device_services.Services().Size() + << " services without cache."; // found the matched service. for (auto rfcomm_device_service : rfcomm_device_services.Services()) { if (rfcomm_device_service.Device() != nullptr && winrt::to_string(rfcomm_device_service.Device().DeviceId()) == id_) { - NEARBY_LOGS(INFO) - << __func__ << ": Found service from no-cache mode."; + LOG(INFO) << __func__ << ": Found service from no-cache mode."; return rfcomm_device_service; } } } + LOG(ERROR) << __func__ + << ": Failed to get RfcommDeviceService due to no any services."; return nullptr; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get RfcommDeviceService: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to get RfcommDeviceService: " << exception.what(); return nullptr; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ << ": RfcommDeviceService: " << ex.code() - << ", error message: " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": RfcommDeviceService: " << ex.code() + << ", error message: " << winrt::to_string(ex.message()); return nullptr; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return nullptr; } } +// Checks cache first, will check uncached if no result. +RfcommDeviceService BluetoothDevice::GetRfcommServiceForIdWithRetryAsync( + RfcommServiceId serviceId) { + int check_service_count = 0; + while (check_service_count < kCheckBluetoothServiceMaxTimes) { + try { + LOG(INFO) << __func__ << ": Get RF services for service id:" + << winrt::to_string(serviceId.AsString()); + + RfcommDeviceServicesResult rfcomm_device_services = nullptr; + // Try to get service from un cached mode. + auto rfcomm_device_services_async = + windows_bluetooth_device_.GetRfcommServicesForIdAsync( + serviceId, BluetoothCacheMode::Uncached); + + switch (rfcomm_device_services_async.wait_for( + TimeSpan(std::chrono::seconds(kBluetoothTimeoutInSeconds)))) { + case winrt::Windows::Foundation::AsyncStatus::Completed: + rfcomm_device_services = rfcomm_device_services_async.GetResults(); + break; + case winrt::Windows::Foundation::AsyncStatus::Started: + LOG(ERROR) << __func__ + << ": Failed to get RfcommDeviceService due to timeout."; + rfcomm_device_services_async.Cancel(); + return nullptr; + default: + LOG(ERROR) + << __func__ + << ": Failed to get RfcommDeviceService due to unknown reasons."; + return nullptr; + } + + if (rfcomm_device_services != nullptr && + rfcomm_device_services.Services().Size() > 0) { + LOG(INFO) << __func__ << ": Get " + << rfcomm_device_services.Services().Size() + << " services without cache."; + // found the matched service. + for (auto rfcomm_device_service : rfcomm_device_services.Services()) { + if (rfcomm_device_service.Device() != nullptr && + winrt::to_string(rfcomm_device_service.Device().DeviceId()) == + id_) { + LOG(INFO) << __func__ << ": Found service from no-cache mode."; + return rfcomm_device_service; + } + } + } + + ++check_service_count; + absl::SleepFor(kCheckBluetoothServiceInterval); + LOG(ERROR) << __func__ << ": No any services at " << check_service_count + << "th check."; + } catch (std::exception exception) { + LOG(ERROR) << __func__ + << ": Failed to get RfcommDeviceService: " << exception.what(); + return nullptr; + } catch (const winrt::hresult_error& ex) { + LOG(ERROR) << __func__ << ": RfcommDeviceService: " << ex.code() + << ", error message: " << winrt::to_string(ex.message()); + return nullptr; + } catch (...) { + LOG(ERROR) << __func__ << ": Unknown exception."; + return nullptr; + } + } + + LOG(ERROR) << __func__ << ": Failed to get RfcommDeviceService."; + return nullptr; +} + } // namespace windows } // namespace nearby diff --git a/internal/platform/implementation/windows/bluetooth_classic_device.h b/internal/platform/implementation/windows/bluetooth_classic_device.h index 7c16e3c7..2c61029c 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_device.h +++ b/internal/platform/implementation/windows/bluetooth_classic_device.h @@ -77,10 +77,12 @@ class BluetoothDevice : public api::BluetoothDevice { void SetName(std::string name) { name_ = name; } RfcommDeviceService GetRfcommServiceForIdAsync( - const winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId - serviceId); + winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId serviceId); private: + RfcommDeviceService GetRfcommServiceForIdWithRetryAsync( + winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId serviceId); + // https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.bluetoothdevice?view=winrt-20348 winrt::Windows::Devices::Bluetooth::BluetoothDevice windows_bluetooth_device_; diff --git a/internal/platform/implementation/windows/bluetooth_classic_medium.cc b/internal/platform/implementation/windows/bluetooth_classic_medium.cc index 9daaa8d7..707e2ddd 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_medium.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_medium.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,11 +14,9 @@ #include "internal/platform/implementation/windows/bluetooth_classic_medium.h" -#include #include #include -#include #include #include #include @@ -31,6 +29,8 @@ #include "internal/platform/cancellation_flag.h" #include "internal/platform/cancellation_flag_listener.h" #include "internal/platform/exception.h" +#include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/bluetooth_classic_device.h" @@ -49,12 +49,31 @@ namespace nearby { namespace windows { namespace { -using winrt::Windows::Foundation::IInspectable; -using winrt::Windows::Foundation::Collections::IMapView; +using ::winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommDeviceService; +using ::winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId; +using ::winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceProvider; +using ::winrt::Windows::Devices::Enumeration::DeviceAccessInformation; +using ::winrt::Windows::Devices::Enumeration::DeviceAccessStatus; +using ::winrt::Windows::Devices::Enumeration::DeviceInformation; +using ::winrt::Windows::Devices::Enumeration::DeviceInformationKind; +using ::winrt::Windows::Devices::Enumeration::DeviceInformationUpdate; +using ::winrt::Windows::Devices::Enumeration::DeviceWatcher; +using ::winrt::Windows::Devices::Enumeration::DeviceWatcherStatus; +using ::winrt::Windows::Foundation::IInspectable; +using ::winrt::Windows::Foundation::Collections::IMapView; +using ::winrt::Windows::Storage::Streams::DataReader; +using ::winrt::Windows::Storage::Streams::DataWriter; +using ::winrt::Windows::Storage::Streams::UnicodeEncoding; -// Used to cntrol the dump output for device information. It is only for debug +// Used to control the dump output for device information. It is only for debug // purpose. constexpr bool kEnableDumpDeviceInfomation = false; +// The maximum length of Bluetooth device name Android can discover. +constexpr int kAndroidDiscoverableBluetoothNameMaxLength = 37; // bytes +// Used to select bluetooth devices. +constexpr wchar_t kBluetoothSelector[] = + L"System.Devices.Aep.ProtocolId:=\"{e0cbf06c-cd8b-4647-bb8a-263b43f0f974}" + L"\""; void DumpDeviceInformation( const IMapView& properties) { @@ -68,31 +87,29 @@ void DumpDeviceInformation( for (const auto& property : properties) { if (property.Key() == L"System.ItemNameDisplay") { - NEARBY_LOGS(INFO) << "System.ItemNameDisplay: " - << InspectableReader::ReadString(property.Value()); + LOG(INFO) << "System.ItemNameDisplay: " + << InspectableReader::ReadString(property.Value()); } else if (property.Key() == L"System.Devices.Aep.CanPair") { - NEARBY_LOGS(INFO) << "System.Devices.Aep.CanPair: " - << InspectableReader::ReadBoolean(property.Value()); + LOG(INFO) << "System.Devices.Aep.CanPair: " + << InspectableReader::ReadBoolean(property.Value()); } else if (property.Key() == L"System.Devices.Aep.IsPaired") { - NEARBY_LOGS(INFO) << "System.Devices.Aep.IsPaired: " - << InspectableReader::ReadBoolean(property.Value()); + LOG(INFO) << "System.Devices.Aep.IsPaired: " + << InspectableReader::ReadBoolean(property.Value()); } else if (property.Key() == L"System.Devices.Aep.IsPresent") { - NEARBY_LOGS(INFO) << "System.Devices.Aep.IsPresent: " - << InspectableReader::ReadBoolean(property.Value()); + LOG(INFO) << "System.Devices.Aep.IsPresent: " + << InspectableReader::ReadBoolean(property.Value()); } else if (property.Key() == L"System.Devices.Aep.DeviceAddress") { - NEARBY_LOGS(INFO) << "System.Devices.Aep.DeviceAddress: " - << InspectableReader::ReadString(property.Value()); + LOG(INFO) << "System.Devices.Aep.DeviceAddress: " + << InspectableReader::ReadString(property.Value()); } } } } // namespace -constexpr uint8_t kAndroidDiscoverableBluetoothNameMaxLength = 37; // bytes - BluetoothClassicMedium::BluetoothClassicMedium( - api::BluetoothAdapter& bluetoothAdapter) - : bluetooth_adapter_(dynamic_cast(bluetoothAdapter)) { + api::BluetoothAdapter& bluetooth_adapter) + : bluetooth_adapter_(dynamic_cast(bluetooth_adapter)) { InitializeDeviceWatcher(); bluetooth_adapter_.RestoreRadioNameIfNecessary(); @@ -103,17 +120,16 @@ BluetoothClassicMedium::BluetoothClassicMedium( BluetoothClassicMedium::~BluetoothClassicMedium() {} void BluetoothClassicMedium::OnScanModeChanged( - BluetoothAdapter::ScanMode scanMode) { - NEARBY_LOGS(INFO) << __func__ - << ": OnScanModeChanged is called with scanMode: " - << static_cast(scanMode); + BluetoothAdapter::ScanMode scan_mode) { + LOG(INFO) << __func__ << ": OnScanModeChanged is called with scanMode: " + << static_cast(scan_mode); - if (scanMode == scan_mode_) { - NEARBY_LOGS(INFO) << __func__ << ": No change of scan mode."; + if (scan_mode == scan_mode_) { + LOG(INFO) << __func__ << ": No change of scan mode."; return; } - scan_mode_ = scanMode; + scan_mode_ = scan_mode; bool radio_discoverable = scan_mode_ == BluetoothAdapter::ScanMode::kConnectableDiscoverable; @@ -125,12 +141,12 @@ void BluetoothClassicMedium::OnScanModeChanged( } if (is_radio_discoverable_ == radio_discoverable) { - NEARBY_LOGS(INFO) << __func__ << ": No change of radio discovery."; + LOG(INFO) << __func__ << ": No change of radio discovery."; return; } if (rfcomm_provider_ == nullptr) { - NEARBY_LOGS(INFO) << __func__ << ": No advertising."; + LOG(WARNING) << __func__ << ": No advertising."; return; } @@ -141,23 +157,22 @@ void BluetoothClassicMedium::OnScanModeChanged( is_radio_discoverable_ = radio_discoverable; return; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": OnScanModeChanged exception: " << exception.what(); + LOG(ERROR) << __func__ + << ": OnScanModeChanged exception: " << exception.what(); return; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": OnScanModeChanged exception: " << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": OnScanModeChanged exception: " << ex.code() + << ": " << winrt::to_string(ex.message()); return; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return; } } bool BluetoothClassicMedium::StartDiscovery( BluetoothClassicMedium::DiscoveryCallback discovery_callback) { - NEARBY_LOGS(INFO) << "StartDiscovery is called."; + LOG(INFO) << "StartDiscovery is called."; bool result = false; discovery_callback_ = std::move(discovery_callback); @@ -170,7 +185,7 @@ bool BluetoothClassicMedium::StartDiscovery( } bool BluetoothClassicMedium::StopDiscovery() { - NEARBY_LOGS(INFO) << "StopDiscovery is called."; + LOG(INFO) << "StopDiscovery is called."; bool result = false; @@ -184,14 +199,14 @@ bool BluetoothClassicMedium::StopDiscovery() { void BluetoothClassicMedium::InitializeDeviceWatcher() { try { // create watcher - const winrt::param::iterable RequestedProperties = + const winrt::param::iterable requested_properties = winrt::single_threaded_vector( {winrt::to_hstring("System.Devices.Aep.IsPresent"), winrt::to_hstring("System.Devices.Aep.DeviceAddress")}); device_watcher_ = DeviceInformation::CreateWatcher( - BLUETOOTH_SELECTOR, // aqsFilter - RequestedProperties, // additionalProperties + kBluetoothSelector, // aqsFilter + requested_properties, // additionalProperties DeviceInformationKind::AssociationEndpoint); // kind // An app must subscribe to all of the added, removed, and updated events @@ -217,14 +232,14 @@ void BluetoothClassicMedium::InitializeDeviceWatcher() { device_watcher_.Removed( {this, &BluetoothClassicMedium::DeviceWatcher_Removed}); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": InitializeDeviceWatcher exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": InitializeDeviceWatcher exception: " << exception.what(); } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": InitializeDeviceWatcher exception: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": InitializeDeviceWatcher exception: " << ex.code() << ": " + << winrt::to_string(ex.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } } @@ -232,9 +247,9 @@ std::unique_ptr BluetoothClassicMedium::ConnectToService( api::BluetoothDevice& remote_device, const std::string& service_uuid, CancellationFlag* cancellation_flag) { try { - NEARBY_LOGS(INFO) << "ConnectToService is called."; + LOG(INFO) << "ConnectToService is called."; if (service_uuid.empty()) { - NEARBY_LOGS(ERROR) << __func__ << ": service_uuid not specified."; + LOG(ERROR) << __func__ << ": service_uuid not specified."; return nullptr; } @@ -246,83 +261,51 @@ std::unique_ptr BluetoothClassicMedium::ConnectToService( // Must check for valid pattern as the guid constructor will throw on an // invalid format if (!std::regex_match(service_uuid, pattern)) { - NEARBY_LOGS(ERROR) << __func__ - << ": invalid service_uuid: " << service_uuid; + LOG(ERROR) << __func__ << ": invalid service_uuid: " << service_uuid; return nullptr; } winrt::guid service(service_uuid); if (cancellation_flag == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": cancellation_flag not specified."; + LOG(ERROR) << __func__ << ": cancellation_flag not specified."; return nullptr; } - remote_device_to_connect_ = - std::make_unique(remote_device.GetMacAddress()); + auto remote_device_to_connect_ = dynamic_cast( + GetRemoteDevice(remote_device.GetMacAddress())); - // First try, check if the remote device that we want to request connection - // to has already been discovered by the Bluetooth Classic Device Watcher - // beforehand inside the discovered_devices_by_id_ map - std::map>::const_iterator - it = discovered_devices_by_id_.find( - winrt::to_hstring(remote_device_to_connect_->GetId())); - - std::unique_ptr device = nullptr; - BluetoothDevice* current_device = nullptr; - - if (it != discovered_devices_by_id_.end()) { - current_device = it->second.get(); - } else { - // The remote device was not discovered by the Bluetooth Classic Device - // Watcher beforehand. - // Second try, request Windows to scan for nearby - // bluetooth devices that has this static mac address again in this - // instance - auto remote_bluetooth_device_from_mac_address = - winrt::Windows::Devices::Bluetooth::BluetoothDevice:: - FromBluetoothAddressAsync( - mac_address_string_to_uint64(remote_device.GetMacAddress())) - .get(); - if (remote_bluetooth_device_from_mac_address == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Windows failed to get remote bluetooth device " - "from static mac address."; - return nullptr; - } - device = std::make_unique( - remote_bluetooth_device_from_mac_address); - current_device = device.get(); - } - - if (current_device == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get current device."; + if (remote_device_to_connect_ == nullptr || + remote_device_to_connect_->GetId().empty()) { + LOG(ERROR) << __func__ + << ": Failed to get remote device from MAC address."; return nullptr; } - winrt::hstring device_id = winrt::to_hstring(current_device->GetId()); + winrt::hstring device_id = + winrt::to_hstring(remote_device_to_connect_->GetId()); if (!HaveAccess(device_id)) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to gain access to device: " - << winrt::to_string(device_id); + LOG(ERROR) << __func__ << ": Failed to gain access to device: " + << winrt::to_string(device_id); return nullptr; } RfcommDeviceService requested_service( - GetRequestedService(current_device, service)); + GetRequestedService(remote_device_to_connect_, service)); if (!FeatureFlags::GetInstance() .GetFlags() .skip_service_discovery_before_connecting_to_rfcomm && !CheckSdp(requested_service)) { - NEARBY_LOGS(ERROR) << __func__ << ": Invalid SDP."; + LOG(ERROR) << __func__ << ": Invalid SDP."; return nullptr; } auto rfcomm_socket = std::make_unique(); if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) + LOG(INFO) << __func__ << ": Bluetooth Classic socket connection cancelled for device: " << winrt::to_string(device_id) << ", service: " << service_uuid; @@ -342,25 +325,25 @@ std::unique_ptr BluetoothClassicMedium::ConnectToService( } catch (std::exception exception) { // We will log and eat the exception since the caller // expects nullptr if it fails - NEARBY_LOGS(ERROR) << __func__ << ": Exception connecting bluetooth async: " - << exception.what(); + LOG(ERROR) << __func__ << ": Exception connecting bluetooth async: " + << exception.what(); return nullptr; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception connecting bluetooth async, error code: " - << ex.code() - << ", error message: " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ + << ": Exception connecting bluetooth async, error code: " + << ex.code() + << ", error message: " << winrt::to_string(ex.message()); return nullptr; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return nullptr; } } std::unique_ptr BluetoothClassicMedium::CreatePairing( api::BluetoothDevice& remote_device) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start to createPairing with device: " - << remote_device.GetMacAddress(); + VLOG(1) << __func__ << ": Start to createPairing with device: " + << remote_device.GetMacAddress(); try { winrt::Windows::Devices::Bluetooth::BluetoothDevice bluetooth_device = winrt::Windows::Devices::Bluetooth::BluetoothDevice:: @@ -374,18 +357,15 @@ std::unique_ptr BluetoothClassicMedium::CreatePairing( return std::make_unique(bluetooth_device, custom_pairing); } - NEARBY_LOGS(VERBOSE) << __func__ - << ": Failed to get DeviceInformationCustomPairing."; + VLOG(1) << __func__ << ": Failed to get DeviceInformationCustomPairing."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << " : Failed to create pairing. exception: " - << exception.what(); + LOG(ERROR) << __func__ << " : Failed to create pairing. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to create pairing. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Failed to create pairing. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return nullptr; } @@ -420,39 +400,39 @@ bool BluetoothClassicMedium::HaveAccess(winrt::hstring device_id) { RfcommDeviceService BluetoothClassicMedium::GetRequestedService( BluetoothDevice* device, winrt::guid service) { - RfcommServiceId rfcommServiceId = RfcommServiceId::FromUuid(service); - return device->GetRfcommServiceForIdAsync(rfcommServiceId); + RfcommServiceId rfcomm_service_id = RfcommServiceId::FromUuid(service); + return device->GetRfcommServiceForIdAsync(rfcomm_service_id); } -bool BluetoothClassicMedium::CheckSdp(RfcommDeviceService requestedService) { +bool BluetoothClassicMedium::CheckSdp(RfcommDeviceService requested_service) { // Do various checks of the SDP record to make sure you are talking to a // device that actually supports the Bluetooth Rfcomm Service // https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommdeviceservice.getsdprawattributesasync?view=winrt-20348 try { - if (requestedService == nullptr) { + if (requested_service == nullptr) { + LOG(WARNING) << __func__ << ": Request service is empty."; return false; } - auto attributes = requestedService.GetSdpRawAttributesAsync().get(); + auto attributes = requested_service.GetSdpRawAttributesAsync().get(); if (!attributes.HasKey(Constants::SdpServiceNameAttributeId)) { - NEARBY_LOGS(ERROR) << __func__ << ": Missing SdpServiceNameAttributeId."; + LOG(ERROR) << __func__ << ": Missing SdpServiceNameAttributeId."; return false; } - auto attributeReader = DataReader::FromBuffer( + auto attribute_reader = DataReader::FromBuffer( attributes.Lookup(Constants::SdpServiceNameAttributeId)); - auto attributeType = attributeReader.ReadByte(); + auto attribute_type = attribute_reader.ReadByte(); - if (attributeType != Constants::SdpServiceNameAttributeType) { - NEARBY_LOGS(ERROR) << __func__ - << ": Missing SdpServiceNameAttributeType."; + if (attribute_type != Constants::SdpServiceNameAttributeType) { + LOG(ERROR) << __func__ << ": Missing SdpServiceNameAttributeType."; return false; } return true; } catch (...) { - NEARBY_LOGS(ERROR) << "Failed to get SDP information."; + LOG(ERROR) << "Failed to get SDP information."; return false; } } @@ -469,15 +449,15 @@ bool BluetoothClassicMedium::CheckSdp(RfcommDeviceService requestedService) { std::unique_ptr BluetoothClassicMedium::ListenForService(const std::string& service_name, const std::string& service_uuid) { - NEARBY_LOGS(INFO) << "ListenForService is called with service name: " - << service_name << "."; + LOG(INFO) << "ListenForService is called with service name: " << service_name + << "."; if (service_uuid.empty()) { - NEARBY_LOGS(ERROR) << __func__ << ": service_uuid was empty."; + LOG(ERROR) << __func__ << ": service_uuid was empty."; return nullptr; } if (service_name.empty()) { - NEARBY_LOGS(ERROR) << __func__ << ": service_name was empty."; + LOG(ERROR) << __func__ << ": service_name was empty."; return nullptr; } @@ -486,15 +466,14 @@ BluetoothClassicMedium::ListenForService(const std::string& service_name, scan_mode_ = bluetooth_adapter_.GetScanMode(); - NEARBY_LOGS(INFO) << __func__ - << ": scan_mode: " << static_cast(scan_mode_); + LOG(INFO) << __func__ << ": scan_mode: " << static_cast(scan_mode_); bool radio_discoverable = scan_mode_ == BluetoothAdapter::ScanMode::kConnectableDiscoverable; bool result = StartAdvertising(radio_discoverable); if (!result) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to start listening."; + LOG(ERROR) << __func__ << ": Failed to start listening."; return nullptr; } @@ -503,19 +482,34 @@ BluetoothClassicMedium::ListenForService(const std::string& service_name, api::BluetoothDevice* BluetoothClassicMedium::GetRemoteDevice( const std::string& mac_address) { - return new BluetoothDevice(mac_address); + auto it = mac_address_to_bluetooth_device_map_.find(mac_address); + + if (it == mac_address_to_bluetooth_device_map_.end()) { + LOG(WARNING) << __func__ << ": Bluetooth device " << mac_address + << " is not in list. create it"; + auto bluetooth_device = std::make_unique(mac_address); + + mac_address_to_bluetooth_device_map_[mac_address] = + std::move(bluetooth_device); + return mac_address_to_bluetooth_device_map_[mac_address].get(); + } + + LOG(INFO) << __func__ << ": Bluetooth device " << mac_address + << " is in cache"; + + return it->second.get(); } bool BluetoothClassicMedium::StartScanning() { if (!IsWatcherStarted()) { if (device_watcher_ == nullptr) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to start scanning due to no available watcher."; + LOG(ERROR) << __func__ + << ": Failed to start scanning due to no available watcher."; return false; } - discovered_devices_by_id_.clear(); + mac_address_to_bluetooth_device_map_.clear(); + removed_bluetooth_devices_map_.clear(); // The Start method can only be called when the DeviceWatcher is in the // Created, Stopped or Aborted state. @@ -530,9 +524,8 @@ bool BluetoothClassicMedium::StartScanning() { } } - NEARBY_LOGS(ERROR) - << __func__ - << ": Attempted to start scanning when watcher already started."; + LOG(ERROR) << __func__ + << ": Attempted to start scanning when watcher already started."; return false; } @@ -541,16 +534,15 @@ bool BluetoothClassicMedium::StopScanning() { device_watcher_.Stop(); return true; } - NEARBY_LOGS(ERROR) - << __func__ - << ": Attempted to stop scanning when watcher already stopped."; + LOG(ERROR) << __func__ + << ": Attempted to stop scanning when watcher already stopped."; return false; } winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Added( - DeviceWatcher sender, DeviceInformation deviceInfo) { - NEARBY_LOGS(INFO) << "Device added " << winrt::to_string(deviceInfo.Id()); - IMapView properties = deviceInfo.Properties(); + DeviceWatcher sender, DeviceInformation device_info) { + LOG(INFO) << "Device added " << winrt::to_string(device_info.Id()); + IMapView properties = device_info.Properties(); DumpDeviceInformation(properties); if (!IsWatcherStarted()) { @@ -559,85 +551,93 @@ winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Added( // If device no item name, ignore it. if (!properties.HasKey(L"System.ItemNameDisplay")) { - NEARBY_LOGS(WARNING) << __func__ << ": Ignore the Bluetooth device " - << winrt::to_string(deviceInfo.Id()) - << " due to no name."; + LOG(WARNING) << __func__ << ": Ignore the Bluetooth device " + << winrt::to_string(device_info.Id()) << " due to no name."; return winrt::fire_and_forget(); } if (properties.Lookup(L"System.ItemNameDisplay") == nullptr) { - NEARBY_LOGS(WARNING) << __func__ << ": Ignore the Bluetooth device " - << winrt::to_string(deviceInfo.Id()) - << " due to empty name."; + LOG(WARNING) << __func__ << ": Ignore the Bluetooth device " + << winrt::to_string(device_info.Id()) << " due to empty name."; return winrt::fire_and_forget(); } // If device doesn't support pair, ignore it. if (!properties.HasKey(L"System.Devices.Aep.CanPair")) { - NEARBY_LOGS(WARNING) << __func__ << ": Ignore the Bluetooth device " - << winrt::to_string(deviceInfo.Id()) - << " due to no pair property."; + LOG(WARNING) << __func__ << ": Ignore the Bluetooth device " + << winrt::to_string(device_info.Id()) + << " due to no pair property."; return winrt::fire_and_forget(); } if (!InspectableReader::ReadBoolean( properties.Lookup(L"System.Devices.Aep.CanPair"))) { - NEARBY_LOGS(WARNING) << __func__ << ": Ignore the Bluetooth device " - << winrt::to_string(deviceInfo.Id()) - << " due to not support pair."; - return winrt::fire_and_forget(); - } - - // Create an iterator for the internal list - std::map>::const_iterator - it = discovered_devices_by_id_.find(deviceInfo.Id()); - - // Add to our internal list if necessary - if (it != discovered_devices_by_id_.end()) { - // We're already tracking this one - NEARBY_LOGS(WARNING) << __func__ << ": Bluetooth device " - << winrt::to_string(deviceInfo.Id()) - << " is alreay added."; + LOG(WARNING) << __func__ << ": Ignore the Bluetooth device " + << winrt::to_string(device_info.Id()) + << " due to not support pair."; return winrt::fire_and_forget(); } // Create a bluetooth device out of this id - auto bluetoothDevice = - winrt::Windows::Devices::Bluetooth::BluetoothDevice::FromIdAsync( - deviceInfo.Id()) + auto native_bluetooth_device = + ::winrt::Windows::Devices::Bluetooth::BluetoothDevice::FromIdAsync( + device_info.Id()) .get(); - auto bluetoothDeviceP = std::make_unique(bluetoothDevice); - discovered_devices_by_id_[deviceInfo.Id()] = std::move(bluetoothDeviceP); + std::string mac_address = + uint64_to_mac_address_string(native_bluetooth_device.BluetoothAddress()); - NEARBY_LOGS(INFO) << __func__ << ": Notifying bluetooth device added"; + // Create an iterator for the internal list + auto it = mac_address_to_bluetooth_device_map_.find(mac_address); + + // Add to our internal list if necessary + if (it != mac_address_to_bluetooth_device_map_.end()) { + // We're already tracking this one + LOG(WARNING) << __func__ << ": Bluetooth device " << mac_address + << " is alreay added."; + return winrt::fire_and_forget(); + } + + auto bluetooth_device = + std::make_unique(native_bluetooth_device); + + mac_address_to_bluetooth_device_map_[mac_address] = + std::move(bluetooth_device); + + LOG(INFO) << __func__ << ": Notifying bluetooth device " << mac_address + << " added"; if (discovery_callback_.device_discovered_cb != nullptr) { discovery_callback_.device_discovered_cb( - *discovered_devices_by_id_[deviceInfo.Id()]); + *mac_address_to_bluetooth_device_map_[mac_address]); } for (auto& observer : observers_.GetObservers()) { - observer->DeviceAdded(*discovered_devices_by_id_[deviceInfo.Id()]); + observer->DeviceAdded(*mac_address_to_bluetooth_device_map_[mac_address]); } return winrt::fire_and_forget(); } winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Updated( - DeviceWatcher sender, DeviceInformationUpdate deviceInfoUpdate) { - auto it = discovered_devices_by_id_.find(deviceInfoUpdate.Id()); + DeviceWatcher sender, DeviceInformationUpdate device_update_info) { + auto native_bluetooth_device = + ::winrt::Windows::Devices::Bluetooth::BluetoothDevice::FromIdAsync( + device_update_info.Id()) + .get(); + std::string mac_address = + uint64_to_mac_address_string(native_bluetooth_device.BluetoothAddress()); - if (it == discovered_devices_by_id_.end()) { - NEARBY_LOGS(WARNING) << __func__ << ": Bluetooth device " - << winrt::to_string(deviceInfoUpdate.Id()) - << " is not in list."; + auto it = mac_address_to_bluetooth_device_map_.find(mac_address); + + if (it == mac_address_to_bluetooth_device_map_.end()) { + LOG(WARNING) << __func__ << ": Bluetooth device " << mac_address + << " is not in list."; return winrt::fire_and_forget(); } - NEARBY_LOGS(INFO) - << "Device updated name: " - << discovered_devices_by_id_[deviceInfoUpdate.Id()]->GetName() << " (" - << winrt::to_string(deviceInfoUpdate.Id()) << ")"; + LOG(INFO) << "Device updated name: " + << mac_address_to_bluetooth_device_map_[mac_address]->GetName() + << " (" << mac_address << ")"; IMapView properties = - deviceInfoUpdate.Properties(); + device_update_info.Properties(); DumpDeviceInformation(properties); if (!IsWatcherStarted()) { @@ -652,17 +652,15 @@ winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Updated( properties.Lookup(L"System.ItemNameDisplay")); if (it->second->GetName() == new_device_name) { - NEARBY_LOGS(INFO) - << "Device name is same as old name, ignore the update."; + LOG(INFO) << "Device name is same as old name, ignore the update."; } else { it->second->SetName(new_device_name); - NEARBY_LOGS(INFO) - << "Updated device name:" - << discovered_devices_by_id_[deviceInfoUpdate.Id()]->GetName(); + LOG(INFO) << "Updated device name:" + << mac_address_to_bluetooth_device_map_[mac_address]->GetName(); discovery_callback_.device_name_changed_cb( - *discovered_devices_by_id_[deviceInfoUpdate.Id()]); + *mac_address_to_bluetooth_device_map_[mac_address]); } } @@ -670,12 +668,13 @@ winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Updated( if (properties.HasKey(L"System.Devices.Aep.IsPaired")) { bool new_paired_status = InspectableReader::ReadBoolean( properties.Lookup(L"System.Devices.Aep.IsPaired")); - NEARBY_LOGS(INFO) << __func__ - << ": Notifying device paired changed: " << std::boolalpha - << new_paired_status; + LOG(INFO) << __func__ + << ": Notifying device paired changed: " << std::boolalpha + << new_paired_status; for (auto& observer : observers_.GetObservers()) { observer->DevicePairedChanged( - *discovered_devices_by_id_[deviceInfoUpdate.Id()], new_paired_status); + *mac_address_to_bluetooth_device_map_[mac_address], + new_paired_status); } } @@ -683,35 +682,47 @@ winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Updated( } winrt::fire_and_forget BluetoothClassicMedium::DeviceWatcher_Removed( - DeviceWatcher sender, DeviceInformationUpdate deviceInfo) { - auto it = discovered_devices_by_id_.find(deviceInfo.Id()); + DeviceWatcher sender, DeviceInformationUpdate device_update_info) { + auto native_bluetooth_device = + ::winrt::Windows::Devices::Bluetooth::BluetoothDevice::FromIdAsync( + device_update_info.Id()) + .get(); - if (it == discovered_devices_by_id_.end()) { - NEARBY_LOGS(WARNING) << __func__ << ": Bluetooth device " - << winrt::to_string(deviceInfo.Id()) - << " is not in list."; + if (native_bluetooth_device == nullptr) { + LOG(WARNING) << __func__ << ": cannot get native bluetooth device."; return winrt::fire_and_forget(); } - NEARBY_LOGS(INFO) << "Device removed " - << discovered_devices_by_id_[deviceInfo.Id()]->GetName() - << " (" << winrt::to_string(deviceInfo.Id()) << ")"; + std::string mac_address = + uint64_to_mac_address_string(native_bluetooth_device.BluetoothAddress()); + auto it = mac_address_to_bluetooth_device_map_.find(mac_address); + + if (it == mac_address_to_bluetooth_device_map_.end()) { + LOG(WARNING) << __func__ << ": Bluetooth device " << mac_address + << " is not in list."; + return winrt::fire_and_forget(); + } + + LOG(INFO) << "Device removed " + << mac_address_to_bluetooth_device_map_[mac_address]->GetName() + << " (" << mac_address << ")"; if (!IsWatcherStarted()) { return winrt::fire_and_forget(); } - NEARBY_LOGS(INFO) << __func__ << ": Notifying bluetooth device removed"; + LOG(INFO) << __func__ << ": Notifying bluetooth device removed"; if (discovery_callback_.device_lost_cb != nullptr) { discovery_callback_.device_lost_cb( - *discovered_devices_by_id_[deviceInfo.Id()]); + *mac_address_to_bluetooth_device_map_[mac_address]); } for (auto& observer : observers_.GetObservers()) { - observer->DeviceRemoved(*discovered_devices_by_id_[deviceInfo.Id()]); + observer->DeviceRemoved(*mac_address_to_bluetooth_device_map_[mac_address]); } - discovered_devices_by_id_.erase(deviceInfo.Id()); + auto node = mac_address_to_bluetooth_device_map_.extract(mac_address); + removed_bluetooth_devices_map_[mac_address] = std::move(node.mapped()); return winrt::fire_and_forget(); } @@ -738,23 +749,23 @@ bool BluetoothClassicMedium::IsWatcherRunning() { } bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { - NEARBY_LOGS(INFO) << __func__ - << ": StartAdvertising is called with radio_discoverable: " - << radio_discoverable << "."; + LOG(INFO) << __func__ + << ": StartAdvertising is called with radio_discoverable: " + << radio_discoverable << "."; try { if (rfcomm_provider_ != nullptr && is_radio_discoverable_ == radio_discoverable) { - NEARBY_LOGS(WARNING) << __func__ - << ": Ignore StartAdvertising due to no change to " - "current advertising."; + LOG(WARNING) << __func__ + << ": Ignore StartAdvertising due to no change to " + "current advertising."; return true; } if (rfcomm_provider_ != nullptr && !StopAdvertising()) { - NEARBY_LOGS(WARNING) << __func__ - << ": Failed to StartAdvertising due to cannot stop " - "running advertising."; + LOG(WARNING) << __func__ + << ": Failed to StartAdvertising due to cannot stop " + "running advertising."; return false; } @@ -769,9 +780,8 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { raw_server_socket_ = server_socket_.get(); if (!server_socket_->listen()) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to StartAdvertising due to cannot start socket."; + LOG(ERROR) << __func__ + << ": Failed to StartAdvertising due to cannot start socket."; server_socket_->Close(); server_socket_ = nullptr; rfcomm_provider_ = nullptr; @@ -788,13 +798,13 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { radio_discoverable); is_radio_discoverable_ = radio_discoverable; - NEARBY_LOGS(INFO) << ": StartListening completed successfully."; + LOG(INFO) << ": StartListening completed successfully."; return true; } catch (std::exception exception) { // We will log and eat the exception since the caller // expects nullptr if it fails - NEARBY_LOGS(ERROR) << __func__ << ": Exception setting up for listen: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Exception setting up for listen: " << exception.what(); if (server_socket_ != nullptr) { server_socket_->Close(); @@ -807,9 +817,8 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": Exception setting up for listen: " << ex.code() - << ": " << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": Exception setting up for listen: " << ex.code() + << ": " << winrt::to_string(ex.message()); if (server_socket_ != nullptr) { server_socket_->Close(); server_socket_ = nullptr; @@ -821,7 +830,7 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; if (server_socket_ != nullptr) { server_socket_->Close(); server_socket_ = nullptr; @@ -836,12 +845,12 @@ bool BluetoothClassicMedium::StartAdvertising(bool radio_discoverable) { } bool BluetoothClassicMedium::StopAdvertising() { - NEARBY_LOGS(INFO) << __func__ << ": StopAdvertising is called"; + LOG(INFO) << __func__ << ": StopAdvertising is called"; try { if (rfcomm_provider_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Ignore StopAdvertising due to no advertising."; + LOG(ERROR) << __func__ + << ": Ignore StopAdvertising due to no advertising."; return true; } @@ -850,19 +859,18 @@ bool BluetoothClassicMedium::StopAdvertising() { raw_server_socket_ = nullptr; server_socket_ = nullptr; - NEARBY_LOGS(INFO) << ": StopAdvertising completed successfully."; + LOG(INFO) << ": StopAdvertising completed successfully."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": StopAdvertising exception: " << exception.what(); + LOG(ERROR) << __func__ + << ": StopAdvertising exception: " << exception.what(); return false; } catch (const winrt::hresult_error& ex) { - NEARBY_LOGS(ERROR) << __func__ - << ": StopAdvertising exception: " << ex.code() << ": " - << winrt::to_string(ex.message()); + LOG(ERROR) << __func__ << ": StopAdvertising exception: " << ex.code() + << ": " << winrt::to_string(ex.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } } @@ -870,26 +878,25 @@ bool BluetoothClassicMedium::StopAdvertising() { bool BluetoothClassicMedium::InitializeServiceSdpAttributes( RfcommServiceProvider rfcomm_provider, std::string service_name) { try { - auto sdpWriter = DataWriter(); + auto sdp_writer = DataWriter(); // Write the Service Name Attribute. - sdpWriter.WriteByte(Constants::SdpServiceNameAttributeType); + sdp_writer.WriteByte(Constants::SdpServiceNameAttributeType); // The length of the UTF-8 encoded Service Name SDP Attribute. - sdpWriter.WriteByte(service_name.size()); + sdp_writer.WriteByte(service_name.size()); // The UTF-8 encoded Service Name value. - sdpWriter.UnicodeEncoding(UnicodeEncoding::Utf8); - sdpWriter.WriteString(winrt::to_hstring(service_name)); + sdp_writer.UnicodeEncoding(UnicodeEncoding::Utf8); + sdp_writer.WriteString(winrt::to_hstring(service_name)); // Set the SDP Attribute on the RFCOMM Service Provider. rfcomm_provider.SdpRawAttributes().Insert( - Constants::SdpServiceNameAttributeId, sdpWriter.DetachBuffer()); + Constants::SdpServiceNameAttributeId, sdp_writer.DetachBuffer()); return true; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to InitializeServiceSdpAttributes."; + LOG(ERROR) << __func__ << ": Failed to InitializeServiceSdpAttributes."; return false; } } diff --git a/internal/platform/implementation/windows/bluetooth_classic_medium.h b/internal/platform/implementation/windows/bluetooth_classic_medium.h index 44f62d06..d90e071a 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_medium.h +++ b/internal/platform/implementation/windows/bluetooth_classic_medium.h @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,11 +15,15 @@ #ifndef PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_MEDIUM_H_ #define PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_MEDIUM_H_ +#include #include #include #include +#include "absl/container/flat_hash_map.h" #include "internal/base/observer_list.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/bluetooth_classic_device.h" @@ -32,76 +36,11 @@ namespace nearby { namespace windows { -// Represents a device. This class allows access to well-known device properties -// as well as additional properties specified during device enumeration. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceinformation?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceInformation; - -// Represents the kind of DeviceInformation object. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceinformationkind?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceInformationKind; - -// Contains updated properties for a DeviceInformation object. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceinformationupdate?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceInformationUpdate; - -// Enumerates devices dynamically, so that the app receives notifications if -// devices are added, removed, or changed after the initial enumeration is -// complete. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.devicewatcher?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceWatcher; - -// Writes data to an output stream. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.datawriter?view=winrt-20348 -using winrt::Windows::Storage::Streams::DataWriter; - -// Specifies the type of character encoding for a stream. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.unicodeencoding?view=winrt-20348 -using winrt::Windows::Storage::Streams::UnicodeEncoding; - -// Describes the state of a DeviceWatcher object. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.devicewatcherstatus?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceWatcherStatus; - -// Represents an instance of a service on a Bluetooth basic rate device. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommdeviceservice?view=winrt-20348 -using winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommDeviceService; - -// Indicates the status of the access to a device. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceaccessstatus?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceAccessStatus; - -// Contains the information about access to a device. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceaccessinformation?view=winrt-20348 -using winrt::Windows::Devices::Enumeration::DeviceAccessInformation; - -// Represents an RFCOMM service ID. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommserviceid?view=winrt-20348 -using winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceId; - -// Represents an instance of a local RFCOMM service. -// https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.rfcomm.rfcommserviceprovider?view=winrt-20348 -using winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceProvider; - -// Reads data from an input stream. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.datareader?view=winrt-20348 -using winrt::Windows::Storage::Streams::DataReader; - -// Writes data to an output stream. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.datawriter?view=winrt-20348 -using winrt::Windows::Storage::Streams::DataWriter; - -// Bluetooth protocol ID = \"{e0cbf06c-cd8b-4647-bb8a-263b43f0f974}\" -// https://docs.microsoft.com/en-us/windows/uwp/devices-sensors/aep-service-class-ids -#define BLUETOOTH_SELECTOR \ - L"System.Devices.Aep.ProtocolId:=\"{e0cbf06c-cd8b-4647-bb8a-263b43f0f974}\"" - // Container of operations that can be performed over the Bluetooth Classic // medium. class BluetoothClassicMedium : public api::BluetoothClassicMedium { public: - explicit BluetoothClassicMedium(api::BluetoothAdapter& bluetoothAdapter); - + explicit BluetoothClassicMedium(api::BluetoothAdapter& bluetooth_adapter); ~BluetoothClassicMedium() override; // https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#startDiscovery() @@ -166,56 +105,67 @@ class BluetoothClassicMedium : public api::BluetoothClassicMedium { bool StopScanning(); bool StartAdvertising(bool radio_discoverable); bool StopAdvertising(); - bool InitializeServiceSdpAttributes(RfcommServiceProvider rfcomm_provider, - std::string service_name); + bool InitializeServiceSdpAttributes( + ::winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceProvider + rfcomm_provider, + std::string service_name); bool IsWatcherStarted(); bool IsWatcherRunning(); void InitializeDeviceWatcher(); - void OnScanModeChanged(BluetoothAdapter::ScanMode scanMode); + void OnScanModeChanged(BluetoothAdapter::ScanMode scan_mode); // This is for a coroutine whose return type is winrt::fire_and_forget, which // handles async operations which don't have any dependencies. // https://docs.microsoft.com/en-us/uwp/cpp-ref-for-winrt/fire-and-forget - winrt::fire_and_forget DeviceWatcher_Added(DeviceWatcher sender, - DeviceInformation deviceInfo); + winrt::fire_and_forget DeviceWatcher_Added( + ::winrt::Windows::Devices::Enumeration::DeviceWatcher sender, + ::winrt::Windows::Devices::Enumeration::DeviceInformation device_info); winrt::fire_and_forget DeviceWatcher_Updated( - DeviceWatcher sender, DeviceInformationUpdate deviceInfo); + ::winrt::Windows::Devices::Enumeration::DeviceWatcher sender, + ::winrt::Windows::Devices::Enumeration::DeviceInformationUpdate + device_update_info); winrt::fire_and_forget DeviceWatcher_Removed( - DeviceWatcher sender, DeviceInformationUpdate deviceInfo); + ::winrt::Windows::Devices::Enumeration::DeviceWatcher sender, + ::winrt::Windows::Devices::Enumeration::DeviceInformationUpdate + device_update_info); // Check to make sure we can connect if we try - bool HaveAccess(winrt::hstring deviceId); + bool HaveAccess(::winrt::hstring device_id); // Get the service requested RfcommDeviceService GetRequestedService(BluetoothDevice* device, - winrt::guid service); + ::winrt::guid service); // Check to see that the device actually handles the requested service - bool CheckSdp(RfcommDeviceService requestedService); + bool CheckSdp(RfcommDeviceService requested_service); BluetoothClassicMedium::DiscoveryCallback discovery_callback_; - DeviceWatcher device_watcher_ = nullptr; + ::winrt::Windows::Devices::Enumeration::DeviceWatcher device_watcher_ = + nullptr; std::unique_ptr bluetooth_socket_; std::string service_name_; std::string service_uuid_; - // hstring is the only type of string winrt understands. - // https://docs.microsoft.com/en-us/uwp/cpp-ref-for-winrt/hstring - std::map> - discovered_devices_by_id_; + // Map MAC address to bluetooth device. + absl::flat_hash_map> + mac_address_to_bluetooth_device_map_; + + // Track removed devices. + absl::flat_hash_map> + removed_bluetooth_devices_map_; BluetoothAdapter& bluetooth_adapter_; BluetoothAdapter::ScanMode scan_mode_ = BluetoothAdapter::ScanMode::kUnknown; - std::unique_ptr remote_device_to_connect_; // Used for advertising. - RfcommServiceProvider rfcomm_provider_ = nullptr; + ::winrt::Windows::Devices::Bluetooth::Rfcomm::RfcommServiceProvider + rfcomm_provider_ = nullptr; std::unique_ptr server_socket_ = nullptr; BluetoothServerSocket* raw_server_socket_ = nullptr; bool is_radio_discoverable_ = false; diff --git a/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc b/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc index 4d82cc4d..09c7eab4 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_server_socket.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,12 +20,24 @@ #include #include +#include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" #include "internal/platform/exception.h" +#include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/implementation/windows/bluetooth_classic_socket.h" #include "internal/platform/logging.h" namespace nearby { namespace windows { +namespace { +using ::winrt::Windows::Networking::Sockets::SocketProtectionLevel; +using ::winrt::Windows::Networking::Sockets::SocketQualityOfService; +using ::winrt::Windows::Networking::Sockets::StreamSocket; +using ::winrt::Windows::Networking::Sockets::StreamSocketListener; +using ::winrt::Windows::Networking::Sockets:: + StreamSocketListenerConnectionReceivedEventArgs; +} // namespace BluetoothServerSocket::BluetoothServerSocket(absl::string_view service_name) : service_name_(service_name) {} @@ -40,7 +52,7 @@ BluetoothServerSocket::~BluetoothServerSocket() { Close(); } // Once error is reported, it is permanent, and ServerSocket has to be closed. std::unique_ptr BluetoothServerSocket::Accept() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Accept is called."; + LOG(INFO) << __func__ << ": Accept is called."; while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); @@ -50,7 +62,7 @@ std::unique_ptr BluetoothServerSocket::Accept() { StreamSocket bluetooth_socket = pending_sockets_.front(); pending_sockets_.pop_front(); - NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection."; + LOG(INFO) << __func__ << ": Accepted a remote connection."; return std::make_unique(bluetooth_socket); } @@ -63,7 +75,7 @@ void BluetoothServerSocket::SetCloseNotifier( Exception BluetoothServerSocket::Close() { try { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Close is called."; + LOG(INFO) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -87,23 +99,23 @@ Exception BluetoothServerSocket::Close() { close_notifier_(); } - NEARBY_LOGS(INFO) << __func__ << ": Close completed succesfully."; + LOG(INFO) << __func__ << ": Close completed succesfully."; return {Exception::kSuccess}; } catch (std::exception exception) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -129,12 +141,12 @@ bool BluetoothServerSocket::listen() { return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; @@ -144,7 +156,7 @@ bool BluetoothServerSocket::listen() { StreamSocketListener listener, StreamSocketListenerConnectionReceivedEventArgs const& args) { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Received connection."; + LOG(INFO) << __func__ << ": Received connection."; if (closed_) { return ::winrt::fire_and_forget{}; diff --git a/internal/platform/implementation/windows/bluetooth_classic_server_socket.h b/internal/platform/implementation/windows/bluetooth_classic_server_socket.h index ea34de39..2e3f2baf 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_server_socket.h +++ b/internal/platform/implementation/windows/bluetooth_classic_server_socket.h @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/implementation/windows/bluetooth_classic_socket.h" #include "internal/platform/implementation/windows/generated/winrt/base.h" @@ -30,28 +31,9 @@ namespace nearby { namespace windows { -// Supports listening for an incoming network connection using Bluetooth RFCOMM. -// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocketlistener?view=winrt-20348 -using winrt::Windows::Networking::Sockets::StreamSocketListener; - -// Provides data for a ConnectionReceived event on a StreamSocketListener -// object. -// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocketlistenerconnectionreceivedeventargs?view=winrt-20348 -using winrt::Windows::Networking::Sockets:: - StreamSocketListenerConnectionReceivedEventArgs; - -// Specifies the quality of service for a StreamSocket object. -// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.socketqualityofservice?view=winrt-20348 -using winrt::Windows::Networking::Sockets::SocketQualityOfService; - -// Specifies the level of encryption to use on a StreamSocket object. -// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.socketprotectionlevel?view=winrt-22000 -using winrt::Windows::Networking::Sockets::SocketProtectionLevel; - -// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html. class BluetoothServerSocket : public api::BluetoothServerSocket { public: - BluetoothServerSocket(absl::string_view service_name); + explicit BluetoothServerSocket(absl::string_view service_name); ~BluetoothServerSocket() override; @@ -77,24 +59,28 @@ class BluetoothServerSocket : public api::BluetoothServerSocket { bool listen(); - const StreamSocketListener& stream_socket_listener() const { + const ::winrt::Windows::Networking::Sockets::StreamSocketListener& + stream_socket_listener() const { return stream_socket_listener_; } private: // The listener is accepting incoming connections ::winrt::fire_and_forget Listener_ConnectionReceived( - StreamSocketListener listener, - StreamSocketListenerConnectionReceivedEventArgs const& args); + ::winrt::Windows::Networking::Sockets::StreamSocketListener listener, + ::winrt::Windows::Networking::Sockets:: + StreamSocketListenerConnectionReceivedEventArgs const& args); // Retrieves IP addresses from local machine std::vector GetIpAddresses() const; mutable absl::Mutex mutex_; absl::CondVar cond_; - std::deque pending_sockets_ ABSL_GUARDED_BY(mutex_); - StreamSocketListener stream_socket_listener_{nullptr}; - winrt::event_token listener_event_token_{}; + std::deque<::winrt::Windows::Networking::Sockets::StreamSocket> + pending_sockets_ ABSL_GUARDED_BY(mutex_); + ::winrt::Windows::Networking::Sockets::StreamSocketListener + stream_socket_listener_{nullptr}; + ::winrt::event_token listener_event_token_{}; // Close notifier absl::AnyInvocable close_notifier_ = nullptr; diff --git a/internal/platform/implementation/windows/bluetooth_classic_socket.cc b/internal/platform/implementation/windows/bluetooth_classic_socket.cc index 5eedb94b..b2a41bb5 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_socket.cc +++ b/internal/platform/implementation/windows/bluetooth_classic_socket.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ #include "internal/platform/implementation/windows/bluetooth_classic_socket.h" +#include #include #include #include @@ -21,32 +22,46 @@ #include "absl/time/clock.h" #include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" +#include "internal/platform/implementation/bluetooth_classic.h" +#include "internal/platform/implementation/windows/bluetooth_classic_device.h" +#include "internal/platform/implementation/windows/generated/winrt/Windows.Devices.Bluetooth.h" +#include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Sockets.h" +#include "internal/platform/implementation/windows/generated/winrt/base.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" -#include "winrt/Windows.Devices.Bluetooth.h" -#include "winrt/Windows.Networking.Sockets.h" -#include "winrt/base.h" +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { namespace { using ::winrt::Windows::Devices::Bluetooth::BluetoothConnectionStatus; +using ::winrt::Windows::Networking::HostName; +using ::winrt::Windows::Networking::Sockets::StreamSocket; +using ::winrt::Windows::Storage::Streams::Buffer; +using ::winrt::Windows::Storage::Streams::IInputStream; +using ::winrt::Windows::Storage::Streams::InputStreamOptions; +using ::winrt::Windows::Storage::Streams::IOutputStream; + constexpr int kMaxConnectRetryCount = 3; constexpr absl::Duration kConnectInterval = absl::Seconds(3); } // namespace -BluetoothSocket::BluetoothSocket(StreamSocket streamSocket) - : windows_socket_(streamSocket) { - NEARBY_LOGS(INFO) << __func__ << ": Initialize bluetooth socket."; +BluetoothSocket::BluetoothSocket(StreamSocket stream_socket) + : windows_socket_(stream_socket) { + LOG(INFO) << __func__ << ": Initialize bluetooth socket."; native_bluetooth_device_ = - winrt::Windows::Devices::Bluetooth::BluetoothDevice::FromHostNameAsync( + ::winrt::Windows::Devices::Bluetooth::BluetoothDevice::FromHostNameAsync( windows_socket_.Information().RemoteHostName()) .get(); if (FeatureFlags::GetInstance() .GetFlags() .enable_bluetooth_connection_status_track) { - NEARBY_LOGS(INFO) - << "Flag enable_bluetooth_connection_status_track is enabled."; + LOG(INFO) << "Flag enable_bluetooth_connection_status_track is enabled."; connection_status_changed_token_ = native_bluetooth_device_.ConnectionStatusChanged( {this, &BluetoothSocket::Listener_ConnectionStatusChanged}); @@ -78,7 +93,7 @@ OutputStream& BluetoothSocket::GetOutputStream() { return output_stream_; } // After this call object should be treated as not connected. // Returns Exception::kIo on error, Exception::kSuccess otherwise. Exception BluetoothSocket::Close() { - NEARBY_LOGS(INFO) << __func__ << ": Close bluetooth socket."; + LOG(INFO) << __func__ << ": Close bluetooth socket."; // The Close method aborts any pending operations and releases all unmanaged // resources associated with the StreamSocket object, including the Input and @@ -103,14 +118,14 @@ Exception BluetoothSocket::Close() { is_bluetooth_socket_closed_ = true; return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -125,26 +140,37 @@ api::BluetoothDevice* BluetoothSocket::GetRemoteDevice() { // Starts an asynchronous operation on a StreamSocket object to connect to a // remote network destination specified by a remote hostname and a remote // service name. -bool BluetoothSocket::Connect(HostName connectionHostName, - winrt::hstring connectionServiceName) { - NEARBY_LOGS(INFO) << __func__ << ": start to connect to bluetooth service:" - << winrt::to_string(connectionServiceName); +bool BluetoothSocket::Connect(HostName connection_host_name, + ::winrt::hstring connection_service_name) { + LOG(INFO) << __func__ << ": start to connect to bluetooth service:" + << winrt::to_string(connection_service_name); - connect_called_count_ = 0; - while (connect_called_count_ < kMaxConnectRetryCount) { - connect_called_count_ += 1; + if (nearby::NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableNewBluetoothRefactor)) { bool connect_result = - InternalConnect(connectionHostName, connectionServiceName); + InternalConnect(connection_host_name, connection_service_name); if (connect_result) { return connect_result; } + } else { + int connect_called_count = 0; + while (connect_called_count < kMaxConnectRetryCount) { + connect_called_count += 1; + bool connect_result = + InternalConnect(connection_host_name, connection_service_name); + if (connect_result) { + return connect_result; + } - NEARBY_LOGS(WARNING) << __func__ << ": Failed to connect bluetooth at the " - << connect_called_count_ << "th call."; + LOG(WARNING) << __func__ << ": Failed to connect bluetooth at the " + << connect_called_count << "th call."; - absl::SleepFor(kConnectInterval); + absl::SleepFor(kConnectInterval); + } } + LOG(WARNING) << __func__ << ": Failed to connect bluetooth"; return false; } @@ -157,14 +183,13 @@ ExceptionOr BluetoothSocket::BluetoothInputStream::Read( std::int64_t size) { try { if (size <= 0) { - NEARBY_LOGS(ERROR) << __func__ - << ": Invalid transmit packet size: " << size; + LOG(ERROR) << __func__ << ": Invalid transmit packet size: " << size; return {Exception::kIo}; } if (size > read_buffer_.Capacity()) { - NEARBY_LOGS(WARNING) << __func__ - << ": resize receive buffer to packet size: " << size; + LOG(WARNING) << __func__ + << ": resize receive buffer to packet size: " << size; read_buffer_ = Buffer(size); } @@ -176,27 +201,27 @@ ExceptionOr BluetoothSocket::BluetoothInputStream::Read( .get(); if (ibuffer.Length() != size) { - NEARBY_LOGS(WARNING) << __func__ << ": Got " << ibuffer.Length() - << " bytes of total " << size << " bytes."; + LOG(WARNING) << __func__ << ": Got " << ibuffer.Length() + << " bytes of total " << size << " bytes."; } ByteArray data((char*)ibuffer.data(), ibuffer.Length()); return ExceptionOr(data); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } Exception BluetoothSocket::BluetoothInputStream::Close() { - NEARBY_LOGS(INFO) << __func__ << ": Close bluetooth input stream."; + LOG(INFO) << __func__ << ": Close bluetooth input stream."; try { if (winrt_input_stream_ != nullptr) { @@ -204,14 +229,14 @@ Exception BluetoothSocket::BluetoothInputStream::Close() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -224,9 +249,8 @@ BluetoothSocket::BluetoothOutputStream::BluetoothOutputStream( Exception BluetoothSocket::BluetoothOutputStream::Write(const ByteArray& data) { try { if (data.size() > write_buffer_.Capacity()) { - NEARBY_LOGS(WARNING) << __func__ - << ": resize write buffer to packet size: " - << data.size(); + LOG(WARNING) << __func__ + << ": resize write buffer to packet size: " << data.size(); write_buffer_ = Buffer(data.size()); } @@ -237,14 +261,14 @@ Exception BluetoothSocket::BluetoothOutputStream::Write(const ByteArray& data) { winrt_output_stream_.WriteAsync(write_buffer_).get(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -258,59 +282,56 @@ Exception BluetoothSocket::BluetoothOutputStream::Flush() { winrt_output_stream_.FlushAsync().get(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } Exception BluetoothSocket::BluetoothOutputStream::Close() { - NEARBY_LOGS(INFO) << __func__ << ": Close bluetooth output stream."; + LOG(INFO) << __func__ << ": Close bluetooth output stream."; try { if (winrt_output_stream_ != nullptr) { winrt_output_stream_.Close(); } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } -bool BluetoothSocket::InternalConnect(HostName connectionHostName, - winrt::hstring connectionServiceName) { +bool BluetoothSocket::InternalConnect(HostName connection_host_name, + winrt::hstring connection_service_name) { try { - if (connectionHostName == nullptr || connectionServiceName.empty()) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Bluetooth socket connection failed. Attempting to " - "connect to empty HostName/MAC address or ServiceName."; + if (connection_host_name == nullptr || connection_service_name.empty()) { + LOG(ERROR) << __func__ + << ": Bluetooth socket connection failed. Attempting to " + "connect to empty HostName/MAC address or ServiceName."; return false; } - NEARBY_LOGS(INFO) << __func__ - << ": Bluetooth socket connection to host name:" - << winrt::to_string(connectionHostName.DisplayName()) - << ", service name:" - << winrt::to_string(connectionServiceName); + LOG(INFO) << __func__ << ": Bluetooth socket connection to host name:" + << winrt::to_string(connection_host_name.DisplayName()) + << ", service name:" << winrt::to_string(connection_service_name); windows_socket_ = winrt::Windows::Networking::Sockets::StreamSocket(); // https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocket.connectasync?view=winrt-20348 - windows_socket_.ConnectAsync(connectionHostName, connectionServiceName) + windows_socket_.ConnectAsync(connection_host_name, connection_service_name) .get(); auto info = windows_socket_.Information(); @@ -324,8 +345,7 @@ bool BluetoothSocket::InternalConnect(HostName connectionHostName, if (FeatureFlags::GetInstance() .GetFlags() .enable_bluetooth_connection_status_track) { - NEARBY_LOGS(INFO) - << "Flag enable_bluetooth_connection_status_track is enabled."; + LOG(INFO) << "Flag enable_bluetooth_connection_status_track is enabled."; connection_status_changed_token_ = native_bluetooth_device_.ConnectionStatusChanged( {this, &BluetoothSocket::Listener_ConnectionStatusChanged}); @@ -337,19 +357,18 @@ bool BluetoothSocket::InternalConnect(HostName connectionHostName, input_stream_ = BluetoothInputStream(windows_socket_.InputStream()); output_stream_ = BluetoothOutputStream(windows_socket_.OutputStream()); - NEARBY_LOGS(INFO) << __func__ - << ": Bluetooth socket successfully connected to " - << bluetooth_device_->GetName(); + LOG(INFO) << __func__ << ": Bluetooth socket successfully connected to " + << bluetooth_device_->GetName(); return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return false; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return false; } } @@ -362,12 +381,10 @@ winrt::fire_and_forget BluetoothSocket::Listener_ConnectionStatusChanged( // Based on the test, the args are empty, so cannot provide more information // on the status change. BluetoothConnectionStatus connection_status = device.ConnectionStatus(); - NEARBY_LOGS(WARNING) << __func__ - << ": Bluetooth connection status changed to:" - << ((connection_status == - BluetoothConnectionStatus::Connected) - ? "Connected" - : "Disconnected"); + LOG(WARNING) << __func__ << ": Bluetooth connection status changed to:" + << ((connection_status == BluetoothConnectionStatus::Connected) + ? "Connected" + : "Disconnected"); return {}; } diff --git a/internal/platform/implementation/windows/bluetooth_classic_socket.h b/internal/platform/implementation/windows/bluetooth_classic_socket.h index 19e2de3b..026d162f 100644 --- a/internal/platform/implementation/windows/bluetooth_classic_socket.h +++ b/internal/platform/implementation/windows/bluetooth_classic_socket.h @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,60 +15,29 @@ #ifndef PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_SOCKET_H_ #define PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_SOCKET_H_ +#include + +#include #include +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/bluetooth_classic.h" #include "internal/platform/implementation/windows/bluetooth_classic_device.h" -#include "winrt/Windows.Foundation.h" -#include "winrt/Windows.Networking.Sockets.h" -#include "winrt/Windows.Storage.Streams.h" +#include "internal/platform/implementation/windows/generated/winrt/Windows.Foundation.h" +#include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Sockets.h" +#include "internal/platform/implementation/windows/generated/winrt/Windows.Storage.Streams.h" +#include "internal/platform/input_stream.h" +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { -// Provides data for a hostname or an IP address. -// https://docs.microsoft.com/en-us/uwp/api/windows.networking.hostname?view=winrt-20348 -using winrt::Windows::Networking::HostName; - -// Supports network communication using a stream socket over Bluetooth RFCOMM. -// https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamsocket?view=winrt-20348 -using winrt::Windows::Networking::Sockets::IStreamSocket; -using winrt::Windows::Networking::Sockets::StreamSocket; - -// Provides a default implementation of the IBuffer interface and its related -// interfaces. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.buffer?view=winrt-20348 -using winrt::Windows::Storage::Streams::Buffer; - -// Represents a sequential stream of bytes to be read. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.iinputstream?view=winrt-20348 -using winrt::Windows::Storage::Streams::IInputStream; - -// Represents a sequential stream of bytes to be written. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.ioutputstream?view=winrt-20348 -using winrt::Windows::Storage::Streams::IOutputStream; - -// Specifies the read options for an input stream. -// This enumeration has a FlagsAttribute attribute that allows a bitwise -// combination of its member values. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.inputstreamoptions?view=winrt-20348 -using winrt::Windows::Storage::Streams::InputStreamOptions; - -// Reads data from an input stream. -// https://docs.microsoft.com/en-us/uwp/api/windows.storage.streams.datareader?view=winrt-20348 -using winrt::Windows::Storage::Streams::DataReader; - -// Represents an asynchronous action. -// https://docs.microsoft.com/en-us/uwp/api/windows.foundation.iasyncaction?view=winrt-20348 -using winrt::Windows::Foundation::IAsyncAction; - -// https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html. class BluetoothSocket : public api::BluetoothSocket { public: BluetoothSocket(); - - explicit BluetoothSocket(StreamSocket streamSocket); - + explicit BluetoothSocket( + ::winrt::Windows::Networking::Sockets::StreamSocket stream_socket); ~BluetoothSocket() override; // NOTE: @@ -95,28 +64,32 @@ class BluetoothSocket : public api::BluetoothSocket { // Connect asynchronously to the target remote device // Returns true if successful, false otherwise - bool Connect(HostName connectionHostName, - winrt::hstring connectionServiceName); + bool Connect(::winrt::Windows::Networking::HostName connection_host_name, + ::winrt::hstring connection_service_name); private: static constexpr int kInitialTransmitPacketSize = 4096; class BluetoothInputStream : public InputStream { public: - explicit BluetoothInputStream(IInputStream stream); + explicit BluetoothInputStream( + ::winrt::Windows::Storage::Streams::IInputStream stream); ~BluetoothInputStream() override = default; ExceptionOr Read(std::int64_t size) override; Exception Close() override; private: - IInputStream winrt_input_stream_{nullptr}; - Buffer read_buffer_{kInitialTransmitPacketSize}; + ::winrt::Windows::Storage::Streams::IInputStream winrt_input_stream_{ + nullptr}; + ::winrt::Windows::Storage::Streams::Buffer read_buffer_{ + kInitialTransmitPacketSize}; }; class BluetoothOutputStream : public OutputStream { public: - explicit BluetoothOutputStream(IOutputStream stream); + explicit BluetoothOutputStream( + ::winrt::Windows::Storage::Streams::IOutputStream stream); ~BluetoothOutputStream() override = default; Exception Write(const ByteArray& data) override; @@ -125,26 +98,28 @@ class BluetoothSocket : public api::BluetoothSocket { Exception Close() override; private: - IOutputStream winrt_output_stream_{nullptr}; - Buffer write_buffer_{kInitialTransmitPacketSize}; + ::winrt::Windows::Storage::Streams::IOutputStream winrt_output_stream_{ + nullptr}; + ::winrt::Windows::Storage::Streams::Buffer write_buffer_{ + kInitialTransmitPacketSize}; }; - bool InternalConnect(HostName connectionHostName, - winrt::hstring connectionServiceName); + bool InternalConnect( + ::winrt::Windows::Networking::HostName connection_host_name, + ::winrt::hstring connection_service_name); - winrt::fire_and_forget Listener_ConnectionStatusChanged( - winrt::Windows::Devices::Bluetooth::BluetoothDevice device, - winrt::Windows::Foundation::IInspectable const& args); + ::winrt::fire_and_forget Listener_ConnectionStatusChanged( + ::winrt::Windows::Devices::Bluetooth::BluetoothDevice device, + ::winrt::Windows::Foundation::IInspectable const& args); - StreamSocket windows_socket_{nullptr}; + ::winrt::Windows::Networking::Sockets::StreamSocket windows_socket_{nullptr}; bool is_bluetooth_socket_closed_ = false; BluetoothInputStream input_stream_{nullptr}; BluetoothOutputStream output_stream_{nullptr}; std::unique_ptr bluetooth_device_ = nullptr; - winrt::Windows::Devices::Bluetooth::BluetoothDevice native_bluetooth_device_{ - nullptr}; - winrt::event_token connection_status_changed_token_{}; - int connect_called_count_ = 0; + ::winrt::Windows::Devices::Bluetooth::BluetoothDevice + native_bluetooth_device_{nullptr}; + ::winrt::event_token connection_status_changed_token_{}; }; } // namespace windows diff --git a/internal/platform/implementation/windows/bluetooth_pairing.cc b/internal/platform/implementation/windows/bluetooth_pairing.cc index c511439f..3ecb2c2a 100644 --- a/internal/platform/implementation/windows/bluetooth_pairing.cc +++ b/internal/platform/implementation/windows/bluetooth_pairing.cc @@ -21,7 +21,6 @@ #include #include -#include "absl/log/check.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" #include "internal/platform/implementation/bluetooth_classic.h" @@ -54,8 +53,7 @@ BluetoothPairing::BluetoothPairing( BluetoothDevice bluetooth_device, DeviceInformationCustomPairing custom_pairing) : bluetooth_device_(bluetooth_device), custom_pairing_(custom_pairing) { - NEARBY_LOGS(VERBOSE) << __func__ - << ": BluetoothPairing is created for device."; + VLOG(1) << __func__ << ": BluetoothPairing is created for device."; } BluetoothPairing::~BluetoothPairing() { @@ -64,19 +62,17 @@ BluetoothPairing::~BluetoothPairing() { std::exchange(pairing_requested_token_, {})); } CancelPairing(); - NEARBY_LOGS(VERBOSE) << __func__ - << ": BluetoothPairing is destroyed for device."; + VLOG(1) << __func__ << ": BluetoothPairing is destroyed for device."; } bool BluetoothPairing::InitiatePairing( api::BluetoothPairingCallback pairing_cb) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start to initiate pairing process."; + VLOG(1) << __func__ << ": Start to initiate pairing process."; try { pairing_requested_token_ = custom_pairing_.PairingRequested( {this, &BluetoothPairing::OnPairingRequested}); if (!pairing_requested_token_) { - NEARBY_LOGS(VERBOSE) << __func__ - << " Failed to registered pairing callback."; + VLOG(1) << __func__ << " Failed to registered pairing callback."; return false; } pairing_callback_ = std::move(pairing_cb); @@ -91,35 +87,32 @@ bool BluetoothPairing::InitiatePairing( OnPair(pairing_result); return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to initiate pairing. exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Failed to initiate pairing. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to initiate pairing. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Failed to initiate pairing. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } bool BluetoothPairing::FinishPairing( std::optional pin_code) { - NEARBY_LOGS(VERBOSE) << __func__ << "Start to finish pairing."; + VLOG(1) << __func__ << "Start to finish pairing."; try { if (!pairing_requested_) { - NEARBY_LOGS(VERBOSE) << __func__ << "No pairing requested."; + VLOG(1) << __func__ << "No pairing requested."; return false; } if (!pairing_deferral_) { - NEARBY_LOGS(VERBOSE) << __func__ << "No ongoing pairing process."; + VLOG(1) << __func__ << "No ongoing pairing process."; return false; } if (expecting_pin_code_) { if (!pin_code.has_value()) { - NEARBY_LOGS(INFO) << __func__ << " Failed to get pin code"; + LOG(INFO) << __func__ << " Failed to get pin code"; return false; } expecting_pin_code_ = false; @@ -129,28 +122,25 @@ bool BluetoothPairing::FinishPairing( pairing_requested_.Accept(); } pairing_deferral_.Complete(); - NEARBY_LOGS(VERBOSE) << "Successfully finished pairing."; + VLOG(1) << "Successfully finished pairing."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to finish pairing. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to finish pairing. exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to finish pairing. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Failed to finish pairing. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } bool BluetoothPairing::CancelPairing() { - NEARBY_LOGS(VERBOSE) << __func__ - << " Start to cancel ongoing pairing process."; + VLOG(1) << __func__ << " Start to cancel ongoing pairing process."; try { if (!pairing_deferral_) { - NEARBY_LOGS(VERBOSE) << __func__ << "No ongoing pairing process."; + VLOG(1) << __func__ << "No ongoing pairing process."; return true; } // There is no way to explicitly cancel an in-progress pairing on Windows as @@ -161,48 +151,44 @@ bool BluetoothPairing::CancelPairing() { // deferral is completed, will know that cancellation was the actual result. was_cancelled_ = true; pairing_deferral_.Close(); - NEARBY_LOGS(VERBOSE) << __func__ << "Canceled ongoing pairing process."; + VLOG(1) << __func__ << "Canceled ongoing pairing process."; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to cancel ongoing pairing " - << "process. exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Failed to cancel ongoing pairing " + << "process. exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to cancel ongoing pairing process. " - << "WinRT exception: " << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Failed to cancel ongoing pairing process. " + << "WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } bool BluetoothPairing::Unpair() { - NEARBY_LOGS(VERBOSE) << __func__ << ": Start to unpair with remote device."; + VLOG(1) << __func__ << ": Start to unpair with remote device."; try { if (!IsPaired()) { - NEARBY_LOGS(VERBOSE) << __func__ << " : Remote device Was not paired."; + VLOG(1) << __func__ << " : Remote device Was not paired."; return true; } DeviceUnpairingResult unpairing_result = bluetooth_device_.DeviceInformation().Pairing().UnpairAsync().get(); if (unpairing_result.Status() == DeviceUnpairingResultStatus::Unpaired) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Unpaired with remote device."; + VLOG(1) << __func__ << ": Unpaired with remote device."; return true; } - NEARBY_LOGS(VERBOSE) << __func__ - << ": Failed to unpaired with remote device."; + VLOG(1) << __func__ << ": Failed to unpaired with remote device."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to unpaired with device. exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Failed to unpaired with device. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to unpaired with device. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to unpaired with device. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } @@ -210,18 +196,17 @@ bool BluetoothPairing::Unpair() { bool BluetoothPairing::IsPaired() { try { bool is_paired = bluetooth_device_.DeviceInformation().Pairing().IsPaired(); - NEARBY_LOGS(INFO) << __func__ << (is_paired ? " True" : " False"); + LOG(INFO) << __func__ << (is_paired ? " True" : " False"); return is_paired; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get IsPaired. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to get IsPaired. exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get IsPaired. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to get IsPaired. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } @@ -229,7 +214,7 @@ bool BluetoothPairing::IsPaired() { void BluetoothPairing::OnPairingRequested( DeviceInformationCustomPairing custom_pairing, DevicePairingRequestedEventArgs pairing_requested) { - NEARBY_LOGS(VERBOSE) << __func__ << "Requested to pair."; + VLOG(1) << __func__ << "Requested to pair."; try { DevicePairingKinds pairing_kind = pairing_requested.PairingKind(); pairing_requested_ = pairing_requested; @@ -237,40 +222,38 @@ void BluetoothPairing::OnPairingRequested( api::PairingParams params; switch (pairing_kind) { case DevicePairingKinds::ProvidePin: - NEARBY_LOGS(INFO) << __func__ << "DevicePairingKind: RequestPinCode."; + LOG(INFO) << __func__ << "DevicePairingKind: RequestPinCode."; expecting_pin_code_ = true; params.pairing_type = PairingType::kRequestPin; pairing_callback_.on_pairing_initiated_cb(params); return; case DevicePairingKinds::ConfirmOnly: - NEARBY_LOGS(INFO) << __func__ << "DevicePairingKind: ConfirmOnly."; + LOG(INFO) << __func__ << "DevicePairingKind: ConfirmOnly."; params.pairing_type = PairingType::kConsent; pairing_callback_.on_pairing_initiated_cb(params); return; case DevicePairingKinds::ConfirmPinMatch: - NEARBY_LOGS(INFO) << __func__ - << "DevicePairingKind: Confirm Pin Match."; + LOG(INFO) << __func__ << "DevicePairingKind: Confirm Pin Match."; params.pairing_type = PairingType::kConfirmPasskey; params.passkey = winrt::to_string(pairing_requested.Pin()); pairing_callback_.on_pairing_initiated_cb(params); return; default: params.pairing_type = PairingType::kUnknown; - NEARBY_LOGS(INFO) << __func__ << "Unsupported DevicePairingKind:" - << static_cast(pairing_kind); + LOG(INFO) << __func__ << "Unsupported DevicePairingKind:" + << static_cast(pairing_kind); break; } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to request to pair with device. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to request to pair with device. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Failed to request to pair with device. WinRT exception: " - << error.code() << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Failed to request to pair with device. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } pairing_callback_.on_pairing_error_cb(PairingError::kFailed); } @@ -278,8 +261,8 @@ void BluetoothPairing::OnPairingRequested( void BluetoothPairing::OnPair(DevicePairingResult& pairing_result) { try { DevicePairingResultStatus status = pairing_result.Status(); - NEARBY_LOGS(INFO) << __func__ - << "Pairing Result Status: " << static_cast(status); + LOG(INFO) << __func__ + << "Pairing Result Status: " << static_cast(status); if (was_cancelled_ && status == DevicePairingResultStatus::RejectedByHandler) { // See comment in CancelPairing() for explanation of why was_cancelled_ @@ -289,53 +272,52 @@ void BluetoothPairing::OnPair(DevicePairingResult& pairing_result) { switch (status) { case DevicePairingResultStatus::AlreadyPaired: case DevicePairingResultStatus::Paired: - NEARBY_LOGS(ERROR) << __func__ << "Pairing Result Status: Paired."; + LOG(ERROR) << __func__ << "Pairing Result Status: Paired."; pairing_callback_.on_paired_cb(); return; case DevicePairingResultStatus::PairingCanceled: - NEARBY_LOGS(ERROR) << __func__ - << "Pairing Result Status: Pairing Canceled."; + LOG(ERROR) << __func__ << "Pairing Result Status: Pairing Canceled."; pairing_callback_.on_pairing_error_cb(PairingError::kAuthCanceled); return; case DevicePairingResultStatus::AuthenticationFailure: - NEARBY_LOGS(ERROR) << __func__ - << "Pairing Result Status: Authentication Failure."; + LOG(ERROR) << __func__ + << "Pairing Result Status: Authentication Failure."; pairing_callback_.on_pairing_error_cb(PairingError::kAuthFailed); return; case DevicePairingResultStatus::ConnectionRejected: case DevicePairingResultStatus::RejectedByHandler: - NEARBY_LOGS(ERROR) << __func__ - << "Pairing Result Status: Authentication Rejected."; + LOG(ERROR) << __func__ + << "Pairing Result Status: Authentication Rejected."; pairing_callback_.on_pairing_error_cb(PairingError::kAuthRejected); return; case DevicePairingResultStatus::AuthenticationTimeout: - NEARBY_LOGS(ERROR) << __func__ - << "Pairing Result Status: Authentication Timeout."; + LOG(ERROR) << __func__ + << "Pairing Result Status: Authentication Timeout."; pairing_callback_.on_pairing_error_cb(PairingError::kAuthTimeout); return; case DevicePairingResultStatus::Failed: - NEARBY_LOGS(ERROR) << __func__ << "Pairing Result Status: Failed."; + LOG(ERROR) << __func__ << "Pairing Result Status: Failed."; pairing_callback_.on_pairing_error_cb(PairingError::kFailed); return; case DevicePairingResultStatus::OperationAlreadyInProgress: - NEARBY_LOGS(ERROR) << __func__ - << "Pairing Result Status: Operation In Progress."; + LOG(ERROR) << __func__ + << "Pairing Result Status: Operation In Progress."; pairing_callback_.on_pairing_error_cb(PairingError::kRepeatedAttempts); return; default: break; } - NEARBY_LOGS(ERROR) << __func__ << "Pairing Result Status: Failed."; + LOG(ERROR) << __func__ << "Pairing Result Status: Failed."; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to get Pairing Result Status. exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Failed to get Pairing Result Status. exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to get Pairing Result Status." - << " WinRT exception: " << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Failed to get Pairing Result Status." + << " WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } pairing_callback_.on_pairing_error_cb(PairingError::kFailed); } diff --git a/internal/platform/implementation/windows/device_info.cc b/internal/platform/implementation/windows/device_info.cc index 5978f27c..236ce63b 100644 --- a/internal/platform/implementation/windows/device_info.cc +++ b/internal/platform/implementation/windows/device_info.cc @@ -18,19 +18,16 @@ #include #include -#include -#include +#include // NOLINT #include #include #include -#include -#include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" -#include "internal/base/bluetooth_address.h" +#include "internal/base/files.h" #include "internal/platform/implementation/device_info.h" -#include "internal/platform/implementation/windows/session_manager.h" +#include "internal/platform/implementation/windows/generated/winrt/base.h" #include "internal/platform/logging.h" #include "winrt/Windows.Foundation.Collections.h" #include "winrt/Windows.Foundation.h" @@ -56,25 +53,25 @@ constexpr char logs_relative_path[] = "Google\\Nearby\\Sharing\\Logs"; constexpr char crash_dumps_relative_path[] = "Google\\Nearby\\Sharing\\CrashDumps"; -std::optional DeviceInfo::GetOsDeviceName() const { +std::optional DeviceInfo::GetOsDeviceName() const { DWORD size = 0; // Get length of the computer name. if (!GetComputerNameExW(ComputerNameDnsHostname, nullptr, &size)) { if (GetLastError() != ERROR_MORE_DATA) { - NEARBY_LOGS(ERROR) << ": Failed to get device name size, error:" - << GetLastError(); + LOG(ERROR) << ": Failed to get device name size, error:" + << GetLastError(); return std::nullopt; } } - WCHAR device_name[size]; - if (GetComputerNameExW(ComputerNameDnsHostname, device_name, &size)) { - std::wstring wide_name(device_name); - return std::u16string(wide_name.begin(), wide_name.end()); + std::wstring device_name(size, L' '); + if (GetComputerNameExW(ComputerNameDnsHostname, device_name.data(), &size)) { + winrt::hstring device_name_str(device_name); + return winrt::to_string(device_name_str); } - NEARBY_LOGS(ERROR) << ": Failed to get device name, error:" << GetLastError(); + LOG(ERROR) << ": Failed to get device name, error:" << GetLastError(); return std::nullopt; } @@ -87,7 +84,7 @@ api::DeviceInfo::OsType DeviceInfo::GetOsType() const { return api::DeviceInfo::OsType::kWindows; } -std::optional DeviceInfo::GetFullName() const { +std::optional DeviceInfo::GetGivenName() const { // FindAllAsync finds all users that are using this app. When we "Switch User" // on Desktop,FindAllAsync() will still return the current user instead of all // of them because the users who are switched out are not using the apps of @@ -100,52 +97,7 @@ std::optional DeviceInfo::GetFullName() const { UserAuthenticationStatus::LocallyAuthenticated) .get(); if (users == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Error retrieving locally authenticated user."; - return std::nullopt; - } - - // On Windows Desktop apps, the first Windows.System.User instance - // returned in the IVectorView is always the current user. - // https://github.com/microsoft/Windows-task-snippets/blob/master/tasks/User-info.md - User current_user = users.GetAt(0); - - // Retrieve the human-readable properties for the current user - IAsyncOperation full_name_obj_async = - current_user.GetPropertyAsync(KnownUserProperties::DisplayName()); - IInspectable full_name_obj = full_name_obj_async.get(); - if (full_name_obj == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Error retrieving full name of user."; - return std::nullopt; - } - winrt::hstring full_name = full_name_obj.as(); - std::wstring wstr(full_name); - std::u16string u16str(wstr.begin(), wstr.end()); - - if (u16str.empty()) { - NEARBY_LOGS(ERROR) - << __func__ << ": Error unboxing string value for full name of user."; - return std::nullopt; - } - - return u16str; -} - -std::optional DeviceInfo::GetGivenName() const { - // FindAllAsync finds all users that are using this app. When we "Switch User" - // on Desktop,FindAllAsync() will still return the current user instead of all - // of them because the users who are switched out are not using the apps of - // the user who is switched in, so FindAllAsync() will not find them. (Under - // the UWP application model, each process runs under its own user account. - // That user account is different from the user account of the logged-in user. - // Processes aren't owned by the logged-in user for purposes of isolation.) - IVectorView users = - User::FindAllAsync(UserType::LocalUser, - UserAuthenticationStatus::LocallyAuthenticated) - .get(); - if (users == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Error retrieving locally authenticated user."; + LOG(ERROR) << __func__ << ": Error retrieving locally authenticated user."; return std::nullopt; } @@ -159,109 +111,19 @@ std::optional DeviceInfo::GetGivenName() const { current_user.GetPropertyAsync(KnownUserProperties::FirstName()); IInspectable given_name_obj = given_name_obj_async.get(); if (given_name_obj == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Error retrieving first name of user."; + LOG(ERROR) << __func__ << ": Error retrieving first name of user."; return std::nullopt; } winrt::hstring given_name = given_name_obj.as(); - std::wstring wstr(given_name); - std::u16string u16str(wstr.begin(), wstr.end()); + std::string given_name_str = winrt::to_string(given_name); - if (u16str.empty()) { - NEARBY_LOGS(ERROR) - << __func__ << ": Error unboxing string value for first name of user."; + if (given_name_str.empty()) { + LOG(ERROR) << __func__ + << ": Error unboxing string value for first name of user."; return std::nullopt; } - return u16str; -} - -std::optional DeviceInfo::GetLastName() const { - // FindAllAsync finds all users that are using this app. When we "Switch User" - // on Desktop,FindAllAsync() will still return the current user instead of all - // of them because the users who are switched out are not using the apps of - // the user who is switched in, so FindAllAsync() will not find them. (Under - // the UWP application model, each process runs under its own user account. - // That user account is different from the user account of the logged-in user. - // Processes aren't owned by the logged-in user for purposes of isolation.) - IVectorView users = - User::FindAllAsync(UserType::LocalUser, - UserAuthenticationStatus::LocallyAuthenticated) - .get(); - if (users == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Error retrieving locally authenticated user."; - return std::nullopt; - } - - // On Windows Desktop apps, the first Windows.System.User instance - // returned in the IVectorView is always the current user. - // https://github.com/microsoft/Windows-task-snippets/blob/master/tasks/User-info.md - User current_user = users.GetAt(0); - - // Retrieve the human-readable properties for the current user - IAsyncOperation last_name_obj_async = - current_user.GetPropertyAsync(KnownUserProperties::LastName()); - IInspectable last_name_obj = last_name_obj_async.get(); - if (last_name_obj == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Error retrieving last name of user."; - return std::nullopt; - } - winrt::hstring last_name = last_name_obj.as(); - std::wstring wstr(last_name); - std::u16string u16str(wstr.begin(), wstr.end()); - - if (u16str.empty()) { - NEARBY_LOGS(ERROR) - << __func__ << ": Error unboxing string value for last name of user."; - return std::nullopt; - } - - return u16str; -} - -std::optional DeviceInfo::GetProfileUserName() const { - // FindAllAsync finds all users that are using this app. When we "Switch User" - // on Desktop,FindAllAsync() will still return the current user instead of all - // of them because the users who are switched out are not using the apps of - // the user who is switched in, so FindAllAsync() will not find them. (Under - // the UWP application model, each process runs under its own user account. - // That user account is different from the user account of the logged-in user. - // Processes aren't owned by the logged-in user for purposes of isolation.) - IVectorView users = - User::FindAllAsync(UserType::LocalUser, - UserAuthenticationStatus::LocallyAuthenticated) - .get(); - if (users == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Error retrieving locally authenticated user."; - return std::nullopt; - } - - // On Windows Desktop apps, the first Windows.System.User instance - // returned in the IVectorView is always the current user. - // https://github.com/microsoft/Windows-task-snippets/blob/master/tasks/User-info.md - User current_user = users.GetAt(0); - - // Retrieve the human-readable properties for the current user - IAsyncOperation account_name_obj_async = - current_user.GetPropertyAsync(KnownUserProperties::AccountName()); - IInspectable account_name_obj = account_name_obj_async.get(); - if (account_name_obj == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": Error retrieving account name of user."; - return std::nullopt; - } - winrt::hstring account_name = account_name_obj.as(); - std::string account_name_string = winrt::to_string(account_name); - - if (account_name_string.empty()) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Error unboxing string value for profile username of user."; - return std::nullopt; - } - - return account_name_string; + return given_name_str; } std::optional DeviceInfo::GetDownloadPath() const { @@ -307,7 +169,7 @@ std::optional DeviceInfo::GetCommonAppDataPath() const { } std::optional DeviceInfo::GetTemporaryPath() const { - return std::filesystem::temp_directory_path(); + return nearby::sharing::GetTemporaryDirectory(); } std::optional DeviceInfo::GetLogPath() const { diff --git a/internal/platform/implementation/windows/device_info.h b/internal/platform/implementation/windows/device_info.h index 79c96771..dbd8153b 100644 --- a/internal/platform/implementation/windows/device_info.h +++ b/internal/platform/implementation/windows/device_info.h @@ -31,13 +31,10 @@ class DeviceInfo : public api::DeviceInfo { public: ~DeviceInfo() override = default; - std::optional GetOsDeviceName() const override; + std::optional GetOsDeviceName() const override; api::DeviceInfo::DeviceType GetDeviceType() const override; api::DeviceInfo::OsType GetOsType() const override; - std::optional GetFullName() const override; - std::optional GetGivenName() const override; - std::optional GetLastName() const override; - std::optional GetProfileUserName() const override; + std::optional GetGivenName() const override; std::optional GetDownloadPath() const override; std::optional GetLocalAppDataPath() const override; diff --git a/internal/platform/implementation/windows/device_info_test.cc b/internal/platform/implementation/windows/device_info_test.cc index d19c4370..59f344c4 100644 --- a/internal/platform/implementation/windows/device_info_test.cc +++ b/internal/platform/implementation/windows/device_info_test.cc @@ -14,11 +14,8 @@ #include "internal/platform/implementation/windows/device_info.h" -#include -#include #include "gtest/gtest.h" -#include "absl/synchronization/notification.h" #include "internal/platform/implementation/device_info.h" namespace nearby { @@ -37,21 +34,10 @@ TEST(DeviceInfo, GetOsType) { EXPECT_EQ(DeviceInfo().GetOsType(), api::DeviceInfo::OsType::kWindows); } -TEST(DeviceInfo, DISABLED_GetFullName) { - EXPECT_TRUE(DeviceInfo().GetFullName().has_value()); -} - TEST(DeviceInfo, DISABLED_GetGivenName) { EXPECT_TRUE(DeviceInfo().GetGivenName().has_value()); } -TEST(DeviceInfo, DISABLED_GetLastName) { - EXPECT_TRUE(DeviceInfo().GetLastName().has_value()); -} - -TEST(DeviceInfo, DISABLED_GetProfileUserName) { - EXPECT_TRUE(DeviceInfo().GetProfileUserName().has_value()); -} TEST(DeviceInfo, DISABLED_GetLocalAppDataPath) { EXPECT_TRUE(DeviceInfo().GetLocalAppDataPath().has_value()); diff --git a/internal/platform/implementation/windows/executor.cc b/internal/platform/implementation/windows/executor.cc index d15bc590..bc30b2f5 100644 --- a/internal/platform/implementation/windows/executor.cc +++ b/internal/platform/implementation/windows/executor.cc @@ -15,8 +15,10 @@ #include "internal/platform/implementation/windows/executor.h" #include +#include #include "internal/platform/logging.h" +#include "internal/platform/runnable.h" namespace nearby { namespace windows { @@ -32,13 +34,13 @@ Executor::Executor(int32_t max_concurrency) void Executor::Execute(Runnable&& runnable) { if (shut_down_) { - NEARBY_LOGS(VERBOSE) << "Warning: " << __func__ - << ": Attempt to execute on a shut down pool."; + VLOG(1) << "Warning: " << __func__ + << ": Attempt to execute on a shut down pool."; return; } if (runnable == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Runnable was null."; + LOG(ERROR) << __func__ << ": Runnable was null."; return; } diff --git a/internal/platform/implementation/windows/file.cc b/internal/platform/implementation/windows/file.cc index 0ce81ed7..d0e4bc54 100644 --- a/internal/platform/implementation/windows/file.cc +++ b/internal/platform/implementation/windows/file.cc @@ -14,45 +14,54 @@ #include "internal/platform/implementation/windows/file.h" -#include #include +#include #include #include #include #include "absl/memory/memory.h" #include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" #include "internal/platform/exception.h" -#include "internal/platform/implementation/windows/utils.h" +#include "internal/platform/implementation/windows/string_utils.h" #include "internal/platform/logging.h" namespace nearby { namespace windows { // InputFile -std::unique_ptr IOFile::CreateInputFile( - const absl::string_view file_path, size_t size) { +std::unique_ptr IOFile::CreateInputFile(absl::string_view file_path, + size_t size) { return absl::WrapUnique(new IOFile(file_path, size)); } -IOFile::IOFile(const absl::string_view file_path, size_t size) - : path_(file_path) { +IOFile::IOFile(absl::string_view file_path, size_t size) : path_(file_path) { // Always open input file path as wide string on Windows platform. - std::wstring wide_path = string_to_wstring(std::string(file_path)); + std::wstring wide_path = string_utils::StringToWideString( + std::string(file_path)); file_.open(wide_path, std::ios::binary | std::ios::in | std::ios::ate); total_size_ = file_.tellg(); + if (total_size_ == -1) { + // Unsure why it consistently returns -1 when the file size exceeds 2GB. If + // obtaining the file size through tellg fails, use the size provided + // in the parameters. + total_size_ = size; + } + file_.seekg(0); } -std::unique_ptr IOFile::CreateOutputFile(const absl::string_view path) { +std::unique_ptr IOFile::CreateOutputFile(absl::string_view path) { return std::unique_ptr(new IOFile(path)); } -IOFile::IOFile(const absl::string_view file_path) +IOFile::IOFile(absl::string_view file_path) : file_(), path_(file_path), total_size_(0) { // Always open input file path as wide string on Windows platform. - std::wstring wide_path = string_to_wstring(path_); + std::wstring wide_path = + string_utils::StringToWideString(path_); file_.open(wide_path, std::ios::binary | std::ios::out); } @@ -66,20 +75,22 @@ ExceptionOr IOFile::Read(std::int64_t size) { return ExceptionOr{Exception::kIo}; } - if (file_.peek() == EOF) { + if (file_.eof()) { return ExceptionOr{ByteArray{}}; } - ByteArray bytes(size); - std::unique_ptr read_bytes{new char[size]}; - file_.read(read_bytes.get(), static_cast(size)); + if (buffer_.size() < size) { + buffer_.resize(size); + } + + file_.read(buffer_.data(), static_cast(size)); auto num_bytes_read = file_.gcount(); if (num_bytes_read == 0) { return ExceptionOr{Exception::kIo}; } - return ExceptionOr(ByteArray(read_bytes.get(), num_bytes_read)); + return ExceptionOr(ByteArray(buffer_.data(), num_bytes_read)); } catch (...) { - NEARBY_LOGS(ERROR) << "Fail to read"; + LOG(ERROR) << "Fail to read"; return ExceptionOr{Exception::kIo}; } } @@ -105,7 +116,7 @@ Exception IOFile::Write(const ByteArray& data) { file_.flush(); return {file_.good() ? Exception::kSuccess : Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << "Fail to write"; + LOG(ERROR) << "Fail to write"; return {Exception::kIo}; } } diff --git a/internal/platform/implementation/windows/file.h b/internal/platform/implementation/windows/file.h index ad26f16e..56d3b294 100644 --- a/internal/platform/implementation/windows/file.h +++ b/internal/platform/implementation/windows/file.h @@ -15,12 +15,14 @@ #ifndef PLATFORM_IMPL_WINDOWS_FILE_H_ #define PLATFORM_IMPL_WINDOWS_FILE_H_ +#include #include #include #include #include #include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" #include "internal/platform/exception.h" #include "internal/platform/implementation/input_file.h" #include "internal/platform/implementation/output_file.h" @@ -30,10 +32,10 @@ namespace windows { class IOFile final : public api::InputFile, public api::OutputFile { public: - static std::unique_ptr CreateInputFile( - const absl::string_view file_path, size_t size); + static std::unique_ptr CreateInputFile(absl::string_view file_path, + size_t size); - static std::unique_ptr CreateOutputFile(const absl::string_view path); + static std::unique_ptr CreateOutputFile(absl::string_view path); ExceptionOr Read(std::int64_t size) override; @@ -46,11 +48,12 @@ class IOFile final : public api::InputFile, public api::OutputFile { Exception Flush() override; private: - explicit IOFile(const absl::string_view file_path, size_t size); - explicit IOFile(const absl::string_view file_path); + explicit IOFile(absl::string_view file_path, size_t size); + explicit IOFile(absl::string_view file_path); std::fstream file_; std::string path_; + std::string buffer_; std::int64_t total_size_; }; diff --git a/internal/platform/implementation/windows/file_path.cc b/internal/platform/implementation/windows/file_path.cc index 8a5f9d0a..3e3c5061 100644 --- a/internal/platform/implementation/windows/file_path.cc +++ b/internal/platform/implementation/windows/file_path.cc @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2022-2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ #include "internal/platform/implementation/windows/file_path.h" +// clang-format off #include #include #include @@ -22,28 +23,36 @@ #include #include #include +#include +// clang-format on #include #include #include #include #include +#include #include #include "absl/strings/str_cat.h" +#include "absl/types/span.h" +#include "connections/implementation/flags/nearby_connections_feature_flags.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/implementation/windows/string_utils.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/logging.h" namespace nearby { namespace windows { -const wchar_t* kUpOneLevel = L"/.."; +const wchar_t* kUpOneLevel = L".."; +constexpr wchar_t kDot = L'.'; constexpr wchar_t kPathDelimiter = L'/'; constexpr wchar_t kReplacementChar = L'_'; constexpr wchar_t kForwardSlash = L'/'; constexpr wchar_t kBackSlash = L'\\'; -wchar_t const* kForbiddenPathNames[] = { +constexpr std::wstring_view kForbiddenPathNames[] = { L"CON", L"PRN", L"AUX", L"NUL", L"COM1", L"COM2", L"COM3", L"COM4", L"COM5", L"COM6", L"COM7", L"COM8", L"COM9", L"LPT1", L"LPT2", L"LPT3", L"LPT4", L"LPT5", L"LPT6", L"LPT7", L"LPT8", L"LPT9"}; @@ -51,12 +60,14 @@ wchar_t const* kForbiddenPathNames[] = { std::wstring FilePath::GetCustomSavePath(std::wstring parent_folder, std::wstring file_name) { std::wstring path; + SanitizeFileName(file_name); path += parent_folder + kPathDelimiter + file_name; return CreateOutputFileWithRename(path); } std::wstring FilePath::GetDownloadPath(std::wstring parent_folder, std::wstring file_name) { + SanitizeFileName(file_name); return CreateOutputFileWithRename( GetDownloadPathInternal(parent_folder, file_name)); } @@ -167,8 +178,8 @@ std::wstring FilePath::CreateOutputFileWithRename(std::wstring path) { } if (count > 0) { - NEARBY_LOGS(INFO) << "Renamed " << wstring_to_string(path) << " to " - << wstring_to_string(target); + LOG(INFO) << "Renamed " << string_utils::WideStringToString(path) << " to " + << string_utils::WideStringToString(target); } // The above leaves the file open, so close it. @@ -198,23 +209,30 @@ std::wstring FilePath::MutateForbiddenPathElements(std::wstring& str) { if (lastToken.length() > 0) path_elements.push_back(lastToken); std::wstring processed_path; + absl::Span forbidden(kForbiddenPathNames); for (auto& path_element : path_elements) { auto tmp_path_element = path_element; + if (tmp_path_element.size() == 1 && tmp_path_element[0] == kDot) { + // Change the dot path name to an underscore. + tmp_path_element[0] = kReplacementChar; + LOG(INFO) << "Renamed path element " + << string_utils::WideStringToString(path_element) << " to " + << string_utils::WideStringToString(tmp_path_element); + path_element[0] = kReplacementChar; + } + std::transform(tmp_path_element.begin(), tmp_path_element.end(), tmp_path_element.begin(), [](wchar_t c) { return std::toupper(c); }); - std::vector forbidden(std::begin(kForbiddenPathNames), - std::end(kForbiddenPathNames)); - while (std::find(forbidden.begin(), forbidden.end(), tmp_path_element) != forbidden.end()) { tmp_path_element.insert(tmp_path_element.begin(), kReplacementChar); - NEARBY_LOGS(INFO) << "Renamed path element " - << wstring_to_string(path_element) << " to " - << wstring_to_string(tmp_path_element); + LOG(INFO) << "Renamed path element " + << string_utils::WideStringToString(path_element) << " to " + << string_utils::WideStringToString(tmp_path_element); path_element.insert(path_element.begin(), kReplacementChar); } @@ -227,16 +245,15 @@ std::wstring FilePath::MutateForbiddenPathElements(std::wstring& str) { return processed_path; } -void FilePath::SanitizePath(std::wstring& path) { - size_t pos = std::wstring::npos; - // Search for the substring in string in a loop until nothing is found - while ((pos = path.find(kUpOneLevel)) != std::string::npos) { - // If found then erase it from string - path.erase(pos, wcslen(kUpOneLevel)); +void FilePath::SanitizeFileName(std::wstring& file_name) { + if (!file_name.empty() && file_name[file_name.size() - 1] == kDot) { + // Change the last dot to an underscore. + file_name[file_name.size() - 1] = kReplacementChar; } +} +void FilePath::SanitizePath(std::wstring& path) { path = MutateForbiddenPathElements(path); - ReplaceInvalidCharacters(path); } @@ -249,16 +266,22 @@ void FilePath::ReplaceInvalidCharacters(std::wstring& path) { for (; it != path.end(); it++) { // If 0 < character < 32, it's illegal, replace it if (*it > 0 && *it < 32) { - NEARBY_LOGS(INFO) << "In path " << wstring_to_string(path) - << " replaced \'" << std::string(1, *it) << "\' with \'" - << std::string(1, kReplacementChar); + LOG(INFO) << "In path " << string_utils::WideStringToString(path) + << " replaced \'" << std::string(1, *it) << "\' with \'" + << std::string(1, kReplacementChar); + *it = kReplacementChar; + } + if (*it == 0) { // character is null + LOG(INFO) << "In path " << string_utils::WideStringToString(path) + << " replaced \'NULL\' with \'" + << std::string(1, kReplacementChar) << "\'"; *it = kReplacementChar; } for (auto illegal_character : kIllegalFileCharacters) { if (*it == illegal_character) { - NEARBY_LOGS(INFO) << "In path " << wstring_to_string(path) - << " replaced \'" << std::string(1, *it) - << "\' with \'" << std::string(1, kReplacementChar); + LOG(INFO) << "In path " << string_utils::WideStringToString(path) + << " replaced \'" << std::string(1, *it) << "\' with \'" + << std::string(1, kReplacementChar); *it = kReplacementChar; } } diff --git a/internal/platform/implementation/windows/file_path.h b/internal/platform/implementation/windows/file_path.h index 17cceb99..83989613 100644 --- a/internal/platform/implementation/windows/file_path.h +++ b/internal/platform/implementation/windows/file_path.h @@ -41,6 +41,7 @@ class FilePath { static std::wstring MutateForbiddenPathElements(std::wstring& str); static std::wstring GetDownloadPathInternal(std::wstring parent_folder, std::wstring file_name); + static void SanitizeFileName(std::wstring& file_name); }; } // namespace windows diff --git a/internal/platform/implementation/windows/file_path_test.cc b/internal/platform/implementation/windows/file_path_test.cc index 2056ceab..6ae3790d 100644 --- a/internal/platform/implementation/windows/file_path_test.cc +++ b/internal/platform/implementation/windows/file_path_test.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include "gtest/gtest.h" @@ -39,6 +38,7 @@ const wchar_t* kFileName(L"increment_file_test.txt"); const wchar_t* kFirstIterationFileName(L"/increment_file_test (1).txt"); const wchar_t* kSecondIterationFileName(L"/increment_file_test (2).txt"); const wchar_t* kThirdIterationFileName(L"/increment_file_test (3).txt"); +const wchar_t* kFileNameWithNullReplaced(L"/increment_file_test.txt_.txt"); const wchar_t* kNoDotsFileName(L"incrementfiletesttxt"); const wchar_t* kOneIterationNoDotsFileName(L"/incrementfiletesttxt (1)"); const wchar_t* kMultipleDotsFileName(L"increment.file.test.txt"); @@ -52,6 +52,8 @@ const wchar_t* kLongEscapeMixedSlash(L"../test\\..\\../test"); const wchar_t* kLongEscapeEndingEscape(L"../test/../../test/.."); const wchar_t* kLongEscapeEndingEscapeWithSlash( L"../test/../../test/../../../"); +const wchar_t* kFileNameWithThreeDots(L"..."); +const wchar_t* kFileNameWithFrontTwoDots(L"..file.name.txt"); } // namespace // Can't run on google 3, I presume the SHGetKnownFolderPath @@ -124,71 +126,6 @@ FolderArgumentsShouldReturnBaseDownloadPath) { EXPECT_EQ(actual, default_download_path_); } // NOLINT false lint error here -TEST_F(FilePathTests, GetDownloadPathWithAttemptToEscape\ -UsersDownloadFolderShouldReturnDownloadPathNotEscapingUsersDownloadFolder) { - std::wstring parent_folder(kImmediateEscape); - std::wstring file_name(L""); - - auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); - - EXPECT_EQ(actual, default_download_path_); -} - -TEST_F(FilePathTests, GetDownloadPathWithMultiple\ -AttemptsToEscapeUsersDownloadFolderWithBackslashShouldReturnDownloadPath\ -NotEscapingUsersDownloadFolder) { - std::wstring parent_folder(kLongEscapeBackSlash); - std::wstring file_name(L""); - - auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); - - EXPECT_EQ(actual, default_download_path_ + kTwoLevelFolder); -} - -TEST_F(FilePathTests, GetDownloadPathWithMultiple\ -AttemptsToEscapeUsersDownloadFolderShouldReturnDownloadPathNotEscapingUsers\ -DownloadFolder) { - std::wstring parent_folder(kLongEscapeSlash); - std::wstring file_name(L""); - - auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); - - EXPECT_EQ(actual, default_download_path_ + kTwoLevelFolder); -} - -TEST_F(FilePathTests, GetDownloadPathWithMultiple\ -AttemptsToEscapeUsersDownloadFolderWithMixedSlashShouldReturnDownloadPath\ -NotEscapingUsersDownloadFolder) { - std::wstring parent_folder(kLongEscapeMixedSlash); - std::wstring file_name(L""); - - auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); - - EXPECT_EQ(actual, default_download_path_ + kTwoLevelFolder); -} - -TEST_F(FilePathTests, GetDownloadPathWithMultiple\ -AttemptsToEscapeUsersDownloadFolderWithEndingEscapeShouldReturnDownload\ -PathNotEscapingUsersDownloadFolder) { - std::wstring parent_folder(kLongEscapeEndingEscape); - std::wstring file_name(L""); - - auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); - - EXPECT_EQ(actual, default_download_path_ + kTwoLevelFolder); -} - -TEST_F(FilePathTests, GetDownloadPathWithMultiple\ -AttemptsToEscapeUsersDownloadFolderWithEndingSlashShouldReturnDownloadPathNot\ -EscapingUsersDownloadFolder) { - std::wstring parent_folder(kLongEscapeEndingEscapeWithSlash); - std::wstring file_name(L""); - - auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); - - EXPECT_EQ(actual, default_download_path_ + kTwoLevelFolder); -} - TEST_F(FilePathTests, GetDownloadPathWithSlashFileName\ ArgumentsShouldReturnBaseDownloadPath) { std::wstring parent_folder(L""); @@ -852,5 +789,88 @@ AHoleBetweenRenamedFiles) { input_file.open(output_file3_path, std::ifstream::binary | std::ifstream::in); ASSERT_FALSE(input_file.rdstate() == std::ifstream::goodbit); } + +TEST_F(FilePathTests, GetDownloadPathWithFileName\ +FileNameTwoDotsFrontShouldReturnBaseDownloadPathWithFileNameTwoDotsFront) { + std::wstring parent_folder(L""); + std::wstring file_name(kFileNameWithFrontTwoDots); + + std::wstringstream path(L""); + path << default_download_path_ << L"/" << file_name; + + std::wstring expected = path.str(); + + auto actual = FilePath::GetDownloadPath(parent_folder, file_name); + EXPECT_EQ(actual, expected); +} + +TEST_F(FilePathTests, GetDownloadPathWithFileName\ +FileNameThreeDotsShouldReturnBaseDownloadPathWithUnderscore) { + std::wstring parent_folder(L""); + std::wstring file_name(kFileNameWithThreeDots); + + std::wstringstream path(L""); + path << default_download_path_ << L"/.._"; + + std::wstring expected = path.str(); + + auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); + + EXPECT_EQ(actual, expected); +} + +TEST_F(FilePathTests, GetDownloadPath_FileExistsReturns\ +FileWithIncrementedNameWithNull) { + std::wstring file_name(kFileName); + int size = file_name.size(); + file_name.append(L"1.txt"); + file_name[size] = L'\x00'; + std::wstring renamed_file_name(kFileNameWithNullReplaced); + std::wstring parent_folder(L""); + + std::wstring output_file_path(default_download_path_); + output_file_path.append(L"/"); + output_file_path.append(file_name); + + std::wstring expected(default_download_path_); + expected += renamed_file_name; + + std::wifstream input_file; + std::wofstream output_file; + + output_file.open(output_file_path, + std::ofstream::binary | std::ofstream::out); + + ASSERT_TRUE(output_file.rdstate() == std::ofstream::goodbit); + + output_file.close(); + + auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); + + EXPECT_EQ(actual, expected); + + // Remove the file and check that it is removed + // File 1 + _wremove(output_file_path.c_str()); + + input_file.open(output_file_path, std::ifstream::binary | std::ifstream::in); + + ASSERT_FALSE(input_file.rdstate() == std::ifstream::goodbit); +} + +TEST_F(FilePathTests, GetDownloadPathWithFileName\ +ParentFolderWithADotShouldBeReplaceedWithUnderscore) { + std::wstring parent_folder(L"test/./folder/"); + std::wstring file_name(kFileName); + + std::wstringstream path(L""); + path << default_download_path_ << L"/test/_/folder" << L"/" << kFileName; + + std::wstring expected = path.str(); + + auto actual(FilePath::GetDownloadPath(parent_folder, file_name)); + + EXPECT_EQ(actual, expected); +} } // namespace windows } // namespace nearby diff --git a/internal/platform/implementation/windows/generated/BUILD b/internal/platform/implementation/windows/generated/BUILD index 39e0a2b2..17f33234 100644 --- a/internal/platform/implementation/windows/generated/BUILD +++ b/internal/platform/implementation/windows/generated/BUILD @@ -15,10 +15,13 @@ licenses(["notice"]) cc_library( name = "types", + hdrs = glob(["**/*.h"]), + includes = ["."], linkopts = [ "wininet.lib", "advapi32.lib", "bcrypt.lib", + "cfgmgr32.lib", "comdlg32.lib", "gdi32.lib", "kernel32.lib", @@ -38,12 +41,11 @@ cc_library( "wlanapi.lib", "shlwapi.lib", ], - textual_hdrs = glob(["**/*.h"]), visibility = [ "//fastpair:__subpackages__", "//internal:__subpackages__", "//internal/platform/implementation/windows:__subpackages__", - "//location/nearby/cpp/sharing/implementation/internal:__subpackages__", - "//third_party/nearby/sharing:__subpackages__", + "//location/nearby/apps/better_together/plugins:__subpackages__", + "//sharing:__subpackages__", ], ) diff --git a/internal/platform/implementation/windows/http_loader.cc b/internal/platform/implementation/windows/http_loader.cc index 5c5ee1db..e3295931 100644 --- a/internal/platform/implementation/windows/http_loader.cc +++ b/internal/platform/implementation/windows/http_loader.cc @@ -22,6 +22,8 @@ #include "absl/strings/ascii.h" #include "absl/strings/numbers.h" #include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/http_loader.h" #include "internal/platform/logging.h" namespace nearby { @@ -202,8 +204,8 @@ absl::Status HttpLoader::ConnectWebServer() { 0); /*Flags*/ if (internet_handle_ == nullptr) { - NEARBY_LOGS(ERROR) << "Failed to open internet with error " - << GetLastError() << "."; + LOG(ERROR) << "Failed to open internet with error " << GetLastError() + << "."; return absl::FailedPreconditionError(absl::StrCat(GetLastError())); } @@ -217,8 +219,8 @@ absl::Status HttpLoader::ConnectWebServer() { 0); /*Context*/ if (connect_handle_ == nullptr) { - NEARBY_LOGS(ERROR) << "Failed to connect remote web server with error " - << GetLastError() << "."; + LOG(ERROR) << "Failed to connect remote web server with error " + << GetLastError() << "."; InternetCloseHandle(internet_handle_); return absl::FailedPreconditionError(absl::StrCat(GetLastError())); } @@ -242,9 +244,8 @@ absl::Status HttpLoader::SendRequest() { 0); if (request_handle_ == nullptr) { - NEARBY_LOGS(ERROR) - << "Failed to open request to remote web server with error " - << GetLastError() << "."; + LOG(ERROR) << "Failed to open request to remote web server with error " + << GetLastError() << "."; InternetCloseHandle(internet_handle_); InternetCloseHandle(connect_handle_); @@ -284,9 +285,8 @@ absl::Status HttpLoader::SendRequest() { data_size); /*Data size*/ if (result == FALSE) { - NEARBY_LOGS(ERROR) - << "Failed to send request to remote web server with error " - << GetLastError() << "."; + LOG(ERROR) << "Failed to send request to remote web server with error " + << GetLastError() << "."; InternetCloseHandle(request_handle_); InternetCloseHandle(connect_handle_); InternetCloseHandle(internet_handle_); @@ -334,9 +334,8 @@ absl::StatusOr HttpLoader::ProcessResponse() { web_response.body.append(buffer, read_size); } } else { - NEARBY_LOGS(ERROR) - << "Failed to read response from remote web server with error " - << GetLastError() << "."; + LOG(ERROR) << "Failed to read response from remote web server with error " + << GetLastError() << "."; InternetCloseHandle(request_handle_); InternetCloseHandle(connect_handle_); InternetCloseHandle(internet_handle_); diff --git a/internal/platform/implementation/windows/log_message.cc b/internal/platform/implementation/windows/log_message.cc deleted file mode 100644 index fbc5d43f..00000000 --- a/internal/platform/implementation/windows/log_message.cc +++ /dev/null @@ -1,71 +0,0 @@ -// 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. - -#include "internal/platform/implementation/windows/log_message.h" - -#include - -#include "strings/strappendv.h" - -namespace nearby { -namespace windows { - -api::LogMessage::Severity min_log_severity_ = api::LogMessage::Severity::kInfo; - -inline absl::LogSeverity ConvertSeverity(api::LogMessage::Severity severity) { - switch (severity) { - // api::LogMessage::Severity kVerbose and kInfo is mapped to - // absl::LogSeverity kInfo since absl::LogSeverity doesn't have kVerbose - // level. - case api::LogMessage::Severity::kVerbose: - case api::LogMessage::Severity::kInfo: - return absl::LogSeverity::kInfo; - case api::LogMessage::Severity::kWarning: - return absl::LogSeverity::kWarning; - case api::LogMessage::Severity::kError: - return absl::LogSeverity::kError; - case api::LogMessage::Severity::kFatal: - return absl::LogSeverity::kFatal; - } -} - -LogMessage::LogMessage(const char* file, int line, Severity severity) - : log_streamer_(ConvertSeverity(severity), file, line) {} - -LogMessage::~LogMessage() = default; - -void LogMessage::Print(const char* format, ...) { - va_list ap; - va_start(ap, format); - std::string result; - strings::StrAppendV(&result, format, ap); - log_streamer_.stream() << result; - va_end(ap); -} - -std::ostream& LogMessage::Stream() { return log_streamer_.stream(); } - -} // namespace windows - -namespace api { - -void LogMessage::SetMinLogSeverity(Severity severity) { - windows::min_log_severity_ = severity; -} - -bool LogMessage::ShouldCreateLogMessage(Severity severity) { - return severity >= windows::min_log_severity_; -} -} // namespace api -} // namespace nearby diff --git a/internal/platform/implementation/windows/log_message.h b/internal/platform/implementation/windows/log_message.h deleted file mode 100644 index 1e6176e3..00000000 --- a/internal/platform/implementation/windows/log_message.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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 PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_ -#define PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_ - -#include "glog/logging.h" -#include "internal/platform/implementation/log_message.h" - -namespace nearby { -namespace windows { - -// See documentation in -// cpp/platform/api/log_message.h -class LogMessage : public api::LogMessage { - public: - LogMessage(const char* file, int line, Severity severity); - ~LogMessage() override; - - void Print(const char* format, ...) override; - - std::ostream& Stream() override; - - private: - google::LogMessage log_streamer_; - static api::LogMessage::Severity min_log_severity_; -}; - -} // namespace windows -} // namespace nearby - -#endif // PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_ diff --git a/internal/platform/implementation/windows/mutex.h b/internal/platform/implementation/windows/mutex.h index b9a908be..006293e9 100644 --- a/internal/platform/implementation/windows/mutex.h +++ b/internal/platform/implementation/windows/mutex.h @@ -14,12 +14,9 @@ #ifndef PLATFORM_IMPL_WINDOWS_MUTEX_H_ #define PLATFORM_IMPL_WINDOWS_MUTEX_H_ #include -#include -#include #include // NOLINT -#include "absl/memory/memory.h" #include "absl/synchronization/mutex.h" #include "internal/platform/implementation/mutex.h" @@ -59,7 +56,7 @@ class ABSL_LOCKABLE Mutex : public api::Mutex { std::recursive_mutex& GetRecursiveMutex() { return recursive_mutex_; } private: - friend class ConditionVariable; + friend class ::nearby::ConditionVariable; absl::Mutex mutex_; std::recursive_mutex recursive_mutex_; // The actual mutex allocation Mode mode_; diff --git a/internal/platform/implementation/windows/platform.cc b/internal/platform/implementation/windows/platform.cc index ddd8c6e6..6cb9474f 100644 --- a/internal/platform/implementation/windows/platform.cc +++ b/internal/platform/implementation/windows/platform.cc @@ -27,44 +27,57 @@ #include #include -#include +#include #include -#include #include #include +#include "absl/base/attributes.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" +#include "internal/platform/implementation/atomic_boolean.h" +#include "internal/platform/implementation/atomic_reference.h" +#include "internal/platform/implementation/ble.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" +#include "internal/platform/implementation/bluetooth_classic.h" +#include "internal/platform/implementation/condition_variable.h" +#include "internal/platform/implementation/count_down_latch.h" +#include "internal/platform/implementation/credential_storage.h" #include "internal/platform/implementation/http_loader.h" +#include "internal/platform/implementation/input_file.h" +#include "internal/platform/implementation/mutex.h" +#include "internal/platform/implementation/output_file.h" +#include "internal/platform/implementation/scheduled_executor.h" +#include "internal/platform/implementation/server_sync.h" #include "internal/platform/implementation/shared/count_down_latch.h" +#include "internal/platform/implementation/submittable_executor.h" +#include "internal/platform/implementation/wifi.h" +#include "internal/platform/implementation/wifi_lan.h" #include "internal/platform/implementation/windows/atomic_boolean.h" #include "internal/platform/implementation/windows/atomic_reference.h" -#include "internal/platform/implementation/windows/ble.h" +#include "internal/platform/implementation/windows/ble_medium.h" #include "internal/platform/implementation/windows/ble_v2.h" #include "internal/platform/implementation/windows/bluetooth_adapter.h" #include "internal/platform/implementation/windows/bluetooth_classic_medium.h" #include "internal/platform/implementation/windows/condition_variable.h" #include "internal/platform/implementation/windows/device_info.h" -#include "internal/platform/implementation/windows/executor.h" #include "internal/platform/implementation/windows/file.h" #include "internal/platform/implementation/windows/file_path.h" -#include "internal/platform/implementation/windows/future.h" #include "internal/platform/implementation/windows/http_loader.h" -#include "internal/platform/implementation/windows/listenable_future.h" -#include "internal/platform/implementation/windows/log_message.h" #include "internal/platform/implementation/windows/mutex.h" #include "internal/platform/implementation/windows/preferences_manager.h" #include "internal/platform/implementation/windows/scheduled_executor.h" #include "internal/platform/implementation/windows/server_sync.h" -#include "internal/platform/implementation/windows/settable_future.h" +#include "internal/platform/implementation/windows/string_utils.h" #include "internal/platform/implementation/windows/submittable_executor.h" #include "internal/platform/implementation/windows/timer.h" #include "internal/platform/implementation/windows/utils.h" -#include "internal/platform/implementation/windows/webrtc.h" #include "internal/platform/implementation/windows/wifi.h" #include "internal/platform/implementation/windows/wifi_hotspot.h" #include "internal/platform/implementation/windows/wifi_lan.h" -#include "internal/platform/logging.h" +#include "internal/platform/os_name.h" +#include "internal/platform/payload_id.h" namespace nearby { namespace api { @@ -102,28 +115,28 @@ std::string GetApplicationName(DWORD pid) { std::string ImplementationPlatform::GetCustomSavePath( const std::string& parent_folder, const std::string& file_name) { - auto parent = windows::string_to_wstring(parent_folder); - auto file = windows::string_to_wstring(file_name); + auto parent = windows::string_utils::StringToWideString(parent_folder); + auto file = windows::string_utils::StringToWideString(file_name); - return windows::wstring_to_string( + return windows::string_utils::WideStringToString( windows::FilePath::GetCustomSavePath(parent, file)); } std::string ImplementationPlatform::GetDownloadPath( const std::string& parent_folder, const std::string& file_name) { - auto parent = windows::string_to_wstring(std::string(parent_folder)); - auto file = windows::string_to_wstring(std::string(file_name)); + auto parent = windows::string_utils::StringToWideString(parent_folder); + auto file = windows::string_utils::StringToWideString(file_name); - return windows::wstring_to_string( + return windows::string_utils::WideStringToString( windows::FilePath::GetDownloadPath(parent, file)); } std::string ImplementationPlatform::GetDownloadPath( const std::string& file_name) { std::wstring fake_parent_path; - auto file = windows::string_to_wstring(std::string(file_name)); + auto file = windows::string_utils::StringToWideString(file_name); - return windows::wstring_to_string( + return windows::string_utils::WideStringToString( windows::FilePath::GetDownloadPath(fake_parent_path, file)); } @@ -166,29 +179,29 @@ OSName ImplementationPlatform::GetCurrentOS() { return OSName::kWindows; } std::unique_ptr ImplementationPlatform::CreateAtomicBoolean( bool initial_value) { - return absl::make_unique(); + return std::make_unique(initial_value); } std::unique_ptr ImplementationPlatform::CreateAtomicUint32( std::uint32_t value) { - return absl::make_unique(); + return std::make_unique(value); } std::unique_ptr ImplementationPlatform::CreateCountDownLatch( std::int32_t count) { - return absl::make_unique(count); + return std::make_unique(count); } #pragma push_macro("CreateMutex") #undef CreateMutex std::unique_ptr ImplementationPlatform::CreateMutex(Mutex::Mode mode) { - return absl::make_unique(mode); + return std::make_unique(mode); } #pragma pop_macro("CreateMutex") std::unique_ptr ImplementationPlatform::CreateConditionVariable(Mutex* mutex) { - return absl::make_unique(mutex); + return std::make_unique(mutex); } ABSL_DEPRECATED("This interface will be deleted in the near future.") @@ -217,8 +230,8 @@ std::unique_ptr ImplementationPlatform::CreateOutputFile( const std::string& file_path) { std::string path(file_path); - auto folder_path = - windows::string_to_wstring(path.substr(0, path.find_last_of('/'))); + auto folder_path = windows::string_utils::StringToWideString( + path.substr(0, path.find_last_of('/'))); // Verifies that a path is a valid directory. // https://docs.microsoft.com/en-us/windows/win32/api/shlwapi/nf-shlwapi-pathisdirectoryw if (!PathIsDirectoryW(folder_path.data())) { @@ -232,42 +245,36 @@ std::unique_ptr ImplementationPlatform::CreateOutputFile( return windows::IOFile::CreateOutputFile(file_path); } -// TODO(b/184975123): replace with real implementation. -std::unique_ptr ImplementationPlatform::CreateLogMessage( - const char* file, int line, LogMessage::Severity severity) { - return absl::make_unique(file, line, severity); -} - std::unique_ptr ImplementationPlatform::CreateSingleThreadExecutor() { - return absl::make_unique(); + return std::make_unique(); } std::unique_ptr ImplementationPlatform::CreateMultiThreadExecutor( std::int32_t max_concurrency) { - return absl::make_unique(max_concurrency); + return std::make_unique(max_concurrency); } std::unique_ptr ImplementationPlatform::CreateScheduledExecutor() { - return absl::make_unique(); + return std::make_unique(); } std::unique_ptr ImplementationPlatform::CreateBluetoothAdapter() { - return absl::make_unique(); + return std::make_unique(); } std::unique_ptr ImplementationPlatform::CreateBluetoothClassicMedium( nearby::api::BluetoothAdapter& adapter) { - return absl::make_unique(adapter); + return std::make_unique(adapter); } std::unique_ptr ImplementationPlatform::CreateBleMedium( BluetoothAdapter& adapter) { - return absl::make_unique(adapter); + return std::make_unique(adapter); } // TODO(b/184975123): replace with real implementation. @@ -276,6 +283,11 @@ ImplementationPlatform::CreateBleV2Medium(api::BluetoothAdapter& adapter) { return std::make_unique(adapter); } +std::unique_ptr +ImplementationPlatform::CreateCredentialStorage() { + return nullptr; +} + // TODO(b/184975123): replace with real implementation. std::unique_ptr ImplementationPlatform::CreateServerSyncMedium() { @@ -288,7 +300,7 @@ std::unique_ptr ImplementationPlatform::CreateWifiMedium() { } std::unique_ptr ImplementationPlatform::CreateWifiLanMedium() { - return absl::make_unique(); + return std::make_unique(); } std::unique_ptr diff --git a/internal/platform/implementation/windows/preferences_manager.cc b/internal/platform/implementation/windows/preferences_manager.cc index 0e89d26d..1a45c549 100644 --- a/internal/platform/implementation/windows/preferences_manager.cc +++ b/internal/platform/implementation/windows/preferences_manager.cc @@ -14,6 +14,7 @@ #include "internal/platform/implementation/windows/preferences_manager.h" +#include #include // NOLINT(build/c++17) #include #include @@ -21,9 +22,16 @@ #include #include +#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" +#include "absl/time/time.h" +#include "absl/types/span.h" #include "nlohmann/json.hpp" #include "nlohmann/json_fwd.hpp" +#include "internal/base/files.h" +#include "internal/platform/implementation/platform.h" +#include "internal/platform/implementation/preferences_manager.h" #include "internal/platform/implementation/windows/preferences_repository.h" #include "internal/platform/logging.h" @@ -39,7 +47,8 @@ PreferencesManager::PreferencesManager(absl::string_view file_path) nearby::api::ImplementationPlatform::CreateDeviceInfo() ->GetLocalAppDataPath(); if (!path.has_value()) { - path = std::filesystem::temp_directory_path(); + path = nearby::sharing::GetTemporaryDirectory().value_or( + nearby::sharing::CurrentDirectory()); } std::filesystem::path full_path = *path / std::string(file_path); @@ -187,7 +196,7 @@ void PreferencesManager::Remove(absl::string_view key) { // Writes data to storage. bool PreferencesManager::Commit() { if (!preferences_repository_->SavePreferences(value_)) { - NEARBY_LOGS(ERROR) << "Failed to save preference." << std::endl; + LOG(ERROR) << "Failed to save preference." << std::endl; return false; } return true; @@ -195,8 +204,8 @@ bool PreferencesManager::Commit() { bool PreferencesManager::SetValue(absl::string_view key, const json& value) { if (!value_.is_object()) { - NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_=" - << value_.dump(4); + LOG(ERROR) << "Preferences is no longer an object! value_=" + << value_.dump(4); value_ = json::object(); } @@ -212,8 +221,8 @@ template T PreferencesManager::GetValue(absl::string_view key, const T& default_value) const { if (!value_.is_object()) { - NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_=" - << value_.dump(4); + LOG(ERROR) << "Preferences is no longer an object! value_=" + << value_.dump(4); return default_value; } @@ -228,8 +237,8 @@ template bool PreferencesManager::SetArrayValue(absl::string_view key, absl::Span value) { if (!value_.is_object()) { - NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_=" - << value_.dump(4); + LOG(ERROR) << "Preferences is no longer an object! value_=" + << value_.dump(4); value_ = json::object(); } @@ -252,8 +261,8 @@ std::vector PreferencesManager::GetArrayValue( std::vector result; if (!value_.is_object()) { - NEARBY_LOGS(ERROR) << "Preferences is no longer an object! value_=" - << value_.dump(4); + LOG(ERROR) << "Preferences is no longer an object! value_=" + << value_.dump(4); for (const T& value : default_value) { result.push_back(value); diff --git a/internal/platform/implementation/windows/preferences_manager_test.cc b/internal/platform/implementation/windows/preferences_manager_test.cc index 243182ae..1766f548 100644 --- a/internal/platform/implementation/windows/preferences_manager_test.cc +++ b/internal/platform/implementation/windows/preferences_manager_test.cc @@ -41,26 +41,23 @@ constexpr absl::Duration kTimeOut = absl::Milliseconds(200); constexpr char kPreferencesFilePath[] = "Google/Nearby/Sharing"; } // namespace - TEST(PreferencesManager, CorruptedConfigFile) { - std::filesystem::path settingsPath = - std::filesystem::temp_directory_path(); + std::filesystem::path settingsPath = std::filesystem::temp_directory_path(); std::ofstream output_stream{settingsPath / "preferences.json"}; output_stream << "CORRUPTED" << std::endl; - NEARBY_LOGS(INFO) << "Loading preferences from: " << settingsPath.string(); + LOG(INFO) << "Loading preferences from: " << settingsPath.string(); EXPECT_EQ(PreferencesManager(settingsPath.string()).GetInteger("data", 100), 100); } TEST(PreferencesManager, ValidConfigFile) { - std::filesystem::path settingsPath = - std::filesystem::temp_directory_path(); + std::filesystem::path settingsPath = std::filesystem::temp_directory_path(); std::ofstream output_stream{settingsPath / "preferences.json"}; output_stream << "{\"data\":8, \"name\": \"Valid\"}" << std::endl; output_stream.close(); - NEARBY_LOGS(INFO) << "Loading preferences from: " << settingsPath.string(); + LOG(INFO) << "Loading preferences from: " << settingsPath.string(); EXPECT_EQ(PreferencesManager(settingsPath.string()).GetInteger("data", 100), 8); } diff --git a/internal/platform/implementation/windows/preferences_repository.cc b/internal/platform/implementation/windows/preferences_repository.cc index 3a5220e2..f5a0d153 100644 --- a/internal/platform/implementation/windows/preferences_repository.cc +++ b/internal/platform/implementation/windows/preferences_repository.cc @@ -19,8 +19,10 @@ #include #include +#include "absl/synchronization/mutex.h" #include "nlohmann/json.hpp" #include "nlohmann/json_fwd.hpp" +#include "internal/base/files.h" #include "internal/platform/logging.h" namespace nearby { @@ -40,8 +42,8 @@ json PreferencesRepository::LoadPreferences() { // The top level root should be an object, if it's not then something went // wrong or the file was corrupted. if (!preferences.value().is_object()) { - NEARBY_LOGS(ERROR) << "Preferences loaded was not a valid object: " - << preferences.value().dump(4); + LOG(ERROR) << "Preferences loaded was not a valid object: " + << preferences.value().dump(4); return json::object(); } @@ -49,17 +51,17 @@ json PreferencesRepository::LoadPreferences() { return preferences.value(); } - NEARBY_LOGS(ERROR) << "Could not load preferences file, trying backup."; + LOG(ERROR) << "Could not load preferences file, trying backup."; // In the future we should switch to using a transaction log or another // stable method which doesn't pose a risk of losing settings preferences = RestoreFromBackup(); if (preferences.has_value()) { - NEARBY_LOGS(ERROR) << "Successfully recovered from backup."; + LOG(ERROR) << "Successfully recovered from backup."; return preferences.value(); } - NEARBY_LOGS(ERROR) << "Failed to load preferences file from back up."; + LOG(ERROR) << "Failed to load preferences file from back up."; return json::object(); } @@ -68,9 +70,9 @@ bool PreferencesRepository::SavePreferences(json preferences) { absl::MutexLock lock(&mutex_); try { std::filesystem::path path = path_; - if (!std::filesystem::exists(path) && - !std::filesystem::create_directories(path)) { - NEARBY_LOGS(ERROR) << "Failed to create preferences path."; + if (!nearby::sharing::FileExists(path) && + !nearby::sharing::CreateDirectories(path)) { + LOG(ERROR) << "Failed to create preferences path."; return false; } @@ -78,30 +80,32 @@ bool PreferencesRepository::SavePreferences(json preferences) { std::filesystem::path full_name_backup = path / kPreferencesBackupFileName; // Create a backup without moving the bytes on disk - if (std::filesystem::exists(full_name)) { - NEARBY_LOGS(INFO) << "Making backup of preferences file."; - std::filesystem::rename(full_name, full_name_backup); + if (nearby::sharing::FileExists(full_name)) { + LOG(INFO) << "Making backup of preferences file."; + if (!nearby::sharing::Rename(full_name, full_name_backup)) { + LOG(ERROR) << "Failed to rename preferences backup file."; + } } - std::ofstream preferences_file(full_name.c_str()); + std::ofstream preferences_file(full_name); preferences_file << preferences; preferences_file.close(); // Make sure the file wasn't saved in a corrupted state if (!AttemptLoad().has_value()) { - NEARBY_LOGS(ERROR) << "Preferences saved to disk in corrupted state. " - "Restoring from backup."; + LOG(ERROR) << "Preferences saved to disk in corrupted state. " + "Restoring from backup."; if (!RestoreFromBackup().has_value()) { - NEARBY_LOGS(ERROR) << "Failed to restore preferences file."; + LOG(ERROR) << "Failed to restore preferences file."; return false; } } } catch (const std::exception& e) { - NEARBY_LOGS(ERROR) << "Failed to save preferences file: " << e.what(); + LOG(ERROR) << "Failed to save preferences file: " << e.what(); return false; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return false; } @@ -111,12 +115,13 @@ bool PreferencesRepository::SavePreferences(json preferences) { std::optional PreferencesRepository::AttemptLoad() { std::filesystem::path path = path_; std::filesystem::path full_name = path / kPreferencesFileName; - if (!std::filesystem::exists(path) || !std::filesystem::exists(full_name)) { + if (!nearby::sharing::DirectoryExists(path) || + !nearby::sharing::FileExists(full_name)) { return std::nullopt; } try { - std::ifstream preferences_file(full_name.c_str()); + std::ifstream preferences_file(full_name); if (!preferences_file.good()) { return std::nullopt; } @@ -125,16 +130,16 @@ std::optional PreferencesRepository::AttemptLoad() { preferences_file.close(); if (preferences.is_discarded()) { - NEARBY_LOGS(ERROR) << "Preferences file corrupted."; + LOG(ERROR) << "Preferences file corrupted."; return std::nullopt; } return preferences; } catch (const std::exception& e) { - NEARBY_LOGS(ERROR) << "Exception while loading preferences: " << e.what(); + LOG(ERROR) << "Exception while loading preferences: " << e.what(); return std::nullopt; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; return std::nullopt; } } @@ -144,15 +149,16 @@ std::optional PreferencesRepository::RestoreFromBackup() { std::filesystem::path full_name = path / kPreferencesFileName; std::filesystem::path full_name_backup = path / kPreferencesBackupFileName; - if (!std::filesystem::exists(full_name_backup)) { - NEARBY_LOGS(WARNING) - << "Backup requested but no backup preferences file found."; + if (!nearby::sharing::FileExists(full_name_backup)) { + LOG(WARNING) << "Backup requested but no backup preferences file found."; return std::nullopt; } - std::filesystem::rename(full_name_backup, full_name); + if (!nearby::sharing::Rename(full_name_backup, full_name)) { + LOG(ERROR) << "Failed to rename preferences backup file."; + } - NEARBY_LOGS(INFO) << "Attempting load from backup preferences."; + LOG(INFO) << "Attempting load from backup preferences."; return AttemptLoad(); } diff --git a/internal/platform/implementation/windows/scheduled_executor.cc b/internal/platform/implementation/windows/scheduled_executor.cc index 8acd677a..02820a49 100644 --- a/internal/platform/implementation/windows/scheduled_executor.cc +++ b/internal/platform/implementation/windows/scheduled_executor.cc @@ -16,19 +16,25 @@ #include -#include #include #include #include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" +#include "internal/platform/implementation/cancelable.h" #include "internal/platform/logging.h" +#include "internal/platform/runnable.h" namespace nearby { namespace windows { ScheduledExecutor::ScheduledExecutor() : executor_(std::make_unique()), - shut_down_(false) {} + shut_down_(false), + use_task_scheduler_(NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableTaskScheduler)) {} // Cancelable is kept both in the executor context, and in the caller context. // We want Cancelable to live until both caller and executor are done with it. @@ -36,30 +42,44 @@ ScheduledExecutor::ScheduledExecutor() // using std:shared_ptr<> instead of std::unique_ptr<>. std::shared_ptr ScheduledExecutor::Schedule( Runnable&& runnable, absl::Duration duration) { - if (shut_down_) { - NEARBY_LOGS(ERROR) << __func__ - << ": Attempt to Schedule on a shut down executor."; + if (use_task_scheduler_) { + if (shut_down_) { + LOG(ERROR) << __func__ + << ": Attempt to Schedule on a shut down executor."; - return nullptr; + return nullptr; + } + return task_scheduler_.Schedule(std::move(runnable), duration); + } else { + if (shut_down_) { + LOG(ERROR) << __func__ + << ": Attempt to Schedule on a shut down executor."; + + return nullptr; + } + + // Cleans completed tasks + auto it = scheduled_tasks_.begin(); + while (it != scheduled_tasks_.end()) { + if ((*it)->IsDone()) { + it = scheduled_tasks_.erase(it); + } else { + ++it; + } + } + + std::shared_ptr task = + std::make_shared(std::move(runnable), duration); + + scheduled_tasks_.push_back(task); + executor_->Execute([task]() { task->Start(); }); + return task; } - - // Cleans completed tasks - std::remove_if( - scheduled_tasks_.begin(), scheduled_tasks_.end(), - [](std::shared_ptr& task) { return task->IsDone(); }); - - std::shared_ptr task = - std::make_shared(std::move(runnable), duration); - - scheduled_tasks_.push_back(task); - executor_->Execute([task]() { task->Start(); }); - return task; } void ScheduledExecutor::Execute(Runnable&& runnable) { if (shut_down_) { - NEARBY_LOGS(ERROR) << __func__ - << ": Attempt to Execute on a shut down executor."; + LOG(ERROR) << __func__ << ": Attempt to Execute on a shut down executor."; return; } @@ -67,18 +87,26 @@ void ScheduledExecutor::Execute(Runnable&& runnable) { } void ScheduledExecutor::Shutdown() { - if (!shut_down_) { - shut_down_ = true; - for (auto& task : scheduled_tasks_) { - task->Cancel(); + if (use_task_scheduler_) { + if (!shut_down_) { + shut_down_ = true; + executor_->Shutdown(); + task_scheduler_.Shutdown(); + return; } + } else { + if (!shut_down_) { + shut_down_ = true; + for (auto& task : scheduled_tasks_) { + task->Cancel(); + } - scheduled_tasks_.clear(); - executor_->Shutdown(); - return; + scheduled_tasks_.clear(); + executor_->Shutdown(); + return; + } } - NEARBY_LOGS(ERROR) << __func__ - << ": Attempt to Shutdown on a shut down executor."; + LOG(ERROR) << __func__ << ": Attempt to Shutdown on a shut down executor."; } } // namespace windows } // namespace nearby diff --git a/internal/platform/implementation/windows/scheduled_executor.h b/internal/platform/implementation/windows/scheduled_executor.h index 2e1601c1..5cc87503 100644 --- a/internal/platform/implementation/windows/scheduled_executor.h +++ b/internal/platform/implementation/windows/scheduled_executor.h @@ -17,8 +17,8 @@ #include +#include #include -#include #include #include "absl/synchronization/notification.h" @@ -26,6 +26,8 @@ #include "internal/platform/implementation/cancelable.h" #include "internal/platform/implementation/scheduled_executor.h" #include "internal/platform/implementation/windows/executor.h" +#include "internal/platform/implementation/windows/task_scheduler.h" +#include "internal/platform/runnable.h" namespace nearby { namespace windows { @@ -49,7 +51,7 @@ class ScheduledExecutor : public api::ScheduledExecutor { std::shared_ptr Schedule(Runnable&& runnable, absl::Duration duration) override; - // Executes the runnable task immedately. + // Executes the runnable task immediately. void Execute(Runnable&& runnable) override; // Shutdowns the executor, all scheduled task will be cancelled. @@ -94,6 +96,9 @@ class ScheduledExecutor : public api::ScheduledExecutor { std::unique_ptr executor_ = nullptr; std::vector> scheduled_tasks_; std::atomic_bool shut_down_ = false; + + const bool use_task_scheduler_; + TaskScheduler task_scheduler_; }; } // namespace windows diff --git a/internal/platform/implementation/windows/scheduled_executor_test.cc b/internal/platform/implementation/windows/scheduled_executor_test.cc index f04dd954..118a9e86 100644 --- a/internal/platform/implementation/windows/scheduled_executor_test.cc +++ b/internal/platform/implementation/windows/scheduled_executor_test.cc @@ -14,6 +14,7 @@ #include "internal/platform/implementation/windows/scheduled_executor.h" +#include // NOLINT #include #include @@ -21,13 +22,31 @@ #include "absl/synchronization/notification.h" #include "absl/time/clock.h" #include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/implementation/windows/test_data.h" namespace nearby { namespace windows { namespace { -TEST(ScheduledExecutorTests, ExecuteSucceeds) { +constexpr absl::Duration kWaitTimeout = absl::Milliseconds(2000); + +class ScheduledExecutorTest : public ::testing::TestWithParam { + public: + void SetUp() override { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + platform::config_package_nearby::nearby_platform_feature:: + kEnableTaskScheduler, + GetParam()); + } + + void TearDown() override { + NearbyFlags::GetInstance().ResetOverridedValues(); + } +}; + +TEST_P(ScheduledExecutorTest, ExecuteSucceeds) { absl::Notification notification; // Arrange std::string expected(RUNNABLE_0_TEXT.c_str()); @@ -47,8 +66,7 @@ TEST(ScheduledExecutorTests, ExecuteSucceeds) { notification.Notify(); }); - ASSERT_TRUE( - notification.WaitForNotificationWithTimeout(absl::Milliseconds(200))); + ASSERT_TRUE(notification.WaitForNotificationWithTimeout(kWaitTimeout)); submittableExecutor->Shutdown(); // Assert @@ -61,7 +79,7 @@ TEST(ScheduledExecutorTests, ExecuteSucceeds) { ASSERT_EQ(output, expected); } -TEST(ScheduledExecutorTests, ScheduleSucceeds) { +TEST_P(ScheduledExecutorTest, ScheduleSucceeds) { absl::Notification notification; // Arrange std::string expected(RUNNABLE_0_TEXT.c_str()); @@ -88,8 +106,7 @@ TEST(ScheduledExecutorTests, ScheduleSucceeds) { }, absl::Milliseconds(50)); - ASSERT_TRUE( - notification.WaitForNotificationWithTimeout(absl::Milliseconds(200))); + ASSERT_TRUE(notification.WaitForNotificationWithTimeout(kWaitTimeout)); submittableExecutor->Shutdown(); ASSERT_EQ(threadIds->size(), 2); @@ -99,7 +116,7 @@ TEST(ScheduledExecutorTests, ScheduleSucceeds) { ASSERT_EQ(output, expected); } -TEST(ScheduledExecutorTests, CancelSucceeds) { +TEST_P(ScheduledExecutorTest, CancelSucceeds) { absl::Notification notification; // Arrange std::string expected(""); @@ -123,8 +140,7 @@ TEST(ScheduledExecutorTests, CancelSucceeds) { auto actual = cancelable->Cancel(); - EXPECT_FALSE( - notification.WaitForNotificationWithTimeout(absl::Milliseconds(2000))); + EXPECT_FALSE(notification.WaitForNotificationWithTimeout(kWaitTimeout)); submittableExecutor->Shutdown(); // Assert @@ -136,7 +152,7 @@ TEST(ScheduledExecutorTests, CancelSucceeds) { ASSERT_EQ(output, expected); } -TEST(ScheduledExecutorTests, CancelAfterStartedFails) { +TEST_P(ScheduledExecutorTest, CancelAfterStartedFails) { absl::Notification notification; // Arrange std::string expected(RUNNABLE_0_TEXT.c_str()); @@ -158,11 +174,10 @@ TEST(ScheduledExecutorTests, CancelAfterStartedFails) { }, absl::Milliseconds(100)); - absl::SleepFor(absl::Milliseconds(200)); + absl::SleepFor(absl::Milliseconds(500)); auto actual = cancelable->Cancel(); - ASSERT_TRUE( - notification.WaitForNotificationWithTimeout(absl::Milliseconds(2000))); + ASSERT_TRUE(notification.WaitForNotificationWithTimeout(kWaitTimeout)); submittableExecutor->Shutdown(); // Assert @@ -174,6 +189,9 @@ TEST(ScheduledExecutorTests, CancelAfterStartedFails) { ASSERT_EQ(output, expected); } +INSTANTIATE_TEST_SUITE_P(ScheduledExecutorTaskSchedulerFlagTest, + ScheduledExecutorTest, testing::Bool()); + } // namespace } // namespace windows } // namespace nearby diff --git a/internal/platform/implementation/windows/session_manager.cc b/internal/platform/implementation/windows/session_manager.cc index 3624a3ae..b12a4aa5 100644 --- a/internal/platform/implementation/windows/session_manager.cc +++ b/internal/platform/implementation/windows/session_manager.cc @@ -24,6 +24,7 @@ #include "absl/base/const_init.h" #include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" +#include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" #include "absl/synchronization/notification.h" #include "internal/platform/implementation/windows/submittable_executor.h" @@ -91,7 +92,7 @@ bool SessionManager::RegisterSessionListener( absl::string_view listener_name, absl::AnyInvocable callback) { absl::MutexLock lock(&session_mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Registering listener: " << listener_name; + LOG(INFO) << __func__ << ": Registering listener: " << listener_name; // Create session thread if no running thread. if (session_thread_ == nullptr) { @@ -114,38 +115,36 @@ bool SessionManager::RegisterSessionListener( session_callbacks_->emplace(listener_name, std::move(callback)); listeners_.emplace(listener_name); - NEARBY_LOGS(INFO) << __func__ << ": Session listener: " << listener_name - << " is registered."; + LOG(INFO) << __func__ << ": Session listener: " << listener_name + << " is registered."; return true; } bool SessionManager::UnregisterSessionListener( absl::string_view listener_name) { absl::MutexLock lock(&session_mutex_); - NEARBY_LOGS(INFO) << __func__ - << ": Unregistering listener: " << listener_name; + LOG(INFO) << __func__ << ": Unregistering listener: " << listener_name; if (session_thread_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": No running listener."; + LOG(ERROR) << __func__ << ": No running listener."; return false; } if (!session_callbacks_->contains(listener_name) || !listeners_.contains(listener_name)) { - NEARBY_LOGS(ERROR) << __func__ - << ": No listener with name:" << listener_name; + LOG(ERROR) << __func__ << ": No listener with name:" << listener_name; return false; } session_callbacks_->erase(listener_name); listeners_.erase(listener_name); if (!session_callbacks_->empty()) { - NEARBY_LOGS(INFO) << __func__ << ": Session listener: " << listener_name - << " is unregistered."; + LOG(INFO) << __func__ << ": Session listener: " << listener_name + << " is unregistered."; return true; } CleanUp(); - NEARBY_LOGS(INFO) << __func__ << ": Session listener: " << listener_name - << " is unregistered."; + LOG(INFO) << __func__ << ": Session listener: " << listener_name + << " is unregistered."; return true; } @@ -178,8 +177,7 @@ bool SessionManager::PreventSleep() const { EXECUTION_STATE execution_state = SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); if (execution_state == 0) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set execution state of the thread."; + LOG(ERROR) << __func__ << ": Failed to set execution state of the thread."; return false; } return true; @@ -188,16 +186,15 @@ bool SessionManager::PreventSleep() const { bool SessionManager::AllowSleep() const { EXECUTION_STATE execution_state = SetThreadExecutionState(ES_CONTINUOUS); if (execution_state == 0) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to set execution state of the thread."; + LOG(ERROR) << __func__ << ": Failed to set execution state of the thread."; return false; } return true; } void SessionManager::NotifySessionState(SessionState state) { - NEARBY_LOGS(INFO) << __func__ - << ": Notifying session state: " << static_cast(state); + LOG(INFO) << __func__ + << ": Notifying session state: " << static_cast(state); if (state == SessionManager::SessionState::kLock) { absl::MutexLock lock(&session_mutex_); for (auto& it : *SessionManager::session_callbacks_) { @@ -214,19 +211,18 @@ void SessionManager::NotifySessionState(SessionState state) { void SessionManager::StartSession(absl::Notification& notification) { session_hwnd_ = CreateNearbyWindow(); if (session_hwnd_ == nullptr) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to create session Window."; + LOG(ERROR) << __func__ << ": Failed to create session Window."; return; } if (!WTSRegisterSessionNotification(session_hwnd_, NOTIFY_FOR_THIS_SESSION)) { - NEARBY_LOGS(ERROR) << __func__ - << ":Failed to register session notification."; + LOG(ERROR) << __func__ << ":Failed to register session notification."; return; } notification.Notify(); - NEARBY_LOGS(INFO) << __func__ << ": Session thread started."; + LOG(INFO) << __func__ << ": Session thread started."; // Main message loop MSG msg = {}; @@ -237,17 +233,16 @@ void SessionManager::StartSession(absl::Notification& notification) { } if (!WTSUnRegisterSessionNotification(session_hwnd_)) { - NEARBY_LOGS(ERROR) << __func__ - << ": Failed to register session notification."; + LOG(ERROR) << __func__ << ": Failed to register session notification."; return; } if (!UnregisterClassA(/*lpClassName=*/kMessageWindowClass, /*hInstance=*/(HINSTANCE)GetModuleHandle(nullptr))) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to unregister window class."; + LOG(ERROR) << __func__ << ": Failed to unregister window class."; } - NEARBY_LOGS(INFO) << __func__ << ": Completed Message loop."; + LOG(INFO) << __func__ << ": Completed Message loop."; } void SessionManager::StopSession() { diff --git a/internal/platform/implementation/windows/string_utils.cc b/internal/platform/implementation/windows/string_utils.cc new file mode 100644 index 00000000..d7918a62 --- /dev/null +++ b/internal/platform/implementation/windows/string_utils.cc @@ -0,0 +1,113 @@ +// Copyright 2024 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. + +#include "internal/platform/implementation/windows/string_utils.h" + +#include + +#include + +#include "internal/platform/logging.h" + +namespace nearby::windows::string_utils { + +// Converts std::string to wstring +std::wstring StringToWideString(std::string str) { + if (str.empty()) { + return L""; + } + + // https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar + int output_length = + MultiByteToWideChar(/*CodePage=*/CP_UTF8, + /*dwFlags=*/0, + /*lpMultiByteStr=*/str.c_str(), + /*cbMultiByte=*/static_cast(str.length()), + /*lpWideCharStr=*/nullptr, + /*cchWideChar=*/0); + if (output_length == 0) { + return L""; + } + std::wstring output(output_length, L'\0'); + int result = MultiByteToWideChar( + /*CodePage=*/CP_UTF8, /*dwFlags=*/0, /*lpMultiByteStr=*/str.c_str(), + /*cbMultiByte=*/static_cast(str.length()), + /*lpWideCharStr=*/&output[0], + /*cchWideChar=*/output_length); + if (result == 0) { + LOG(INFO) << "Error converting String to Wstring. Error code: " + << GetLastError(); + return L""; + } + return output; +} + +// Converts wstring to std::string +std::string WideStringToString(std::wstring wstr) { + if (wstr.empty()) { + return ""; + } + + std::string output; + size_t start = 0; + size_t index = 0; + + // Iterate over the wstring buffer, chop it into wchar chunks and convert them + // one-by-one + do { + index = wstr.find(L'\0', start); + if (index == std::wstring::npos) index = wstr.length(); + if (start <= wstr.length()) { + // https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte + int size = + WideCharToMultiByte(/*CodePage=*/CP_UTF8, + /*dwFlags=*/WC_ERR_INVALID_CHARS, + /*lpWideCharStr=*/&wstr[start], + /*cchWideChar=*/static_cast(index - start), + /*lpMultiByteStr=*/nullptr, + /*cbMultiByte=*/0, + /*lpDefaultChar=*/nullptr, + /*lpUsedDefaultChar=*/nullptr); + if (size == 0) { + return ""; + } + std::string converted_chunk = std::string(size, '\0'); + int result = WideCharToMultiByte( + /*CodePage=*/CP_UTF8, /*dwFlags=*/WC_ERR_INVALID_CHARS, + /*lpWideCharStr=*/&wstr[start], + /*cchWideChar=*/static_cast(index - start), + /*lpMultiByteStr=*/&converted_chunk[0], + /*cbMultiByte=*/static_cast(converted_chunk.size()), + /*lpDefaultChar=*/nullptr, + /*lpUsedDefaultChar=*/nullptr); + if (result == 0) { + LOG(INFO) << "Error converting Wstring to String. Error code: " + << GetLastError(); + return ""; + } + output.append(converted_chunk); + // Append '\0' to handle the case of {wstring \0 wstring \0 wstring} -> + // {string \0 string \0 string} + if (index < wstr.length()) { + LOG(INFO) << "Appending a null byte to string"; + output.append(1, '\0'); + } + } + start = index + 1; + } while (index != std::wstring::npos && start < wstr.length()); + + return output; +} + +} // namespace nearby::windows::string_utils diff --git a/internal/platform/implementation/windows/string_utils.h b/internal/platform/implementation/windows/string_utils.h new file mode 100644 index 00000000..820f0b5d --- /dev/null +++ b/internal/platform/implementation/windows/string_utils.h @@ -0,0 +1,29 @@ +// Copyright 2024 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_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_STRING_UTILS_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_STRING_UTILS_H_ + +#include + +namespace nearby::windows::string_utils { + +// Converts UTF-8 encoded string to wstring +std::wstring StringToWideString(std::string str); +// Converts wstring to UTF-8 encoded string +std::string WideStringToString(std::wstring wstr); + +} // namespace nearby::windows::string_utils + +#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_STRING_UTILS_H_ diff --git a/internal/platform/implementation/windows/string_utils_test.cc b/internal/platform/implementation/windows/string_utils_test.cc new file mode 100644 index 00000000..95512375 --- /dev/null +++ b/internal/platform/implementation/windows/string_utils_test.cc @@ -0,0 +1,190 @@ +// Copyright 2024 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. +#include "internal/platform/implementation/windows/string_utils.h" + +#include +#include + +#include "gtest/gtest.h" + +namespace nearby::windows::string_utils { + +const wchar_t* const kConvertRoundtripCasesWide[] = { + L"Hello World!", + L"Quick Share for Windows", + // "附近分享 蓝牙 无线传送 »" + L"\x9644\x8fd1\x5206\x4eab\x0020\x84dd\x7259\x0020\x65e0\x7ebf\x4f20\x9001" + L"\x0020\x00bb", + // "近隣のシェア" + L"\x8fd1\x96a3\x306e\x30b7\x30a7\x30a2", + // "주변 공유" + L"\xc8fc\xbcc0\x0020\xacf5\xc720", + // "आस-पास साझा करें" + L"\x0906\x0938\x002d\x092a\x093e\x0938\x0020\x0938\x093e\x091d\x093e\x0020" + L"\x0915\x0930\x0947\x0902", + // "அருகிலுள்ள பகிர்வு" + L"\x0b85\x0bb0\x0bc1\x0b95\x0bbf\x0bb2\x0bc1\x0bb3\x0bcd\x0bb3\x0020\x0baa" + L"\x0b95\x0bbf\x0bb0\x0bcd\x0bb5\x0bc1", +}; + +const wchar_t* const kWideStringWithNull[] = { + L"A" L"\0" L"B" L"\0" L"C", + L"Hello World!" + L"\0" + L"Quick Share for Windows" + L"\0" + // "附近分享 蓝牙 无线传送 »" + L"\x9644\x8fd1\x5206\x4eab\x0020\x84dd\x7259\x0020\x65e0\x7ebf\x4f20\x9001" + L"\x0020\x00bb", +}; + +const wchar_t* const kSymbolsWideString[] = { + // ????? (Mathematical Alphanumeric Symbols (U+011d40 - U+011d44 : + // A,B,C,D,E) + L"\xd807\xdd40\xd807\xdd41\xd807\xdd42\xd807\xdd43\xd807\xdd44", +}; + +const char* const kConvertRoundtripCases[] = { + "Hello World!", + "Quick Share for Windows", + "附近分享 蓝牙 无线传送 »", + "近隣のシェア", + "주변 공유", + "आस-पास साझा करें", + "அருகிலுள்ள பகிர்வு", +}; + +const char* const kStringWithNull[] = { + "A" "\0" "B" "\0" "C", + "Hello World!" + "\0" + "Quick Share for Windows" + "\0" + "附近分享 蓝牙 无线传送 »", +}; + +const char* const kStringWithoutNull[] = { + "ABC", + "Hello World!" + "Quick Share for Windows" + "附近分享 蓝牙 无线传送 »", +}; + +const char* const kIllegalString[] = { + "™©pj·žÅ", // base64 decoded string of "malware.exe" +}; + +TEST(StringUtilsTests, ConvertWideStringToString) { + int count = sizeof(kConvertRoundtripCasesWide) / + sizeof(kConvertRoundtripCasesWide[0]); + for (int i = 0; i < count; ++i) { + std::ostringstream utf8; + utf8 << WideStringToString(kConvertRoundtripCasesWide[i]); + EXPECT_EQ(utf8.str(), kConvertRoundtripCases[i]); + } + + count = sizeof(kWideStringWithNull) / + sizeof(kWideStringWithNull[0]); + for (int i = 0; i < count; ++i) { + std::ostringstream utf8; + utf8 << WideStringToString(kWideStringWithNull[i]); + EXPECT_EQ(utf8.str(), kStringWithNull[i]); + EXPECT_NE(utf8.str(), kStringWithoutNull[i]); + } +} + +TEST(StringUtilsTests, ConvertWideStringToStringRoundTrip) { + // we round-trip all the wide strings through UTF-8 to make sure everything + // agrees on the conversion. This uses the stream operators to test them + // simultaneously. + for (auto* i : kConvertRoundtripCasesWide) { + std::ostringstream utf8; + utf8 << WideStringToString(i); + std::wostringstream wide; + wide << StringToWideString(utf8.str()); + + EXPECT_EQ(i, wide.str()); + } + + for (auto* i : kSymbolsWideString) { + std::ostringstream utf8; + utf8 << WideStringToString(i); + std::wostringstream wide; + wide << StringToWideString(utf8.str()); + + EXPECT_EQ(i, wide.str()); + } + + for (auto* i : kWideStringWithNull) { + std::ostringstream utf8; + utf8 << WideStringToString(i); + std::wostringstream wide; + wide << StringToWideString(utf8.str()); + + EXPECT_EQ(i, wide.str()); + } +} + +TEST(StringUtilsTests, ConvertStringToWideString) { + int count = sizeof(kConvertRoundtripCasesWide) / + sizeof(kConvertRoundtripCasesWide[0]); + for (int i = 0; i < count; ++i) { + std::wostringstream wide; + wide << StringToWideString(kConvertRoundtripCases[i]); + EXPECT_EQ(wide.str(), kConvertRoundtripCasesWide[i]); + } +} + +TEST(StringUtilsTests, ConvertStringToWideStringRoundTrip) { + // we round-trip all the wide strings through UTF-8 to make sure everything + // agrees on the conversion. This uses the stream operators to test them + // simultaneously. + for (auto* i : kConvertRoundtripCases) { + std::wostringstream wide; + wide << StringToWideString(i); + std::ostringstream utf8; + utf8 << WideStringToString(wide.str()); + + EXPECT_EQ(i, utf8.str()); + } + + for (auto* i : kIllegalString) { + std::wostringstream wide; + wide << StringToWideString(i); + std::ostringstream utf8; + utf8 << WideStringToString(wide.str()); + + EXPECT_EQ(i, utf8.str()); + } + + for (auto* i : kStringWithNull) { + std::wostringstream wide; + wide << StringToWideString(i); + std::ostringstream utf8; + utf8 << WideStringToString(wide.str()); + + EXPECT_EQ(i, utf8.str()); + } +} + +TEST(StringUtilsTests, ConvertEmptyStringAndWideString) { + // An empty std::wstring should be converted to an empty std::string, + // and vice versa. + std::wstring wide_empty; + std::string empty; + EXPECT_EQ(empty, WideStringToString(wide_empty)); + EXPECT_EQ(wide_empty, StringToWideString(empty)); +} + +} // namespace nearby::windows::string_utils diff --git a/internal/platform/implementation/windows/submittable_executor.cc b/internal/platform/implementation/windows/submittable_executor.cc index 21082442..a50f029f 100644 --- a/internal/platform/implementation/windows/submittable_executor.cc +++ b/internal/platform/implementation/windows/submittable_executor.cc @@ -14,9 +14,11 @@ #include "internal/platform/implementation/windows/submittable_executor.h" +#include + #include "internal/platform/implementation/windows/executor.h" #include "internal/platform/logging.h" - +#include "internal/platform/runnable.h" namespace nearby { namespace windows { @@ -32,8 +34,8 @@ bool SubmittableExecutor::DoSubmit(Runnable&& wrapped_callable) { return true; } - NEARBY_LOGS(ERROR) << "Error: " << __func__ - << ": Attempt to DoSubmit on a shutdown executor."; + LOG(ERROR) << "Error: " << __func__ + << ": Attempt to DoSubmit on a shutdown executor."; return false; } @@ -43,8 +45,8 @@ void SubmittableExecutor::Execute(Runnable&& runnable) { if (!shut_down_) { executor_->Execute(std::move(runnable)); } else { - NEARBY_LOGS(ERROR) << "Error: " << __func__ - << ": Attempt to Execute on a shutdown executor."; + LOG(ERROR) << "Error: " << __func__ + << ": Attempt to Execute on a shutdown executor."; } } @@ -55,8 +57,8 @@ void SubmittableExecutor::Shutdown() { shut_down_ = true; } - NEARBY_LOGS(ERROR) << "Error: " << __func__ - << ": Attempt to Shutdown on a shutdown executor."; + LOG(ERROR) << "Error: " << __func__ + << ": Attempt to Shutdown on a shutdown executor."; } } // namespace windows diff --git a/internal/platform/implementation/windows/submittable_executor.h b/internal/platform/implementation/windows/submittable_executor.h index 5aab7715..a75d6540 100644 --- a/internal/platform/implementation/windows/submittable_executor.h +++ b/internal/platform/implementation/windows/submittable_executor.h @@ -15,8 +15,13 @@ #ifndef PLATFORM_IMPL_WINDOWS_SUBMITTABLE_EXECUTOR_H_ #define PLATFORM_IMPL_WINDOWS_SUBMITTABLE_EXECUTOR_H_ +#include +#include +#include + #include "internal/platform/implementation/submittable_executor.h" #include "internal/platform/implementation/windows/executor.h" +#include "internal/platform/runnable.h" namespace nearby { namespace windows { @@ -28,7 +33,7 @@ namespace windows { class SubmittableExecutor : public api::SubmittableExecutor { public: SubmittableExecutor(); - SubmittableExecutor(int32_t maxConcurrancy); + explicit SubmittableExecutor(int32_t max_concurrancy); ~SubmittableExecutor() override = default; // Submit a callable (with no delay). diff --git a/internal/platform/implementation/windows/task_scheduler.cc b/internal/platform/implementation/windows/task_scheduler.cc new file mode 100644 index 00000000..cfc08f43 --- /dev/null +++ b/internal/platform/implementation/windows/task_scheduler.cc @@ -0,0 +1,209 @@ +// Copyright 2024 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. + +#include "internal/platform/implementation/windows/task_scheduler.h" + +#include + +#include +#include +#include + +#include "absl/synchronization/mutex.h" +#include "absl/time/time.h" +#include "internal/platform/implementation/cancelable.h" +#include "internal/platform/logging.h" +#include "internal/platform/runnable.h" + +namespace nearby::windows { +namespace { +void CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired) { + Runnable* task = reinterpret_cast(lpParam); + if (task != nullptr) { + (*task)(); + } +} +} // namespace + +TaskScheduler::TaskScheduler() { + LOG(INFO) << __func__ << ": Created task scheduler: " << this; +} + +TaskScheduler::~TaskScheduler() { + Shutdown(); + LOG(INFO) << __func__ << ": Destroyed task scheduler: " << this; +} + +std::shared_ptr TaskScheduler::Schedule( + Runnable&& runnable, absl::Duration duration) { + return Schedule(std::move(runnable), duration, absl::ZeroDuration()); +} + +std::shared_ptr TaskScheduler::Schedule( + Runnable&& runnable, absl::Duration duration, + absl::Duration repeat_interval) { + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": Scheduling task on task scheduler:" << this + << ", duration: " << absl::ToInt64Milliseconds(duration) + << "ms, repeat_interval: " + << absl::ToInt64Milliseconds(repeat_interval) << "ms"; + if (is_shutdown_) { + LOG(ERROR) << __func__ + << ": Attempt to schedule task on a shut down task " + "scheduler: " + << this; + return nullptr; + } + + // Clear all cancelled tasks. + CleanScheduledTasks(); + + std::shared_ptr task = std::make_shared( + *this, std::move(runnable), repeat_interval != absl::ZeroDuration()); + + HANDLE timer_handle = nullptr; + if (!CreateTimerQueueTimer(&timer_handle, nullptr, + static_cast(TimerRoutine), + task->runnable(), + absl::ToInt64Milliseconds(duration), + absl::ToInt64Milliseconds(repeat_interval), 0)) { + LOG(ERROR) << __func__ + << ": Failed to create timer queue timer in task scheduler:" + << this << " error: " << GetLastError(); + return nullptr; + } + + task->set_timer_handle(reinterpret_cast(timer_handle)); + scheduled_tasks_.insert({reinterpret_cast(timer_handle), task}); + LOG(INFO) << __func__ << ": Scheduled task " << task.get() + << " on task scheduler:" << this + << " timer handle: " << task->timer_handle(); + return task; +} + +void TaskScheduler::Shutdown() { + absl::MutexLock lock(&mutex_); + LOG(INFO) << __func__ << ": Shutting down task scheduler:" << this; + if (is_shutdown_) { + return; + } + for (auto& task : scheduled_tasks_) { + if (task.second->is_cancelled()) { + continue; + } + // Wait for running task to finish. + if (!DeleteTimerQueueTimer( + nullptr, reinterpret_cast(task.second->timer_handle()), + INVALID_HANDLE_VALUE)) { + if (GetLastError() != ERROR_IO_PENDING) { + LOG(ERROR) << __func__ << ": Failed to delete timer queue timer: " + << task.second->timer_handle() + << " error: " << GetLastError(); + } + } + } + scheduled_tasks_.clear(); + is_shutdown_ = true; + LOG(INFO) << __func__ << ": Shut down task scheduler:" << this; +} + +TaskScheduler::ScheduledTask::ScheduledTask(TaskScheduler& task_scheduler, + Runnable&& runnable, + bool is_repeated) + : task_scheduler_(&task_scheduler), is_repeated_(is_repeated) { + runnable_ = [this, runnable = std::move(runnable)]() mutable { + { + absl::MutexLock lock(&mutex_); + is_executed_ = true; + } + if (runnable) { + runnable(); + } + }; +} + +bool TaskScheduler::ScheduledTask::Cancel() { + LOG(INFO) << __func__ << ": Cancelling timer " << timer_handle() + << " from task scheduler:" << this; + { + absl::MutexLock lock(&mutex_); + if (is_cancelled_) { + return false; + } + is_cancelled_ = true; + } + + bool result = task_scheduler_->CancelScheduledTask(timer_handle()); + { + absl::MutexLock lock(&mutex_); + if (!is_repeated_ && is_executed_) { + result = false; + } + } + return result; +} + +void TaskScheduler::ScheduledTask::set_timer_handle(intptr_t timer_handle) { + absl::MutexLock lock(&mutex_); + timer_handle_ = timer_handle; +} + +Runnable* TaskScheduler::ScheduledTask::runnable() { + absl::MutexLock lock(&mutex_); + return &runnable_; +} + +intptr_t TaskScheduler::ScheduledTask::timer_handle() const { + absl::MutexLock lock(&mutex_); + return timer_handle_; +} + +bool TaskScheduler::ScheduledTask::is_cancelled() const { + absl::MutexLock lock(&mutex_); + return is_cancelled_; +} + +bool TaskScheduler::CancelScheduledTask(intptr_t timer_handle) { + absl::MutexLock lock(&mutex_); + auto it = scheduled_tasks_.find(timer_handle); + if (it == scheduled_tasks_.end()) { + return false; + } + + // Wait for running task to finish. + if (!DeleteTimerQueueTimer(nullptr, reinterpret_cast(timer_handle), + INVALID_HANDLE_VALUE)) { + if (GetLastError() != ERROR_IO_PENDING) { + LOG(ERROR) << __func__ + << ": Failed to delete timer queue timer: " << timer_handle + << " error: " << GetLastError(); + return false; + } + } + + return true; +} + +void TaskScheduler::CleanScheduledTasks() { + auto it = scheduled_tasks_.begin(); + while (it != scheduled_tasks_.end()) { + if (it->second->is_cancelled()) { + scheduled_tasks_.erase(it++); + } else { + ++it; + } + } +} + +} // namespace nearby::windows diff --git a/internal/platform/implementation/windows/task_scheduler.h b/internal/platform/implementation/windows/task_scheduler.h new file mode 100644 index 00000000..da66328a --- /dev/null +++ b/internal/platform/implementation/windows/task_scheduler.h @@ -0,0 +1,85 @@ +// Copyright 2024 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_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_TASK_SCHEDULER_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_TASK_SCHEDULER_H_ + +#include +#include + +#include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "absl/synchronization/mutex.h" +#include "absl/time/time.h" +#include "internal/platform/implementation/cancelable.h" +#include "internal/platform/runnable.h" + +namespace nearby::windows { + +// TaskScheduler is a utility class to scheduled a runnable task. It is used by +// the ScheduledExecutor and timer implementations. +class TaskScheduler { + public: + TaskScheduler(); + ~TaskScheduler(); + + std::shared_ptr Schedule(Runnable&& runnable, + absl::Duration duration); + + std::shared_ptr Schedule(Runnable&& runnable, + absl::Duration duration, + absl::Duration repeat_interval) + ABSL_LOCKS_EXCLUDED(mutex_); + + void Shutdown() ABSL_LOCKS_EXCLUDED(mutex_); + + private: + class ScheduledTask : public api::Cancelable { + public: + explicit ScheduledTask(TaskScheduler& task_scheduler, Runnable&& runnable, + bool is_repeated); + ~ScheduledTask() override = default; + + // Note: not support to cancel and shutdown a scheduled task in the + // callback. + // when task is cancelled or executed, return false, otherwise return true. + bool Cancel() override ABSL_LOCKS_EXCLUDED(mutex_); + bool is_cancelled() const ABSL_LOCKS_EXCLUDED(mutex_); + + intptr_t timer_handle() const ABSL_LOCKS_EXCLUDED(mutex_); + void set_timer_handle(intptr_t timer_handle) ABSL_LOCKS_EXCLUDED(mutex_); + Runnable* runnable() ABSL_LOCKS_EXCLUDED(mutex_); + + private: + mutable absl::Mutex mutex_; + TaskScheduler* const task_scheduler_; + Runnable runnable_ ABSL_GUARDED_BY(mutex_); + intptr_t timer_handle_ ABSL_GUARDED_BY(mutex_); + bool is_cancelled_ ABSL_GUARDED_BY(mutex_) = false; + bool is_executed_ ABSL_GUARDED_BY(mutex_) = false; + bool is_repeated_ ABSL_GUARDED_BY(mutex_) = false; + }; + + bool CancelScheduledTask(intptr_t timer_handle) ABSL_LOCKS_EXCLUDED(mutex_); + void CleanScheduledTasks() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + + absl::Mutex mutex_; + bool is_shutdown_ ABSL_GUARDED_BY(mutex_) = false; + absl::flat_hash_map> scheduled_tasks_ + ABSL_GUARDED_BY(mutex_); +}; + +} // namespace nearby::windows + +#endif // THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_WINDOWS_TASK_SCHEDULER_H_ diff --git a/internal/platform/implementation/windows/task_scheduler_test.cc b/internal/platform/implementation/windows/task_scheduler_test.cc new file mode 100644 index 00000000..bc762fa2 --- /dev/null +++ b/internal/platform/implementation/windows/task_scheduler_test.cc @@ -0,0 +1,113 @@ +// Copyright 2024 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. + +#include "internal/platform/implementation/windows/task_scheduler.h" + +#include +#include + +#include "gtest/gtest.h" +#include "absl/synchronization/notification.h" +#include "absl/time/clock.h" +#include "absl/time/time.h" + +namespace nearby::windows { + +namespace { +constexpr absl::Duration kTaskDuration = absl::Milliseconds(500); + +TEST(TaskScheduler, ScheduleOneTask) { + TaskScheduler task_scheduler; + int counter = 0; + absl::Notification notification; + auto task = [&counter, ¬ification]() { + counter++; + notification.Notify(); + }; + auto cancelable = task_scheduler.Schedule(task, absl::Milliseconds(100)); + EXPECT_NE(cancelable, nullptr); + EXPECT_TRUE(notification.WaitForNotificationWithTimeout(kTaskDuration)); + EXPECT_EQ(counter, 1); +} + +TEST(TaskScheduler, ScheduleOneEarlierTaskAfterOneTask) { + TaskScheduler task_scheduler; + std::vector result; + absl::Notification notification1; + absl::Notification notification2; + auto task1 = [&result, ¬ification1]() { + result.push_back(1); + notification1.Notify(); + }; + + auto task2 = [&result, ¬ification2]() { + result.push_back(2); + notification2.Notify(); + }; + task_scheduler.Schedule(task1, absl::Milliseconds(100)); + task_scheduler.Schedule(task2, absl::Milliseconds(50)); + EXPECT_TRUE(notification1.WaitForNotificationWithTimeout(kTaskDuration)); + EXPECT_TRUE(notification2.WaitForNotificationWithTimeout(kTaskDuration)); + ASSERT_EQ(result.size(), 2); + EXPECT_EQ(result.at(0), 2); + EXPECT_EQ(result.at(1), 1); +} + +TEST(TaskScheduler, CancelScheduledTask) { + TaskScheduler task_scheduler; + int counter = 0; + absl::Notification notification; + auto task = [&counter, ¬ification]() { + counter++; + notification.Notify(); + }; + auto cancelable = task_scheduler.Schedule(task, absl::Milliseconds(200)); + cancelable->Cancel(); + EXPECT_FALSE(notification.WaitForNotificationWithTimeout(kTaskDuration)); + EXPECT_EQ(counter, 0); +} + +TEST(TaskScheduler, ShundownShouldWaitForScheduledTaskToFinish) { + TaskScheduler task_scheduler; + int counter = 0; + absl::Notification notification; + auto task = [&counter, ¬ification]() { + absl::SleepFor(kTaskDuration); + counter++; + notification.Notify(); + }; + auto cancelable = task_scheduler.Schedule(task, absl::Milliseconds(100)); + absl::SleepFor(absl::Milliseconds(200)); + task_scheduler.Shutdown(); + EXPECT_EQ(counter, 1); +} + +TEST(TaskScheduler, CancelCancleledScheduledTask) { + TaskScheduler task_scheduler; + int counter = 0; + absl::Notification notification; + auto task = [&counter, ¬ification]() { + absl::SleepFor(kTaskDuration); + counter++; + notification.Notify(); + }; + auto cancelable = task_scheduler.Schedule(task, absl::Milliseconds(200)); + EXPECT_TRUE(cancelable->Cancel()); + EXPECT_FALSE(cancelable->Cancel()); + task_scheduler.Shutdown(); + EXPECT_EQ(counter, 0); +} + +} // namespace +} // namespace nearby::windows diff --git a/internal/platform/implementation/windows/test_utils.cc b/internal/platform/implementation/windows/test_utils.cc index bbde32e8..9f4544e0 100644 --- a/internal/platform/implementation/windows/test_utils.cc +++ b/internal/platform/implementation/windows/test_utils.cc @@ -17,10 +17,13 @@ #include #include +#include #include +#include #include "absl/strings/str_format.h" #include "absl/strings/str_replace.h" +#include "internal/platform/payload_id.h" namespace test_utils { std::wstring StringToWideString(const std::string& s) { @@ -44,7 +47,7 @@ std::string GetPayloadPath(nearby::PayloadId payload_id) { FOLDERID_Downloads, // rfid: A reference to the KNOWNFOLDERID that // identifies the folder. 0, // dwFlags: Flags that specify special retrieval options. - NULL, // hToken: An access token that represents a particular user. + nullptr, // hToken: An access token that represents a particular user. &basePath); // ppszPath: When this method returns, contains the address // of a pointer to a null-terminated Unicode string that // specifies the path of the known folder. The calling @@ -54,8 +57,8 @@ std::string GetPayloadPath(nearby::PayloadId payload_id) { size_t bufferSize; // Get the required buffer size. - wcstombs_s(&bufferSize, NULL, 0, basePath, 0); - std::string fullpathUTF8(bufferSize, NULL); + wcstombs_s(&bufferSize, nullptr, 0, basePath, 0); + std::string fullpathUTF8(bufferSize, 0); wcstombs_s(&bufferSize, fullpathUTF8.data(), bufferSize, basePath, _TRUNCATE); std::string fullPath = std::string(fullpathUTF8); // Clean up the string by removing null's diff --git a/internal/platform/implementation/windows/thread_pool.cc b/internal/platform/implementation/windows/thread_pool.cc index dfbcb644..e823d4fd 100644 --- a/internal/platform/implementation/windows/thread_pool.cc +++ b/internal/platform/implementation/windows/thread_pool.cc @@ -16,12 +16,13 @@ #include +#include #include #include #include "absl/memory/memory.h" #include "absl/synchronization/mutex.h" -#include "internal/platform/count_down_latch.h" +#include "internal/platform/implementation/shared/count_down_latch.h" #include "internal/platform/logging.h" #include "internal/platform/runnable.h" @@ -44,16 +45,15 @@ std::unique_ptr ThreadPool::Create(int max_pool_size) { InitializeThreadpoolEnvironment(&thread_pool_environ); if (max_pool_size <= 0) { - NEARBY_LOGS(ERROR) << __func__ - << ": Maximum pool size must be positive integer value."; + LOG(ERROR) << __func__ + << ": Maximum pool size must be positive integer value."; return nullptr; } thread_pool = CreateThreadpool(NULL); if (thread_pool == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": failed to create thread pool. LastError: " - << GetLastError(); + LOG(ERROR) << __func__ << ": failed to create thread pool. LastError: " + << GetLastError(); return nullptr; } @@ -61,9 +61,9 @@ std::unique_ptr ThreadPool::Create(int max_pool_size) { // it will keep at least one thread. SetThreadpoolThreadMaximum(thread_pool, max_pool_size); if (!SetThreadpoolThreadMinimum(thread_pool, 1)) { - NEARBY_LOGS(ERROR) - << __func__ << ": failed to set minimum thread pool size. LastError: " - << GetLastError(); + LOG(ERROR) << __func__ + << ": failed to set minimum thread pool size. LastError: " + << GetLastError(); CloseThreadpool(thread_pool); return nullptr; } @@ -83,13 +83,12 @@ ThreadPool::ThreadPool(PTP_POOL thread_pool, : thread_pool_(thread_pool), thread_pool_environ_(thread_pool_environ), max_pool_size_(max_pool_size) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Thread pool(" << this - << ") is created with size:" << max_pool_size_; + VLOG(1) << __func__ << ": Thread pool(" << this + << ") is created with size:" << max_pool_size_; } ThreadPool::~ThreadPool() { - NEARBY_LOGS(VERBOSE) << __func__ << ": Thread pool(" << this - << ") is released."; + VLOG(1) << __func__ << ": Thread pool(" << this << ") is released."; if (thread_pool_ == nullptr) { return; @@ -106,20 +105,18 @@ bool ThreadPool::Run(Runnable task) { } if (shutdown_latch_ != nullptr) { - NEARBY_LOGS(WARNING) << __func__ << ": Thread pool is in shutting down."; + LOG(WARNING) << __func__ << ": Thread pool is in shutting down."; return false; } PTP_WORK work; tasks_.push(std::move(task)); - NEARBY_LOGS(VERBOSE) << __func__ << ": Scheduled to run task(" - << &tasks_.back() << ")."; + VLOG(1) << __func__ << ": Scheduled to run task(" << &tasks_.back() << ")."; work = CreateThreadpoolWork(WorkCallback, this, &thread_pool_environ_); if (work == nullptr) { - NEARBY_LOGS(ERROR) << __func__ - << ": failed to create thread pool work. LastError: " - << GetLastError(); + LOG(ERROR) << __func__ << ": failed to create thread pool work. LastError: " + << GetLastError(); return false; } @@ -138,29 +135,27 @@ void ThreadPool::ShutDown() { absl::MutexLock lock(&mutex_); if (thread_pool_ == nullptr) { - NEARBY_LOGS(WARNING) << __func__ << ": Shutdown on closed thread pool(" - << this << ")."; + LOG(WARNING) << __func__ << ": Shutdown on closed thread pool(" << this + << ")."; return; } if (running_tasks_count_ == 0) { CloseThreadpool(thread_pool_); thread_pool_ = nullptr; - NEARBY_LOGS(VERBOSE) << __func__ << ": Thread pool(" << this - << ") is shut down."; + VLOG(1) << __func__ << ": Thread pool(" << this << ") is shut down."; return; } if (shutdown_latch_ != nullptr) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Thread pool(" << this - << ") is already in shutting down."; + VLOG(1) << __func__ << ": Thread pool(" << this + << ") is already in shutting down."; return; } - NEARBY_LOGS(VERBOSE) << __func__ << ": Thread pool(" << this - << ") is shutting down."; + VLOG(1) << __func__ << ": Thread pool(" << this << ") is shutting down."; - shutdown_latch_ = std::make_unique(1); + shutdown_latch_ = std::make_unique(1); } // Wait for all tasks to complete. @@ -170,8 +165,7 @@ void ThreadPool::ShutDown() { absl::MutexLock lock(&mutex_); CloseThreadpool(thread_pool_); thread_pool_ = nullptr; - NEARBY_LOGS(VERBOSE) << __func__ << ": Thread pool(" << this - << ") is shut down."; + VLOG(1) << __func__ << ": Thread pool(" << this << ") is shut down."; } } @@ -185,15 +179,14 @@ void ThreadPool::RunNextTask() { return; } if (!tasks_.empty()) { - NEARBY_LOGS(VERBOSE) << __func__ << ": Run task(" << &tasks_.front() - << ")."; + VLOG(1) << __func__ << ": Run task(" << &tasks_.front() << ")."; task = std::move(tasks_.front()); tasks_.pop(); if (task == nullptr) { - NEARBY_LOGS(WARNING) - << __func__ << ": Tried to run task in an empty thread pool."; + LOG(WARNING) << __func__ + << ": Tried to run task in an empty thread pool."; --running_tasks_count_; if (running_tasks_count_ == 0 && shutdown_latch_ != nullptr) { shutdown_latch_->CountDown(); diff --git a/internal/platform/implementation/windows/thread_pool.h b/internal/platform/implementation/windows/thread_pool.h index 9e9207ea..9d7a2125 100644 --- a/internal/platform/implementation/windows/thread_pool.h +++ b/internal/platform/implementation/windows/thread_pool.h @@ -23,7 +23,7 @@ #include "absl/base/thread_annotations.h" #include "absl/synchronization/mutex.h" -#include "internal/platform/count_down_latch.h" +#include "internal/platform/implementation/shared/count_down_latch.h" #include "internal/platform/runnable.h" namespace nearby { @@ -68,7 +68,7 @@ class ThreadPool { int running_tasks_count_ ABSL_GUARDED_BY(mutex_) = 0; // The latch is used to wait for running tasks - std::unique_ptr shutdown_latch_ = nullptr; + std::unique_ptr shutdown_latch_ = nullptr; friend VOID CALLBACK WorkCallback(PTP_CALLBACK_INSTANCE instance, PVOID parameter, PTP_WORK work); diff --git a/internal/platform/implementation/windows/timer.cc b/internal/platform/implementation/windows/timer.cc index c27846ef..61841ebf 100644 --- a/internal/platform/implementation/windows/timer.cc +++ b/internal/platform/implementation/windows/timer.cc @@ -14,81 +14,128 @@ #include "internal/platform/implementation/windows/timer.h" +#include #include +#include +#include "absl/functional/any_invocable.h" #include "absl/synchronization/mutex.h" +#include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/logging.h" +#include "internal/platform/runnable.h" namespace nearby { namespace windows { +Timer::Timer() + : use_task_scheduler_(NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableTaskScheduler)) {} + Timer::~Timer() { Stop(); } bool Timer::Create(int delay, int interval, absl::AnyInvocable callback) { - absl::MutexLock lock(&mutex_); - - if ((delay < 0) || (interval < 0)) { - NEARBY_LOGS(WARNING) << "Delay and interval shouldn\'t be negative value."; - return false; - } - - if (timer_queue_handle_ != nullptr) { - return false; - } - - timer_queue_handle_ = CreateTimerQueue(); - if (timer_queue_handle_ == nullptr) { - NEARBY_LOGS(ERROR) << "Failed to create timer queue."; - return false; - } - - delay_ = delay; - interval_ = interval; - callback_ = std::move(callback); - - if (!CreateTimerQueueTimer(&handle_, timer_queue_handle_, - static_cast(TimerRoutine), - &callback_, delay, interval, WT_EXECUTEDEFAULT)) { - if (!DeleteTimerQueueEx(timer_queue_handle_, nullptr)) { - NEARBY_LOGS(ERROR) << "Failed to create timer in timer queue."; + if (use_task_scheduler_) { + absl::MutexLock lock(&mutex_); + if ((delay < 0) || (interval < 0)) { + LOG(WARNING) << "Delay and interval shouldn\'t be negative value."; + return false; } - timer_queue_handle_ = nullptr; - return false; - } - return true; + if (cancelable_task_) { + return false; + } + callback_ = std::move(callback); + std::function internal_callback = [this]() { + if (callback_ != nullptr) { + callback_(); + } + }; + cancelable_task_ = task_scheduler_.Schedule(std::move(internal_callback), + absl::Milliseconds(delay), + absl::Milliseconds(interval)); + return cancelable_task_ != nullptr; + } else { + absl::MutexLock lock(&mutex_); + + if ((delay < 0) || (interval < 0)) { + LOG(WARNING) << "Delay and interval shouldn\'t be negative value."; + return false; + } + + if (timer_queue_handle_ != nullptr) { + return false; + } + + timer_queue_handle_ = CreateTimerQueue(); + if (timer_queue_handle_ == nullptr) { + LOG(ERROR) << "Failed to create timer queue."; + return false; + } + + delay_ = delay; + interval_ = interval; + callback_ = std::move(callback); + + if (!CreateTimerQueueTimer(&handle_, timer_queue_handle_, + static_cast(TimerRoutine), + &callback_, delay, interval, + WT_EXECUTEDEFAULT)) { + if (!DeleteTimerQueueEx(timer_queue_handle_, nullptr)) { + LOG(ERROR) << "Failed to create timer in timer queue."; + } + timer_queue_handle_ = nullptr; + return false; + } + + return true; + } } bool Timer::Stop() { - absl::MutexLock lock(&mutex_); + if (use_task_scheduler_) { + absl::MutexLock lock(&mutex_); + if (cancelable_task_ == nullptr) { + return true; + } - if (timer_queue_handle_ == nullptr) { - return true; - } + bool result = cancelable_task_->Cancel(); + cancelable_task_ = nullptr; + return result; + } else { + absl::MutexLock lock(&mutex_); - if (!DeleteTimerQueueTimer(timer_queue_handle_, handle_, nullptr)) { - if (GetLastError() != ERROR_IO_PENDING) { - NEARBY_LOGS(ERROR) << "Failed to delete timer from timer queue."; + if (timer_queue_handle_ == nullptr) { + return true; + } + + if (!DeleteTimerQueueTimer(timer_queue_handle_, handle_, nullptr)) { + if (GetLastError() != ERROR_IO_PENDING) { + LOG(ERROR) << "Failed to delete timer from timer queue."; + return false; + } + } + + handle_ = nullptr; + + if (!DeleteTimerQueueEx(timer_queue_handle_, nullptr)) { + LOG(ERROR) << "Failed to delete timer queue."; return false; } + + timer_queue_handle_ = nullptr; + return true; } - - handle_ = nullptr; - - if (!DeleteTimerQueueEx(timer_queue_handle_, nullptr)) { - NEARBY_LOGS(ERROR) << "Failed to delete timer queue."; - return false; - } - - timer_queue_handle_ = nullptr; - return true; } bool Timer::FireNow() { absl::MutexLock lock(&mutex_); - if (!timer_queue_handle_ || !callback_) { + if (!callback_) { + LOG(ERROR) << "callback_ is empty"; return false; } @@ -97,8 +144,7 @@ bool Timer::FireNow() { } if (task_executor_ == nullptr) { - NEARBY_LOGS(ERROR) - << "Failed to fire the task due to cannot create executor."; + LOG(ERROR) << "Failed to fire the task due to cannot create executor."; return false; } diff --git a/internal/platform/implementation/windows/timer.h b/internal/platform/implementation/windows/timer.h index 8b9d9806..7d5b077f 100644 --- a/internal/platform/implementation/windows/timer.h +++ b/internal/platform/implementation/windows/timer.h @@ -18,18 +18,22 @@ #include #include +#include #include "absl/base/thread_annotations.h" +#include "absl/functional/any_invocable.h" #include "absl/synchronization/mutex.h" +#include "internal/platform/implementation/cancelable.h" #include "internal/platform/implementation/timer.h" #include "internal/platform/implementation/windows/submittable_executor.h" +#include "internal/platform/implementation/windows/task_scheduler.h" namespace nearby { namespace windows { class Timer : public api::Timer { public: - Timer() = default; + Timer(); ~Timer() override; bool Create(int delay, int interval, @@ -42,6 +46,7 @@ class Timer : public api::Timer { static void CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired); mutable absl::Mutex mutex_; + const bool use_task_scheduler_; int delay_ ABSL_GUARDED_BY(mutex_); int interval_ ABSL_GUARDED_BY(mutex_); absl::AnyInvocable callback_; @@ -49,6 +54,9 @@ class Timer : public api::Timer { HANDLE timer_queue_handle_ ABSL_GUARDED_BY(mutex_) = nullptr; std::unique_ptr task_executor_ ABSL_GUARDED_BY(mutex_) = nullptr; + TaskScheduler task_scheduler_ ABSL_GUARDED_BY(mutex_); + std::shared_ptr cancelable_task_ ABSL_GUARDED_BY(mutex_) = + nullptr; }; } // namespace windows diff --git a/internal/platform/implementation/windows/timer_test.cc b/internal/platform/implementation/windows/timer_test.cc index 725397cd..ff32dd02 100644 --- a/internal/platform/implementation/windows/timer_test.cc +++ b/internal/platform/implementation/windows/timer_test.cc @@ -15,18 +15,36 @@ #include "internal/platform/implementation/timer.h" #include // NOLINT -// NOLINT #include #include // NOLINT #include "gtest/gtest.h" +#include "absl/synchronization/notification.h" +#include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/count_down_latch.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/implementation/platform.h" namespace nearby { namespace windows { namespace { -TEST(Timer, TestCreateTimer) { +class TimerTest : public ::testing::TestWithParam { + public: + void SetUp() override { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + platform::config_package_nearby::nearby_platform_feature:: + kEnableTaskScheduler, + GetParam()); + } + + void TearDown() override { + NearbyFlags::GetInstance().ResetOverridedValues(); + } +}; + +TEST_P(TimerTest, TestCreateTimer) { int count = 0; std::unique_ptr timer = @@ -38,31 +56,44 @@ TEST(Timer, TestCreateTimer) { } // This test case cannot run on Google3 -TEST(Timer, DISABLED_TestRepeatTimer) { +TEST_P(TimerTest, TestRepeatTimer) { + CountDownLatch latch(3); int count = 0; - std::unique_ptr timer = nearby::api::ImplementationPlatform::CreateTimer(); ASSERT_TRUE(timer != nullptr); - EXPECT_TRUE(timer->Create(300, 300, [&]() { ++count; })); - std::this_thread::sleep_for(std::chrono::seconds(1)); - EXPECT_TRUE(timer->Stop()); + EXPECT_TRUE(timer->Create(300, 300, [&]() { + ++count; + latch.CountDown(); + })); + + EXPECT_TRUE(latch.Await(absl::Seconds(2))); EXPECT_EQ(count, 3); + EXPECT_TRUE(timer->Stop()); } -TEST(Timer, DISABLED_TestFireNow) { +TEST_P(TimerTest, TestFireNow) { int count = 0; + absl::Notification notification; auto timer = nearby::api::ImplementationPlatform::CreateTimer(); EXPECT_TRUE(timer != nullptr); - EXPECT_TRUE(timer->Create(3000, 3000, [&]() { ++count; })); + EXPECT_TRUE(timer->Create(3000, 3000, [&count, ¬ification]() { + ++count; + notification.Notify(); + })); EXPECT_TRUE(timer->FireNow()); EXPECT_TRUE(timer->Stop()); + EXPECT_TRUE( + notification.WaitForNotificationWithTimeout(absl::Milliseconds(1000))); EXPECT_EQ(count, 1); } +INSTANTIATE_TEST_SUITE_P(TimerTaskSchedulerFlagTest, TimerTest, + testing::Bool()); + } // namespace } // namespace windows } // namespace nearby diff --git a/internal/platform/implementation/windows/utils.cc b/internal/platform/implementation/windows/utils.cc index 0f852b0e..b3826678 100644 --- a/internal/platform/implementation/windows/utils.cc +++ b/internal/platform/implementation/windows/utils.cc @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,18 +15,20 @@ #include "internal/platform/implementation/windows/utils.h" #include +#include // Standard C/C++ headers #include +#include #include #include +#include #include #include #include // Third party headers #include "absl/strings/ascii.h" -#include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" // Nearby connections headers @@ -34,6 +36,7 @@ #include "internal/platform/bluetooth_utils.h" #include "internal/platform/byte_array.h" #include "internal/platform/implementation/crypto.h" +#include "internal/platform/implementation/windows/string_utils.h" #include "internal/platform/logging.h" #include "internal/platform/uuid.h" #include "winrt/Windows.Foundation.Collections.h" @@ -47,6 +50,7 @@ namespace { using ::winrt::Windows::Networking::HostNameType; using ::winrt::Windows::Networking::Connectivity::NetworkAdapter; using ::winrt::Windows::Networking::Connectivity::NetworkInformation; +using ::winrt::Windows::Networking::Connectivity::NetworkTypes; } // namespace @@ -103,16 +107,6 @@ std::string ipaddr_dotdecimal_to_4bytes_string(std::string ipv4_s) { return std::string(ipv4_b, 4); } -std::wstring string_to_wstring(std::string str) { - std::wstring_convert> converter; - return converter.from_bytes(str); -} - -std::string wstring_to_string(std::wstring wstr) { - std::wstring_convert> converter; - return converter.to_bytes(wstr); -} - std::vector GetIpv4Addresses() { std::vector result; std::vector wifi_addresses; @@ -126,6 +120,11 @@ std::vector GetIpv4Addresses() { host_name.IPInformation().NetworkAdapter() != nullptr && host_name.Type() == HostNameType::Ipv4) { NetworkAdapter adapter = host_name.IPInformation().NetworkAdapter(); + if (adapter.NetworkItem().GetNetworkTypes() == NetworkTypes::None) { + // If we're not connected to a network, we don't want to add this + // address. + continue; + } if (adapter.IanaInterfaceType() == Constants::kInterfaceTypeWifi) { wifi_addresses.push_back(winrt::to_string(host_name.ToString())); } else if (adapter.IanaInterfaceType() == @@ -137,16 +136,13 @@ std::vector GetIpv4Addresses() { } } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot get IPv4 addresses. Exception : " - << exception.what(); + LOG(ERROR) << __func__ << ": Cannot get IPv4 addresses. Exception : " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot get IPv4 addresses. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Cannot get IPv4 addresses. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } result.insert(result.end(), wifi_addresses.begin(), wifi_addresses.end()); @@ -182,8 +178,8 @@ Uuid winrt_guid_to_nearby_uuid(const ::winrt::guid& guid) { int64_t data3 = guid.Data3; int64_t msb = ((data1 >> 24) & 0xff) << 56 | ((data1 >> 16) & 0xff) << 48 | - ((data1 >> 8) & 0xff) << 40 | ((data1)&0xff) << 32 | - ((data2 >> 8) & 0xff) << 24 | ((data2)&0xff) << 16 | + ((data1 >> 8) & 0xff) << 40 | ((data1) & 0xff) << 32 | + ((data2 >> 8) & 0xff) << 24 | ((data2) & 0xff) << 16 | ((data3 >> 8) & 0xff) << 8 | (data3 & 0xff); int64_t lsb = @@ -215,7 +211,7 @@ winrt::guid nearby_uuid_to_winrt_guid(Uuid uuid) { } bool is_nearby_uuid_equal_to_winrt_guid(const Uuid& uuid, - const ::winrt::guid& guid) { + const ::winrt::guid& guid) { return uuid == winrt_guid_to_nearby_uuid(guid); } @@ -242,7 +238,7 @@ bool InspectableReader::ReadBoolean(IInspectable inspectable) { return property_value.GetBoolean(); } -uint16 InspectableReader::ReadUint16(IInspectable inspectable) { +uint16_t InspectableReader::ReadUint16(IInspectable inspectable) { if (inspectable == nullptr) { return 0; } @@ -260,7 +256,7 @@ uint16 InspectableReader::ReadUint16(IInspectable inspectable) { return property_value.GetUInt16(); } -uint32 InspectableReader::ReadUint32(IInspectable inspectable) { +uint32_t InspectableReader::ReadUint32(IInspectable inspectable) { if (inspectable == nullptr) { return 0; } @@ -293,7 +289,8 @@ std::string InspectableReader::ReadString(IInspectable inspectable) { throw std::invalid_argument("not string data type."); } - return wstring_to_string(property_value.GetString().c_str()); + return nearby::windows::string_utils::WideStringToString( + property_value.GetString().c_str()); } std::vector InspectableReader::ReadStringArray( @@ -316,7 +313,7 @@ std::vector InspectableReader::ReadStringArray( winrt::com_array strings; property_value.GetStringArray(strings); - for (winrt::hstring str : strings) { + for (const winrt::hstring& str : strings) { result.push_back(winrt::to_string(str)); } return result; diff --git a/internal/platform/implementation/windows/utils.h b/internal/platform/implementation/windows/utils.h index 96b92c94..61d6f5e6 100644 --- a/internal/platform/implementation/windows/utils.h +++ b/internal/platform/implementation/windows/utils.h @@ -39,8 +39,6 @@ std::string ipaddr_4bytes_to_dotdecimal_string(absl::string_view ipaddr_4bytes); std::string ipaddr_dotdecimal_to_4bytes_string(std::string ipv4_s); // Helpers to windows platform -std::wstring string_to_wstring(std::string str); -std::string wstring_to_string(std::wstring wstr); ByteArray Sha256(absl::string_view input, size_t size); // Reads the IPv4 addresses @@ -75,8 +73,8 @@ const uint16_t kInterfaceTypeWifi = 71; class InspectableReader { public: static bool ReadBoolean(IInspectable inspectable); - static uint16 ReadUint16(IInspectable inspectable); - static uint32 ReadUint32(IInspectable inspectable); + static uint16_t ReadUint16(IInspectable inspectable); + static uint32_t ReadUint32(IInspectable inspectable); static std::string ReadString(IInspectable inspectable); static std::vector ReadStringArray(IInspectable inspectable); }; diff --git a/internal/platform/implementation/windows/webrtc.cc b/internal/platform/implementation/windows/webrtc.cc index ab1df289..287b4898 100644 --- a/internal/platform/implementation/windows/webrtc.cc +++ b/internal/platform/implementation/windows/webrtc.cc @@ -17,12 +17,19 @@ #include #include +#include #include #include +#include "absl/strings/string_view.h" #include "internal/account/account_manager_impl.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/implementation/webrtc.h" #include "internal/platform/logging.h" +#include "webrtc/api/peer_connection_interface.h" +#include "webrtc/api/scoped_refptr.h" #include "webrtc/api/task_queue/default_task_queue_factory.h" +#include "webrtc/rtc_base/thread.h" namespace nearby { namespace windows { @@ -54,19 +61,24 @@ const std::string WebRtcMedium::GetDefaultCountryCode() { wchar_t systemGeoName[LOCALE_NAME_MAX_LENGTH]; if (!GetUserDefaultGeoName(systemGeoName, LOCALE_NAME_MAX_LENGTH)) { - NEARBY_LOGS(ERROR) << __func__ << ": Failed to GetUserDefaultGeoName: " - << ". Fall back to US."; + LOG(ERROR) << __func__ + << ": Failed to GetUserDefaultGeoName: " << ". Fall back to US."; return "US"; } std::wstring wideGeo(systemGeoName); std::string systemGeoNameString(wideGeo.begin(), wideGeo.end()); - NEARBY_LOGS(VERBOSE) << "GetUserDefaultGeoName() returns: " - << systemGeoNameString; + VLOG(1) << "GetUserDefaultGeoName() returns: " << systemGeoNameString; return systemGeoNameString; } void WebRtcMedium::CreatePeerConnection( webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) { + CreatePeerConnection(std::nullopt, observer, std::move(callback)); +} + +void WebRtcMedium::CreatePeerConnection( + std::optional options, + webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) { webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; rtc_config.sdp_semantics = webrtc::SdpSemantics::kUnifiedPlan; // TODO(b/261663238): Add the TURN servers and go beyond the default servers. @@ -81,7 +93,7 @@ void WebRtcMedium::CreatePeerConnection( std::unique_ptr signaling_thread = rtc::Thread::Create(); signaling_thread->SetName("signaling_thread", nullptr); if (!signaling_thread->Start()) { - NEARBY_LOGS(FATAL) << "Failed to start thread"; + LOG(FATAL) << "Failed to start thread"; } webrtc::PeerConnectionDependencies dependencies(observer); @@ -90,15 +102,19 @@ void WebRtcMedium::CreatePeerConnection( webrtc::CreateDefaultTaskQueueFactory(); factory_dependencies.signaling_thread = signaling_thread.release(); + rtc::scoped_refptr + peer_connection_factory = webrtc::CreateModularPeerConnectionFactory( + std::move(factory_dependencies)); + if (options.has_value()) { + peer_connection_factory->SetOptions(options.value()); + } auto peer_connection_or_error = - webrtc::CreateModularPeerConnectionFactory( - std::move(factory_dependencies)) - ->CreatePeerConnectionOrError(rtc_config, std::move(dependencies)); - + peer_connection_factory->CreatePeerConnectionOrError( + rtc_config, std::move(dependencies)); if (peer_connection_or_error.ok()) { callback(peer_connection_or_error.MoveValue()); } else { - NEARBY_LOGS(FATAL) << "Failed to create peer connection"; + LOG(FATAL) << "Failed to create peer connection"; callback(/*peer_connection=*/nullptr); } } diff --git a/internal/platform/implementation/windows/webrtc.h b/internal/platform/implementation/windows/webrtc.h index 50f0b32f..18766870 100644 --- a/internal/platform/implementation/windows/webrtc.h +++ b/internal/platform/implementation/windows/webrtc.h @@ -15,10 +15,15 @@ #ifndef PLATFORM_IMPL_WINDOWS_WEBRTC_H_ #define PLATFORM_IMPL_WINDOWS_WEBRTC_H_ +#include +#include #include -#include "internal/account/account_manager.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/implementation/account_manager.h" #include "internal/platform/implementation/webrtc.h" +#include "webrtc/api/peer_connection_interface.h" namespace nearby { namespace windows { @@ -63,6 +68,13 @@ class WebRtcMedium : public api::WebRtcMedium { void CreatePeerConnection(webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) override; + // Creates and returns a new webrtc::PeerConnectionInterface object via + // |callback| with |PeerConnectionFactoryInterface::Options|. + void CreatePeerConnection( + std::optional options, + webrtc::PeerConnectionObserver* observer, + PeerConnectionCallback callback) override; + // Returns a signaling messenger for sending WebRTC signaling messages. // TODO(b/261663238): replace with real implementation. std::unique_ptr GetSignalingMessenger( diff --git a/internal/platform/implementation/windows/webrtc_test.cc b/internal/platform/implementation/windows/webrtc_test.cc index 81331a14..5b1e5c50 100644 --- a/internal/platform/implementation/windows/webrtc_test.cc +++ b/internal/platform/implementation/windows/webrtc_test.cc @@ -15,12 +15,17 @@ #include "internal/platform/implementation/windows/webrtc.h" #include +#include #include -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "internal/platform/implementation/webrtc.h" +#include "webrtc/api/jsep.h" +#include "webrtc/api/data_channel_interface.h" +#include "webrtc/api/peer_connection_interface.h" +#include "webrtc/api/scoped_refptr.h" + namespace nearby { namespace windows { @@ -58,8 +63,9 @@ TEST(WebrtcTest, CreatePeerConnectionSucceeds) { auto observer = std::make_unique(); WebRtcMedium medium; medium.CreatePeerConnection( - observer.get(), [](rtc::scoped_refptr - peer_connection) mutable { + std::nullopt, observer.get(), + [](rtc::scoped_refptr + peer_connection) mutable { if (!peer_connection) { FAIL() << "Peer connection should have been non-null"; return; diff --git a/internal/platform/implementation/windows/wifi.h b/internal/platform/implementation/windows/wifi.h index 01b4733b..7e63da5b 100644 --- a/internal/platform/implementation/windows/wifi.h +++ b/internal/platform/implementation/windows/wifi.h @@ -22,7 +22,7 @@ // Nearby connections headers #include "internal/platform/implementation/wifi.h" -#include "internal/platform/wifi_utils.h" +#include "internal/platform/implementation/wifi_utils.h" // WinRT headers #include "internal/platform/implementation/windows/generated/winrt/Windows.Foundation.Collections.h" diff --git a/internal/platform/implementation/windows/wifi_direct_medium.cc b/internal/platform/implementation/windows/wifi_direct_medium.cc index 7ced0f48..83cde539 100644 --- a/internal/platform/implementation/windows/wifi_direct_medium.cc +++ b/internal/platform/implementation/windows/wifi_direct_medium.cc @@ -20,8 +20,10 @@ #include "absl/strings/string_view.h" #include "absl/time/time.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/implementation/wifi_direct.h" +#include "internal/platform/implementation/wifi_utils.h" #include "internal/platform/implementation/windows/wifi_direct.h" -#include "internal/platform/wifi_utils.h" // Nearby connections headers #include "internal/platform/cancellation_flag_listener.h" @@ -66,23 +68,23 @@ bool WifiDirectMedium::IsInterfaceValid() const { DWORD result = WFDOpenHandle(WFD_API_VERSION, &negotiated_version, &wifi_direct_handle); if (result == ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "WiFi can support WifiDirect"; + LOG(INFO) << "WiFi can support WifiDirect"; WFDCloseHandle(wifi_direct_handle); return true; } - NEARBY_LOGS(ERROR) << "WiFi can't support WifiDirect"; + LOG(ERROR) << "WiFi can't support WifiDirect"; return false; } std::unique_ptr WifiDirectMedium::ConnectToService( absl::string_view ip_address, int port, CancellationFlag* cancellation_flag) { - NEARBY_LOGS(WARNING) << __func__ << " : Connect to remote service."; + LOG(WARNING) << __func__ << " : Connect to remote service."; if (ip_address.empty() || port == 0) { - NEARBY_LOGS(ERROR) << "no valid service address and port to connect: " - << "ip_address = " << ip_address << ", port = " << port; + LOG(ERROR) << "no valid service address and port to connect: " + << "ip_address = " << ip_address << ", port = " << port; return nullptr; } @@ -94,7 +96,7 @@ std::unique_ptr WifiDirectMedium::ConnectToService( } if (!WifiUtils::ValidateIPV4(ipv4_address)) { - NEARBY_LOGS(ERROR) << "Invalid IP address parameter."; + LOG(ERROR) << "Invalid IP address parameter."; return nullptr; } @@ -113,23 +115,22 @@ std::unique_ptr WifiDirectMedium::ConnectToService( // setup cancel listener if (cancellation_flag != nullptr) { if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) << "connect has been cancelled to service " - << ipv4_address << ":" << port; + LOG(INFO) << "connect has been cancelled to service " << ipv4_address + << ":" << port; return nullptr; } connection_cancellation_listener = std::make_unique( cancellation_flag, [socket]() { - NEARBY_LOGS(WARNING) - << "connect is closed due to it is cancelled."; + LOG(WARNING) << "connect is closed due to it is cancelled."; socket.Close(); }); } connection_timeout_ = scheduled_executor_.Schedule( [socket]() { - NEARBY_LOGS(WARNING) << "connect is closed due to timeout."; + LOG(WARNING) << "connect is closed due to timeout."; socket.Close(); }, kWifiDirectClientSocketConnectTimeoutMillis); @@ -143,12 +144,12 @@ std::unique_ptr WifiDirectMedium::ConnectToService( auto client_socket = std::make_unique(socket); - NEARBY_LOGS(INFO) << "connected to remote service " << ipv4_address << ":" - << port; + LOG(INFO) << "connected to remote service " << ipv4_address << ":" + << port; return client_socket; } catch (...) { - NEARBY_LOGS(ERROR) << "failed to connect remote service " << ipv4_address - << ":" << port << " for the " << i + 1 << " time"; + LOG(ERROR) << "failed to connect remote service " << ipv4_address << ":" + << port << " for the " << i + 1 << " time"; } if (connection_timeout_ != nullptr) { @@ -167,8 +168,8 @@ std::unique_ptr WifiDirectMedium::ListenForService( // check current status if (IsAccepting()) { - NEARBY_LOGS(WARNING) << "accepting connections already started on port " - << server_socket_ptr_->GetPort(); + LOG(WARNING) << "accepting connections already started on port " + << server_socket_ptr_->GetPort(); return nullptr; } @@ -179,18 +180,18 @@ std::unique_ptr WifiDirectMedium::ListenForService( medium_status_ |= kMediumStatusAccepting; server_socket->SetCloseNotifier([this]() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << "server socket was closed on port " - << server_socket_ptr_->GetPort(); + LOG(INFO) << "server socket was closed on port " + << server_socket_ptr_->GetPort(); medium_status_ &= (~kMediumStatusAccepting); server_socket_ptr_ = nullptr; }); - NEARBY_LOGS(INFO) << "started to listen serive on port " - << server_socket_ptr_->GetPort(); + LOG(INFO) << "started to listen serive on port " + << server_socket_ptr_->GetPort(); return server_socket; } - NEARBY_LOGS(ERROR) << "Failed to listen service on port " << port; + LOG(ERROR) << "Failed to listen service on port " << port; return nullptr; } @@ -200,7 +201,7 @@ bool WifiDirectMedium::StartWifiDirect( absl::MutexLock lock(&mutex_); if (IsBeaconing()) { - NEARBY_LOGS(WARNING) << "cannot create SoftAP again when it is running."; + LOG(WARNING) << "cannot create SoftAP again when it is running."; return true; } @@ -245,29 +246,26 @@ bool WifiDirectMedium::StartWifiDirect( publisher_.Start(); if (publisher_.Status() == WiFiDirectAdvertisementPublisherStatus::Started) { - NEARBY_LOGS(INFO) << "Windows WiFiDirect GO(SoftAP) started"; + LOG(INFO) << "Windows WiFiDirect GO(SoftAP) started"; medium_status_ |= kMediumStatusBeaconing; return true; } // Clean up when fail - NEARBY_LOGS(ERROR) << "Windows WiFiDirect GO(SoftAP) fails to start"; + LOG(ERROR) << "Windows WiFiDirect GO(SoftAP) fails to start"; publisher_.StatusChanged(publisher_status_changed_token_); listener_.ConnectionRequested(connection_requested_token_); listener_ = nullptr; publisher_ = nullptr; return false; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot start WiFiDirect GO. Exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Cannot start WiFiDirect GO. Exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot start WiFiDirect GO. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Cannot start WiFiDirect GO. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } @@ -277,7 +275,7 @@ bool WifiDirectMedium::StopWifiDirect() { absl::MutexLock lock(&mutex_); if (!IsBeaconing()) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << "Cannot stop WiFiDirect GO(SoftAP) because no GO was started."; return true; } @@ -290,21 +288,19 @@ bool WifiDirectMedium::StopWifiDirect() { wifi_direct_device_ = nullptr; listener_ = nullptr; publisher_ = nullptr; - NEARBY_LOGS(INFO) << "succeeded to stop WiFiDirect GO(SoftAP)"; + LOG(INFO) << "succeeded to stop WiFiDirect GO(SoftAP)"; } medium_status_ &= (~kMediumStatusBeaconing); return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Stop WiFiDirect GO failed. Exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Stop WiFiDirect GO failed. Exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Stop WiFiDirect GO failed. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Stop WiFiDirect GO failed. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } @@ -314,34 +310,33 @@ fire_and_forget WifiDirectMedium::OnStatusChanged( WiFiDirectAdvertisementPublisherStatusChangedEventArgs event) { if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Started) { if (sender.Advertisement().LegacySettings().IsEnabled()) { - NEARBY_LOGS(INFO) - << "WiFiDirect GO SSID: " - << winrt::to_string( - publisher_.Advertisement().LegacySettings().Ssid()); - NEARBY_LOGS(INFO) << "WiFiDirect GO PW: " - << winrt::to_string(publisher_.Advertisement() - .LegacySettings() - .Passphrase() - .Password()); + LOG(INFO) << "WiFiDirect GO SSID: " + << winrt::to_string( + publisher_.Advertisement().LegacySettings().Ssid()); + LOG(INFO) << "WiFiDirect GO PW: " + << winrt::to_string(publisher_.Advertisement() + .LegacySettings() + .Passphrase() + .Password()); } return winrt::fire_and_forget(); } else if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Created) { - NEARBY_LOGS(INFO) << "Receive WiFiDirect/SoftAP Created event."; + LOG(INFO) << "Receive WiFiDirect/SoftAP Created event."; return winrt::fire_and_forget(); } else if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Stopped) { - NEARBY_LOGS(INFO) << "Receive WiFiDirect/SoftAP Stopped event."; + LOG(INFO) << "Receive WiFiDirect/SoftAP Stopped event."; } else if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Aborted) { - NEARBY_LOGS(INFO) << "Receive WiFiDirect/SoftAP Aborted event."; + LOG(INFO) << "Receive WiFiDirect/SoftAP Aborted event."; } // Publisher is stopped. Need to clean up the publisher. { absl::MutexLock lock(&mutex_); if (publisher_ != nullptr) { - NEARBY_LOGS(ERROR) << "Windows WiFiDirect GO(SoftAP) cleanup."; + LOG(ERROR) << "Windows WiFiDirect GO(SoftAP) cleanup."; listener_.ConnectionRequested(connection_requested_token_); publisher_.StatusChanged(publisher_status_changed_token_); wifi_direct_device_ = nullptr; @@ -358,8 +353,8 @@ fire_and_forget WifiDirectMedium::OnConnectionRequested( WiFiDirectConnectionRequestedEventArgs const& event) { WiFiDirectConnectionRequest connection_request = event.GetConnectionRequest(); winrt::hstring device_name = connection_request.DeviceInformation().Name(); - NEARBY_LOGS(INFO) << "Receive connection request from: " - << winrt::to_string(device_name); + LOG(INFO) << "Receive connection request from: " + << winrt::to_string(device_name); try { // This is to solve b/236805122. @@ -372,9 +367,9 @@ fire_and_forget WifiDirectMedium::OnConnectionRequested( wifi_direct_device_ = WiFiDirectDevice::FromIdAsync( connection_request.DeviceInformation().Id()) .get(); - NEARBY_LOGS(INFO) << "Registered the device in WLAN-AutoConfig"; + LOG(INFO) << "Registered the device in WLAN-AutoConfig"; } catch (...) { - NEARBY_LOGS(ERROR) << "Failed to registered the device in WLAN-AutoConfig"; + LOG(ERROR) << "Failed to registered the device in WLAN-AutoConfig"; wifi_direct_device_ = nullptr; connection_request.Close(); } @@ -387,20 +382,19 @@ bool WifiDirectMedium::ConnectWifiDirect( try { if (IsConnected()) { - NEARBY_LOGS(WARNING) << "Already connected to AP, disconnect first."; + LOG(WARNING) << "Already connected to AP, disconnect first."; InternalDisconnectWifiDirect(); } auto access = WiFiAdapter::RequestAccessAsync().get(); if (access != WiFiAccessStatus::Allowed) { - NEARBY_LOGS(WARNING) << "Access Denied with reason: " - << static_cast(access); + LOG(WARNING) << "Access Denied with reason: " << static_cast(access); return false; } auto adapters = WiFiAdapter::FindAllAdaptersAsync().get(); if (adapters.Size() < 1) { - NEARBY_LOGS(WARNING) << "No WiFi Adapter found."; + LOG(WARNING) << "No WiFi Adapter found."; return false; } wifi_adapter_ = adapters.GetAt(0); @@ -417,8 +411,8 @@ bool WifiDirectMedium::ConnectWifiDirect( // SoftAP is an abbreviation for "software enabled access point". WiFiAvailableNetwork nearby_softap{nullptr}; - NEARBY_LOGS(INFO) << "Scanning for Nearby WifiDirect GO's SSID: " - << wifi_direct_credentials->GetSSID(); + LOG(INFO) << "Scanning for Nearby WifiDirect GO's SSID: " + << wifi_direct_credentials->GetSSID(); // First time scan may not find our target GO, try 2 more times can // almost guarantee to find the GO @@ -431,22 +425,22 @@ bool WifiDirectMedium::ConnectWifiDirect( if (!wifi_connected_network_ && !ssid.empty() && (winrt::to_string(network.Ssid()) == ssid)) { wifi_connected_network_ = network; - NEARBY_LOGS(INFO) << "Save the current connected network: " << ssid; + LOG(INFO) << "Save the current connected network: " << ssid; } else if (!nearby_softap && winrt::to_string(network.Ssid()) == wifi_direct_credentials->GetSSID()) { - NEARBY_LOGS(INFO) - << "Found Nearby SSID: " << winrt::to_string(network.Ssid()); + LOG(INFO) << "Found Nearby SSID: " + << winrt::to_string(network.Ssid()); nearby_softap = network; } if (nearby_softap && wifi_connected_network_) break; } if (nearby_softap) break; - NEARBY_LOGS(INFO) << "Scan ... "; + LOG(INFO) << "Scan ... "; wifi_adapter_.ScanAsync().get(); } if (!nearby_softap) { - NEARBY_LOGS(INFO) << "WifiDirect GO is not found"; + LOG(INFO) << "WifiDirect GO is not found"; return false; } @@ -460,15 +454,15 @@ bool WifiDirectMedium::ConnectWifiDirect( if (connect_result == nullptr || connect_result.ConnectionStatus() != WiFiConnectionStatus::Success) { - NEARBY_LOGS(INFO) << "Connecting failed with reason: " - << static_cast(connect_result.ConnectionStatus()); + LOG(INFO) << "Connecting failed with reason: " + << static_cast(connect_result.ConnectionStatus()); return false; } // Make sure IP address is ready. std::string ip_address; for (int i = 0; i < kIpAddressMaxRetries; i++) { - NEARBY_LOGS(INFO) << "Check IP address at attempt " << i; + LOG(INFO) << "Check IP address at attempt " << i; std::vector ip_addresses = GetIpv4Addresses(); if (ip_addresses.empty()) { Sleep(kIpAddressRetryIntervalMillis / absl::Milliseconds(1)); @@ -479,28 +473,26 @@ bool WifiDirectMedium::ConnectWifiDirect( } if (ip_address.empty()) { - NEARBY_LOGS(INFO) << "Failed to get IP address from WifiDirect GO."; + LOG(INFO) << "Failed to get IP address from WifiDirect GO."; return false; } - NEARBY_LOGS(INFO) << "Got IP: " << ip_address << " from WifiDirect GO."; + LOG(INFO) << "Got IP: " << ip_address << " from WifiDirect GO."; std::string last_ssid = wifi_direct_credentials->GetSSID(); medium_status_ |= kMediumStatusConnected; - NEARBY_LOGS(INFO) << "Connected to WifiDirect GO: " << last_ssid; + LOG(INFO) << "Connected to WifiDirect GO: " << last_ssid; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot connet to WifiDirect GO. Exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Cannot connet to WifiDirect GO. Exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot connet to WifiDirect GO. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Cannot connet to WifiDirect GO. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } @@ -520,15 +512,15 @@ void WifiDirectMedium::RestoreWifiConnection() { profile.WlanConnectionProfileDetails().GetConnectedSsid()); if (!ssid.empty() && (winrt::to_string(wifi_connected_network_.Ssid()) == ssid)) { - NEARBY_LOGS(INFO) << "Already conneted to the previous WIFI network " - << ssid << "! Skip restoration."; + LOG(INFO) << "Already conneted to the previous WIFI network " << ssid + << "! Skip restoration."; return; } } // Disconnect to the WiFi connection through the WiFi adapter. wifi_adapter_.Disconnect(); - NEARBY_LOGS(INFO) << "Disconnected to current network."; + LOG(INFO) << "Disconnected to current network."; auto connect_result = wifi_adapter_ .ConnectAsync(wifi_connected_network_, @@ -537,11 +529,11 @@ void WifiDirectMedium::RestoreWifiConnection() { if (connect_result == nullptr || connect_result.ConnectionStatus() != WiFiConnectionStatus::Success) { - NEARBY_LOGS(INFO) << "Connecting to previous network failed with reason: " - << static_cast(connect_result.ConnectionStatus()); + LOG(INFO) << "Connecting to previous network failed with reason: " + << static_cast(connect_result.ConnectionStatus()); } else { - NEARBY_LOGS(INFO) << "Restored the previous WIFI connection: " - << winrt::to_string(wifi_connected_network_.Ssid()); + LOG(INFO) << "Restored the previous WIFI connection: " + << winrt::to_string(wifi_connected_network_.Ssid()); } wifi_connected_network_ = nullptr; } @@ -552,23 +544,21 @@ bool WifiDirectMedium::DisconnectWifiDirect() { try { return InternalDisconnectWifiDirect(); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ - << ": Disconnect WifiDirect GO failed. Exception: " - << exception.what(); + LOG(ERROR) << __func__ << ": Disconnect WifiDirect GO failed. Exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Disconnect WifiDirect GO failed. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Disconnect WifiDirect GO failed. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exception."; + LOG(ERROR) << __func__ << ": Unknown exception."; } return false; } bool WifiDirectMedium::InternalDisconnectWifiDirect() { if (!IsConnected()) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << "Cannot disconnect WifiDirect GO because it is not connected."; return true; } @@ -591,23 +581,19 @@ bool WifiDirectMedium::InternalDisconnectWifiDirect() { auto profile_delete_status = profile.TryDeleteAsync().get(); switch (profile_delete_status) { case ConnectionProfileDeleteStatus::Success: - NEARBY_LOGS(INFO) - << "WiFi profile with SSID:" << ssid << " is deleted."; + LOG(INFO) << "WiFi profile with SSID:" << ssid << " is deleted."; break; case ConnectionProfileDeleteStatus::DeniedBySystem: - NEARBY_LOGS(ERROR) - << "Failed to delete WiFi profile with SSID:" << ssid - << " due to denied by system."; + LOG(ERROR) << "Failed to delete WiFi profile with SSID:" << ssid + << " due to denied by system."; break; case ConnectionProfileDeleteStatus::DeniedByUser: - NEARBY_LOGS(ERROR) - << "Failed to delete WiFi profile with SSID:" << ssid - << " due to denied by user."; + LOG(ERROR) << "Failed to delete WiFi profile with SSID:" << ssid + << " due to denied by user."; break; case ConnectionProfileDeleteStatus::UnknownError: - NEARBY_LOGS(ERROR) - << "Failed to delete WiFi profile with SSID:" << ssid - << " due to unknonw error."; + LOG(ERROR) << "Failed to delete WiFi profile with SSID:" << ssid + << " due to unknonw error."; break; default: break; diff --git a/internal/platform/implementation/windows/wifi_direct_server_socket.cc b/internal/platform/implementation/windows/wifi_direct_server_socket.cc index a1298d31..5b736460 100644 --- a/internal/platform/implementation/windows/wifi_direct_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_direct_server_socket.cc @@ -20,9 +20,13 @@ #include // ABSL headers +#include "absl/functional/any_invocable.h" #include "absl/strings/match.h" // Nearby connections headers +#include "absl/synchronization/mutex.h" +#include "internal/platform/exception.h" +#include "internal/platform/implementation/wifi_direct.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Sockets.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/implementation/windows/wifi_direct.h" @@ -67,7 +71,7 @@ int WifiDirectServerSocket::GetPort() const { std::unique_ptr WifiDirectServerSocket::Accept() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Accept is called."; + LOG(INFO) << __func__ << ": Accept is called."; while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); @@ -77,7 +81,7 @@ std::unique_ptr WifiDirectServerSocket::Accept() { StreamSocket wifi_direct_socket = pending_sockets_.front(); pending_sockets_.pop_front(); - NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection."; + LOG(INFO) << __func__ << ": Accepted a remote connection."; return std::make_unique(wifi_direct_socket); } @@ -89,7 +93,7 @@ void WifiDirectServerSocket::SetCloseNotifier( Exception WifiDirectServerSocket::Close() { try { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Close is called."; + LOG(INFO) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -112,23 +116,23 @@ Exception WifiDirectServerSocket::Close() { close_notifier_(); } - NEARBY_LOGS(INFO) << __func__ << ": Close completed succesfully."; + LOG(INFO) << __func__ << ": Close completed succesfully."; return {Exception::kSuccess}; } catch (std::exception exception) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error &error) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -138,17 +142,17 @@ bool WifiDirectServerSocket::listen() { for (int i = 0; i < kMaxRetries; i++) { wifi_direct_go_ipaddr_ = GetDirectGOIpAddresses(); if (wifi_direct_go_ipaddr_.empty()) { - NEARBY_LOGS(WARNING) - << "Failed to find WifiDirect GO's IP addr for the try: " << i + 1 - << ". Wait " << kRetryIntervalMilliSeconds << "ms snd try again"; + LOG(WARNING) << "Failed to find WifiDirect GO's IP addr for the try: " + << i + 1 << ". Wait " << kRetryIntervalMilliSeconds + << "ms snd try again"; Sleep(kRetryIntervalMilliSeconds); } else { break; } } if (wifi_direct_go_ipaddr_.empty()) { - NEARBY_LOGS(WARNING) << "Failed to start accepting connection without IP " - "addresses configured on computer."; + LOG(WARNING) << "Failed to start accepting connection without IP " + "addresses configured on computer."; return false; } @@ -176,17 +180,16 @@ bool WifiDirectServerSocket::listen() { return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Cannot accept connection on preferred port. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot accept connection on preferred port. Exception: " + << exception.what(); } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ":Cannot accept connection on preferred port. WinRT exception: " << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } try { @@ -194,18 +197,17 @@ bool WifiDirectServerSocket::listen() { // need to save the port information. port_ = std::stoi(stream_socket_listener_.Information().LocalPort().c_str()); - NEARBY_LOGS(INFO) << "Server Socket port: " << port_; + LOG(INFO) << "Server Socket port: " << port_; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Cannot bind to any port. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot bind to any port. Exception: " << exception.what(); } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot bind to any port. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Cannot bind to any port. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; @@ -215,7 +217,7 @@ fire_and_forget WifiDirectServerSocket::Listener_ConnectionReceived( StreamSocketListener listener, StreamSocketListenerConnectionReceivedEventArgs const &args) { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Received connection."; + LOG(INFO) << __func__ << ": Received connection."; if (closed_) { return fire_and_forget{}; @@ -236,7 +238,7 @@ std::vector WifiDirectServerSocket::GetIpAddresses() const { std::string ipv4_s = winrt::to_string(host_name.ToString()); if (absl::EndsWith(ipv4_s, ".1")) { - NEARBY_LOGS(INFO) << "Found WifiDirect GO IP: " << ipv4_s; + LOG(INFO) << "Found WifiDirect GO IP: " << ipv4_s; result.push_back(ipv4_s); } } @@ -256,7 +258,7 @@ std::string WifiDirectServerSocket::GetDirectGOIpAddresses() const { if (absl::EndsWith(ipv4_s, ".1")) { // TODO(b/228541380): replace when we find a better way to // identifying the WifiDirect GO IP address - NEARBY_LOGS(INFO) << "Found WifiDirect GO IP: " << ipv4_s; + LOG(INFO) << "Found WifiDirect GO IP: " << ipv4_s; return ipv4_s; } } @@ -264,14 +266,14 @@ std::string WifiDirectServerSocket::GetDirectGOIpAddresses() const { } return {}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {}; } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {}; } } diff --git a/internal/platform/implementation/windows/wifi_direct_socket.cc b/internal/platform/implementation/windows/wifi_direct_socket.cc index 069db83a..d0a9f1cc 100644 --- a/internal/platform/implementation/windows/wifi_direct_socket.cc +++ b/internal/platform/implementation/windows/wifi_direct_socket.cc @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/windows/wifi_direct.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" - +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { @@ -33,12 +37,12 @@ WifiDirectSocket::~WifiDirectSocket() { Close(); } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } } @@ -53,14 +57,14 @@ Exception WifiDirectSocket::Close() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -79,21 +83,21 @@ ExceptionOr WifiDirectSocket::SocketInputStream::Read( input_stream_.ReadAsync(buffer, size, InputStreamOptions::None).get(); if (ibuffer.Length() != size) { - NEARBY_LOGS(WARNING) << "Only got part of data of needed."; + LOG(WARNING) << "Only got part of data of needed."; } ByteArray data((char*)ibuffer.data(), ibuffer.Length()); return ExceptionOr(data); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -106,14 +110,14 @@ ExceptionOr WifiDirectSocket::SocketInputStream::Skip(size_t offset) { input_stream_.ReadAsync(buffer, offset, InputStreamOptions::None).get(); return ExceptionOr((size_t)ibuffer.Length()); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -123,14 +127,14 @@ Exception WifiDirectSocket::SocketInputStream::Close() { input_stream_.Close(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -150,14 +154,14 @@ Exception WifiDirectSocket::SocketOutputStream::Write(const ByteArray& data) { output_stream_.WriteAsync(buffer).get(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -167,14 +171,14 @@ Exception WifiDirectSocket::SocketOutputStream::Flush() { output_stream_.FlushAsync().get(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -184,14 +188,14 @@ Exception WifiDirectSocket::SocketOutputStream::Close() { output_stream_.Close(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } diff --git a/internal/platform/implementation/windows/wifi_hotspot.h b/internal/platform/implementation/windows/wifi_hotspot.h index 5c34e414..1c4171c6 100644 --- a/internal/platform/implementation/windows/wifi_hotspot.h +++ b/internal/platform/implementation/windows/wifi_hotspot.h @@ -21,13 +21,21 @@ #include // Standard C/C++ headers +#include #include +#include #include #include #include +#include // Nearby connections headers +#include "absl/base/thread_annotations.h" +#include "absl/functional/any_invocable.h" #include "absl/strings/string_view.h" +#include "absl/synchronization/mutex.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/implementation/cancelable.h" #include "internal/platform/implementation/wifi_hotspot.h" #include "internal/platform/implementation/windows/scheduled_executor.h" #include "internal/platform/implementation/windows/submittable_executor.h" @@ -45,6 +53,7 @@ #include "internal/platform/implementation/windows/generated/winrt/Windows.Security.Cryptography.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Storage.Streams.h" #include "internal/platform/implementation/windows/generated/winrt/base.h" +#include "internal/platform/wifi_credential.h" namespace nearby { namespace windows { @@ -293,6 +302,14 @@ class WifiHotspotMedium : public api::WifiHotspotMedium { // Implemented the disconnection to WiFi hotspot, and used to avoid deadlock. bool InternalDisconnectWifiHotspot(); + // Restore the WiFi connection after disconnect from the Hotspot + void RestoreWifiConnection(); + // Delete the network profile of the WiFi hotspot + bool DeleteNetworkProfile(winrt::hstring ssid); + // Store the Hotspot SSID to local storage + void StoreHotspotSsid(std::string ssid); + // Get the Hotspot SSID from local storage + std::string GetStoredHotspotSsid(); bool IsIdle() { return medium_status_ == kMediumStatusIdle; } // Advertiser is accepting connection on server socket @@ -301,7 +318,6 @@ class WifiHotspotMedium : public api::WifiHotspotMedium { bool IsBeaconing() { return (medium_status_ & kMediumStatusBeaconing) != 0; } // Discoverer is connected with the Hotspot bool IsConnected() { return (medium_status_ & kMediumStatusConnected) != 0; } - void RestoreWifiConnection(); WiFiDirectAdvertisementPublisher publisher_{nullptr}; WiFiDirectConnectionListener listener_{nullptr}; @@ -318,7 +334,8 @@ class WifiHotspotMedium : public api::WifiHotspotMedium { winrt::event_token connection_requested_token_; WiFiAdapter wifi_adapter_{nullptr}; - WiFiAvailableNetwork wifi_connected_network_{nullptr}; + WiFiAvailableNetwork wifi_original_network_{nullptr}; + winrt::hstring wifi_connected_hotspot_ssid_ = winrt::hstring(L""); // Gets error message from exception pointer std::string GetErrorMessage(std::exception_ptr eptr); diff --git a/internal/platform/implementation/windows/wifi_hotspot_medium.cc b/internal/platform/implementation/windows/wifi_hotspot_medium.cc index 8cdbd06b..206854a0 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_medium.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_medium.cc @@ -11,30 +11,47 @@ // 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. - #include #include #include #include -#include -#include +#include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include "absl/time/time.h" +#include "absl/synchronization/mutex.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" +#include "internal/platform/cancellation_flag_listener.h" +#include "internal/platform/exception.h" #include "internal/platform/feature_flags.h" #include "internal/platform/flags/nearby_platform_feature_flags.h" -#include "internal/platform/implementation/windows/wifi_hotspot.h" - -// Nearby connections headers -#include "internal/flags/nearby_flags.h" -#include "internal/platform/cancellation_flag_listener.h" +#include "internal/platform/implementation/input_file.h" +#include "internal/platform/implementation/output_file.h" +#include "internal/platform/implementation/platform.h" +#include "internal/platform/implementation/wifi_hotspot.h" +#include "internal/platform/implementation/wifi_utils.h" #include "internal/platform/implementation/windows/utils.h" +#include "internal/platform/implementation/windows/wifi_hotspot.h" +#include "internal/platform/implementation/windows/wifi_intel.h" #include "internal/platform/logging.h" +#include "internal/platform/wifi_credential.h" namespace nearby { namespace windows { +namespace { +constexpr absl::string_view kHotspotSsidFileName = "ssid.txt"; +} -WifiHotspotMedium::WifiHotspotMedium() {} +WifiHotspotMedium::WifiHotspotMedium() { + std::string ssid = GetStoredHotspotSsid(); + if (!ssid.empty()) { + LOG(INFO) << "Get stored Hotspot SSID: " << ssid + << " from previous run"; + DeleteNetworkProfile(winrt::to_hstring(ssid)); + StoreHotspotSsid({}); + } +} WifiHotspotMedium::~WifiHotspotMedium() { StopWifiHotspot(); @@ -42,30 +59,30 @@ WifiHotspotMedium::~WifiHotspotMedium() { } bool WifiHotspotMedium::IsInterfaceValid() const { - HANDLE wifi_direct_handle = NULL; + HANDLE wifi_direct_handle = nullptr; DWORD negotiated_version = 0; DWORD result = 0; result = WFDOpenHandle(WFD_API_VERSION, &negotiated_version, &wifi_direct_handle); if (result == ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "WiFi can support Hotspot"; + LOG(INFO) << "WiFi can support Hotspot"; WFDCloseHandle(wifi_direct_handle); return true; } - NEARBY_LOGS(ERROR) << "WiFi can't support Hotspot"; + LOG(ERROR) << "WiFi can't support Hotspot"; return false; } std::unique_ptr WifiHotspotMedium::ConnectToService( absl::string_view ip_address, int port, CancellationFlag* cancellation_flag) { - NEARBY_LOGS(WARNING) << __func__ << " : Connect to remote service."; + LOG(WARNING) << __func__ << " : Connect to remote service."; if (ip_address.empty() || port == 0) { - NEARBY_LOGS(ERROR) << "no valid service address and port to connect: " - << "ip_address = " << ip_address << ", port = " << port; + LOG(ERROR) << "no valid service address and port to connect: " + << "ip_address = " << ip_address << ", port = " << port; return nullptr; } @@ -76,7 +93,7 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( ipv4_address = std::string(ip_address); } if (ipv4_address.empty()) { - NEARBY_LOGS(ERROR) << "Invalid IP address parameter."; + LOG(ERROR) << "Invalid IP address parameter."; return nullptr; } @@ -98,13 +115,11 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotConnectionTimeoutMillis); - NEARBY_LOGS(INFO) << "maximum connection retries=" - << wifi_hotspot_max_connection_retries - << ", connection interval=" - << wifi_hotspot_retry_interval_millis - << "ms, connection timeout=" - << wifi_hotspot_client_socket_connect_timeout_millis - << "ms"; + LOG(INFO) << "maximum connection retries=" + << wifi_hotspot_max_connection_retries + << ", connection interval=" << wifi_hotspot_retry_interval_millis + << "ms, connection timeout=" + << wifi_hotspot_client_socket_connect_timeout_millis << "ms"; for (int i = 0; i < wifi_hotspot_max_connection_retries; i++) { try { StreamSocket socket{}; @@ -115,16 +130,15 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( // setup cancel listener if (cancellation_flag != nullptr) { if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) << "connect has been cancelled to service " - << ipv4_address << ":" << port; + LOG(INFO) << "connect has been cancelled to service " << ipv4_address + << ":" << port; return nullptr; } connection_cancellation_listener = std::make_unique( cancellation_flag, [socket]() { - NEARBY_LOGS(WARNING) - << "connect is closed due to it is cancelled."; + LOG(WARNING) << "connect is closed due to it is cancelled."; socket.Close(); }); } @@ -132,7 +146,7 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( if (FeatureFlags::GetInstance().GetFlags().enable_connection_timeout) { connection_timeout_ = scheduled_executor_.Schedule( [socket]() { - NEARBY_LOGS(WARNING) << "connect is closed due to timeout."; + LOG(WARNING) << "connect is closed due to timeout."; socket.Close(); }, absl::Milliseconds( @@ -148,22 +162,22 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( auto wifi_hotspot_socket = std::make_unique(socket); - NEARBY_LOGS(INFO) << "connected to remote service " << ipv4_address << ":" - << port; + LOG(INFO) << "connected to remote service " << ipv4_address << ":" + << port; return wifi_hotspot_socket; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << "failed to connect remote service " << ipv4_address - << ":" << port << " for the " << i + 1 - << " time. Exception: " << exception.what(); + LOG(ERROR) << "failed to connect remote service " << ipv4_address << ":" + << port << " for the " << i + 1 + << " time. Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << "failed to connect remote service " << ipv4_address - << ":" << port << " for the " << i + 1 - << " time. WinRT exception: " << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << "failed to connect remote service " << ipv4_address << ":" + << port << " for the " << i + 1 + << " time. WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << "failed to connect remote service " << ipv4_address - << ":" << port << " for the " << i + 1 - << " time due to unknown reason."; + LOG(ERROR) << "failed to connect remote service " << ipv4_address << ":" + << port << " for the " << i + 1 + << " time due to unknown reason."; } if (connection_timeout_ != nullptr) { @@ -179,13 +193,13 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( std::unique_ptr WifiHotspotMedium::ListenForService(int port) { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ - << " :Start to listen connection from WiFi Hotspot client."; + LOG(INFO) << __func__ + << " :Start to listen connection from WiFi Hotspot client."; // check current status if (IsAccepting()) { - NEARBY_LOGS(WARNING) << "accepting connections already started on port " - << server_socket_ptr_->GetPort(); + LOG(WARNING) << "accepting connections already started on port " + << server_socket_ptr_->GetPort(); return nullptr; } @@ -198,16 +212,16 @@ WifiHotspotMedium::ListenForService(int port) { // Setup close notifier after listen started. server_socket->SetCloseNotifier([this]() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << "Server socket was closed."; + LOG(INFO) << "Server socket was closed."; medium_status_ &= (~kMediumStatusAccepting); server_socket_ptr_ = nullptr; }); - NEARBY_LOGS(INFO) << "Started to listen serive on port " - << server_socket_ptr_->GetPort(); + LOG(INFO) << "Started to listen serive on port " + << server_socket_ptr_->GetPort(); return server_socket; } - NEARBY_LOGS(ERROR) << "Failed to listen service on port " << port; + LOG(ERROR) << "Failed to listen service on port " << port; return nullptr; } @@ -215,11 +229,10 @@ WifiHotspotMedium::ListenForService(int port) { bool WifiHotspotMedium::StartWifiHotspot( HotspotCredentials* hotspot_credentials_) { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Start to create WiFi Hotspot."; + LOG(INFO) << __func__ << ": Start to create WiFi Hotspot."; if (IsBeaconing()) { - NEARBY_LOGS(WARNING) - << "Cannot create WiFi Hotspot again when it is running."; + LOG(WARNING) << "Cannot create WiFi Hotspot again when it is running."; return true; } @@ -254,28 +267,44 @@ bool WifiHotspotMedium::StartWifiHotspot( publisher_.Start(); if (publisher_.Status() == WiFiDirectAdvertisementPublisherStatus::Started) { - NEARBY_LOGS(INFO) << __func__ << ": WiFi Hotspot created and started."; + LOG(INFO) << __func__ << ": WiFi Hotspot created and started."; medium_status_ |= kMediumStatusBeaconing; + if (NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableIntelPieSdk)) { + WifiIntel& intel_wifi{WifiIntel::GetInstance()}; + if (intel_wifi.Start()) { + int GO_channel = intel_wifi.GetGOChannel(); + LOG(INFO) << "Intel PIE enabled, Hotspot is running on channel: " + << GO_channel; + intel_wifi.Stop(); + hotspot_credentials_->SetFrequency( + WifiUtils::ConvertChannelToFrequencyMhz(GO_channel, + WifiBandType::kUnknown)); + } + } else { + LOG(INFO) << "Intel PIE disabled, Can't extract Hotspot channel info!"; + hotspot_credentials_->SetFrequency(-1); + } return true; } // Clean up when fail - NEARBY_LOGS(ERROR) << "Windows WiFi Hotspot fails to start"; + LOG(ERROR) << "Windows WiFi Hotspot fails to start"; publisher_.StatusChanged(publisher_status_changed_token_); listener_.ConnectionRequested(connection_requested_token_); listener_ = nullptr; publisher_ = nullptr; return false; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Cannot start Hotspot. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot start Hotspot. Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot start Hotspot. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Cannot start Hotspot. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; } @@ -285,7 +314,7 @@ bool WifiHotspotMedium::StopWifiHotspot() { absl::MutexLock lock(&mutex_); if (!IsBeaconing()) { - NEARBY_LOGS(WARNING) << "Cannot stop SoftAP because no SoftAP is started."; + LOG(WARNING) << "Cannot stop SoftAP because no SoftAP is started."; return true; } try { @@ -296,20 +325,20 @@ bool WifiHotspotMedium::StopWifiHotspot() { wifi_direct_device_ = nullptr; listener_ = nullptr; publisher_ = nullptr; - NEARBY_LOGS(INFO) << "succeeded to stop WiFi Hotspot"; + LOG(INFO) << "succeeded to stop WiFi Hotspot"; } medium_status_ &= (~kMediumStatusBeaconing); return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Stop Hotspot failed. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Stop Hotspot failed. Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": Stop Hotspot failed. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Stop Hotspot failed. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; } @@ -319,34 +348,33 @@ fire_and_forget WifiHotspotMedium::OnStatusChanged( WiFiDirectAdvertisementPublisherStatusChangedEventArgs event) { if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Started) { if (sender.Advertisement().LegacySettings().IsEnabled()) { - NEARBY_LOGS(INFO) - << "WiFi SoftAP SSID: " - << winrt::to_string( - publisher_.Advertisement().LegacySettings().Ssid()); - NEARBY_LOGS(INFO) << "WiFi SoftAP PW: " - << winrt::to_string(publisher_.Advertisement() - .LegacySettings() - .Passphrase() - .Password()); + LOG(INFO) << "WiFi SoftAP SSID: " + << winrt::to_string( + publisher_.Advertisement().LegacySettings().Ssid()); + LOG(INFO) << "WiFi SoftAP PW: " + << winrt::to_string(publisher_.Advertisement() + .LegacySettings() + .Passphrase() + .Password()); } return winrt::fire_and_forget(); } else if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Created) { - NEARBY_LOGS(INFO) << "Receive WiFi direct/SoftAP Created event."; + LOG(INFO) << "Receive WiFi direct/SoftAP Created event."; return winrt::fire_and_forget(); } else if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Stopped) { - NEARBY_LOGS(INFO) << "Receive WiFi direct/SoftAP Stopped event."; + LOG(INFO) << "Receive WiFi direct/SoftAP Stopped event."; } else if (event.Status() == WiFiDirectAdvertisementPublisherStatus::Aborted) { - NEARBY_LOGS(INFO) << "Receive WiFi direct/SoftAP Aborted event."; + LOG(INFO) << "Receive WiFi direct/SoftAP Aborted event."; } // Publisher is stopped. Need to clean up the publisher. { absl::MutexLock lock(&mutex_); if (publisher_ != nullptr) { - NEARBY_LOGS(ERROR) << "Windows WiFi Hotspot cleanup."; + LOG(ERROR) << "Windows WiFi Hotspot cleanup."; listener_.ConnectionRequested(connection_requested_token_); publisher_.StatusChanged(publisher_status_changed_token_); wifi_direct_device_ = nullptr; @@ -363,8 +391,8 @@ fire_and_forget WifiHotspotMedium::OnConnectionRequested( WiFiDirectConnectionRequestedEventArgs const& event) { WiFiDirectConnectionRequest connection_request = event.GetConnectionRequest(); winrt::hstring device_name = connection_request.DeviceInformation().Name(); - NEARBY_LOGS(INFO) << "Receive connection request from: " - << winrt::to_string(device_name); + LOG(INFO) << "Receive connection request from: " + << winrt::to_string(device_name); try { // This is to solve b/236805122. @@ -377,9 +405,9 @@ fire_and_forget WifiHotspotMedium::OnConnectionRequested( wifi_direct_device_ = WiFiDirectDevice::FromIdAsync( connection_request.DeviceInformation().Id()) .get(); - NEARBY_LOGS(INFO) << "Registered the device in WLAN-AutoConfig"; + LOG(INFO) << "Registered the device in WLAN-AutoConfig"; } catch (...) { - NEARBY_LOGS(ERROR) << "Failed to registered the device in WLAN-AutoConfig"; + LOG(ERROR) << "Failed to registered the device in WLAN-AutoConfig"; wifi_direct_device_ = nullptr; connection_request.Close(); } @@ -391,21 +419,28 @@ bool WifiHotspotMedium::ConnectWifiHotspot( absl::MutexLock lock(&mutex_); try { + if (!wifi_connected_hotspot_ssid_.empty()) { + LOG(INFO) << "Before connecting to Hotspot, Delete the previous " + "Hotspot profile with SSID: " + << winrt::to_string(wifi_connected_hotspot_ssid_); + DeleteNetworkProfile(wifi_connected_hotspot_ssid_); + wifi_connected_hotspot_ssid_ = winrt::hstring(L""); + StoreHotspotSsid({}); + } if (IsConnected()) { - NEARBY_LOGS(WARNING) << "Already connected to AP, disconnect first."; + LOG(WARNING) << "Already connected to Hotspot, disconnect first."; InternalDisconnectWifiHotspot(); } auto access = WiFiAdapter::RequestAccessAsync().get(); if (access != WiFiAccessStatus::Allowed) { - NEARBY_LOGS(WARNING) << "Access Denied with reason: " - << static_cast(access); + LOG(WARNING) << "Access Denied with reason: " << static_cast(access); return false; } auto adapters = WiFiAdapter::FindAllAdaptersAsync().get(); if (adapters.Size() < 1) { - NEARBY_LOGS(WARNING) << "No WiFi Adapter found."; + LOG(WARNING) << "No WiFi Adapter found."; return false; } wifi_adapter_ = adapters.GetAt(0); @@ -422,44 +457,65 @@ bool WifiHotspotMedium::ConnectWifiHotspot( // SoftAP is an abbreviation for "software enabled access point". WiFiAvailableNetwork nearby_softap{nullptr}; - NEARBY_LOGS(INFO) << "Scanning for Nearby Hotspot SSID: " - << hotspot_credentials_->GetSSID(); + bool intel_wifi_started = false; + if (NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableIntelPieSdk)) { + auto channel = WifiUtils::ConvertFrequencyMhzToChannel( + hotspot_credentials_->GetFrequency()); + WifiIntel& intel_wifi{WifiIntel::GetInstance()}; + intel_wifi_started = intel_wifi.Start(); + if (intel_wifi_started) { + intel_wifi.SetScanFilter(channel); + } + } + + LOG(INFO) << "Scanning for Nearby Hotspot SSID: " + << hotspot_credentials_->GetSSID(); // First time scan may not find our target hotspot, try 2 more times can // almost guarantee to find the Hotspot wifi_adapter_.ScanAsync().get(); - wifi_connected_network_ = nullptr; + wifi_original_network_ = nullptr; int64_t wifi_hotspot_max_scans = NearbyFlags::GetInstance().GetInt64Flag( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotScanMaxRetries); - NEARBY_LOGS(INFO) << "maximum scan retries=" << wifi_hotspot_max_scans; - for (int i = 0; i < wifi_hotspot_max_scans; i++) { + int i; + for (i = 0; i < wifi_hotspot_max_scans; i++) { for (const auto& network : wifi_adapter_.NetworkReport().AvailableNetworks()) { - if (!wifi_connected_network_ && !ssid.empty() && + if (!wifi_original_network_ && !ssid.empty() && (winrt::to_string(network.Ssid()) == ssid)) { - wifi_connected_network_ = network; - NEARBY_LOGS(INFO) << "Save the current connected network: " << ssid; + wifi_original_network_ = network; + LOG(INFO) << "Save the current connected network: " << ssid; } else if (!nearby_softap && winrt::to_string(network.Ssid()) == hotspot_credentials_->GetSSID()) { - NEARBY_LOGS(INFO) - << "Found Nearby SSID: " << winrt::to_string(network.Ssid()); + LOG(INFO) << "Found Nearby SSID: " + << winrt::to_string(network.Ssid()); nearby_softap = network; } - if (nearby_softap && (ssid.empty() || wifi_connected_network_)) break; + if (nearby_softap && (ssid.empty() || wifi_original_network_)) break; } if (nearby_softap) break; - NEARBY_LOGS(INFO) << "Scan ... "; + LOG(INFO) << "Scan ... "; wifi_adapter_.ScanAsync().get(); } + LOG(INFO) << "Finish scanning " + << (nearby_softap ? "successfully" : "failed") << " with " + << i + 1 << " times trying."; + + if (intel_wifi_started) { + WifiIntel& intel_wifi{WifiIntel::GetInstance()}; + intel_wifi.ResetScanFilter(); + intel_wifi.Stop(); + } if (!nearby_softap) { - NEARBY_LOGS(INFO) << "Hotspot is not found"; + LOG(INFO) << "Hotspot is not found"; return false; } - PasswordCredential creds; creds.Password(winrt::to_hstring(hotspot_credentials_->GetPassword())); @@ -470,8 +526,8 @@ bool WifiHotspotMedium::ConnectWifiHotspot( if (connect_result == nullptr || connect_result.ConnectionStatus() != WiFiConnectionStatus::Success) { - NEARBY_LOGS(INFO) << "Connecting failed with reason: " - << static_cast(connect_result.ConnectionStatus()); + LOG(INFO) << "Connecting failed with reason: " + << static_cast(connect_result.ConnectionStatus()); RestoreWifiConnection(); return false; } @@ -485,11 +541,11 @@ bool WifiHotspotMedium::ConnectWifiHotspot( NearbyFlags::GetInstance().GetInt64Flag( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotCheckIpIntervalMillis); - NEARBY_LOGS(INFO) << "maximum IP check retries=" << ip_address_max_retries - << ", IP check interval=" - << ip_address_retry_interval_millis << "ms"; + LOG(INFO) << "maximum IP check retries=" << ip_address_max_retries + << ", IP check interval=" << ip_address_retry_interval_millis + << "ms"; for (int i = 0; i < ip_address_max_retries; i++) { - NEARBY_LOGS(INFO) << "Check IP address at attemp " << i; + LOG(INFO) << "Check IP address at attemp " << i; std::vector ip_addresses = GetIpv4Addresses(); if (ip_addresses.empty()) { Sleep(ip_address_retry_interval_millis); @@ -500,33 +556,35 @@ bool WifiHotspotMedium::ConnectWifiHotspot( } if (ip_address.empty()) { - NEARBY_LOGS(INFO) << "Failed to get IP address from hotspot."; + LOG(INFO) << "Failed to get IP address from hotspot."; + RestoreWifiConnection(); + DeleteNetworkProfile(nearby_softap.Ssid()); return false; } - NEARBY_LOGS(INFO) << "Got IP address " << ip_address << " from hotspot."; + LOG(INFO) << "Got IP address " << ip_address << " from hotspot."; std::string last_ssid = hotspot_credentials_->GetSSID(); + wifi_connected_hotspot_ssid_ = nearby_softap.Ssid(); + StoreHotspotSsid(winrt::to_string(wifi_connected_hotspot_ssid_)); medium_status_ |= kMediumStatusConnected; - NEARBY_LOGS(INFO) << "Connected to hotspot: " << last_ssid; + LOG(INFO) << "Connected to hotspot: " << last_ssid; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Cannot connet to Hotspot. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot connet to Hotspot. Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot connet to Hotspot. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": Cannot connet to Hotspot. WinRT exception: " + << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; } void WifiHotspotMedium::RestoreWifiConnection() { - if (!wifi_connected_network_ && wifi_adapter_) { + if (!wifi_original_network_ && wifi_adapter_) { wifi_adapter_.Disconnect(); return; } @@ -539,31 +597,31 @@ void WifiHotspotMedium::RestoreWifiConnection() { ssid = winrt::to_string( profile.WlanConnectionProfileDetails().GetConnectedSsid()); if (!ssid.empty() && - (winrt::to_string(wifi_connected_network_.Ssid()) == ssid)) { - NEARBY_LOGS(INFO) << "Already conneted to the previous WIFI network " - << ssid << "! Skip restoration."; + (winrt::to_string(wifi_original_network_.Ssid()) == ssid)) { + LOG(INFO) << "Already conneted to the previous WIFI network " << ssid + << "! Skip restoration."; return; } } // Disconnect to the WiFi connection through the WiFi adapter. wifi_adapter_.Disconnect(); - NEARBY_LOGS(INFO) << "Disconnected to current network."; + LOG(INFO) << "Disconnected to current network."; auto connect_result = wifi_adapter_ - .ConnectAsync(wifi_connected_network_, + .ConnectAsync(wifi_original_network_, WiFiReconnectionKind::Automatic) .get(); if (connect_result == nullptr || connect_result.ConnectionStatus() != WiFiConnectionStatus::Success) { - NEARBY_LOGS(INFO) << "Connecting to previous network failed with reason: " - << static_cast(connect_result.ConnectionStatus()); + LOG(INFO) << "Connecting to previous network failed with reason: " + << static_cast(connect_result.ConnectionStatus()); } else { - NEARBY_LOGS(INFO) << "Restored the previous WIFI connection: " - << winrt::to_string(wifi_connected_network_.Ssid()); + LOG(INFO) << "Restored the previous WIFI connection: " + << winrt::to_string(wifi_original_network_.Ssid()); } - wifi_connected_network_ = nullptr; + wifi_original_network_ = nullptr; } } @@ -572,64 +630,35 @@ bool WifiHotspotMedium::DisconnectWifiHotspot() { try { return InternalDisconnectWifiHotspot(); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Stop Hotspot failed. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Stop Hotspot failed. Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": Stop Hotspot failed. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Stop Hotspot failed. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; } bool WifiHotspotMedium::InternalDisconnectWifiHotspot() { if (!IsConnected()) { - NEARBY_LOGS(WARNING) - << "Cannot disconnect SoftAP because it is not connected."; + LOG(WARNING) << "Cannot disconnect SoftAP because it is not connected."; return true; } if (wifi_adapter_) { - // Gets connected WiFi profile. - auto profile = - wifi_adapter_.NetworkAdapter().GetConnectedProfileAsync().get(); - // Disconnect to the WiFi connection through the WiFi adapter. RestoreWifiConnection(); wifi_adapter_ = nullptr; - // Try to remove the WiFi profile - if (profile != nullptr && profile.CanDelete() && - profile.IsWlanConnectionProfile()) { - std::string ssid = winrt::to_string( - profile.WlanConnectionProfileDetails().GetConnectedSsid()); - - auto profile_delete_status = profile.TryDeleteAsync().get(); - switch (profile_delete_status) { - case ConnectionProfileDeleteStatus::Success: - NEARBY_LOGS(INFO) - << "WiFi profile with SSID:" << ssid << " is deleted."; - break; - case ConnectionProfileDeleteStatus::DeniedBySystem: - NEARBY_LOGS(ERROR) - << "Failed to delete WiFi profile with SSID:" << ssid - << " due to denied by system."; - break; - case ConnectionProfileDeleteStatus::DeniedByUser: - NEARBY_LOGS(ERROR) - << "Failed to delete WiFi profile with SSID:" << ssid - << " due to denied by user."; - break; - case ConnectionProfileDeleteStatus::UnknownError: - NEARBY_LOGS(ERROR) - << "Failed to delete WiFi profile with SSID:" << ssid - << " due to unknonw error."; - break; - default: - break; - } + if (!wifi_connected_hotspot_ssid_.empty()) { + LOG(INFO) << "Delete the previous connected network profile with SSID: " + << winrt::to_string(wifi_connected_hotspot_ssid_); + DeleteNetworkProfile(wifi_connected_hotspot_ssid_); + wifi_connected_hotspot_ssid_ = winrt::hstring(L""); + StoreHotspotSsid({}); } } @@ -637,6 +666,134 @@ bool WifiHotspotMedium::InternalDisconnectWifiHotspot() { return true; } +bool WifiHotspotMedium::DeleteNetworkProfile(winrt::hstring ssid) { + bool result = false; + ConnectionProfile profile{nullptr}; + auto connections = NetworkInformation::GetConnectionProfiles(); + auto ssid_string = winrt::to_string(ssid); + if (ssid_string.empty()) { + LOG(INFO) << "SSID is empty. No need to delete the network profile"; + return true; + } + + LOG(INFO) << "Search profile with SSID: " << ssid_string; + for (const auto& connection_profile : connections) { + if (connection_profile.ProfileName() == ssid) { + LOG(INFO) << "Found the network profile with SSID: " << ssid_string; + profile = connection_profile; + break; + } + } + if (profile == nullptr) { + LOG(INFO) << "No network profile found with SSID: " << ssid_string; + return result; + } + + if (profile != nullptr && profile.CanDelete() && + profile.IsWlanConnectionProfile()) { + auto profile_delete_status = profile.TryDeleteAsync().get(); + switch (profile_delete_status) { + case ConnectionProfileDeleteStatus::Success: + LOG(INFO) << "WiFi profile with SSID:" << ssid_string << " is deleted."; + result = true; + break; + case ConnectionProfileDeleteStatus::DeniedBySystem: + LOG(ERROR) << "Failed to delete WiFi profile with SSID:" << ssid_string + << " due to denied by system."; + break; + case ConnectionProfileDeleteStatus::DeniedByUser: + LOG(ERROR) << "Failed to delete WiFi profile with SSID:" << ssid_string + << " due to denied by user."; + break; + case ConnectionProfileDeleteStatus::UnknownError: + LOG(ERROR) << "Failed to delete WiFi profile with SSID:" << ssid_string + << " due to unknonw error."; + break; + default: + break; + } + } + return result; +} + +void WifiHotspotMedium::StoreHotspotSsid(std::string ssid) { + std::unique_ptr ssid_file; + try { + std::string file_name(kHotspotSsidFileName); + std::string full_path = + nearby::api::ImplementationPlatform::GetAppDataPath(file_name); + ssid_file = + nearby::api::ImplementationPlatform::CreateOutputFile(full_path); + if (ssid_file == nullptr) { + LOG(ERROR) << "Failed to create output file: " << file_name; + return; + } + ByteArray data(ssid); + ssid_file->Write(data); + } catch (std::exception exception) { + LOG(ERROR) << __func__ + << ": Failed to store Hotspot SSID. Exception: " + << exception.what(); + } catch (const winrt::hresult_error& error) { + LOG(ERROR) << __func__ + << ": Failed to store Hotspot SSID. WinRT exception: " + << error.code() << ": " + << winrt::to_string(error.message()); + } catch (...) { + LOG(ERROR) << __func__ << ": unknown error."; + } + if (ssid_file != nullptr) { + ssid_file->Close(); + } +} + +std::string WifiHotspotMedium::GetStoredHotspotSsid() { + std::unique_ptr ssid_file; + try { + std::string file_name(kHotspotSsidFileName); + std::string full_path = + nearby::api::ImplementationPlatform::GetAppDataPath(file_name); + std::unique_ptr ssid_file = + nearby::api::ImplementationPlatform::CreateInputFile(full_path, 0); + if (ssid_file == nullptr) { + LOG(ERROR) << "Failed to create input file: " << file_name; + return {}; + } + auto total_size = ssid_file->GetTotalSize(); + if (total_size == 0) { + LOG(INFO) << __func__ << ": No Hotspot ssid found."; + ssid_file->Close(); + return {}; + } + + nearby::ExceptionOr raw_ssid = ssid_file->Read(total_size); + + if (!raw_ssid.ok()) { + LOG(ERROR) << __func__ + << ": Failed to read Hotspot ssid. Exception: " + << raw_ssid.exception(); + return {}; + } + return std::string(raw_ssid.GetResult().data()); + } catch (std::exception exception) { + LOG(ERROR) << __func__ + << ": Failed to store Hotspot SSID. Exception: " + << exception.what(); + } catch (const winrt::hresult_error& error) { + LOG(ERROR) << __func__ + << ": Failed to store Hotspot SSID. WinRT exception: " + << error.code() << ": " + << winrt::to_string(error.message()); + } catch (...) { + LOG(ERROR) << __func__ << ": unknown error."; + } + if (ssid_file != nullptr) { + ssid_file->Close(); + } + + return {}; +} + std::string WifiHotspotMedium::GetErrorMessage(std::exception_ptr eptr) { try { if (eptr) { diff --git a/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc b/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc index a9d2f6f2..08b8a0c5 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc @@ -58,8 +58,8 @@ std::string WifiHotspotServerSocket::GetIPAddress() const { } std::string hotspot_ip_address = GetHotspotIpAddress(); - NEARBY_LOGS(INFO) << __func__ - << ": Return hotspot IP address: " << hotspot_ip_address; + LOG(INFO) << __func__ + << ": Return hotspot IP address: " << hotspot_ip_address; return hotspot_ip_address; } @@ -69,7 +69,7 @@ int WifiHotspotServerSocket::GetPort() const { platform::config_package_nearby::nearby_platform_feature:: kEnableHotspotWin32Socket)) { if (listen_socket_ == INVALID_SOCKET) { - NEARBY_LOGS(WARNING) << __func__ << ": listen_socket_ is invalid."; + LOG(WARNING) << __func__ << ": listen_socket_ is invalid."; return 0; } return port_; @@ -83,7 +83,7 @@ int WifiHotspotServerSocket::GetPort() const { std::unique_ptr WifiHotspotServerSocket::Accept() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Accept is called."; + LOG(INFO) << __func__ << ": Accept is called."; if (NearbyFlags::GetInstance().GetBoolFlag( platform::config_package_nearby::nearby_platform_feature:: @@ -95,7 +95,7 @@ std::unique_ptr WifiHotspotServerSocket::Accept() { SOCKET wifi_hotspot_socket = pending_client_sockets_.front(); pending_client_sockets_.pop_front(); - NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection."; + LOG(INFO) << __func__ << ": Accepted a remote connection."; return std::make_unique(wifi_hotspot_socket); } @@ -107,7 +107,7 @@ std::unique_ptr WifiHotspotServerSocket::Accept() { StreamSocket wifi_hotspot_socket = pending_sockets_.front(); pending_sockets_.pop_front(); - NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection."; + LOG(INFO) << __func__ << ": Accepted a remote connection."; return std::make_unique(wifi_hotspot_socket); } @@ -119,7 +119,7 @@ void WifiHotspotServerSocket::SetCloseNotifier( Exception WifiHotspotServerSocket::Close() { try { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Close is called."; + LOG(INFO) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -129,7 +129,7 @@ Exception WifiHotspotServerSocket::Close() { platform::config_package_nearby::nearby_platform_feature:: kEnableHotspotWin32Socket)) { if (listen_socket_ != INVALID_SOCKET) { - NEARBY_LOGS(INFO) << ": Close listen_socket_: " << listen_socket_; + LOG(INFO) << ": Close listen_socket_: " << listen_socket_; // Trigger close event manually WSASetEvent(socket_events_[kSocketEventClose]); shutdown(listen_socket_, 2); @@ -170,23 +170,23 @@ Exception WifiHotspotServerSocket::Close() { close_notifier_(); } - NEARBY_LOGS(INFO) << __func__ << ": Close completed succesfully."; + LOG(INFO) << __func__ << ": Close completed succesfully."; return {Exception::kSuccess}; } catch (std::exception exception) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error &error) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -195,7 +195,7 @@ fire_and_forget WifiHotspotServerSocket::Listener_ConnectionReceived( StreamSocketListener listener, StreamSocketListenerConnectionReceivedEventArgs const &args) { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Received connection."; + LOG(INFO) << __func__ << ": Received connection."; if (closed_) { return fire_and_forget{}; @@ -231,17 +231,16 @@ bool WifiHotspotServerSocket::SetupServerSocketWinRT() { return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Cannot accept connection on preferred port. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot accept connection on preferred port. Exception: " + << exception.what(); } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ":Cannot accept connection on preferred port. WinRT exception: " << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } try { @@ -249,26 +248,25 @@ bool WifiHotspotServerSocket::SetupServerSocketWinRT() { // need to save the port information. port_ = std::stoi(stream_socket_listener_.Information().LocalPort().c_str()); - NEARBY_LOGS(INFO) << "Server Socket port: " << port_; + LOG(INFO) << "Server Socket port: " << port_; return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Cannot bind to any port. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot bind to any port. Exception: " << exception.what(); } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot bind to any port. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Cannot bind to any port. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; } void WifiHotspotServerSocket::SocketErrorNotice(absl::string_view reason) { - NEARBY_LOGS(WARNING) << "socket error. " << reason - << " failed with error: " << WSAGetLastError(); + LOG(WARNING) << "socket error. " << reason + << " failed with error: " << WSAGetLastError(); for (auto &it : socket_events_) { if (it != WSA_INVALID_EVENT) { WSACloseEvent(it); @@ -281,18 +279,17 @@ void WifiHotspotServerSocket::SocketErrorNotice(absl::string_view reason) { bool WifiHotspotServerSocket::SetupServerSocketWinSock() { WSADATA wsa_data; - WSAEVENT socket_event; int flag = 1; int result = WSAStartup(MAKEWORD(2, 2), &wsa_data); if (result != 0) { - NEARBY_LOGS(WARNING) << "WSAStartup failed with error:" << result; + LOG(WARNING) << "WSAStartup failed with error:" << result; return false; } listen_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (listen_socket_ == INVALID_SOCKET) { - NEARBY_LOGS(WARNING) << "Failed to get socket"; + LOG(WARNING) << "Failed to get socket"; WSACleanup(); return false; } @@ -310,7 +307,7 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { SocketErrorNotice("Bind"); return false; } - NEARBY_LOGS(INFO) << "Bind socket successful"; + LOG(INFO) << "Bind socket successful"; int size = sizeof(serv_addr); memset(&serv_addr, 0, size); @@ -320,7 +317,7 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { return false; } port_ = ntohs(serv_addr.sin_port); - NEARBY_LOGS(INFO) << "Hotspot Server bound to port: " << port_; + LOG(INFO) << "Hotspot Server bound to port: " << port_; socket_events_[kSocketEventListen] = WSACreateEvent(); if (socket_events_[kSocketEventListen] == WSA_INVALID_EVENT) { @@ -346,8 +343,8 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { SocketErrorNotice("Listen"); return false; } - NEARBY_LOGS(INFO) << "Hotspot Server Socket " << listen_socket_ - << " started to listen with socket event: " << socket_event; + LOG(INFO) << "Hotspot Server Socket " << listen_socket_ + << " started to listen."; submittable_executor_.Execute([this]() { DWORD index; @@ -356,33 +353,33 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { index = WSAWaitForMultipleEvents(kSocketEventsCount, socket_events_, FALSE, WSA_INFINITE, FALSE); - NEARBY_LOGS(INFO) << "Hotspot Server Socket " << listen_socket_ - << " received event index: " << index; + LOG(INFO) << "Hotspot Server Socket " << listen_socket_ + << " received event index: " << index; if (index == WSA_WAIT_TIMEOUT || index == WSA_WAIT_FAILED) { - NEARBY_LOGS(INFO) << "Hotspot Server Socket timout or failed "; + LOG(INFO) << "Hotspot Server Socket timout or failed "; return false; } index = index - WSA_WAIT_EVENT_0; if (index == kSocketEventClose) { // the socket is closed by SDK - NEARBY_LOGS(INFO) << "listner socket is closed."; + LOG(INFO) << "listner socket is closed."; return false; } // Iterate through all events and enumerate if (WSAEnumNetworkEvents(listen_socket_, socket_events_[index], &network_events) == SOCKET_ERROR) { - NEARBY_LOGS(INFO) << "Iterate through all events failed"; + LOG(INFO) << "Iterate through all events failed"; return false; } if (network_events.lNetworkEvents & FD_CLOSE) { - NEARBY_LOGS(INFO) << "Reveived FD_CLOSE event"; + LOG(INFO) << "Reveived FD_CLOSE event"; return false; } if (network_events.lNetworkEvents & FD_ACCEPT) { client_socket_ = accept(listen_socket_, nullptr, nullptr); - NEARBY_LOGS(INFO) << "Reveived FD_ACCEPT event."; + LOG(INFO) << "Reveived FD_ACCEPT event."; if (client_socket_ == INVALID_SOCKET) { return false; @@ -390,13 +387,12 @@ bool WifiHotspotServerSocket::SetupServerSocketWinSock() { if (WSAEventSelect(listen_socket_, socket_events_[kSocketEventListen], 0) == SOCKET_ERROR) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << "Remove association between listen_socket_ and event failed: " << WSAGetLastError(); } - NEARBY_LOGS(INFO) << "Hotspot Server Client Socket created: " - << client_socket_; + LOG(INFO) << "Hotspot Server Client Socket created: " << client_socket_; if (closed_) { return false; } @@ -420,24 +416,23 @@ bool WifiHotspotServerSocket::listen() { NearbyFlags::GetInstance().GetInt64Flag( platform::config_package_nearby::nearby_platform_feature:: kWifiHotspotCheckIpIntervalMillis); - NEARBY_LOGS(INFO) << "maximum IP check retries=" << ip_address_max_retries - << ", IP check interval=" - << ip_address_retry_interval_millis << "ms"; + LOG(INFO) << "maximum IP check retries=" << ip_address_max_retries + << ", IP check interval=" << ip_address_retry_interval_millis + << "ms"; for (int i = 0; i < ip_address_max_retries; i++) { hotspot_ipaddr_ = GetHotspotIpAddress(); if (hotspot_ipaddr_.empty()) { - NEARBY_LOGS(WARNING) << "Failed to find Hotspot's IP addr for the try: " - << i + 1 << ". Wait " - << ip_address_retry_interval_millis - << "ms snd try again"; + LOG(WARNING) << "Failed to find Hotspot's IP addr for the try: " << i + 1 + << ". Wait " << ip_address_retry_interval_millis + << "ms snd try again"; Sleep(ip_address_retry_interval_millis); } else { break; } } if (hotspot_ipaddr_.empty()) { - NEARBY_LOGS(WARNING) << "Failed to start accepting connection without IP " - "addresses configured on computer."; + LOG(WARNING) << "Failed to start accepting connection without IP " + "addresses configured on computer."; return false; } @@ -477,24 +472,24 @@ std::string WifiHotspotServerSocket::GetHotspotIpAddress() const { // Windows always creates Hotspot at address "192.168.137.1". for (auto &ip_candidate : ip_candidates) { if (ip_candidate == "192.168.137.1") { - NEARBY_LOGS(INFO) << "Found Hotspot IP: " << ip_candidate; + LOG(INFO) << "Found Hotspot IP: " << ip_candidate; return ip_candidate; } } - NEARBY_LOGS(INFO) << "Found Hotspot IP: " << ip_candidates.front(); + LOG(INFO) << "Found Hotspot IP: " << ip_candidates.front(); return ip_candidates.front(); } return {}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {}; } catch (const winrt::hresult_error &error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {}; } } diff --git a/internal/platform/implementation/windows/wifi_hotspot_socket.cc b/internal/platform/implementation/windows/wifi_hotspot_socket.cc index 15999d37..d2cd2d75 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_socket.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_socket.cc @@ -12,11 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/windows/wifi_hotspot.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { @@ -44,12 +49,12 @@ WifiHotspotSocket::~WifiHotspotSocket() { Close(); } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } } @@ -68,14 +73,14 @@ Exception WifiHotspotSocket::Close() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -101,7 +106,7 @@ ExceptionOr WifiHotspotSocket::SocketInputStream::Read( input_stream_.ReadAsync(buffer, size, InputStreamOptions::None).get(); if (ibuffer.Length() != size) { - NEARBY_LOGS(WARNING) << "Only got part of data of needed."; + LOG(WARNING) << "Only got part of data of needed."; } ByteArray data((char*)ibuffer.data(), ibuffer.Length()); @@ -118,7 +123,7 @@ ExceptionOr WifiHotspotSocket::SocketInputStream::Read( return ExceptionOr(data); } if (result == 0) { - NEARBY_LOGS(INFO) << "Connection closed."; + LOG(INFO) << "Connection closed."; return {Exception::kIo}; } // When WSAEWOULDBLOCK happens, it means the packet for receive is not @@ -139,14 +144,14 @@ ExceptionOr WifiHotspotSocket::SocketInputStream::Read( } return {Exception::kIo}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -171,7 +176,7 @@ ExceptionOr WifiHotspotSocket::SocketInputStream::Skip(size_t offset) { return ExceptionOr((size_t)result); } if (result == 0) { - NEARBY_LOGS(INFO) << "Connection closed."; + LOG(INFO) << "Connection closed."; } else { // When WSAEWOULDBLOCK happens, it means the packet for receive is not // ready at the moment. The API select() will block till the packet is @@ -191,14 +196,14 @@ ExceptionOr WifiHotspotSocket::SocketInputStream::Skip(size_t offset) { } return {Exception::kIo}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -213,14 +218,14 @@ Exception WifiHotspotSocket::SocketInputStream::Close() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -256,18 +261,18 @@ Exception WifiHotspotSocket::SocketOutputStream::Write(const ByteArray& data) { if (result > 0) { return {Exception::kSuccess}; } - NEARBY_LOGS(INFO) << "recv failed: " << WSAGetLastError(); + LOG(INFO) << "recv failed: " << WSAGetLastError(); return {Exception::kIo}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -279,14 +284,14 @@ Exception WifiHotspotSocket::SocketOutputStream::Flush() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -301,14 +306,14 @@ Exception WifiHotspotSocket::SocketOutputStream::Close() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } diff --git a/internal/platform/implementation/windows/wifi_hotspot_test.cc b/internal/platform/implementation/windows/wifi_hotspot_test.cc new file mode 100644 index 00000000..3f4bf4a3 --- /dev/null +++ b/internal/platform/implementation/windows/wifi_hotspot_test.cc @@ -0,0 +1,144 @@ +// Copyright 2023 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. + +#include "internal/platform/implementation/windows/wifi_hotspot.h" + +#include +#include +#include + +#include "gtest/gtest.h" +#include "absl/time/clock.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" +#include "internal/platform/logging.h" +#include "internal/platform/wifi_credential.h" + +namespace nearby { +namespace windows { +namespace { + +TEST(WifiHotspotMedium, DISABLED_StartWifiHotspot) { + int run_test; + LOG(INFO) << "Run StartWifiHotspot test case? input 0 or 1:"; + std::cin >> run_test; + + if (run_test) { + HotspotCredentials hotspot_credentials; + WifiHotspotMedium hotspot_medium; + + NearbyFlags::GetInstance().OverrideBoolFlagValue( + platform::config_package_nearby::nearby_platform_feature:: + kEnableIntelPieSdk, + true); + + EXPECT_TRUE(hotspot_medium.IsInterfaceValid()); + EXPECT_TRUE(hotspot_medium.StartWifiHotspot(&hotspot_credentials)); + + while (true) { + LOG(INFO) << "Enter \"s\" to stop test:"; + std::string stop; + std::cin >> stop; + if (stop == "s") { + LOG(INFO) << "Exit WiFi Hotspot"; + EXPECT_TRUE(hotspot_medium.StopWifiHotspot()); + break; + } + } + } else { + LOG(INFO) << "Skip the test"; + } +} + +TEST(WifiHotspotMedium, DISABLED_WifiHotspotServerStartListen) { + int run_test; + LOG(INFO) << "Run WifiHotspotServerStartListen test? input 0 or 1:"; + std::cin >> run_test; + + if (run_test) { + HotspotCredentials hotspot_credentials; + WifiHotspotMedium hotspot_medium; + + EXPECT_TRUE(hotspot_medium.IsInterfaceValid()); + EXPECT_TRUE(hotspot_medium.StartWifiHotspot(&hotspot_credentials)); + absl::SleepFor(absl::Seconds(1)); + std::unique_ptr server_socket = + hotspot_medium.ListenForService(0); + absl::SleepFor(absl::Seconds(10)); + std::unique_ptr client_socket = + server_socket->Accept(); + + while (true) { + LOG(INFO) << "Enter \"s\" to stop test:"; + std::string stop; + std::cin >> stop; + if (stop == "s") { + LOG(INFO) << "Close server socket and stop WiFi Hotspot"; + server_socket->Close(); + EXPECT_TRUE(hotspot_medium.StopWifiHotspot()); + break; + } + } + } else { + LOG(INFO) << "Skip the test"; + } +} + +TEST(WifiHotspotMedium, DISABLED_ConnectWifiHotspot) { + int run_test; + LOG(INFO) << "Run ConnectWifiHotspot test case? input 0 or 1:"; + std::cin >> run_test; + + if (run_test) { + HotspotCredentials hotspot_credentials; + WifiHotspotMedium hotspot_medium; + LOG(INFO) << "Enter Network SSID to be connected: "; + std::string ssid; + std::cin >> ssid; + LOG(INFO) << "Enter password: "; + std::string password; + std::cin >> password; + LOG(INFO) << "Enter frequency(input 0 if unknown): "; + int frequency; + std::cin >> frequency; + + hotspot_credentials.SetSSID(ssid); + hotspot_credentials.SetPassword(password); + hotspot_credentials.SetFrequency(frequency); + + NearbyFlags::GetInstance().OverrideBoolFlagValue( + platform::config_package_nearby::nearby_platform_feature:: + kEnableIntelPieSdk, + true); + + EXPECT_TRUE(hotspot_medium.ConnectWifiHotspot(&hotspot_credentials)); + absl::SleepFor(absl::Seconds(1)); + while (true) { + LOG(INFO) << "Enter \"s\" to stop test:"; + std::string stop; + std::cin >> stop; + if (stop == "s") { + LOG(INFO) << "Disconnect WiFi"; + EXPECT_TRUE(hotspot_medium.DisconnectWifiHotspot()); + break; + } + } + } else { + LOG(INFO) << "Skip the test"; + } +} + +} // namespace +} // namespace windows +} // namespace nearby diff --git a/internal/platform/implementation/windows/wifi_intel.cc b/internal/platform/implementation/windows/wifi_intel.cc new file mode 100644 index 00000000..737dfc01 --- /dev/null +++ b/internal/platform/implementation/windows/wifi_intel.cc @@ -0,0 +1,679 @@ +// Copyright 2022 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. + +#include "internal/platform/implementation/windows/wifi_intel.h" + +// clang-format off +#include // NOLINT +#include +#include +#include +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include // NOLINT +#include +// clang-format on + +#include +#include +#include +#include +#include +#include + +#ifndef NO_INTEL_PIE +#include "absl/strings/str_format.h" +#include "third_party/intel/pie/include/PieApiErrors.h" +#include "third_party/intel/pie/include/PieApiTypes.h" +#include "third_party/intel/pie/include/PieDefinitions.h" +#include "third_party/intel/pie/include/PieErrorMacro.h" +#include "internal/platform/logging.h" +#endif + +namespace nearby { +namespace windows { +namespace { + +#define SAFEDELETE(x) \ + { \ + try { \ + if (x) { \ + delete x; \ + x = nullptr; \ + } \ + } catch (...) { \ + LOG(INFO) << absl::StrFormat("Exception while delete memory at 0x%p ", \ + (void*)x); \ + } \ + } + +#define SAFEDELETEARRAY(x) \ + { \ + try { \ + if (x) { \ + delete[] x; \ + x = nullptr; \ + } \ + } catch (...) { \ + LOG(INFO) << absl::StrFormat("Exception while delete memory at 0x%p ", \ + (void*)x); \ + } \ + } + +#define SAFEFREELIBRARY(x) \ + { \ + try { \ + if (x) { \ + FreeLibrary(x); \ + x = nullptr; \ + } \ + } catch (...) { \ + LOG(INFO) << absl::StrFormat("Exception while freeing library at 0x%p ", \ + (void*)x); \ + } \ + } + +#ifndef NO_INTEL_PIE +#define PIE_API_DLL L"\\MurocApi.dll" +#define ERROR_ +const wchar_t PIE_HW_ID_[] = L"SWC\\VID_8086&PID_PIE&SID_0001\0"; +const wchar_t PIE_DLL_PATH_HINT[] = L"PiePathHint"; +#endif +} // namespace +#ifndef NO_INTEL_PIE +typedef MUROC_RET(APIENTRY* WIFIGETADAPTERLIST)( // NOLINT + PINTEL_WIFI_HEADER pHeader, void** pAdapterList); +typedef MUROC_RET(APIENTRY* REGISTERINTELCB)( + MurocDefs::PINTEL_CALLBACK pIntelCallback); +typedef MUROC_RET(APIENTRY* GETRADIOSTATE)(HADAPTER hAdapter, bool* bEnabled); +typedef MUROC_RET(APIENTRY* WIFIPANQUERYPREFERREDCHANNELSETTING)( + HADAPTER hAdapter, PINTEL_WIFI_HEADER pHeader, + void* pOutQueryPreferredChannel); +typedef MUROC_RET(APIENTRY* WIFILEGACYGOSETSCANFILTER)( + HADAPTER hAdapter, PINTEL_WIFI_HEADER pHeader, void* pInputData); +typedef MUROC_RET(APIENTRY* WIFIPANRESETLEGACYGOSCANFILTER)( + HADAPTER hAdapter, PINTEL_WIFI_HEADER pHeader); +typedef MUROC_RET(APIENTRY* DEREGISTERINTELCB)( + MurocDefs::INTEL_EVENT_CALLBACK fnCallbac); +typedef MUROC_RET(APIENTRY* FREELISTMEMORY)(void* pList); + +// Forward declarations of the internal private functions +wchar_t* GetEntireRegistryDeviceList(); +bool IsHwIdMatching(DEVINST devInst, const wchar_t* expecedHwId); +DEVINST SearchForDeviceInstance(wchar_t* pEntireDeviceList); +void CloseRegKeyHandle(HKEY softwareKey); // NOLINT +void OpenRegKeyHandle(DEVINST devInst, HKEY& softwareKey); +DWORD GetRegKeyWCHARValue(DEVINST deviceInstance, LPCWSTR keyName, // NOLINT + wchar_t* valOut, PDWORD pValLen, // NOLINT + PDWORD pDataType); // NOLINT +DWORD GetFullDllLoadPathFromPieRegistry(DEVINST pieDeviceInstance, + PWCHAR* ppDllPathValue); // NOLINT +HADAPTER WifiGetAdapterList(HINSTANCE murocApiDllHandle, // NOLINT + PINTEL_ADAPTER_LIST_V120* ppAllAdapters); +void RegisterIntelCallback(HINSTANCE murocApiDllHandle, + MurocDefs::PINTEL_CALLBACK pIntelEventCbHandle); +void DeregisterIntelCallback(HINSTANCE murocApiDllHandle, + MurocDefs::INTEL_EVENT_CALLBACK fnCallback); +void FreeMemoryList(HINSTANCE murocApiDllHandle, void* ptr); + +void WINAPI IntelEventHandler(MurocDefs::INTEL_EVENT iEvent, // NOLINT + void* pContext); +// g_intel_event_cb_handle must be the address of a global and not on the stack +// because the CB comes from another thread +MurocDefs::INTEL_CALLBACK g_intel_event_cb_handle = {IntelEventHandler, + nullptr}; +#endif + +WifiIntel& WifiIntel::GetInstance() { + static std::aligned_storage_t storage; + static WifiIntel* instance = new (&storage) WifiIntel(); + return *instance; +} + +bool WifiIntel::Start() { + LOG(INFO) << "WifiIntel::Start()"; +#ifndef NO_INTEL_PIE + muroc_api_dll_handle_ = PIEDllLoader(); + if ((muroc_api_dll_handle_ != nullptr)) { + LOG(INFO) << "Load PIE_API_DLL completed successfully"; + + wifi_adapter_handle_ = + WifiGetAdapterList(muroc_api_dll_handle_, &p_all_adapters_); + if (wifi_adapter_handle_ != INVALID_HADAPTER) { + intel_wifi_valid_ = true; + RegisterIntelCallback(muroc_api_dll_handle_, &g_intel_event_cb_handle); + } else { + SAFEFREELIBRARY(muroc_api_dll_handle_); + } + } +#else + LOG(INFO) << "NO_INTEL_PIE found, skip"; +#endif + return intel_wifi_valid_; +} + +void WifiIntel::Stop() { + LOG(INFO) << "WifiIntel::Stop()"; +#ifndef NO_INTEL_PIE + if (intel_wifi_valid_) { + LOG(INFO) << "Deregister Intel Callback, free Adapters Memory " + "List, free Muroc Api Dll handler."; + DeregisterIntelCallback(muroc_api_dll_handle_, IntelEventHandler); + FreeMemoryList(muroc_api_dll_handle_, p_all_adapters_); + SAFEFREELIBRARY(muroc_api_dll_handle_); + } +#else + LOG(INFO) << "NO_INTEL_PIE found, skip"; +#endif +} + +int WifiIntel::GetGOChannel() { +#ifndef NO_INTEL_PIE + WIFIPANQUERYPREFERREDCHANNELSETTING WifiPanQueryPreferredChannelSettingFunc = + nullptr; + int channel = -1; + + DWORD dwError = ERROR_SUCCESS; // NOLINT + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; // NOLINT + INTEL_WIFI_HEADER intelWifiHeader; + MurocDefs::INTEL_GO_OPERATION_CHANNEL_SETTING intelGOChan; + + if (!intel_wifi_valid_) return channel; + + WifiPanQueryPreferredChannelSettingFunc = + (WIFIPANQUERYPREFERREDCHANNELSETTING)GetProcAddress( // NOLINT + muroc_api_dll_handle_, "WifiPanQueryPreferredChannelSetting"); + + if (WifiPanQueryPreferredChannelSettingFunc == nullptr) { + dwError = GetLastError(); // NOLINT + LOG(INFO) << "GetProcAddress WifiPanQueryPreferredChannelSetting error: " + << dwError; + return channel; + } + VLOG(1) + << "Load WifiPanQueryPreferredChannelSetting API completed successfully"; + + intelWifiHeader.dwSize = + sizeof(MurocDefs::INTEL_GO_OPERATION_CHANNEL_SETTING); + memset(&intelGOChan, 0, sizeof(intelGOChan)); + murocApiRetVal = WifiPanQueryPreferredChannelSettingFunc( + wifi_adapter_handle_, &intelWifiHeader, (void*)&intelGOChan); + + if (murocApiRetVal == IWLAN_E_SUCCESS) { // NOLINT + LOG(INFO) << "Calling WifiPanQueryPreferredChannelSetting API succeeded"; + if (intelGOChan.goState == MurocDefs::INTEL_GO_CURRENT_CHANNEL_ACTIVE) { + channel = intelGOChan.channel; + } else { + LOG(INFO) << "No active GO found, return -1"; + } + } else { + LOG(INFO) << "Calling WifiPanQueryPreferredChannelSetting API " + "failed with error: " + << murocApiRetVal; + } + + return channel; +#else + LOG(INFO) << "NO_INTEL_PIE found, return -1"; + return -1; +#endif +} + +bool WifiIntel::SetScanFilter(int channel) { +#ifndef NO_INTEL_PIE + WIFILEGACYGOSETSCANFILTER WifiLegacyGoSetScanFilterFunc = nullptr; + DWORD dwError = ERROR_SUCCESS; // NOLINT + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; // NOLINT + INTEL_WIFI_HEADER intelWifiHeader; + MurocDefs::WIFI_LEGACY_GO_SCAN_FILTER scanFilter; + + if (channel <= 0) return false; + if (!intel_wifi_valid_) return false; + + LOG(INFO) << "Set scan channel:" << channel; + WifiLegacyGoSetScanFilterFunc = + (WIFILEGACYGOSETSCANFILTER)GetProcAddress( // NOLINT + muroc_api_dll_handle_, "WifiLegacyGoSetScanFilter"); + + if (WifiLegacyGoSetScanFilterFunc == nullptr) { + dwError = GetLastError(); // NOLINT + LOG(INFO) << "GetProcAddress WifiLegacyGoSetScanFilterFunc error: " + << dwError; + return false; + } + VLOG(1) << "Load WifiLegacyGoSetScanFilterFunc API completed successfully"; + + intelWifiHeader.dwSize = sizeof(MurocDefs::WIFI_LEGACY_GO_SCAN_FILTER); + memset(&scanFilter, 0, sizeof(scanFilter)); + scanFilter.channel = (UINT8)channel; + murocApiRetVal = WifiLegacyGoSetScanFilterFunc( + wifi_adapter_handle_, &intelWifiHeader, (void*)&scanFilter); + + if (murocApiRetVal == IWLAN_E_SUCCESS) { // NOLINT + LOG(INFO) << "Calling WifiLegacyGoSetScanFilter API " + "succeeded, set scan channel to " + << channel; + return true; + } + LOG(INFO) << "Calling WifiLegacyGoSetScanFilter API " + "failed with error: " + << murocApiRetVal; + + return false; +#else + LOG(INFO) << "NO_INTEL_PIE found, return -1"; + return false; +#endif +} + +bool WifiIntel::ResetScanFilter() { +#ifndef NO_INTEL_PIE + WIFIPANRESETLEGACYGOSCANFILTER WifiPanReSetLegacyGoScanFilterFunc = nullptr; + DWORD dwError = ERROR_SUCCESS; // NOLINT + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; // NOLINT + INTEL_WIFI_HEADER intelWifiHeader; + + if (!intel_wifi_valid_) return false; + + WifiPanReSetLegacyGoScanFilterFunc = + (WIFIPANRESETLEGACYGOSCANFILTER)GetProcAddress( // NOLINT + muroc_api_dll_handle_, "WifiPanReSetLegacyGoScanFilter"); + + if (WifiPanReSetLegacyGoScanFilterFunc == nullptr) { + dwError = GetLastError(); // NOLINT + LOG(INFO) << "GetProcAddress WifiPanReSetLegacyGoScanFilterFunc error: " + << dwError; + return false; + } + VLOG(1) + << "Load WifiPanReSetLegacyGoScanFilterFunc API completed successfully"; + intelWifiHeader.dwSize = 0; + murocApiRetVal = WifiPanReSetLegacyGoScanFilterFunc(wifi_adapter_handle_, + &intelWifiHeader); + + if (murocApiRetVal == IWLAN_E_SUCCESS) { // NOLINT + LOG(INFO) << "Calling WifiPanReSetLegacyGoScanFilter API succeeded"; + return true; + } + LOG(INFO) << "Calling WifiPanQueryPreferredChannelSetting API " + "failed with error: " + << murocApiRetVal; + + return false; +#else + LOG(INFO) << "NO_INTEL_PIE found, return -1"; + return false; +#endif +} + +#ifndef NO_INTEL_PIE +wchar_t* GetEntireRegistryDeviceList() { + CONFIGRET configRet = CR_SUCCESS; + wchar_t* pDeviceList = nullptr; + ULONG deviceListLength = 0; // NOLINT + + // retrieves the buffer size required to hold a list of device instance IDs + // for the local machine's device instances. + configRet = CM_Get_Device_ID_List_SizeW(&deviceListLength, nullptr, + CM_GETIDLIST_FILTER_PRESENT); + + if (configRet == CR_SUCCESS) { + // Allocates a block of memory from a heap.for the Devices List + pDeviceList = + (wchar_t*)new BYTE[deviceListLength * sizeof(wchar_t)]; // NOLINT + if (nullptr != pDeviceList) { + // retrieves a list of device instance IDs for the local computer's device + // instances + configRet = CM_Get_Device_ID_ListW(nullptr, pDeviceList, deviceListLength, + CM_GETIDLIST_FILTER_PRESENT); + if (configRet != CR_SUCCESS) { + LOG(INFO) << "Unexpected error! CM_Get_Device_ID_List return Value of " + << configRet; + SAFEDELETEARRAY(pDeviceList); + } + } else { + configRet = CR_OUT_OF_MEMORY; + LOG(INFO) + << "Unexpected error! failed to allocate memory to the device list"; + } + } else { + LOG(INFO) << "Unexpected error! CM_Get_Device_ID_List_Size return Value of " + << configRet; + } + + return pDeviceList; +} + +bool IsHwIdMatching(DEVINST devInst, const wchar_t* expecedHwId) { + bool isHwIdFound = false; + DEVPROPTYPE propertyType = DEVPROP_TYPE_STRING_LIST; + CONFIGRET configRet; + wchar_t currentDeviceHwId[MAX_DEVICE_ID_LEN] = {0}; + ULONG propertySize; + + // Query the Hardware ID property of the device instance + propertySize = sizeof(currentDeviceHwId); + configRet = CM_Get_DevNode_PropertyW(devInst, &DEVPKEY_Device_HardwareIds, + &propertyType, (BYTE*)currentDeviceHwId, + &propertySize, 0); + if (configRet == CR_SUCCESS) { + // Compare to given HW ID + wchar_t* pdest = wcsstr(currentDeviceHwId, expecedHwId); // NOLINT + if (nullptr != pdest) { + std::wcout << "wifi_intel.cc" << ":" << __LINE__ + << "] Intel WIFI hwId is found: " << expecedHwId << std::endl; + isHwIdFound = true; + } + } + return isHwIdFound; +} + +DEVINST SearchForDeviceInstance(wchar_t* pEntireDeviceList) { + DEVINST devInst = NULL; // NOLINT + + if (pEntireDeviceList != nullptr) { + bool isMatchingDeviceFound = false; + wchar_t* currentDevice = nullptr; + CONFIGRET configRet = CR_SUCCESS; + + // Loop - over the devices List and Find PIE device by HW ID + for (currentDevice = pEntireDeviceList; + (0 != *currentDevice) && (!isMatchingDeviceFound); + currentDevice += wcslen(currentDevice) + 1) { // NOLINT + // If the list of devices also includes non-present devices, + // CM_LOCATE_DEVNODE_PHANTOM should be used in place of + // CM_LOCATE_DEVNODE_NORMAL. + configRet = + CM_Locate_DevNodeW(&devInst, currentDevice, CM_LOCATE_DEVNODE_NORMAL); + if (configRet != CR_SUCCESS) { + LOG(INFO) << "Unexpected error! CM_Locate_DevNode return Value of " + << configRet; + devInst = NULL; + break; + } + isMatchingDeviceFound = IsHwIdMatching(devInst, PIE_HW_ID_); + if (isMatchingDeviceFound) { + LOG(INFO) << "Intel WIFI Device is found!"; + break; + } else { + devInst = NULL; + } + } + } + + return devInst; +} + +void CloseRegKeyHandle(HKEY softwareKey) { + // close the registry + RegCloseKey(softwareKey); +} + +void OpenRegKeyHandle(DEVINST devInst, HKEY& softwareKey) { + CONFIGRET configRet = CR_SUCCESS; + + if (devInst != NULL) { + // opens a registry key for device-specific configuration information. + configRet = CM_Open_DevNode_Key(devInst, KEY_READ, 0, // NOLINT + RegDisposition_OpenExisting, &softwareKey, + CM_REGISTRY_SOFTWARE); + + VLOG(1) << absl::StrFormat("softwareKey %p ", softwareKey); + + if (configRet != CR_SUCCESS) { + LOG(INFO) << "Unexpected error! CM_Open_DevNode_Key return Value of " + << configRet; + } + } else { + LOG(INFO) << "devInst is NULL"; + } +} + +DWORD GetRegKeyWCHARValue(DEVINST deviceInstance, LPCWSTR keyName, + wchar_t* valOut, PDWORD pValLen, PDWORD pDataType) { + HKEY softwareKey; + DWORD ret = ERROR_SUCCESS; + + if (deviceInstance != NULL) { + OpenRegKeyHandle(deviceInstance, softwareKey); + + ret = RegQueryValueExW(softwareKey, keyName, nullptr, pDataType, + (LPBYTE)valOut, pValLen); // NOLINT + + CloseRegKeyHandle(softwareKey); + } else { + LOG(INFO) << "Couldn't find dev instacne for device :-( "; + ret = ERROR_NOT_FOUND; // NOLINT + } + return ret; +} + +DWORD GetFullDllLoadPathFromPieRegistry(DEVINST pieDeviceInstance, + PWCHAR* ppDllPathValue) { + DWORD status = ERROR_SUCCESS; + DWORD dllPathBufferLen = 0; + DWORD regKeyDataType = 0; + DWORD dllFullPathLen = 0; + PWCHAR pLoadPathString = nullptr; + std::wstring pathString = {}; + + // Get the buffer size to allocate the dll load path + status = GetRegKeyWCHARValue(pieDeviceInstance, PIE_DLL_PATH_HINT, nullptr, + &dllPathBufferLen, ®KeyDataType); + if (status != ERROR_SUCCESS) { + LOG(INFO) << "Unexpected error! GetRegKeyWCHARValue return Value of " + << status; + return status; + } else { + VLOG(1) << "Queried key length successfully!"; + } + + dllFullPathLen = (dllPathBufferLen + sizeof(PIE_API_DLL)); + VLOG(1) << "dll Full Path Length = " << dllFullPathLen; + + pLoadPathString = new wchar_t[dllFullPathLen]; + SecureZeroMemory(pLoadPathString, dllFullPathLen); // NOLINT + + // Get the load path + status = + GetRegKeyWCHARValue(pieDeviceInstance, PIE_DLL_PATH_HINT, pLoadPathString, + &dllPathBufferLen, ®KeyDataType); + if (status != ERROR_SUCCESS) { + LOG(INFO) << "Unexpected error! GetRegKeyWCHARValue return Value of " + << status; + SAFEDELETEARRAY(pLoadPathString); + return status; + } else { + pathString = pLoadPathString; + VLOG(1) << "Queried key successfully!"; + } + + std::wstring fullString = pathString + PIE_API_DLL; + + wcscpy_s(pLoadPathString, dllFullPathLen, fullString.c_str()); // NOLINT + + std::wcout << "wifi_intel.cc" << ":" << __LINE__ + << "] PIE Dll Path and Name = " << pLoadPathString << std::endl; + + if (ppDllPathValue != nullptr) { + *ppDllPathValue = pLoadPathString; + } else { + SAFEDELETEARRAY(pLoadPathString); + } + return status; +} + +HINSTANCE WifiIntel::PIEDllLoader() { + wchar_t* pEntireDeviceList = nullptr; + DEVINST pieRegDeviceInstance = 0; + PWCHAR pDllPathValue = nullptr; + HINSTANCE murocApiDllHandle = nullptr; + DWORD ret = ERROR_SUCCESS; + + pEntireDeviceList = GetEntireRegistryDeviceList(); + pieRegDeviceInstance = SearchForDeviceInstance(pEntireDeviceList); + SAFEDELETEARRAY(pEntireDeviceList); + + ret = GetFullDllLoadPathFromPieRegistry(pieRegDeviceInstance, &pDllPathValue); + + if (ret == ERROR_SUCCESS) { + LOG(INFO) << "Found and trying to load MurocApi.dll"; + + // load the library and get the handle + murocApiDllHandle = LoadLibraryW(pDllPathValue); // NOLINT + + VLOG(1) << absl::StrFormat("Muroc Api Dll Handle is 0x%p ", + murocApiDllHandle); + } else { + LOG(INFO) << "GetFullDllLoadPathFromPieRegistry fails eith error: " << ret; + } + + SAFEDELETEARRAY(pDllPathValue); + + return murocApiDllHandle; +} + +HADAPTER WifiGetAdapterList(HINSTANCE murocApiDllHandle, + PINTEL_ADAPTER_LIST_V120* ppAllAdapters) { + HADAPTER firstAdapterOnTheList = INVALID_HADAPTER; + WIFIGETADAPTERLIST WifiGetAdapterListFunction = nullptr; + DWORD dwError; + + // Use Muroc APIs - First - Get Adapter List + WifiGetAdapterListFunction = (WIFIGETADAPTERLIST)GetProcAddress( + murocApiDllHandle, "WifiGetAdapterList"); + + if (WifiGetAdapterListFunction == nullptr) { + dwError = GetLastError(); + LOG(INFO) << "GetProcAddress for WifiGetAdapterListFunction API " + "fails with error: " + << dwError; + return INVALID_HADAPTER; + } + + VLOG(1) << "GetProcAddress for WifiGetAdapterListFunction API " + "completed successfully"; + INTEL_WIFI_HEADER intelHeader = {INTEL_STRUCT_VERSION_V156, // NOLINT + sizeof(MurocDefs::INTEL_ADAPTER_LIST_V120)}; + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; + + murocApiRetVal = + WifiGetAdapterListFunction(&intelHeader, (void**)ppAllAdapters); + + if (murocApiRetVal != IWLAN_E_SUCCESS) { + LOG(INFO) << "Calling WifiGetAdapterListFunction API fails with error:" + << murocApiRetVal; + return INVALID_HADAPTER; + } + + firstAdapterOnTheList = (*ppAllAdapters)->adapter[0].hAdapter; + LOG(INFO) << "WIFI Adapter on the list: " << firstAdapterOnTheList; + + return firstAdapterOnTheList; +} + +void RegisterIntelCallback( + HINSTANCE murocApiDllHandle, + const MurocDefs::PINTEL_CALLBACK pIntelEventCbHandle) { + REGISTERINTELCB registerIntelCBFunc = nullptr; + DWORD dwError = ERROR_SUCCESS; + + registerIntelCBFunc = (REGISTERINTELCB)GetProcAddress( + murocApiDllHandle, "RegisterIntelCallback"); + if (registerIntelCBFunc == nullptr) { + dwError = GetLastError(); + LOG(INFO) << "GetProcAddress of RegisterIntelCallback API fails with error:" + << dwError; + return; + } + + VLOG(1) << "Load RegisterIntelCallback API successfully"; + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; + + murocApiRetVal = registerIntelCBFunc(pIntelEventCbHandle); + + if (murocApiRetVal == IWLAN_E_SUCCESS) { + LOG(INFO) << "Calling RegisterIntelCallback API succeeded."; + } else { + LOG(INFO) << "Calling RegisterIntelCallback API fails with error:" + << murocApiRetVal; + } +} + +void DeregisterIntelCallback(HINSTANCE murocApiDllHandle, + MurocDefs::INTEL_EVENT_CALLBACK fnCallback) { + DEREGISTERINTELCB deregisterIntelCBFunc = nullptr; + DWORD dwError = ERROR_SUCCESS; + + deregisterIntelCBFunc = (DEREGISTERINTELCB)GetProcAddress( + murocApiDllHandle, "DeregisterIntelCallback"); + + if (deregisterIntelCBFunc == nullptr) { + dwError = GetLastError(); + LOG(INFO) + << "GetProcAddress of DeregisterIntelCallback API failed with error: ", + dwError; + return; + } + + { + VLOG(1) << "Load DeregisterIntelCallback API successfully"; + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; + + murocApiRetVal = deregisterIntelCBFunc(fnCallback); + + if (murocApiRetVal == IWLAN_E_SUCCESS) { + VLOG(1) << "Calling DeregisterIntelCallback API succeeded."; + } else { + LOG(INFO) << "Calling DeregisterIntelCallback API fails with error:" + << murocApiRetVal; + } + } +} + +void WINAPI IntelEventHandler(MurocDefs::INTEL_EVENT iEvent, void* pContext) { + LOG(INFO) << "Received Intel Event id: %d" << iEvent.eType; +} + +void FreeMemoryList(HINSTANCE murocApiDllHandle, void* ptr) { + FREELISTMEMORY freeMemoryListFunction = nullptr; + DWORD dwError = ERROR_SUCCESS; + + freeMemoryListFunction = + (FREELISTMEMORY)GetProcAddress(murocApiDllHandle, "FreeListMemory"); + + if (freeMemoryListFunction == nullptr) { + dwError = GetLastError(); + LOG(INFO) << "GetProcAddress of FreeListMemory API failed with error: " + << dwError; + } + + if ((freeMemoryListFunction != nullptr)) { + VLOG(1) << "Load FreeListMemory API successfully"; + MUROC_RET murocApiRetVal = IWLAN_E_FAILURE; + + murocApiRetVal = freeMemoryListFunction(ptr); + + if (murocApiRetVal == IWLAN_E_SUCCESS) { + VLOG(1) << "Calling FreeListMemory API succeeded."; + } else { + LOG(INFO) << "Calling FreeListMemory API failed with error: " + << murocApiRetVal; + } + } +} +#endif +} // namespace windows +} // namespace nearby diff --git a/internal/platform/implementation/windows/wifi_intel.h b/internal/platform/implementation/windows/wifi_intel.h new file mode 100644 index 00000000..b9da5643 --- /dev/null +++ b/internal/platform/implementation/windows/wifi_intel.h @@ -0,0 +1,74 @@ +// Copyright 2022-2023 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 PLATFORM_IMPL_WINDOWS_WIFI_INTEL_H_ +#define PLATFORM_IMPL_WINDOWS_WIFI_INTEL_H_ + +// clang-format off +#include +#include +#include +// clang-format on + +// Intel WIFI PIE headers +#ifndef NO_INTEL_PIE +#include "third_party/intel/pie/include/IntelSdkVersionInfo.h" +#include "third_party/intel/pie/include/PieApiErrors.h" +#include "third_party/intel/pie/include/PieDefinitions.h" +#endif +#include "internal/platform/logging.h" + +namespace nearby { +namespace windows { +#ifndef NO_INTEL_PIE +using ::MurocDefs::PINTEL_ADAPTER_LIST_V120; +#endif + +// Container of Intel WIFI to utilize Intel PIE SDK API +class WifiIntel { + public: + WifiIntel(const WifiIntel&) = delete; + WifiIntel& operator=(const WifiIntel&) = delete; + + static WifiIntel& GetInstance(); + bool IsValid() const { return intel_wifi_valid_; } + bool Start(); + void Stop(); + int GetGOChannel(); + bool SetScanFilter(int channel); + bool ResetScanFilter(); + + + private: + // This is a singleton object, for which destructor will never be called. + // Constructor will be invoked once from Instance() static method. + // Object is create in-place (with a placement new) to guarantee that + // destructor is not scheduled for execution at exit. + WifiIntel() = default; + ~WifiIntel() = default; + +#ifndef NO_INTEL_PIE + HINSTANCE PIEDllLoader(); + + HINSTANCE muroc_api_dll_handle_ = nullptr; + HADAPTER wifi_adapter_handle_ = 0; + PINTEL_ADAPTER_LIST_V120 p_all_adapters_ = nullptr; +#endif + bool intel_wifi_valid_ = false; +}; + +} // namespace windows +} // namespace nearby + +#endif // PLATFORM_IMPL_WINDOWS_WIFI_INTEL_H_ diff --git a/internal/platform/implementation/windows/wifi_lan.h b/internal/platform/implementation/windows/wifi_lan.h index dcb4e765..fc351813 100644 --- a/internal/platform/implementation/windows/wifi_lan.h +++ b/internal/platform/implementation/windows/wifi_lan.h @@ -18,24 +18,31 @@ // Windows headers // clang-format off #include // NOLINT -#include // NOLINT // clang-format on // Standard C/C++ headers +#include +#include +#include #include #include #include #include +#include // Nearby connections headers #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" +#include "absl/functional/any_invocable.h" #include "absl/strings/string_view.h" #include "absl/synchronization/mutex.h" #include "absl/time/time.h" #include "absl/types/optional.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/exception.h" +#include "internal/platform/implementation/cancelable.h" #include "internal/platform/implementation/wifi_lan.h" #include "internal/platform/implementation/windows/scheduled_executor.h" #include "internal/platform/input_stream.h" @@ -250,11 +257,6 @@ class WifiLanMedium : public api::WifiLanMedium { std::unique_ptr ListenForService( int port = 0) override; - // DnsServiceDeRegister is a async process, after operation finish, callback - // will call this method to notify the waiting method StopAdvertising to - // continue. - void NotifyDnsServiceUnregistered(DWORD status); - absl::optional> GetDynamicPortRange() override { return absl::nullopt; @@ -312,8 +314,6 @@ class WifiLanMedium : public api::WifiLanMedium { DeviceWatcher sender, DeviceInformationUpdate deviceInfoUpdate); fire_and_forget Watcher_DeviceRemoved( DeviceWatcher sender, DeviceInformationUpdate deviceInfoUpdate); - static void Advertising_StopCompleted(DWORD Status, PVOID pQueryContext, - PDNS_SERVICE_INSTANCE pInstance); // Gets error message from exception pointer std::string GetErrorMessage(std::exception_ptr eptr); @@ -328,13 +328,6 @@ class WifiLanMedium : public api::WifiLanMedium { DnssdServiceInstance dnssd_service_instance_{nullptr}; DnssdRegistrationResult dnssd_regirstraion_result_{nullptr}; - // Stop advertising properties - DNS_SERVICE_INSTANCE dns_service_instance_{nullptr}; - DNS_SERVICE_REGISTER_REQUEST dns_service_register_request_; - std::unique_ptr dns_service_instance_name_{nullptr}; - std::unique_ptr dns_service_stop_latch_; - DWORD dns_service_stop_status_; - // Discovery properties DeviceWatcher device_watcher_{nullptr}; winrt::event_token device_watcher_added_event_token; diff --git a/internal/platform/implementation/windows/wifi_lan_medium.cc b/internal/platform/implementation/windows/wifi_lan_medium.cc index b98b164c..9f672ece 100644 --- a/internal/platform/implementation/windows/wifi_lan_medium.cc +++ b/internal/platform/implementation/windows/wifi_lan_medium.cc @@ -34,13 +34,17 @@ // Nearby connections headers #include "absl/synchronization/mutex.h" -#include "absl/time/clock.h" #include "absl/time/time.h" + +// Nearby connections headers +#include "internal/platform/cancellation_flag.h" #include "internal/platform/cancellation_flag_listener.h" #include "internal/platform/exception.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/windows/string_utils.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/logging.h" +#include "internal/platform/nsd_service_info.h" #include "internal/platform/runnable.h" namespace nearby { @@ -79,35 +83,32 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo& nsd_service_info) { if ((server_socket.second->GetIPAddress() == nsd_service_info.GetIPAddress()) && (server_socket.second->GetPort() == nsd_service_info.GetPort())) { - NEARBY_LOGS(INFO) << "Found the server socket." - << " IP: " - << ipaddr_4bytes_to_dotdecimal_string( - nsd_service_info.GetIPAddress()) - << "; port: " << nsd_service_info.GetPort(); + LOG(INFO) << "Found the server socket." << " IP: " + << ipaddr_4bytes_to_dotdecimal_string( + nsd_service_info.GetIPAddress()) + << "; port: " << nsd_service_info.GetPort(); server_socket_ptr = server_socket.second; socket_found = true; break; } } if (!socket_found) { - NEARBY_LOGS(WARNING) - << "cannot start advertising without accepting connetions."; + LOG(WARNING) << "cannot start advertising without accepting connetions."; return false; } if (IsAdvertising()) { - NEARBY_LOGS(WARNING) - << "cannot start advertising again when it is running."; + LOG(WARNING) << "cannot start advertising again when it is running."; return false; } if (nsd_service_info.GetTxtRecord(kDeviceEndpointInfo.data()).empty()) { - NEARBY_LOGS(ERROR) << "cannot start advertising without endpoint info."; + LOG(ERROR) << "cannot start advertising without endpoint info."; return false; } if (nsd_service_info.GetServiceName().empty()) { - NEARBY_LOGS(ERROR) << "cannot start advertising without service name."; + LOG(ERROR) << "cannot start advertising without service name."; return false; } @@ -117,10 +118,10 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo& nsd_service_info) { absl::StrFormat(kMdnsInstanceNameFormat.data(), service_name_, nsd_service_info.GetServiceType()); - NEARBY_LOGS(INFO) << "mDNS instance name is " << instance_name; + LOG(INFO) << "mDNS instance name is " << instance_name; dnssd_service_instance_ = DnssdServiceInstance{ - string_to_wstring(instance_name), + string_utils::StringToWideString(instance_name), nullptr, // let windows use default computer's local name (uint16)nsd_service_info.GetPort()}; @@ -131,8 +132,8 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo& nsd_service_info) { nsd_service_info.GetTxtRecords(); auto it = text_records.begin(); while (it != text_records.end()) { - text_attributes.Insert(string_to_wstring(it->first), - string_to_wstring(it->second)); + text_attributes.Insert(string_utils::StringToWideString(it->first), + string_utils::StringToWideString(it->second)); it++; } @@ -140,7 +141,7 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo& nsd_service_info) { std::vector ipv4_addresses = GetIpv4Addresses(); if (!ipv4_addresses.empty()) { if (ipv4_addresses.size() > 1) { - NEARBY_LOGS(WARNING) << "The device has multiple IPv4 addresses."; + LOG(WARNING) << "The device has multiple IPv4 addresses."; } text_attributes.Insert(winrt::to_hstring(std::string(kDeviceIpv4)), winrt::to_hstring(ipv4_addresses[0])); @@ -152,99 +153,38 @@ bool WifiLanMedium::StartAdvertising(const NsdServiceInfo& nsd_service_info) { .get(); if (dnssd_regirstraion_result_.HasInstanceNameChanged()) { - NEARBY_LOGS(WARNING) << "advertising instance name was changed due to have " - "same name instance was running."; + LOG(WARNING) << "advertising instance name was changed due to have " + "same name instance was running."; // stop the service and return false StopAdvertising(nsd_service_info); return false; } if (dnssd_regirstraion_result_.Status() == DnssdRegistrationStatus::Success) { - NEARBY_LOGS(INFO) << "started to advertising."; + LOG(INFO) << "started to advertising."; medium_status_ |= kMediumStatusAdvertising; return true; } // Clean up - NEARBY_LOGS(ERROR) - << "failed to start advertising due to registration failure."; + LOG(ERROR) << "failed to start advertising due to registration failure."; dnssd_service_instance_ = nullptr; dnssd_regirstraion_result_ = nullptr; return false; } -// Win32 call only can use globel function or static method in class -void WifiLanMedium::Advertising_StopCompleted(DWORD Status, PVOID pQueryContext, - PDNS_SERVICE_INSTANCE pInstance) { - NEARBY_LOGS(INFO) << "unregister with status=" << Status; - try { - WifiLanMedium* medium = static_cast(pQueryContext); - medium->NotifyDnsServiceUnregistered(Status); - } catch (...) { - NEARBY_LOGS(ERROR) << "failed to notify the stop of DNS service instance." - << Status; - } -} - -void WifiLanMedium::NotifyDnsServiceUnregistered(DWORD status) { - if (dns_service_stop_latch_.get() != nullptr) { - dns_service_stop_status_ = status; - dns_service_stop_latch_.get()->CountDown(); - } -} - bool WifiLanMedium::StopAdvertising(const NsdServiceInfo& nsd_service_info) { // Need to use Win32 API to deregister the Dnssd instance if (!IsAdvertising()) { - NEARBY_LOGS(WARNING) + LOG(WARNING) << "Cannot stop advertising because no advertising is running."; return false; } - // Init DNS service instance - std::string instance_name = absl::StrFormat( - kMdnsInstanceNameFormat.data(), nsd_service_info.GetServiceName(), - nsd_service_info.GetServiceType()); - int port = nsd_service_info.GetPort(); - dns_service_instance_name_ = - std::make_unique(string_to_wstring(instance_name)); + dnssd_service_instance_ = nullptr; - dns_service_instance_.pszInstanceName = - (LPWSTR)dns_service_instance_name_->c_str(); - dns_service_instance_.pszHostName = (LPWSTR)kMdnsHostName.data(); - dns_service_instance_.wPort = port; - - // Init DNS service register request - dns_service_register_request_.Version = DNS_QUERY_REQUEST_VERSION1; - dns_service_register_request_.InterfaceIndex = - 0; // all interfaces will be considered - dns_service_register_request_.unicastEnabled = false; - dns_service_register_request_.hCredentials = NULL; - dns_service_register_request_.pServiceInstance = &dns_service_instance_; - dns_service_register_request_.pQueryContext = this; // callback use it - dns_service_register_request_.pRegisterCompletionCallback = - WifiLanMedium::Advertising_StopCompleted; - - dns_service_stop_latch_ = std::make_unique(1); - DWORD status = DnsServiceDeRegister(&dns_service_register_request_, nullptr); - - if (status != DNS_REQUEST_PENDING) { - NEARBY_LOGS(ERROR) << "failed to stop mDNS advertising for service type =" - << nsd_service_info.GetServiceType(); - return false; - } - - // Wait for stop finish - dns_service_stop_latch_.get()->Await(); - dns_service_stop_latch_ = nullptr; - if (dns_service_stop_status_ != 0) { - NEARBY_LOGS(INFO) << "failed to stop mDNS advertising for service type =" - << nsd_service_info.GetServiceType(); - return false; - } - - NEARBY_LOGS(INFO) << "succeeded to stop mDNS advertising for service type =" - << nsd_service_info.GetServiceType(); + LOG(INFO) << "succeeded to stop mDNS advertising for service type =" + << nsd_service_info.GetServiceType(); medium_status_ &= (~kMediumStatusAdvertising); return true; } @@ -253,8 +193,8 @@ bool WifiLanMedium::StopAdvertising(const NsdServiceInfo& nsd_service_info) { bool WifiLanMedium::StartDiscovery(const std::string& service_type, DiscoveredServiceCallback callback) { if (IsDiscovering()) { - NEARBY_LOGS(WARNING) << "discovery already running for service type =" - << service_type; + LOG(WARNING) << "discovery already running for service type =" + << service_type; return false; } @@ -279,7 +219,7 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_type, L"System.Devices.Dnssd.TextAttributes"}; device_watcher_ = DeviceInformation::CreateWatcher( - string_to_wstring(selector), requestedProperties, + string_utils::StringToWideString(selector), requestedProperties, DeviceInformationKind::AssociationEndpointService); device_watcher_added_event_token = @@ -296,7 +236,7 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_type, discovered_service_callback_ = std::move(callback); medium_status_ |= kMediumStatusDiscovering; - NEARBY_LOGS(INFO) << "started to discovery."; + LOG(INFO) << "started to discovery."; return true; } @@ -306,7 +246,7 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_type, // DiscoveredServiceCallback passed in to StartDiscovery() for service_id. bool WifiLanMedium::StopDiscovery(const std::string& service_type) { if (!IsDiscovering()) { - NEARBY_LOGS(WARNING) << "no discovering service to stop."; + LOG(WARNING) << "no discovering service to stop."; return false; } device_watcher_.Stop(); @@ -321,9 +261,8 @@ bool WifiLanMedium::StopDiscovery(const std::string& service_type) { std::unique_ptr WifiLanMedium::ConnectToService( const NsdServiceInfo& remote_service_info, CancellationFlag* cancellation_flag) { - NEARBY_LOGS(ERROR) - << "connect to service by NSD service info. service type is " - << remote_service_info.GetServiceType(); + LOG(ERROR) << "connect to service by NSD service info. service type is " + << remote_service_info.GetServiceType(); return ConnectToService(remote_service_info.GetIPAddress(), remote_service_info.GetPort(), cancellation_flag); @@ -332,9 +271,9 @@ std::unique_ptr WifiLanMedium::ConnectToService( std::unique_ptr WifiLanMedium::ConnectToService( const std::string& ip_address, int port, CancellationFlag* cancellation_flag) { - NEARBY_LOGS(INFO) << "ConnectToService is called."; + LOG(INFO) << "ConnectToService is called."; if (ip_address.empty() || ip_address.length() != 4 || port == 0) { - NEARBY_LOGS(ERROR) << "no valid service address and port to connect."; + LOG(ERROR) << "no valid service address and port to connect."; return nullptr; } @@ -346,14 +285,15 @@ std::unique_ptr WifiLanMedium::ConnectToService( address.S_un.S_un_b.s_b4 = ip_address[3]; char* ipv4_address = inet_ntoa(address); if (ipv4_address == nullptr) { - NEARBY_LOGS(ERROR) << "Invalid IP address parameter."; + LOG(ERROR) << "Invalid IP address parameter."; return nullptr; } std::unique_ptr connection_cancellation_listener = nullptr; - HostName host_name{string_to_wstring(std::string(ipv4_address))}; + HostName host_name{ + string_utils::StringToWideString(std::string(ipv4_address))}; winrt::hstring service_name{winrt::to_hstring(port)}; StreamSocket socket{}; @@ -361,16 +301,15 @@ std::unique_ptr WifiLanMedium::ConnectToService( // setup cancel listener if (cancellation_flag != nullptr) { if (cancellation_flag->Cancelled()) { - NEARBY_LOGS(INFO) << "connect has been cancelled to service " - << ipv4_address << ":" << port; + LOG(INFO) << "connect has been cancelled to service " << ipv4_address + << ":" << port; return nullptr; } connection_cancellation_listener = std::make_unique( cancellation_flag, [socket]() { - NEARBY_LOGS(WARNING) - << "connect is closed due to it is cancelled."; + LOG(WARNING) << "connect is closed due to it is cancelled."; socket.Close(); }); } @@ -380,7 +319,7 @@ std::unique_ptr WifiLanMedium::ConnectToService( if (FeatureFlags::GetInstance().GetFlags().enable_connection_timeout) { connection_timeout_ = scheduled_executor_.Schedule( [socket]() { - NEARBY_LOGS(WARNING) << "connect is closed due to timeout."; + LOG(WARNING) << "connect is closed due to timeout."; socket.Close(); }, kConnectServiceTimeout); @@ -400,13 +339,12 @@ std::unique_ptr WifiLanMedium::ConnectToService( winrt::to_string(socket.Information().LocalAddress().DisplayName()); std::string local_port = winrt::to_string(socket.Information().LocalPort()); - NEARBY_LOGS(INFO) << "connected to remote service " << ipv4_address << ":" - << port << " with local address " << local_address << ":" - << local_port; + LOG(INFO) << "connected to remote service " << ipv4_address << ":" << port + << " with local address " << local_address << ":" << local_port; return wifi_lan_socket; } catch (...) { - NEARBY_LOGS(ERROR) << "failed to connect remote service " << ipv4_address - << ":" << port; + LOG(ERROR) << "failed to connect remote service " << ipv4_address << ":" + << port; } if (connection_timeout_ != nullptr) { @@ -422,8 +360,8 @@ std::unique_ptr WifiLanMedium::ListenForService( // check current status const auto& it = port_to_server_socket_map_.find(port); if (it != port_to_server_socket_map_.end()) { - NEARBY_LOGS(WARNING) << "accepting connections already started on port " - << it->second->GetPort(); + LOG(WARNING) << "accepting connections already started on port " + << it->second->GetPort(); return nullptr; } std::unique_ptr server_socket = @@ -432,29 +370,29 @@ std::unique_ptr WifiLanMedium::ListenForService( if (server_socket->listen()) { int port = server_socket_ptr->GetPort(); - NEARBY_LOGS(INFO) << "started to listen serive on IP:port " - << ipaddr_4bytes_to_dotdecimal_string( - server_socket_ptr->GetIPAddress()) - << ":" << port; + LOG(INFO) << "started to listen serive on IP:port " + << ipaddr_4bytes_to_dotdecimal_string( + server_socket_ptr->GetIPAddress()) + << ":" << port; port_to_server_socket_map_.insert({port, server_socket_ptr}); server_socket->SetCloseNotifier([this, server_socket_ptr, port]() { if (port_to_server_socket_map_.contains(port) && port_to_server_socket_map_[port] == server_socket_ptr) { - NEARBY_LOGS(INFO) << "Server socket was closed on port " << port; + LOG(INFO) << "Server socket was closed on port " << port; port_to_server_socket_map_[port] = nullptr; port_to_server_socket_map_.erase(port); } else { - NEARBY_LOGS(INFO) << " The closing port doesn't match with the record " - "in port_to_server_socket_map_ map for port: " - << port; + LOG(INFO) << " The closing port doesn't match with the record " + "in port_to_server_socket_map_ map for port: " + << port; } }); return server_socket; } - NEARBY_LOGS(ERROR) << "Failed to listen service on port " << port; + LOG(ERROR) << "Failed to listen service on port " << port; return nullptr; } @@ -467,8 +405,7 @@ ExceptionOr WifiLanMedium::GetNsdServiceInformation( IInspectable inspectable = properties.TryLookup(L"System.Devices.Dnssd.InstanceName"); if (inspectable == nullptr) { - NEARBY_LOGS(WARNING) - << "no service name information in device information."; + LOG(WARNING) << "no service name information in device information."; return Exception{Exception::kFailed}; } nsd_service_info.SetServiceName(InspectableReader::ReadString(inspectable)); @@ -476,8 +413,7 @@ ExceptionOr WifiLanMedium::GetNsdServiceInformation( // Read service type information inspectable = properties.TryLookup(L"System.Devices.Dnssd.ServiceName"); if (inspectable == nullptr) { - NEARBY_LOGS(WARNING) - << "no service type information in device information."; + LOG(WARNING) << "no service type information in device information."; return Exception{Exception::kFailed}; } @@ -491,8 +427,7 @@ ExceptionOr WifiLanMedium::GetNsdServiceInformation( // Read text records inspectable = properties.TryLookup(L"System.Devices.Dnssd.TextAttributes"); if (inspectable == nullptr) { - NEARBY_LOGS(WARNING) - << "No text attributes information in device information."; + LOG(WARNING) << "No text attributes information in device information."; return Exception{Exception::kFailed}; } @@ -501,7 +436,7 @@ ExceptionOr WifiLanMedium::GetNsdServiceInformation( // text attribute in format key=value int pos = text_attribute.find("="); if (pos <= 0 || pos == text_attribute.size() - 1) { - NEARBY_LOGS(WARNING) << "found invalid text attribute " << text_attribute; + LOG(WARNING) << "found invalid text attribute " << text_attribute; continue; } @@ -528,14 +463,14 @@ ExceptionOr WifiLanMedium::GetNsdServiceInformation( } else { inspectable = properties.TryLookup(L"System.Devices.IPAddress"); if (inspectable == nullptr) { - NEARBY_LOGS(WARNING) << "No IP address property in device information."; + LOG(WARNING) << "No IP address property in device information."; return Exception{Exception::kFailed}; } ip_address_candidates = InspectableReader::ReadStringArray(inspectable); } if (ip_address_candidates.empty()) { - NEARBY_LOGS(WARNING) << "No IP address information in device information."; + LOG(WARNING) << "No IP address information in device information."; return Exception{Exception::kFailed}; } @@ -560,7 +495,7 @@ ExceptionOr WifiLanMedium::GetNsdServiceInformation( // Read IP port inspectable = properties.TryLookup(L"System.Devices.Dnssd.PortNumber"); if (inspectable == nullptr) { - NEARBY_LOGS(WARNING) << "no IP port property in device information."; + LOG(WARNING) << "no IP port property in device information."; return Exception{Exception::kFailed}; } @@ -578,8 +513,8 @@ fire_and_forget WifiLanMedium::Watcher_DeviceAdded( /*is_device_found*/ true); if (!nsd_service_info_except.ok()) { - NEARBY_LOGS(WARNING) << "NSD information is incompleted or has error! " - "Don't add WIFI_LAN device."; + LOG(WARNING) << "NSD information is incompleted or has error! " + "Don't add WIFI_LAN device."; return fire_and_forget{}; } @@ -587,28 +522,27 @@ fire_and_forget WifiLanMedium::Watcher_DeviceAdded( std::string endpoint = nsd_service_info.GetTxtRecord(kDeviceEndpointInfo.data()); if (endpoint.empty()) { - NEARBY_LOGS(WARNING) << "No endpoint information! " - "Don't add WIFI_LAN device."; + LOG(WARNING) << "No endpoint information! " + "Don't add WIFI_LAN device."; return fire_and_forget{}; } // Don't discover itself if (nsd_service_info.GetServiceName() == service_name_) { - NEARBY_LOGS(WARNING) << "Don't add WIFI_LAN device for itself"; + LOG(WARNING) << "Don't add WIFI_LAN device for itself"; return fire_and_forget{}; } - NEARBY_LOGS(INFO) << "device added for service name " - << nsd_service_info.GetServiceName() << ", address: " - << ipaddr_4bytes_to_dotdecimal_string( - nsd_service_info.GetIPAddress()) - << ":" << nsd_service_info.GetPort(); + LOG(INFO) << "device added for service name " + << nsd_service_info.GetServiceName() << ", address: " + << ipaddr_4bytes_to_dotdecimal_string( + nsd_service_info.GetIPAddress()) + << ":" << nsd_service_info.GetPort(); if (!IsConnectableIpAddress( ipaddr_4bytes_to_dotdecimal_string(nsd_service_info.GetIPAddress()), nsd_service_info.GetPort(), kConnectTimeout)) { - NEARBY_LOGS(WARNING) - << "Don't add WIFI_LAN device due to it is not reachable."; + LOG(WARNING) << "Don't add WIFI_LAN device due to it is not reachable."; return fire_and_forget{}; } @@ -625,7 +559,7 @@ fire_and_forget WifiLanMedium::Watcher_DeviceUpdated( /*is_device_found*/ true); if (!nsd_service_info_except.ok()) { - NEARBY_LOGS(WARNING) << "NSD information is incompleted or has error!"; + LOG(WARNING) << "NSD information is incompleted or has error!"; return fire_and_forget{}; } @@ -633,7 +567,7 @@ fire_and_forget WifiLanMedium::Watcher_DeviceUpdated( // Don't discover itself if (nsd_service_info.GetServiceName() == service_name_) { - NEARBY_LOGS(WARNING) << "Don't update WIFI_LAN device for itself."; + LOG(WARNING) << "Don't update WIFI_LAN device for itself."; return fire_and_forget{}; } @@ -641,7 +575,23 @@ fire_and_forget WifiLanMedium::Watcher_DeviceUpdated( std::optional last_nsd_service_info = GetDiscoveredService(winrt::to_string(deviceInfoUpdate.Id())); if (!last_nsd_service_info.has_value()) { - NEARBY_LOGS(WARNING) + if (IsConnectableIpAddress( + ipaddr_4bytes_to_dotdecimal_string(nsd_service_info.GetIPAddress()), + nsd_service_info.GetPort(), kConnectTimeout)) { + // If the device is not in the discovered service list, but it is + // connectable during update, we add it to the discovered service list. + LOG(INFO) << "device added for service name " + << nsd_service_info.GetServiceName() << ", address: " + << ipaddr_4bytes_to_dotdecimal_string( + nsd_service_info.GetIPAddress()) + << ":" << nsd_service_info.GetPort(); + UpdateDiscoveredService(winrt::to_string(deviceInfoUpdate.Id()), + nsd_service_info); + discovered_service_callback_.service_discovered_cb(nsd_service_info); + return fire_and_forget{}; + } + + LOG(WARNING) << "Don't update WIFI_LAN device due to it is not in device list."; return fire_and_forget{}; } @@ -653,11 +603,11 @@ fire_and_forget WifiLanMedium::Watcher_DeviceUpdated( (last_nsd_service_info->GetIPAddress() == nsd_service_info.GetIPAddress()) && (last_nsd_service_info->GetPort() == nsd_service_info.GetPort())) { - NEARBY_LOGS(INFO) << "Don't update WIFI_LAN device due to no change."; + LOG(INFO) << "Don't update WIFI_LAN device due to no change."; return fire_and_forget{}; } - NEARBY_LOGS(INFO) + LOG(INFO) << "Device is changed from (service name:" << last_nsd_service_info->GetServiceName() << ", endpoint info:" << last_nsd_service_info->GetTxtRecord(std::string(kDeviceEndpointInfo)) @@ -689,14 +639,13 @@ fire_and_forget WifiLanMedium::Watcher_DeviceRemoved( /*is_device_found*/ false); if (!nsd_service_info_except.ok()) { - NEARBY_LOGS(WARNING) - << "NSD information is incompleted or has error! Ignore"; + LOG(WARNING) << "NSD information is incompleted or has error! Ignore"; return fire_and_forget{}; } NsdServiceInfo nsd_service_info = nsd_service_info_except.GetResult(); - NEARBY_LOGS(INFO) << "device removed for service name " - << nsd_service_info.GetServiceName(); + LOG(INFO) << "device removed for service name " + << nsd_service_info.GetServiceName(); std::string endpoint = nsd_service_info.GetTxtRecord(kDeviceEndpointInfo.data()); diff --git a/internal/platform/implementation/windows/wifi_lan_server_socket.cc b/internal/platform/implementation/windows/wifi_lan_server_socket.cc index b5010a2d..8f4b7990 100644 --- a/internal/platform/implementation/windows/wifi_lan_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_lan_server_socket.cc @@ -19,6 +19,10 @@ #include #include +#include "absl/functional/any_invocable.h" +#include "absl/synchronization/mutex.h" +#include "internal/platform/exception.h" +#include "internal/platform/implementation/wifi_lan.h" #include "internal/platform/implementation/windows/generated/winrt/Windows.Networking.Sockets.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/implementation/windows/wifi_lan.h" @@ -39,13 +43,12 @@ WifiLanServerSocket::~WifiLanServerSocket() { Close(); } // Returns the first IP address. std::string WifiLanServerSocket::GetIPAddress() const { if (stream_socket_listener_ == nullptr) { - NEARBY_LOGS(ERROR) << "Failed to get IP address due to no server socket."; + LOG(ERROR) << "Failed to get IP address due to no server socket."; return ""; } if (ip_addresses_.empty()) { - NEARBY_LOGS(ERROR) - << "Failed to get IP address due to no avaible IP addresses."; + LOG(ERROR) << "Failed to get IP address due to no avaible IP addresses."; return ""; } @@ -69,7 +72,7 @@ int WifiLanServerSocket::GetPort() const { // Once error is reported, it is permanent, and ServerSocket has to be closed. std::unique_ptr WifiLanServerSocket::Accept() { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Accept is called."; + LOG(INFO) << __func__ << ": Accept is called."; while (!closed_ && pending_sockets_.empty()) { cond_.Wait(&mutex_); @@ -79,7 +82,7 @@ std::unique_ptr WifiLanServerSocket::Accept() { StreamSocket wifi_lan_socket = pending_sockets_.front(); pending_sockets_.pop_front(); - NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection."; + LOG(INFO) << __func__ << ": Accepted a remote connection."; return std::make_unique(wifi_lan_socket); } @@ -92,7 +95,7 @@ void WifiLanServerSocket::SetCloseNotifier( Exception WifiLanServerSocket::Close() { try { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Close is called."; + LOG(INFO) << __func__ << ": Close is called."; if (closed_) { return {Exception::kSuccess}; @@ -116,23 +119,23 @@ Exception WifiLanServerSocket::Close() { close_notifier_(); } - NEARBY_LOGS(INFO) << __func__ << ": Close completed succesfully."; + LOG(INFO) << __func__ << ": Close completed succesfully."; return {Exception::kSuccess}; } catch (std::exception exception) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { closed_ = true; cond_.SignalAll(); - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -142,8 +145,8 @@ bool WifiLanServerSocket::listen() { ip_addresses_ = Get4BytesIpv4Addresses(); if (ip_addresses_.empty()) { - NEARBY_LOGS(WARNING) << "failed to start accepting connection without IP " - "addresses configured on computer."; + LOG(WARNING) << "failed to start accepting connection without IP " + "addresses configured on computer."; return false; } @@ -169,17 +172,16 @@ bool WifiLanServerSocket::listen() { return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) - << __func__ - << ": Cannot accept connection on preferred port. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot accept connection on preferred port. Exception: " + << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) + LOG(ERROR) << __func__ << ": Cannot accept connection on preferred port. WinRT exception: " << error.code() << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } try { @@ -190,15 +192,14 @@ bool WifiLanServerSocket::listen() { std::stoi(stream_socket_listener_.Information().LocalPort().c_str()); return true; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Cannot bind to any port. Exception: " - << exception.what(); + LOG(ERROR) << __func__ + << ": Cannot bind to any port. Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ - << ": Cannot bind to any port. WinRT exception: " - << error.code() << ": " - << winrt::to_string(error.message()); + LOG(ERROR) << __func__ + << ": Cannot bind to any port. WinRT exception: " << error.code() + << ": " << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } return false; @@ -208,7 +209,7 @@ fire_and_forget WifiLanServerSocket::Listener_ConnectionReceived( StreamSocketListener listener, StreamSocketListenerConnectionReceivedEventArgs const& args) { absl::MutexLock lock(&mutex_); - NEARBY_LOGS(INFO) << __func__ << ": Received connection."; + LOG(INFO) << __func__ << ": Received connection."; if (closed_) { return fire_and_forget{}; diff --git a/internal/platform/implementation/windows/wifi_lan_socket.cc b/internal/platform/implementation/windows/wifi_lan_socket.cc index 12a06370..c2a91975 100644 --- a/internal/platform/implementation/windows/wifi_lan_socket.cc +++ b/internal/platform/implementation/windows/wifi_lan_socket.cc @@ -12,11 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/windows/wifi_lan.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" +#include "internal/platform/output_stream.h" namespace nearby { namespace windows { @@ -33,12 +38,12 @@ WifiLanSocket::~WifiLanSocket() { Close(); } } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; } } @@ -53,14 +58,14 @@ Exception WifiLanSocket::Close() { } return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -79,21 +84,22 @@ ExceptionOr WifiLanSocket::SocketInputStream::Read( input_stream_.ReadAsync(buffer, size, InputStreamOptions::None).get(); if (ibuffer.Length() != size) { - NEARBY_LOGS(WARNING) << "Only got part of data of needed."; + LOG(WARNING) << "Only read partial of data: [" << ibuffer.Length() << "/" + << size << "]."; } ByteArray data((char*)ibuffer.data(), ibuffer.Length()); return ExceptionOr(data); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -106,14 +112,14 @@ ExceptionOr WifiLanSocket::SocketInputStream::Skip(size_t offset) { input_stream_.ReadAsync(buffer, offset, InputStreamOptions::None).get(); return ExceptionOr((size_t)ibuffer.Length()); } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -123,14 +129,14 @@ Exception WifiLanSocket::SocketInputStream::Close() { input_stream_.Close(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -146,17 +152,22 @@ Exception WifiLanSocket::SocketOutputStream::Write(const ByteArray& data) { Buffer buffer = Buffer(data.size()); std::memcpy(buffer.data(), data.data(), data.size()); buffer.Length(data.size()); - output_stream_.WriteAsync(buffer).get(); + uint32_t wrote_bytes = output_stream_.WriteAsync(buffer).get(); + if (wrote_bytes != data.size()) { + LOG(WARNING) << "Only wrote partial of data:[" << wrote_bytes << "/" + << data.size() << "]."; + } + return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -166,14 +177,14 @@ Exception WifiLanSocket::SocketOutputStream::Flush() { output_stream_.FlushAsync().get(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } @@ -183,14 +194,14 @@ Exception WifiLanSocket::SocketOutputStream::Close() { output_stream_.Close(); return {Exception::kSuccess}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {Exception::kIo}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {Exception::kIo}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {Exception::kIo}; } } diff --git a/internal/platform/implementation/windows/wifi_medium.cc b/internal/platform/implementation/windows/wifi_medium.cc index f35bf8e5..5e78519b 100644 --- a/internal/platform/implementation/windows/wifi_medium.cc +++ b/internal/platform/implementation/windows/wifi_medium.cc @@ -12,10 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include +#include // #include #include "absl/strings/str_format.h" +#include "internal/platform/implementation/wifi.h" +#include "internal/platform/implementation/wifi_utils.h" #include "internal/platform/implementation/windows/utils.h" #include "internal/platform/implementation/windows/wifi.h" #include "internal/platform/logging.h" @@ -39,16 +43,16 @@ PWLAN_INTERFACE_INFO_LIST EnumInterface(PHANDLE client_handle) { /* variables used for WlanEnumInterfaces */ PWLAN_INTERFACE_INFO_LIST p_intf_list = nullptr; - result = - WlanOpenHandle(client_version, NULL, &negotiated_version, client_handle); + result = WlanOpenHandle(client_version, nullptr, &negotiated_version, + client_handle); if (result != ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "WlanOpenHandle failed with error: " << result; + LOG(INFO) << "WlanOpenHandle failed with error: " << result; return p_intf_list; } - result = WlanEnumInterfaces(*client_handle, NULL, &p_intf_list); + result = WlanEnumInterfaces(*client_handle, nullptr, &p_intf_list); if (result != ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "WlanEnumInterfaces failed with error: " << result; + LOG(INFO) << "WlanEnumInterfaces failed with error: " << result; } return p_intf_list; } @@ -69,12 +73,12 @@ void WifiMedium::InitCapability() { p_intf_list = EnumInterface(&client_handle); if (!client_handle) { - NEARBY_LOGS(INFO) + LOG(INFO) << "Client Handle is null, wifi maybe not supported on this device."; return; } if (!p_intf_list) { - WlanCloseHandle(client_handle, NULL); + WlanCloseHandle(client_handle, nullptr); return; } wifi_interface_valid_ = true; @@ -82,11 +86,12 @@ void WifiMedium::InitCapability() { for (int i = 0; i < (int)p_intf_list->dwNumberOfItems; i++) { p_intf_info = (WLAN_INTERFACE_INFO*)&p_intf_list->InterfaceInfo[i]; if (WlanGetInterfaceCapability(client_handle, &p_intf_info->InterfaceGuid, - NULL, &p_intf_capability) != ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "Get Capability failed"; + nullptr, + &p_intf_capability) != ERROR_SUCCESS) { + LOG(INFO) << "Get Capability failed"; WlanFreeMemory(p_intf_list); p_intf_list = nullptr; - WlanCloseHandle(client_handle, NULL); + WlanCloseHandle(client_handle, nullptr); return; } @@ -100,7 +105,7 @@ void WifiMedium::InitCapability() { p_intf_capability = nullptr; WlanFreeMemory(p_intf_list); p_intf_list = nullptr; - WlanCloseHandle(client_handle, NULL); + WlanCloseHandle(client_handle, nullptr); } // TODO(b/259414512): the return type should be optional. @@ -126,13 +131,13 @@ api::WifiInformation& WifiMedium::GetInformation() { p_intf_list = EnumInterface(&client_handle); if (!client_handle) { - NEARBY_LOGS(INFO) << "Client Handle is NULL"; + LOG(INFO) << "Client Handle is nullptr"; FillupEthernetParams(); return wifi_information_; } if (!p_intf_list) { - NEARBY_LOGS(INFO) << "WlanEnumInterfaces failed with error: "; - WlanCloseHandle(client_handle, NULL); + LOG(INFO) << "WlanEnumInterfaces failed with error: "; + WlanCloseHandle(client_handle, nullptr); FillupEthernetParams(); return wifi_information_; } @@ -140,16 +145,16 @@ api::WifiInformation& WifiMedium::GetInformation() { for (int i = 0; i < (int)p_intf_list->dwNumberOfItems; i++) { p_intf_info = (WLAN_INTERFACE_INFO*)&p_intf_list->InterfaceInfo[i]; if (p_intf_info->isState == wlan_interface_state_connected) { - NEARBY_LOGS(INFO) << "Found connected WiFi interface No: " << i; + LOG(INFO) << "Found connected WiFi interface No: " << i; wifi_information_.is_connected = true; DWORD channel_size; result = WlanQueryInterface(client_handle, &p_intf_info->InterfaceGuid, - wlan_intf_opcode_channel_number, NULL, + wlan_intf_opcode_channel_number, nullptr, &channel_size, (PVOID*)&channel, &op_code_value_type); if (result != ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "WlanQueryInterface channel error = " << result; + LOG(INFO) << "WlanQueryInterface channel error = " << result; WlanFreeMemory(p_intf_list); p_intf_list = nullptr; WlanCloseHandle(client_handle, nullptr); @@ -158,20 +163,20 @@ api::WifiInformation& WifiMedium::GetInformation() { } wifi_information_.ap_frequency = WifiUtils::ConvertChannelToFrequencyMhz( *channel, api::WifiBandType::kUnknown); - NEARBY_LOGS(INFO) << "Channel: " << *channel - << "; ap_frequency: " << wifi_information_.ap_frequency; + LOG(INFO) << "Channel: " << (channel == nullptr ? 0 : *channel) + << "; ap_frequency: " << wifi_information_.ap_frequency; WlanFreeMemory(channel); channel = nullptr; result = WlanQueryInterface(client_handle, &p_intf_info->InterfaceGuid, - wlan_intf_opcode_current_connection, NULL, + wlan_intf_opcode_current_connection, nullptr, &connect_info_size, (PVOID*)&p_connect_info, &op_code_value_type); if (result != ERROR_SUCCESS) { - NEARBY_LOGS(INFO) << "WlanQueryInterface current AP error = " << result; + LOG(INFO) << "WlanQueryInterface current AP error = " << result; WlanFreeMemory(p_intf_list); p_intf_list = nullptr; - WlanCloseHandle(client_handle, NULL); + WlanCloseHandle(client_handle, nullptr); FillupEthernetParams(); return wifi_information_; } @@ -183,8 +188,8 @@ api::WifiInformation& WifiMedium::GetInformation() { reinterpret_cast( p_connect_info->wlanAssociationAttributes.dot11Ssid.ucSSID), wifi_information_.ssid.size()); - NEARBY_LOGS(INFO) << "wifi ssid is: " << wifi_information_.ssid - << "; length is:" << wifi_information_.ssid.length(); + LOG(INFO) << "wifi ssid is: " << wifi_information_.ssid + << "; length is:" << wifi_information_.ssid.length(); char str_tmp[kMacAddrLen]; strncpy(str_tmp, @@ -194,7 +199,7 @@ api::WifiInformation& WifiMedium::GetInformation() { wifi_information_.bssid = absl::StrFormat( "%02llx:%02llx:%02llx:%02llx:%02llx:%02llx", str_tmp[0], str_tmp[1], str_tmp[2], str_tmp[3], str_tmp[4], str_tmp[5]); - NEARBY_LOGS(INFO) << "wifi bssid is: " << wifi_information_.bssid; + LOG(INFO) << "wifi bssid is: " << wifi_information_.bssid; } } @@ -202,7 +207,7 @@ api::WifiInformation& WifiMedium::GetInformation() { p_connect_info = nullptr; WlanFreeMemory(p_intf_list); p_intf_list = nullptr; - WlanCloseHandle(client_handle, NULL); + WlanCloseHandle(client_handle, nullptr); if (wifi_information_.is_connected) { wifi_information_.ip_address_dot_decimal = InternalGetWifiIpAddress(); @@ -228,7 +233,7 @@ std::string WifiMedium::InternalGetWifiIpAddress() { host_name.IPInformation().NetworkAdapter() != nullptr && host_name.Type() == HostNameType::Ipv4) { std::string ipv4_s = winrt::to_string(host_name.ToString()); - NEARBY_LOGS(INFO) << "Found IP: " << ipv4_s; + LOG(INFO) << "Found IP: " << ipv4_s; auto profile = host_name.IPInformation() .NetworkAdapter() @@ -239,7 +244,7 @@ std::string WifiMedium::InternalGetWifiIpAddress() { if (profile_details != nullptr && wifi_information_.ssid == winrt::to_string(profile_details.GetConnectedSsid())) { - NEARBY_LOGS(INFO) + LOG(INFO) << "SSID of this IP matches with this WiFi interface's SSID:" << wifi_information_.ssid << ", return this IP: " << ipv4_s; return ipv4_s; @@ -249,14 +254,14 @@ std::string WifiMedium::InternalGetWifiIpAddress() { } return {}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {}; } } @@ -271,21 +276,21 @@ std::string WifiMedium::InternalGetEthernetIpAddress() { std::string ipv4_s = winrt::to_string(host_name.ToString()); if (host_name.IPInformation().NetworkAdapter().IanaInterfaceType() == Constants::kInterfaceTypeEthernet) { - NEARBY_LOGS(INFO) << "Found IP: " << ipv4_s; + LOG(INFO) << "Found IP: " << ipv4_s; return ipv4_s; } } } return {}; } catch (std::exception exception) { - NEARBY_LOGS(ERROR) << __func__ << ": Exception: " << exception.what(); + LOG(ERROR) << __func__ << ": Exception: " << exception.what(); return {}; } catch (const winrt::hresult_error& error) { - NEARBY_LOGS(ERROR) << __func__ << ": WinRT exception: " << error.code() - << ": " << winrt::to_string(error.message()); + LOG(ERROR) << __func__ << ": WinRT exception: " << error.code() << ": " + << winrt::to_string(error.message()); return {}; } catch (...) { - NEARBY_LOGS(ERROR) << __func__ << ": Unknown exeption."; + LOG(ERROR) << __func__ << ": Unknown exeption."; return {}; } } @@ -293,7 +298,7 @@ std::string WifiMedium::InternalGetEthernetIpAddress() { void WifiMedium::FillupEthernetParams() { wifi_information_.ip_address_dot_decimal = InternalGetEthernetIpAddress(); if (wifi_information_.ip_address_dot_decimal.empty()) { - NEARBY_LOGS(INFO) << "No Etherent IP Addr found."; + LOG(INFO) << "No Etherent IP Addr found."; return; } wifi_information_.ip_address_4_bytes = ipaddr_dotdecimal_to_4bytes_string( diff --git a/internal/platform/implementation/windows/wifi_medium_test.cc b/internal/platform/implementation/windows/wifi_medium_test.cc new file mode 100644 index 00000000..fb18012a --- /dev/null +++ b/internal/platform/implementation/windows/wifi_medium_test.cc @@ -0,0 +1,51 @@ +// Copyright 2023 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. + +#include + +#include "gtest/gtest.h" +#include "internal/platform/implementation/windows/wifi.h" +#include "internal/platform/logging.h" + +namespace nearby { +namespace windows { +namespace { + +TEST(WifiMedium, DISABLED_GetCapabilityAndInformation) { + int run_test; + LOG(INFO) << "Run GetCapabilityAndInformation test case? input 0 or 1:"; + std::cin >> run_test; + + if (run_test) { + WifiMedium wifi_medium; + + auto& capability = wifi_medium.GetCapability(); + LOG(INFO) << "Support 5G? " << capability.supports_5_ghz; + + auto& information = wifi_medium.GetInformation(); + LOG(INFO) << "Is Connected? " << information.is_connected + << "; ssid = " << information.ssid + << "; bssid = " << information.bssid + << "; ap_frequency: " << information.ap_frequency + << "; ip_address_dot_decimal: " + << information.ip_address_dot_decimal + << "; ip_address_4_bytes: " << information.ip_address_4_bytes; + } else { + LOG(INFO) << "Skip the test"; + } +} + +} // namespace +} // namespace windows +} // namespace nearby diff --git a/internal/platform/input_stream.h b/internal/platform/input_stream.h index 383964b6..ffb84a0a 100644 --- a/internal/platform/input_stream.h +++ b/internal/platform/input_stream.h @@ -15,6 +15,7 @@ #ifndef PLATFORM_BASE_INPUT_STREAM_H_ #define PLATFORM_BASE_INPUT_STREAM_H_ +#include #include #include "internal/platform/byte_array.h" diff --git a/internal/platform/listeners.h b/internal/platform/listeners.h index f1143a13..ac170541 100644 --- a/internal/platform/listeners.h +++ b/internal/platform/listeners.h @@ -15,6 +15,7 @@ #ifndef PLATFORM_BASE_LISTENERS_H_ #define PLATFORM_BASE_LISTENERS_H_ +#include #include "absl/functional/any_invocable.h" namespace nearby { diff --git a/internal/platform/logging.h b/internal/platform/logging.h index 3bdc654a..f4960d53 100644 --- a/internal/platform/logging.h +++ b/internal/platform/logging.h @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,87 +15,25 @@ #ifndef PLATFORM_BASE_LOGGING_H_ #define PLATFORM_BASE_LOGGING_H_ -// base/logging.h is only included to allow logging clients to include CHECK's. -// In Chrome this is base/check.h. See crbug/1212611. -#ifdef NEARBY_CHROMIUM +#if defined(NEARBY_CHROMIUM) +// Chromium does not use absl log. Forward to Chromium native log macros. #include "base/check.h" -// base/logging.h is available externally as "glog". However, this repo contains -// template files that can't be built by Swift Package Manager. To build with -// SPM we only need CHECK and DCHECK defined. -#elif defined(NEARBY_SWIFTPM) -#include -#define CHECK(condition) static_cast(0), condition ? (void) 0 : abort() -#define DCHECK(condition) static_cast(0), (void) 0 -#define CHECK_GT(a, b) static_cast(0), a > b ? (void) 0 : abort() -#define DCHECK_GT(a, b) static_cast(0), a > b ? (void) 0 : abort() -#define CHECK_LE(a, b) static_cast(0), a <= b ? (void) 0 : abort() -#define DCHECK_LE(a, b) static_cast(0), a <= b ? (void) 0 : abort() -#define CHECK_NE(a, b) static_cast(0), a != b ? (void) 0 : abort() -#define DCHECK_NE(a, b) static_cast(0), a != b ? (void) 0 : abort() -#define CHECK_EQ(a, b) static_cast(0), a == b ? (void) 0 : abort() -#define DCHECK_EQ(a, b) static_cast(0), a == b ? (void) 0 : abort() -#define CHECK_GE(a, b) static_cast(0), a >= b ? (void) 0 : abort() -#define DCHECK_GE(a, b) static_cast(0), a >= b ? (void) 0 : abort() -#else -#include "glog/logging.h" -#endif -#include "internal/platform/implementation/log_message.h" -#include "internal/platform/implementation/platform.h" - -namespace nearby { - -// This class is used to explicitly ignore values in the conditional -// logging macros. This avoids compiler warnings like "value computed -// is not used" and "statement has no effect". -class LogMessageVoidify { - public: - LogMessageVoidify() = default; - // This has to be an operator with a precedence lower than << but - // higher than ?: - void operator&(std::ostream&) {} -}; - -} // namespace nearby - -// Severity enum conversion -#define NEARBY_SEVERITY_VERBOSE nearby::api::LogMessage::Severity::kVerbose -#define NEARBY_SEVERITY_INFO nearby::api::LogMessage::Severity::kInfo -#define NEARBY_SEVERITY_WARNING nearby::api::LogMessage::Severity::kWarning -#define NEARBY_SEVERITY_ERROR nearby::api::LogMessage::Severity::kError -#define NEARBY_SEVERITY_FATAL nearby::api::LogMessage::Severity::kFatal -#if defined(_WIN32) -// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets substituted -// with 0, and it expands to NEARBY_SEVERITY_0. To allow us to keep using this -// syntax, we define this macro to do the same thing as NEARBY_SEVERITY_ERROR. -#define NEARBY_SEVERITY_0 nearby::api::LogMessage::Severity::kError -#endif // defined(_WIN32) -#define NEARBY_SEVERITY(severity) NEARBY_SEVERITY_##severity - -// Log enabling -#define NEARBY_LOG_IS_ON(severity) \ - nearby::api::LogMessage::ShouldCreateLogMessage(NEARBY_SEVERITY(severity)) - -#define NEARBY_LOG_SET_SEVERITY(severity) \ - nearby::api::LogMessage::SetMinLogSeverity(NEARBY_SEVERITY(severity)) - -// Log message creation -#define NEARBY_LOG_MESSAGE(severity) \ - nearby::api::ImplementationPlatform::CreateLogMessage( \ - __FILE__, __LINE__, NEARBY_SEVERITY(severity)) +#include "base/check_op.h" +#include "base/logging.h" +#else // defined(NEARBY_CHROMIUM) +// IWYU pragma: begin_exports +#include "absl/log/check.h" // nogncheck +#include "absl/log/globals.h" // nogncheck +#include "absl/log/log.h" // nogncheck +// IWYU pragma: end_exports +#endif // defined(NEARBY_CHROMIUM) // Public APIs -// The stream statement must come last or otherwise it won't compile. -#define NEARBY_LOGS(severity) \ - !(NEARBY_LOG_IS_ON(severity)) \ - ? (void)0 \ - : nearby::LogMessageVoidify() & NEARBY_LOG_MESSAGE(severity)->Stream() +// The stream statement must come last, or it won't compile. +#define NEARBY_VLOG(level) VLOG(level) +#define NEARBY_LOGS(severity) LOG(severity) -#define NEARBY_LOG(severity, ...) \ - NEARBY_LOG_IS_ON(severity) \ - ? NEARBY_LOG_MESSAGE(severity)->Print(__VA_ARGS__) : (void)0 - -#ifdef NEARBY_SWIFTPM -#define LOG(severity) NEARBY_LOGS(severity) -#endif +#define NEARBY_DLOG(severity) DLOG(severity) +#define NEARBY_DVLOG(severity) DVLOG(severity) #endif // PLATFORM_BASE_LOGGING_H_ diff --git a/internal/platform/logging_test.cc b/internal/platform/logging_test.cc deleted file mode 100644 index e4f5a82a..00000000 --- a/internal/platform/logging_test.cc +++ /dev/null @@ -1,53 +0,0 @@ -// 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. - -#include "internal/platform/logging.h" - -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" -#include "gtest/gtest.h" - -namespace { - -TEST(LoggingTest, CanLog) { - NEARBY_LOG_SET_SEVERITY(INFO); - int num = 42; - NEARBY_LOG(INFO, "The answer to everything: %d", num++); - EXPECT_EQ(num, 43); -} - -TEST(LoggingTest, CanLog_LoggingDisabled) { - NEARBY_LOG_SET_SEVERITY(ERROR); - int num = 42; - NEARBY_LOG(INFO, "The answer to everything: %d", num++); - // num++ should not be evaluated - EXPECT_EQ(num, 42); -} - -TEST(LoggingTest, CanStream) { - NEARBY_LOG_SET_SEVERITY(INFO); - int num = 42; - NEARBY_LOGS(INFO) << "The answer to everything: " << num++; - EXPECT_EQ(num, 43); -} - -TEST(LoggingTest, CanStream_LoggingDisabled) { - NEARBY_LOG_SET_SEVERITY(ERROR); - int num = 42; - NEARBY_LOGS(INFO) << "The answer to everything: " << num++; - // num++ should not be evaluated - EXPECT_EQ(num, 42); -} - -} // namespace diff --git a/internal/platform/medium_environment.cc b/internal/platform/medium_environment.cc index 8ed0d104..885a7a22 100644 --- a/internal/platform/medium_environment.cc +++ b/internal/platform/medium_environment.cc @@ -14,27 +14,40 @@ #include "internal/platform/medium_environment.h" -#include #include -#include #include #include #include #include #include #include -#include #include "absl/container/flat_hash_set.h" #include "absl/status/status.h" #include "absl/strings/escaping.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" #include "absl/types/optional.h" +#include "internal/platform/borrowable.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/feature_flags.h" +#include "internal/platform/implementation/ble.h" #include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/bluetooth_classic.h" +#include "internal/platform/implementation/wifi_direct.h" +#include "internal/platform/implementation/wifi_hotspot.h" +#include "internal/platform/implementation/wifi_lan.h" #include "internal/platform/logging.h" +#include "internal/platform/mutex_lock.h" +#include "internal/platform/nsd_service_info.h" #include "internal/platform/prng.h" +#include "internal/platform/runnable.h" +#include "internal/platform/uuid.h" +#include "internal/platform/wifi_credential.h" +#include "internal/test/fake_clock.h" namespace nearby { @@ -126,8 +139,9 @@ void MediumEnvironment::OnBluetoothAdapterChangedState( name = std::move(name), enabled, mode, &latch]() { NEARBY_LOGS(INFO) << "[adapter=" << &adapter - << ", device=" << &adapter_device << "] update: name=" - << ", enabled=" << enabled << ", mode=" << int32_t(mode); + << ", device=" << &adapter_device + << "] update: name=" << ", enabled=" << enabled + << ", mode=" << int32_t(mode); for (auto& medium_info : bluetooth_mediums_) { auto& info = medium_info.second; // Do not send notification to medium that owns this adapter. @@ -158,7 +172,7 @@ void MediumEnvironment::OnBluetoothDeviceStateChanged( if (!enabled_) return; auto item = info.devices.find(&device); if (item == info.devices.end()) { - NEARBY_LOGS(INFO) << "G3 OnBluetoothDeviceStateChanged [device impl=" + NEARBY_LOGS(INFO) << "OnBluetoothDeviceStateChanged [device impl=" << &device << "]: new device; notify=" << enable_notifications_.load(); if (mode == api::BluetoothAdapter::ScanMode::kConnectableDiscoverable && @@ -167,7 +181,7 @@ void MediumEnvironment::OnBluetoothDeviceStateChanged( // Store device name, and report it as discovered. info.devices.emplace(&device, name); if (enable_notifications_) { - NEARBY_LOGS(VERBOSE) << "Notify about new discovered device"; + NEARBY_VLOG(1) << "Notify about new discovered device"; info.callback.device_discovered_cb(device); for (auto& observer : observers_.GetObservers()) { observer->DeviceAdded(device); @@ -175,7 +189,7 @@ void MediumEnvironment::OnBluetoothDeviceStateChanged( } } } else { - NEARBY_LOGS(INFO) << "G3 OnBluetoothDeviceStateChanged [device impl=" + NEARBY_LOGS(INFO) << "OnBluetoothDeviceStateChanged [device impl=" << &device << "]: existing device; notify=" << enable_notifications_.load(); auto& discovered_name = item->second; @@ -191,7 +205,7 @@ void MediumEnvironment::OnBluetoothDeviceStateChanged( } else { // Device is in discovery mode, so we are reporting it anyway. if (enable_notifications_) { - NEARBY_LOGS(VERBOSE) << "Notify about existing discovered device"; + NEARBY_VLOG(1) << "Notify about existing discovered device"; info.callback.device_discovered_cb(device); for (auto& observer : observers_.GetObservers()) { observer->DeviceAdded(device); @@ -203,7 +217,7 @@ void MediumEnvironment::OnBluetoothDeviceStateChanged( // Known device is turned off. // Erase it from the map, and report as lost. if (enable_notifications_) { - NEARBY_LOGS(VERBOSE) << "Notify about removed device"; + NEARBY_VLOG(1) << "Notify about removed device"; info.callback.device_lost_cb(device); for (auto& observer : observers_.GetObservers()) { observer->DeviceRemoved(device); @@ -284,7 +298,7 @@ void MediumEnvironment::OnBlePeripheralStateChanged( BleMediumContext& info, api::BlePeripheral& peripheral, const std::string& service_id, bool fast_advertisement, bool enabled) { if (!enabled_) return; - NEARBY_LOGS(INFO) << "G3 OnBleServiceStateChanged [peripheral impl=" + NEARBY_LOGS(INFO) << "OnBleServiceStateChanged [peripheral impl=" << &peripheral << "]; context=" << &info << "; service_id=" << service_id << "; notify=" << enable_notifications_.load(); @@ -292,7 +306,7 @@ void MediumEnvironment::OnBlePeripheralStateChanged( if (enabled) { RunOnMediumEnvironmentThread([&info, &peripheral, service_id, fast_advertisement]() { - NEARBY_LOGS(INFO) << "G3 [Run] OnBleServiceStateChanged [peripheral impl=" + NEARBY_LOGS(INFO) << "[Run] OnBleServiceStateChanged [peripheral impl=" << &peripheral << "]; context=" << &info << "; service_id=" << service_id; info.discovery_callback.peripheral_discovered_cb(peripheral, service_id, @@ -308,18 +322,22 @@ void MediumEnvironment::OnBleV2PeripheralStateChanged( const api::ble_v2::BleAdvertisementData& ble_advertisement_data, api::ble_v2::BlePeripheral& peripheral) { if (!enabled_) return; - NEARBY_LOGS(INFO) << "G3 OnBleServiceStateChanged [peripheral impl=" + NEARBY_LOGS(INFO) << "OnBleServiceStateChanged [peripheral impl=" << &peripheral << "]; medium_context=" << &context << "; notify=" << enable_notifications_.load(); if (!enable_notifications_) return; - NEARBY_LOGS(INFO) << "G3 [Run] OnBleServiceStateChanged [peripheral impl=" + NEARBY_LOGS(INFO) << "[Run] OnBleServiceStateChanged [peripheral impl=" << &peripheral << "]; context=" << &context << "; notify=" << enabled; - if (enabled) { - for (auto& element : context.scan_callback_map) { - if (element.first.first == service_id) + + for (auto& element : context.scan_callback_map) { + if (element.first.first == service_id) { + if (enabled) { element.second.advertisement_found_cb(peripheral, ble_advertisement_data); + } else { + element.second.advertisement_lost_cb(peripheral); + } } } } @@ -332,7 +350,7 @@ void MediumEnvironment::OnWifiLanServiceStateChanged( std::string service_type = service_info.GetServiceType(); auto item = info.discovered_services.find(service_name); if (item == info.discovered_services.end()) { - NEARBY_LOGS(INFO) << "G3 OnWifiLanServiceStateChanged; context=" << &info + NEARBY_LOGS(INFO) << "OnWifiLanServiceStateChanged; context=" << &info << "; service_type=" << service_type << "; enabled=" << enabled << "; notify=" << enable_notifications_.load(); @@ -353,8 +371,8 @@ void MediumEnvironment::OnWifiLanServiceStateChanged( } } else { NEARBY_LOGS(INFO) - << "G3 OnWifiLanServiceStateChanged: exisitng service; context=" - << &info << "; service_type=" << service_type << "; enabled=" << enabled + << "OnWifiLanServiceStateChanged: exisitng service; context=" << &info + << "; service_type=" << service_type << "; enabled=" << enabled << "; notify=" << enable_notifications_.load(); if (enabled) { if (enable_notifications_) { @@ -400,7 +418,7 @@ void MediumEnvironment::RegisterBluetoothMedium( }}) .first->second; auto* owned_adapter = context.adapter; - NEARBY_LOGS(INFO) << "Registered: medium=" << &medium + NEARBY_LOGS(INFO) << "Registered: Bluetooth medium=" << &medium << "; adapter=" << owned_adapter; for (auto& adapter_device : bluetooth_adapters_) { auto& adapter = adapter_device.first; @@ -456,7 +474,7 @@ void MediumEnvironment::RegisterBleMedium(api::BleMedium& medium) { if (!enabled_) return; RunOnMediumEnvironmentThread([this, &medium]() { ble_mediums_.insert({&medium, BleMediumContext{}}); - NEARBY_LOGS(INFO) << "Registered: medium:" << &medium; + NEARBY_LOGS(INFO) << "Registered: BLE medium:" << &medium; }); } @@ -513,7 +531,8 @@ void MediumEnvironment::UpdateBleMediumForScanning( << "; medium=" << &medium << "; service_id=" << service_id << "; fast_advertisement_service_uuid=" - << fast_advertisement_service_uuid + << absl::BytesToHexString( + fast_advertisement_service_uuid) << "; enabled=" << enabled; for (auto& medium_info : ble_mediums_) { auto& local_medium = medium_info.first; @@ -557,7 +576,7 @@ void MediumEnvironment::UnregisterBleMedium(api::BleMedium& medium) { auto item = ble_mediums_.extract(&medium); latch.CountDown(); if (item.empty()) return; - NEARBY_LOGS(INFO) << "Unregistered Ble medium"; + NEARBY_LOGS(INFO) << "Unregistered BLE medium:" << &medium; }); latch.Await(); } @@ -588,7 +607,7 @@ void MediumEnvironment::RegisterBleV2Medium( RunOnMediumEnvironmentThread([this, &medium, peripheral]() { ble_v2_mediums_.insert( {&medium, BleV2MediumContext{.ble_peripheral = peripheral}}); - NEARBY_LOGS(INFO) << "G3 Registered: medium:" << &medium; + NEARBY_LOGS(INFO) << "Registered: BLE V2 medium:" << &medium; }); } @@ -603,46 +622,56 @@ void MediumEnvironment::UpdateBleV2MediumForAdvertising( auto it = ble_v2_mediums_.find(&medium); if (it == ble_v2_mediums_.end()) { NEARBY_LOGS(INFO) - << "G3 UpdateBleV2MediumForAdvertising failed. There is no " + << "UpdateBleV2MediumForAdvertising failed. There is no " "medium registered."; return; } auto& context = it->second; context.ble_peripheral = &peripheral; context.advertising = enabled; - if (enabled) { - context.advertisement_data = advertisement_data; - NEARBY_LOGS(INFO) - << "G3 UpdateBleV2MediumForAdvertising: this=" << this - << ", medium=" << &medium << ", medium_context=" << &context - << ", peripheral=" << &peripheral << ", enabled=" << enabled; - for (auto& medium_info : ble_v2_mediums_) { - const api::ble_v2::BleMedium* remote_medium = medium_info.first; - BleV2MediumContext& remote_context = medium_info.second; - // Do not send notification to the same medium. - if (remote_medium == &medium) continue; - // Do not send notification to the medium that is not scanning. - if (!remote_context.scanning) continue; - absl::flat_hash_set remote_scanning_service_uuids; - for (auto& element : remote_context.scan_callback_map) { - remote_scanning_service_uuids.insert(element.first.first); - } - for (auto& remote_scanning_service_uuid : - remote_scanning_service_uuids) { - auto const it = context.advertisement_data.service_data.find( - remote_scanning_service_uuid); - if (it == context.advertisement_data.service_data.end()) continue; - NEARBY_LOGS(INFO) - << "G3 UpdateBleV2MediumForAdvertising, found other medium=" - << remote_medium - << ", remote_medium_context=" << &remote_context - << ", remote_context.peripheral=" - << remote_context.ble_peripheral - << ". Ready to call OnBleV2PeripheralStateChanged."; - OnBleV2PeripheralStateChanged( - enabled, remote_context, remote_scanning_service_uuid, - context.advertisement_data, *context.ble_peripheral); - } + context.advertisement_data = advertisement_data; + + NEARBY_LOGS(INFO) << "UpdateBleV2MediumForAdvertising: this=" << this + << ", medium=" << &medium + << ", medium_context=" << &context + << ", peripheral=" << &peripheral + << ", enabled=" << enabled; + + for (auto& medium_info : ble_v2_mediums_) { + const api::ble_v2::BleMedium* remote_medium = medium_info.first; + BleV2MediumContext& remote_context = medium_info.second; + + // Do not send notification to the same medium. + if (remote_medium == &medium) continue; + // Do not send notification to the medium that is not scanning. + if (!remote_context.scanning) continue; + + absl::flat_hash_set remote_scanning_service_uuids; + for (auto& element : remote_context.scan_callback_map) { + remote_scanning_service_uuids.insert(element.first.first); + } + + for (auto& remote_scanning_service_uuid : + remote_scanning_service_uuids) { + auto const it = context.advertisement_data.service_data.find( + remote_scanning_service_uuid); + + // Only skip when service data is not found and the medium is + // enabled. Mediums that stop advertising (disabled) pass in empty + // advertisement data but should still be processed. + if (it == context.advertisement_data.service_data.end() && enabled) + continue; + + NEARBY_LOGS(INFO) + << "UpdateBleV2MediumForAdvertising, found other medium=" + << remote_medium + << ", remote_medium_context=" << &remote_context + << ", remote_context.peripheral=" + << remote_context.ble_peripheral + << ". Ready to call OnBleV2PeripheralStateChanged."; + OnBleV2PeripheralStateChanged( + enabled, remote_context, remote_scanning_service_uuid, + context.advertisement_data, *context.ble_peripheral); } } }); @@ -661,12 +690,12 @@ void MediumEnvironment::UpdateBleV2MediumForScanning( auto it = ble_v2_mediums_.find(&medium); if (it == ble_v2_mediums_.end()) { NEARBY_LOGS(INFO) - << "G3 UpdateBleV2MediumForScanning failed. There is no medium " + << "UpdateBleV2MediumForScanning failed. There is no medium " "registered."; return; } BleV2MediumContext& context = it->second; - NEARBY_LOGS(INFO) << "G3 UpdateBleV2MediumForScanning: this=" << this + NEARBY_LOGS(INFO) << "UpdateBleV2MediumForScanning: this=" << this << ", medium=" << &medium << ", medium_context=" << &context << ", enabled=" << enabled; @@ -691,7 +720,7 @@ void MediumEnvironment::UpdateBleV2MediumForScanning( if (it == remote_context.advertisement_data.service_data.end()) continue; NEARBY_LOGS(INFO) - << "G3 UpdateBleV2MediumForScanning, found other medium=" + << "UpdateBleV2MediumForScanning, found other medium=" << remote_medium << ", remote_medium_context=" << &remote_context << ", scanning_service_uuid=" << scanning_service_uuid.Get16BitAsString() @@ -716,20 +745,20 @@ void MediumEnvironment::UnregisterBleV2Medium(api::ble_v2::BleMedium& medium) { RunOnMediumEnvironmentThread([this, &medium]() { auto item = ble_v2_mediums_.extract(&medium); if (item.empty()) return; - NEARBY_LOGS(INFO) << "G3 Unregistered Ble medium"; + NEARBY_LOGS(INFO) << "Unregistered BLE V2 medium:" << &medium; }); } -absl::optional +std::optional MediumEnvironment::GetBleV2MediumStatus(const api::ble_v2::BleMedium& medium) { - if (!enabled_) return absl::nullopt; + if (!enabled_) return std::nullopt; - absl::optional result; + std::optional result; CountDownLatch latch(1); RunOnMediumEnvironmentThread([this, &medium, &latch, &result]() { auto it = ble_v2_mediums_.find(&medium); if (it == ble_v2_mediums_.end()) { - result = absl::nullopt; + result = std::nullopt; latch.CountDown(); return; } @@ -754,8 +783,8 @@ void MediumEnvironment::RegisterWebRtcSignalingMessenger( std::move(complete_callback)}]() mutable { webrtc_signaling_message_callback_[self_id] = std::move(message_callback); webrtc_signaling_complete_callback_[self_id] = std::move(complete_callback); - NEARBY_LOGS(INFO) << "Registered signaling message callback for id = " - << self_id; + NEARBY_LOGS(INFO) + << "Registered: WebRTC signaling message callback for id = " << self_id; }); } @@ -767,8 +796,9 @@ void MediumEnvironment::UnregisterWebRtcSignalingMessenger( webrtc_signaling_message_callback_.extract(self_id); auto complete_callback_item = webrtc_signaling_complete_callback_.extract(self_id); - NEARBY_LOGS(INFO) << "Unregistered signaling message callback for id = " - << self_id; + NEARBY_LOGS(INFO) + << "Unregistered WebRTC signaling message callback for id = " + << self_id; }); } @@ -844,7 +874,7 @@ void MediumEnvironment::RegisterWifiLanMedium(api::WifiLanMedium& medium) { if (!enabled_) return; RunOnMediumEnvironmentThread([this, &medium]() { wifi_lan_mediums_.insert({&medium, WifiLanMediumContext{}}); - NEARBY_LOG(INFO, "Registered: medium=%p", &medium); + NEARBY_LOGS(INFO) << "Registered: WifiLan medium:" << &medium; }); } @@ -917,7 +947,7 @@ void MediumEnvironment::UnregisterWifiLanMedium(api::WifiLanMedium& medium) { RunOnMediumEnvironmentThread([this, &medium]() { auto item = wifi_lan_mediums_.extract(&medium); if (item.empty()) return; - NEARBY_LOGS(INFO) << "Unregistered WifiLan medium"; + NEARBY_LOGS(INFO) << "Unregistered WifiLan medium:" << &medium; }); } @@ -951,7 +981,7 @@ void MediumEnvironment::RegisterWifiDirectMedium( RunOnMediumEnvironmentThread([this, &medium]() { MutexLock lock(&mutex_); wifi_direct_mediums_.insert({&medium, WifiDirectMediumContext{}}); - NEARBY_LOG(INFO, "Registered: medium=%p", &medium); + NEARBY_LOGS(INFO) << "Registered: WifiDirect medium:" << &medium; }); } @@ -1031,7 +1061,7 @@ void MediumEnvironment::UnregisterWifiDirectMedium( RunOnMediumEnvironmentThread([this, &medium]() { MutexLock lock(&mutex_); wifi_direct_mediums_.extract(&medium); - NEARBY_LOGS(INFO) << "Unregistered WifiDirect medium"; + NEARBY_LOGS(INFO) << "Unregistered WifiDirect medium:" << &medium; }); } @@ -1041,7 +1071,7 @@ void MediumEnvironment::RegisterWifiHotspotMedium( RunOnMediumEnvironmentThread([this, &medium]() { MutexLock lock(&mutex_); wifi_hotspot_mediums_.insert({&medium, WifiHotspotMediumContext{}}); - NEARBY_LOG(INFO, "Registered: medium=%p", &medium); + NEARBY_LOGS(INFO) << "Registered: WifiHotspot medium:" << &medium; }); } @@ -1116,7 +1146,7 @@ void MediumEnvironment::UnregisterWifiHotspotMedium( MutexLock lock(&mutex_); auto item = wifi_hotspot_mediums_.extract(&medium); if (item.empty()) return; - NEARBY_LOGS(INFO) << "Unregistered WifiHotspot medium"; + NEARBY_LOGS(INFO) << "Unregistered WifiHotspot medium:" << &medium; }); } @@ -1124,12 +1154,12 @@ void MediumEnvironment::SetFeatureFlags(const FeatureFlags::Flags& flags) { const_cast(FeatureFlags::GetInstance()).SetFlags(flags); } -absl::optional MediumEnvironment::GetSimulatedClock() { +std::optional MediumEnvironment::GetSimulatedClock() { MutexLock lock(&mutex_); if (simulated_clock_) { - return absl::optional(simulated_clock_.get()); + return std::optional(simulated_clock_.get()); } - return absl::nullopt; + return std::nullopt; } void MediumEnvironment::RegisterGattServer( @@ -1137,11 +1167,10 @@ void MediumEnvironment::RegisterGattServer( Borrowable gatt_server) { if (!enabled_) return; RunOnMediumEnvironmentThread([this, &medium, peripheral, gatt_server]() { - NEARBY_LOGS(INFO) << "RegisterGattServer for " << peripheral->GetAddress(); auto it = ble_v2_mediums_.find(&medium); if (it == ble_v2_mediums_.end()) { - NEARBY_LOGS(INFO) << "G3 RegisterGattServer failed. There is no " - "medium registered."; + NEARBY_LOGS(WARNING) << "Register GattServer failed. There is no medium" + " registered."; return; } auto& context = it->second; @@ -1149,6 +1178,8 @@ void MediumEnvironment::RegisterGattServer( context.gatt_server = std::make_unique>(gatt_server); context.ble_peripheral = peripheral; + NEARBY_LOGS(INFO) << "Registered: GattServer for " + << peripheral->GetAddress() << " on medium:" << &medium; }); } @@ -1158,14 +1189,16 @@ void MediumEnvironment::UnregisterGattServer(api::ble_v2::BleMedium& medium) { RunOnMediumEnvironmentThread([&]() { auto it = ble_v2_mediums_.find(&medium); if (it == ble_v2_mediums_.end()) { - NEARBY_LOGS(INFO) << "G3 UnregisterGattServer failed. There is no " - "medium registered."; + NEARBY_LOGS(INFO) << "Unregister GattServer failed. There is no " + "medium registered on medium:" + << &medium; latch.CountDown(); return; } auto& context = it->second; - NEARBY_LOGS(INFO) << "UnregisterGattServer for " - << context.ble_peripheral->GetAddress(); + NEARBY_LOGS(INFO) << "Unregistered GattServer for " + << context.ble_peripheral->GetAddress() + << " on medium:" << &medium; context.gatt_server = nullptr; context.ble_peripheral = nullptr; latch.CountDown(); @@ -1196,7 +1229,7 @@ Borrowable MediumEnvironment::GetGattServer( }); latch.Await(); if (!found_server) { - NEARBY_LOGS(INFO) << "G3 GetGattServer failed. No GATT server for " + NEARBY_LOGS(INFO) << "GetGattServer failed. No GATT server for " << peripheral.GetAddress(); } return result; @@ -1359,4 +1392,12 @@ void MediumEnvironment::RemoveObserver( observers_.RemoveObserver(observer); } +void MediumEnvironment::SetBleExtendedAdvertisementsAvailable(bool enabled) { + ble_extended_advertisements_available_ = enabled; +} + +bool MediumEnvironment::IsBleExtendedAdvertisementsAvailable() const { + return ble_extended_advertisements_available_; +} + } // namespace nearby diff --git a/internal/platform/medium_environment.h b/internal/platform/medium_environment.h index 2e6d099d..bad815a4 100644 --- a/internal/platform/medium_environment.h +++ b/internal/platform/medium_environment.h @@ -16,15 +16,16 @@ #define PLATFORM_BASE_MEDIUM_ENVIRONMENT_H_ #include +#include #include #include #include #include -#include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" -#include "absl/container/flat_hash_set.h" #include "absl/strings/string_view.h" +#include "absl/time/time.h" #include "absl/types/optional.h" #include "internal/base/observer_list.h" #include "internal/platform/borrowable.h" @@ -32,6 +33,7 @@ #include "internal/platform/implementation/ble_v2.h" #include "internal/platform/implementation/bluetooth_adapter.h" #include "internal/platform/implementation/bluetooth_classic.h" +#include "internal/platform/runnable.h" #include "internal/platform/uuid.h" #include "internal/test/fake_clock.h" #ifndef NO_WEBRTC @@ -91,6 +93,8 @@ class MediumEnvironment { bool is_scanning; }; + MediumEnvironment(MediumEnvironment&&) = delete; + MediumEnvironment& operator=(MediumEnvironment&&) = delete; MediumEnvironment(const MediumEnvironment&) = delete; MediumEnvironment& operator=(const MediumEnvironment&) = delete; @@ -262,8 +266,8 @@ class MediumEnvironment { void UnregisterBleV2Medium(api::ble_v2::BleMedium& mediumum); // Collects the status for the given BleMedium. Mainly used in unit tests - // to verify if the BleMedum is in expected status after opeartions. - absl::optional GetBleV2MediumStatus( + // to verify if the BleMedum is in expected status after operations. + std::optional GetBleV2MediumStatus( const api::ble_v2::BleMedium& medium); // Adds medium-related info to allow for discovery/advertising to work. @@ -343,7 +347,7 @@ class MediumEnvironment { void SetFeatureFlags(const FeatureFlags::Flags& flags); - absl::optional GetSimulatedClock(); + std::optional GetSimulatedClock(); api::ble_v2::BleMedium* FindBleV2Medium(absl::string_view address); api::ble_v2::BleMedium* FindBleV2Medium(uint64_t id); @@ -388,6 +392,11 @@ class MediumEnvironment { void AddObserver(api::BluetoothClassicMedium::Observer* observer); void RemoveObserver(api::BluetoothClassicMedium::Observer* observer); + // Sets the availability of BLE extended advertisements. It is false by + // default. + void SetBleExtendedAdvertisementsAvailable(bool enabled); + bool IsBleExtendedAdvertisementsAvailable() const; + private: struct BluetoothMediumContext { BluetoothDiscoveryCallback callback; @@ -519,6 +528,7 @@ class MediumEnvironment { absl::Duration peer_connection_latency_ = absl::ZeroDuration(); std::unique_ptr simulated_clock_ ABSL_GUARDED_BY(mutex_); ObserverList observers_; + bool ble_extended_advertisements_available_ = false; }; } // namespace nearby diff --git a/internal/platform/mutex.h b/internal/platform/mutex.h index 7c22764c..6ce81a69 100644 --- a/internal/platform/mutex.h +++ b/internal/platform/mutex.h @@ -31,12 +31,10 @@ namespace nearby { // cause a deadlock. class ABSL_LOCKABLE Mutex final { public: - using Platform = api::ImplementationPlatform; - using Mode = api::Mutex::Mode; - explicit Mutex(bool check = true) - : impl_(Platform::CreateMutex(check ? Mode::kRegular - : Mode::kRegularNoCheck)) {} + : impl_(api::ImplementationPlatform::CreateMutex( + check ? api::Mutex::Mode::kRegular + : api::Mutex::Mode::kRegularNoCheck)) {} Mutex(Mutex&&) = default; Mutex& operator=(Mutex&&) = default; ~Mutex() = default; @@ -58,10 +56,9 @@ class ABSL_LOCKABLE Mutex final { // successfully acquire it. class ABSL_LOCKABLE RecursiveMutex final { public: - using Platform = api::ImplementationPlatform; - using Mode = api::Mutex::Mode; - - RecursiveMutex() : impl_(Platform::CreateMutex(Mode::kRecursive)) {} + RecursiveMutex() + : impl_(api::ImplementationPlatform::CreateMutex( + api::Mutex::Mode::kRecursive)) {} RecursiveMutex(RecursiveMutex&&) = default; RecursiveMutex& operator=(RecursiveMutex&&) = default; ~RecursiveMutex() = default; diff --git a/internal/platform/nsd_service_info.h b/internal/platform/nsd_service_info.h index 26962434..69900120 100644 --- a/internal/platform/nsd_service_info.h +++ b/internal/platform/nsd_service_info.h @@ -16,8 +16,10 @@ #define PLATFORM_BASE_NSD_SERVICE_INFO_H_ #include +#include #include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" namespace nearby { @@ -63,7 +65,7 @@ class NsdServiceInfo { // Sets all TXTRecord. void SetTxtRecords( - absl::flat_hash_map& txt_records) { + const absl::flat_hash_map& txt_records) { txt_records_ = txt_records; } diff --git a/internal/platform/pending_job_registry.h b/internal/platform/pending_job_registry.h index 063c94f4..5d45c145 100644 --- a/internal/platform/pending_job_registry.h +++ b/internal/platform/pending_job_registry.h @@ -42,9 +42,9 @@ class PendingJobRegistry { std::string CreateKey(const std::string& name, absl::Time post_time); Mutex mutex_; - absl::flat_hash_map pending_jobs_ + absl::flat_hash_map pending_jobs_ ABSL_GUARDED_BY(mutex_); - absl::flat_hash_map running_jobs_ + absl::flat_hash_map running_jobs_ ABSL_GUARDED_BY(mutex_); absl::Time list_jobs_time_ ABSL_GUARDED_BY(mutex_) = absl::UnixEpoch(); }; diff --git a/internal/platform/pipe.cc b/internal/platform/pipe.cc index 8249686d..9c6509a5 100644 --- a/internal/platform/pipe.cc +++ b/internal/platform/pipe.cc @@ -21,29 +21,20 @@ #include #include "absl/base/thread_annotations.h" -#include "internal/platform/base_mutex_lock.h" #include "internal/platform/byte_array.h" +#include "internal/platform/condition_variable.h" #include "internal/platform/exception.h" -#include "internal/platform/implementation/condition_variable.h" -#include "internal/platform/implementation/mutex.h" -#include "internal/platform/implementation/platform.h" #include "internal/platform/input_stream.h" +#include "internal/platform/mutex.h" +#include "internal/platform/mutex_lock.h" #include "internal/platform/output_stream.h" namespace nearby { namespace { -using Platform = api::ImplementationPlatform; - class Pipe { public: - Pipe() { -#pragma push_macro("CreateMutex") -#undef CreateMutex - mutex_ = Platform::CreateMutex(api::Mutex::Mode::kRegular); -#pragma pop_macro("CreateMutex") - cond_ = Platform::CreateConditionVariable(mutex_.get()); - } + Pipe() = default; class PipeInputStream : public InputStream { public: @@ -99,12 +90,12 @@ class Pipe { std::deque ABSL_GUARDED_BY(mutex_) buffer_; // Order of declaration matters: // - mutex must be defined before condvar; - std::unique_ptr mutex_; - std::unique_ptr cond_; + Mutex mutex_; + ConditionVariable cond_{&mutex_}; }; ExceptionOr Pipe::Read(size_t size) { - BaseMutexLock lock(mutex_.get()); + MutexLock lock(&mutex_); // We're done reading all the chunks that were written before the OutputStream // was closed, so there's nothing to do here other than return an empty chunk @@ -114,7 +105,7 @@ ExceptionOr Pipe::Read(size_t size) { } while (buffer_.empty() && !input_stream_closed_) { - Exception wait_exception = cond_->Wait(); + Exception wait_exception = cond_.Wait(); if (wait_exception.Raised()) { return ExceptionOr{wait_exception}; @@ -149,22 +140,22 @@ ExceptionOr Pipe::Read(size_t size) { } Exception Pipe::Write(const ByteArray& data) { - BaseMutexLock lock(mutex_.get()); + MutexLock lock(&mutex_); return WriteLocked(data); } void Pipe::MarkInputStreamClosed() { - BaseMutexLock lock(mutex_.get()); + MutexLock lock(&mutex_); if (input_stream_closed_) return; input_stream_closed_ = true; // Trigger cond_ to unblock a potentially-blocked call to read(), and to let // it know to return Exception::IO. - cond_->Notify(); + cond_.Notify(); } void Pipe::MarkOutputStreamClosed() { - BaseMutexLock lock(mutex_.get()); + MutexLock lock(&mutex_); if (output_stream_closed_) return; // Write a sentinel null chunk before marking output_stream_closed as true. WriteLocked(ByteArray{}); @@ -179,7 +170,7 @@ Exception Pipe::WriteLocked(const ByteArray& data) { buffer_.push_back(data); // Trigger cond_ to unblock a potentially-blocked call to read(), now that // there's more data for it to consume. - cond_->Notify(); + cond_.Notify(); return {Exception::kSuccess}; } diff --git a/internal/platform/prng.cc b/internal/platform/prng.cc index 5a4f94b7..02713e99 100644 --- a/internal/platform/prng.cc +++ b/internal/platform/prng.cc @@ -14,6 +14,8 @@ #include "internal/platform/prng.h" +#include +#include #include #include "absl/time/clock.h" diff --git a/internal/platform/scheduled_executor.h b/internal/platform/scheduled_executor.h index f146c068..01b96053 100644 --- a/internal/platform/scheduled_executor.h +++ b/internal/platform/scheduled_executor.h @@ -15,8 +15,9 @@ #ifndef PLATFORM_PUBLIC_SCHEDULED_EXECUTOR_H_ #define PLATFORM_PUBLIC_SCHEDULED_EXECUTOR_H_ -#include #include +#include +#include #include "absl/base/thread_annotations.h" #include "absl/time/time.h" @@ -29,7 +30,6 @@ #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" #include "internal/platform/runnable.h" -#include "internal/platform/thread_check_callable.h" #include "internal/platform/thread_check_runnable.h" namespace nearby { @@ -40,9 +40,8 @@ namespace nearby { // https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html class ABSL_LOCKABLE ScheduledExecutor final : public Lockable { public: - using Platform = api::ImplementationPlatform; - - ScheduledExecutor() : impl_(Platform::CreateScheduledExecutor()) {} + ScheduledExecutor() + : impl_(api::ImplementationPlatform::CreateScheduledExecutor()) {} ScheduledExecutor(ScheduledExecutor&& other) { *this = std::move(other); } ~ScheduledExecutor() { DoShutdown(); } diff --git a/internal/platform/scheduled_executor_test.cc b/internal/platform/scheduled_executor_test.cc index 63d88b32..33d54997 100644 --- a/internal/platform/scheduled_executor_test.cc +++ b/internal/platform/scheduled_executor_test.cc @@ -17,15 +17,34 @@ #include #include "gtest/gtest.h" +#include "absl/base/thread_annotations.h" #include "absl/synchronization/mutex.h" +#include "absl/synchronization/notification.h" #include "absl/time/clock.h" #include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" +#include "internal/platform/cancelable.h" #include "internal/platform/count_down_latch.h" -#include "internal/platform/exception.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" #include "internal/platform/medium_environment.h" +#include "internal/test/fake_clock.h" namespace nearby { +class ScheduledExecutorTest : public ::testing::Test { + public: + void SetUp() override { + NearbyFlags::GetInstance().OverrideBoolFlagValue( + platform::config_package_nearby::nearby_platform_feature:: + kEnableTaskScheduler, + true); + } + + void TearDown() override { + NearbyFlags::GetInstance().ResetOverridedValues(); + } +}; + // kShortDelay must be significant enough to guarantee that OS under heavy load // should be able to execute the non-blocking test paths within this time. absl::Duration kShortDelay = absl::Milliseconds(100); @@ -34,11 +53,11 @@ absl::Duration kShortDelay = absl::Milliseconds(100); // will let kShortDelay fire and jobs scheduled before the kLongDelay fires. absl::Duration kLongDelay = 10 * kShortDelay; -TEST(ScheduledExecutorTest, ConsructorDestructorWorks) { +TEST_F(ScheduledExecutorTest, ConsructorDestructorWorks) { ScheduledExecutor executor; } -TEST(ScheduledExecutorTest, CanExecute) { +TEST_F(ScheduledExecutorTest, CanExecute) { absl::Mutex mutex; absl::CondVar cond; std::atomic_bool done = false; @@ -56,7 +75,7 @@ TEST(ScheduledExecutorTest, CanExecute) { EXPECT_TRUE(done); } -TEST(ScheduledExecutorTest, CanSchedule) { +TEST_F(ScheduledExecutorTest, CanSchedule) { ScheduledExecutor executor; std::atomic_int value = 0; absl::Mutex mutex; @@ -84,7 +103,7 @@ TEST(ScheduledExecutorTest, CanSchedule) { EXPECT_EQ(value, 5); } -TEST(ScheduledExecutorTest, CanCancel) { +TEST_F(ScheduledExecutorTest, CanCancel) { ScheduledExecutor executor; std::atomic_int value = 0; Cancelable cancelable = @@ -95,7 +114,7 @@ TEST(ScheduledExecutorTest, CanCancel) { EXPECT_EQ(value, 0); } -TEST(ScheduledExecutorTest, CanCancelTwice) { +TEST_F(ScheduledExecutorTest, CanCancelTwice) { ScheduledExecutor executor; std::atomic_int value = 0; Cancelable cancelable = @@ -109,7 +128,7 @@ TEST(ScheduledExecutorTest, CanCancelTwice) { EXPECT_EQ(value, 0); } -TEST(ScheduledExecutorTest, FailToCancel) { +TEST_F(ScheduledExecutorTest, FailToCancel) { absl::Mutex mutex; absl::CondVar cond; ScheduledExecutor executor; @@ -132,8 +151,8 @@ TEST(ScheduledExecutorTest, FailToCancel) { EXPECT_EQ(value, 1); } -TEST(ScheduledExecutorTest, - CancelWhileRunning_TaskCompletesBeforeCancelReturns) { +TEST_F(ScheduledExecutorTest, + CancelWhileRunning_TaskCompletesBeforeCancelReturns) { CountDownLatch start_latch(1); ScheduledExecutor executor; std::atomic_int value = 0; @@ -152,8 +171,8 @@ TEST(ScheduledExecutorTest, EXPECT_EQ(value, 1); } -TEST(ScheduledExecutorTest, - CancelTwiceWhileRunning_TaskCompletesBeforeCancelReturns) { +TEST_F(ScheduledExecutorTest, + CancelTwiceWhileRunning_TaskCompletesBeforeCancelReturns) { CountDownLatch start_latch(1); ScheduledExecutor executor; std::atomic_int value = 0; @@ -174,7 +193,7 @@ TEST(ScheduledExecutorTest, EXPECT_EQ(value, 1); } -TEST(ScheduledExecutorTest, ShutdownWaitsForRunningTasks) { +TEST_F(ScheduledExecutorTest, ShutdownWaitsForRunningTasks) { ScheduledExecutor executor; std::atomic_int value = 0; executor.Execute([&]() { @@ -187,14 +206,14 @@ TEST(ScheduledExecutorTest, ShutdownWaitsForRunningTasks) { EXPECT_EQ(value, 1); } -TEST(ScheduledExecutorTest, ExecuteAfterShutdownFails) { +TEST_F(ScheduledExecutorTest, ExecuteAfterShutdownFails) { ScheduledExecutor executor; executor.Shutdown(); executor.Execute([&]() { FAIL() << "Task should not run"; }); } -TEST(ScheduledExecutorTest, ExecuteDuringShutdownFails) { +TEST_F(ScheduledExecutorTest, ExecuteDuringShutdownFails) { CountDownLatch latch(1); ScheduledExecutor executor; @@ -207,7 +226,7 @@ TEST(ScheduledExecutorTest, ExecuteDuringShutdownFails) { executor.Shutdown(); } -TEST(ScheduledExecutorTest, SimulatedClockCanSchedule) { +TEST_F(ScheduledExecutorTest, SimulatedClockCanSchedule) { MediumEnvironment::Instance().Start({.use_simulated_clock = true}); FakeClock* fake_clock = MediumEnvironment::Instance().GetSimulatedClock().value(); @@ -245,8 +264,8 @@ TEST(ScheduledExecutorTest, SimulatedClockCanSchedule) { MediumEnvironment::Instance().Stop(); } -TEST(ScheduledExecutorTest, - DestroyExecutorWithSimulatedClockIgnoresPendingTasks) { +TEST_F(ScheduledExecutorTest, + DestroyExecutorWithSimulatedClockIgnoresPendingTasks) { MediumEnvironment::Instance().Start({.use_simulated_clock = true}); FakeClock* fake_clock = MediumEnvironment::Instance().GetSimulatedClock().value(); @@ -263,7 +282,7 @@ TEST(ScheduledExecutorTest, MediumEnvironment::Instance().Stop(); } -struct ThreadCheckTestClass { +struct ScheduledThreadCheckTestClass { ScheduledExecutor executor; int value ABSL_GUARDED_BY(executor) = 0; @@ -271,23 +290,31 @@ struct ThreadCheckTestClass { int getValue() ABSL_EXCLUSIVE_LOCKS_REQUIRED(executor) { return value; } }; -TEST(ScheduledExecutorTest, ThreadCheck_Execute) { - ThreadCheckTestClass test_class; +TEST_F(ScheduledExecutorTest, ThreadCheck_Execute) { + ScheduledThreadCheckTestClass test_class; + absl::Notification notification; test_class.executor.Execute( - [&test_class]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(test_class.executor) { - test_class.incValue(); - }); + [&test_class, ¬ification]() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(test_class.executor) { + test_class.incValue(); + notification.Notify(); + }); + EXPECT_TRUE(notification.WaitForNotificationWithTimeout(absl::Seconds(2))); } -TEST(ScheduledExecutorTest, ThreadCheck_Schedule) { - ThreadCheckTestClass test_class; +TEST_F(ScheduledExecutorTest, ThreadCheck_Schedule) { + ScheduledThreadCheckTestClass test_class; + absl::Notification notification; test_class.executor.Schedule( - [&test_class]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(test_class.executor) { - test_class.incValue(); - }, + [&test_class, ¬ification]() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(test_class.executor) { + test_class.incValue(); + notification.Notify(); + }, absl::ZeroDuration()); + EXPECT_TRUE(notification.WaitForNotificationWithTimeout(absl::Seconds(2))); } } // namespace nearby diff --git a/internal/platform/settable_future.h b/internal/platform/settable_future.h index 406187e3..0d1930c6 100644 --- a/internal/platform/settable_future.h +++ b/internal/platform/settable_future.h @@ -19,8 +19,16 @@ #include #include +#include "absl/time/time.h" +#include "internal/flags/nearby_flags.h" #include "internal/platform/condition_variable.h" +#include "internal/platform/exception.h" +#include "internal/platform/flags/nearby_platform_feature_flags.h" +#include "internal/platform/implementation/executor.h" #include "internal/platform/implementation/listenable_future.h" +#include "internal/platform/implementation/platform.h" +#include "internal/platform/implementation/settable_future.h" +#include "internal/platform/implementation/submittable_executor.h" #include "internal/platform/mutex.h" #include "internal/platform/mutex_lock.h" #include "internal/platform/system_clock.h" @@ -36,10 +44,20 @@ class SettableFuture : public api::SettableFuture { // Creates a SettableFuture that fails with a kTimeout when `timeout` expires. explicit SettableFuture(absl::Duration timeout) - : timer_(absl::make_unique()) { - timer_->Start(absl::ToInt64Milliseconds(timeout), 0, - [this] { SetException({Exception::kTimeout}); }); + : timer_(std::make_unique()) { + timer_->Start(absl::ToInt64Milliseconds(timeout), 0, [this] { + // Offload the timeout to a single thread executor. + if (NearbyFlags::GetInstance().GetBoolFlag( + platform::config_package_nearby::nearby_platform_feature:: + kEnableTaskScheduler)) { + executor_ = api::ImplementationPlatform::CreateSingleThreadExecutor(); + executor_->Execute([this]() { SetException({Exception::kTimeout}); }); + } else { + SetException({Exception::kTimeout}); + } + }); } + ~SettableFuture() override = default; bool Set(T value) override { @@ -148,6 +166,7 @@ class SettableFuture : public api::SettableFuture { T value_; Exception exception_{Exception::kFailed}; std::unique_ptr timer_; + std::unique_ptr executor_; }; } // namespace nearby diff --git a/internal/platform/single_thread_executor_test.cc b/internal/platform/single_thread_executor_test.cc index 2caf8ea0..745d61bc 100644 --- a/internal/platform/single_thread_executor_test.cc +++ b/internal/platform/single_thread_executor_test.cc @@ -16,13 +16,16 @@ #include #include +#include #include "gtest/gtest.h" +#include "absl/base/thread_annotations.h" #include "absl/synchronization/mutex.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/exception.h" +#include "internal/platform/future.h" namespace nearby { diff --git a/internal/platform/socket.h b/internal/platform/socket.h index 43acd77c..c1a34d64 100644 --- a/internal/platform/socket.h +++ b/internal/platform/socket.h @@ -15,8 +15,18 @@ #ifndef PLATFORM_BASE_SOCKET_H_ #define PLATFORM_BASE_SOCKET_H_ +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/functional/any_invocable.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/exception.h" #include "internal/platform/input_stream.h" #include "internal/platform/output_stream.h" +#include "proto/connections_enums.pb.h" namespace nearby { @@ -29,7 +39,79 @@ class Socket { virtual InputStream& GetInputStream() = 0; virtual OutputStream& GetOutputStream() = 0; - virtual void Close() = 0; + virtual Exception Close() = 0; +}; + +class MediumSocket : public Socket { + public: + explicit MediumSocket(location::nearby::proto::connections::Medium medium) + : medium_(medium) {} + ~MediumSocket() override = default; + + /** Returns the medium of the socket. */ + virtual location::nearby::proto::connections::Medium GetMedium() const { + return medium_; + } + + /** Creates a virtual socket only with outputstream. */ + virtual MediumSocket* CreateVirtualSocket(OutputStream* outputstream) { + return this; + } + + /** Creates a virtual socket. */ + virtual MediumSocket* CreateVirtualSocket( + const std::string& salted_service_id_hash_key, OutputStream* outputstream, + location::nearby::proto::connections::Medium medium, + absl::flat_hash_map>* + virtual_sockets_ptr) { + return this; + } + + /** Feeds the received incoming data to the client. */ + virtual void FeedIncomingData(ByteArray data) { +// NEARBY_LOGS(INFO) << "FeedIncomingData: do nothing"; + } + + /** Returns true if the socket is a virtual socket. */ + virtual bool IsVirtualSocket() { + return false; + } + + /** Adds a listener to be invoked when the socket is closed. */ + void AddOnSocketClosedListener( + std::unique_ptr> socket_closed_listener) { + socket_closed_listeners_.insert(std::move(socket_closed_listener)); + } + + /** Adds a listener to be invoked when the multiplex socket is enabled. */ + void RegisterMultiplexEnabledCallback( + std::shared_ptr> callback) { + multiplex_socket_enabled_cbs_.insert(std::move(callback)); + } + + /** Enables the multiplex socket. */ + void EnableMultiplexSocket() { + if (!IsVirtualSocket()) { + return; + } + for (auto& callback : multiplex_socket_enabled_cbs_) { + (*callback)(); + } + } + + /** Closes the local socket. */ + void CloseLocal() { + for (auto& listener : socket_closed_listeners_) { + (*listener)(); + } + } + + private: + location::nearby::proto::connections::Medium medium_; + absl::flat_hash_set>> + socket_closed_listeners_; + absl::flat_hash_set>> + multiplex_socket_enabled_cbs_; }; } // namespace nearby diff --git a/internal/platform/task_runner.h b/internal/platform/task_runner.h index 24ffda5d..20efc466 100644 --- a/internal/platform/task_runner.h +++ b/internal/platform/task_runner.h @@ -29,13 +29,19 @@ class TaskRunner { // Posts a task to task runner. The task runs immediately or not depends on // the implementation of class. If the implementation supports multiple // threads, posted tasks could run concurrently. + // Returns false if TashRunner has been shutdown. virtual bool PostTask(absl::AnyInvocable task) = 0; // Posts a task to run with delay. Multiple tasks can be scheduled. Tasks will // execute in the order of their delay expiring, not in the order they were // posted. + // Returns false if TashRunner has been shutdown. virtual bool PostDelayedTask(absl::Duration delay, absl::AnyInvocable task) = 0; + + // Shutdown this TaskRunner so that scheduled tasks are no longer executed. + // New tasks posted after Shutdown all will be ignored. + virtual void Shutdown() = 0; }; } // namespace nearby diff --git a/internal/platform/task_runner_impl.cc b/internal/platform/task_runner_impl.cc index 4892ae76..c418634b 100644 --- a/internal/platform/task_runner_impl.cc +++ b/internal/platform/task_runner_impl.cc @@ -14,60 +14,98 @@ #include "internal/platform/task_runner_impl.h" +#include #include #include +#include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" +#include "absl/synchronization/mutex.h" #include "absl/time/time.h" #include "internal/platform/implementation/crypto.h" +#include "internal/platform/multi_thread_executor.h" #include "internal/platform/single_thread_executor.h" +#include "internal/platform/timer.h" #include "internal/platform/timer_impl.h" namespace nearby { TaskRunnerImpl::TaskRunnerImpl(uint32_t runner_count) { if (runner_count == 1) { - executor_ = std::make_unique<::nearby::SingleThreadExecutor>(); + executor_ = std::make_unique(); } else { - executor_ = std::make_unique<::nearby::MultiThreadExecutor>(runner_count); + executor_ = std::make_unique(runner_count); } } TaskRunnerImpl::~TaskRunnerImpl() { { absl::MutexLock lock(&mutex_); - timers_map_.clear(); + if (closed_) { + return; + } } + Shutdown(); +} + +void TaskRunnerImpl::Shutdown() { + absl::flat_hash_map> timers; + { + absl::MutexLock lock(&mutex_); + closed_ = true; + timers = std::move(timers_map_); + } + for (auto& timer : timers) { + timer.second->Stop(); + } + // We expect that all timers are stopped, no new timers will be added, and the + // timer callbacks are not running. executor_->Shutdown(); } bool TaskRunnerImpl::PostTask(absl::AnyInvocable task) { + { + absl::MutexLock lock(&mutex_); + if (closed_) { + return false; + } + } + if (task) { // Because of cannot get the executor status from platform API, just returns // true after calling the Execute method. executor_->Execute(std::move(task)); } - return true; } bool TaskRunnerImpl::PostDelayedTask(absl::Duration delay, absl::AnyInvocable task) { + absl::MutexLock lock(&mutex_); + if (closed_) { + return false; + } if (!task) { return true; } - - absl::MutexLock lock(&mutex_); uint64_t id = GenerateId(); std::unique_ptr timer = std::make_unique(); if (timer->Start(absl::ToInt64Milliseconds(delay), 0, [this, id, task = std::move(task)]() mutable { + std::unique_ptr timer; + { + absl::MutexLock lock(&mutex_); + if (closed_) { + return; + } + timer = std::move(timers_map_.extract(id).mapped()); + } PostTask(std::move(task)); // We can't destroy the timer directly from the timer // callback. - absl::MutexLock lock(&mutex_); - auto timer = timers_map_.extract(id); - PostTask([timer = std::move(timer)]() {}); + if (timer) { + PostTask([timer = std::move(timer)]() {}); + } })) { timers_map_.emplace(id, std::move(timer)); return true; diff --git a/internal/platform/task_runner_impl.h b/internal/platform/task_runner_impl.h index 337a10df..fa927c4e 100644 --- a/internal/platform/task_runner_impl.h +++ b/internal/platform/task_runner_impl.h @@ -23,14 +23,15 @@ #undef UNICODE #endif +#include #include -#include #include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" #include "absl/synchronization/mutex.h" -#include "internal/platform/multi_thread_executor.h" +#include "absl/time/time.h" +#include "internal/platform/submittable_executor.h" #include "internal/platform/task_runner.h" #include "internal/platform/timer.h" @@ -41,18 +42,22 @@ class TaskRunnerImpl : public TaskRunner { explicit TaskRunnerImpl(uint32_t runner_count); ~TaskRunnerImpl() override; - bool PostTask(absl::AnyInvocable task) override; + bool PostTask(absl::AnyInvocable task) override + ABSL_LOCKS_EXCLUDED(mutex_); bool PostDelayedTask(absl::Duration delay, absl::AnyInvocable task) override ABSL_LOCKS_EXCLUDED(mutex_); + void Shutdown() override ABSL_LOCKS_EXCLUDED(mutex_); + private: uint64_t GenerateId(); mutable absl::Mutex mutex_; - std::unique_ptr<::nearby::SubmittableExecutor> executor_; + std::unique_ptr executor_; absl::flat_hash_map> timers_map_ ABSL_GUARDED_BY(mutex_); + bool closed_ ABSL_GUARDED_BY(mutex_) = false; }; } // namespace nearby diff --git a/internal/platform/task_runner_impl_test.cc b/internal/platform/task_runner_impl_test.cc index f7323ef7..90bb839c 100644 --- a/internal/platform/task_runner_impl_test.cc +++ b/internal/platform/task_runner_impl_test.cc @@ -21,6 +21,7 @@ #include "gtest/gtest.h" #include "absl/synchronization/notification.h" #include "absl/time/clock.h" +#include "absl/time/time.h" #include "internal/platform/count_down_latch.h" namespace nearby { @@ -28,9 +29,9 @@ namespace { constexpr uint32_t kNumThreads[] = {1, 10}; -class BaseTaskRunnerImplTest : public ::testing::TestWithParam {}; +class TaskRunnerImplTest : public ::testing::TestWithParam {}; -TEST_P(BaseTaskRunnerImplTest, PostTask) { +TEST_P(TaskRunnerImplTest, PostTask) { TaskRunnerImpl task_runner{GetParam()}; absl::Notification notification; bool called = false; @@ -43,7 +44,7 @@ TEST_P(BaseTaskRunnerImplTest, PostTask) { EXPECT_TRUE(called); } -TEST_F(BaseTaskRunnerImplTest, PostSequenceTasks) { +TEST_F(TaskRunnerImplTest, PostSequenceTasks) { TaskRunnerImpl task_runner{1}; std::vector completed_tasks; absl::Notification notification; @@ -71,7 +72,7 @@ TEST_F(BaseTaskRunnerImplTest, PostSequenceTasks) { EXPECT_EQ(completed_tasks[1], "task2"); } -TEST_P(BaseTaskRunnerImplTest, PostDelayedTask) { +TEST_P(TaskRunnerImplTest, PostDelayedTask) { TaskRunnerImpl task_runner{GetParam()}; std::atomic_bool first_task_started = false; CountDownLatch latch(2); @@ -91,7 +92,7 @@ TEST_P(BaseTaskRunnerImplTest, PostDelayedTask) { latch.Await(); } -TEST_P(BaseTaskRunnerImplTest, PostTwoDelayedTasks) { +TEST_P(TaskRunnerImplTest, PostTwoDelayedTasks) { TaskRunnerImpl task_runner{GetParam()}; std::atomic_bool first_task_started = false; CountDownLatch latch(2); @@ -111,7 +112,7 @@ TEST_P(BaseTaskRunnerImplTest, PostTwoDelayedTasks) { latch.Await(); } -TEST_P(BaseTaskRunnerImplTest, PostMultipleTasks) { +TEST_P(TaskRunnerImplTest, PostMultipleTasks) { TaskRunnerImpl task_runner(GetParam()); constexpr int kNumTasks = 10; CountDownLatch latch(kNumTasks); @@ -126,14 +127,27 @@ TEST_P(BaseTaskRunnerImplTest, PostMultipleTasks) { EXPECT_TRUE(latch.Await()); } -TEST_P(BaseTaskRunnerImplTest, PostEmptyTask) { +TEST_P(TaskRunnerImplTest, PostEmptyTask) { TaskRunnerImpl task_runner{GetParam()}; EXPECT_TRUE(task_runner.PostTask(nullptr)); EXPECT_TRUE(task_runner.PostDelayedTask(absl::Milliseconds(100), nullptr)); } -INSTANTIATE_TEST_SUITE_P(ParameterizedBasePcpHandlerTest, - BaseTaskRunnerImplTest, +TEST_P(TaskRunnerImplTest, PostTaskAfterShutdown) { + TaskRunnerImpl task_runner{GetParam()}; + task_runner.Shutdown(); + + EXPECT_FALSE(task_runner.PostTask([]() {})); +} + +TEST_P(TaskRunnerImplTest, PostDelayedTaskAfterShutdown) { + TaskRunnerImpl task_runner{GetParam()}; + task_runner.Shutdown(); + + EXPECT_FALSE(task_runner.PostDelayedTask(absl::Milliseconds(50), []() {})); +} + +INSTANTIATE_TEST_SUITE_P(ParameterizedTaskRunnerImplTest, TaskRunnerImplTest, ::testing::ValuesIn(kNumThreads)); } // namespace diff --git a/internal/platform/thread_check_nocompile_test.py b/internal/platform/thread_check_nocompile_test.py index 82604049..5773f512 100644 --- a/internal/platform/thread_check_nocompile_test.py +++ b/internal/platform/thread_check_nocompile_test.py @@ -1,3 +1,17 @@ +# Copyright 2022 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. + """Negative tests for thread safety analysis in executors implementation.""" from google3.testing.pybase import fake_target_util diff --git a/internal/platform/uuid.cc b/internal/platform/uuid.cc index a22ab7df..abba3ec2 100644 --- a/internal/platform/uuid.cc +++ b/internal/platform/uuid.cc @@ -14,12 +14,23 @@ #include "internal/platform/uuid.h" +#include +#include #include +#include +#include +#include #include #include +#include -#include "absl/strings/escaping.h" -#include "internal/platform/implementation/crypto.h" +#include "absl/strings/numbers.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_split.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" +#include +#include namespace nearby { namespace { @@ -30,12 +41,70 @@ std::ostream& write_hex(std::ostream& os, absl::string_view data) { } return os; } + +ByteArray Hash(absl::string_view input, const EVP_MD* algo) { + unsigned int md_out_size = EVP_MAX_MD_SIZE; + uint8_t digest_buffer[EVP_MAX_MD_SIZE]; + if (input.empty()) return {}; + + if (!EVP_Digest(input.data(), input.size(), digest_buffer, &md_out_size, algo, + nullptr)) + return {}; + + return ByteArray{reinterpret_cast(digest_buffer), md_out_size}; +} + +ByteArray Md5(absl::string_view input) { return Hash(input, EVP_md5()); } + } // namespace +// Based on the Java implementation +// http://androidxref.com/8.0.0_r4/xref/libcore/ojluni/src/main/java/java/util/UUID.java#191 +std::optional Uuid::FromString(absl::string_view data) { + std::vector components = absl::StrSplit(data, '-'); + if (components.size() != 5) { + return std::nullopt; + } + + for (std::string& component : components) { + component = absl::StrCat("0x", component); + } + + int64_t most_sig_bits = 0L; + int64_t least_sig_bits = 0L; + int64_t temp; + if (!absl::SimpleHexAtoi(components[0], &temp)) { + return std::nullopt; + } + most_sig_bits = temp; + most_sig_bits <<= 16; + if (!absl::SimpleHexAtoi(components[1], &temp)) { + return std::nullopt; + } + most_sig_bits |= temp; + most_sig_bits <<= 16; + if (!absl::SimpleHexAtoi(components[2], &temp)) { + return std::nullopt; + } + most_sig_bits |= temp; + + if (!absl::SimpleHexAtoi(components[3], &temp)) { + return std::nullopt; + } + least_sig_bits = temp; + least_sig_bits <<= 48; + if (!absl::SimpleHexAtoi(components[4], &temp)) { + return std::nullopt; + } + least_sig_bits |= temp; + + return Uuid(most_sig_bits, least_sig_bits); +} + Uuid::Uuid(absl::string_view data) { // Based on the Java counterpart at // http://androidxref.com/8.0.0_r4/xref/libcore/ojluni/src/main/java/java/util/UUID.java#162. - std::string md5_data(Crypto::Md5(data)); + std::string md5_data(Md5(data)); md5_data[6] &= 0x0f; // Clear version. md5_data[6] |= 0x30; // Set to version 3. md5_data[8] &= 0x3f; // Clear variant. diff --git a/internal/platform/uuid.h b/internal/platform/uuid.h index ad3d896d..230e2f29 100644 --- a/internal/platform/uuid.h +++ b/internal/platform/uuid.h @@ -17,6 +17,7 @@ #include #include +#include #include #include "absl/strings/string_view.h" @@ -32,6 +33,10 @@ class Uuid final { public: Uuid() = default; + // Constructs a UUID from the canonical string format as + // xxxxxABCD-xxxx-xxxx-xxxxxxxxxxxxxx + static std::optional FromString(absl::string_view data); + // Constructs a type 3 (name based) UUID based on the input string. explicit Uuid(absl::string_view data); // Constructs a new UUID using the specified most_sig_bits for the most diff --git a/internal/platform/uuid_test.cc b/internal/platform/uuid_test.cc index 909b68bf..136ef90e 100644 --- a/internal/platform/uuid_test.cc +++ b/internal/platform/uuid_test.cc @@ -14,11 +14,15 @@ #include "internal/platform/uuid.h" +#include +#include +#include #include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/strings/string_view.h" #include "internal/platform/crypto.h" #include "internal/platform/logging.h" @@ -131,5 +135,13 @@ TEST(UuidTest, OperatorGreaterThan) { EXPECT_TRUE(a < b); } +TEST(UuidTest, ConstructUuidFromString) { + std::optional a = + Uuid::FromString("12345678-1234-1234-1234-123456789012"); + + ASSERT_TRUE(a.has_value()); + EXPECT_EQ(std::string(*a), "12345678-1234-1234-1234-123456789012"); +} + } // namespace } // namespace nearby diff --git a/internal/platform/webrtc.h b/internal/platform/webrtc.h index ef49ad9c..96a83f9b 100644 --- a/internal/platform/webrtc.h +++ b/internal/platform/webrtc.h @@ -18,7 +18,13 @@ #ifndef NO_WEBRTC #include +#include +#include +#include +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/feature_flags.h" #include "internal/platform/implementation/platform.h" #include "internal/platform/implementation/webrtc.h" #include "webrtc/api/peer_connection_interface.h" @@ -74,11 +80,22 @@ class WebRtcMedium { return impl_->GetDefaultCountryCode(); } + void SetNonCellular(bool non_cellular) { + non_cellular_ = non_cellular; + } + // Creates and returns a new webrtc::PeerConnectionInterface object via // |callback|. void CreatePeerConnection(webrtc::PeerConnectionObserver* observer, PeerConnectionCallback callback) { - impl_->CreatePeerConnection(observer, std::move(callback)); + if (FeatureFlags::GetInstance() + .GetFlags() + .support_web_rtc_non_cellular_medium) { + // TODO(edwinwu): Add support for non-cellular networks. + impl_->CreatePeerConnection(std::nullopt, observer, std::move(callback)); + } else { + impl_->CreatePeerConnection(observer, std::move(callback)); + } } // Returns a signaling messenger for sending WebRTC signaling messages. @@ -93,6 +110,7 @@ class WebRtcMedium { private: std::unique_ptr impl_; + bool non_cellular_ = false; }; } // namespace nearby diff --git a/internal/platform/wifi_credential.h b/internal/platform/wifi_credential.h index e715235a..646dfb86 100644 --- a/internal/platform/wifi_credential.h +++ b/internal/platform/wifi_credential.h @@ -59,6 +59,8 @@ class HotspotCredentials { // Gets the Frequency int GetFrequency() const { return frequency_; } + // Set frequency_ + void SetFrequency(int frequency) { frequency_ = frequency; } // Gets the Band location::nearby::proto::connections::ConnectionBand GetBand() const { @@ -118,6 +120,8 @@ class WifiDirectCredentials { // Gets the Frequency int GetFrequency() const { return frequency_; } + // Set the Frequency + void SetFrequency(int frequency) { frequency_ = frequency; } // Gets the Band location::nearby::proto::connections::ConnectionBand GetBand() const { diff --git a/internal/platform/wifi_hotspot.h b/internal/platform/wifi_hotspot.h index 88ee985a..187d50da 100644 --- a/internal/platform/wifi_hotspot.h +++ b/internal/platform/wifi_hotspot.h @@ -15,13 +15,16 @@ #ifndef PLATFORM_PUBLIC_WIFI_HOTSPOT_H_ #define PLATFORM_PUBLIC_WIFI_HOTSPOT_H_ +#include #include +#include #include #include -#include "absl/container/flat_hash_map.h" -#include "internal/platform/byte_array.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "internal/platform/cancellation_flag.h" +#include "internal/platform/exception.h" #include "internal/platform/implementation/platform.h" #include "internal/platform/implementation/wifi_hotspot.h" #include "internal/platform/input_stream.h" @@ -170,7 +173,7 @@ class WifiHotspotMedium { } // Returns the port range as a pair of min and max port. - absl::optional> GetDynamicPortRange() { + std::optional> GetDynamicPortRange() { return impl_->GetDynamicPortRange(); } @@ -181,10 +184,11 @@ class WifiHotspotMedium { bool StopWifiHotspot() { return impl_->StopWifiHotspot(); } bool ConnectWifiHotspot(const std::string& ssid, - const std::string& password) { + const std::string& password, int frequency) { MutexLock lock(&mutex_); hotspot_credentials_.SetSSID(ssid); hotspot_credentials_.SetPassword(password); + hotspot_credentials_.SetFrequency(frequency); return impl_->ConnectWifiHotspot(&hotspot_credentials_); } bool DisconnectWifiHotspot() { return impl_->DisconnectWifiHotspot(); } diff --git a/internal/platform/wifi_hotspot_test.cc b/internal/platform/wifi_hotspot_test.cc index a21ee7a8..262f3098 100644 --- a/internal/platform/wifi_hotspot_test.cc +++ b/internal/platform/wifi_hotspot_test.cc @@ -14,15 +14,21 @@ #include "internal/platform/wifi_hotspot.h" +#include #include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/time/clock.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/cancellation_flag.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/exception.h" +#include "internal/platform/input_stream.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" +#include "internal/platform/output_stream.h" #include "internal/platform/wifi_credential.h" namespace nearby { @@ -43,6 +49,7 @@ constexpr absl::string_view kSsid = "Direct-357a2d8c"; constexpr absl::string_view kPassword = "b592f7d3"; constexpr absl::string_view kIp = "123.234.23.1"; constexpr const size_t kPort = 20; +constexpr int kFrequency = 2412; constexpr absl::string_view kData = "ABCD"; constexpr const size_t kChunkSize = 10; @@ -109,7 +116,7 @@ TEST_F(WifiHotspotMediumTest, CanConnectDisconnectHotspot) { std::string password(kPassword); ASSERT_TRUE(wifi_hotspot_a->IsInterfaceValid()); - EXPECT_FALSE(wifi_hotspot_a->ConnectWifiHotspot(ssid, password)); + EXPECT_FALSE(wifi_hotspot_a->ConnectWifiHotspot(ssid, password, kFrequency)); EXPECT_TRUE(wifi_hotspot_a->DisconnectWifiHotspot()); wifi_hotspot_a.reset(); } @@ -125,7 +132,8 @@ TEST_P(WifiHotspotMediumTest, CanStartHotspotThatOtherConnect) { EXPECT_TRUE(wifi_hotspot_a->StartWifiHotspot()); HotspotCredentials* hotspot_credentials = wifi_hotspot_a->GetCredential(); EXPECT_TRUE(wifi_hotspot_b->ConnectWifiHotspot( - hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword())); + hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword(), + hotspot_credentials->GetFrequency())); WifiHotspotServerSocket server_socket = wifi_hotspot_a->ListenForService(); EXPECT_TRUE(server_socket.IsValid()); @@ -191,7 +199,8 @@ TEST_P(WifiHotspotMediumTest, CanStartHotspotThatOtherCanCancelConnect) { EXPECT_TRUE(wifi_hotspot_a->StartWifiHotspot()); HotspotCredentials* hotspot_credentials = wifi_hotspot_a->GetCredential(); EXPECT_TRUE(wifi_hotspot_b->ConnectWifiHotspot( - hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword())); + hotspot_credentials->GetSSID(), hotspot_credentials->GetPassword(), + hotspot_credentials->GetFrequency())); WifiHotspotServerSocket server_socket = wifi_hotspot_a->ListenForService(); EXPECT_TRUE(server_socket.IsValid()); @@ -250,7 +259,7 @@ TEST_F(WifiHotspotMediumTest, CanStartHotspotTheOtherFailConnect) { std::string ssid(kSsid); std::string password(kPassword); - EXPECT_FALSE(wifi_hotspot_b->ConnectWifiHotspot(ssid, password)); + EXPECT_FALSE(wifi_hotspot_b->ConnectWifiHotspot(ssid, password, kFrequency)); EXPECT_TRUE(wifi_hotspot_b->DisconnectWifiHotspot()); EXPECT_TRUE(wifi_hotspot_a->StopWifiHotspot()); diff --git a/internal/platform/wifi_lan.cc b/internal/platform/wifi_lan.cc index 1a80bd1c..6719ac46 100644 --- a/internal/platform/wifi_lan.cc +++ b/internal/platform/wifi_lan.cc @@ -17,8 +17,8 @@ #include #include +#include "internal/platform/implementation/wifi_utils.h" #include "internal/platform/mutex_lock.h" -#include "internal/platform/wifi_utils.h" namespace nearby { @@ -43,7 +43,7 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_id, } api::WifiLanMedium::DiscoveredServiceCallback api_callback = { .service_discovered_cb = - [this](NsdServiceInfo service_info) { + [this](const NsdServiceInfo& service_info) { MutexLock lock(&mutex_); std::string service_type = service_info.GetServiceType(); // Check callback for the service type. @@ -86,7 +86,7 @@ bool WifiLanMedium::StartDiscovery(const std::string& service_id, medium_callback.service_discovered_cb(service_info, service_id); }, .service_lost_cb = - [this](NsdServiceInfo service_info) { + [this](const NsdServiceInfo& service_info) { MutexLock lock(&mutex_); std::string service_type = service_info.GetServiceType(); std::string service_name = service_info.GetServiceName(); diff --git a/internal/proto/BUILD b/internal/proto/BUILD index 0cd7e234..d0a92854 100644 --- a/internal/proto/BUILD +++ b/internal/proto/BUILD @@ -1,10 +1,29 @@ -load("@rules_cc//cc:defs.bzl", "cc_proto_library") +# Copyright 2022 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. + # NOTE: gRPC libraries not needed. +load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( name = "credential_proto", srcs = ["credential.proto"], - visibility = ["//location/nearby/presence/proto:__pkg__"], + visibility = [ + "//google/internal/location/nearby/sharing/v1:__pkg__", + "//location/nearby/presence/proto:__pkg__", + "//location/nearby/sharing/proto:__pkg__", + ], ) cc_proto_library( @@ -18,7 +37,10 @@ cc_proto_library( proto_library( name = "local_credential_proto", srcs = ["local_credential.proto"], - visibility = ["//location/nearby/presence/proto:__pkg__"], + visibility = [ + "//location/nearby/presence/proto:__pkg__", + "//location/nearby/sharing/proto:__pkg__", + ], deps = [":credential_proto"], ) @@ -33,9 +55,7 @@ cc_proto_library( proto_library( name = "metadata_proto", srcs = ["metadata.proto"], - visibility = [ - "//visibility:private", # Only private by automation, not intent. Owner may accept CLs adding visibility. See go/scheuklappen#explicit-private. - ], + visibility = ["//visibility:private"], ) proto_library( diff --git a/internal/proto/analytics/BUILD b/internal/proto/analytics/BUILD index 904d2182..2105f2eb 100644 --- a/internal/proto/analytics/BUILD +++ b/internal/proto/analytics/BUILD @@ -13,6 +13,7 @@ # limitations under the License. load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") licenses(["notice"]) @@ -32,7 +33,6 @@ proto_library( proto_library( name = "fast_pair_log_proto", srcs = ["fast_pair_log.proto"], - compatible_with = ["//buildenv/target:non_prod"], deps = ["//proto:fast_pair_enums_proto"], ) @@ -50,6 +50,7 @@ cc_proto_library( name = "connections_log_cc_proto", visibility = [ "//connections:__subpackages__", + "//internal/analytics:__pkg__", "//location/nearby/analytics/cpp:__subpackages__", ], deps = [":connections_log_proto"], @@ -67,8 +68,8 @@ cc_test( "//internal/platform:types", "//internal/platform/implementation/g3", # build_cleaner: keep "//proto:connections_enums_cc_proto", + "//third_party/protobuf", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_googletest//:gtest_main", - "@com_google_protobuf//:protobuf", ], ) diff --git a/internal/proto/analytics/connections_log.proto b/internal/proto/analytics/connections_log.proto index 09fdb890..fb9819ff 100644 --- a/internal/proto/analytics/connections_log.proto +++ b/internal/proto/analytics/connections_log.proto @@ -63,6 +63,42 @@ message ConnectionsLog { // Zero or more StrategySessions. repeated StrategySession strategy_session = 2; + + // The client session flow id. + optional int64 client_flow_id = 3 /* type = ST_SESSION_ID */; + + // All the connection tokens used in this client session. + optional string connection_token = 4 + /* type = ST_SESSION_ID */; + } + + message OperationResult { + // The category of the operation result + optional location.nearby.proto.connections.OperationResultCategory + result_category = 1; + + // The result code of the operation result + optional location.nearby.proto.connections.OperationResultCode result_code = + 2; + } + + message OperationResultWithMedium { + optional location.nearby.proto.connections.Medium medium = 1; + + // Indicate which mediums belong to the same update API Call. + optional int32 update_index = 2; + + // The category of the operation result + optional location.nearby.proto.connections.OperationResultCategory + result_category = 3; + + // The result code of the operation result + optional location.nearby.proto.connections.OperationResultCode result_code = + 4; + + // The connection mode. + optional location.nearby.proto.connections.ConnectionMode connection_mode = + 5; } // One round of a particular Strategy done by a client. @@ -127,6 +163,13 @@ message ConnectionsLog { // Encapsulates additional discovery information. optional DiscoveryMetadata discovery_metadata = 7; + + // Collect the discovery results of the mediums + repeated OperationResultWithMedium adv_dis_result = 8; + + // The readon of stopping discoverying + optional location.nearby.proto.connections.StopDiscoveringReason + stop_reason = 9; } // An endpoint discovered on a particular medium during discovery. @@ -205,6 +248,13 @@ message ConnectionsLog { // Encapsulates additional advertising information. optional AdvertisingMetadata advertising_metadata = 5; + + // Collect the discovery results of the mediums + repeated OperationResultWithMedium adv_dis_result = 6; + + // The readon of stopping advertising + optional location.nearby.proto.connections.StopAdvertisingReason + stop_reason = 7; } // A request to connect, corresponding to the API's concept of @@ -262,6 +312,13 @@ message ConnectionsLog { // Encapsulates additional connection information. optional ConnectionAttemptMetadata connection_attempt_metadata = 8; + + // The result code of this connection attempt + optional OperationResult operation_result = 9; + + // The connection mode. + optional location.nearby.proto.connections.ConnectionMode connection_mode = + 10; } // A successfully-established connection over a particular medium. @@ -295,6 +352,9 @@ message ConnectionsLog { // If this is a safe disconnection. optional SafeDisconnectionResult safe_disconnection_result = 9; + // The result code of this established connection + optional OperationResult operation_result = 10; + enum SafeDisconnectionResult { UNKNOWN_SAFE_DISCONNECTION_RESULT = 0; SAFE_DISCONNECTION = 1; @@ -324,6 +384,12 @@ message ConnectionsLog { // The number of successful auto resume. optional int32 num_successful_auto_resume = 7; + + // The result code of this sent payload + optional OperationResult operation_result = 8; + + // The number of failed auto resume attempts. + optional int32 num_failed_auto_resume = 9; } // An attempt to upgrade an existing connection from one medium to another. @@ -355,6 +421,9 @@ message ConnectionsLog { // The token used to identify this upgrade pair. optional string connection_token = 8 /* type = ST_SESSION_ID */; + + // The result code of this upgrade attempt + optional OperationResult operation_result = 9; } // Next Id: 22 @@ -420,6 +489,15 @@ message ConnectionsLog { // The power level of this advertising optional location.nearby.proto.connections.PowerLevel power_level = 5; + + // The dual band support status + optional bool supports_dual_band = 6; + + // The wifi aware support status + optional bool supports_wifi_aware = 7; + + // The endpoint info size + optional int32 endpoint_info_size = 8; } // Some additional information to keep with the discovery phase. diff --git a/internal/proto/analytics/fast_pair_log.proto b/internal/proto/analytics/fast_pair_log.proto index 702b38ea..ab0316ef 100644 --- a/internal/proto/analytics/fast_pair_log.proto +++ b/internal/proto/analytics/fast_pair_log.proto @@ -16,7 +16,7 @@ syntax = "proto2"; package nearby.proto.fastpair; -import "third_party/nearby/proto/fast_pair_enums.proto"; +import "proto/fast_pair_enums.proto"; option optimize_for = LITE_RUNTIME; option java_package = "nearby.proto.fastpair"; @@ -107,6 +107,8 @@ message FastPairLog { message ProviderInfo { // The number of account keys stored in the provider. optional int32 number_account_keys_on_provider = 1; + // The GATT database hash in the provider. + optional string database_hash = 2; } message FootprintsInfo { @@ -151,4 +153,31 @@ message FastPairLog { // For the CREATE_BOND event, add bonding transport optional uint32 bonding_transport = 18; + + // Whether the current user is first day pairing a new device by fast pair. + // This is used for evaluating the A/B test of device pairing half sheet + // layout. + optional bool is_first_day_new_user = 19; + + // Whether the current user is first seven days pairing a new device by fast + // pair. This is used for evaluating the A/B test of device pairing half sheet + // layout. + optional bool is_seven_days_new_user = 20; + + // For the CREATE_BOND event, add bonded device count + optional uint32 bonded_device_count = 21; + + // SASS connection state for the device. Not set for non-SASS devices. + optional int32 sass_connection_state = 22; + + optional bool is_pair_triggered_by_settings = 23; + + // The nearby mainline tethering module version. + optional int64 nearby_mainline_tethering_version = 24; + + // The nearby nano app version for offload. + optional int64 nearby_nano_app_version = 25; + + // For the SECRET_HANDSHAKE event, is the pairing device in paired history. + optional bool is_in_paired_history = 26; } diff --git a/internal/proto/credential.proto b/internal/proto/credential.proto index 42836b1d..53506e88 100644 --- a/internal/proto/credential.proto +++ b/internal/proto/credential.proto @@ -26,10 +26,9 @@ option optimize_for = LITE_RUNTIME; // LINT.IfChange(IdentityType) enum IdentityType { IDENTITY_TYPE_UNSPECIFIED = 0; - IDENTITY_TYPE_PRIVATE = 1; - IDENTITY_TYPE_TRUSTED = 2; + IDENTITY_TYPE_PRIVATE_GROUP = 1; + IDENTITY_TYPE_CONTACTS_GROUP = 2; IDENTITY_TYPE_PUBLIC = 3; - IDENTITY_TYPE_PROVISIONED = 4; } // LINT.ThenChange(//depot/google3/google/internal/location/nearby/presence/v1/nearby_resources.proto:IdentityType) // LINT.IfChange(CredentialType) @@ -43,11 +42,11 @@ enum CredentialType { // The shared credential is derived from local credential, and distributed to // remote devices based on the trust token for identity decryption and // authentication. -// NEXT_ID=16 +// NEXT_ID=20 // LINT.IfChange(SharedCredential) message SharedCredential { // The randomly generated unique id of the public credential. - bytes secret_id = 1; + bytes secret_id = 1 [deprecated = true]; // 32 bytes of secure random bytes used to derive any symmetric keys needed. bytes key_seed = 2; @@ -81,7 +80,7 @@ message SharedCredential { // The version number of this SharedCredential, matches the corresponding // protocol version. - bytes version = 10; + bytes version = 10 [deprecated = true]; // The type assigned to the credential. The CredentialType is used to // determine whether a device identity credential or account based identity @@ -92,8 +91,9 @@ message SharedCredential { // metadata_encryption_key. bytes encrypted_metadata_bytes_v1 = 12; - // The tag for verifying metadata_encryption_key for an unsigned V1 adv. - bytes metadata_encryption_key_unsigned_adv_tag_v1 = 13; + // The HMAC of the plaintext identity token included (in encrypted form) in an + // unsigned, short salt, V1 advertisement. + bytes identity_token_short_salt_adv_hmac_key_v1 = 13; // The randomly generated positive unique id of the shared credential. int64 id = 14; @@ -101,5 +101,20 @@ message SharedCredential { // The DUSI number related to the uploader of this shared credential. Debug // purpose only. string dusi = 15; + + // Signature algorithm version. Used to determine which algorithm to use to + // verify incoming signatures. + string signature_version = 16 [deprecated = true]; + + // The HMAC of the plaintext identity token included (in encrypted form) in an + // unsigned, extended salt, V1 advertisement. + bytes identity_token_extended_salt_adv_hmac_key_v1 = 17; + + // The HMAC of the plaintext identity token included (in encrypted form) in a + // signed V1 advertisement. + bytes identity_token_signed_adv_hmac_key_v1 = 18; + + // Credential version used to infer the expected credential material. + int64 credential_version = 19; } // LINT.ThenChange(//depot/google3/google/internal/location/nearby/presence/v1/nearby_resources.proto:SharedCredential) diff --git a/internal/proto/local_credential.proto b/internal/proto/local_credential.proto index 7fbcada0..af711324 100644 --- a/internal/proto/local_credential.proto +++ b/internal/proto/local_credential.proto @@ -18,7 +18,6 @@ package nearby.internal; import "internal/proto/credential.proto"; -// option cc_api_version = 2; // option java_api_version = 2; option java_multiple_files = true; option java_package = "com.google.nearby.presence"; @@ -28,20 +27,24 @@ option optimize_for = LITE_RUNTIME; // The local credential contains information of a local device for // identity encryption and authentication. It should never leave the generating // device. -// NEXT_ID=11 +// NEXT_ID=14 message LocalCredential { - // Private encryption key descriptor. - // Usually, either `certificate_alias` or `key` is set. + // Private signing key descriptor. + // For Ed25519PrivateKey, both `certificate_alias` and `encrypted_key` is set. message PrivateKey { - // The associated alias of a X509Certificate. + // The associated alias of a X509Certificate or a SecretKey. string certificate_alias = 1; - // The private key + + // The raw private key bytes bytes key = 2; + + // The encrypted Ed25519 private key bytes. + bytes encrypted_key = 3; } // The unique id of (and hashed based on) a pair of Secret Key and // X509Certificate's public key. - bytes secret_id = 1; + bytes secret_id = 1 [deprecated = true]; // Bytes representation of an AES Key owned by local device, to encrypt // local device metadata. @@ -70,10 +73,19 @@ message LocalCredential { // The set of 2-byte salts already used to encrypt the metadata key. map consumed_salts = 9; - // The 16 bytes aes key to encrypt metadata in PublicCredential. - bytes metadata_encryption_key_v1 = 10; + // 16 bytes of crypto-grade random data that the credential's identity + // provider can use to encrypt metadata in a DiscoveryCredential + // (SharedCredential). + bytes identity_token_v1 = 10; // The positive unique id of (and hashed based on) a pair of Secret Key and // X509Certificate's public key. int64 id = 11; + + // Signature algorithm version. Used to determine which algorithm to use to + // sign data. + string signature_version = 12 [deprecated = true]; + + // Credential version used to infer the expected credential material. + int64 credential_version = 13; } diff --git a/internal/proto/messaging.proto b/internal/proto/messaging.proto index 5be1effc..8aa949f9 100644 --- a/internal/proto/messaging.proto +++ b/internal/proto/messaging.proto @@ -1,3 +1,17 @@ +// Copyright 2023 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. + syntax = "proto3"; package google.internal.communications.instantmessaging.v1; diff --git a/internal/proto/metadata.proto b/internal/proto/metadata.proto index b341e200..945ca807 100644 --- a/internal/proto/metadata.proto +++ b/internal/proto/metadata.proto @@ -24,7 +24,7 @@ option optimize_for = LITE_RUNTIME; // The metadata of a device. Contains confidential data not to be broadcasted // directly in OTA. -// NEXT_ID=5 +// NEXT_ID=8 message DeviceIdentityMetaData { // The type of the device. DeviceType device_type = 1; @@ -38,11 +38,24 @@ message DeviceIdentityMetaData { // The instance type (user profile) related to the metadata. InstanceType instance_type = 4; + + // The device_id from the MultideviceParameters file of the broadcasting + // device + bytes device_id = 5; + + // The device's model name + string device_model_name = 6; + + // The device's manufacturer name + string device_manufacturer = 7; } // The metadata of a device. // Contains confidential data not to be broadcasted directly in OTA. +// Metadata is deprecated, use DeviceIdentityMetadata instead. message Metadata { + option deprecated = true; + // The type of the device. DeviceType device_type = 1; diff --git a/internal/test/BUILD b/internal/test/BUILD index e3227fe4..0172593e 100644 --- a/internal/test/BUILD +++ b/internal/test/BUILD @@ -14,36 +14,52 @@ licenses(["notice"]) +cc_library( + name = "mocks", + testonly = 1, + hdrs = [ + "mock_account_manager.h", + "mock_account_observer.h", + ], + visibility = ["//visibility:public"], + deps = [ + "//internal/platform/implementation:account_manager", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/status", + "@com_google_absl//absl/strings:string_view", + "@com_google_googletest//:gtest_for_library_testonly", + ], +) + cc_library( name = "test", srcs = [ + "fake_account_manager.cc", "fake_clock.cc", "fake_single_thread_executor.cc", "fake_task_runner.cc", "fake_timer.cc", - "fake_webrtc.cc", ], hdrs = [ + "fake_account_manager.h", "fake_clock.h", - "fake_data_set.h", "fake_device_info.h", "fake_http_client.h", "fake_http_client_factory.h", "fake_single_thread_executor.h", "fake_task_runner.h", "fake_timer.h", - "fake_webrtc.h", ], copts = [ "-Ithird_party", ], visibility = ["//visibility:public"], deps = [ - "//internal/base:bluetooth_address", - "//internal/data:data_manager", + "//internal/base", "//internal/network:types", "//internal/platform:comm", "//internal/platform:types", + "//internal/platform/implementation:account_manager", "//internal/platform/implementation:types", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", @@ -63,7 +79,6 @@ cc_test( timeout = "short", srcs = [ "fake_clock_test.cc", - "fake_data_set_test.cc", "fake_device_info_test.cc", "fake_http_client_test.cc", "fake_task_runner_test.cc", @@ -75,8 +90,8 @@ cc_test( shard_count = 8, deps = [ ":test", - "//internal/data:data_manager", "//internal/network:types", + "//internal/network:url", "//internal/platform:types", "//internal/platform/implementation:types", "//internal/platform/implementation/g3", # fixdeps: keep diff --git a/internal/test/fake_account_manager.cc b/internal/test/fake_account_manager.cc new file mode 100644 index 00000000..918fdb0d --- /dev/null +++ b/internal/test/fake_account_manager.cc @@ -0,0 +1,139 @@ +// Copyright 2022 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. + +#include "internal/test/fake_account_manager.h" + +#include +#include +#include + +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/account_manager.h" + +namespace nearby { + +std::optional FakeAccountManager::GetCurrentAccount() { + if (user_name_.has_value()) { + return account_; + } + return std::nullopt; +} + +void FakeAccountManager::Login( + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback) { + if (account_.has_value()) { + UpdateCurrentUser(account_->id); + NotifyLogin(account_->id); + // Invoke callback after all operations have been performed since test cases + // may rely on the callback for synchronization. + login_success_callback(*account_); + return; + } + + login_failure_callback(absl::InternalError("No account.")); +} + +void FakeAccountManager::Login( + absl::string_view client_id, absl::string_view client_secret, + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback) { + if (account_.has_value()) { + UpdateCurrentUser(account_->id); + NotifyLogin(account_->id); + // Invoke callback after all operations have been performed since test cases + // may rely on the callback for synchronization. + login_success_callback(*account_); + return; + } + + login_failure_callback(absl::InternalError("No account.")); +} + +void FakeAccountManager::Logout( + absl::AnyInvocable logout_callback) { + if (is_logout_success_) { + std::string account_id = account_->id; + SetAccount(std::nullopt); + NotifyLogout(account_id, /*credential_error=*/false); + // Invoke callback after all operations have been performed since test cases + // may rely on the callback for synchronization. + logout_callback(absl::OkStatus()); + return; + } + + logout_callback(absl::NotFoundError("No account login.")); +} + +bool FakeAccountManager::GetAccessToken( + absl::string_view account_id, + absl::AnyInvocable success_callback, + absl::AnyInvocable failure_callback) { + if (!account_.has_value()) { + failure_callback(absl::UnavailableError("No current user.")); + return false; + } + success_callback(account_id); + return true; +} + +std::pair +FakeAccountManager::GetOAuthClientCredential() { + return {"", ""}; +} + +void FakeAccountManager::SetAccount(std::optional account) { + account_ = account; + if (account_.has_value()) { + UpdateCurrentUser(account_->id); + } else { + ClearCurrentUser(); + } +} + +void FakeAccountManager::UpdateCurrentUser(absl::string_view current_user) { + user_name_ = current_user; +} + +void FakeAccountManager::ClearCurrentUser() { + user_name_.reset(); +} + +void FakeAccountManager::AddObserver(Observer* observer) { + observers_.AddObserver(observer); +} + +void FakeAccountManager::RemoveObserver(Observer* observer) { + if (!observers_.HasObserver(observer)) { + return; + } + observers_.RemoveObserver(observer); +} + +void FakeAccountManager::NotifyLogin(absl::string_view account_id) { + for (const auto& observer : observers_.GetObservers()) { + observer->OnLoginSucceeded(account_id); + } +} + +void FakeAccountManager::NotifyLogout(absl::string_view account_id, + bool credential_error) { + for (const auto& observer : observers_.GetObservers()) { + observer->OnLogoutSucceeded(account_id, credential_error); + } +} + +} // namespace nearby diff --git a/internal/test/fake_account_manager.h b/internal/test/fake_account_manager.h new file mode 100644 index 00000000..e61165ee --- /dev/null +++ b/internal/test/fake_account_manager.h @@ -0,0 +1,87 @@ +// Copyright 2022 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_INTERNAL_TEST_FAKE_ACCOUNT_MANAGER_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_TEST_FAKE_ACCOUNT_MANAGER_H_ + +#include +#include +#include + +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" +#include "absl/strings/string_view.h" +#include "internal/base/observer_list.h" +#include "internal/platform/implementation/account_manager.h" + +namespace nearby { + +// A fake implementation of FakeAccountManager, along with a fake +// factory, to be used in tests. +class FakeAccountManager : public AccountManager { + public: + FakeAccountManager() = default; + ~FakeAccountManager() override = default; + + std::optional GetCurrentAccount() override; + + void Login( + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback) override; + + void Login( + absl::string_view client_id, absl::string_view client_secret, + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback) override; + + void Logout(absl::AnyInvocable logout_callback) override; + + bool GetAccessToken( + absl::string_view account_id, + absl::AnyInvocable success_callback, + absl::AnyInvocable failure_callback) override; + std::pair GetOAuthClientCredential() override; + void AddObserver(Observer* observer) override; + void RemoveObserver(Observer* observer) override; + + // Methods to set API response. + void SetAccount(std::optional account); + + void SetLogoutSuccess(bool is_logout_success) { + is_logout_success_ = is_logout_success; + } + + void NotifyCredentialError() { + NotifyLogout(account_->id, /*credential_error=*/true); + } + + private: + // Updates current username to preference. + void UpdateCurrentUser(absl::string_view current_user); + void ClearCurrentUser(); + void NotifyLogin(absl::string_view account_id); + void NotifyLogout(absl::string_view account_id, bool credential_error); + + // Login will fail when account_ is empty. + std::optional account_; + + // Logout will fail when is_logout_success_ is false; + bool is_logout_success_ = true; + nearby::ObserverList observers_; + std::optional user_name_; +}; + +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_INTERNAL_TEST_FAKE_ACCOUNT_MANAGER_H_ diff --git a/internal/test/fake_data_set.h b/internal/test/fake_data_set.h deleted file mode 100644 index 7393abda..00000000 --- a/internal/test/fake_data_set.h +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2022 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_INTERNAL_TEST_FAKE_DATA_SET_H_ -#define THIRD_PARTY_NEARBY_INTERNAL_TEST_FAKE_DATA_SET_H_ - -#include -#include -#include -#include -#include - -#include "absl/container/flat_hash_map.h" -#include "internal/data/data_set.h" - -namespace nearby { -namespace data { - -template -class FakeDataSet : public DataSet { - public: - using KeyEntryVector = std::vector>; - - explicit FakeDataSet(const absl::flat_hash_map& entries_map) - : entries_map_(entries_map) {} - - void Initialize(std::function callback) override { - init_callback_ = std::move(callback); - } - - void LoadEntries(std::function>)> - callback) override { - load_callback_ = std::move(callback); - } - - void UpdateEntries(std::unique_ptr entries_to_save, - std::unique_ptr> keys_to_remove, - std::function callback) override { - entries_to_save_ = std::move(entries_to_save); - keys_to_remove_ = std::move(keys_to_remove); - update_callback_ = std::move(callback); - } - - void Destroy(std::function callback) override { - destroy_callback_ = std::move(callback); - } - - // Mocked methods - void InitStatusCallback(InitStatus status) { - if (init_callback_ != nullptr) { - init_callback_(status); - } - } - - void LoadCallback(bool success) { - if (load_callback_ != nullptr) { - auto entries = std::make_unique>(); - for (auto it = entries_map_.begin(); it != entries_map_.end(); ++it) { - entries->push_back(it->second); - } - load_callback_(success, std::move(entries)); - } - } - - void UpdateCallback(bool success) { - if (success) { - if (entries_to_save_ != nullptr) { - for (auto it = entries_to_save_->begin(); it != entries_to_save_->end(); - ++it) { - auto entry = entries_map_.find(it->first); - if (entry == entries_map_.end()) { - entries_map_.emplace(it->first, it->second); - } else { - entry->second = it->second; - } - } - } - - if (keys_to_remove_ != nullptr) { - for (auto it = keys_to_remove_->begin(); it != keys_to_remove_->end(); - ++it) { - entries_map_.erase(*it); - } - } - } - - entries_to_save_ = nullptr; - keys_to_remove_ = nullptr; - if (update_callback_ != nullptr) { - update_callback_(success); - } - } - - void DestroyCallback(bool success) { - if (success) { - entries_map_.clear(); - } - - if (destroy_callback_ != nullptr) { - destroy_callback_(success); - } - } - - absl::flat_hash_map& entries_map() { return entries_map_; } - - private: - absl::flat_hash_map entries_map_ = nullptr; - std::function init_callback_ = nullptr; - std::function>)> load_callback_ = - nullptr; - std::unique_ptr entries_to_save_ = nullptr; - std::unique_ptr> keys_to_remove_ = nullptr; - std::function update_callback_ = nullptr; - std::function destroy_callback_ = nullptr; -}; - -} // namespace data -} // namespace nearby - -#endif // THIRD_PARTY_NEARBY_INTERNAL_TEST_FAKE_DATA_SET_H_ diff --git a/internal/test/fake_data_set_test.cc b/internal/test/fake_data_set_test.cc deleted file mode 100644 index fb7da29d..00000000 --- a/internal/test/fake_data_set_test.cc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2022 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. - -#include "internal/test/fake_data_set.h" - -#include -#include -#include -#include -#include - -#include "gmock/gmock.h" -#include "protobuf-matchers/protocol-buffer-matchers.h" -#include "gtest/gtest.h" -#include "internal/data/data_set.h" - -namespace nearby { -namespace data { -namespace { - -TEST(FakeDataSet, TestInitialize) { - InitStatus result = InitStatus::kNotInitialized; - FakeDataSet string_set({}); - - string_set.Initialize([&result](InitStatus res) { result = res; }); - string_set.InitStatusCallback(InitStatus::kOK); - EXPECT_EQ(result, InitStatus::kOK); -} - -TEST(FakeDataSet, TestUpdateEntries) { - bool result = false; - FakeDataSet string_set({}); - - auto temp = FakeDataSet::KeyEntryVector( - {{"id1", "string1"}, {"id2", "string2"}}); - - auto data = std::make_unique::KeyEntryVector>(temp); - - string_set.UpdateEntries(std::move(data), nullptr, - [&result](bool res) { result = res; }); - - string_set.UpdateCallback(true); - EXPECT_TRUE(result); - data = std::make_unique::KeyEntryVector>(temp); - string_set.UpdateEntries(std::move(data), nullptr, - [&result](bool res) { result = res; }); - string_set.UpdateCallback(false); - EXPECT_FALSE(result); -} - -TEST(FakeDataSet, TestLoadEntries) { - std::vector result = {}; - FakeDataSet string_set({}); - - auto temp = FakeDataSet::KeyEntryVector( - {{"id1", "string1"}, {"id2", "string2"}}); - auto data = std::make_unique::KeyEntryVector>(temp); - - string_set.UpdateEntries(std::move(data), nullptr, [](bool ans) {}); - string_set.UpdateCallback(true); - string_set.LoadEntries( - [&result](bool ans, std::unique_ptr> res) { - auto it = res->begin(); - while (it != res->end()) { - result.push_back(*it); - ++it; - } - }); - string_set.LoadCallback(true); - EXPECT_THAT(result, testing::SizeIs(2)); - std::sort(result.begin(), result.end()); - EXPECT_EQ(result, std::vector({"string1", "string2"})); -} - -TEST(MockDataSet, TestDestroy) { - bool result; - std::vector data = {}; - FakeDataSet string_set({{"id1", "string1"}, {"id2", "string2"}}); - string_set.Destroy([&result](bool res) { result = res; }); - string_set.DestroyCallback(true); - EXPECT_TRUE(result); - string_set.LoadEntries( - [&data](bool ans, std::unique_ptr> res) { - auto it = res->begin(); - while (it != res->end()) { - data.push_back(*it); - ++it; - } - }); - string_set.LoadCallback(true); - EXPECT_THAT(data, ::testing::SizeIs(0)); -} - -} // namespace -} // namespace data -} // namespace nearby diff --git a/internal/test/fake_device_info.h b/internal/test/fake_device_info.h index b7fbf160..b6975d93 100644 --- a/internal/test/fake_device_info.h +++ b/internal/test/fake_device_info.h @@ -15,7 +15,8 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_TEST_FAKE_DEVICE_INFO_H_ #define THIRD_PARTY_NEARBY_INTERNAL_TEST_FAKE_DEVICE_INFO_H_ -#include +#include +#include // NOLINT #include #include #include @@ -24,7 +25,6 @@ #include "absl/container/flat_hash_map.h" #include "absl/strings/string_view.h" -#include "internal/base/bluetooth_address.h" #include "internal/platform/device_info.h" #include "internal/platform/implementation/device_info.h" @@ -32,7 +32,7 @@ namespace nearby { class FakeDeviceInfo : public DeviceInfo { public: - std::u16string GetOsDeviceName() const override { return device_name_; } + std::string GetOsDeviceName() const override { return device_name_; } api::DeviceInfo::DeviceType GetDeviceType() const override { return device_type_; @@ -40,18 +40,9 @@ class FakeDeviceInfo : public DeviceInfo { api::DeviceInfo::OsType GetOsType() const override { return os_type_; } - std::optional GetFullName() const override { - return full_name_; - } - std::optional GetGivenName() const override { + std::optional GetGivenName() const override { return given_name_; } - std::optional GetLastName() const override { - return last_name_; - } - std::optional GetProfileUserName() const override { - return profile_user_name_; - } std::filesystem::path GetDownloadPath() const override { return download_path_; @@ -63,6 +54,8 @@ class FakeDeviceInfo : public DeviceInfo { std::filesystem::path GetTemporaryPath() const override { return temp_path_; } + std::filesystem::path GetLogPath() const override { return temp_path_; } + std::optional GetAvailableDiskSpaceInBytes( const std::filesystem::path& path) const override { std::wstring path_key = path.wstring(); @@ -93,7 +86,7 @@ class FakeDeviceInfo : public DeviceInfo { int GetScreenLockedListenerCount() { return screen_locked_listeners_.size(); } // Mock methods. - void SetOsDeviceName(std::u16string_view device_name) { + void SetOsDeviceName(std::string_view device_name) { device_name_ = device_name; } @@ -103,15 +96,7 @@ class FakeDeviceInfo : public DeviceInfo { void SetOsType(api::DeviceInfo::OsType os_type) { os_type_ = os_type; } - void SetFullName(std::optional full_name) { - if (full_name.has_value() && !full_name->empty()) { - full_name_ = full_name; - } else { - full_name_ = std::nullopt; - } - } - - void SetGivenName(std::optional given_name) { + void SetGivenName(std::optional given_name) { if (given_name.has_value() && !given_name->empty()) { given_name_ = given_name; } else { @@ -119,22 +104,6 @@ class FakeDeviceInfo : public DeviceInfo { } } - void SetLastName(std::optional last_name) { - if (last_name.has_value() && !last_name->empty()) { - last_name_ = last_name; - } else { - last_name_ = std::nullopt; - } - } - - void SetProfileUserName(std::optional profile_user_name) { - if (profile_user_name.has_value() && !profile_user_name->empty()) { - profile_user_name_ = profile_user_name; - } else { - profile_user_name_ = std::nullopt; - } - } - void SetDownloadPath(std::filesystem::path path) { download_path_ = path; } void SetAppDataPath(std::filesystem::path path) { app_data_path_ = path; } @@ -160,14 +129,11 @@ class FakeDeviceInfo : public DeviceInfo { } private: - std::u16string device_name_ = u"nearby"; + std::string device_name_ = "nearby"; api::DeviceInfo::DeviceType device_type_ = api::DeviceInfo::DeviceType::kLaptop; api::DeviceInfo::OsType os_type_ = api::DeviceInfo::OsType::kWindows; - std::optional full_name_ = u"Nearby"; - std::optional given_name_ = u"Nearby"; - std::optional last_name_ = u"Nearby"; - std::optional profile_user_name_ = "nearby"; + std::optional given_name_ = "Nearby"; std::filesystem::path download_path_ = std::filesystem::temp_directory_path(); std::filesystem::path app_data_path_ = std::filesystem::temp_directory_path(); std::filesystem::path temp_path_ = std::filesystem::temp_directory_path(); diff --git a/internal/test/fake_device_info_test.cc b/internal/test/fake_device_info_test.cc index 16935c43..05449289 100644 --- a/internal/test/fake_device_info_test.cc +++ b/internal/test/fake_device_info_test.cc @@ -27,8 +27,8 @@ namespace { TEST(FakeDeviceInfo, DeviceName) { FakeDeviceInfo device_info; - device_info.SetOsDeviceName(u"windows"); - EXPECT_EQ(device_info.GetOsDeviceName(), u"windows"); + device_info.SetOsDeviceName("windows"); + EXPECT_EQ(device_info.GetOsDeviceName(), "windows"); } TEST(FakeDeviceInfo, DeviceType) { @@ -43,38 +43,14 @@ TEST(FakeDeviceInfo, OsType) { EXPECT_EQ(device_info.GetOsType(), api::DeviceInfo::OsType::kWindows); } -TEST(FakeDeviceInfo, FullName) { - FakeDeviceInfo device_info; - device_info.SetFullName(u"windows"); - EXPECT_EQ(device_info.GetFullName(), u"windows"); - device_info.SetFullName(std::nullopt); - EXPECT_FALSE(device_info.GetFullName().has_value()); -} - TEST(FakeDeviceInfo, GivenName) { FakeDeviceInfo device_info; - device_info.SetGivenName(u"windows"); - EXPECT_EQ(device_info.GetGivenName(), u"windows"); + device_info.SetGivenName("windows"); + EXPECT_EQ(device_info.GetGivenName(), "windows"); device_info.SetGivenName(std::nullopt); EXPECT_FALSE(device_info.GetGivenName().has_value()); } -TEST(FakeDeviceInfo, LastName) { - FakeDeviceInfo device_info; - device_info.SetLastName(u"windows"); - EXPECT_EQ(device_info.GetLastName(), u"windows"); - device_info.SetLastName(std::nullopt); - EXPECT_FALSE(device_info.GetLastName().has_value()); -} - -TEST(FakeDeviceInfo, ProfileUserName) { - FakeDeviceInfo device_info; - device_info.SetProfileUserName("windows"); - EXPECT_EQ(device_info.GetProfileUserName(), "windows"); - device_info.SetProfileUserName(std::nullopt); - EXPECT_FALSE(device_info.GetProfileUserName().has_value()); -} - TEST(FakeDeviceInfo, GetDownloadPath) { FakeDeviceInfo device_info; EXPECT_EQ(device_info.GetDownloadPath(), diff --git a/internal/test/fake_http_client.h b/internal/test/fake_http_client.h index 14e04a80..000143af 100644 --- a/internal/test/fake_http_client.h +++ b/internal/test/fake_http_client.h @@ -17,13 +17,13 @@ #include -#include #include #include #include #include #include +#include "absl/functional/any_invocable.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" @@ -39,7 +39,7 @@ class FakeHttpClient : public HttpClient { public: struct RequestInfo { HttpRequest request; - std::function&)> callback; + absl::AnyInvocable&)> callback; }; FakeHttpClient() = default; @@ -51,22 +51,23 @@ class FakeHttpClient : public HttpClient { FakeHttpClient(FakeHttpClient&&) = default; FakeHttpClient& operator=(FakeHttpClient&&) = default; - void StartRequest(const HttpRequest& request, - std::function&)> - callback) override { + void StartRequest( + const HttpRequest& request, + absl::AnyInvocable&)> callback) + override { RequestInfo request_info; request_info.request = request; - request_info.callback = callback; + request_info.callback = std::move(callback); request_infos_.push_back(std::move(request_info)); } void StartCancellableRequest( std::unique_ptr request, - std::function&)> callback) + absl::AnyInvocable&)> callback) override { RequestInfo request_info; request_info.request = request->http_request(); - request_info.callback = callback; + request_info.callback = std::move(callback); request_infos_.push_back(std::move(request_info)); } @@ -90,8 +91,8 @@ class FakeHttpClient : public HttpClient { if (pos >= request_infos_.size()) { return; } - auto request_info = request_infos_.at(pos); - if (request_info.callback != nullptr) { + auto& request_info = request_infos_.at(pos); + if (request_info.callback) { request_info.callback(response); } diff --git a/internal/test/fake_task_runner.cc b/internal/test/fake_task_runner.cc index 956832ac..e88c7394 100644 --- a/internal/test/fake_task_runner.cc +++ b/internal/test/fake_task_runner.cc @@ -14,28 +14,36 @@ #include "internal/test/fake_task_runner.h" +#include #include #include #include +#include "absl/functional/any_invocable.h" #include "absl/synchronization/mutex.h" #include "absl/synchronization/notification.h" +#include "absl/time/clock.h" #include "absl/time/time.h" -#include "internal/platform/count_down_latch.h" +#include "internal/platform/timer.h" #include "internal/test/fake_timer.h" namespace nearby { -std::atomic_uint FakeTaskRunner::total_running_thread_count_ = 0; +std::atomic_uint FakeTaskRunner::pending_tasks_count_ = 0; -FakeTaskRunner::~FakeTaskRunner() { absl::MutexLock lock(&mutex_); } +FakeTaskRunner::~FakeTaskRunner() { Shutdown(); } + +void FakeTaskRunner::Shutdown() { + absl::MutexLock lock(&mutex_); + task_executor_->Shutdown(); +} bool FakeTaskRunner::PostTask(absl::AnyInvocable task) { absl::MutexLock lock(&mutex_); - ++total_running_thread_count_; + ++pending_tasks_count_; task_executor_->Execute([task = std::move(task)]() mutable { task(); - --total_running_thread_count_; + --pending_tasks_count_; }); return true; } @@ -59,23 +67,18 @@ void FakeTaskRunner::Sync() { } bool FakeTaskRunner::SyncWithTimeout(absl::Duration timeout) { - CountDownLatch latch(count_); - for (int i = 0; i < count_; ++i) { - PostTask([&] { latch.CountDown(); }); - } - - auto result = latch.Await(timeout); - return result.ok() && result.result(); + absl::Notification notification; + PostTask([&] { notification.Notify(); }); + return notification.WaitForNotificationWithTimeout(timeout); } bool FakeTaskRunner::WaitForRunningTasksWithTimeout(absl::Duration timeout) { int i = (timeout / absl::Milliseconds(1)) / 50; - while (total_running_thread_count_ != 0 && i > 0) { + while (pending_tasks_count_ != 0 && i > 0) { absl::SleepFor(absl::Milliseconds(50)); --i; } - - return total_running_thread_count_ == 0; + return pending_tasks_count_ == 0; } } // namespace nearby diff --git a/internal/test/fake_task_runner.h b/internal/test/fake_task_runner.h index 643e394e..3dee1703 100644 --- a/internal/test/fake_task_runner.h +++ b/internal/test/fake_task_runner.h @@ -21,6 +21,7 @@ #include #include "absl/base/thread_annotations.h" +#include "absl/synchronization/mutex.h" #include "absl/time/time.h" #include "internal/platform/multi_thread_executor.h" #include "internal/platform/task_runner.h" @@ -46,6 +47,8 @@ class FakeTaskRunner : public TaskRunner { absl::AnyInvocable task) override ABSL_LOCKS_EXCLUDED(mutex_); + void Shutdown() override ABSL_LOCKS_EXCLUDED(mutex_); + // Wait for all thread completed. void Sync(); @@ -55,6 +58,10 @@ class FakeTaskRunner : public TaskRunner { // In some test cases, we need to make sure all running tasks completion // before go to next task. This method can be used for the purpose. static bool WaitForRunningTasksWithTimeout(absl::Duration timeout); + // Use of WaitForRunningTasksWithTimeout requires calling + // ResetPendingTaskCount at test initialization to be able to track pending + // tasks correctly. + static void ResetPendingTasksCount() { pending_tasks_count_ = 0; } private: mutable absl::Mutex mutex_; @@ -66,7 +73,7 @@ class FakeTaskRunner : public TaskRunner { // Tracks delayed tasks. std::vector> timers_ ABSL_GUARDED_BY(mutex_); - static std::atomic_uint total_running_thread_count_; + static std::atomic_uint pending_tasks_count_; }; } // namespace nearby diff --git a/internal/test/fake_task_runner_test.cc b/internal/test/fake_task_runner_test.cc index a09b96ae..1704d3cc 100644 --- a/internal/test/fake_task_runner_test.cc +++ b/internal/test/fake_task_runner_test.cc @@ -26,6 +26,7 @@ namespace nearby { namespace { TEST(FakeTaskRunner, PostTask) { + FakeTaskRunner::ResetPendingTasksCount(); FakeClock clock; int count = 0; FakeTaskRunner task_runner{&clock, 1}; @@ -36,6 +37,7 @@ TEST(FakeTaskRunner, PostTask) { } TEST(FakeTaskRunner, PostDelayedTask) { + FakeTaskRunner::ResetPendingTasksCount(); FakeClock clock; int count = 0; FakeTaskRunner task_runner{&clock, 1}; @@ -67,6 +69,7 @@ TEST(FakeTaskRunner, PostTasksRunInSequence) { } TEST(FakeTaskRunner, PostDelayedTaskInDelayedTask) { + FakeTaskRunner::ResetPendingTasksCount(); FakeClock clock; int called_count = 0; FakeTaskRunner task_runner{&clock, 1}; diff --git a/internal/test/mock_account_manager.h b/internal/test/mock_account_manager.h new file mode 100644 index 00000000..6b087504 --- /dev/null +++ b/internal/test/mock_account_manager.h @@ -0,0 +1,58 @@ +// Copyright 2024 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_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_ + +#include +#include +#include + +#include "gmock/gmock.h" +#include "absl/functional/any_invocable.h" +#include "absl/status/status.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/account_manager.h" + +namespace nearby { + +class MockAccountManager : public AccountManager { + public: + MOCK_METHOD(std::optional, GetCurrentAccount, (), (override)); + MOCK_METHOD(void, Login, + (absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback), + (override)); + MOCK_METHOD(void, Login, + (absl::string_view client_id, absl::string_view client_secret, + absl::AnyInvocable login_success_callback, + absl::AnyInvocable login_failure_callback), + (override)); + MOCK_METHOD(void, Logout, + (absl::AnyInvocable logout_callback), + (override)); + MOCK_METHOD(bool, GetAccessToken, + (absl::string_view account_id, + absl::AnyInvocable success_callback, + absl::AnyInvocable failure_callback), + (override)); + MOCK_METHOD((std::pair), GetOAuthClientCredential, + (), (override)); + MOCK_METHOD(void, AddObserver, (Observer * observer), (override)); + MOCK_METHOD(void, RemoveObserver, (Observer * observer), (override)); +}; + +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_ diff --git a/internal/test/mock_account_observer.h b/internal/test/mock_account_observer.h new file mode 100644 index 00000000..bf4da0e6 --- /dev/null +++ b/internal/test/mock_account_observer.h @@ -0,0 +1,38 @@ +// Copyright 2024 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_INTERNAL_TEST_MOCK_ACCOUNT_OBSERVER_H_ +#define THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_OBSERVER_H_ + +#include "gmock/gmock.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/account_manager.h" + +namespace nearby { + +class MockAccountObserver : public AccountManager::Observer { + public: + ~MockAccountObserver() override = default; + + MOCK_METHOD(void, OnLoginSucceeded, (absl::string_view account_id), + (override)); + + MOCK_METHOD(void, OnLogoutSucceeded, + (absl::string_view account_id, bool credential_error), + (override)); +}; + +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_OBSERVER_H_ diff --git a/internal/weave/BUILD b/internal/weave/BUILD index 4fe40458..62bda5fa 100644 --- a/internal/weave/BUILD +++ b/internal/weave/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + cc_library( name = "weave", srcs = [ diff --git a/internal/weave/base_socket.cc b/internal/weave/base_socket.cc index 52dd630e..ffde5592 100644 --- a/internal/weave/base_socket.cc +++ b/internal/weave/base_socket.cc @@ -139,7 +139,7 @@ void BaseSocket::WritePacket(absl::StatusOr packet) { NEARBY_LOGS(WARNING) << "Packet status:" << packet.status(); return; } - CHECK(packet->SetPacketCounter(packet_counter_generator_.Next()).ok()); + CHECK_OK(packet->SetPacketCounter(packet_counter_generator_.Next())); NEARBY_LOGS(INFO) << "transmitting packet"; connection_.Transmit(packet->GetBytes()); } diff --git a/internal/weave/base_socket.h b/internal/weave/base_socket.h index 693cbb6f..6b7329c4 100644 --- a/internal/weave/base_socket.h +++ b/internal/weave/base_socket.h @@ -20,7 +20,11 @@ #include #include "absl/base/thread_annotations.h" +#include "internal/platform/byte_array.h" +#include "internal/platform/future.h" +#include "internal/platform/logging.h" #include "internal/platform/mutex.h" +#include "internal/platform/runnable.h" #include "internal/platform/single_thread_executor.h" #include "internal/weave/connection.h" #include "internal/weave/control_packet_write_request.h" diff --git a/internal/weave/control_packet_write_request.h b/internal/weave/control_packet_write_request.h index 9006365f..59ba8861 100644 --- a/internal/weave/control_packet_write_request.h +++ b/internal/weave/control_packet_write_request.h @@ -18,6 +18,7 @@ #include #include "absl/status/status.h" +#include "absl/status/statusor.h" #include "internal/weave/packet.h" namespace nearby { diff --git a/internal/weave/packet.cc b/internal/weave/packet.cc index 790c463b..60dd6639 100644 --- a/internal/weave/packet.cc +++ b/internal/weave/packet.cc @@ -22,6 +22,7 @@ #include #include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" diff --git a/internal/weave/packet.h b/internal/weave/packet.h index 069f1e9c..b7c34350 100644 --- a/internal/weave/packet.h +++ b/internal/weave/packet.h @@ -15,11 +15,13 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_WEAVE_PACKET_H_ #define THIRD_PARTY_NEARBY_INTERNAL_WEAVE_PACKET_H_ +#include #include #include #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" namespace nearby { diff --git a/internal/weave/sockets/BUILD b/internal/weave/sockets/BUILD index 15f0d2d7..e495d6aa 100644 --- a/internal/weave/sockets/BUILD +++ b/internal/weave/sockets/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 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. + cc_library( name = "sockets", srcs = [ @@ -9,14 +23,13 @@ cc_library( "initial_data_provider.h", "server_socket.h", ], - visibility = [ - "//connections:__subpackages__", - ], + visibility = ["//visibility:private"], deps = [ "//internal/platform:types", "//internal/weave", "@com_google_absl//absl/random", "@com_google_absl//absl/status", + "@com_google_absl//absl/strings", ], ) diff --git a/internal/weave/sockets/client_socket.cc b/internal/weave/sockets/client_socket.cc index cd4ef1e5..dadaa619 100644 --- a/internal/weave/sockets/client_socket.cc +++ b/internal/weave/sockets/client_socket.cc @@ -14,12 +14,17 @@ #include "internal/weave/sockets/client_socket.h" +#include #include #include #include #include "absl/status/status.h" +#include "absl/strings/str_cat.h" +#include "internal/platform/logging.h" #include "internal/weave/base_socket.h" +#include "internal/weave/connection.h" +#include "internal/weave/packet.h" #include "internal/weave/socket_callback.h" #include "internal/weave/sockets/initial_data_provider.h" diff --git a/internal/weave/sockets/client_socket.h b/internal/weave/sockets/client_socket.h index af21f0c3..f39b2d20 100644 --- a/internal/weave/sockets/client_socket.h +++ b/internal/weave/sockets/client_socket.h @@ -17,8 +17,10 @@ #include +#include "internal/platform/single_thread_executor.h" #include "internal/weave/base_socket.h" #include "internal/weave/connection.h" +#include "internal/weave/packet.h" #include "internal/weave/socket_callback.h" #include "internal/weave/sockets/initial_data_provider.h" diff --git a/internal/weave/sockets/initial_data_provider.h b/internal/weave/sockets/initial_data_provider.h index cef403a3..52d72c2c 100644 --- a/internal/weave/sockets/initial_data_provider.h +++ b/internal/weave/sockets/initial_data_provider.h @@ -15,9 +15,12 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_WEAVE_SOCKETS_INITIAL_DATA_PROVIDER_H_ #define THIRD_PARTY_NEARBY_INTERNAL_WEAVE_SOCKETS_INITIAL_DATA_PROVIDER_H_ +#include +#include #include #include "absl/random/random.h" +#include "absl/strings/str_cat.h" namespace nearby { namespace weave { diff --git a/internal/weave/sockets/server_socket.cc b/internal/weave/sockets/server_socket.cc index e361470e..e01426b7 100644 --- a/internal/weave/sockets/server_socket.cc +++ b/internal/weave/sockets/server_socket.cc @@ -20,8 +20,12 @@ #include #include "absl/status/status.h" +#include "absl/strings/string_view.h" #include "internal/platform/logging.h" #include "internal/weave/base_socket.h" +#include "internal/weave/connection.h" +#include "internal/weave/packet.h" +#include "internal/weave/socket_callback.h" namespace nearby { namespace weave { diff --git a/internal/weave/sockets/server_socket.h b/internal/weave/sockets/server_socket.h index a9f60fc6..a5cacc23 100644 --- a/internal/weave/sockets/server_socket.h +++ b/internal/weave/sockets/server_socket.h @@ -15,10 +15,9 @@ #ifndef THIRD_PARTY_NEARBY_INTERNAL_WEAVE_SOCKETS_SERVER_SOCKET_H_ #define THIRD_PARTY_NEARBY_INTERNAL_WEAVE_SOCKETS_SERVER_SOCKET_H_ -#include - #include "internal/weave/base_socket.h" #include "internal/weave/connection.h" +#include "internal/weave/packet.h" #include "internal/weave/socket_callback.h" namespace nearby { diff --git a/minimum_os.bzl b/minimum_os.bzl index d708b89f..c7ad06b6 100644 --- a/minimum_os.bzl +++ b/minimum_os.bzl @@ -1,3 +1,17 @@ +# Copyright 2023 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. + """Minimum OS version definitions and related test setup""" IOS_MINIMUM_OS = "13.7" diff --git a/presence/BUILD b/presence/BUILD index c4b38578..800711f1 100644 --- a/presence/BUILD +++ b/presence/BUILD @@ -19,6 +19,7 @@ cc_library( name = "presence", srcs = [ "presence_client_impl.cc", + "presence_device_provider.cc", "presence_service_impl.cc", ], hdrs = [ @@ -30,12 +31,22 @@ cc_library( ], deps = [ ":types", + "//internal/interop:authentication_status", + "//internal/interop:authentication_transport_interface", "//internal/interop:device", + "//internal/platform:base", "//internal/platform:types", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", + "//internal/proto:local_credential_cc_proto", "//internal/proto:metadata_cc_proto", "//presence/implementation:internal", # build_cleaner: keep + "//presence/implementation/mediums", + "//presence/proto:presence_frame_cc_proto", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", "@com_google_absl//absl/types:variant", ], ) @@ -55,8 +66,11 @@ cc_library( deps = [ ":presence", ":types", + "//internal/interop:device", + "//internal/interop:test_support", "//internal/platform:types", "//internal/proto:metadata_cc_proto", + "//presence/implementation:internal", # build_cleaner: keep "@com_google_absl//absl/status:statusor", ], ) @@ -175,12 +189,25 @@ cc_test( deps = [ ":presence", ":types", + "//internal/crypto", + "//internal/interop:authentication_status", + "//internal/interop:authentication_transport_interface", + "//internal/interop:device", "//internal/platform:test_util", "//internal/platform:types", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", + "//internal/proto:credential_cc_proto", + "//internal/proto:local_credential_cc_proto", "//internal/proto:metadata_cc_proto", + "//presence/implementation:internal", + "//presence/implementation:internal_test", + "//presence/proto:presence_frame_cc_proto", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", + "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", ] + select({ "@platforms//os:windows": [ diff --git a/presence/broadcast_request.h b/presence/broadcast_request.h index dc380203..598ffdf3 100644 --- a/presence/broadcast_request.h +++ b/presence/broadcast_request.h @@ -18,7 +18,6 @@ #include #include -#include "absl/types/optional.h" #include "absl/types/variant.h" #include "internal/proto/credential.pb.h" #include "presence/data_element.h" diff --git a/presence/credential_test.cc b/presence/credential_test.cc index 02a895c4..cfaa00d0 100644 --- a/presence/credential_test.cc +++ b/presence/credential_test.cc @@ -27,8 +27,7 @@ namespace presence { namespace { using ::nearby::internal::LocalCredential; using ::nearby::internal::SharedCredential; -using ::nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE; -using ::nearby::internal::IdentityType::IDENTITY_TYPE_PROVISIONED; +using ::nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; using ::protobuf_matchers::EqualsProto; @@ -41,9 +40,9 @@ TEST(CredentialsTest, InitSharedCredential) { SharedCredential pc1 = {}; SharedCredential pc2 = {}; EXPECT_THAT(pc1, EqualsProto(pc2)); - pc1.set_identity_type(IDENTITY_TYPE_PRIVATE); + pc1.set_identity_type(IDENTITY_TYPE_PRIVATE_GROUP); EXPECT_THAT(pc1, ::testing::Not(EqualsProto(pc2))); - pc2.set_identity_type(IDENTITY_TYPE_PRIVATE); + pc2.set_identity_type(IDENTITY_TYPE_PRIVATE_GROUP); EXPECT_THAT(pc1, EqualsProto(pc2)); } @@ -51,15 +50,15 @@ TEST(CredentialsTest, InitLocalCredential) { LocalCredential pc1 = {}; LocalCredential pc2 = {}; EXPECT_THAT(pc1, EqualsProto(pc2)); - pc1.set_identity_type(IDENTITY_TYPE_PRIVATE); + pc1.set_identity_type(IDENTITY_TYPE_PRIVATE_GROUP); EXPECT_THAT(pc1, ::testing::Not(EqualsProto(pc2))); - pc2.set_identity_type(IDENTITY_TYPE_PRIVATE); + pc2.set_identity_type(IDENTITY_TYPE_PRIVATE_GROUP); EXPECT_THAT(pc1, EqualsProto(pc2)); } TEST(CredentialsTest, CopyLocalCredential) { LocalCredential pc1 = {}; - pc1.set_identity_type(IDENTITY_TYPE_PROVISIONED); + pc1.set_identity_type(IDENTITY_TYPE_PRIVATE_GROUP); auto salts = pc1.mutable_consumed_salts(); salts->insert(std::pair(15, true)); LocalCredential pc1_copy = {pc1}; @@ -68,7 +67,7 @@ TEST(CredentialsTest, CopyLocalCredential) { TEST(CredentialsTest, CopySharedCredential) { SharedCredential pc1 = {}; - pc1.set_identity_type(IDENTITY_TYPE_PROVISIONED); + pc1.set_identity_type(IDENTITY_TYPE_PRIVATE_GROUP); for (const uint8_t byte : nearby::Uuid().data()) { pc1.mutable_secret_id()->push_back(byte); } diff --git a/presence/data_element.h b/presence/data_element.h index 034d90c7..eb2ffebb 100644 --- a/presence/data_element.h +++ b/presence/data_element.h @@ -17,6 +17,7 @@ #include +#include #include #include @@ -27,7 +28,9 @@ namespace presence { // Reserved Action types when the field type is kActionFieldType. // The values are bit numbers in BE ordering. +// TODO(b/338107166): these are out of date, need to be updated to latest spec enum class ActionBit { + kCallTransferAction = 4, kActiveUnlockAction = 8, kNearbyShareAction = 9, kInstantTetheringAction = 10, @@ -39,16 +42,24 @@ enum class ActionBit { kLastAction }; +// helpful for enumerating overall all possible action bit types, this must be +// kept in sync with the above enum +constexpr std::initializer_list kAllActionBits = { + ActionBit::kCallTransferAction, ActionBit::kActiveUnlockAction, + ActionBit::kNearbyShareAction, ActionBit::kInstantTetheringAction, + ActionBit::kPhoneHubAction, ActionBit::kPresenceManagerAction, + ActionBit::kFinderAction, ActionBit::kFastPairSassAction, + ActionBit::kTapToTransferAction}; + /** Describes a custom Data element in NP advertisement. */ class DataElement { public: // The field types listed below require special processing when generating and // parsing NP advertisements. static constexpr int kSaltFieldType = 0; - static constexpr int kPrivateIdentityFieldType = 1; - static constexpr int kTrustedIdentityFieldType = 2; + static constexpr int kPrivateGroupIdentityFieldType = 1; + static constexpr int kContactsGroupIdentityFieldType = 2; static constexpr int kPublicIdentityFieldType = 3; - static constexpr int kProvisionedIdentityFieldType = 4; static constexpr int kTxPowerFieldType = 5; static constexpr int kActionFieldType = 6; static constexpr int kModelIdFieldType = 7; diff --git a/presence/data_types.h b/presence/data_types.h index 21700bb9..48fdde74 100644 --- a/presence/data_types.h +++ b/presence/data_types.h @@ -15,8 +15,7 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_SCAN_CALLBACK_H_ #define THIRD_PARTY_NEARBY_PRESENCE_SCAN_CALLBACK_H_ -#include -#include +#include #include "absl/functional/any_invocable.h" #include "internal/platform/logging.h" @@ -59,15 +58,6 @@ struct BroadcastCallback { }; }; -// Chromium uses its own crypto library instead of nearby/internal/crypto, -// in which base::span is used instead of absl::Span. See b/276368162. -#ifdef NEARBY_CHROMIUM -template -using CryptoSpan = base::span; -#else -template -using CryptoSpan = absl::Span; -#endif } // namespace presence } // namespace nearby diff --git a/presence/discovery_filter_test.cc b/presence/discovery_filter_test.cc index 9b201a6f..c85f8f83 100644 --- a/presence/discovery_filter_test.cc +++ b/presence/discovery_filter_test.cc @@ -25,7 +25,7 @@ namespace { using ::nearby::internal::IdentityType; const PresenceAction kTestAction = {1}; -const IdentityType kTestIdentity = {IdentityType::IDENTITY_TYPE_TRUSTED}; +const IdentityType kTestIdentity = {IdentityType::IDENTITY_TYPE_CONTACTS_GROUP}; TEST(DiscoveryFilterTest, DefaultConstructorWorks) { DiscoveryFilter filter; diff --git a/presence/fake_presence_service.cc b/presence/fake_presence_service.cc index 5c83c996..ff06221a 100644 --- a/presence/fake_presence_service.cc +++ b/presence/fake_presence_service.cc @@ -18,6 +18,7 @@ #include #include +#include "internal/interop/device_provider.h" #include "internal/platform/borrowable.h" #include "presence/fake_presence_client.h" @@ -52,8 +53,9 @@ absl::StatusOr FakePresenceService::StartBroadcast( // Not implemented. void FakePresenceService::StopBroadcast(BroadcastSessionId session_id) {} -void FakePresenceService::UpdateLocalDeviceMetadata( - const ::nearby::internal::Metadata& metadata, bool regen_credentials, +void FakePresenceService::UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, @@ -74,9 +76,8 @@ void FakePresenceService::UpdateLocalDeviceMetadata( } } -// Not implemented. -PresenceDeviceProvider* FakePresenceService::GetLocalDeviceProvider() { - return nullptr; +NearbyDeviceProvider* FakePresenceService::GetLocalDeviceProvider() { + return provider_; } void FakePresenceService::GetLocalPublicCredentials( diff --git a/presence/fake_presence_service.h b/presence/fake_presence_service.h index b86d2bf6..81dca042 100644 --- a/presence/fake_presence_service.h +++ b/presence/fake_presence_service.h @@ -15,11 +15,13 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_FAKE_PRESENCE_SERVICE_H_ #define THIRD_PARTY_NEARBY_PRESENCE_FAKE_PRESENCE_SERVICE_H_ +#include "internal/interop/device_provider.h" +#include "internal/interop/fake_device_provider.h" #include "internal/platform/borrowable.h" #include "internal/proto/metadata.pb.h" +#include "presence/broadcast_request.h" #include "presence/data_types.h" #include "presence/presence_client.h" -#include "presence/presence_device_provider.h" #include "presence/presence_service.h" namespace nearby { @@ -45,16 +47,18 @@ class FakePresenceService : public PresenceService { void StopBroadcast(BroadcastSessionId session_id) override; - void UpdateLocalDeviceMetadata( - const ::nearby::internal::Metadata& metadata, bool regen_credentials, + void UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) override; - PresenceDeviceProvider* GetLocalDeviceProvider() override; + NearbyDeviceProvider* GetLocalDeviceProvider() override; - ::nearby::internal::Metadata GetLocalDeviceMetadata() override { + ::nearby::internal::DeviceIdentityMetaData GetDeviceIdentityMetaData() + override { return metadata_; } @@ -96,6 +100,10 @@ class FakePresenceService : public PresenceService { shared_credentials_ = shared_credentials; } + void SetDeviceProvider(NearbyDeviceProvider* provider) { + provider_ = provider; + } + private: FakePresenceClient* most_recent_fake_presence_client_ = nullptr; std::vector shared_credentials_; @@ -103,7 +111,8 @@ class FakePresenceService : public PresenceService { absl::Status gen_credentials_status_; absl::Status update_remote_public_credentials_status_; absl::Status get_public_credentials_status_; - ::nearby::internal::Metadata metadata_; + ::nearby::internal::DeviceIdentityMetaData metadata_; + NearbyDeviceProvider* provider_; ::nearby::Lender lender_{this}; }; diff --git a/presence/fpp/fpp_manager.cc b/presence/fpp/fpp_manager.cc index dfe2f4d4..74b78792 100644 --- a/presence/fpp/fpp_manager.cc +++ b/presence/fpp/fpp_manager.cc @@ -142,9 +142,9 @@ void FppManager::CheckPresenceZoneChanged(uint64_t device_id, ProximityEstimate old_estimate, ProximityEstimate new_estimate) { if (old_estimate.proximity_state != new_estimate.proximity_state) { - NEARBY_LOG(WARNING, - "Updating zone transition callbacks with new zone. Zone=%p", - new_estimate.proximity_state); + NEARBY_LOGS(WARNING) + << "Updating zone transition callbacks with new zone. Zone=" + << static_cast(new_estimate.proximity_state); for (auto& pair : zone_transition_callbacks_) { pair.second.on_proximity_zone_changed( device_id, diff --git a/presence/implementation/BUILD b/presence/implementation/BUILD index a7b9de53..40cd7238 100644 --- a/presence/implementation/BUILD +++ b/presence/implementation/BUILD @@ -11,63 +11,37 @@ # 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. -load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") -load("@bazel_skylib//lib:selects.bzl", "selects") licenses(["notice"]) -# Command line build option that enables linking with the LDT encryption implementation in Rust. -# -# When not set, LDT encryption will not be available. We won't be able to advertise encrypted BLE4.2 advertisements nor scan for them. -bool_flag( - name = "enable_rust_ldt", - build_setting_default = False, -) - -config_setting( - name = "no_link_with_rust", - flag_values = { - ":enable_rust_ldt": "false", - }, -) - -# Current google3 does not support Rust on Android or Windows. -selects.config_setting_group( - name = "norust_or_windows_or_android", - match_any = [ - ":no_link_with_rust", - "@platforms//os:windows", - "@platforms//os:android", - ], -) - -cc_library( - name = "ldt_stub", - srcs = ["np_ldt.c"], - hdrs = ["np_ldt.h"], -) - -cc_library( - name = "internal", +filegroup( + name = "presence_internal_common_srcs", srcs = [ "action_factory.cc", - "advertisement_decoder.cc", "advertisement_factory.cc", + "advertisement_filter.cc", "base_broadcast_request.cc", "broadcast_manager.cc", - "connection_authenticator.cc", + "connection_authenticator_impl.cc", "credential_manager_impl.cc", "ldt.cc", "scan_manager.cc", "service_controller_impl.cc", ], - hdrs = [ +) + +filegroup( + name = "presence_internal_common_hdrs", + srcs = [ "action_factory.h", "advertisement_decoder.h", + "advertisement_decoder_impl.h", "advertisement_factory.h", + "advertisement_filter.h", "base_broadcast_request.h", "broadcast_manager.h", "connection_authenticator.h", + "connection_authenticator_impl.h", "credential_manager.h", "credential_manager_impl.h", "ldt.h", @@ -75,10 +49,19 @@ cc_library( "service_controller.h", "service_controller_impl.h", ], - defines = select({ - ":norust_or_windows_or_android": [], - "//conditions:default": ["USE_RUST_LDT=1"], - }), +) + +cc_library( + name = "internal", + srcs = [ + "advertisement_decoder_rust_impl.cc", + ":presence_internal_common_srcs", + ], + hdrs = [ + "advertisement_decoder_rust_impl.h", + ":presence_internal_common_hdrs", + ], + defines = ["USE_RUST_DECODER=1"], visibility = [ "//presence:__subpackages__", ], @@ -96,10 +79,14 @@ cc_library( "//internal/proto:metadata_cc_proto", "//presence:types", "//presence/implementation/mediums", + "@beto-core//:ldt_np_adv_ffi", + "@beto-core//:np_c_ffi_types", + "@beto-core//:np_cpp_ffi", "@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/hash", + "@com_google_absl//absl/log:check", "@com_google_absl//absl/log:die_if_null", "@com_google_absl//absl/random", "@com_google_absl//absl/random:distributions", @@ -110,11 +97,58 @@ cc_library( "@com_google_absl//absl/synchronization", "@com_google_absl//absl/time", "@com_google_absl//absl/types:optional", + "@com_google_absl//absl/types:span", "@com_google_absl//absl/types:variant", - ] + select({ - ":norust_or_windows_or_android": [":ldt_stub"], - "//conditions:default": ["//third_party/beto_core/nearby/presence/ldt_np_adv_ffi"], - }), + ], +) + +cc_library( + name = "internal_deprecated", + srcs = [ + "advertisement_decoder_impl.cc", + ":presence_internal_common_srcs", + ], + hdrs = [ + "advertisement_decoder_impl.h", + ":presence_internal_common_hdrs", + ], + visibility = [ + "//presence:__subpackages__", + ], + deps = [ + "//devtools/rust:rust_okay_here", + "//internal/crypto", + "//internal/crypto_cros", + "//internal/platform:base", + "//internal/platform:comm", + "//internal/platform:types", + "//internal/platform:uuid", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", + "//internal/proto:credential_cc_proto", + "//internal/proto:local_credential_cc_proto", + "//internal/proto:metadata_cc_proto", + "//presence:types", + "//presence/implementation/mediums", + "@beto-core//:ldt_np_adv_ffi", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/hash", + "@com_google_absl//absl/log:check", + "@com_google_absl//absl/log:die_if_null", + "@com_google_absl//absl/random", + "@com_google_absl//absl/random:distributions", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:optional", + "@com_google_absl//absl/types:span", + "@com_google_absl//absl/types:variant", + ], ) cc_library( @@ -136,6 +170,8 @@ cc_library( srcs = [ ], hdrs = [ + "mock_connection_authenticator.h", + "mock_credential_manager.h", "mock_service_controller.h", ], visibility = [ @@ -143,8 +179,13 @@ cc_library( ], deps = [ ":internal", - "//presence", + "//internal/platform/implementation:comm", + "//internal/proto:credential_cc_proto", + "//internal/proto:local_credential_cc_proto", "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings:string_view", "@com_google_googletest//:gtest_main", ], ) @@ -153,6 +194,56 @@ cc_test( name = "advertisement_decoder_test", size = "small", srcs = ["advertisement_decoder_test.cc"], + deps = [ + ":internal_deprecated", + "//internal/platform:base", + "//internal/proto:credential_cc_proto", + "//presence:types", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest_main", + ] + select({ + "@platforms//os:windows": [ + "//internal/platform/implementation/windows", + ], + "//conditions:default": [ + "//internal/platform/implementation/g3", + ], + }), +) + +cc_test( + name = "advertisement_decoder_new_format_test", + size = "small", + srcs = ["advertisement_decoder_new_format_test.cc"], + deps = [ + ":internal", + "//internal/platform:base", + "//internal/proto:credential_cc_proto", + "//presence:types", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest_main", + ] + select({ + "@platforms//os:windows": [ + "//internal/platform/implementation/windows", + ], + "//conditions:default": [ + "//internal/platform/implementation/g3", + ], + }), +) + +cc_test( + name = "advertisement_filter_test", + size = "small", + srcs = ["advertisement_filter_test.cc"], deps = [ ":internal", "//internal/platform:base", @@ -225,8 +316,8 @@ cc_test( deps = [ ":internal", "//internal/platform:base", - "//internal/proto:credential_cc_proto", "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_googletest//:gtest_main", ] + select({ @@ -280,9 +371,9 @@ cc_test( ) cc_test( - name = "connection_authenticator_test", + name = "connection_authenticator_impl_test", size = "small", - srcs = ["connection_authenticator_test.cc"], + srcs = ["connection_authenticator_impl_test.cc"], deps = [ ":internal", "//internal/crypto", @@ -317,6 +408,7 @@ cc_test( "//net/proto2/contrib/parse_proto:testing", "@com_github_protobuf_matchers//protobuf-matchers", "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", @@ -336,11 +428,50 @@ cc_test( srcs = ["scan_manager_test.cc"], deps = [ ":internal", + ":internal_test", + "//internal/platform:base", "//internal/platform:comm", "//internal/platform:test_util", "//internal/platform:types", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", + "//internal/proto:credential_cc_proto", + "//presence:types", "//presence/implementation/mediums", "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:variant", + "@com_google_googletest//:gtest_main", + ] + select({ + "@platforms//os:windows": [ + "//internal/platform/implementation/windows", + ], + "//conditions:default": [ + "//internal/platform/implementation/g3", + ], + }), +) + +cc_test( + name = "service_controller_impl_test", + size = "small", + srcs = ["service_controller_impl_test.cc"], + deps = [ + ":internal", + ":internal_test", + "//internal/platform:comm", + "//internal/platform:test_util", + "//internal/platform:types", + "//internal/platform/implementation:comm", + "//internal/platform/implementation:types", + "//internal/proto:credential_cc_proto", + "//net/proto2/contrib/parse_proto:testing", + "//presence/implementation/mediums", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/status", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", "@com_google_absl//absl/time", "@com_google_googletest//:gtest_main", ] + select({ diff --git a/presence/implementation/action_factory.cc b/presence/implementation/action_factory.cc index 050a29c5..e345b054 100644 --- a/presence/implementation/action_factory.cc +++ b/presence/implementation/action_factory.cc @@ -15,10 +15,12 @@ #include "presence/implementation/action_factory.h" #include +#include #include -#include "absl/types/optional.h" #include "internal/platform/logging.h" +#include "presence/data_element.h" +#include "presence/implementation/base_broadcast_request.h" namespace nearby { namespace presence { @@ -33,7 +35,7 @@ namespace { int GetActionMask(ActionBit action) { int bit = static_cast(action); if (bit < 0 || bit >= kActionSizeInBits) { - NEARBY_LOG(WARNING, "Unsupported action %d", static_cast(action)); + NEARBY_LOGS(WARNING) << "Unsupported action " << static_cast(action); return kEmptyMask; } return 1 << (kActionSizeInBits - 1 - bit); @@ -52,20 +54,20 @@ int GetMask(const DataElement& element) { if (!value.empty()) { return (value[0] & kContentTimestampMask) << kContentTimestampShift; } else { - NEARBY_LOG(WARNING, "Context timestamp Data Element without value"); + NEARBY_LOGS(WARNING) << "Context timestamp Data Element without value"; return kEmptyMask; } } case DataElement::kActionFieldType: { if (element.GetValue().empty()) { - NEARBY_LOG(WARNING, "Action Data Element without value"); + NEARBY_LOGS(WARNING) << "Action Data Element without value"; return kEmptyMask; } return GetActionMask(ActionBit(element.GetValue()[0])); } } - NEARBY_LOG(WARNING, "Data Element 0x%x not supported in base advertisement", - type); + NEARBY_LOGS(WARNING) << "Data Element " << type + << " not supported in base advertisement"; return kEmptyMask; } diff --git a/presence/implementation/advertisement_decoder.h b/presence/implementation/advertisement_decoder.h index e4c59dbf..3c5d444b 100644 --- a/presence/implementation/advertisement_decoder.h +++ b/presence/implementation/advertisement_decoder.h @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2024 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,24 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_H_ -#define THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_H_ +#ifndef THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_ADVERTISEMENT_DECODER_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_ADVERTISEMENT_DECODER_H_ +#include #include #include -#include "absl/container/flat_hash_map.h" -#include "absl/container/flat_hash_set.h" #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "internal/platform/implementation/credential_callbacks.h" +#include "absl/strings/string_view.h" #include "internal/proto/credential.pb.h" #include "presence/data_element.h" -#include "presence/scan_request.h" namespace nearby { namespace presence { +// The structured decoded form of a detected Nearby Presence advertisement struct Advertisement { uint8_t version = 0; std::vector data_elements; @@ -39,61 +38,22 @@ struct Advertisement { std::string metadata_key; }; -// Decodes BLE NP advertisements +// Interface for decoding Nearby Presence advertisements from a payload of raw +// bytes into a structured, decrypted, and decoded format class AdvertisementDecoder { public: - using IdentityType = ::nearby::internal::IdentityType; + // Is needed otherwise deleting an instance via a pointer to a base class + // results in undefined behavior + virtual ~AdvertisementDecoder() = default; - AdvertisementDecoder( - ScanRequest scan_request, - absl::flat_hash_map>* credentials) - : scan_request_(scan_request), credentials_(credentials) { - AddBannedDataTypes(); - } - - explicit AdvertisementDecoder(ScanRequest scan_request) - : scan_request_(scan_request) { - AddBannedDataTypes(); - } - - static std::vector GetCredentialSelectors( - const ScanRequest& scan_request); - - // Returns a list of Data Elements decoded from the advertisement. - // Returns an error if the advertisement is misformatted or if it couldn't be - // decrypted. - absl::StatusOr DecodeAdvertisement( - absl::string_view advertisement); - - // Returns true if the decoded advertisement in `data_elements` matches the - // filters in `scan_request`. - bool MatchesScanFilter(const std::vector& data_elements); - - private: - // Decrypts data elements stored inside encrypted `elem` and appends them to - // `decoded_advertisement_`. - absl::Status DecryptDataElements(const DataElement& elem); - absl::StatusOr Decrypt(absl::string_view salt, - absl::string_view encrypted); - void DecodeBaseAction(absl::string_view serialized_action); - absl::StatusOr DecryptLdt( - const std::vector& credentials, - absl::string_view salt, absl::string_view data_elements); - void AddBannedDataTypes(); - bool MatchesScanFilter(const std::vector& data_elements, - const PresenceScanFilter& filter); - bool MatchesScanFilter(const std::vector& data_elements, - const LegacyPresenceScanFilter& filter); - - ScanRequest scan_request_; - absl::flat_hash_map>* - credentials_ = nullptr; - absl::flat_hash_set banned_data_types_; - Advertisement decoded_advertisement_; + // Returns the structured and decoded contents of an advertisement given a + // payload of bytes as a string. Returns an error if the advertisement is + // misformatted or if it couldn't be decrypted. + virtual absl::StatusOr DecodeAdvertisement( + absl::string_view advertisement) = 0; }; } // namespace presence } // namespace nearby -#endif // THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_H_ +#endif // THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_ADVERTISEMENT_DECODER_H_ diff --git a/presence/implementation/advertisement_decoder.cc b/presence/implementation/advertisement_decoder_impl.cc similarity index 50% rename from presence/implementation/advertisement_decoder.cc rename to presence/implementation/advertisement_decoder_impl.cc index 53102ac9..386e1fa0 100644 --- a/presence/implementation/advertisement_decoder.cc +++ b/presence/implementation/advertisement_decoder_impl.cc @@ -12,23 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "presence/implementation/advertisement_decoder.h" +#include "presence/implementation/advertisement_decoder_impl.h" -#include +#include #include #include #include #include +#include "absl/container/flat_hash_map.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/escaping.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "internal/platform/logging.h" -#include "internal/proto/credential.pb.h" #include "presence/data_element.h" #include "presence/implementation/action_factory.h" +#include "presence/implementation/advertisement_decoder.h" #include "presence/implementation/base_broadcast_request.h" #include "presence/implementation/ldt.h" @@ -61,9 +62,8 @@ bool IsDataElementAllowed(uint8_t header) { return length == 2; case DataElement::kPublicIdentityFieldType: return length == 0; - case DataElement::kPrivateIdentityFieldType: - case DataElement::kProvisionedIdentityFieldType: - case DataElement::kTrustedIdentityFieldType: + case DataElement::kPrivateGroupIdentityFieldType: + case DataElement::kContactsGroupIdentityFieldType: return length >= 2 && length <= 6; case DataElement::kTxPowerFieldType: return length == 1; @@ -85,9 +85,8 @@ bool IsDataElementAllowed(uint8_t header) { } bool IsEncryptedIdentity(int data_type) { - return data_type == DataElement::kPrivateIdentityFieldType || - data_type == DataElement::kTrustedIdentityFieldType || - data_type == DataElement::kProvisionedIdentityFieldType; + return data_type == DataElement::kPrivateGroupIdentityFieldType || + data_type == DataElement::kContactsGroupIdentityFieldType; } bool IsIdentity(int data_type) { @@ -97,12 +96,10 @@ bool IsIdentity(int data_type) { internal::IdentityType GetIdentityType(int data_type) { switch (data_type) { - case DataElement::kPrivateIdentityFieldType: - return internal::IDENTITY_TYPE_PRIVATE; - case DataElement::kTrustedIdentityFieldType: - return internal::IDENTITY_TYPE_TRUSTED; - case DataElement::kProvisionedIdentityFieldType: - return internal::IDENTITY_TYPE_PROVISIONED; + case DataElement::kPrivateGroupIdentityFieldType: + return internal::IDENTITY_TYPE_PRIVATE_GROUP; + case DataElement::kContactsGroupIdentityFieldType: + return internal::IDENTITY_TYPE_CONTACTS_GROUP; case DataElement::kPublicIdentityFieldType: return internal::IDENTITY_TYPE_PUBLIC; } @@ -149,45 +146,15 @@ absl::StatusOr ParseDataElement(const absl::string_view input, "Data element (%s) is %d bytes long. Expected at least %d", absl::BytesToHexString(input), input.size(), index)); } - NEARBY_LOGS(VERBOSE) << "Type: " << static_cast(data_type) - << " length: " << static_cast(length) << " DE: " - << absl::BytesToHexString(input.substr(start, length)); + NEARBY_VLOG(1) << "Type: " << static_cast(data_type) + << " length: " << static_cast(length) << " DE: " + << absl::BytesToHexString(input.substr(start, length)); return DataElement(data_type, input.substr(start, length)); } - -bool Contains(const std::vector& data_elements, - const DataElement& data_element) { - return std::find(data_elements.begin(), data_elements.end(), data_element) != - data_elements.end(); -} - -bool ContainsAll(const std::vector& data_elements, - const std::vector& extended_properties) { - for (const auto& filter_element : extended_properties) { - if (!Contains(data_elements, filter_element)) { - return false; - } - } - return true; -} - -bool ContainsAny(const std::vector& data_elements, - const std::vector& actions) { - if (actions.empty()) { - return true; - } - for (int action : actions) { - if (Contains(data_elements, DataElement(ActionBit(action)))) { - return true; - } - } - return false; -} - } // namespace -void AdvertisementDecoder::DecodeBaseAction( - absl::string_view serialized_action) { +void DecodeBaseAction(absl::string_view serialized_action, + Advertisement& decoded_advertisement) { if (serialized_action.empty() || serialized_action.size() > 3) { NEARBY_LOGS(WARNING) << "Base NP action \'" << absl::BytesToHexString(serialized_action) @@ -202,25 +169,25 @@ void AdvertisementDecoder::DecodeBaseAction( action.action |= serialized_action[i] << offset; } - ActionFactory::DecodeAction(action, decoded_advertisement_.data_elements); + ActionFactory::DecodeAction(action, decoded_advertisement.data_elements); } -absl::StatusOr AdvertisementDecoder::DecryptLdt( +absl::StatusOr DecryptLdt( const std::vector& credentials, - absl::string_view salt, absl::string_view data_elements) { + absl::string_view salt, absl::string_view encrypted_contents, + Advertisement& decoded_advertisement) { if (credentials.empty()) { return absl::UnavailableError("No credentials"); } for (const auto& credential : credentials) { absl::StatusOr encryptor = LdtEncryptor::Create( - credential.key_seed(), - credential.metadata_encryption_key_tag_v0()); + credential.key_seed(), credential.metadata_encryption_key_tag_v0()); if (encryptor.ok()) { absl::StatusOr result = - encryptor->DecryptAndVerify(data_elements, salt); + encryptor->DecryptAndVerify(encrypted_contents, salt); if (result.ok() && result->size() > kBaseMetadataSize) { - decoded_advertisement_.public_credential = credential; - decoded_advertisement_.metadata_key = + decoded_advertisement.public_credential = credential; + decoded_advertisement.metadata_key = result->substr(0, kBaseMetadataSize); return result->substr(kBaseMetadataSize); } @@ -230,18 +197,20 @@ absl::StatusOr AdvertisementDecoder::DecryptLdt( "Couldn't decrypt the message with any credentials"); } -absl::Status AdvertisementDecoder::DecryptDataElements( - const DataElement& elem) { +absl::Status DecryptDataElements( + const std::vector& credentials, + const DataElement& elem, Advertisement& decoded_advertisement) { if (elem.GetValue().size() <= kEncryptedIdentityAdditionalLength) { return absl::OutOfRangeError(absl::StrFormat( "Encrypted identity data element is too short - %d bytes", elem.GetValue().size())); } absl::string_view salt = elem.GetValue().substr(0, kSaltSize); - decoded_advertisement_.data_elements.emplace_back(DataElement::kSaltFieldType, - salt); + decoded_advertisement.data_elements.emplace_back(DataElement::kSaltFieldType, + salt); absl::string_view encrypted = elem.GetValue().substr(kSaltSize); - absl::StatusOr decrypted = Decrypt(salt, encrypted); + absl::StatusOr decrypted = + DecryptLdt(credentials, salt, encrypted, decoded_advertisement); if (!decrypted.ok()) { NEARBY_LOGS(WARNING) << "Failed to decrypt advertisement, status: " << decrypted.status(); @@ -257,74 +226,17 @@ absl::Status AdvertisementDecoder::DecryptDataElements( return internal_elem.status(); } if (internal_elem->GetType() == DataElement::kActionFieldType) { - DecodeBaseAction(internal_elem->GetValue()); + DecodeBaseAction(internal_elem->GetValue(), decoded_advertisement); } else { - decoded_advertisement_.data_elements.push_back(*std::move(internal_elem)); + decoded_advertisement.data_elements.push_back(*std::move(internal_elem)); } } return absl::OkStatus(); } -absl::StatusOr AdvertisementDecoder::Decrypt( - absl::string_view salt, absl::string_view encrypted) { - for (const auto& scan_filter : scan_request_.scan_filters) { - if (!absl::holds_alternative(scan_filter)) { - continue; - } - const std::vector& credentials = - absl::get(scan_filter) - .remote_public_credentials; - if (credentials.empty()) { - continue; - } - absl::StatusOr decrypted = - DecryptLdt(credentials, salt, encrypted); - if (decrypted.ok()) { - return decrypted; - } - } - if (credentials_ == nullptr) { - return absl::FailedPreconditionError("Missing credentials"); - } - - return DecryptLdt((*credentials_)[decoded_advertisement_.identity_type], salt, - encrypted); -} - -void AdvertisementDecoder::AddBannedDataTypes() { - // The scan request has information what identity types the client is - // interested in. We'll ban all other idenitity data types. - banned_data_types_ = {DataElement::kPrivateIdentityFieldType, - DataElement::kTrustedIdentityFieldType, - DataElement::kPublicIdentityFieldType, - DataElement::kProvisionedIdentityFieldType}; - for (nearby::internal::IdentityType identity_type : - scan_request_.identity_types) { - switch (identity_type) { - case internal::IDENTITY_TYPE_PRIVATE: - banned_data_types_.erase(DataElement::kPrivateIdentityFieldType); - break; - case internal::IDENTITY_TYPE_TRUSTED: - banned_data_types_.erase(DataElement::kTrustedIdentityFieldType); - break; - case internal::IDENTITY_TYPE_PUBLIC: - banned_data_types_.erase(DataElement::kPublicIdentityFieldType); - break; - case internal::IDENTITY_TYPE_PROVISIONED: - banned_data_types_.erase(DataElement::kProvisionedIdentityFieldType); - break; - default: - // Nothing to do - break; - } - } -} - -absl::StatusOr AdvertisementDecoder::DecodeAdvertisement( +absl::StatusOr AdvertisementDecoderImpl::DecodeAdvertisement( absl::string_view advertisement) { - // Let's keep the result advertisement in a member variable to avoid passing - // it around all the time. - decoded_advertisement_ = Advertisement{}; + Advertisement decoded_advertisement = Advertisement{}; std::vector result; NEARBY_LOGS(INFO) << "Advertisement: " << absl::BytesToHexString(advertisement); @@ -332,12 +244,12 @@ absl::StatusOr AdvertisementDecoder::DecodeAdvertisement( return absl::OutOfRangeError("Empty advertisement"); } uint8_t version = advertisement[0]; - NEARBY_LOGS(VERBOSE) << "Version: " << version; + NEARBY_VLOG(1) << "Version: " << version; if (version != kAdvertisementVersion) { return absl::UnimplementedError(absl::StrFormat( "Advertisement version (%d) is not supported", version)); } - decoded_advertisement_.version = version; + decoded_advertisement.version = version; size_t index = 1; absl::StatusOr decrypted; while (index < advertisement.size()) { @@ -347,89 +259,30 @@ absl::StatusOr AdvertisementDecoder::DecodeAdvertisement( << elem.status(); return elem.status(); } - // This checks allows us to bail before decryption when, for example, the - // client is scanning for advertisements with private identity but the - // advertisement uses trusted identity. - if (banned_data_types_.contains(elem->GetType())) { - return absl::FailedPreconditionError( - absl::StrFormat("Ignoring advertisement with data element type: %d", - elem->GetType())); - } if (IsIdentity(elem->GetType())) { - decoded_advertisement_.identity_type = GetIdentityType(elem->GetType()); + decoded_advertisement.identity_type = GetIdentityType(elem->GetType()); } if (IsEncryptedIdentity(elem->GetType())) { - absl::Status status = DecryptDataElements(*elem); + if (credentials_map_ == nullptr) { + return absl::FailedPreconditionError("Missing credentials"); + } + auto identity_type_specific_creds = + (*credentials_map_)[decoded_advertisement.identity_type]; + absl::Status status = DecryptDataElements(identity_type_specific_creds, + *elem, decoded_advertisement); if (!status.ok()) { return status; } } else { if (elem->GetType() == DataElement::kActionFieldType) { - DecodeBaseAction(elem->GetValue()); + DecodeBaseAction(elem->GetValue(), decoded_advertisement); } else { - decoded_advertisement_.data_elements.push_back(*std::move(elem)); + decoded_advertisement.data_elements.push_back(*std::move(elem)); } } } - return std::move(decoded_advertisement_); -} -bool AdvertisementDecoder::MatchesScanFilter( - const std::vector& data_elements) { - // The advertisement matches the scan request when it matches at least - // one of the filters in the request. - if (scan_request_.scan_filters.empty()) { - return true; - } - for (const auto& filter : scan_request_.scan_filters) { - if (absl::holds_alternative(filter)) { - if (MatchesScanFilter(data_elements, - absl::get(filter))) { - return true; - } - } else if (absl::holds_alternative(filter)) { - if (MatchesScanFilter(data_elements, - absl::get(filter))) { - return true; - } - } - } - return false; -} - -bool AdvertisementDecoder::MatchesScanFilter( - const std::vector& data_elements, - const PresenceScanFilter& filter) { - // The advertisement must contain all Data Elements in scan request. - return ContainsAll(data_elements, filter.extended_properties); -} - -bool AdvertisementDecoder::MatchesScanFilter( - const std::vector& data_elements, - const LegacyPresenceScanFilter& filter) { - // The advertisement must: - // * contain any Action from scan request, - // * contain all Data Elements in scan request. - return ContainsAny(data_elements, filter.actions) && - ContainsAll(data_elements, filter.extended_properties); -} - -std::vector AdvertisementDecoder::GetCredentialSelectors( - const ScanRequest& scan_request) { - std::vector all_types = { - IdentityType::IDENTITY_TYPE_PRIVATE, IdentityType::IDENTITY_TYPE_TRUSTED, - IdentityType::IDENTITY_TYPE_PUBLIC, - IdentityType::IDENTITY_TYPE_PROVISIONED}; - std::vector selectors; - for (auto identity_type : - (scan_request.identity_types.empty() ? all_types - : scan_request.identity_types)) { - selectors.push_back( - CredentialSelector{.manager_app_id = scan_request.manager_app_id, - .account_name = scan_request.account_name, - .identity_type = identity_type}); - } - return selectors; + return std::move(decoded_advertisement); } } // namespace presence diff --git a/presence/implementation/advertisement_decoder_impl.h b/presence/implementation/advertisement_decoder_impl.h new file mode 100644 index 00000000..c3e7e592 --- /dev/null +++ b/presence/implementation/advertisement_decoder_impl.h @@ -0,0 +1,51 @@ +// Copyright 2022 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_PRESENCE_ADVERTISEMENT_DECODER_IMPL_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_IMPL_H_ + +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/proto/credential.pb.h" +#include "presence/implementation/advertisement_decoder.h" + +namespace nearby { +namespace presence { + +// Implements the C++ backed parsing and decrypting of advertisement bytes +class AdvertisementDecoderImpl : public AdvertisementDecoder { + public: + AdvertisementDecoderImpl() = default; + explicit AdvertisementDecoderImpl( + absl::flat_hash_map>* + credentials_map) + : credentials_map_(credentials_map) {} + + absl::StatusOr DecodeAdvertisement( + absl::string_view advertisement) override; + + private: + absl::flat_hash_map>* + credentials_map_ = nullptr; +}; + +} // namespace presence +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_IMPL_H_ diff --git a/presence/implementation/advertisement_decoder_new_format_test.cc b/presence/implementation/advertisement_decoder_new_format_test.cc new file mode 100644 index 00000000..ef78c828 --- /dev/null +++ b/presence/implementation/advertisement_decoder_new_format_test.cc @@ -0,0 +1,156 @@ +// Copyright 2022 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. + +#include +#include + +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" +#include "gtest/gtest.h" +#include "absl/container/flat_hash_map.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/escaping.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" +#include "internal/proto/credential.pb.h" +#include "presence/data_element.h" +#include "presence/implementation/advertisement_decoder.h" +#include "presence/implementation/advertisement_decoder_rust_impl.h" + +namespace nearby { +namespace presence { +namespace { + +using ::nearby::ByteArray; // NOLINT +using ::nearby::internal::IdentityType; // NOLINT +using ::nearby::internal::SharedCredential; // NOLINT +using ::testing::ElementsAre; +using ::testing::status::StatusIs; + +TEST(AdvertisementDecoderImpl, DecodePublicAdvertisement) { + std::string V0AdvPlaintextBytes = + "00" // Adv Header V0 unencrypted + "1503"; // length 1 Tx Power DE value 3 + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(); + + absl::StatusOr result = + decoder.DecodeAdvertisement(absl::HexStringToBytes(V0AdvPlaintextBytes)); + ASSERT_OK(result); + EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PUBLIC); + EXPECT_EQ(result->version, 0); + EXPECT_THAT(result->data_elements, + ElementsAre(DataElement(DataElement::kTxPowerFieldType, + absl::HexStringToBytes("03")))); +} + +TEST(AdvertisementDecoderImpl, DecodePublicAdvertisementMultiDe) { + std::string V0AdvPlaintextMultiDeBytes = + "00" // Adv Header V0 unencrypted + "1505" // length 1 Tx Power DE value 5 + "260040"; // length 2 actions de with NearbyShare bit set + + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(); + absl::StatusOr result = decoder.DecodeAdvertisement( + absl::HexStringToBytes(V0AdvPlaintextMultiDeBytes)); + ASSERT_OK(result); + EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PUBLIC); + EXPECT_EQ(result->version, 0); + EXPECT_THAT(result->data_elements, + ElementsAre(DataElement(DataElement::kTxPowerFieldType, + absl::HexStringToBytes("05")), + DataElement(ActionBit::kNearbyShareAction))); +} + +// V0 encrypted advertisement data - ripped out of np_adv/tests/examples_v0.rs +TEST(AdvertisementDecoderImpl, DecodeEncryptedAdvertisement) { + std::string V0AdvEncryptedBytes = "042222D82212EF16DBF872F2A3A7C0FA5248EC"; + ByteArray seed({ + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + }); + ByteArray known_mac({0x09, 0xFE, 0x9E, 0x81, 0xB7, 0x3E, 0x5E, 0xCC, + 0x76, 0x59, 0x57, 0x71, 0xE0, 0x1F, 0xFB, 0x34, + 0x38, 0xE7, 0x5F, 0x24, 0xA7, 0x69, 0x56, 0xA0, + 0xB8, 0xEA, 0x67, 0xD1, 0x1C, 0x3E, 0x36, 0xFD}); + SharedCredential public_credential; + public_credential.set_key_seed(seed.AsStringView()); + public_credential.set_metadata_encryption_key_tag_v0( + known_mac.AsStringView()); + public_credential.set_id(12345678); + absl::flat_hash_map> + credentials; + credentials[IdentityType::IDENTITY_TYPE_PRIVATE_GROUP].push_back( + public_credential); + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(&credentials); + + absl::StatusOr result = + decoder.DecodeAdvertisement(absl::HexStringToBytes(V0AdvEncryptedBytes)); + ASSERT_OK(result); + EXPECT_EQ(result->public_credential.value().id(), public_credential.id()); + EXPECT_EQ(result->public_credential.value().key_seed(), + public_credential.key_seed()); + EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PRIVATE_GROUP); + EXPECT_EQ(result->version, 0); + EXPECT_THAT(result->data_elements, + ElementsAre(DataElement(DataElement::kSaltFieldType, + absl::HexStringToBytes("2222")), + DataElement(DataElement::kTxPowerFieldType, + absl::HexStringToBytes("03")))); +} + +TEST(AdvertisementDecoderImpl, DecodeEncryptedAdvertisementNoCreds) { + std::string V0AdvEncryptedBytes = "042222D82212EF16DBF872F2A3A7C0FA5248EC"; + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(); + + absl::StatusOr result = + decoder.DecodeAdvertisement(absl::HexStringToBytes(V0AdvEncryptedBytes)); + EXPECT_THAT(result, StatusIs(absl::StatusCode::kUnavailable)); +} + +TEST(AdvertisementDecoderImpl, V1AdvCurrentlyUnsupported) { + std::string V1Adv = + "20" // Version header V1 + "00" // format + "02" // section len + "1503"; // Tx power value 3 + + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(); + absl::StatusOr result = + decoder.DecodeAdvertisement(absl::HexStringToBytes(V1Adv)); + EXPECT_THAT(result, StatusIs(absl::StatusCode::kUnimplemented)); +} + +TEST(AdvertisementDecoderImpl, V0InvalidEmptyAdv) { + std::string V1Adv = "00"; + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(); + absl::StatusOr result = + decoder.DecodeAdvertisement(absl::HexStringToBytes(V1Adv)); + EXPECT_THAT(result, StatusIs(absl::StatusCode::kInvalidArgument)); +} + +TEST(AdvertisementDecoderImpl, V0InvalidAdvContents) { + std::string invalid_v0_adv = + "00" // Adv Header V0 unencrypted + "3503"; // length 3 Tx Power DE with only 1 byte + AdvertisementDecoderImpl decoder = AdvertisementDecoderImpl(); + absl::StatusOr result = + decoder.DecodeAdvertisement(absl::HexStringToBytes(invalid_v0_adv)); + EXPECT_THAT(result, StatusIs(absl::StatusCode::kInvalidArgument)); +} + +} // namespace +} // namespace presence +} // namespace nearby diff --git a/presence/implementation/advertisement_decoder_rust_impl.cc b/presence/implementation/advertisement_decoder_rust_impl.cc new file mode 100644 index 00000000..0f7227b3 --- /dev/null +++ b/presence/implementation/advertisement_decoder_rust_impl.cc @@ -0,0 +1,241 @@ +// Copyright 2022 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. + +#include "presence/implementation/advertisement_decoder_rust_impl.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "np_cpp_ffi_types.h" +#include "nearby_protocol.h" +#include "internal/platform/logging.h" +#include "presence/data_element.h" +#include "presence/implementation/advertisement_decoder.h" + +namespace nearby { +namespace presence { +namespace { + +absl::StatusOr MapAction(const ActionBit action) { + switch (action) { + case ActionBit::kActiveUnlockAction: + return nearby_protocol::ActionType::ActiveUnlock; + case ActionBit::kNearbyShareAction: + return nearby_protocol::ActionType::NearbyShare; + case ActionBit::kInstantTetheringAction: + return nearby_protocol::ActionType::InstantTethering; + case ActionBit::kPhoneHubAction: + return nearby_protocol::ActionType::PhoneHub; + default: + return absl::InvalidArgumentError("Unsupported action type"); + } +} + +void AddActionsToAdvertisement(const nearby_protocol::V0Actions& parsed_actions, + Advertisement& advertisement) { + for (const auto action : kAllActionBits) { + auto action_type = MapAction(action); + if (!action_type.ok()) { + NEARBY_LOGS(WARNING) + << "Advertisement contains an unsupported action bit: " + << (int)action; + continue; + } + if (parsed_actions.HasAction(*action_type)) { + advertisement.data_elements.push_back(DataElement(action)); + } + } +} + +void ProcessDataElement(const nearby_protocol::V0DataElement& data_element, + Advertisement& advertisement) { + switch (data_element.GetKind()) { + case nearby_protocol::V0DataElementKind::TxPower: { + advertisement.data_elements.push_back(DataElement( + DataElement::kTxPowerFieldType, data_element.AsTxPower().GetAsI8())); + return; + } + case nearby_protocol::V0DataElementKind::Actions: { + AddActionsToAdvertisement(data_element.AsActions(), advertisement); + } + } +} + +internal::IdentityType GetIdentityType( + nearby_protocol::DeserializedV0IdentityKind identity) { + switch (identity) { + case np_ffi::internal::DeserializedV0IdentityKind::Plaintext: + return internal::IdentityType::IDENTITY_TYPE_PUBLIC; + case np_ffi::internal::DeserializedV0IdentityKind::Decrypted: + return internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; + } +} + +absl::StatusOr<::nearby::internal::SharedCredential> FindById( + std::vector<::nearby::internal::SharedCredential> private_credentials, + uint64_t id) { + auto cred = + std::find_if(private_credentials.begin(), private_credentials.end(), + [&id](const auto& x) { return x.id() == id; }); + if (cred == private_credentials.end()) { + return absl::NotFoundError("No credential found with id: " + + std::to_string(id)); + } + return *cred; +} + +absl::Status ProcessLegibleV0Adv( + nearby_protocol::LegibleDeserializedV0Advertisement legible_adv, + std::vector<::nearby::internal::SharedCredential> private_credentials, + Advertisement& advertisement) { + advertisement.identity_type = GetIdentityType(legible_adv.GetIdentityKind()); + + auto num_des = legible_adv.GetNumberOfDataElements(); + auto payload = legible_adv.IntoPayload(); + + // TODO(b/333126765): salt isn't a DE, we should restructure the + // Advertisement struct to reflect this + if (advertisement.identity_type == + internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP) { + auto cred_details = payload.TryGetIdentityDetails(); + if (!cred_details.ok()) { + return cred_details.status(); + } + + advertisement.public_credential = + FindById(private_credentials, cred_details->cred_id); + + // TODO(b/333126765): update salt to use unsigned char * to remove cast + std::string salt(reinterpret_cast(cred_details->salt), 2); + advertisement.data_elements.push_back(DataElement(0x00, salt)); + + std::string metadata_key( + reinterpret_cast(cred_details->identity_token), 14); + advertisement.metadata_key = std::move(metadata_key); + } + + for (int i = 0; i < num_des; i++) { + auto de_result = payload.TryGetDataElement(i); + if (!de_result.ok()) { + return de_result.status(); + } + ProcessDataElement(*de_result, advertisement); + } + return absl::OkStatus(); +} + +absl::Status ProcessV0Advertisement( + nearby_protocol::DeserializedV0Advertisement result, + std::vector<::nearby::internal::SharedCredential> private_credentials, + Advertisement& adv) { + switch (result.GetKind()) { + case nearby_protocol::DeserializedV0AdvertisementKind::Legible: + return ProcessLegibleV0Adv(result.IntoLegible(), private_credentials, + adv); + break; + case nearby_protocol::DeserializedV0AdvertisementKind:: + NoMatchingCredentials: { + return absl::UnavailableError( + "Couldn't decrypt the message with any credentials"); + } + } +} + +} // namespace + +absl::StatusOr AdvertisementDecoderImpl::DecodeAdvertisement( + absl::string_view advertisement) { + auto byte_buffer = nearby_protocol::ByteBuffer< + nearby_protocol::MAX_ADV_PAYLOAD_SIZE>::TryFromString(advertisement); + if (!byte_buffer.ok()) { + return absl::InvalidArgumentError("Invalid length advertisement"); + } + + Advertisement decoded_advertisement; + const nearby_protocol::RawAdvertisementPayload payload(byte_buffer.value()); + auto deserialize_result = + nearby_protocol::Deserializer::DeserializeAdvertisement(payload, + cred_book_); + + switch (deserialize_result.GetKind()) { + case np_ffi::internal::DeserializeAdvertisementResultKind::Error: { + return absl::InvalidArgumentError("Invalid advertisement format"); + } + case np_ffi::internal::DeserializeAdvertisementResultKind::V1: { + return absl::UnimplementedError( + absl::StrFormat("V1 Advertisement format is not supported")); + } + case np_ffi::internal::DeserializeAdvertisementResultKind::V0: { + decoded_advertisement.version = 0; + auto result = + ProcessV0Advertisement(deserialize_result.IntoV0(), + private_credentials_, decoded_advertisement); + if (!result.ok()) { + return result; + } + break; + } + } + + return decoded_advertisement; +} + +nearby_protocol::CredentialBook +AdvertisementDecoderImpl::InitializeCredentialBook( + absl::flat_hash_map>* + credentials_map) { + if (credentials_map == nullptr) { + nearby_protocol::CredentialSlab slab; + nearby_protocol::CredentialBook cred_book(slab); + return cred_book; + } + + nearby_protocol::CredentialSlab slab; + for (const auto& credential : (*credentials_map) + [internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP]) { + std::vector metadata_bytes( + credential.encrypted_metadata_bytes_v0().begin(), + credential.encrypted_metadata_bytes_v0().end()); + nearby_protocol::MatchedCredentialData matched_cred(credential.id(), + metadata_bytes); + + auto key_seed = credential.key_seed(); + std::array key_seed_array; + std::copy(key_seed.begin(), key_seed.end(), key_seed_array.data()); + + auto tag = credential.metadata_encryption_key_tag_v0(); + std::array tag_array; + std::copy(tag.begin(), tag.end(), tag_array.data()); + + auto matchable_credential = nearby_protocol::V0MatchableCredential( + key_seed_array, tag_array, matched_cred); + slab.AddV0Credential(matchable_credential); + } + nearby_protocol::CredentialBook cred_book(slab); + return cred_book; +} + +} // namespace presence +} // namespace nearby diff --git a/presence/implementation/advertisement_decoder_rust_impl.h b/presence/implementation/advertisement_decoder_rust_impl.h new file mode 100644 index 00000000..b2444e7d --- /dev/null +++ b/presence/implementation/advertisement_decoder_rust_impl.h @@ -0,0 +1,61 @@ +// Copyright 2022 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_PRESENCE_ADVERTISEMENT_DECODER_RUST_IMPL_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_RUST_IMPL_H_ + +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "nearby_protocol.h" +#include "presence/implementation/advertisement_decoder.h" + +namespace nearby { +namespace presence { + +// Implements the Rust backed parsing and decrypting of advertisement bytes +class AdvertisementDecoderImpl : public AdvertisementDecoder { + public: + AdvertisementDecoderImpl() + : cred_book_(InitializeCredentialBook(nullptr)), + private_credentials_( + std::vector<::nearby::internal::SharedCredential>()) {} + + explicit AdvertisementDecoderImpl( + absl::flat_hash_map>* + credentials_map) + : cred_book_(InitializeCredentialBook(credentials_map)), + private_credentials_( + (*credentials_map) + [internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP]) {} + + absl::StatusOr DecodeAdvertisement( + absl::string_view advertisement) override; + + private: + nearby_protocol::CredentialBook InitializeCredentialBook( + absl::flat_hash_map>* + credentials_map); + nearby_protocol::CredentialBook cred_book_; + std::vector<::nearby::internal::SharedCredential> private_credentials_; +}; + +} // namespace presence +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_DECODER_IMPL_H_ diff --git a/presence/implementation/advertisement_decoder_test.cc b/presence/implementation/advertisement_decoder_test.cc index 8b532ef7..5b2a70d4 100644 --- a/presence/implementation/advertisement_decoder_test.cc +++ b/presence/implementation/advertisement_decoder_test.cc @@ -14,19 +14,21 @@ #include "presence/implementation/advertisement_decoder.h" -#include #include #include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/container/flat_hash_map.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/escaping.h" -#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" #include "internal/proto/credential.pb.h" #include "presence/data_element.h" +#include "presence/implementation/advertisement_decoder_impl.h" #include "presence/scan_request.h" #include "presence/scan_request_builder.h" @@ -34,13 +36,10 @@ namespace nearby { namespace presence { namespace { -using ::nearby::ByteArray; // NOLINT -using ::nearby::internal::IdentityType; +using ::nearby::ByteArray; // NOLINT +using ::nearby::internal::IdentityType; // NOLINT using ::nearby::internal::SharedCredential; // NOLINT using ::testing::ElementsAre; -using ::testing::Matcher; -using ::testing::Pointwise; -using ::testing::Return; using ::testing::UnorderedElementsAre; using ::testing::status::StatusIs; @@ -48,23 +47,21 @@ constexpr absl::string_view kAccountName = "test account"; ScanRequest GetScanRequest() { return {.account_name = std::string(kAccountName), - .identity_types = {IdentityType::IDENTITY_TYPE_PRIVATE, - IdentityType::IDENTITY_TYPE_TRUSTED, - IdentityType::IDENTITY_TYPE_PUBLIC, - IdentityType::IDENTITY_TYPE_PROVISIONED}}; + .identity_types = { + IdentityType::IDENTITY_TYPE_PRIVATE_GROUP, + IdentityType::IDENTITY_TYPE_CONTACTS_GROUP, + IdentityType::IDENTITY_TYPE_PUBLIC, + }}; } -#ifdef USE_RUST_LDT ScanRequest GetScanRequest(std::vector credentials) { LegacyPresenceScanFilter scan_filter = {.remote_public_credentials = credentials}; return ScanRequestBuilder() .SetAccountName(kAccountName) - .AddIdentityType(IdentityType::IDENTITY_TYPE_PRIVATE) - .AddIdentityType(IdentityType::IDENTITY_TYPE_TRUSTED) + .AddIdentityType(IdentityType::IDENTITY_TYPE_PRIVATE_GROUP) + .AddIdentityType(IdentityType::IDENTITY_TYPE_CONTACTS_GROUP) .AddIdentityType(IdentityType::IDENTITY_TYPE_PUBLIC) - .AddIdentityType(IdentityType::IDENTITY_TYPE_PROVISIONED) - .AddScanFilter(scan_filter) .Build(); } @@ -73,9 +70,10 @@ SharedCredential GetPublicCredential() { ByteArray seed({204, 219, 36, 137, 233, 252, 172, 66, 179, 147, 72, 184, 148, 30, 209, 154, 29, 54, 14, 117, 224, 152, 200, 193, 94, 107, 28, 194, 182, 32, 205, 57}); - ByteArray known_mac({223, 185, 10, 31, 155, 31, 226, 141, 24, 187, 204, - 165, 34, 64, 181, 204, 44, 203, 95, 141, 82, 137, - 163, 203, 100, 235, 53, 65, 202, 97, 75, 180}); + ByteArray known_mac({0xB4, 0xC5, 0x9F, 0xA5, 0x99, 0x24, 0x1B, 0x81, + 0x75, 0x8D, 0x97, 0x6B, 0x5A, 0x62, 0x1C, 0x05, + 0x23, 0x2F, 0xE1, 0xBF, 0x89, 0xAE, 0x59, 0x87, + 0xCA, 0x25, 0x4C, 0x35, 0x54, 0xDC, 0xE5, 0x0E}); SharedCredential public_credential; public_credential.set_key_seed(seed.AsStringView()); public_credential.set_metadata_encryption_key_tag_v0( @@ -83,127 +81,27 @@ SharedCredential GetPublicCredential() { return public_credential; } -TEST(AdvertisementDecoder, DecodeBaseNpPrivateAdvertisement) { - std::string salt = "AB"; - ByteArray metadata_key( - {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); - absl::flat_hash_map> - credentials; - credentials[IdentityType::IDENTITY_TYPE_PRIVATE].push_back( - GetPublicCredential()); - AdvertisementDecoder decoder(GetScanRequest(), &credentials); - - absl::StatusOr result = decoder.DecodeAdvertisement( - absl::HexStringToBytes("00514142c2c30e79fee14599e36e34d5d42e49fc37b0df")); +TEST(AdvertisementDecoderImpl, + DecodeBaseNpV0PublicIdentityWithTxAndActionFields) { + AdvertisementDecoderImpl decoder; + // v0 public identity, power and action, action value 8 for active unlock. + // These values all come from + // //third_party/nearby/presence/implementation/advertisement_factory_test.cc + auto result = + decoder.DecodeAdvertisement(absl::HexStringToBytes("000315FF260080")); ASSERT_OK(result); - EXPECT_EQ(result->metadata_key, metadata_key.AsStringView()); - EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PRIVATE); EXPECT_THAT(result->data_elements, - ElementsAre(DataElement(DataElement::kSaltFieldType, salt), - DataElement(DataElement::kTxPowerFieldType, - absl::HexStringToBytes("05")), - DataElement(DataElement::kActionFieldType, - absl::HexStringToBytes("08")))); + UnorderedElementsAre( + DataElement(DataElement::kPublicIdentityFieldType, ""), + DataElement(DataElement::kTxPowerFieldType, + absl::HexStringToBytes("ff")), + DataElement(DataElement(ActionBit::kActiveUnlockAction)))); } -TEST(AdvertisementDecoder, - DecodeBaseNpPrivateAdvertisementWithPublicCredentialFromScanRequest) { +TEST(AdvertisementDecoderImpl, DecodeBaseNpPublicAdvertisement) { const std::string salt = "AB"; - ByteArray metadata_key( - {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); - std::vector credentials = {GetPublicCredential()}; - - AdvertisementDecoder decoder(GetScanRequest(credentials)); - - absl::StatusOr result = decoder.DecodeAdvertisement( - absl::HexStringToBytes("00514142c2c30e79fee14599e36e34d5d42e49fc37b0df")); - - ASSERT_OK(result); - EXPECT_EQ(result->metadata_key, metadata_key.AsStringView()); - EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PRIVATE); - EXPECT_THAT(result->data_elements, - ElementsAre(DataElement(DataElement::kSaltFieldType, salt), - DataElement(DataElement::kTxPowerFieldType, - absl::HexStringToBytes("05")), - DataElement(DataElement::kActionFieldType, - absl::HexStringToBytes("08")))); -} - -TEST(AdvertisementDecoder, DecodeBaseNpTrustedAdvertisement) { - std::string salt = "AB"; - ByteArray metadata_key( - {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); - absl::flat_hash_map> - credentials; - credentials[IdentityType::IDENTITY_TYPE_TRUSTED].push_back( - GetPublicCredential()); - AdvertisementDecoder decoder(GetScanRequest(), &credentials); - - absl::StatusOr result = decoder.DecodeAdvertisement( - absl::HexStringToBytes("00524142099500aeef8bff5df05169a79726e11563b865")); - - ASSERT_OK(result); - EXPECT_EQ(result->metadata_key, metadata_key.AsStringView()); - EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_TRUSTED); - EXPECT_THAT( - result->data_elements, - UnorderedElementsAre(DataElement(DataElement::kSaltFieldType, salt), - DataElement(DataElement::kTxPowerFieldType, - absl::HexStringToBytes("05")), - DataElement(DataElement::kActionFieldType, - absl::HexStringToBytes("08")), - DataElement(DataElement::kActionFieldType, - absl::HexStringToBytes("0A")))); -} - -TEST(AdvertisementDecoder, DecodeBaseNpProvisionedAdvertisement) { - std::string salt = "AB"; - ByteArray metadata_key( - {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); - absl::flat_hash_map> - credentials; - credentials[IdentityType::IDENTITY_TYPE_PROVISIONED].push_back( - GetPublicCredential()); - AdvertisementDecoder decoder(GetScanRequest(), &credentials); - - absl::StatusOr result = decoder.DecodeAdvertisement( - absl::HexStringToBytes("00544142099500aeef8bff5df05169a79726e11563b865")); - - ASSERT_OK(result); - EXPECT_EQ(result->metadata_key, metadata_key.AsStringView()); - EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PROVISIONED); - EXPECT_THAT( - result->data_elements, - UnorderedElementsAre(DataElement(DataElement::kSaltFieldType, salt), - DataElement(DataElement::kTxPowerFieldType, - absl::HexStringToBytes("05")), - DataElement(DataElement::kActionFieldType, - absl::HexStringToBytes("08")), - DataElement(DataElement::kActionFieldType, - absl::HexStringToBytes("0A")))); -} - -TEST(AdvertisementDecoder, InvalidEncryptedContent) { - std::string salt = "AB"; - ByteArray metadata_key( - {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); - absl::flat_hash_map> - credentials; - credentials[IdentityType::IDENTITY_TYPE_PRIVATE].push_back( - GetPublicCredential()); - AdvertisementDecoder decoder(GetScanRequest(), &credentials); - - EXPECT_THAT(decoder.DecodeAdvertisement(absl::HexStringToBytes( - "00414142f085d661ac8cb110e792e7faeb736294")), - StatusIs(absl::StatusCode::kOutOfRange)); -} - -#endif /*USE_RUST_LDT*/ - -TEST(AdvertisementDecoder, DecodeBaseNpPublicAdvertisement) { - const std::string salt = "AB"; - AdvertisementDecoder decoder(GetScanRequest()); + AdvertisementDecoderImpl decoder; const absl::StatusOr result = decoder.DecodeAdvertisement( absl::HexStringToBytes("002041420337C1C2C31BEE")); @@ -221,9 +119,9 @@ TEST(AdvertisementDecoder, DecodeBaseNpPublicAdvertisement) { absl::HexStringToBytes("EE")))); } -TEST(AdvertisementDecoder, DecodeBaseNpWithTxAndActionFields) { +TEST(AdvertisementDecoderImpl, DecodeBaseNpWithTxAndActionFields) { std::string salt = "AB"; - AdvertisementDecoder decoder(GetScanRequest()); + AdvertisementDecoderImpl decoder; auto result = decoder.DecodeAdvertisement( absl::HexStringToBytes("0020414203155036B04180")); @@ -241,61 +139,55 @@ TEST(AdvertisementDecoder, DecodeBaseNpWithTxAndActionFields) { DataElement(DataElement(ActionBit::kNearbyShareAction)))); } -TEST(AdvertisementDecoder, DecodeBaseNpV0PublicIdentityWithTxAndActionFields) { - AdvertisementDecoder decoder(GetScanRequest()); +TEST(AdvertisementDecoderImpl, DecodeBaseNpPrivateAdvertisement) { + std::string salt = "AB"; + ByteArray metadata_key( + {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); + absl::flat_hash_map> + credentials; + credentials[IdentityType::IDENTITY_TYPE_PRIVATE_GROUP].push_back( + GetPublicCredential()); + AdvertisementDecoderImpl decoder(&credentials); - auto result = decoder.DecodeAdvertisement( - // v0 public identity, power and action, action value 8 for active unlock. - absl::HexStringToBytes("000315FF260080")); - - EXPECT_OK(result); + absl::StatusOr result = decoder.DecodeAdvertisement( + absl::HexStringToBytes("00514142b8412efb0bc657ba514baf4d1b50ddc842cd1c")); + ASSERT_OK(result); + EXPECT_EQ(result->metadata_key, metadata_key.AsStringView()); + EXPECT_EQ(result->identity_type, IdentityType::IDENTITY_TYPE_PRIVATE_GROUP); EXPECT_THAT(result->data_elements, - UnorderedElementsAre( - DataElement(DataElement::kPublicIdentityFieldType, ""), - DataElement(DataElement::kTxPowerFieldType, - absl::HexStringToBytes("ff")), - DataElement(DataElement(ActionBit::kActiveUnlockAction)))); + ElementsAre(DataElement(DataElement::kSaltFieldType, salt), + DataElement(DataElement::kTxPowerFieldType, + absl::HexStringToBytes("05")), + DataElement(DataElement::kActionFieldType, + absl::HexStringToBytes("08")))); } -TEST(AdvertisementDecoder, - ScanForEncryptedIdentityIgnoresPublicIdentityAdvertisement) { - AdvertisementDecoder decoder( - {.account_name = std::string(kAccountName), - .identity_types = {IdentityType::IDENTITY_TYPE_PRIVATE, - IdentityType::IDENTITY_TYPE_TRUSTED, - IdentityType::IDENTITY_TYPE_PROVISIONED}}); +TEST(AdvertisementDecoderImpl, InvalidEncryptedContent) { + std::string salt = "AB"; + ByteArray metadata_key( + {205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174}); + absl::flat_hash_map> + credentials; + credentials[IdentityType::IDENTITY_TYPE_PRIVATE_GROUP].push_back( + GetPublicCredential()); + AdvertisementDecoderImpl decoder(&credentials); - EXPECT_THAT(decoder.DecodeAdvertisement( - absl::HexStringToBytes("00204142034650B04180")), - StatusIs(absl::StatusCode::kFailedPrecondition)); + EXPECT_THAT(decoder.DecodeAdvertisement(absl::HexStringToBytes( + "00414142f085d661ac8cb110e792e7faeb736294")), + StatusIs(absl::StatusCode::kOutOfRange)); } -TEST(AdvertisementDecoder, DecodeEddystone) { - AdvertisementDecoder decoder(GetScanRequest()); - std::string eddystone_id = - absl::HexStringToBytes("A0A1A2A3A4A5A6A7A8A9B0B1B2B3B4B5B6B7B8B9"); - - auto result = decoder.DecodeAdvertisement(absl::HexStringToBytes("0008") + - eddystone_id); - - EXPECT_OK(result); - EXPECT_THAT(result->data_elements, - ElementsAre(DataElement(DataElement::kEddystoneIdFieldType, - eddystone_id))); -} - -// TODO(b/238214467): Add more negative tests -TEST(AdvertisementDecoder, UnsupportedDataElement) { +TEST(AdvertisementDecoderImpl, UnsupportedDataElement) { std::string valid_header_and_salt = absl::HexStringToBytes("00204142"); - AdvertisementDecoder decoder(GetScanRequest()); + AdvertisementDecoderImpl decoder; EXPECT_THAT(decoder.DecodeAdvertisement(valid_header_and_salt + absl::HexStringToBytes("0D")), StatusIs(absl::StatusCode::kInvalidArgument)); } -TEST(AdvertisementDecoder, InvalidAdvertisementFieldTooShort) { - AdvertisementDecoder decoder(GetScanRequest()); +TEST(AdvertisementDecoderImpl, InvalidAdvertisementFieldTooShort) { + AdvertisementDecoderImpl decoder; // 0x59 header means 5 bytes long Account Key Data but only 4 bytes follow. EXPECT_THAT( @@ -303,8 +195,8 @@ TEST(AdvertisementDecoder, InvalidAdvertisementFieldTooShort) { StatusIs(absl::StatusCode::kOutOfRange)); } -TEST(AdvertisementDecoder, ZeroLengthPayload) { - AdvertisementDecoder decoder(GetScanRequest()); +TEST(AdvertisementDecoderImpl, ZeroLengthPayload) { + AdvertisementDecoderImpl decoder; // A action with type 0xA and no payload const absl::StatusOr result = @@ -314,116 +206,21 @@ TEST(AdvertisementDecoder, ZeroLengthPayload) { EXPECT_THAT(result->data_elements, ElementsAre(DataElement(0xA, ""))); } -TEST(AdvertisementDecoder, EmptyAdvertisement) { - AdvertisementDecoder decoder(GetScanRequest()); +TEST(AdvertisementDecoderImpl, EmptyAdvertisement) { + AdvertisementDecoderImpl decoder; EXPECT_THAT(decoder.DecodeAdvertisement(""), StatusIs(absl::StatusCode::kOutOfRange)); } -TEST(AdvertisementDecoder, UnsupportedAdvertisementVersion) { - AdvertisementDecoder decoder(GetScanRequest()); +TEST(AdvertisementDecoderImpl, UnsupportedAdvertisementVersion) { + AdvertisementDecoderImpl decoder; EXPECT_THAT(decoder.DecodeAdvertisement( absl::HexStringToBytes("012041420318CD29EEFF")), StatusIs(absl::StatusCode::kUnimplemented)); } -TEST(AdvertisementDecoder, MatchesScanFilterNoFilterPasses) { - std::vector adv = { - DataElement(DataElement::kPrivateIdentityFieldType, "payload")}; - ScanRequest empty_scan_request = {}; - AdvertisementDecoder decoder(empty_scan_request); - - // A scan request without scan filters matches any advertisement - EXPECT_TRUE(decoder.MatchesScanFilter( - {DataElement(DataElement::kPrivateIdentityFieldType, "payload")})); - EXPECT_TRUE(decoder.MatchesScanFilter({})); -} - -TEST(AdvertisementDecoder, MatchesPresenceScanFilter) { - std::vector adv = { - DataElement(DataElement::kPrivateIdentityFieldType, "payload")}; - DataElement model_id = - DataElement(DataElement::kModelIdFieldType, "model id"); - DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); - DataElement salt2 = DataElement(DataElement::kSaltFieldType, "salt 2"); - PresenceScanFilter filter = {.extended_properties = {model_id, salt}}; - - AdvertisementDecoder decoder( - - ScanRequestBuilder().AddScanFilter(filter).Build()); - - EXPECT_FALSE(decoder.MatchesScanFilter({})); - EXPECT_FALSE(decoder.MatchesScanFilter({salt})); - EXPECT_TRUE(decoder.MatchesScanFilter({salt, model_id})); - EXPECT_TRUE(decoder.MatchesScanFilter({salt, salt2, model_id})); - EXPECT_FALSE(decoder.MatchesScanFilter({salt2, model_id})); -} - -TEST(AdvertisementDecoder, MatchesLegacyPresenceScanFilter) { - std::vector adv = { - DataElement(DataElement::kPrivateIdentityFieldType, "payload")}; - DataElement model_id = - DataElement(DataElement::kModelIdFieldType, "model id"); - DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); - DataElement salt2 = DataElement(DataElement::kSaltFieldType, "salt 2"); - LegacyPresenceScanFilter filter = {.extended_properties = {model_id, salt}}; - - AdvertisementDecoder decoder( - - ScanRequestBuilder().AddScanFilter(filter).Build()); - - EXPECT_FALSE(decoder.MatchesScanFilter({})); - EXPECT_FALSE(decoder.MatchesScanFilter({salt})); - EXPECT_TRUE(decoder.MatchesScanFilter({salt, model_id})); - EXPECT_TRUE(decoder.MatchesScanFilter({salt, salt2, model_id})); - EXPECT_FALSE(decoder.MatchesScanFilter({salt2, model_id})); -} - -TEST(AdvertisementDecoder, MatchesLegacyPresenceScanFilterWithActions) { - std::vector adv = { - DataElement(DataElement::kPrivateIdentityFieldType, "payload")}; - DataElement model_id = - DataElement(DataElement::kModelIdFieldType, "model id"); - DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); - DataElement ttt_action = DataElement(ActionBit::kTapToTransferAction); - LegacyPresenceScanFilter filter = { - .actions = {static_cast(ActionBit::kActiveUnlockAction), - static_cast(ActionBit::kTapToTransferAction)}, - .extended_properties = {model_id, salt}}; - - AdvertisementDecoder decoder( - - ScanRequestBuilder().AddScanFilter(filter).Build()); - - EXPECT_FALSE(decoder.MatchesScanFilter({salt, model_id})); - EXPECT_TRUE(decoder.MatchesScanFilter({salt, ttt_action, model_id})); -} - -TEST(AdvertisementDecoder, MatchesMultipleFilters) { - std::vector adv = { - DataElement(DataElement::kPrivateIdentityFieldType, "payload")}; - DataElement model_id = - DataElement(DataElement::kModelIdFieldType, "model id"); - DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); - DataElement ttt_action = DataElement(ActionBit::kTapToTransferAction); - PresenceScanFilter presence_filter = {.extended_properties = {model_id}}; - LegacyPresenceScanFilter legacy_filter = { - .actions = {static_cast(ActionBit::kActiveUnlockAction), - static_cast(ActionBit::kTapToTransferAction)}, - .extended_properties = {salt}}; - - AdvertisementDecoder decoder(ScanRequestBuilder() - .AddScanFilter(presence_filter) - .AddScanFilter(legacy_filter) - .Build()); - - EXPECT_TRUE(decoder.MatchesScanFilter({model_id})); - EXPECT_TRUE(decoder.MatchesScanFilter({salt, ttt_action})); - EXPECT_FALSE(decoder.MatchesScanFilter({ttt_action})); -} - } // namespace } // namespace presence } // namespace nearby diff --git a/presence/implementation/advertisement_factory.cc b/presence/implementation/advertisement_factory.cc index 86ac217c..e3270c2a 100644 --- a/presence/implementation/advertisement_factory.cc +++ b/presence/implementation/advertisement_factory.cc @@ -14,13 +14,21 @@ #include "presence/implementation/advertisement_factory.h" +#include +#include #include #include #include +#include "absl/base/attributes.h" #include "absl/status/status.h" +#include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" #include "absl/types/variant.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "internal/platform/logging.h" #include "internal/platform/uuid.h" #include "internal/proto/credential.pb.h" @@ -55,8 +63,8 @@ absl::Status AppendDataElement(unsigned data_type, std::string& output) { auto header = CreateDataElementHeader(data_element.size(), data_type); if (!header.ok()) { - NEARBY_LOG(WARNING, "Can't add Data element type: %d, length: %d", - data_type, data_element.size()); + NEARBY_LOGS(WARNING) << "Can't add Data element type: " << data_type + << ", length: " << data_element.size(); return header.status(); } output.push_back(*header); @@ -66,16 +74,14 @@ absl::Status AppendDataElement(unsigned data_type, uint8_t GetIdentityFieldType(IdentityType type) { switch (type) { - case IdentityType::IDENTITY_TYPE_PRIVATE: - return DataElement::kPrivateIdentityFieldType; - case IdentityType::IDENTITY_TYPE_TRUSTED: - return DataElement::kTrustedIdentityFieldType; + case IdentityType::IDENTITY_TYPE_PRIVATE_GROUP: + return DataElement::kPrivateGroupIdentityFieldType; + case IdentityType::IDENTITY_TYPE_CONTACTS_GROUP: + return DataElement::kContactsGroupIdentityFieldType; case IdentityType::IDENTITY_TYPE_PUBLIC: - return DataElement::kPublicIdentityFieldType; - case IdentityType::IDENTITY_TYPE_PROVISIONED: ABSL_FALLTHROUGH_INTENDED; default: - return DataElement::kProvisionedIdentityFieldType; + return DataElement::kPublicIdentityFieldType; } } @@ -94,9 +100,8 @@ std::string SerializeAction(const Action& action) { } bool RequiresCredentials(IdentityType identity_type) { - return identity_type == IdentityType::IDENTITY_TYPE_PRIVATE || - identity_type == IdentityType::IDENTITY_TYPE_TRUSTED || - identity_type == IdentityType::IDENTITY_TYPE_PROVISIONED; + return identity_type == IdentityType::IDENTITY_TYPE_PRIVATE_GROUP || + identity_type == IdentityType::IDENTITY_TYPE_CONTACTS_GROUP; } } // namespace @@ -146,8 +151,8 @@ AdvertisementFactory::CreateBaseNpAdvertisement( if (!result.ok()) { return result; } - NEARBY_LOGS(VERBOSE) << "Unencrypted advertisement payload " - << absl::BytesToHexString(unencrypted); + NEARBY_VLOG(1) << "Unencrypted advertisement payload " + << absl::BytesToHexString(unencrypted); absl::StatusOr encrypted = EncryptDataElements(*credential, request.salt, unencrypted); if (!encrypted.ok()) { diff --git a/presence/implementation/advertisement_factory.h b/presence/implementation/advertisement_factory.h index 69321f54..54211944 100644 --- a/presence/implementation/advertisement_factory.h +++ b/presence/implementation/advertisement_factory.h @@ -16,10 +16,11 @@ #define THIRD_PARTY_NEARBY_PRESENCE_ADVERTISEMENT_FACTORY_H_ #include -#include #include "absl/status/statusor.h" -#include "internal/proto/credential.pb.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "presence/implementation/base_broadcast_request.h" #include "presence/implementation/mediums/advertisement_data.h" @@ -39,17 +40,18 @@ class AdvertisementFactory { // Returns a BLE advertisement for given `request. absl::StatusOr CreateAdvertisement( const BaseBroadcastRequest& request, - absl::optional credential) const; + absl::optional credential) const; // NOLINT absl::StatusOr CreateAdvertisement( const BaseBroadcastRequest& request) const { - return CreateAdvertisement(request, absl::optional()); + return CreateAdvertisement(request, + absl::optional()); // NOLINT } private: absl::StatusOr CreateBaseNpAdvertisement( const BaseBroadcastRequest& request, - absl::optional credential) const; + absl::optional credential) const; // NOLINT absl::StatusOr EncryptDataElements( const LocalCredential& credential, absl::string_view salt, absl::string_view data_elements) const; diff --git a/presence/implementation/advertisement_factory_test.cc b/presence/implementation/advertisement_factory_test.cc index 58de083a..8c2897f8 100644 --- a/presence/implementation/advertisement_factory_test.cc +++ b/presence/implementation/advertisement_factory_test.cc @@ -40,7 +40,6 @@ using ::testing::NiceMock; using ::testing::Return; using ::testing::status::StatusIs; -#ifdef USE_RUST_LDT LocalCredential CreateLocalCredential(IdentityType identity_type) { // Values copied from LDT tests ByteArray seed({204, 219, 36, 137, 233, 252, 172, 66, 179, 147, 72, @@ -60,7 +59,7 @@ LocalCredential CreateLocalCredential(IdentityType identity_type) { TEST(AdvertisementFactory, CreateAdvertisementFromPrivateIdentity) { std::string account_name = "Test account"; std::string salt = "AB"; - constexpr IdentityType kIdentity = IdentityType::IDENTITY_TYPE_PRIVATE; + constexpr IdentityType kIdentity = IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; std::vector data_elements; data_elements.emplace_back(ActionBit::kActiveUnlockAction); Action action = ActionFactory::CreateAction(data_elements); @@ -78,13 +77,13 @@ TEST(AdvertisementFactory, CreateAdvertisementFromPrivateIdentity) { ASSERT_OK(result); EXPECT_FALSE(result->is_extended_advertisement); EXPECT_EQ(absl::BytesToHexString(result->content), - "00514142c2c30e79fee14599e36e34d5d42e49fc37b0df"); + "00514142b8412efb0bc657ba514baf4d1b50ddc842cd1c"); } TEST(AdvertisementFactory, CreateAdvertisementFromTrustedIdentity) { std::string account_name = "Test account"; std::string salt = "AB"; - constexpr IdentityType kIdentity = IdentityType::IDENTITY_TYPE_TRUSTED; + constexpr IdentityType kIdentity = IdentityType::IDENTITY_TYPE_CONTACTS_GROUP; std::vector data_elements; data_elements.emplace_back(ActionBit::kActiveUnlockAction); data_elements.emplace_back(ActionBit::kPresenceManagerAction); @@ -103,35 +102,9 @@ TEST(AdvertisementFactory, CreateAdvertisementFromTrustedIdentity) { ASSERT_OK(result); EXPECT_FALSE(result->is_extended_advertisement); EXPECT_EQ(absl::BytesToHexString(result->content), - "005241428b213e608c378e9941444dcfbedfcb6958a73d"); + "0052414257a35c020f1c547d7e169303196d75da7118ba"); } -TEST(AdvertisementFactory, CreateAdvertisementFromProvisionedIdentity) { - std::string account_name = "Test account"; - std::string salt = "AB"; - constexpr IdentityType kIdentity = IdentityType::IDENTITY_TYPE_PROVISIONED; - std::vector data_elements; - data_elements.emplace_back(ActionBit::kActiveUnlockAction); - data_elements.emplace_back(ActionBit::kPresenceManagerAction); - Action action = ActionFactory::CreateAction(data_elements); - BaseBroadcastRequest request = - BaseBroadcastRequest(BasePresenceRequestBuilder(kIdentity) - .SetAccountName(account_name) - .SetSalt(salt) - .SetTxPower(5) - .SetAction(action)); - - absl::StatusOr result = - AdvertisementFactory().CreateAdvertisement( - request, CreateLocalCredential(kIdentity)); - - ASSERT_OK(result); - EXPECT_FALSE(result->is_extended_advertisement); - EXPECT_EQ(absl::BytesToHexString(result->content), - "005441428b213e608c378e9941444dcfbedfcb6958a73d"); -} -#endif /*USE_RUST_LDT*/ - TEST(AdvertisementFactory, CreateAdvertisementFromPublicIdentity) { std::string salt = "AB"; constexpr IdentityType kIdentity = IdentityType::IDENTITY_TYPE_PUBLIC; @@ -154,7 +127,7 @@ TEST(AdvertisementFactory, CreateAdvertisementFromPublicIdentity) { TEST(AdvertisementFactory, CreateAdvertisementFailsWhenSaltIsTooShort) { std::string salt = "AB"; - constexpr IdentityType kIdentity = internal::IDENTITY_TYPE_PRIVATE; + constexpr IdentityType kIdentity = internal::IDENTITY_TYPE_PRIVATE_GROUP; std::vector data_elements; data_elements.emplace_back(ActionBit::kActiveUnlockAction); Action action = ActionFactory::CreateAction(data_elements); diff --git a/presence/implementation/advertisement_filter.cc b/presence/implementation/advertisement_filter.cc new file mode 100644 index 00000000..36b1001f --- /dev/null +++ b/presence/implementation/advertisement_filter.cc @@ -0,0 +1,120 @@ +// Copyright 2024 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. + +#include "presence/implementation/advertisement_filter.h" + +#include +#include + +#include "absl/types/variant.h" +#include "internal/platform/logging.h" +#include "presence/data_element.h" +#include "presence/implementation/advertisement_decoder.h" +#include "presence/scan_request.h" + +namespace nearby { +namespace presence { + +bool Contains(const std::vector& data_elements, + const DataElement& data_element) { + return std::find(data_elements.begin(), data_elements.end(), data_element) != + data_elements.end(); +} + +bool ContainsAll(const std::vector& data_elements, + const std::vector& extended_properties) { + for (const auto& filter_element : extended_properties) { + if (!Contains(data_elements, filter_element)) { + return false; + } + } + return true; +} + +bool ContainsAny(const std::vector& data_elements, + const std::vector& actions) { + if (actions.empty()) { + return true; + } + for (int action : actions) { + if (Contains(data_elements, DataElement(ActionBit(action)))) { + return true; + } + } + return false; +} + +bool AdvertisementFilter::MatchesScanFilter( + const Advertisement& advertisement) { + // Verify the identity is one requested in the scan_request. + // Per the Public API of scan_request, if identity_types provided in the + // scan_request is empty then decode advertisements of every identity type + auto requested_identity_types = scan_request_.identity_types; + if (!requested_identity_types.empty() && + !(std::find( + requested_identity_types.begin(), requested_identity_types.end(), + advertisement.identity_type) != requested_identity_types.end())) { + NEARBY_LOGS(INFO) + << "Skipping advertisement with identity type: " + << advertisement.identity_type + << " because that identity type was not requested in the scan " + "request"; + return false; + } + + // The advertisement matches the scan request when it matches at least + // one of the filters in the request. + if (scan_request_.scan_filters.empty()) { + return true; + } + + // NOLINT is used to suppress google3-legacy-absl-backport lints because the + // the suggestion is not compatible with Chrome + for (const auto& filter : scan_request_.scan_filters) { + if (absl::holds_alternative(filter)) { // NOLINT + if (MatchesScanFilter(advertisement.data_elements, + absl::get(filter))) { // NOLINT + return true; + } + } else if (absl::holds_alternative( // NOLINT + filter)) { + if (MatchesScanFilter( + advertisement.data_elements, + absl::get(filter))) { // NOLINT + return true; + } + } + } + return false; +} + +bool AdvertisementFilter::MatchesScanFilter( + const std::vector& data_elements, + const PresenceScanFilter& filter) { + // The advertisement must contain all Data Elements in scan request. + return ContainsAll(data_elements, filter.extended_properties); +} + +bool AdvertisementFilter::MatchesScanFilter( + const std::vector& data_elements, + const LegacyPresenceScanFilter& filter) { + // The advertisement must: + // * contain any Action from scan request, + // * contain all Data Elements in scan request. + return ContainsAny(data_elements, filter.actions) && + ContainsAll(data_elements, filter.extended_properties); +} + +} // namespace presence +} // namespace nearby diff --git a/presence/implementation/advertisement_filter.h b/presence/implementation/advertisement_filter.h new file mode 100644 index 00000000..2e2db1e4 --- /dev/null +++ b/presence/implementation/advertisement_filter.h @@ -0,0 +1,46 @@ +// Copyright 2024 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_PRESENCE_IMPLEMENTATION_ADVERTISEMENT_FILTER_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_ADVERTISEMENT_FILTER_H_ + +#include + +#include "presence/data_element.h" +#include "presence/implementation/advertisement_decoder.h" +#include "presence/scan_request.h" + +namespace nearby { +namespace presence { +class AdvertisementFilter { + public: + explicit AdvertisementFilter(ScanRequest scan_request) + : scan_request_(scan_request) {} + + // Returns true if the decoded advertisement in `data_elements` matches the + // filters in `scan_request`. + bool MatchesScanFilter(const Advertisement& adv); + + private: + bool MatchesScanFilter(const std::vector& data_elements, + const PresenceScanFilter& filter); + bool MatchesScanFilter(const std::vector& data_elements, + const LegacyPresenceScanFilter& filter); + ScanRequest scan_request_; +}; + +} // namespace presence +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_ADVERTISEMENT_FILTER_H_ diff --git a/presence/implementation/advertisement_filter_test.cc b/presence/implementation/advertisement_filter_test.cc new file mode 100644 index 00000000..ff3a1dfd --- /dev/null +++ b/presence/implementation/advertisement_filter_test.cc @@ -0,0 +1,174 @@ +// Copyright 2024 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. + +#include "presence/implementation/advertisement_filter.h" + +#include +#include +#include + +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" +#include "gtest/gtest.h" +#include "absl/strings/escaping.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "internal/platform/byte_array.h" +#include "internal/proto/credential.pb.h" +#include "presence/data_element.h" +#include "presence/implementation/advertisement_decoder.h" +#include "presence/scan_request.h" +#include "presence/scan_request_builder.h" + +namespace nearby { +namespace presence { +namespace { + +TEST(AdvertisementFilter, MatchesScanFilterNoFilterPasses) { + std::vector adv = { + DataElement(DataElement::kPrivateGroupIdentityFieldType, "payload")}; + ScanRequest empty_scan_request = {}; + AdvertisementFilter adv_filter(empty_scan_request); + + // A scan request without scan filters matches any advertisement + EXPECT_TRUE(adv_filter.MatchesScanFilter( + {.data_elements = {DataElement( + DataElement::kPrivateGroupIdentityFieldType, "payload")}})); + EXPECT_TRUE(adv_filter.MatchesScanFilter({})); +} + +TEST(AdvertisementFilter, MatchesPresenceScanFilter) { + std::vector adv = { + DataElement(DataElement::kPrivateGroupIdentityFieldType, "payload")}; + DataElement model_id = + DataElement(DataElement::kModelIdFieldType, "model id"); + DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); + DataElement salt2 = DataElement(DataElement::kSaltFieldType, "salt 2"); + PresenceScanFilter filter = {.extended_properties = {model_id, salt}}; + + AdvertisementFilter adv_filter( + ScanRequestBuilder().AddScanFilter(filter).Build()); + + EXPECT_FALSE(adv_filter.MatchesScanFilter({})); + EXPECT_FALSE(adv_filter.MatchesScanFilter({.data_elements = {salt}})); + EXPECT_TRUE( + adv_filter.MatchesScanFilter({.data_elements = {salt, model_id}})); + EXPECT_TRUE( + adv_filter.MatchesScanFilter({.data_elements = {salt, salt2, model_id}})); + EXPECT_FALSE( + adv_filter.MatchesScanFilter({.data_elements = {salt2, model_id}})); +} + +TEST(AdvertisementFilter, MatchesLegacyPresenceScanFilter) { + std::vector adv = { + DataElement(DataElement::kPrivateGroupIdentityFieldType, "payload")}; + DataElement model_id = + DataElement(DataElement::kModelIdFieldType, "model id"); + DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); + DataElement salt2 = DataElement(DataElement::kSaltFieldType, "salt 2"); + LegacyPresenceScanFilter filter = {.extended_properties = {model_id, salt}}; + + AdvertisementFilter adv_filter( + ScanRequestBuilder().AddScanFilter(filter).Build()); + + EXPECT_FALSE(adv_filter.MatchesScanFilter(Advertisement{})); + EXPECT_FALSE(adv_filter.MatchesScanFilter({.data_elements = {salt}})); + EXPECT_TRUE( + adv_filter.MatchesScanFilter({.data_elements = {salt, model_id}})); + EXPECT_TRUE( + adv_filter.MatchesScanFilter({.data_elements = {salt, salt2, model_id}})); + EXPECT_FALSE(adv_filter.MatchesScanFilter( + Advertisement{.data_elements = {salt2, model_id}})); +} + +TEST(AdvertisementFilter, + EncryptedIdentityFilterIgnoresPublicIdentityAdvertisement) { + AdvertisementFilter adv_filter( + {.identity_types = { + internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP, + internal::IdentityType::IDENTITY_TYPE_CONTACTS_GROUP}}); + + EXPECT_FALSE(adv_filter.MatchesScanFilter( + {.identity_type = internal::IdentityType::IDENTITY_TYPE_PUBLIC})); + EXPECT_TRUE(adv_filter.MatchesScanFilter( + {.identity_type = internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP})); +} + +TEST(AdvertisementFilter, PublicIdentityFilterMatchesPublicIdentityAdv) { + AdvertisementFilter adv_filter( + {.identity_types = {internal::IdentityType::IDENTITY_TYPE_PUBLIC}}); + + EXPECT_TRUE(adv_filter.MatchesScanFilter( + {.identity_type = internal::IdentityType::IDENTITY_TYPE_PUBLIC})); + EXPECT_FALSE(adv_filter.MatchesScanFilter( + {.identity_type = internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP})); +} + +TEST(AdvertisementFilter, EmptyIdentityFilterMatchesAllAdvIdentityTypes) { + AdvertisementFilter adv_filter({}); + + EXPECT_TRUE(adv_filter.MatchesScanFilter( + {.identity_type = internal::IdentityType::IDENTITY_TYPE_PUBLIC})); + EXPECT_TRUE(adv_filter.MatchesScanFilter( + {.identity_type = internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP})); +} + +TEST(AdvertisementFilter, MatchesLegacyPresenceScanFilterWithActions) { + std::vector adv = { + DataElement(DataElement::kPrivateGroupIdentityFieldType, "payload")}; + DataElement model_id = + DataElement(DataElement::kModelIdFieldType, "model id"); + DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); + DataElement ttt_action = DataElement(ActionBit::kTapToTransferAction); + LegacyPresenceScanFilter filter = { + .actions = {static_cast(ActionBit::kActiveUnlockAction), + static_cast(ActionBit::kTapToTransferAction)}, + .extended_properties = {model_id, salt}}; + + AdvertisementFilter adv_filter( + ScanRequestBuilder().AddScanFilter(filter).Build()); + + EXPECT_FALSE( + adv_filter.MatchesScanFilter({.data_elements = {salt, model_id}})); + EXPECT_TRUE(adv_filter.MatchesScanFilter( + {.data_elements = {salt, ttt_action, model_id}})); +} + +TEST(AdvertisementFilter, MatchesMultipleFilters) { + std::vector adv = { + DataElement(DataElement::kPrivateGroupIdentityFieldType, "payload")}; + DataElement model_id = + DataElement(DataElement::kModelIdFieldType, "model id"); + DataElement salt = DataElement(DataElement::kSaltFieldType, "salt"); + DataElement ttt_action = DataElement(ActionBit::kTapToTransferAction); + PresenceScanFilter presence_filter = {.extended_properties = {model_id}}; + LegacyPresenceScanFilter legacy_filter = { + .actions = {static_cast(ActionBit::kActiveUnlockAction), + static_cast(ActionBit::kTapToTransferAction)}, + .extended_properties = {salt}}; + + AdvertisementFilter adv_filter(ScanRequestBuilder() + .AddScanFilter(presence_filter) + .AddScanFilter(legacy_filter) + .Build()); + + EXPECT_TRUE(adv_filter.MatchesScanFilter({.data_elements = {model_id}})); + EXPECT_TRUE( + adv_filter.MatchesScanFilter({.data_elements = {salt, ttt_action}})); + EXPECT_FALSE(adv_filter.MatchesScanFilter({.data_elements = {ttt_action}})); +} + +} // namespace +} // namespace presence +} // namespace nearby diff --git a/presence/implementation/base_broadcast_request.cc b/presence/implementation/base_broadcast_request.cc index 935d7ccc..7c524861 100644 --- a/presence/implementation/base_broadcast_request.cc +++ b/presence/implementation/base_broadcast_request.cc @@ -30,7 +30,7 @@ namespace presence { BasePresenceRequestBuilder& BasePresenceRequestBuilder::SetSalt( absl::string_view salt) { if (salt.size() != kSaltSize) { - NEARBY_LOG(WARNING, "Unsupported salt length: %d", salt.size()); + NEARBY_LOGS(WARNING) << "Unsupported salt length: " << salt.size(); } else { salt_ = std::string(salt); } @@ -74,8 +74,7 @@ BasePresenceRequestBuilder::operator BaseBroadcastRequest() const { .action = action_}; std::string bytes(kSaltSize, 0); - crypto::RandBytes(const_cast(bytes.data()), - bytes.size()); + RandBytes(const_cast(bytes.data()), bytes.size()); BaseBroadcastRequest broadcast_request{ .variant = presence, @@ -94,8 +93,8 @@ absl::StatusOr BaseBroadcastRequest::Create( return absl::InvalidArgumentError("Missing broadcast sections"); } if (presence_request.sections.size() > 1) { - NEARBY_LOG(WARNING, - "Only first section is used in BLE 4.2 advertisement"); + NEARBY_LOGS(WARNING) + << "Only first section is used in BLE 4.2 advertisement"; } const PresenceBroadcast::BroadcastSection& section = presence_request.sections.front(); diff --git a/presence/implementation/base_broadcast_request.h b/presence/implementation/base_broadcast_request.h index 2b898a6b..36821ccc 100644 --- a/presence/implementation/base_broadcast_request.h +++ b/presence/implementation/base_broadcast_request.h @@ -17,6 +17,7 @@ #include +#include #include #include "absl/status/statusor.h" diff --git a/presence/implementation/broadcast_manager.cc b/presence/implementation/broadcast_manager.cc index 5bc5ed3a..166ae7ae 100644 --- a/presence/implementation/broadcast_manager.cc +++ b/presence/implementation/broadcast_manager.cc @@ -15,18 +15,26 @@ #include "presence/implementation/broadcast_manager.h" #include -#include +#include #include -#include #include #include #include -#include "absl/time/time.h" +#include "absl/base/thread_annotations.h" +#include "absl/status/status.h" +#include "absl/strings/str_format.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "internal/platform/implementation/crypto.h" -#include "internal/platform/implementation/system_clock.h" #include "internal/platform/logging.h" +#include "presence/broadcast_request.h" +#include "presence/data_types.h" #include "presence/implementation/advertisement_factory.h" +#include "presence/implementation/base_broadcast_request.h" +#include "presence/implementation/mediums/advertisement_data.h" namespace nearby { namespace presence { @@ -146,11 +154,11 @@ void BroadcastManager::FetchCredentials( }}); } -absl::optional BroadcastManager::SelectCredential( +absl::optional BroadcastManager::SelectCredential( // NOLINT BaseBroadcastRequest& broadcast_request, std::vector credentials) { if (credentials.empty()) { - return absl::optional(); + return absl::optional(); // NOLINT } auto credential = std::min_element(credentials.begin(), credentials.end(), @@ -159,25 +167,25 @@ absl::optional BroadcastManager::SelectCredential( }); if (credential == credentials.end()) { NEARBY_LOGS(WARNING) << "No active credentials"; - return absl::optional(); + return absl::optional(); // NOLINT } std::string salt = SelectSalt(*credential, broadcast_request.salt); if (salt != broadcast_request.salt) { - NEARBY_LOGS(VERBOSE) << "Changed salt"; + NEARBY_VLOG(1) << "Changed salt"; broadcast_request.salt = salt; } return *credential; } -absl::optional BroadcastManager::Advertise( +absl::optional BroadcastManager::Advertise( // NOLINT BroadcastSessionId id, BaseBroadcastRequest broadcast_request, std::vector credentials) { auto it = sessions_.find(id); if (it == sessions_.end()) { NEARBY_LOGS(INFO) << "Broadcast session terminated, id: " << id; - return absl::optional(); + return absl::optional(); // NOLINT } - absl::optional credential = + absl::optional credential = // NOLINT SelectCredential(broadcast_request, std::move(credentials)); absl::StatusOr advertisement = AdvertisementFactory().CreateAdvertisement(broadcast_request, credential); @@ -185,7 +193,7 @@ absl::optional BroadcastManager::Advertise( NEARBY_LOGS(WARNING) << "Can't create advertisement, reason: " << advertisement.status(); NotifyStartCallbackStatus(id, advertisement.status()); - return absl::optional(); + return absl::optional(); // NOLINT } std::unique_ptr session = mediums_->GetBle().StartAdvertising( @@ -197,7 +205,7 @@ absl::optional BroadcastManager::Advertise( if (!session) { NotifyStartCallbackStatus(id, absl::InternalError("Can't start advertising")); - return absl::optional(); + return absl::optional(); // NOLINT } it->second.SetAdvertisingSession(std::move(session)); return credential; @@ -225,8 +233,8 @@ void BroadcastManager::StopBroadcast(BroadcastSessionId id) { "stop-broadcast", [this, id]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(executor_) { auto it = sessions_.find(id); if (it == sessions_.end()) { - NEARBY_LOGS(VERBOSE) - << absl::StrFormat("BroadcastSession(0x%x) not found", id); + NEARBY_VLOG(1) << absl::StrFormat("BroadcastSession(0x%x) not found", + id); return; } it->second.StopAdvertising(); diff --git a/presence/implementation/broadcast_manager.h b/presence/implementation/broadcast_manager.h index d9a7fd52..7d274907 100644 --- a/presence/implementation/broadcast_manager.h +++ b/presence/implementation/broadcast_manager.h @@ -21,15 +21,20 @@ #include #include "absl/base/thread_annotations.h" +#include "absl/container/flat_hash_map.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/runnable.h" #include "internal/platform/single_thread_executor.h" -#include "internal/proto/credential.pb.h" #include "presence/broadcast_request.h" #include "presence/data_types.h" #include "presence/implementation/base_broadcast_request.h" #include "presence/implementation/credential_manager.h" #include "presence/implementation/mediums/mediums.h" +#include "presence/power_mode.h" namespace nearby { namespace presence { @@ -84,14 +89,14 @@ class BroadcastManager { void FetchCredentials(BroadcastSessionId id, BaseBroadcastRequest broadcast_request) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_); - absl::optional SelectCredential( + absl::optional SelectCredential( //NOLINT BaseBroadcastRequest& broadcast_request, std::vector credentials); // Returns the private credential, if any, selected to generate the // advertisement. A salt used in the advertisement is added to the returned // private credential. The caller must save it in the storage. - absl::optional Advertise( + absl::optional Advertise( //NOLINT BroadcastSessionId id, BaseBroadcastRequest broadcast_request, std::vector credentials) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_); diff --git a/presence/implementation/broadcast_manager_test.cc b/presence/implementation/broadcast_manager_test.cc index ca578bc9..0e777768 100644 --- a/presence/implementation/broadcast_manager_test.cc +++ b/presence/implementation/broadcast_manager_test.cc @@ -162,7 +162,7 @@ TEST_P(BroadcastManagerTest, StartBroadcastPrivateIdentityFails) { // TODO(b/256249404): Support private identity. absl::StatusOr session = broadcast_manager_.StartBroadcast( - CreateBroadcastRequest(internal::IDENTITY_TYPE_PRIVATE), + CreateBroadcastRequest(internal::IDENTITY_TYPE_PRIVATE_GROUP), CreateBroadcastCallback()); ASSERT_OK(session); diff --git a/presence/implementation/connection_authenticator.h b/presence/implementation/connection_authenticator.h index 0933a966..7a9b2cb8 100644 --- a/presence/implementation/connection_authenticator.h +++ b/presence/implementation/connection_authenticator.h @@ -45,6 +45,8 @@ class ConnectionAuthenticator { using InitiatorData = absl::variant; + virtual ~ConnectionAuthenticator() = default; + // Builds a signed message to be returned to Nearby Connections for // authentication on the other side of the connection. // ukey2_secret - The shared secret derived from the UKEY2 handshake in NC. @@ -53,10 +55,10 @@ class ConnectionAuthenticator { // performing one-way authentication. // shared_credential - The shared credential used to decrypt the advertisement // from the remote device. - absl::StatusOr BuildSignedMessageAsInitiator( + virtual absl::StatusOr BuildSignedMessageAsInitiator( absl::string_view ukey2_secret, std::optional local_credential, - const internal::SharedCredential& shared_credential) const; + const internal::SharedCredential& shared_credential) const = 0; // Builds a signed message to be returned to Nearby Connections for // authentication on the other side of the connection. @@ -64,9 +66,9 @@ class ConnectionAuthenticator { // local_credential - The local credential used to sign the derived // information so the initiator can verify against our // shared credential. - absl::StatusOr BuildSignedMessageAsResponder( + virtual absl::StatusOr BuildSignedMessageAsResponder( absl::string_view ukey2_secret, - const internal::LocalCredential& local_credential) const; + const internal::LocalCredential& local_credential) const = 0; // Verifies a signed message received from the responder (broadcaster) of the // Nearby Presence advertisement. @@ -75,22 +77,24 @@ class ConnectionAuthenticator { // ukey2_secret - the shared secret derived from the ukey2 handshake in NC. // shared_credentials - the set of shared credentials that can be used to // verify the responder data. - absl::Status VerifyMessageAsInitiator( + virtual absl::Status VerifyMessageAsInitiator( ResponderData authentication_data, absl::string_view ukey2_secret, - const std::vector& shared_credentials) const; + const std::vector& shared_credentials) + const = 0; // Verifies a signed message received from the Nearby Connections peer. - // Returns absl::OkStatus() if the verification was successful. + // Returns the matched local credential if the verification was successful. // ukey2_secret - The shared secret derived from the UKEY2 handshake in NC. // received_frame - The received frame from Nearby Connections. // local_credentials - The set of local credentials that may contain the // required keyseed hash. // shared_credentials - The set of shared credentials that can be used to // verify the signed contents of the frame. - absl::StatusOr VerifyMessageAsResponder( + virtual absl::StatusOr VerifyMessageAsResponder( absl::string_view ukey2_secret, InitiatorData initiator_data, const std::vector& local_credentials, - const std::vector& shared_credentials) const; + const std::vector& shared_credentials) + const = 0; }; } // namespace presence diff --git a/presence/implementation/connection_authenticator.cc b/presence/implementation/connection_authenticator_impl.cc similarity index 96% rename from presence/implementation/connection_authenticator.cc rename to presence/implementation/connection_authenticator_impl.cc index 4ee90609..cbe68aa2 100644 --- a/presence/implementation/connection_authenticator.cc +++ b/presence/implementation/connection_authenticator_impl.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "presence/implementation/connection_authenticator.h" +#include "presence/implementation/connection_authenticator_impl.h" #include #include @@ -47,7 +47,7 @@ constexpr char kDiscovererHkdfInfo[] = } // namespace absl::StatusOr -ConnectionAuthenticator::BuildSignedMessageAsInitiator( +ConnectionAuthenticatorImpl::BuildSignedMessageAsInitiator( absl::string_view ukey2_secret, std::optional local_credential, const internal::SharedCredential& shared_credential) const { @@ -78,7 +78,7 @@ ConnectionAuthenticator::BuildSignedMessageAsInitiator( } absl::StatusOr -ConnectionAuthenticator::BuildSignedMessageAsResponder( +ConnectionAuthenticatorImpl::BuildSignedMessageAsResponder( absl::string_view ukey2_secret, const internal::LocalCredential& local_credential) const { auto signer = crypto::Ed25519Signer::Create( @@ -95,7 +95,7 @@ ConnectionAuthenticator::BuildSignedMessageAsResponder( *pkey_signature}; } -absl::Status ConnectionAuthenticator::VerifyMessageAsInitiator( +absl::Status ConnectionAuthenticatorImpl::VerifyMessageAsInitiator( ResponderData authentication_data, absl::string_view ukey2_secret, const std::vector& shared_credentials) const { if (authentication_data.private_key_signature.empty()) { @@ -119,7 +119,7 @@ absl::Status ConnectionAuthenticator::VerifyMessageAsInitiator( } absl::StatusOr -ConnectionAuthenticator::VerifyMessageAsResponder( +ConnectionAuthenticatorImpl::VerifyMessageAsResponder( absl::string_view ukey2_secret, InitiatorData initiator_data, const std::vector& local_credentials, const std::vector& shared_credentials) const { diff --git a/presence/implementation/connection_authenticator_impl.h b/presence/implementation/connection_authenticator_impl.h new file mode 100644 index 00000000..25f42ddc --- /dev/null +++ b/presence/implementation/connection_authenticator_impl.h @@ -0,0 +1,85 @@ +// Copyright 2023 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_PRESENCE_IMPLEMENTATION_CONNECTION_AUTHENTICATOR_IMPL_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_CONNECTION_AUTHENTICATOR_IMPL_H_ + +#include +#include + +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/proto/credential.pb.h" +#include "internal/proto/local_credential.pb.h" +#include "presence/implementation/connection_authenticator.h" + +namespace nearby { +namespace presence { + +class ConnectionAuthenticatorImpl : public ConnectionAuthenticator { + public: + // Builds a signed message to be returned to Nearby Connections for + // authentication on the other side of the connection. + // ukey2_secret - The shared secret derived from the UKEY2 handshake in NC. + // local_credential - The local credential used to sign the derived + // information. If this is std::nullopt, then we will be + // performing one-way authentication. + // shared_credential - The shared credential used to decrypt the advertisement + // from the remote device. + absl::StatusOr BuildSignedMessageAsInitiator( + absl::string_view ukey2_secret, + std::optional local_credential, + const internal::SharedCredential& shared_credential) const override; + + // Builds a signed message to be returned to Nearby Connections for + // authentication on the other side of the connection. + // ukey2_secret - The shared secret derived from the UKEY2 handshake in NC. + // local_credential - The local credential used to sign the derived + // information so the initiator can verify against our + // shared credential. + absl::StatusOr BuildSignedMessageAsResponder( + absl::string_view ukey2_secret, + const internal::LocalCredential& local_credential) const override; + + // Verifies a signed message received from the responder (broadcaster) of the + // Nearby Presence advertisement. + // authentication_data - the data required to verify the connection, received + // from the responder. + // ukey2_secret - the shared secret derived from the ukey2 handshake in NC. + // shared_credentials - the set of shared credentials that can be used to + // verify the responder data. + absl::Status VerifyMessageAsInitiator( + ResponderData authentication_data, absl::string_view ukey2_secret, + const std::vector& shared_credentials) + const override; + + // Verifies a signed message received from the Nearby Connections peer. + // ukey2_secret - The shared secret derived from the UKEY2 handshake in NC. + // received_frame - The received frame from Nearby Connections. + // local_credentials - The set of local credentials that may contain the + // required keyseed hash. + // shared_credentials - The set of shared credentials that can be used to + // verify the signed contents of the frame. + absl::StatusOr VerifyMessageAsResponder( + absl::string_view ukey2_secret, InitiatorData initiator_data, + const std::vector& local_credentials, + const std::vector& shared_credentials) + const override; +}; + +} // namespace presence +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_CONNECTION_AUTHENTICATOR_IMPL_H_ diff --git a/presence/implementation/connection_authenticator_test.cc b/presence/implementation/connection_authenticator_impl_test.cc similarity index 87% rename from presence/implementation/connection_authenticator_test.cc rename to presence/implementation/connection_authenticator_impl_test.cc index 5e2e042e..e28eb477 100644 --- a/presence/implementation/connection_authenticator_test.cc +++ b/presence/implementation/connection_authenticator_impl_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "presence/implementation/connection_authenticator.h" +#include "presence/implementation/connection_authenticator_impl.h" #include #include @@ -79,8 +79,8 @@ class PresenceAuthenticatorTest : public ::testing::Test { }; TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerify) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( kUkey2Secret, initiator_local_credential_, @@ -93,8 +93,8 @@ TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerify) { } TEST_F(PresenceAuthenticatorTest, TestOneWayInitiatorSignResponderVerify) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN( ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( @@ -107,8 +107,8 @@ TEST_F(PresenceAuthenticatorTest, TestOneWayInitiatorSignResponderVerify) { } TEST_F(PresenceAuthenticatorTest, TestResponderSignInitiatorVerify) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::ResponderData auth_data, responder_authenticator.BuildSignedMessageAsResponder( kUkey2Secret, responder_local_credential_)); @@ -118,8 +118,8 @@ TEST_F(PresenceAuthenticatorTest, TestResponderSignInitiatorVerify) { TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerifyNoSharedCredentialMatchFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( kUkey2Secret, initiator_local_credential_, @@ -131,8 +131,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestOneWayInitiatorSignResponderVerifyNoMatchCredentialFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN( ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( @@ -144,8 +144,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestOneWayInitiatorSignResponderVerifyNoCredentialFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN( ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( @@ -157,8 +157,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerifyNoMatchCredentialFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( kUkey2Secret, initiator_local_credential_, @@ -170,8 +170,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerifyWrongKeyFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( kUkey2Secret, initiator_local_credential_, @@ -184,8 +184,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestResponderSignInitiatorVerifyNoMatchCredentialFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::ResponderData auth_data, responder_authenticator.BuildSignedMessageAsResponder( kUkey2Secret, responder_local_credential_)); @@ -196,8 +196,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestResponderSignInitiatorVerifyWrongKeyFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::ResponderData auth_data, responder_authenticator.BuildSignedMessageAsResponder( kUkey2Secret, responder_local_credential_)); @@ -209,8 +209,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerifyNoCidHashFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( kUkey2Secret, initiator_local_credential_, @@ -225,8 +225,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestTwoWayInitiatorSignResponderVerifyNoPkeySigFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( kUkey2Secret, initiator_local_credential_, @@ -241,8 +241,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestOneWayInitiatorSignResponderVerifyNoCidHashFails) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN( ConnectionAuthenticator::InitiatorData auth_data, initiator_authenticator.BuildSignedMessageAsInitiator( @@ -257,8 +257,8 @@ TEST_F(PresenceAuthenticatorTest, TEST_F(PresenceAuthenticatorTest, TestResponderSignInitiatorVerifyNoPkeySigFail) { - ConnectionAuthenticator responder_authenticator; - ConnectionAuthenticator initiator_authenticator; + ConnectionAuthenticatorImpl responder_authenticator; + ConnectionAuthenticatorImpl initiator_authenticator; ASSERT_OK_AND_ASSIGN(ConnectionAuthenticator::ResponderData auth_data, responder_authenticator.BuildSignedMessageAsResponder( kUkey2Secret, responder_local_credential_)); diff --git a/presence/implementation/credential_manager.h b/presence/implementation/credential_manager.h index a8f206f3..2d4e088b 100644 --- a/presence/implementation/credential_manager.h +++ b/presence/implementation/credential_manager.h @@ -19,7 +19,6 @@ #include #include -#include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "internal/platform/implementation/credential_callbacks.h" #include "internal/proto/credential.pb.h" @@ -47,7 +46,7 @@ class CredentialManager { // The user’s own public credentials won’t be saved on local credential // storage. virtual void GenerateCredentials( - const nearby::internal::Metadata& metadata, + const nearby::internal::DeviceIdentityMetaData& device_identity_metadata, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, @@ -91,23 +90,23 @@ class CredentialManager { // `UnsubscribeFromPublicCredentials()` return. virtual void UnsubscribeFromPublicCredentials(SubscriberId id) = 0; - // Decrypts the device metadata from a public credential. + // Decrypts the device identity metadata from a public credential. // Returns an empty string if decryption fails. - virtual std::string DecryptMetadata(absl::string_view metadata_encryption_key, - absl::string_view key_seed, - absl::string_view metadata_string) = 0; + virtual std::string DecryptDeviceIdentityMetaData( + absl::string_view metadata_encryption_key, absl::string_view key_seed, + absl::string_view metadata_string) = 0; - // Sets the NP service's device metadata, regenerating credentials if - // `regen_credentials` is set to true. - virtual void SetLocalDeviceMetadata( - const ::nearby::internal::Metadata& metadata, bool regen_credentials, - absl::string_view manager_app_id, + // If `regen_credentials` is set to true, regenerating credentials. + virtual void SetDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) = 0; - // Gets the NP service's device metadata. - virtual ::nearby::internal::Metadata GetLocalDeviceMetadata() = 0; + virtual ::nearby::internal::DeviceIdentityMetaData + GetDeviceIdentityMetaData() = 0; }; } // namespace presence diff --git a/presence/implementation/credential_manager_impl.cc b/presence/implementation/credential_manager_impl.cc index f5bafad8..8c552316 100644 --- a/presence/implementation/credential_manager_impl.cc +++ b/presence/implementation/credential_manager_impl.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -26,20 +27,15 @@ #include "absl/status/status.h" #include "absl/strings/string_view.h" #include "absl/time/time.h" +#include "absl/types/span.h" #include "absl/types/variant.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" -#ifdef NEARBY_CHROMIUM -#include "crypto/aead.h" -#include "crypto/ec_private_key.h" -#include "crypto/hkdf.h" -#include "crypto/random.h" -#else #include "internal/crypto_cros/aead.h" #include "internal/crypto_cros/ec_private_key.h" #include "internal/crypto_cros/hkdf.h" -#include "internal/crypto_cros/random.h" -#endif #include "internal/platform/base64_utils.h" +#include "internal/platform/crypto.h" #include "internal/platform/future.h" #include "internal/platform/implementation/credential_callbacks.h" #include "internal/platform/implementation/crypto.h" @@ -66,10 +62,16 @@ using ::nearby::internal::SharedCredential; // Key to retrieve local device's Private/Public Key Credentials from key store. constexpr char kPairedKeyAliasPrefix[] = "nearby_presence_paired_key_alias_"; +// Use an empty string because Chromium only supports 1 account. +// Windows & Apple will have their own Identity Provider. +constexpr absl::string_view kEmptyAccountName = ""; + // The expected number of valid local credentials to be stored on local device. constexpr int kExpectedValidLocalCredtialSize = 6; // The expiration time in days for a credential. constexpr int kCredentialLifeCycleDays = 5; +// The minimum size of bytes to generate credential id. +constexpr int kExpectedByteSizeOfCredentialId = 8; // Returns a random duration in [0, max_duration] range. absl::Duration RandomDuration(absl::Duration max_duration) { @@ -78,7 +80,7 @@ absl::Duration RandomDuration(absl::Duration max_duration) { } std::string CustomizeBytesSize(absl::string_view bytes, size_t len) { - return ::crypto::HkdfSha256( + return crypto::HkdfSha256( /*ikm=*/std::string(bytes), // NOLINT /*salt=*/std::string(CredentialManagerImpl::kAuthenticityKeyByteSize, 0), /*info=*/"", /*derived_key_size=*/len); @@ -86,8 +88,32 @@ std::string CustomizeBytesSize(absl::string_view bytes, size_t len) { } // namespace +// Returns a positive long value extracted from a byte array. +int64_t GenerateIdFromByteArray(const ByteArray& input) { + size_t inputLength = input.size(); + + ByteArray processed_bytes(kExpectedByteSizeOfCredentialId); + // Only use first 8 bytes if the input is longer than 8 bytes. + if (inputLength > kExpectedByteSizeOfCredentialId) { + processed_bytes.CopyAt(0, input); + } else { + // Extend the input with zeros if it's shorter than 8 bytes + processed_bytes.CopyAt(kExpectedByteSizeOfCredentialId - inputLength, + input); + } + + int64_t id = 0; + for (int i = 0; i < kExpectedByteSizeOfCredentialId; ++i) { + id |= (static_cast(processed_bytes.data()[i]) << (8 * i)); + } + if (id == std::numeric_limits::min()) + return std::numeric_limits::max(); + return std::abs(id); +} + void CredentialManagerImpl::GenerateCredentials( - const Metadata& metadata, absl::string_view manager_app_id, + const DeviceIdentityMetaData& device_identity_metadata, + absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) { @@ -98,8 +124,9 @@ void CredentialManagerImpl::GenerateCredentials( absl::Time start_time = SystemClock::ElapsedRealtime(); absl::Duration gap = credential_life_cycle_days * absl::Hours(24); for (int index = 0; index < contiguous_copy_of_credentials; index++) { - auto public_private_credentials = CreateLocalCredential( - metadata, identity_type, start_time, start_time + gap); + auto public_private_credentials = + CreateLocalCredential(device_identity_metadata, identity_type, + start_time, start_time + gap); if (public_private_credentials.second.identity_type() != IdentityType::IDENTITY_TYPE_UNSPECIFIED) { private_credentials.push_back(public_private_credentials.first); @@ -111,12 +138,12 @@ void CredentialManagerImpl::GenerateCredentials( // Create credential_storage object and invoke SaveCredentials. credential_storage_ptr_->SaveCredentials( - manager_app_id, metadata.account_name(), private_credentials, + manager_app_id, kEmptyAccountName, private_credentials, public_credentials, PublicCredentialType::kLocalPublicCredential, SaveCredentialsResultCallback{ .credentials_saved_cb = [this, manager_app_id = std::string(manager_app_id), - account_name = metadata.account_name(), + account_name = kEmptyAccountName, callback = std::move(credentials_generated_cb), public_credentials](absl::Status status) mutable { if (!status.ok()) { @@ -171,10 +198,9 @@ void CredentialManagerImpl::UpdateRemotePublicCredentials( } std::pair -CredentialManagerImpl::CreateLocalCredential(const Metadata& metadata, - IdentityType identity_type, - absl::Time start_time, - absl::Time end_time) { +CredentialManagerImpl::CreateLocalCredential( + const DeviceIdentityMetaData& device_identity_metadata, + IdentityType identity_type, absl::Time start_time, absl::Time end_time) { LocalCredential private_credential; private_credential.set_start_time_millis(absl::ToUnixMillis(start_time)); private_credential.set_end_time_millis(absl::ToUnixMillis(end_time)); @@ -182,8 +208,8 @@ CredentialManagerImpl::CreateLocalCredential(const Metadata& metadata, // Creates an AES key to encrypt the whole broadcast. std::string secret_key(kAuthenticityKeyByteSize, 0); - crypto::RandBytes(const_cast(secret_key.data()), - secret_key.size()); + RandBytes(const_cast(secret_key.data()), + secret_key.size()); private_credential.set_key_seed(secret_key); // Uses SHA-256 algorithm to generate the credential ID from the @@ -193,7 +219,7 @@ CredentialManagerImpl::CreateLocalCredential(const Metadata& metadata, // empty ByteArray. CHECK(!secret_id.Empty()) << "Crypto::Sha256 failed!"; - private_credential.set_secret_id(std::string(secret_id.AsStringView())); + private_credential.set_id(GenerateIdFromByteArray(secret_id)); std::string alias = Base64Utils::Encode(secret_id); auto prefixedAlias = kPairedKeyAliasPrefix + alias; @@ -204,10 +230,10 @@ CredentialManagerImpl::CreateLocalCredential(const Metadata& metadata, key_pair->ExportPrivateKey(&private_key); private_credential.mutable_connection_signing_key()->set_key( std::string(private_key.begin(), private_key.end())); - // Create an AES key to encrypt the device metadata. + // Create an AES key to encrypt the device identity metadata. std::string metadata_key(kBaseMetadataSize, 0); - crypto::RandBytes(const_cast(metadata_key.data()), - metadata_key.size()); + RandBytes(const_cast(metadata_key.data()), + metadata_key.size()); private_credential.set_metadata_encryption_key_v0(metadata_key); // Generate the public credential @@ -216,11 +242,13 @@ CredentialManagerImpl::CreateLocalCredential(const Metadata& metadata, return std::pair( private_credential, - CreatePublicCredential(private_credential, metadata, public_key)); + CreatePublicCredential(private_credential, device_identity_metadata, + public_key)); } SharedCredential CredentialManagerImpl::CreatePublicCredential( - const LocalCredential& private_credential, const Metadata& metadata, + const LocalCredential& private_credential, + const DeviceIdentityMetaData& device_identity_metadata, const std::vector& public_key) { // The start time in the public credential should be decreased by a random // value in 0 - 3 hours range. @@ -234,7 +262,7 @@ SharedCredential CredentialManagerImpl::CreatePublicCredential( RandomDuration(absl::Hours(3)); SharedCredential public_credential; public_credential.set_identity_type(private_credential.identity_type()); - public_credential.set_secret_id(private_credential.secret_id()); + public_credential.set_id(private_credential.id()); public_credential.set_key_seed(private_credential.key_seed()); public_credential.set_start_time_millis(absl::ToUnixMillis(start_time)); public_credential.set_end_time_millis(absl::ToUnixMillis(end_time)); @@ -248,13 +276,13 @@ SharedCredential CredentialManagerImpl::CreatePublicCredential( public_credential.set_metadata_encryption_key_tag_v0( std::string(metadata_encryption_key_tag.AsStringView())); - // Encrypt the device metadata - auto encrypted_meta_data = EncryptMetadata( + auto encrypted_meta_data = EncryptDeviceIdentityMetaData( private_credential.metadata_encryption_key_v0(), - private_credential.key_seed(), metadata.SerializeAsString()); + private_credential.key_seed(), + device_identity_metadata.SerializeAsString()); if (encrypted_meta_data.empty()) { - NEARBY_LOGS(ERROR) << "Fails to encrypt the device metadata."; + NEARBY_LOGS(ERROR) << "Fails to encrypt the device identity metadata."; public_credential.set_identity_type( IdentityType::IDENTITY_TYPE_UNSPECIFIED); return public_credential; @@ -264,7 +292,7 @@ SharedCredential CredentialManagerImpl::CreatePublicCredential( return public_credential; } -std::string CredentialManagerImpl::DecryptMetadata( +std::string CredentialManagerImpl::DecryptDeviceIdentityMetaData( absl::string_view metadata_encryption_key, absl::string_view key_seed, absl::string_view metadata_string) { crypto::Aead aead(crypto::Aead::AeadAlgorithm::AES_256_GCM); @@ -281,12 +309,12 @@ std::string CredentialManagerImpl::DecryptMetadata( auto result = aead.Open(encrypted_metadata_bytes, /*nonce=*/ iv_bytes, - /*additional_data=*/CryptoSpan()); + /*additional_data=*/absl::Span()); return std::string(result.value().begin(), result.value().end()); } -std::string CredentialManagerImpl::EncryptMetadata( +std::string CredentialManagerImpl::EncryptDeviceIdentityMetaData( absl::string_view metadata_encryption_key, absl::string_view key_seed, absl::string_view metadata_string) { crypto::Aead aead(crypto::Aead::AeadAlgorithm::AES_256_GCM); @@ -306,7 +334,7 @@ std::string CredentialManagerImpl::EncryptMetadata( auto encrypted = aead.Seal(metadata_bytes, /*nonce=*/ iv_bytes, - /*additional_data=*/CryptoSpan()); + /*additional_data=*/absl::Span()); return std::string(encrypted.begin(), encrypted.end()); } @@ -316,42 +344,36 @@ std::vector CredentialManagerImpl::ExtendMetadataEncryptionKey( return crypto::HkdfSha256( std::vector(metadata_encryption_key.begin(), metadata_encryption_key.end()), - /*salt=*/CryptoSpan(), - /*info=*/CryptoSpan(), kNearbyPresenceNumBytesAesGcmKeySize); + /*salt=*/absl::Span(), + /*info=*/absl::Span(), kNearbyPresenceNumBytesAesGcmKeySize); } void CredentialManagerImpl::GetLocalCredentials( const CredentialSelector& credential_selector, GetLocalCredentialsResultCallback callback) { - CountDownLatch get_local_credentials_latch(1); - absl::StatusOr> get_local_credentials_result; credential_storage_ptr_->GetLocalCredentials( credential_selector, GetLocalCredentialsResultCallback{ .credentials_fetched_cb = - [get_local_credentials_latch, &get_local_credentials_result]( + [this, credential_selector, callback = std::move(callback)]( absl::StatusOr> - credentials) mutable { - get_local_credentials_result = std::move(credentials); - get_local_credentials_latch.CountDown(); + get_local_credentials_result) mutable { + if (!get_local_credentials_result.ok()) { + callback.credentials_fetched_cb( + get_local_credentials_result.status()); + return; + } + + CheckCredentialsAndRefillIfNeeded( + credential_selector, + /* credentials_list_variant */ + &get_local_credentials_result.value(), + /* callback_for_local_credentials */ + std::move(callback), + /* callback_for_shared_credentials */ + std::nullopt); }, }); - if (!WaitForLatch("GetLocalCredentials", &get_local_credentials_latch)) { - NEARBY_LOGS(INFO) << "Failed in awaiting GetLocalCredentials"; - callback.credentials_fetched_cb( - absl::DeadlineExceededError("Failed in awaiting GetLocalCredentials")); - return; - } - if (!get_local_credentials_result.ok()) { - callback.credentials_fetched_cb(get_local_credentials_result.status()); - return; - } - - CheckCredentialsAndRefillIfNeeded( - credential_selector, - /* cal_credentials_list_variant */ &get_local_credentials_result.value(), - /* callback_for_local_credentials */ std::move(callback), - /* callback_for_shared_credentials */ std::nullopt); } void CredentialManagerImpl::GetPublicCredentials( @@ -365,35 +387,28 @@ void CredentialManagerImpl::GetPublicCredentials( return; } - CountDownLatch get_shared_credentials_latch(1); - absl::StatusOr> get_shared_credentials_result; credential_storage_ptr_->GetPublicCredentials( credential_selector, public_credential_type, GetPublicCredentialsResultCallback{ .credentials_fetched_cb = - [get_shared_credentials_latch, &get_shared_credentials_result]( + [this, credential_selector, callback = std::move(callback)]( absl::StatusOr> - credentials) mutable { - get_shared_credentials_result = std::move(credentials); - get_shared_credentials_latch.CountDown(); + get_shared_credentials_result) mutable { + if (!get_shared_credentials_result.ok()) { + callback.credentials_fetched_cb( + get_shared_credentials_result.status()); + return; + } + + CheckCredentialsAndRefillIfNeeded( + credential_selector, + /* credentials_list_variant */ + &get_shared_credentials_result.value(), + /* callback_for_local_credentials */ std::nullopt, + /* callback_for_shared_credentials */ + std::move(callback)); }, }); - if (!WaitForLatch("GetSharedCredentials", &get_shared_credentials_latch)) { - NEARBY_LOGS(INFO) << "Failed in awaiting GetSharedCredentials"; - callback.credentials_fetched_cb( - absl::DeadlineExceededError("Failed in awaiting GetsharedCredentials")); - return; - } - if (!get_shared_credentials_result.ok()) { - callback.credentials_fetched_cb(get_shared_credentials_result.status()); - return; - } - - CheckCredentialsAndRefillIfNeeded( - credential_selector, - /* credentials_list_variant */ &get_shared_credentials_result.value(), - /* callback_for_local_credentials */ std::nullopt, - /* callback_for_shared_credentials */ std::move(callback)); } ExceptionOr> @@ -432,6 +447,9 @@ CredentialManagerImpl::GetPublicCredentialsSync( return result.Get(timeout); } +// TODO(b/326063431): The intent of this method is likely for +// GetPublicCredentials() to be called after the AddSubscriber() calls, but +// it's unlikely that this is happening on a real device. Manually verify. SubscriberId CredentialManagerImpl::SubscribeForPublicCredentials( const CredentialSelector& credential_selector, PublicCredentialType public_credential_type, @@ -635,121 +653,159 @@ void CredentialManagerImpl::CheckCredentialsAndRefillIfNeeded( return; } - std::vector newly_generated_local_credentials; - std::vector newly_generated_shared_credentials; - // Generate more credential pairs to refill the expired ones. - auto start_time = absl::FromUnixMillis(last_valid_end_time_millis); - auto gap = kCredentialLifeCycleDays * absl::Hours(24); - for (int i = 0; i < kExpectedValidLocalCredtialSize - valid_credentials_count; - i++) { - auto pair = - CreateLocalCredential(metadata_, credential_selector.identity_type, - start_time, start_time + gap); - newly_generated_local_credentials.push_back(pair.first); - newly_generated_shared_credentials.push_back(pair.second); - start_time += gap; - } - - // Already got the merged valid credential list for either local or shared. - // Now get the other credentials list from storage. - CountDownLatch get_corresponding_credentials_latch(1); + // Already got the valid credential list for either local or shared. + // Now get the other credentials list from storage, prune them, and begin + // the process of appending new credentials onto them. if (invoked_for_local) { - absl::StatusOr> - get_shared_result; credential_storage_ptr_->GetPublicCredentials( credential_selector, PublicCredentialType::kLocalPublicCredential, GetPublicCredentialsResultCallback{ .credentials_fetched_cb = - [get_corresponding_credentials_latch, &get_shared_result]( + [this, current_time_millis, last_valid_end_time_millis, + credential_selector, + valid_local_credentials = std::move(valid_local_credentials), + valid_shared_credentials = std::move(valid_shared_credentials), + callback_for_local_credentials = + std::move(callback_for_local_credentials), + callback_for_shared_credentials = + std::move(callback_for_shared_credentials)]( absl::StatusOr< std::vector> result) mutable { - get_shared_result = std::move(result); - get_corresponding_credentials_latch.CountDown(); + if (!result.ok()) { + callback_for_local_credentials.value() + .credentials_fetched_cb(result.status()); + return; + } + for (const auto& credential : result.value()) { + if (credential.end_time_millis() >= current_time_millis) { + valid_shared_credentials.push_back(credential); + } + } + + RefillRemainingValidCredentialsWithNewCredentials( + credential_selector, valid_local_credentials, + valid_shared_credentials, + /*start_time_to_generate_new_credentials_millis=*/ + last_valid_end_time_millis, + std::move(callback_for_local_credentials), + std::move(callback_for_shared_credentials)); }, }); - if (!WaitForLatch( - "CheckCredentialsAndRefillIfNeeded-GetCorrespondingShared", - &get_corresponding_credentials_latch)) { - callback_for_local_credentials.value().credentials_fetched_cb( - absl::DeadlineExceededError("Failed in GetLocalCredentials")); - return; - } - if (!get_shared_result.ok()) { - callback_for_local_credentials.value().credentials_fetched_cb( - get_shared_result.status()); - return; - } - for (const auto& credential : get_shared_result.value()) { - if (credential.end_time_millis() >= current_time_millis) { - valid_shared_credentials.push_back(credential); - } - } } else { - absl::StatusOr> - get_local_result; credential_storage_ptr_->GetLocalCredentials( credential_selector, GetLocalCredentialsResultCallback{ .credentials_fetched_cb = - [get_corresponding_credentials_latch, &get_local_result]( + [this, current_time_millis, last_valid_end_time_millis, + credential_selector, + valid_local_credentials = std::move(valid_local_credentials), + valid_shared_credentials = std::move(valid_shared_credentials), + callback_for_local_credentials = + std::move(callback_for_local_credentials), + callback_for_shared_credentials = + std::move(callback_for_shared_credentials)]( absl::StatusOr< std::vector> result) mutable { - get_local_result = std::move(result); - get_corresponding_credentials_latch.CountDown(); + if (!result.ok()) { + callback_for_local_credentials.value() + .credentials_fetched_cb(result.status()); + return; + } + for (const auto& credential : result.value()) { + if (credential.end_time_millis() >= current_time_millis) { + valid_local_credentials.push_back( + credential); // RESTORE TODO + } + } + + RefillRemainingValidCredentialsWithNewCredentials( + credential_selector, valid_local_credentials, + valid_shared_credentials, + /*start_time_to_generate_new_credentials_millis=*/ + last_valid_end_time_millis, + std::move(callback_for_local_credentials), + std::move(callback_for_shared_credentials)); }, }); - if (!WaitForLatch("CheckCredentialsAndRefillIfNeeded-GetCorrespondingLocal", - &get_corresponding_credentials_latch)) { - callback_for_shared_credentials.value().credentials_fetched_cb( - absl::DeadlineExceededError( - "Failed in awaiting corresponding GetSharedCredentials")); - return; - } - if (!get_local_result.ok()) { - callback_for_local_credentials.value().credentials_fetched_cb( - get_local_result.status()); - return; - } - for (const auto& credential : get_local_result.value()) { - if (credential.end_time_millis() >= current_time_millis) { - valid_local_credentials.push_back(credential); - } - } + } +} + +void CredentialManagerImpl::RefillRemainingValidCredentialsWithNewCredentials( + const CredentialSelector& credential_selector, + std::vector valid_local_credentials, + std::vector valid_shared_credentials, + int64_t start_time_to_generate_new_credentials_millis, + std::optional + callback_for_local_credentials, + std::optional + callback_for_shared_credentials) { + // The number of valid credentials has already been determined by pruning + // valid_local_credentials and valid_shared_credentials. They must match + // in size. + int valid_credentials_count = valid_local_credentials.size(); + CHECK_EQ(valid_credentials_count, valid_shared_credentials.size()); + + std::vector newly_generated_local_credentials; + std::vector newly_generated_shared_credentials; + + // Generate more credential pairs to refill the expired ones. + auto start_time = + absl::FromUnixMillis(start_time_to_generate_new_credentials_millis); + auto gap = kCredentialLifeCycleDays * absl::Hours(24); + for (int i = 0; i < kExpectedValidLocalCredtialSize - valid_credentials_count; + i++) { + auto pair = CreateLocalCredential(device_identity_metadata_, + credential_selector.identity_type, + start_time, start_time + gap); + newly_generated_local_credentials.push_back(std::move(pair.first)); + newly_generated_shared_credentials.push_back(std::move(pair.second)); + start_time += gap; } - // Now merge newly generated credentails to already existing valid ones. + // Now merge newly generated credentials to already existing valid ones. valid_local_credentials.insert(valid_local_credentials.end(), newly_generated_local_credentials.begin(), newly_generated_local_credentials.end()); valid_shared_credentials.insert(valid_shared_credentials.end(), newly_generated_shared_credentials.begin(), newly_generated_shared_credentials.end()); + // Save merged local and shared credential lists to storage - CountDownLatch save_credentials_latch(1); - absl::Status save_credentials_status; credential_storage_ptr_->SaveCredentials( credential_selector.manager_app_id, credential_selector.account_name, valid_local_credentials, valid_shared_credentials, PublicCredentialType::kLocalPublicCredential, SaveCredentialsResultCallback{ .credentials_saved_cb = - [save_credentials_latch, - &save_credentials_status](absl::Status status) mutable { - save_credentials_status = status; - save_credentials_latch.CountDown(); + [this, valid_local_credentials, valid_shared_credentials, + callback_for_local_credentials = + std::move(callback_for_local_credentials), + callback_for_shared_credentials = + std::move(callback_for_shared_credentials)]( + absl::Status status) mutable { + OnCredentialRefillComplete( + std::move(status), valid_local_credentials, + valid_shared_credentials, + std::move(callback_for_local_credentials), + std::move(callback_for_shared_credentials)); }, }); - if (!WaitForLatch("CheckCredentialsAndRefillIfNeeded-SaveCredentials", - &save_credentials_latch)) { - save_credentials_status = - absl::DeadlineExceededError("Failed in awaiting SaveCredentials"); - } +} + +void CredentialManagerImpl::OnCredentialRefillComplete( + absl::Status save_credentials_status, + std::vector valid_local_credentials, + std::vector valid_shared_credentials, + std::optional + callback_for_local_credentials, + std::optional + callback_for_shared_credentials) { if (!save_credentials_status.ok()) { NEARBY_LOGS(ERROR) << "Save credentials failed with: " << save_credentials_status; - if (invoked_for_local) { + if (callback_for_local_credentials.has_value()) { callback_for_local_credentials.value().credentials_fetched_cb( save_credentials_status); } else { @@ -758,7 +814,8 @@ void CredentialManagerImpl::CheckCredentialsAndRefillIfNeeded( } return; } - if (invoked_for_local) { + + if (callback_for_local_credentials.has_value()) { callback_for_local_credentials.value().credentials_fetched_cb( valid_local_credentials); } else { diff --git a/presence/implementation/credential_manager_impl.h b/presence/implementation/credential_manager_impl.h index 428f50d4..9cd2c99e 100644 --- a/presence/implementation/credential_manager_impl.h +++ b/presence/implementation/credential_manager_impl.h @@ -43,7 +43,7 @@ namespace presence { class CredentialManagerImpl : public CredentialManager { public: using IdentityType = ::nearby::internal::IdentityType; - using Metadata = ::nearby::internal::Metadata; + using DeviceIdentityMetaData = ::nearby::internal::DeviceIdentityMetaData; explicit CredentialManagerImpl(SingleThreadExecutor* executor) : executor_(ABSL_DIE_IF_NULL(executor)) { @@ -67,7 +67,8 @@ class CredentialManagerImpl : public CredentialManager { static constexpr int kAesGcmIVSize = 12; void GenerateCredentials( - const Metadata& metadata, absl::string_view manager_app_id, + const DeviceIdentityMetaData& device_identity_metadata, + absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) override; @@ -111,43 +112,47 @@ class CredentialManagerImpl : public CredentialManager { void UnsubscribeFromPublicCredentials(SubscriberId id) override; - std::string DecryptMetadata(absl::string_view metadata_encryption_key, - absl::string_view key_seed, - absl::string_view metadata_string) override; + std::string DecryptDeviceIdentityMetaData( + absl::string_view metadata_encryption_key, absl::string_view key_seed, + absl::string_view metadata_string) override; std::pair - CreateLocalCredential(const Metadata& metadata, IdentityType identity_type, - absl::Time start_time, absl::Time end_time); + CreateLocalCredential(const DeviceIdentityMetaData& device_identity_metadata, + IdentityType identity_type, absl::Time start_time, + absl::Time end_time); nearby::internal::SharedCredential CreatePublicCredential( const nearby::internal::LocalCredential& private_credential, - const Metadata& metadata, const std::vector& public_key); + const DeviceIdentityMetaData& device_identity_metadata, + const std::vector& public_key); - virtual std::string EncryptMetadata(absl::string_view metadata_encryption_key, - absl::string_view key_seed, - absl::string_view metadata_string); + virtual std::string EncryptDeviceIdentityMetaData( + absl::string_view metadata_encryption_key, absl::string_view key_seed, + absl::string_view metadata_string); // Extend the key from 16 bytes to 32 bytes. std::vector ExtendMetadataEncryptionKey( absl::string_view metadata_encryption_key); - void SetLocalDeviceMetadata( - const Metadata& metadata, bool regen_credentials, - absl::string_view manager_app_id, + void SetDeviceIdentityMetaData( + const DeviceIdentityMetaData& device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) override { - metadata_ = metadata; + device_identity_metadata_ = device_identity_metadata; if (regen_credentials) { - GenerateCredentials( - metadata, manager_app_id, identity_types, credential_life_cycle_days, - contiguous_copy_of_credentials, std::move(credentials_generated_cb)); + GenerateCredentials(device_identity_metadata, manager_app_id, + identity_types, credential_life_cycle_days, + contiguous_copy_of_credentials, + std::move(credentials_generated_cb)); } } - ::nearby::internal::Metadata GetLocalDeviceMetadata() override { - return metadata_; + ::nearby::internal::DeviceIdentityMetaData GetDeviceIdentityMetaData() + override { + return device_identity_metadata_; } private: @@ -206,6 +211,23 @@ class CredentialManagerImpl : public CredentialManager { callback_for_local_credentials, std::optional callback_for_shared_credentials); + void RefillRemainingValidCredentialsWithNewCredentials( + const CredentialSelector& credential_selector, + std::vector valid_local_credentials, + std::vector valid_shared_credentials, + int64_t start_time_to_generate_new_credentials_millis, + std::optional + callback_for_local_credentials, + std::optional + callback_for_shared_credentials); + void OnCredentialRefillComplete( + absl::Status save_credentials_status, + std::vector valid_local_credentials, + std::vector valid_shared_credentials, + std::optional + callback_for_local_credentials, + std::optional + callback_for_shared_credentials); void OnCredentialsChanged(absl::string_view manager_app_id, absl::string_view account_name, @@ -231,7 +253,7 @@ class CredentialManagerImpl : public CredentialManager { ABSL_GUARDED_BY(*executor_); SingleThreadExecutor* executor_; std::unique_ptr credential_storage_ptr_; - Metadata metadata_; + DeviceIdentityMetaData device_identity_metadata_; }; } // namespace presence diff --git a/presence/implementation/credential_manager_impl_test.cc b/presence/implementation/credential_manager_impl_test.cc index 2d3b34bf..44d37659 100644 --- a/presence/implementation/credential_manager_impl_test.cc +++ b/presence/implementation/credential_manager_impl_test.cc @@ -14,8 +14,8 @@ #include "presence/implementation/credential_manager_impl.h" -#include #include +#include #include #include #include @@ -25,8 +25,10 @@ #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/status/status.h" +#include "absl/status/statusor.h" #include "absl/strings/escaping.h" #include "absl/strings/string_view.h" +#include "absl/time/clock.h" #include "absl/time/time.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/credential_storage_impl.h" @@ -45,33 +47,35 @@ using ::nearby::Crypto; using ::nearby::MediumEnvironment; using ::nearby::internal::IdentityType; using ::nearby::internal::LocalCredential; -using ::nearby::internal::Metadata; + +using ::nearby::internal::DeviceIdentityMetaData; using ::nearby::internal::SharedCredential; -using ::nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE; -using ::nearby::internal::IdentityType::IDENTITY_TYPE_TRUSTED; +using ::nearby::internal::IdentityType::IDENTITY_TYPE_CONTACTS_GROUP; +using ::nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; using ::protobuf_matchers::EqualsProto; using ::testing::UnorderedPointwise; using ::testing::status::StatusIs; constexpr absl::string_view kManagerAppId = "TEST_MANAGER_APP"; -constexpr absl::string_view kAccountName = "test account"; +constexpr absl::string_view kAccountName = ""; constexpr int kExpectedPresenceCredentialListSize = 6; constexpr int kExpectedPresenceCredentialValidDays = 5; -Metadata CreateTestMetadata(absl::string_view account_name = kAccountName) { - Metadata metadata; - metadata.set_account_name(account_name); - metadata.set_device_name("NP test device"); - metadata.set_device_profile_url("test_image.test.com"); - metadata.set_bluetooth_mac_address("FF:FF:FF:FF:FF:FF"); - return metadata; +DeviceIdentityMetaData CreateTestDeviceIdentityMetaData() { + DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_device_type( + internal::DeviceType::DEVICE_TYPE_PHONE); + device_identity_metadata.set_device_name("NP test device"); + device_identity_metadata.set_bluetooth_mac_address("FF:FF:FF:FF:FF:FF"); + device_identity_metadata.set_device_id("\x12\xab\xcd"); + return device_identity_metadata; } CredentialSelector BuildDefaultCredentialSelector() { CredentialSelector credential_selector; credential_selector.manager_app_id = std::string(kManagerAppId); credential_selector.account_name = std::string(kAccountName); - credential_selector.identity_type = IDENTITY_TYPE_PRIVATE; + credential_selector.identity_type = IDENTITY_TYPE_PRIVATE_GROUP; return credential_selector; } @@ -95,11 +99,57 @@ class CredentialManagerImplTest : public ::testing::Test { (override)); }; + class FakeCredentialStorage : public nearby::CredentialStorageImpl { + public: + // nearby::CredentialStorageImpl: + void SaveCredentials( + absl::string_view manager_app_id, absl::string_view account_name, + const std::vector& private_credentials, + const std::vector& public_credentials, + PublicCredentialType public_credential_type, + SaveCredentialsResultCallback callback) override { + // Capture the credentials before actually saving them, so that they + // can be manipulated later on. + private_credentials_ = private_credentials; + public_credentials_ = public_credentials; + + nearby::CredentialStorageImpl::SaveCredentials( + manager_app_id, account_name, private_credentials, public_credentials, + public_credential_type, std::move(callback)); + } + void GetLocalCredentials( + const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) override { + if (private_credentials_.has_value()) { + callback.credentials_fetched_cb(private_credentials_.value()); + } else { + nearby::CredentialStorageImpl::GetLocalCredentials(credential_selector, + std::move(callback)); + } + } + void GetPublicCredentials( + const CredentialSelector& credential_selector, + PublicCredentialType public_credential_type, + GetPublicCredentialsResultCallback callback) override { + if (public_credentials_.has_value()) { + callback.credentials_fetched_cb(public_credentials_.value()); + } else { + nearby::CredentialStorageImpl::GetPublicCredentials( + credential_selector, public_credential_type, std::move(callback)); + } + } + + std::optional> + public_credentials_; + std::optional> + private_credentials_; + }; + class MockCredentialManager : public CredentialManagerImpl { public: explicit MockCredentialManager(SingleThreadExecutor* executor) : CredentialManagerImpl(executor) {} - MOCK_METHOD(std::string, EncryptMetadata, + MOCK_METHOD(std::string, EncryptDeviceIdentityMetaData, (absl::string_view metadata_encryption_key, absl::string_view key_seed, absl::string_view metadata_string), (override)); @@ -123,15 +173,49 @@ class CredentialManagerImplTest : public ::testing::Test { void AddLocalIdentity(absl::string_view manager_app_id, absl::string_view account_name, IdentityType identity_type) { - Metadata metadata = CreateTestMetadata(account_name); - - credential_manager_.GenerateCredentials( - metadata, manager_app_id, {identity_type}, + auto public_credentials = GenerateCredentialsSync( + CreateTestDeviceIdentityMetaData(), manager_app_id, {identity_type}, /*credential_life_cycle_days=*/kExpectedPresenceCredentialValidDays, - /*contigous_copy_of_credentials=*/1, - {[](absl::StatusOr> credentials) { - EXPECT_OK(credentials); - }}); + /*contiguous_copy_of_credentials=*/1); + EXPECT_OK(public_credentials); + } + + absl::StatusOr> GenerateCredentialsSync( + const DeviceIdentityMetaData& device_identity_metadata, + absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials) { + absl::StatusOr> public_credentials; + + CountDownLatch latch(1); + credential_manager_.GenerateCredentials( + device_identity_metadata, manager_app_id, identity_types, + credential_life_cycle_days, contiguous_copy_of_credentials, + {.credentials_generated_cb = + [&](absl::StatusOr> credentials) { + public_credentials = credentials; + latch.CountDown(); + }}); + EXPECT_TRUE(latch.Await().Ok()); + + return public_credentials; + } + + std::vector GetLocalCredentialsSync( + CredentialSelector credential_selector) { + auto private_credentials = credential_manager_.GetLocalCredentialsSync( + credential_selector, absl::Seconds(1)); + EXPECT_TRUE(private_credentials.ok()); + return private_credentials.GetResult(); + } + + std::vector GetPublicCredentialsSync( + CredentialSelector credential_selector, + PublicCredentialType public_credential_type) { + auto public_credentials = credential_manager_.GetPublicCredentialsSync( + credential_selector, public_credential_type, absl::Seconds(1)); + EXPECT_TRUE(public_credentials.ok()); + return public_credentials.GetResult(); } protected: @@ -141,17 +225,18 @@ class CredentialManagerImplTest : public ::testing::Test { }; TEST_F(CredentialManagerImplTest, CreateOneCredentialSuccessfully) { - Metadata metadata = CreateTestMetadata(); + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); constexpr absl::Time kStartTime = absl::FromUnixSeconds(100000); constexpr absl::Time kEndTime = absl::FromUnixSeconds(200000); auto credentials = credential_manager_.CreateLocalCredential( - metadata, IDENTITY_TYPE_PRIVATE, kStartTime, kEndTime); + device_identity_metadata, IDENTITY_TYPE_PRIVATE_GROUP, kStartTime, + kEndTime); LocalCredential private_credential = credentials.first; // Verify the private credential. - EXPECT_EQ(private_credential.identity_type(), IDENTITY_TYPE_PRIVATE); - EXPECT_FALSE(private_credential.secret_id().empty()); + EXPECT_EQ(private_credential.identity_type(), IDENTITY_TYPE_PRIVATE_GROUP); + EXPECT_NE(private_credential.id(), 0); EXPECT_EQ(private_credential.start_time_millis(), absl::ToUnixMillis(kStartTime)); EXPECT_EQ(private_credential.end_time_millis(), absl::ToUnixMillis(kEndTime)); @@ -163,8 +248,9 @@ TEST_F(CredentialManagerImplTest, CreateOneCredentialSuccessfully) { SharedCredential public_credential = credentials.second; // Verify the public credential. - EXPECT_EQ(public_credential.identity_type(), IDENTITY_TYPE_PRIVATE); - EXPECT_FALSE(public_credential.secret_id().empty()); + EXPECT_EQ(public_credential.identity_type(), IDENTITY_TYPE_PRIVATE_GROUP); + EXPECT_NE(public_credential.id(), 0); + EXPECT_EQ(private_credential.id(), public_credential.id()); EXPECT_EQ(private_credential.key_seed(), public_credential.key_seed()); EXPECT_LE(public_credential.start_time_millis(), absl::ToUnixMillis(kStartTime)); @@ -180,37 +266,31 @@ TEST_F(CredentialManagerImplTest, CreateOneCredentialSuccessfully) { public_credential.connection_signature_verification_key().empty()); EXPECT_FALSE(public_credential.encrypted_metadata_bytes_v0().empty()); - // Decrypt the device metadata - - auto decrypted_metadata = credential_manager_.DecryptMetadata( + auto decrypted_metadata = credential_manager_.DecryptDeviceIdentityMetaData( private_credential.metadata_encryption_key_v0(), public_credential.key_seed(), public_credential.encrypted_metadata_bytes_v0()); - EXPECT_EQ(metadata.SerializeAsString(), decrypted_metadata); + EXPECT_EQ(device_identity_metadata.SerializeAsString(), decrypted_metadata); } TEST_F(CredentialManagerImplTest, GenerateCredentialsSuccessfully) { - Metadata metadata = CreateTestMetadata(); - absl::StatusOr> public_credentials; - std::vector identityTypes{IDENTITY_TYPE_PRIVATE}; + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); + std::vector identityTypes{IDENTITY_TYPE_PRIVATE_GROUP}; absl::Time previous_start_time; absl::Time previous_end_time; - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identityTypes, - kExpectedPresenceCredentialValidDays, kExpectedPresenceCredentialListSize, - {.credentials_generated_cb = - [&](absl::StatusOr> credentials) { - public_credentials = std::move(credentials); - }}); - + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identityTypes, + kExpectedPresenceCredentialValidDays, + kExpectedPresenceCredentialListSize); EXPECT_OK(public_credentials); EXPECT_EQ(public_credentials->size(), kExpectedPresenceCredentialListSize); + for (int i = 0; i < kExpectedPresenceCredentialListSize; i++) { SharedCredential& public_credential = public_credentials->at(i); - EXPECT_EQ(public_credential.identity_type(), IDENTITY_TYPE_PRIVATE); - EXPECT_FALSE(public_credential.secret_id().empty()); + EXPECT_EQ(public_credential.identity_type(), IDENTITY_TYPE_PRIVATE_GROUP); + EXPECT_NE(public_credential.id(), 0); absl::Time start_time_millis = absl::FromUnixMillis(public_credential.start_time_millis()); absl::Time end_time_millis = @@ -233,12 +313,12 @@ TEST_F(CredentialManagerImplTest, SubscribeCallsCallbackWithExistingCredentials) { absl::StatusOr> public_credentials1; absl::StatusOr> public_credentials2; - AddLocalIdentity(kManagerAppId, kAccountName, IDENTITY_TYPE_PRIVATE); + AddLocalIdentity(kManagerAppId, kAccountName, IDENTITY_TYPE_PRIVATE_GROUP); SubscriberId id1 = credential_manager_.SubscribeForPublicCredentials( CredentialSelector{.manager_app_id = std::string(kManagerAppId), .account_name = std::string(kAccountName), - .identity_type = IDENTITY_TYPE_PRIVATE}, + .identity_type = IDENTITY_TYPE_PRIVATE_GROUP}, PublicCredentialType::kLocalPublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { @@ -247,7 +327,7 @@ TEST_F(CredentialManagerImplTest, SubscriberId id2 = credential_manager_.SubscribeForPublicCredentials( CredentialSelector{.manager_app_id = std::string(kManagerAppId), .account_name = std::string(kAccountName), - .identity_type = IDENTITY_TYPE_PRIVATE}, + .identity_type = IDENTITY_TYPE_PRIVATE_GROUP}, PublicCredentialType::kLocalPublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { @@ -272,7 +352,7 @@ TEST_F(CredentialManagerImplTest, SubscriberId id = credential_manager_.SubscribeForPublicCredentials( CredentialSelector{.manager_app_id = std::string(kManagerAppId), .account_name = std::string(kAccountName), - .identity_type = IDENTITY_TYPE_PRIVATE}, + .identity_type = IDENTITY_TYPE_PRIVATE_GROUP}, PublicCredentialType::kLocalPublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { @@ -281,7 +361,7 @@ TEST_F(CredentialManagerImplTest, Fence(); EXPECT_THAT(public_credentials, StatusIs(absl::StatusCode::kUnknown)); - AddLocalIdentity(kManagerAppId, kAccountName, IDENTITY_TYPE_PRIVATE); + AddLocalIdentity(kManagerAppId, kAccountName, IDENTITY_TYPE_PRIVATE_GROUP); Fence(); ASSERT_OK(public_credentials); @@ -296,7 +376,7 @@ TEST_F(CredentialManagerImplTest, NoCallbacksAfterUnsubscribe) { SubscriberId id = credential_manager_.SubscribeForPublicCredentials( CredentialSelector{.manager_app_id = std::string(kManagerAppId), .account_name = std::string(kAccountName), - .identity_type = IDENTITY_TYPE_PRIVATE}, + .identity_type = IDENTITY_TYPE_PRIVATE_GROUP}, PublicCredentialType::kLocalPublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { @@ -304,7 +384,7 @@ TEST_F(CredentialManagerImplTest, NoCallbacksAfterUnsubscribe) { }}); credential_manager_.UnsubscribeFromPublicCredentials(id); - AddLocalIdentity(kManagerAppId, kAccountName, IDENTITY_TYPE_PRIVATE); + AddLocalIdentity(kManagerAppId, kAccountName, IDENTITY_TYPE_PRIVATE_GROUP); Fence(); EXPECT_THAT(public_credentials, StatusIs(absl::StatusCode::kUnknown)); @@ -312,7 +392,7 @@ TEST_F(CredentialManagerImplTest, NoCallbacksAfterUnsubscribe) { TEST_F(CredentialManagerImplTest, GenerateCredentialsSuccessfullyButStoreFailed) { - Metadata metadata = CreateTestMetadata(); + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); auto credential_storage_ptr = std::make_unique(); EXPECT_CALL(*credential_storage_ptr, SaveCredentials) @@ -327,16 +407,12 @@ TEST_F(CredentialManagerImplTest, })); credential_manager_ = CredentialManagerImpl(&executor_, std::move(credential_storage_ptr)); - absl::StatusOr> public_credentials; - std::vector identityTypes{IDENTITY_TYPE_PRIVATE}; + std::vector identityTypes{IDENTITY_TYPE_PRIVATE_GROUP}; - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identityTypes, - kExpectedPresenceCredentialValidDays, kExpectedPresenceCredentialListSize, - {.credentials_generated_cb = - [&](absl::StatusOr> credentials) { - public_credentials = std::move(credentials); - }}); + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identityTypes, + kExpectedPresenceCredentialValidDays, + kExpectedPresenceCredentialListSize); EXPECT_THAT(public_credentials, StatusIs(absl::StatusCode::kFailedPrecondition)); } @@ -344,7 +420,7 @@ TEST_F(CredentialManagerImplTest, TEST_F(CredentialManagerImplTest, UpdateRemotePublicCredentialsSuccessfully) { SharedCredential public_credential_for_test; public_credential_for_test.set_identity_type( - IdentityType::IDENTITY_TYPE_TRUSTED); + IdentityType::IDENTITY_TYPE_CONTACTS_GROUP); std::vector public_credentials{ {public_credential_for_test}}; @@ -370,7 +446,7 @@ TEST_F(CredentialManagerImplTest, absl::StatusOr> subscribed_credentials; SharedCredential public_credential_for_test; public_credential_for_test.set_identity_type( - IdentityType::IDENTITY_TYPE_PRIVATE); + IdentityType::IDENTITY_TYPE_PRIVATE_GROUP); std::vector public_credentials{ {public_credential_for_test}}; nearby::CountDownLatch updated_latch(1); @@ -383,18 +459,20 @@ TEST_F(CredentialManagerImplTest, }, }; SubscriberId id1 = credential_manager_.SubscribeForPublicCredentials( - CredentialSelector{.manager_app_id = std::string(kManagerAppId), - .account_name = std::string(kAccountName), - .identity_type = internal::IDENTITY_TYPE_PRIVATE}, + CredentialSelector{ + .manager_app_id = std::string(kManagerAppId), + .account_name = std::string(kAccountName), + .identity_type = internal::IDENTITY_TYPE_PRIVATE_GROUP}, PublicCredentialType::kRemotePublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { subscribed_credentials = std::move(credentials); }}); SubscriberId id2 = credential_manager_.SubscribeForPublicCredentials( - CredentialSelector{.manager_app_id = std::string(kManagerAppId), - .account_name = std::string(kAccountName), - .identity_type = internal::IDENTITY_TYPE_TRUSTED}, + CredentialSelector{ + .manager_app_id = std::string(kManagerAppId), + .account_name = std::string(kAccountName), + .identity_type = internal::IDENTITY_TYPE_CONTACTS_GROUP}, PublicCredentialType::kRemotePublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { @@ -433,63 +511,58 @@ TEST_F(CredentialManagerImplTest, GetPublicCredentialsFailed) { absl::StatusOr> public_credentials; CredentialSelector credential_selector = BuildDefaultCredentialSelector(); + CountDownLatch latch(1); credential_manager_.GetPublicCredentials( credential_selector, PublicCredentialType::kLocalPublicCredential, {.credentials_fetched_cb = [&](absl::StatusOr> credentials) { public_credentials = std::move(credentials); + latch.CountDown(); }}); + EXPECT_TRUE(latch.Await().Ok()); EXPECT_THAT(public_credentials, StatusIs(absl::StatusCode::kNotFound)); } TEST_F(CredentialManagerImplTest, GetCredentialsSuccessfully) { - Metadata metadata = CreateTestMetadata(); - absl::StatusOr> public_credentials; - std::vector identity_types{IDENTITY_TYPE_PRIVATE}; - absl::StatusOr> private_credentials; + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); + std::vector identity_types{IDENTITY_TYPE_PRIVATE_GROUP}; CredentialSelector credential_selector = BuildDefaultCredentialSelector(); - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identity_types, - kExpectedPresenceCredentialValidDays, kExpectedPresenceCredentialListSize, - {.credentials_generated_cb = - [&](absl::StatusOr> credentials) { - public_credentials = std::move(credentials); - }}); - credential_manager_.GetLocalCredentials( - credential_selector, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - private_credentials = std::move(credentials); - }}); - + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identity_types, + kExpectedPresenceCredentialValidDays, + kExpectedPresenceCredentialListSize); EXPECT_OK(public_credentials); EXPECT_EQ(public_credentials->size(), kExpectedPresenceCredentialListSize); - EXPECT_OK(private_credentials); - EXPECT_FALSE(private_credentials->empty()); + + auto private_credentials = GetLocalCredentialsSync(credential_selector); + EXPECT_FALSE(private_credentials.empty()); } TEST_F(CredentialManagerImplTest, PublicCredentialsFailEncryption) { - Metadata metadata = CreateTestMetadata(); + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); absl::StatusOr> public_credentials; auto credential_manager_ptr = std::make_unique( &executor_); - EXPECT_CALL(*credential_manager_ptr, EncryptMetadata) + EXPECT_CALL(*credential_manager_ptr, EncryptDeviceIdentityMetaData) .WillOnce(::testing::Invoke( [](absl::string_view metadata_encryption_key, absl::string_view key_seed, absl::string_view metadata_string) { return ""; })); - std::vector identity_types{IDENTITY_TYPE_PRIVATE}; + std::vector identity_types{IDENTITY_TYPE_PRIVATE_GROUP}; + CountDownLatch latch(1); credential_manager_ptr->GenerateCredentials( - metadata, kManagerAppId, identity_types, + device_identity_metadata, kManagerAppId, identity_types, kExpectedPresenceCredentialValidDays, 1, {.credentials_generated_cb = [&](absl::StatusOr> credentials) { public_credentials = std::move(credentials); + latch.CountDown(); }}); + EXPECT_TRUE(latch.Await().Ok()); EXPECT_THAT(public_credentials, StatusIs(absl::StatusCode::kInvalidArgument)); } @@ -498,34 +571,24 @@ TEST_F(CredentialManagerImplTest, UpdateLocalCredential) { constexpr int kSelectedCredentialId = 2; constexpr uint16_t kSalt = 1000; absl::Status update_status = absl::UnknownError(""); - Metadata metadata = CreateTestMetadata(); - absl::StatusOr> - public_credentials; - std::vector identity_types{IDENTITY_TYPE_PRIVATE, - IDENTITY_TYPE_TRUSTED}; - absl::StatusOr> private_credentials; - absl::StatusOr> modified_private_credentials; + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); + std::vector identity_types{IDENTITY_TYPE_PRIVATE_GROUP, + IDENTITY_TYPE_CONTACTS_GROUP}; CredentialSelector credential_selector = BuildDefaultCredentialSelector(); - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identity_types, - kExpectedPresenceCredentialValidDays, kExpectedPresenceCredentialListSize, - {.credentials_generated_cb = - [&](absl::StatusOr> - credentials) { - public_credentials = std::move(credentials); - }}); - credential_manager_.GetLocalCredentials( - credential_selector, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - private_credentials = std::move(credentials); - }}); + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identity_types, + kExpectedPresenceCredentialValidDays, + kExpectedPresenceCredentialListSize); + + auto private_credentials = GetLocalCredentialsSync(credential_selector); + EXPECT_EQ(kExpectedPresenceCredentialListSize, private_credentials.size()); + ASSERT_OK(public_credentials); - ASSERT_OK(private_credentials); - EXPECT_EQ(private_credentials->size(), kExpectedPresenceCredentialListSize); // Modify a private credential - LocalCredential& credential = private_credentials->at(kSelectedCredentialId); + auto credential = private_credentials.at(kSelectedCredentialId); + EXPECT_TRUE( + private_credentials.at(kSelectedCredentialId).consumed_salts().empty()); credential.mutable_consumed_salts()->insert({kSalt, true}); credential_manager_.UpdateLocalCredential( @@ -534,185 +597,121 @@ TEST_F(CredentialManagerImplTest, UpdateLocalCredential) { EXPECT_OK(update_status); - // verify modified content - credential_manager_.GetLocalCredentials( - credential_selector, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - modified_private_credentials = std::move(credentials); - }}); - ASSERT_OK(modified_private_credentials); - EXPECT_THAT(*modified_private_credentials, - UnorderedPointwise(EqualsProto(), *private_credentials)); + // Verify that the modified credential has the new field in the new + // retrieved list of credentials. + auto modified_private_credentials = + GetLocalCredentialsSync(credential_selector); + EXPECT_TRUE(modified_private_credentials.at(kSelectedCredentialId) + .consumed_salts() + .at(kSalt)); } -TEST_F(CredentialManagerImplTest, ParseAndroidSharedCredential) { - // This SharedCredential and Metadata were generated on Android. - constexpr absl::string_view kSharedCredentialBase16 = - "0A20C8B6DB66CBA77E8CF0286A78574D1F7EADF3C3DAA3E26DAB048FD5481B4FBA7A1220" - "E809E7805FC6AB8226A4CCA9FAEA5FDDE49EE07E7D5905CCB6AA0F779069F2A818D088D4" - "EADE3020B093BEBDE0302A56E1CAE889FC26B8FBF399C86BEB8D7AB84EE476EF2E75B465" - "773A957BDEAD6732FCD74BFFC363BE068CCD9109108AAE5274C861675F3E7E0E524C4A75" - "11DC9F669FCAC072EE70062B00AEA4A736454FC1CAAE6F8D62843220D563DF856310428E" - "FE6D8B6FBD74FB9C4E762323782494D0E2DF6FEA118E17B13A5B3059301306072A8648CE" - "3D020106082A8648CE3D03010703420004169A965ACFCAE31B031147A0169823B4B6926D" - "7AA86E50CABB5F6100F6992D5C1769FC629F0F789B7B39525DA4A33FC2438A074DC1EEC0" - "21B1AA4FD2122DC5044801"; +TEST_F(CredentialManagerImplTest, EncryptAndDecryptDeviceIdentityMetaData) { constexpr absl::string_view kMetadataEncryptionKeyBase16 = "6331578C6E244074111B2ED0BBDB"; - constexpr absl::string_view kMetadataBase16 = - "08011A137363616E6E657220646576696365206E616D6522137363616E6E657220706572" - "736F6E206E616D652A107363616E6E65722069636F6E2075726C3206AABBCCDDEEFF"; - SharedCredential shared_credential; - Metadata expected_metadata; + constexpr absl::string_view kSeed = "123456"; - ASSERT_TRUE(shared_credential.ParseFromString( - absl::HexStringToBytes(kSharedCredentialBase16))); - ASSERT_TRUE(expected_metadata.ParseFromString( - absl::HexStringToBytes(kMetadataBase16))); - std::string decrypted_metadata = credential_manager_.DecryptMetadata( - absl::HexStringToBytes(kMetadataEncryptionKeyBase16), - shared_credential.key_seed(), - shared_credential.encrypted_metadata_bytes_v0()); - Metadata metadata; - ASSERT_TRUE(metadata.ParseFromString(decrypted_metadata)); - EXPECT_THAT(metadata, EqualsProto(expected_metadata)); + auto encrypted_meta_data = credential_manager_.EncryptDeviceIdentityMetaData( + kMetadataEncryptionKeyBase16, kSeed, + CreateTestDeviceIdentityMetaData().SerializeAsString()); + + auto decrypted_meta_data = credential_manager_.DecryptDeviceIdentityMetaData( + kMetadataEncryptionKeyBase16, kSeed, encrypted_meta_data); + + DeviceIdentityMetaData device_identity_metadata; + ASSERT_TRUE(device_identity_metadata.ParseFromString(decrypted_meta_data)); + EXPECT_EQ(device_identity_metadata.device_id(), "\x12\xab\xcd"); + EXPECT_EQ(device_identity_metadata.device_type(), + internal::DeviceType::DEVICE_TYPE_PHONE); + EXPECT_EQ(device_identity_metadata.device_name(), "NP test device"); + EXPECT_EQ(device_identity_metadata.bluetooth_mac_address(), + "FF:FF:FF:FF:FF:FF"); } -TEST_F(CredentialManagerImplTest, RefillCredentailInGetLocalCredentials) { - Metadata metadata = CreateTestMetadata(); - absl::StatusOr> public_credentials; - std::vector identity_types{IDENTITY_TYPE_PRIVATE}; - absl::StatusOr> private_credentials; +TEST_F(CredentialManagerImplTest, RefillCredentialsInGetLocalCredentials) { + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); + std::vector identity_types{IDENTITY_TYPE_PRIVATE_GROUP}; CredentialSelector credential_selector = BuildDefaultCredentialSelector(); - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identity_types, - kExpectedPresenceCredentialValidDays, 1, - {.credentials_generated_cb = - [&](absl::StatusOr> credentials) { - public_credentials = std::move(credentials); - }}); + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identity_types, + kExpectedPresenceCredentialValidDays, 1); EXPECT_OK(public_credentials); - EXPECT_EQ(public_credentials->size(), 1); + EXPECT_EQ(1, public_credentials->size()); // only generate 1 creds, expecting GetLocal would trigger refill to // kExpectedPresenceCredentialListSize. - credential_manager_.GetLocalCredentials( - credential_selector, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - private_credentials = std::move(credentials); - }}); - - EXPECT_OK(private_credentials); - EXPECT_EQ(private_credentials->size(), kExpectedPresenceCredentialListSize); + auto private_credentials = GetLocalCredentialsSync(credential_selector); + EXPECT_EQ(kExpectedPresenceCredentialListSize, private_credentials.size()); } -TEST_F(CredentialManagerImplTest, RefillCredentailInGetSharedCredentials) { - Metadata metadata = CreateTestMetadata(); - absl::StatusOr> public_credentials; - std::vector identity_types{IDENTITY_TYPE_PRIVATE}; - absl::StatusOr> refilled_public_credentials; +TEST_F(CredentialManagerImplTest, RefillCredentialsInGetSharedCredentials) { + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); + std::vector identity_types{IDENTITY_TYPE_PRIVATE_GROUP}; CredentialSelector credential_selector = BuildDefaultCredentialSelector(); - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identity_types, - kExpectedPresenceCredentialValidDays, 1, - {.credentials_generated_cb = - [&](absl::StatusOr> credentials) { - public_credentials = std::move(credentials); - }}); - + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identity_types, + kExpectedPresenceCredentialValidDays, 1); EXPECT_OK(public_credentials); - EXPECT_EQ(public_credentials->size(), 1); + EXPECT_EQ(1, public_credentials->size()); // Only generated 1 creds, expecting GetPublicCredentials for // kLocalPublicCredential type would trigger refill to // kExpectedPresenceCredentialListSize. - credential_manager_.GetPublicCredentials( - credential_selector, PublicCredentialType::kLocalPublicCredential, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - refilled_public_credentials = std::move(credentials); - }}); - - EXPECT_OK(refilled_public_credentials); - EXPECT_EQ(refilled_public_credentials->size(), - kExpectedPresenceCredentialListSize); + auto refilled_public_credentials = GetPublicCredentialsSync( + credential_selector, PublicCredentialType::kLocalPublicCredential); + EXPECT_EQ(kExpectedPresenceCredentialListSize, + refilled_public_credentials.size()); } TEST_F(CredentialManagerImplTest, RefillExpiredCredsInGetLocal) { - Metadata metadata = CreateTestMetadata(); - absl::StatusOr> public_credentials; - std::vector identity_types{IDENTITY_TYPE_PRIVATE}; - absl::StatusOr> private_credentials; + auto device_identity_metadata = CreateTestDeviceIdentityMetaData(); + std::vector identity_types{IDENTITY_TYPE_PRIVATE_GROUP}; CredentialSelector credential_selector = BuildDefaultCredentialSelector(); - credential_manager_.GenerateCredentials( - metadata, kManagerAppId, identity_types, - kExpectedPresenceCredentialValidDays, kExpectedPresenceCredentialListSize, - {.credentials_generated_cb = - [&](absl::StatusOr> credentials) { - public_credentials = std::move(credentials); - }}); + auto credential_storage = + std::make_unique(); + auto* credential_storage_ptr = credential_storage.get(); + credential_manager_ = + CredentialManagerImpl(&executor_, std::move(credential_storage)); + + auto public_credentials = GenerateCredentialsSync( + device_identity_metadata, kManagerAppId, identity_types, + kExpectedPresenceCredentialValidDays, + kExpectedPresenceCredentialListSize); ASSERT_OK(public_credentials); EXPECT_EQ(public_credentials->size(), kExpectedPresenceCredentialListSize); - // Now generated kExpectedPresenceCredentialListSize valid creds, read out the - // local creds list, then manually update the first credential's end time to - // make it expired. - credential_manager_.GetLocalCredentials( - credential_selector, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - private_credentials = std::move(credentials); - }}); + // Now that we have generated kExpectedPresenceCredentialListSize valid creds, + // tweak the first credential's end time, in both credential lists, to + // make them expired. + auto expiry_time = absl::ToUnixMillis(absl::Now() - absl::Hours(1)); + credential_storage_ptr->private_credentials_.value() + .at(0) + .set_end_time_millis(expiry_time); + credential_storage_ptr->public_credentials_.value().at(0).set_end_time_millis( + expiry_time); - ASSERT_OK(private_credentials); - EXPECT_EQ(private_credentials->size(), kExpectedPresenceCredentialListSize); + auto old_private_credentials = + credential_storage_ptr->private_credentials_.value(); - LocalCredential expiring_local_credential = private_credentials->at(0); + auto refilled_private_credentials = + GetLocalCredentialsSync(credential_selector); + EXPECT_EQ(kExpectedPresenceCredentialListSize, + refilled_private_credentials.size()); - expiring_local_credential.set_end_time_millis( - absl::ToUnixMillis(absl::Now() - absl::Hours(1))); - - CountDownLatch update_local_cred_latch(1); - - credential_manager_.UpdateLocalCredential( - credential_selector, expiring_local_credential, - { - .credentials_saved_cb = - [&](absl::Status status) { - if (status.ok()) { - update_local_cred_latch.CountDown(); - } - }, - }); - EXPECT_TRUE(update_local_cred_latch.Await().Ok()); - - absl::StatusOr> refilled_private_credentials; - credential_manager_.GetLocalCredentials( - credential_selector, - {.credentials_fetched_cb = - [&](absl::StatusOr> credentials) { - refilled_private_credentials = std::move(credentials); - }}); - - EXPECT_OK(refilled_private_credentials); - EXPECT_EQ(refilled_private_credentials->size(), - kExpectedPresenceCredentialListSize); // Verifying the expired one private_credentials->at(0) is pruned in the new // list. - EXPECT_EQ(private_credentials->at(1).secret_id(), - refilled_private_credentials->at(0).secret_id()); + EXPECT_EQ(old_private_credentials.at(1).secret_id(), + refilled_private_credentials.at(0).secret_id()); // Verifying the new generated cred's start time is the same as previously - // exisiting list's last cred's end time. + // existing list's last cred's end time. EXPECT_EQ( - private_credentials->at(5).end_time_millis(), - refilled_private_credentials->at(kExpectedPresenceCredentialListSize - 1) + old_private_credentials.at(5).end_time_millis(), + refilled_private_credentials.at(kExpectedPresenceCredentialListSize - 1) .start_time_millis()); } diff --git a/presence/implementation/ldt.cc b/presence/implementation/ldt.cc index 01126dd2..be1ad33a 100644 --- a/presence/implementation/ldt.cc +++ b/presence/implementation/ldt.cc @@ -15,18 +15,18 @@ #include "presence/implementation/ldt.h" #include -#include +#include #include #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#ifdef USE_RUST_LDT -#include "third_party/beto-core/src/nearby/presence/ldt_np_adv_ffi/include/np_ldt.h" +#ifdef NEARBY_CHROMIUM +#include "third_party/beto-core/src/nearby/presence/ldt_np_adv_ffi/c/include/np_ldt.h" #else -#include "presence/implementation/np_ldt.h" -#endif /* USE_RUST_LDT */ +#include "np_ldt.h" +#endif namespace nearby { namespace presence { diff --git a/presence/implementation/ldt.h b/presence/implementation/ldt.h index 6a563505..2c1322bd 100644 --- a/presence/implementation/ldt.h +++ b/presence/implementation/ldt.h @@ -18,13 +18,14 @@ #include #include +#ifdef NEARBY_CHROMIUM +#include "third_party/beto-core/src/nearby/presence/ldt_np_adv_ffi/c/include/np_ldt.h" +#else +#include "np_ldt.h" +#endif + #include "absl/status/statusor.h" #include "absl/strings/string_view.h" -#ifdef USE_RUST_LDT -#include "third_party/beto-core/src/nearby/presence/ldt_np_adv_ffi/include/np_ldt.h" -#else -#include "presence/implementation/np_ldt.h" -#endif /* USE_RUST_LDT */ namespace nearby { namespace presence { diff --git a/presence/implementation/ldt_test.cc b/presence/implementation/ldt_test.cc index fbbd2581..b574cc7d 100644 --- a/presence/implementation/ldt_test.cc +++ b/presence/implementation/ldt_test.cc @@ -18,41 +18,37 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/status/statusor.h" #include "absl/strings/escaping.h" +#include "absl/strings/string_view.h" #include "internal/platform/byte_array.h" -#include "internal/proto/credential.pb.h" namespace nearby { namespace presence { namespace { using ::nearby::ByteArray; -using ::nearby::internal::SharedCredential; - -#ifdef USE_RUST_LDT // Test data from Android tests. constexpr absl::string_view kKeySeedBase16 = - "BAF3C12E1BBBB3E4367BBD40986D0D7CD158DF6D662AAE6312FE67634B5D4547"; + "CCDB2489E9FCAC42B39348B8941ED19A1D360E75E098C8C15E6B1CC2B620CD39"; constexpr absl::string_view kKnownMacBase16 = - "CDDA7C6CF56882D74364F8BE9874A78D7C961BFF9800A40D83F6652E6CF5D1A7"; -constexpr absl::string_view kSharedCredentialBase16 = - "1220BAF3C12E1BBBB3E4367BBD40986D0D7CD158DF6D662AAE6312FE67634B5D45473220" - "CDDA7C6CF56882D74364F8BE9874A78D7C961BFF9800A40D83F6652E6CF5D1A7"; + "B4C59FA599241B81758D976B5A621C05232FE1BF89AE5987CA254C3554DCE50E"; constexpr absl::string_view kPlainTextBase16 = - "205BF1D88FF539EC740CCC2EC2DE19353EF30F01054C3E24"; + "CD683FE1A1D1F846543D0A13D4AEA40040C8D67B"; constexpr absl::string_view kCipherTextBase16 = - "FDABC09D6F8028D4E5E585C62E9A0DB5003F19FEBDF92524"; -constexpr absl::string_view kSaltBase16 = "874C"; + "61E481C12F4DE24F2D4AB22D8908F80D3A3F9B40"; +constexpr absl::string_view kSaltBase16 = "0C0F"; TEST(Ldt, EncryptAndDecrypt) { // Test data copied from NP LDT tests ByteArray seed({204, 219, 36, 137, 233, 252, 172, 66, 179, 147, 72, 184, 148, 30, 209, 154, 29, 54, 14, 117, 224, 152, 200, 193, 94, 107, 28, 194, 182, 32, 205, 57}); - ByteArray known_mac({223, 185, 10, 31, 155, 31, 226, 141, 24, 187, 204, - 165, 34, 64, 181, 204, 44, 203, 95, 141, 82, 137, - 163, 203, 100, 235, 53, 65, 202, 97, 75, 180}); + ByteArray known_mac({0xB4, 0xC5, 0x9F, 0xA5, 0x99, 0x24, 0x1B, 0x81, + 0x75, 0x8D, 0x97, 0x6B, 0x5A, 0x62, 0x1C, 0x05, + 0x23, 0x2F, 0xE1, 0xBF, 0x89, 0xAE, 0x59, 0x87, + 0xCA, 0x25, 0x4C, 0x35, 0x54, 0xDC, 0xE5, 0x0E}); ByteArray test_data({205, 104, 63, 225, 161, 209, 248, 70, 84, 61, 10, 19, 212, 174, 164, 0, 64, 200, 214, 123}); ByteArray salt({12, 15}); @@ -84,12 +80,9 @@ TEST(Ldt, EncryptAndroidData) { } TEST(Ldt, DecryptAndroidData) { - SharedCredential shared_credential; - ASSERT_TRUE(shared_credential.ParseFromString( - absl::HexStringToBytes(kSharedCredentialBase16))); - absl::StatusOr encryptor = LdtEncryptor::Create( - shared_credential.key_seed(), - shared_credential.metadata_encryption_key_tag_v0()); + absl::StatusOr encryptor = + LdtEncryptor::Create(absl::HexStringToBytes(kKeySeedBase16), + absl::HexStringToBytes(kKnownMacBase16)); ASSERT_OK(encryptor); absl::StatusOr decrypted = @@ -100,23 +93,6 @@ TEST(Ldt, DecryptAndroidData) { EXPECT_EQ(*decrypted, absl::HexStringToBytes(kPlainTextBase16)); } -#else -TEST(Ldt, LdtUnvailable) { - ByteArray seed({204, 219, 36, 137, 233, 252, 172, 66, 179, 147, 72, - 184, 148, 30, 209, 154, 29, 54, 14, 117, 224, 152, - 200, 193, 94, 107, 28, 194, 182, 32, 205, 57}); - ByteArray known_mac({223, 185, 10, 31, 155, 31, 226, 141, 24, 187, 204, - 165, 34, 64, 181, 204, 44, 203, 95, 141, 82, 137, - 163, 203, 100, 235, 53, 65, 202, 97, 75, 180}); - - absl::StatusOr encryptor = - LdtEncryptor::Create(seed.AsStringView(), known_mac.AsStringView()); - - EXPECT_THAT(encryptor.status(), - absl::UnavailableError("Failed to create LDT encryptor")); -} -#endif - } // namespace } // namespace presence } // namespace nearby diff --git a/presence/implementation/mediums/BUILD b/presence/implementation/mediums/BUILD index e30cdad4..a2592bc7 100644 --- a/presence/implementation/mediums/BUILD +++ b/presence/implementation/mediums/BUILD @@ -23,7 +23,7 @@ cc_library( "mediums.h", ], visibility = [ - "//presence/implementation:__subpackages__", + "//presence:__subpackages__", ], deps = [ "//internal/platform:comm", diff --git a/presence/implementation/mediums/ble_test.cc b/presence/implementation/mediums/ble_test.cc index 9ca5f202..92c95cdd 100644 --- a/presence/implementation/mediums/ble_test.cc +++ b/presence/implementation/mediums/ble_test.cc @@ -58,7 +58,7 @@ class BleTest : public testing::TestWithParam { std::string account_name_ = "Test-Name"; constexpr static PowerMode kPowerMode = PowerMode::kBalanced; std::vector identity_types_ = { - nearby::internal::IdentityType::IDENTITY_TYPE_TRUSTED, + nearby::internal::IdentityType::IDENTITY_TYPE_CONTACTS_GROUP, }; std::vector extended_properties_ = { DataElement{DataElement::kTxPowerFieldType, "-10"}}; diff --git a/presence/implementation/mock_connection_authenticator.h b/presence/implementation/mock_connection_authenticator.h new file mode 100644 index 00000000..24e860eb --- /dev/null +++ b/presence/implementation/mock_connection_authenticator.h @@ -0,0 +1,63 @@ +// Copyright 2023 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_PRESENCE_IMPLEMENTATION_MOCK_CONNECTION_AUTHENTICATOR_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_MOCK_CONNECTION_AUTHENTICATOR_H_ + +#include +#include + +#include "gmock/gmock.h" +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/proto/credential.pb.h" +#include "internal/proto/local_credential.pb.h" +#include "presence/implementation/connection_authenticator.h" + +namespace nearby { +namespace presence { + +/* + * This class is for unit tests, mocking {@code ConnectionAuthenticator} + * functions in `PresenceDeviceProviderTest`. + */ +class MockConnectionAuthenticator : public ConnectionAuthenticator { + public: + MOCK_METHOD(absl::StatusOr, BuildSignedMessageAsInitiator, + (absl::string_view ukey2_secret, + std::optional local_credential, + const internal::SharedCredential& shared_credential), + (const, override)); + MOCK_METHOD(absl::StatusOr, BuildSignedMessageAsResponder, + (absl::string_view ukey2_secret, + const internal::LocalCredential& local_credential), + (const, override)); + MOCK_METHOD( + absl::Status, VerifyMessageAsInitiator, + (ResponderData authentication_data, absl::string_view ukey2_secret, + const std::vector& shared_credentials), + (const, override)); + MOCK_METHOD( + absl::StatusOr, VerifyMessageAsResponder, + (absl::string_view ukey2_secret, InitiatorData initiator_data, + const std::vector& local_credentials, + const std::vector& shared_credentials), + (const, override)); +}; + +} // namespace presence +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_MOCK_CONNECTION_AUTHENTICATOR_H_ diff --git a/presence/implementation/mock_credential_manager.h b/presence/implementation/mock_credential_manager.h new file mode 100644 index 00000000..64d6e848 --- /dev/null +++ b/presence/implementation/mock_credential_manager.h @@ -0,0 +1,86 @@ +// Copyright 2023 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_PRESENCE_IMPLEMENTATION_MOCK_CREDENTIAL_MANAGER_H_ +#define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_MOCK_CREDENTIAL_MANAGER_H_ + +#include +#include + +#include "gmock/gmock.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/credential_callbacks.h" +#include "presence/implementation/credential_manager.h" + +namespace nearby { +namespace presence { + +class MockCredentialManager : public CredentialManager { + public: + MOCK_METHOD( + void, GenerateCredentials, + (const nearby::internal::DeviceIdentityMetaData& device_identity_metadata, + absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb), + (override)); + MOCK_METHOD(void, UpdateRemotePublicCredentials, + (absl::string_view manager_app_id, absl::string_view account_name, + const std::vector& + remote_public_creds, + UpdateRemotePublicCredentialsCallback credentials_updated_cb), + (override)); + MOCK_METHOD(void, UpdateLocalCredential, + (const CredentialSelector& credential_selector, + nearby::internal::LocalCredential credential, + SaveCredentialsResultCallback result_callback), + (override)); + MOCK_METHOD(void, GetLocalCredentials, + (const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback), + (override)); + MOCK_METHOD(void, GetPublicCredentials, + (const CredentialSelector& credential_selector, + PublicCredentialType public_credential_type, + GetPublicCredentialsResultCallback callback), + (override)); + MOCK_METHOD(SubscriberId, SubscribeForPublicCredentials, + (const CredentialSelector& credential_selector, + PublicCredentialType public_credential_type, + GetPublicCredentialsResultCallback callback), + (override)); + MOCK_METHOD(void, UnsubscribeFromPublicCredentials, (SubscriberId id), + (override)); + MOCK_METHOD(std::string, DecryptDeviceIdentityMetaData, + (absl::string_view metadata_encryption_key, + absl::string_view key_seed, absl::string_view metadata_string), + (override)); + MOCK_METHOD( + void, SetDeviceIdentityMetaData, + (const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb), + (override)); + MOCK_METHOD(::nearby::internal::DeviceIdentityMetaData, + GetDeviceIdentityMetaData, (), (override)); +}; + +} // namespace presence +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_MOCK_CREDENTIAL_MANAGER_H_ diff --git a/presence/implementation/mock_service_controller.h b/presence/implementation/mock_service_controller.h index 84960f12..90c3b31d 100644 --- a/presence/implementation/mock_service_controller.h +++ b/presence/implementation/mock_service_controller.h @@ -16,8 +16,11 @@ #define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_MOCK_SERVICE_CONTROLLER_H_ #include +#include #include "gmock/gmock.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "presence/implementation/service_controller.h" namespace nearby { @@ -33,11 +36,44 @@ class MockServiceController : public ServiceController { MOCK_METHOD(absl::StatusOr, StartScan, (ScanRequest scan_request, ScanCallback callback), (override)); + MOCK_METHOD(void, StopScan, (ScanSessionId session_id), (override)); MOCK_METHOD(absl::StatusOr, StartBroadcast, (BroadcastRequest broadcast_request, BroadcastCallback callback), (override)); - - private: + MOCK_METHOD(void, StopBroadcast, (BroadcastSessionId session_id), (override)); + MOCK_METHOD( + void, UpdateLocalDeviceMetadata, + (const ::nearby::internal::Metadata& metadata, bool regen_credentials, + absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb), + (override)); + MOCK_METHOD( + void, UpdateDeviceIdentityMetaData, + (const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb), + (override)); + MOCK_METHOD(::nearby::internal::DeviceIdentityMetaData, + GetDeviceIdentityMetaData, (), (override)); + MOCK_METHOD(void, GetLocalPublicCredentials, + (const CredentialSelector& credential_selector, + GetPublicCredentialsResultCallback callback), + (override)); + MOCK_METHOD(void, UpdateRemotePublicCredentials, + (absl::string_view manager_app_id, absl::string_view account_name, + const std::vector& + remote_public_creds, + UpdateRemotePublicCredentialsCallback credentials_updated_cb), + (override)); + MOCK_METHOD(void, GetLocalCredentials, + (const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback), + (override)); }; } // namespace presence diff --git a/presence/implementation/np_ldt.c b/presence/implementation/np_ldt.c deleted file mode 100644 index ec36e5b7..00000000 --- a/presence/implementation/np_ldt.c +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2022 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. - -#include "presence/implementation/np_ldt.h" - -// Placeholder, empty implementations of LDT utilities. They will be replaced -// with implementations in Rust. - -NpLdtEncryptHandle NpLdtEncryptCreate(NpLdtKeySeed key_seed) { - NpLdtEncryptHandle handle = {0}; - return handle; -} - -NpLdtDecryptHandle NpLdtDecryptCreate(NpLdtKeySeed key_seed, NpMetadataKeyHmac hmac_tag) { - NpLdtDecryptHandle handle = {0}; - return handle; -} - -NP_LDT_RESULT NpLdtEncryptClose(NpLdtEncryptHandle handle) { return NP_LDT_SUCCESS; } - -NP_LDT_RESULT NpLdtDecryptClose(NpLdtDecryptHandle handle) { return NP_LDT_SUCCESS; } - -NP_LDT_RESULT NpLdtEncrypt(NpLdtEncryptHandle handle, uint8_t* buffer, - size_t buffer_len, NpLdtSalt salt) { - return NP_LDT_SUCCESS; -} - -NP_LDT_RESULT NpLdtDecryptAndVerify(NpLdtDecryptHandle handle, uint8_t* buffer, - size_t buffer_len, NpLdtSalt salt) { - return NP_LDT_SUCCESS; -} diff --git a/presence/implementation/np_ldt.h b/presence/implementation/np_ldt.h deleted file mode 100644 index 7af6d143..00000000 --- a/presence/implementation/np_ldt.h +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2022 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. -// C API for Rust implementation of LDT [1], tailored to Nearby Presence's -// BLE 4.2 legacy format advertisement parsing usecase. -// -// [1] https://eprint.iacr.org/2017/841.pdf - -// TODO pluggable memory allocation for embedded - -// TODO include guard name based on final file location -#ifndef NP_LDT_H_ -#define NP_LDT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -// Individual encrypt/decrypt API, useful when creating advertisements or when -// decrypting advertisements from a known origin - -// The allocated handle to use for encryption -typedef struct { - uint64_t handle; -} NpLdtEncryptHandle; - -// The allocated handle to use for decryption -typedef struct { - uint64_t handle; -} NpLdtDecryptHandle; - -// Key material from the Nearby Presence credential from which keys will be -// derived. -typedef struct { - uint8_t bytes[32]; -} NpLdtKeySeed; - -typedef struct { - uint8_t bytes[32]; -} NpMetadataKeyHmac; - -typedef struct { - uint8_t bytes[2]; -} NpLdtSalt; - -// Possible result codes returned from the LDT NP API's -typedef enum { - // Call to api was succesful - NP_LDT_SUCCESS = 0, - // Payload of invalid length was provided must be >= 16 and <=31 bytes - NP_LDT_ERROR_INVALID_LENGTH = -1, - // The provided metadata hmac did not match the calculated hmac on call to - // decrypt and verify - NP_LDT_ERROR_MAC_MISMATCH = -2, -} NP_LDT_RESULT; - -// Allocate an LDT-XTS-AES128 Decryption cipher using the "swap" mix function. -// -// `key_seed` is the key material from the Nearby Presence credential from which -// the LDT key will be derived. -// 'hmac_tag' is the hmac auth tag calculated on the metadata key used to verify -// decryption was successful -// -// Returns 0 on error, or a non-zero handle on success. -NpLdtDecryptHandle NpLdtDecryptCreate(NpLdtKeySeed key_seed, - NpMetadataKeyHmac hmac_tag); - -// Allocate an LDT-XTS-AES128 Encryption cipher using the "swap" mix function. -// -// `key_seed` is the key material from the Nearby Presence credential from which -// the LDT key will be derived. -// -// Returns 0 on error, or a non-zero handle on success. -NpLdtEncryptHandle NpLdtEncryptCreate(NpLdtKeySeed key_seed); - -// Release allocated resources for an NpLdtEncryptHandle -// -// Returns 0 on success or an NP_LDT_RESULT error code on failure -NP_LDT_RESULT NpLdtEncryptClose(NpLdtEncryptHandle handle); - -// Release allocated resources for an NpLdtDecryptHandle -// -// Returns 0 on success or an NP_LDT_RESULT error code on failure -NP_LDT_RESULT NpLdtDecryptClose(NpLdtDecryptHandle handle); - -// Encrypt a 16-31 byte buffer in-place. -// -// `buffer` is a pointer to a 16-31 byte plaintext, with length in `buffer_len`. -// `salt` is the big-endian 2 byte salt that will be used in the Nearby -// Presence advertisement, which will be incorporated into the tweaks LDT uses -// while encrypting. -// -// Returns 0 on success, in which case `buffer` will now contain ciphertext. -// Returns an NP_LDT_RESULT error code on failure -NP_LDT_RESULT NpLdtEncrypt(NpLdtEncryptHandle handle, uint8_t* buffer, - size_t buffer_len, NpLdtSalt salt); - -// Decrypt a 16-31 byte buffer in-place. -// -// `buffer` is a pointer to a 16-31 byte ciphertext, with length in -// `buffer_len`. -// `salt` is the big-endian 2 byte salt found in the Nearby Presence -// advertisement, which will be incorporated into the tweaks LDT uses while -// decrypting. -// -// Returns 0 on success, in which case `buffer` will now contain plaintext. -// Returns an NP_LDT_RESULT error code on failure -NP_LDT_RESULT NpLdtDecryptAndVerify(NpLdtDecryptHandle handle, uint8_t* buffer, - size_t buffer_len, NpLdtSalt salt); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // NP_LDT_H_ diff --git a/presence/implementation/scan_manager.cc b/presence/implementation/scan_manager.cc index 02c405be..29f2dcc4 100644 --- a/presence/implementation/scan_manager.cc +++ b/presence/implementation/scan_manager.cc @@ -14,23 +14,29 @@ #include "presence/implementation/scan_manager.h" -#include -#include +#include + +#include #include #include #include #include +#include "absl/base/thread_annotations.h" #include "absl/status/status.h" -#include "absl/types/variant.h" -#include "internal/platform/implementation/crypto.h" +#include "absl/strings/string_view.h" #include "internal/platform/future.h" #include "internal/platform/implementation/ble_v2.h" #include "internal/platform/implementation/credential_callbacks.h" -#include "internal/platform/uuid.h" +#include "internal/platform/implementation/crypto.h" +#include "internal/platform/logging.h" +#include "presence//implementation/advertisement_filter.h" +#include "presence/data_element.h" #include "presence/data_types.h" +#include "presence/device_motion.h" #include "presence/implementation/advertisement_decoder.h" #include "presence/implementation/mediums/ble.h" +#include "presence/presence_action.h" #include "presence/presence_device.h" #include "presence/scan_request.h" @@ -49,35 +55,45 @@ ScanSessionId ScanManager::StartScan(ScanRequest scan_request, ScanSessionId id = nearby::RandData(); RunOnServiceControllerThread( "start-scan", - [this, id, scan_request, scan_callback = std::move(cb)]() - ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_) mutable { - ScanningCallback callback = ScanningCallback{ - .start_scanning_result = - [start_scan_client = - std::move(scan_callback.start_scan_cb)]( - absl::Status ble_status) mutable { - start_scan_client(ble_status); - }, - .advertisement_found_cb = - [this, id](BlePeripheral& peripheral, - BleAdvertisementData data) { - RunOnServiceControllerThread( - "notify-found-ble", - [this, id, data = std::move(data), - address = peripheral.GetAddress()]() - ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_) { - NotifyFoundBle(id, data, address); - }); - }}; - FetchCredentials(id, scan_request); - scan_sessions_.insert( - {id, ScanSessionState{ - .request = scan_request, - .callback = std::move(scan_callback), - .decoder = AdvertisementDecoder(scan_request), - .scanning_session = mediums_->GetBle().StartScanning( - scan_request, std::move(callback))}}); - }); + [this, id, scan_request, + scan_callback = + std::move(cb)]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_) mutable { + ScanningCallback callback = ScanningCallback{ + .start_scanning_result = + [start_scan_client = std::move(scan_callback.start_scan_cb)]( + absl::Status ble_status) mutable { + start_scan_client(ble_status); + }, + .advertisement_found_cb = + [this, id](BlePeripheral& peripheral, + BleAdvertisementData data) { + RunOnServiceControllerThread( + "notify-found-ble", + [this, id, data = std::move(data), + address = peripheral.GetAddress()]() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_) { + NotifyFoundBle(id, data, address); + }); + }, + .advertisement_lost_cb = + [this, id](BlePeripheral& peripheral) { + RunOnServiceControllerThread( + "notify-lost-ble", + [this, id, address = peripheral.GetAddress()]() + ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_) { + NotifyLostBle(id, address); + }); + }}; + FetchCredentials(id, scan_request); + scan_sessions_.insert( + {id, ScanSessionState{ + .request = scan_request, + .callback = std::move(scan_callback), + .decoder = AdvertisementDecoderImpl(), + .advertisement_filter = AdvertisementFilter(scan_request), + .scanning_session = mediums_->GetBle().StartScanning( + scan_request, std::move(callback))}}); + }); return id; } @@ -100,40 +116,108 @@ void ScanManager::StopScan(ScanSessionId id) { void ScanManager::NotifyFoundBle(ScanSessionId id, BleAdvertisementData data, absl::string_view remote_address) { - auto advertisement_data = - data.service_data[kPresenceServiceUuid].AsStringView(); auto it = scan_sessions_.find(id); if (it == scan_sessions_.end()) { return; } + + auto advertisement_data = + data.service_data[kPresenceServiceUuid].AsStringView(); + auto advert = it->second.decoder.DecodeAdvertisement(advertisement_data); if (!advert.ok()) { // This advertisement is not relevant to the current element, skip. return; } - if (it->second.decoder.MatchesScanFilter(advert->data_elements)) { - internal::Metadata metadata; - metadata.set_bluetooth_mac_address(std::string(remote_address)); - PresenceDevice device(DeviceMotion(), metadata, advert->identity_type); - // Ok if the advertisement is for trusted/private identity. - if (advert->public_credential.ok()) { - device.SetDecryptSharedCredential(*(advert->public_credential)); - } - device.AddExtendedProperties(advert->data_elements); - for (const auto& data_element : advert->data_elements) { - if (data_element.GetType() == DataElement::kActionFieldType) { - device.AddAction(PresenceAction(static_cast( - static_cast(data_element.GetValue()[0])))); + + if (it->second.advertisement_filter.MatchesScanFilter(*advert)) { + internal::DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_bluetooth_mac_address( + std::string(remote_address)); + + if (!device_address_to_endpoint_id_map_.contains(remote_address)) { + PresenceDevice device(DeviceMotion(), device_identity_metadata, + advert->identity_type); + // Ok if the advertisement is for trusted/private identity. + if (advert->public_credential.ok()) { + device.SetDecryptSharedCredential(*(advert->public_credential)); } + device.AddExtendedProperties(advert->data_elements); + for (const auto& data_element : advert->data_elements) { + if (data_element.GetType() == DataElement::kActionFieldType) { + device.AddAction(PresenceAction(static_cast( + static_cast(data_element.GetValue()[0])))); + } + } + + device_address_to_endpoint_id_map_.emplace(remote_address, + device.GetEndpointId()); + + it->second.callback.on_discovered_cb(std::move(device)); + } else { + PresenceDevice device( + device_address_to_endpoint_id_map_.at(remote_address)); + device.SetDeviceIdentityMetaData(device_identity_metadata); + // Ok if the advertisement is for trusted/private identity. + if (advert->public_credential.ok()) { + device.SetDecryptSharedCredential(*(advert->public_credential)); + } + device.AddExtendedProperties(advert->data_elements); + for (const auto& data_element : advert->data_elements) { + if (data_element.GetType() == DataElement::kActionFieldType) { + device.AddAction(PresenceAction(static_cast( + static_cast(data_element.GetValue()[0])))); + } + } + + it->second.callback.on_updated_cb(std::move(device)); } - it->second.callback.on_discovered_cb(std::move(device)); } } +void ScanManager::NotifyLostBle(ScanSessionId id, + absl::string_view remote_address) { + auto it = scan_sessions_.find(id); + if (it == scan_sessions_.end()) { + return; + } + + if (device_address_to_endpoint_id_map_.contains(remote_address)) { + internal::DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_bluetooth_mac_address( + std::string(remote_address)); + PresenceDevice device( + device_address_to_endpoint_id_map_.at(remote_address)); + device.SetDeviceIdentityMetaData(device_identity_metadata); + + device_address_to_endpoint_id_map_.erase(remote_address); + + it->second.callback.on_lost_cb(std::move(device)); + } +} + +std::vector GetCredentialSelectors( + const ScanRequest& scan_request) { + std::vector all_types = { + nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP, + nearby::internal::IdentityType::IDENTITY_TYPE_CONTACTS_GROUP, + nearby::internal::IdentityType::IDENTITY_TYPE_PUBLIC}; + std::vector selectors; + for (auto identity_type : + (scan_request.identity_types.empty() ? all_types + : scan_request.identity_types)) { + selectors.push_back( + CredentialSelector{.manager_app_id = scan_request.manager_app_id, + .account_name = scan_request.account_name, + .identity_type = identity_type}); + } + return selectors; +} + void ScanManager::FetchCredentials(ScanSessionId id, const ScanRequest& scan_request) { std::vector credential_selectors = - AdvertisementDecoder::GetCredentialSelectors(scan_request); + GetCredentialSelectors(scan_request); for (const CredentialSelector& selector : credential_selectors) { // Not fetching for PUBLIC. if (selector.identity_type == internal::IDENTITY_TYPE_UNSPECIFIED || @@ -170,13 +254,19 @@ void ScanManager::FetchCredentials(ScanSessionId id, void ScanManager::UpdateCredentials(ScanSessionId id, IdentityType identity_type, std::vector credentials) { + // Credentials should never get fetched for PUBLIC of No-Identity requests + assert(identity_type != internal::IDENTITY_TYPE_UNSPECIFIED); + assert(identity_type != internal::IDENTITY_TYPE_PUBLIC); + auto it = scan_sessions_.find(id); + if (it == scan_sessions_.end()) { return; } + ScanSessionState& session = it->second; session.credentials[identity_type] = std::move(credentials); - session.decoder = AdvertisementDecoder(session.request, &session.credentials); + session.decoder = AdvertisementDecoderImpl(&session.credentials); } int ScanManager::ScanningCallbacksLengthForTest() { diff --git a/presence/implementation/scan_manager.h b/presence/implementation/scan_manager.h index 9262c09b..c0127afb 100644 --- a/presence/implementation/scan_manager.h +++ b/presence/implementation/scan_manager.h @@ -15,21 +15,33 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_SCAN_MANAGER_H_ #define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_SCAN_MANAGER_H_ -#include #include #include #include #include +#include "absl/base/thread_annotations.h" #include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/mutex.h" +#include "internal/platform/mutex_lock.h" +#include "internal/platform/runnable.h" #include "internal/platform/single_thread_executor.h" #include "internal/proto/credential.pb.h" #include "presence/data_types.h" -#include "presence/implementation/advertisement_decoder.h" +#include "presence/implementation/advertisement_filter.h" #include "presence/implementation/credential_manager.h" #include "presence/implementation/mediums/mediums.h" #include "presence/scan_request.h" +#ifdef USE_RUST_DECODER +#include "presence/implementation/advertisement_decoder_rust_impl.h" +#else +#include "presence/implementation/advertisement_decoder_impl.h" +#endif + + namespace nearby { namespace presence { @@ -65,12 +77,15 @@ class ScanManager { ScanCallback callback; absl::flat_hash_map> credentials; - AdvertisementDecoder decoder; + AdvertisementDecoderImpl decoder; + AdvertisementFilter advertisement_filter; std::unique_ptr scanning_session; }; void NotifyFoundBle(ScanSessionId id, BleAdvertisementData data, absl::string_view remote_address) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_); + void NotifyLostBle(ScanSessionId id, absl::string_view remote_address) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_); void FetchCredentials(ScanSessionId id, const ScanRequest& scan_request) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*executor_); void UpdateCredentials(ScanSessionId id, IdentityType identity_type, @@ -83,6 +98,9 @@ class ScanManager { CredentialManager* credential_manager_; absl::flat_hash_map scan_sessions_ ABSL_GUARDED_BY(*executor_); + absl::flat_hash_map + device_address_to_endpoint_id_map_ + ABSL_GUARDED_BY(*executor_); SingleThreadExecutor* executor_; }; diff --git a/presence/implementation/scan_manager_test.cc b/presence/implementation/scan_manager_test.cc index 604015b1..f58a7c8c 100644 --- a/presence/implementation/scan_manager_test.cc +++ b/presence/implementation/scan_manager_test.cc @@ -14,9 +14,7 @@ #include "presence/implementation/scan_manager.h" -#include - -#include +#include #include #include #include @@ -25,17 +23,28 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" -#include "absl/time/time.h" +#include "absl/strings/escaping.h" +#include "absl/types/variant.h" #include "internal/platform/bluetooth_adapter.h" +#include "internal/platform/byte_array.h" #include "internal/platform/count_down_latch.h" +#include "internal/platform/implementation/ble_v2.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "internal/platform/logging.h" #include "internal/platform/medium_environment.h" #include "internal/platform/single_thread_executor.h" -#include "presence/implementation/advertisement_factory.h" -#include "presence/implementation/base_broadcast_request.h" +#include "internal/proto/credential.proto.h" +#include "presence/data_element.h" +#include "presence/data_types.h" #include "presence/implementation/credential_manager_impl.h" +#include "presence/implementation/mediums/advertisement_data.h" #include "presence/implementation/mediums/ble.h" #include "presence/implementation/mediums/mediums.h" +#include "presence/implementation/mock_credential_manager.h" +#include "presence/power_mode.h" +#include "presence/presence_action.h" +#include "presence/presence_device.h" +#include "presence/scan_request.h" namespace nearby { namespace presence { @@ -47,7 +56,6 @@ using AdvertisingCallback = using ::nearby::SingleThreadExecutor; using CountDownLatch = ::nearby::CountDownLatch; -// using ::testing::UnorderedElementsAre; using ::testing::Contains; class ScanManagerTest : public testing::Test { @@ -59,20 +67,12 @@ class ScanManagerTest : public testing::Test { } std::unique_ptr StartAdvertisingOn(Ble& ble) { - PresenceBroadcast::BroadcastSection section = { - .identity = internal::IDENTITY_TYPE_PUBLIC, - .extended_properties = MakeDefaultExtendedProperties(), - .account_name = "Test account"}; - PresenceBroadcast presence_request = {.sections = {section}}; - BroadcastRequest input = {.tx_power = 30, .variant = presence_request}; - absl::StatusOr request = - BaseBroadcastRequest::Create(input); - EXPECT_OK(request); - absl::StatusOr advertisement = - AdvertisementFactory().CreateAdvertisement(request.value()); - EXPECT_OK(advertisement); + auto advertisement = AdvertisementData{ + .is_extended_advertisement = false, + .content = {0x00, 0x26, 0x00, 0x40}, + }; std::unique_ptr session = ble.StartAdvertising( - advertisement.value(), PowerMode::kLowPower, + advertisement, PowerMode::kLowPower, AdvertisingCallback{.start_advertising_result = [](absl::Status) {}}); env_.Sync(); return session; @@ -103,7 +103,11 @@ class ScanManagerTest : public testing::Test { } }, .on_discovered_cb = - [this](PresenceDevice pd) { found_latch_.CountDown(); }}; + [this](PresenceDevice pd) { found_latch_.CountDown(); }, + .on_updated_cb = + [this](PresenceDevice pd) { updated_latch_.CountDown(); }, + .on_lost_cb = + [this](PresenceDevice pd) { lost_latch_.CountDown(); }}; } std::vector MakeDefaultIdentityTypes() { @@ -112,13 +116,15 @@ class ScanManagerTest : public testing::Test { }; } std::vector MakeDefaultExtendedProperties() { - return {DataElement(ActionBit::kPresenceManagerAction)}; + return {DataElement(ActionBit::kNearbyShareAction)}; } SingleThreadExecutor executor_; CredentialManagerImpl credential_manager_{&executor_}; nearby::MediumEnvironment& env_ = {nearby::MediumEnvironment::Instance()}; CountDownLatch start_latch_{1}; CountDownLatch found_latch_{1}; + CountDownLatch updated_latch_{1}; + CountDownLatch lost_latch_{1}; }; TEST_F(ScanManagerTest, CanStartThenStopScanning) { @@ -200,25 +206,33 @@ TEST_F(ScanManagerTest, PresenceMetadataIsRetained) { }, .on_discovered_cb = [this, &address](PresenceDevice pd) { - if (pd.GetMetadata().bluetooth_mac_address() == address) { - EXPECT_THAT( - pd.GetExtendedProperties(), - Contains( - DataElement(DataElement::kPublicIdentityFieldType, "")) - .Times(1)); - // MakeDefaultScanRequest() used kPresenceManagerAction for - // broadcasting. Thus verify DE and action got it recorded. - EXPECT_THAT( - pd.GetExtendedProperties(), - Contains(DataElement(ActionBit::kPresenceManagerAction)) - .Times(1)); - EXPECT_THAT(pd.GetActions(), - Contains(PresenceAction{ - (int)ActionBit::kPresenceManagerAction}) + if (pd.GetDeviceIdentityMetadata().bluetooth_mac_address() == + address) { + EXPECT_THAT(pd.GetExtendedProperties(), + Contains(DataElement(ActionBit::kNearbyShareAction)) .Times(1)); + EXPECT_THAT( + pd.GetActions(), + Contains(PresenceAction{(int)ActionBit::kNearbyShareAction}) + .Times(1)); found_latch_.CountDown(); } + }, + .on_updated_cb = + [this, &address](PresenceDevice pd) { + if (pd.GetDeviceIdentityMetadata().bluetooth_mac_address() == + address) { + EXPECT_THAT(pd.GetExtendedProperties(), + Contains(DataElement(ActionBit::kNearbyShareAction)) + .Times(1)); + EXPECT_THAT( + pd.GetActions(), + Contains(PresenceAction{(int)ActionBit::kNearbyShareAction}) + .Times(1)); + + updated_latch_.CountDown(); + } }}; // Start scanning ScanRequest scan_request_no_filter = MakeDefaultScanRequest(); @@ -230,6 +244,37 @@ TEST_F(ScanManagerTest, PresenceMetadataIsRetained) { ASSERT_TRUE(mediums.GetBle().IsAvailable()); EXPECT_TRUE(start_latch_.Await().Ok()); EXPECT_TRUE(found_latch_.Await().Ok()); + + // Advertise again to trigger `on_updated_cb` + advertising_session = StartAdvertisingOn(ble2); + + EXPECT_TRUE(updated_latch_.Await().Ok()); + manager.StopScan(scan_session); + EXPECT_EQ(manager.ScanningCallbacksLengthForTest(), 0); +} + +TEST_F(ScanManagerTest, DiscoverThenLoseAdvertisement) { + Mediums mediums; + ScanManager manager(mediums, credential_manager_, executor_); + // Set up advertiser + nearby::BluetoothAdapter server_adapter; + Ble ble2(server_adapter); + std::unique_ptr advertising_session = + StartAdvertisingOn(ble2); + + // Start scanning + ScanSessionId scan_session = + manager.StartScan(MakeDefaultScanRequest(), MakeDefaultScanCallback()); + + EXPECT_EQ(manager.ScanningCallbacksLengthForTest(), 1); + EXPECT_TRUE(start_latch_.Await().Ok()); + EXPECT_TRUE(found_latch_.Await().Ok()); + + // Stop advertising to trigger `on_lost_cb` + EXPECT_OK(advertising_session->stop_advertising()); + env_.Sync(); + + EXPECT_TRUE(lost_latch_.Await().Ok()); manager.StopScan(scan_session); EXPECT_EQ(manager.ScanningCallbacksLengthForTest(), 0); } @@ -324,6 +369,83 @@ TEST_F(ScanManagerTest, NoDeviceFoundAfterStopScan) { executor_.Shutdown(); } +internal::SharedCredential GetPublicCredential() { + // Values copied from LDT tests + ByteArray seed({ + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, + }); + ByteArray known_mac({0x09, 0xFE, 0x9E, 0x81, 0xB7, 0x3E, 0x5E, 0xCC, + 0x76, 0x59, 0x57, 0x71, 0xE0, 0x1F, 0xFB, 0x34, + 0x38, 0xE7, 0x5F, 0x24, 0xA7, 0x69, 0x56, 0xA0, + 0xB8, 0xEA, 0x67, 0xD1, 0x1C, 0x3E, 0x36, 0xFD}); + internal::SharedCredential public_credential; + public_credential.set_key_seed(seed.AsStringView()); + public_credential.set_metadata_encryption_key_tag_v0( + known_mac.AsStringView()); + return public_credential; +} + +std::vector BuildSharedCredentials() { + return {GetPublicCredential()}; +} + +TEST_F(ScanManagerTest, ScanningE2EWithEncryptedAdvertisementAndCredentials) { + Mediums mediums; + auto mock_credential_manager = MockCredentialManager(); + EXPECT_CALL(mock_credential_manager, GetPublicCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + PublicCredentialType public_credential_type, + GetPublicCredentialsResultCallback callback) { + callback.credentials_fetched_cb(BuildSharedCredentials()); + }); + ScanManager manager(mediums, mock_credential_manager, executor_); + + // Set up advertiser to broadcast a private identity adv + nearby::BluetoothAdapter server_adapter; + Ble ble2(server_adapter); + std::string V0AdvEncryptedBytes = "042222D82212EF16DBF872F2A3A7C0FA5248EC"; + std::string payload = absl::HexStringToBytes(V0AdvEncryptedBytes); + auto advertisement = AdvertisementData{ + .is_extended_advertisement = false, + .content = payload, + }; + + std::unique_ptr session = ble2.StartAdvertising( + advertisement, PowerMode::kLowPower, + AdvertisingCallback{.start_advertising_result = [](absl::Status) {}}); + env_.Sync(); + + std::vector< + absl::variant> // NOLINT + filters = {PresenceScanFilter{ + .scan_type = ScanType::kPresenceScan, + .extended_properties = {DataElement(DataElement::kTxPowerFieldType, + 3)}, + }}; + + ScanRequest scan_request = { + .account_name = "Test account", + .identity_types = + {nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP}, + .scan_filters = filters, + .use_ble = true, + .scan_type = ScanType::kPresenceScan, + .power_mode = PowerMode::kBalanced, + .scan_only_when_screen_on = true, + }; + + // Start scanning + ScanSessionId scan_session = + manager.StartScan(scan_request, MakeDefaultScanCallback()); + EXPECT_EQ(manager.ScanningCallbacksLengthForTest(), 1); + EXPECT_TRUE(start_latch_.Await().Ok()); + EXPECT_TRUE(found_latch_.Await().Ok()); + manager.StopScan(scan_session); + EXPECT_EQ(manager.ScanningCallbacksLengthForTest(), 0); +} + } // namespace } // namespace presence } // namespace nearby diff --git a/presence/implementation/service_controller.h b/presence/implementation/service_controller.h index bd27c003..9389741e 100644 --- a/presence/implementation/service_controller.h +++ b/presence/implementation/service_controller.h @@ -15,10 +15,10 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_SERVICE_CONTROLLER_H_ #define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_SERVICE_CONTROLLER_H_ -#include #include #include "absl/status/statusor.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "internal/proto/metadata.pb.h" #include "presence/broadcast_request.h" #include "presence/data_types.h" @@ -48,7 +48,15 @@ class ServiceController { const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) = 0; - virtual ::nearby::internal::Metadata GetLocalDeviceMetadata() = 0; + virtual void UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb) = 0; + virtual ::nearby::internal::DeviceIdentityMetaData + GetDeviceIdentityMetaData() = 0; virtual void GetLocalPublicCredentials( const CredentialSelector& credential_selector, GetPublicCredentialsResultCallback callback) = 0; @@ -57,6 +65,9 @@ class ServiceController { const std::vector& remote_public_creds, UpdateRemotePublicCredentialsCallback credentials_updated_cb) = 0; + virtual void GetLocalCredentials( + const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) = 0; }; } // namespace presence diff --git a/presence/implementation/service_controller_impl.cc b/presence/implementation/service_controller_impl.cc index 60efdc31..3c158fc6 100644 --- a/presence/implementation/service_controller_impl.cc +++ b/presence/implementation/service_controller_impl.cc @@ -18,7 +18,9 @@ #include #include "absl/status/statusor.h" +#include "internal/platform/implementation/credential_callbacks.h" #include "presence/data_types.h" +#include "presence/implementation/credential_manager.h" namespace nearby { namespace presence { @@ -41,16 +43,24 @@ void ServiceControllerImpl::StopBroadcast(BroadcastSessionId id) { broadcast_manager_.StopBroadcast(id); } +// TODO(b/327629276): Remove this function. void ServiceControllerImpl::UpdateLocalDeviceMetadata( const ::nearby::internal::Metadata& metadata, bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb) {} + +void ServiceControllerImpl::UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) { - credential_manager_.SetLocalDeviceMetadata( - metadata, regen_credentials, manager_app_id, identity_types, - credential_life_cycle_days, contiguous_copy_of_credentials, - std::move(credentials_generated_cb)); + credential_manager_.SetDeviceIdentityMetaData( + device_identity_metadata, regen_credentials, manager_app_id, + identity_types, credential_life_cycle_days, + contiguous_copy_of_credentials, std::move(credentials_generated_cb)); } void ServiceControllerImpl::GetLocalPublicCredentials( @@ -70,5 +80,12 @@ void ServiceControllerImpl::UpdateRemotePublicCredentials( std::move(credentials_updated_cb)); } +void ServiceControllerImpl::GetLocalCredentials( + const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + credential_manager_.GetLocalCredentials(credential_selector, + std::move(callback)); +} + } // namespace presence } // namespace nearby diff --git a/presence/implementation/service_controller_impl.h b/presence/implementation/service_controller_impl.h index 3590d34d..b858b7b3 100644 --- a/presence/implementation/service_controller_impl.h +++ b/presence/implementation/service_controller_impl.h @@ -15,15 +15,21 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_SERVICE_CONTROLLER_IMPL_H_ #define THIRD_PARTY_NEARBY_PRESENCE_IMPLEMENTATION_SERVICE_CONTROLLER_IMPL_H_ -#include #include #include +#include +#include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/credential_callbacks.h" +#include "internal/platform/runnable.h" +#include "internal/platform/single_thread_executor.h" #include "internal/proto/metadata.pb.h" +#include "presence/broadcast_request.h" +#include "presence/data_types.h" #include "presence/implementation/broadcast_manager.h" -#include "presence/implementation/credential_manager_impl.h" -#include "presence/implementation/mediums/mediums.h" +#include "presence/implementation/credential_manager.h" #include "presence/implementation/scan_manager.h" #include "presence/implementation/service_controller.h" #include "presence/scan_request.h" @@ -39,6 +45,14 @@ class ServiceControllerImpl : public ServiceController { public: using SingleThreadExecutor = ::nearby::SingleThreadExecutor; + ServiceControllerImpl(SingleThreadExecutor* executor, + CredentialManager* credential_manager, + ScanManager* scan_manager, + BroadcastManager* broadcast_manager) + : executor_(*executor), + credential_manager_(*credential_manager), + scan_manager_(*scan_manager), + broadcast_manager_(*broadcast_manager) {} ~ServiceControllerImpl() override { executor_.Shutdown(); } absl::StatusOr StartScan(ScanRequest scan_request, @@ -53,9 +67,17 @@ class ServiceControllerImpl : public ServiceController { const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) override; + void UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, + const std::vector& identity_types, + int credential_life_cycle_days, int contiguous_copy_of_credentials, + GenerateCredentialsResultCallback credentials_generated_cb) override; - ::nearby::internal::Metadata GetLocalDeviceMetadata() override { - return credential_manager_.GetLocalDeviceMetadata(); + ::nearby::internal::DeviceIdentityMetaData GetDeviceIdentityMetaData() + override { + return credential_manager_.GetDeviceIdentityMetaData(); } void GetLocalPublicCredentials( const CredentialSelector& credential_selector, @@ -65,24 +87,21 @@ class ServiceControllerImpl : public ServiceController { const std::vector& remote_public_creds, UpdateRemotePublicCredentialsCallback credentials_updated_cb) override; + void GetLocalCredentials(const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) override; SingleThreadExecutor& GetBackgroundExecutor() { return executor_; } - // Gives tests access to mediums. - Mediums& GetMediums() { return mediums_; } - private: - SingleThreadExecutor executor_; void NotifyStartCallbackStatus(BroadcastSessionId id, absl::Status status); void RunOnServiceControllerThread(absl::string_view name, Runnable runnable) { executor_.Execute(std::string(name), std::move(runnable)); } - Mediums mediums_; // NOLINT: further impl will use it. - CredentialManagerImpl credential_manager_{ - &executor_}; // NOLINT: further impl will use it. - ScanManager scan_manager_{mediums_, credential_manager_, - executor_}; // NOLINT: further impl will use it. - BroadcastManager broadcast_manager_{mediums_, credential_manager_, executor_}; + + SingleThreadExecutor& executor_; + CredentialManager& credential_manager_; + ScanManager& scan_manager_; + BroadcastManager& broadcast_manager_; }; } // namespace presence diff --git a/presence/implementation/service_controller_impl_test.cc b/presence/implementation/service_controller_impl_test.cc new file mode 100644 index 00000000..5d638186 --- /dev/null +++ b/presence/implementation/service_controller_impl_test.cc @@ -0,0 +1,102 @@ +// Copyright 2023 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. + +#include "presence/implementation/service_controller_impl.h" + +#include +#include +#include +#include + +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" +#include "gtest/gtest.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/platform/implementation/credential_callbacks.h" +#include "internal/platform/single_thread_executor.h" +#include "internal/proto/credential.pb.h" +#include "presence/implementation/broadcast_manager.h" +#include "presence/implementation/mediums/mediums.h" +#include "presence/implementation/mock_credential_manager.h" +#include "presence/implementation/scan_manager.h" + +namespace nearby { +namespace presence { +namespace { + +constexpr absl::string_view kManagerAppId = "TEST_MANAGER_APP"; +constexpr absl::string_view kAccountName = "test account"; +constexpr absl::string_view kSecretId1 = "1111111"; +constexpr absl::string_view kSecretId2 = "2222222"; +constexpr absl::string_view kSecretId3 = "3333333"; + +CredentialSelector BuildDefaultCredentialSelector() { + CredentialSelector credential_selector; + credential_selector.manager_app_id = std::string(kManagerAppId); + credential_selector.account_name = std::string(kAccountName); + credential_selector.identity_type = + ::nearby::internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; + return credential_selector; +} + +std::vector BuildLocalCredentials() { + internal::LocalCredential local_credential1; + local_credential1.set_secret_id(kSecretId1); + internal::LocalCredential local_credential2; + local_credential2.set_secret_id(kSecretId2); + internal::LocalCredential local_credential3; + local_credential3.set_secret_id(kSecretId3); + return {local_credential1, local_credential2, local_credential3}; +} + +TEST(ServiceControllerImplTest, GetLocalCredentials) { + auto mock_credential_manager = std::make_unique(); + EXPECT_CALL(*mock_credential_manager.get(), GetLocalCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + callback.credentials_fetched_cb(BuildLocalCredentials()); + }); + + Mediums mediums; + SingleThreadExecutor executor; + ScanManager scan_manager{mediums, *mock_credential_manager, executor}; + BroadcastManager broadcast_manager{mediums, *mock_credential_manager, + executor}; + + auto service_controller = std::make_unique( + &executor, mock_credential_manager.get(), &scan_manager, + &broadcast_manager); + CredentialSelector credential_selector = BuildDefaultCredentialSelector(); + + absl::StatusOr> + private_credentials; + service_controller->GetLocalCredentials( + credential_selector, + {.credentials_fetched_cb = + [&](absl::StatusOr> + credentials) { + private_credentials = std::move(credentials); + }}); + + EXPECT_OK(private_credentials); + ASSERT_EQ(3u, private_credentials->size()); + ASSERT_EQ(private_credentials->at(0).secret_id(), kSecretId1); + ASSERT_EQ(private_credentials->at(1).secret_id(), kSecretId2); + ASSERT_EQ(private_credentials->at(2).secret_id(), kSecretId3); +} + +} // namespace +} // namespace presence +} // namespace nearby diff --git a/presence/presence_client_impl.cc b/presence/presence_client_impl.cc index a136f86d..828dc580 100644 --- a/presence/presence_client_impl.cc +++ b/presence/presence_client_impl.cc @@ -80,7 +80,7 @@ void PresenceClientImpl::StopBroadcast(BroadcastSessionId session_id) { if (borrowed) { (*borrowed)->StopBroadcast(session_id); } else { - NEARBY_LOGS(VERBOSE) << "Session already finished, id: " << session_id; + NEARBY_VLOG(1) << "Session already finished, id: " << session_id; } } diff --git a/presence/presence_client_test.cc b/presence/presence_client_test.cc index 7e24acc8..2c43f26f 100644 --- a/presence/presence_client_test.cc +++ b/presence/presence_client_test.cc @@ -12,12 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "presence/presence_client.h" + #include +#include +#include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" #include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "internal/platform/future.h" #include "internal/platform/medium_environment.h" #include "presence/data_types.h" #include "presence/presence_device.h" @@ -27,7 +34,7 @@ namespace nearby { namespace presence { namespace { -using ::nearby::internal::Metadata; +using ::nearby::internal::DeviceIdentityMetaData; using ::testing::status::StatusIs; constexpr absl::string_view kMacAddr = "\x4C\x8B\x1D\xCE\xBA\xD1"; @@ -39,15 +46,14 @@ std::unique_ptr CreateDefunctPresenceClient() { return presence_service.CreatePresenceClient(); } -Metadata CreateTestMetadata() { - Metadata metadata; - metadata.set_device_type(internal::DEVICE_TYPE_PHONE); - metadata.set_account_name("test_account"); - metadata.set_device_name("NP test device"); - metadata.set_user_name("Test user"); - metadata.set_device_profile_url("test_image.test.com"); - metadata.set_bluetooth_mac_address(kMacAddr); - return metadata; +DeviceIdentityMetaData CreateTestDeviceIdentityMetaData() { + DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_device_type( + internal::DeviceType::DEVICE_TYPE_PHONE); + device_identity_metadata.set_device_name("NP test device"); + device_identity_metadata.set_bluetooth_mac_address(kMacAddr); + device_identity_metadata.set_device_id("\x12\xab\xcd"); + return device_identity_metadata; } class PresenceClientTest : public testing::Test { @@ -125,13 +131,13 @@ TEST_F(PresenceClientTest, GettingDeviceWorks) { PresenceServiceImpl presence_service; std::unique_ptr presence_client = presence_service.CreatePresenceClient(); - presence_service.UpdateLocalDeviceMetadata(CreateTestMetadata(), false, "", - {}, 0, 0, {}); + presence_service.UpdateDeviceIdentityMetaData( + CreateTestDeviceIdentityMetaData(), false, "", {}, 0, 0, {}); auto device = presence_client->GetLocalDevice(); ASSERT_NE(device, std::nullopt); EXPECT_EQ(device->GetEndpointId().length(), kEndpointIdLength); - EXPECT_EQ(device->GetMetadata().SerializeAsString(), - CreateTestMetadata().SerializeAsString()); + EXPECT_EQ(device->GetDeviceIdentityMetadata().SerializeAsString(), + CreateTestDeviceIdentityMetaData().SerializeAsString()); } TEST_F(PresenceClientTest, TestGettingDeviceDefunct) { diff --git a/presence/presence_device.cc b/presence/presence_device.cc index afbec278..e2651089 100644 --- a/presence/presence_device.cc +++ b/presence/presence_device.cc @@ -17,6 +17,7 @@ #include #include +#include "absl/strings/string_view.h" #include "absl/types/variant.h" #include "connections/implementation/proto/offline_wire_formats.pb.h" #include "internal/interop/device.h" @@ -38,8 +39,8 @@ constexpr char kEndpointIdChars[] = { // LINT.IfChange constexpr int kAndroidIdentityTypeUnknown = -1; -constexpr int kAndroidIdentityTypePrivate = 0; -constexpr int kAndroidIdentityTypeTrusted = 1; +constexpr int kAndroidIdentityTypePrivateGroup = 0; +constexpr int kAndroidIdentityTypeContactsGroup = 1; constexpr int kAndroidIdentityTypePublic = 2; // LINT.ThenChange( // //depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/presence/PresenceIdentity.java @@ -78,10 +79,10 @@ ConvertToConnectionsDeviceType(internal::DeviceType device_type) { int ConvertToAndroidIdentityType(nearby::internal::IdentityType identity_type) { switch (identity_type) { - case internal::IDENTITY_TYPE_PRIVATE: - return kAndroidIdentityTypePrivate; - case internal::IDENTITY_TYPE_TRUSTED: - return kAndroidIdentityTypeTrusted; + case internal::IDENTITY_TYPE_PRIVATE_GROUP: + return kAndroidIdentityTypePrivateGroup; + case internal::IDENTITY_TYPE_CONTACTS_GROUP: + return kAndroidIdentityTypeContactsGroup; case internal::IDENTITY_TYPE_PUBLIC: return kAndroidIdentityTypePublic; default: @@ -91,26 +92,31 @@ int ConvertToAndroidIdentityType(nearby::internal::IdentityType identity_type) { } } // namespace -PresenceDevice::PresenceDevice(Metadata metadata) noexcept +PresenceDevice::PresenceDevice(absl::string_view endpoint_id) noexcept + : endpoint_id_(endpoint_id) {} + +PresenceDevice::PresenceDevice( + DeviceIdentityMetaData device_identity_metadata) noexcept : discovery_timestamp_(nearby::SystemClock::ElapsedRealtime()), device_motion_(DeviceMotion()), - metadata_(metadata) { + device_identity_metadata_(device_identity_metadata) { endpoint_id_ = GenerateRandomEndpointId(); } -PresenceDevice::PresenceDevice(DeviceMotion device_motion, - Metadata metadata) noexcept +PresenceDevice::PresenceDevice( + DeviceMotion device_motion, + DeviceIdentityMetaData device_identity_metadata) noexcept : discovery_timestamp_(nearby::SystemClock::ElapsedRealtime()), device_motion_(device_motion), - metadata_(metadata) { + device_identity_metadata_(device_identity_metadata) { endpoint_id_ = GenerateRandomEndpointId(); } PresenceDevice::PresenceDevice( - DeviceMotion device_motion, Metadata metadata, + DeviceMotion device_motion, DeviceIdentityMetaData device_identity_metadata, nearby::internal::IdentityType identity_type) noexcept : discovery_timestamp_(nearby::SystemClock::ElapsedRealtime()), device_motion_(device_motion), - metadata_(metadata), + device_identity_metadata_(device_identity_metadata), identity_type_(identity_type) { endpoint_id_ = GenerateRandomEndpointId(); } @@ -122,9 +128,9 @@ std::vector PresenceDevice::GetConnectionInfos() for (const auto& action : actions_) { transformed_actions.push_back(action.GetActionIdentifier()); } - return {nearby::BleConnectionInfo(metadata_.bluetooth_mac_address(), - /*gatt_characteristic=*/"", /*psm=*/"", - transformed_actions)}; + return {nearby::BleConnectionInfo( + device_identity_metadata_.bluetooth_mac_address(), + /*gatt_characteristic=*/"", /*psm=*/"", transformed_actions)}; } std::string PresenceDevice::ToProtoBytes() const { @@ -147,9 +153,8 @@ std::string PresenceDevice::ToProtoBytes() const { absl::get(connection_info).ToDataElementBytes(); } if (absl::holds_alternative(connection_info)) { - connection_infos += - absl::get(connection_info) - .ToDataElementBytes(); + connection_infos += absl::get(connection_info) + .ToDataElementBytes(); } if (absl::holds_alternative(connection_info)) { connection_infos += absl::get(connection_info) @@ -157,10 +162,10 @@ std::string PresenceDevice::ToProtoBytes() const { } } device.set_device_type( - ConvertToConnectionsDeviceType(metadata_.device_type())); - device.set_device_name(metadata_.device_name()); + ConvertToConnectionsDeviceType(device_identity_metadata_.device_type())); + device.set_device_name(device_identity_metadata_.device_name()); device.set_connectivity_info_list(connection_infos); - device.set_device_image_url(metadata_.device_profile_url()); + device.set_device_image_url("dummy url"); // Not used. return device.SerializeAsString(); } } // namespace presence diff --git a/presence/presence_device.h b/presence/presence_device.h index 231ecffb..93bac818 100644 --- a/presence/presence_device.h +++ b/presence/presence_device.h @@ -15,9 +15,11 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_PRESENCE_DEVICE_H_ #define THIRD_PARTY_NEARBY_PRESENCE_PRESENCE_DEVICE_H_ +#include #include #include +#include "absl/strings/string_view.h" #include "absl/time/time.h" #include "internal/interop/device.h" #include "internal/proto/credential.pb.h" @@ -33,13 +35,18 @@ inline constexpr int kEndpointIdLength = 4; class PresenceDevice : public nearby::NearbyDevice { using Metadata = ::nearby::internal::Metadata; + using DeviceIdentityMetaData = ::nearby::internal::DeviceIdentityMetaData; public: - explicit PresenceDevice(Metadata metadata) noexcept; - explicit PresenceDevice(DeviceMotion device_motion, - Metadata metadata) noexcept; + explicit PresenceDevice(absl::string_view endpoint_id) noexcept; explicit PresenceDevice( - DeviceMotion device_motion, Metadata metadata, + DeviceIdentityMetaData device_identity_metadata) noexcept; + explicit PresenceDevice( + DeviceMotion device_motion, + DeviceIdentityMetaData device_identity_metadata) noexcept; + explicit PresenceDevice( + DeviceMotion device_motion, + DeviceIdentityMetaData device_identity_metadata, nearby::internal::IdentityType identity_type) noexcept; std::string GetEndpointId() const override { return endpoint_id_; } std::vector GetConnectionInfos() @@ -61,8 +68,13 @@ class PresenceDevice : public nearby::NearbyDevice { return NearbyDevice::Type::kPresenceDevice; } DeviceMotion GetDeviceMotion() const { return device_motion_; } - Metadata GetMetadata() const { return metadata_; } - void SetMetadata(const Metadata metadata) { metadata_ = metadata; } + DeviceIdentityMetaData GetDeviceIdentityMetadata() const { + return device_identity_metadata_; + } + void SetDeviceIdentityMetaData( + const DeviceIdentityMetaData& device_identity_metadata) { + device_identity_metadata_ = device_identity_metadata; + } void SetDecryptSharedCredential( const internal::SharedCredential& decrypt_shared_credential) { decrypt_shared_credential_ = decrypt_shared_credential; @@ -77,7 +89,7 @@ class PresenceDevice : public nearby::NearbyDevice { private: const absl::Time discovery_timestamp_; const DeviceMotion device_motion_; - Metadata metadata_; + DeviceIdentityMetaData device_identity_metadata_; std::vector extended_properties_; std::vector actions_; std::string endpoint_id_; @@ -99,8 +111,8 @@ inline bool operator==(const PresenceDevice& d1, const PresenceDevice& d2) { d2.GetDecryptSharedCredential()->SerializeAsString(); } return d1.GetDeviceMotion() == d2.GetDeviceMotion() && - d1.GetMetadata().SerializeAsString() == - d2.GetMetadata().SerializeAsString() && + d1.GetDeviceIdentityMetadata().SerializeAsString() == + d2.GetDeviceIdentityMetadata().SerializeAsString() && d1.GetActions() == d2.GetActions() && d1.GetExtendedProperties() == d2.GetExtendedProperties() && d1.GetIdentityType() == d2.GetIdentityType() && diff --git a/presence/presence_device_provider.cc b/presence/presence_device_provider.cc new file mode 100644 index 00000000..74201568 --- /dev/null +++ b/presence/presence_device_provider.cc @@ -0,0 +1,263 @@ +// Copyright 2023 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. + +#include "presence/presence_device_provider.h" + +#include +#include +#include +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "absl/types/variant.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/authentication_transport.h" +#include "internal/interop/device.h" +#include "internal/platform/exception.h" +#include "internal/platform/future.h" +#include "internal/platform/implementation/system_clock.h" +#include "internal/platform/logging.h" +#include "presence/implementation/connection_authenticator.h" +#include "presence/implementation/service_controller.h" +#include "presence/presence_device.h" +#include "presence/proto/presence_frame.pb.h" + +namespace nearby { +namespace presence { + +namespace { + +constexpr int kPresenceVersion = 1; + +// TODO(b/317215548): Use Status code rather than custom defined +// authentication status. +std::string AuthenticationErrorToString(AuthenticationStatus status) { + switch (status) { + case AuthenticationStatus::kUnknown: + return "AuthenticationStatus::kUnknown"; + case AuthenticationStatus::kSuccess: + return "AuthenticationStatus::kSuccess"; + case AuthenticationStatus::kFailure: + return "AuthenticationStatus::kFailure"; + } + NEARBY_LOGS(ERROR) << "Unexpected value for AuthenticationStatus: " + << static_cast(status); + return "AuthenticationStatus::kUnknown"; +} + +std::optional GetValidCredential( + std::vector local_credentials) { + absl::Time now = SystemClock::ElapsedRealtime(); + for (auto& credential : local_credentials) { + if (absl::FromUnixMillis(credential.start_time_millis()) <= now && + absl::FromUnixMillis(credential.end_time_millis()) > now) { + return credential; + } + } + return std::nullopt; +} + +PresenceAuthenticationFrame BuildInitiatorPresenceAuthenticationFrame( + ConnectionAuthenticator::InitiatorData initiator_data_variant) { + // It is expected that the `PresenceAuthenticationFrame` built for the + // initator role always is `TwoWayInitiatorData`, since the local device is + // always expected to have a valid local credential to be used, and this is + // verified in AuthenticateAsInitiator(), which returns failure if no valid + // local credential is found (which is expected to not happen, since valid + // credentials will be generated if needed before the authentiation is + // called). + // + // Note: std::holds_alternative and std::get cannot be used here because + // they are not supported in Chromium. + DCHECK(absl::holds_alternative( + initiator_data_variant)); + auto two_way_initiator_data = + absl::get( + initiator_data_variant); + + PresenceAuthenticationFrame authentication_frame; + authentication_frame.set_version(kPresenceVersion); + authentication_frame.set_private_key_signature( + two_way_initiator_data.private_key_signature); + authentication_frame.set_shared_credential_id_hash( + two_way_initiator_data.shared_credential_hash); + return authentication_frame; +} + +} // namespace + +PresenceDeviceProvider::PresenceDeviceProvider( + ServiceController* service_controller, + const ConnectionAuthenticator* connection_authenticator) + : service_controller_(*service_controller), + device_(service_controller_.GetDeviceIdentityMetaData()), + connection_authenticator_(*connection_authenticator) { + CHECK(connection_authenticator); +} + +AuthenticationStatus PresenceDeviceProvider::AuthenticateAsInitiator( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const { + Future response; + + // 1. Fetch the local credentials and select the correct one to use + // for authentication by calling `GetValidCredential()`, which + // iterates over the returned list and returns the local credential + // that corresponds with the current time. + // + // TODO(b/304843571): Add support for additional IdentityTypes and for + // AuthenticationStatus::kUnknown. Currently, only `IDENTITY_TYPE_PRIVATE` is + // supported in order to unblock Nearby Presence MVP on CrOS, however in + // order to support future IdentityTypes, there needs to be a way to + // plumb in the requested identity type, as well as report back the + // unknown result to callers in NC. + service_controller_.GetLocalCredentials( + /*credential_selector=*/{.manager_app_id = manager_app_id_, + .account_name = "dummy_account_name", + .identity_type = ::nearby::internal:: + IdentityType::IDENTITY_TYPE_PRIVATE_GROUP}, + /*callback=*/{.credentials_fetched_cb = [this, &response, &remote_device, + &authentication_transport, + &shared_secret]( + auto status_or_credentials) { + if (!status_or_credentials.ok()) { + NEARBY_LOGS(INFO) + << __func__ << ": failure to fetch local credentials"; + response.Set(AuthenticationStatus::kFailure); + return; + } + + auto credential = GetValidCredential(status_or_credentials.value()); + if (!credential.has_value()) { + NEARBY_LOGS(INFO) + << __func__ << ": failure to find a valid local credential"; + response.Set(AuthenticationStatus::kFailure); + return; + } + + // 2. Construct the frame and write to the + // |authentication_transport|. + if (!WriteToRemoteDevice( + /*remote_device=*/remote_device, + /*shared_secret=*/shared_secret, + /*authentication_transport=*/authentication_transport, + /*local_credential=*/credential.value(), + /*response=*/response)) { + response.Set(AuthenticationStatus::kFailure); + return; + } + + // 3. Read the message from the remote device via + // |authentication_transport| and verify the response data. + if (!ReadAndVerifyRemoteDeviceData( + /*remote_device=*/remote_device, + /*shared_secret=*/shared_secret, + /*authentication_transport=*/authentication_transport)) { + response.Set(AuthenticationStatus::kFailure); + return; + } + + // 4. Return the status of the authentication to the callers. + response.Set(AuthenticationStatus::kSuccess); + }}); + + NEARBY_LOGS(INFO) << __func__ << ": Waiting for future to complete"; + ExceptionOr result = response.Get(); + CHECK(result.ok()); + + NEARBY_LOGS(INFO) << "Future:[" << __func__ << "] completed with status:" + << AuthenticationErrorToString(result.result()); + return result.result(); +} + +bool PresenceDeviceProvider::WriteToRemoteDevice( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport, + const internal::LocalCredential& local_credential, + Future& response) const { + // Cast the |remote_device| to a `PresenceDevice` in order to retrieve + // it's shared credentials, which is safe to do since the |remote_device| + // passed to the `PresenceDeviceProvider` will always be a `PresenceDevice`. + const PresenceDevice* remote_presence_device = + static_cast(&remote_device); + auto shared_credential = remote_presence_device->GetDecryptSharedCredential(); + if (!shared_credential.has_value()) { + NEARBY_LOGS(INFO) + << __func__ + << ": failure due to no decrypt shared credential from remote device"; + return false; + } + + auto status_or_initiator_data = + connection_authenticator_.BuildSignedMessageAsInitiator( + /*ukey2_secret=*/shared_secret, /*local_credential=*/local_credential, + /*shared_credential=*/shared_credential.value()); + if (!status_or_initiator_data.ok()) { + NEARBY_LOGS(INFO) << __func__ + << ": failure to build signed message as initiator"; + return false; + } + + // Once the initiator data has been built, construct the Presence frame + // which will be written to the device with the built data. + authentication_transport.WriteMessage( + BuildInitiatorPresenceAuthenticationFrame( + status_or_initiator_data.value()) + .SerializeAsString()); + return true; +} + +bool PresenceDeviceProvider::ReadAndVerifyRemoteDeviceData( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const { + // Fetch the local public credentials to be used to verify the response data. + Future read_and_verify_result; + service_controller_.GetLocalPublicCredentials( + /*credential_selector=*/{.manager_app_id = manager_app_id_, + .account_name = "dummy_account_name", + .identity_type = ::nearby::internal:: + IdentityType::IDENTITY_TYPE_PRIVATE_GROUP}, + /*callback=*/{.credentials_fetched_cb = [this, &read_and_verify_result, + &authentication_transport, + &shared_secret]( + auto status_or_credentials) { + if (!status_or_credentials.ok()) { + NEARBY_LOGS(INFO) + << __func__ << ": failure to fetch local public credentials"; + read_and_verify_result.Set(/*success=*/false); + return; + } + + std::string response_data = authentication_transport.ReadMessage(); + auto status = connection_authenticator_.VerifyMessageAsInitiator( + /*authentication_data=*/{.private_key_signature = response_data}, + /*ukey2_secret=*/shared_secret, + /*shared_credential=*/status_or_credentials.value()); + if (!status.ok()) { + NEARBY_LOGS(INFO) << __func__ << ": failure to verify remote device"; + read_and_verify_result.Set(/*success=*/false); + return; + } + + read_and_verify_result.Set(/*success=*/true); + }}); + + NEARBY_LOGS(INFO) << __func__ << ": Waiting for future to complete"; + ExceptionOr result = read_and_verify_result.Get(); + NEARBY_LOGS(INFO) << "Future:[" << __func__ + << "] completed with status:" << result.result(); + return result.result(); +} + +} // namespace presence +} // namespace nearby diff --git a/presence/presence_device_provider.h b/presence/presence_device_provider.h index 0b63a939..afa1df51 100644 --- a/presence/presence_device_provider.h +++ b/presence/presence_device_provider.h @@ -15,25 +15,43 @@ #ifndef THIRD_PARTY_NEARBY_PRESENCE_PRESENCE_DEVICE_PROVIDER_H_ #define THIRD_PARTY_NEARBY_PRESENCE_PRESENCE_DEVICE_PROVIDER_H_ +#include +#include + +#include "absl/strings/string_view.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/authentication_transport.h" +#include "internal/interop/device.h" #include "internal/interop/device_provider.h" +#include "internal/platform/future.h" +#include "internal/proto/local_credential.pb.h" #include "internal/proto/metadata.pb.h" +#include "presence/implementation/connection_authenticator.h" #include "presence/presence_device.h" namespace nearby { namespace presence { +class ServiceController; + class PresenceDeviceProvider : public NearbyDeviceProvider { public: - explicit PresenceDeviceProvider(::nearby::internal::Metadata metadata) - : device_{metadata} {} + PresenceDeviceProvider( + ServiceController* service_controller, + const ConnectionAuthenticator* connection_authenticator); const NearbyDevice* GetLocalDevice() override { return &device_; } + + // To authenticate as an initiator (when the device is in the scanning role), + // the PresenceDeviceProvider will block and: + // 1. Fetch the local credentials and select the correct one to use for + // authentication. + // 2. Construct the frame and write to the |authentication_transport|. + // 3. Read the message from the remote device via |authentication_transport|. + // 4. Return the status of the authentication to the callers. AuthenticationStatus AuthenticateAsInitiator( const NearbyDevice& remote_device, absl::string_view shared_secret, - const AuthenticationTransport& authentication_transport) const override { - // TODO(b/282027237): Implement. - return AuthenticationStatus::kUnknown; - } + const AuthenticationTransport& authentication_transport) const override; AuthenticationStatus AuthenticateAsResponder( absl::string_view shared_secret, @@ -42,13 +60,34 @@ class PresenceDeviceProvider : public NearbyDeviceProvider { return AuthenticationStatus::kUnknown; } - void UpdateMetadata(const ::nearby::internal::Metadata& metadata) { - device_.SetMetadata(metadata); + void UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata) { + device_.SetDeviceIdentityMetaData(device_identity_metadata); } + void SetManagerAppId(absl::string_view manager_app_id) { + manager_app_id_ = manager_app_id; + } + + std::string GetManagerAppId() { return manager_app_id_; } + private: + bool WriteToRemoteDevice( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport, + const internal::LocalCredential& local_credential, + Future& response) const; + bool ReadAndVerifyRemoteDeviceData( + const NearbyDevice& remote_device, absl::string_view shared_secret, + const AuthenticationTransport& authentication_transport) const; + + ServiceController& service_controller_; PresenceDevice device_; + std::string manager_app_id_; + const ConnectionAuthenticator& connection_authenticator_; }; + } // namespace presence } // namespace nearby diff --git a/presence/presence_device_provider_test.cc b/presence/presence_device_provider_test.cc index 57323d8c..a8985270 100644 --- a/presence/presence_device_provider_test.cc +++ b/presence/presence_device_provider_test.cc @@ -14,61 +14,283 @@ #include "presence/presence_device_provider.h" +#include +#include #include +#include +#include #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/status/status.h" +#include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "internal/crypto/ed25519.h" +#include "internal/interop/authentication_status.h" +#include "internal/interop/authentication_transport.h" +#include "internal/platform/implementation/credential_callbacks.h" +#include "internal/platform/implementation/system_clock.h" +#include "internal/proto/credential.pb.h" +#include "internal/proto/local_credential.pb.h" #include "internal/proto/metadata.pb.h" -#include "internal/proto/metadata.proto.h" +#include "presence/implementation/connection_authenticator.h" +#include "presence/implementation/mock_connection_authenticator.h" +#include "presence/implementation/mock_service_controller.h" #include "presence/presence_device.h" +#include "presence/proto/presence_frame.pb.h" namespace nearby { namespace presence { namespace { -using ::nearby::internal::Metadata; +using ::nearby::internal::DeviceIdentityMetaData; constexpr absl::string_view kMacAddr = "\x4C\x8B\x1D\xCE\xBA\xD1"; +constexpr absl::string_view kManagerAppId = "test_app_id"; +constexpr char kUkey2Secret[] = {0x34, 0x56, 0x78, 0x90}; +constexpr char kKeySeed[] = {1, 2, 3, 4, 5, 6, 7, 8}; +constexpr int kPresenceVersion = 1; +constexpr absl::string_view kSharedCredentialHash = "shared_cred_hash"; +constexpr absl::string_view kPrivateKeySignature = "private_key_signature"; -Metadata CreateTestMetadata() { - Metadata metadata; - metadata.set_device_type(internal::DEVICE_TYPE_PHONE); - metadata.set_account_name("test_account"); - metadata.set_device_name("NP test device"); - metadata.set_user_name("Test user"); - metadata.set_device_profile_url("test_image.test.com"); - metadata.set_bluetooth_mac_address(kMacAddr); - return metadata; +DeviceIdentityMetaData CreateTestDeviceIdentityMetaData() { + DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_device_type( + internal::DeviceType::DEVICE_TYPE_PHONE); + device_identity_metadata.set_device_name("NP test device"); + device_identity_metadata.set_bluetooth_mac_address(kMacAddr); + device_identity_metadata.set_device_id("\x12\xab\xcd"); + return device_identity_metadata; } -TEST(PresenceDeviceProviderTest, ProviderIsNotTriviallyConstructible) { +nearby::internal::LocalCredential CreateValidLocalCredential( + const crypto::Ed25519KeyPair& key_pair) { + nearby::internal::LocalCredential credential; + absl::Time now = SystemClock::ElapsedRealtime(); + credential.set_start_time_millis(absl::ToUnixMillis(now)); + credential.set_end_time_millis(absl::ToUnixMillis(now + absl::Minutes(10))); + credential.mutable_connection_signing_key()->set_key( + absl::StrCat(key_pair.private_key, key_pair.public_key)); + credential.set_key_seed(kKeySeed); + return credential; +} + +nearby::internal::LocalCredential CreateExpiredLocalCredential() { + nearby::internal::LocalCredential credential; + absl::Time now = SystemClock::ElapsedRealtime(); + credential.set_start_time_millis(absl::ToUnixMillis(now - absl::Minutes(30))); + credential.set_end_time_millis(absl::ToUnixMillis(now - absl::Minutes(10))); + return credential; +} + +internal::SharedCredential BuildSharedCredential( + const crypto::Ed25519KeyPair& key_pair) { + internal::SharedCredential shared_credential; + shared_credential.set_connection_signature_verification_key( + key_pair.public_key); + shared_credential.set_key_seed(kKeySeed); + return shared_credential; +} + +ConnectionAuthenticator::TwoWayInitiatorData BuildDefaultInitiatorData() { + ConnectionAuthenticator::TwoWayInitiatorData data; + data.shared_credential_hash = kSharedCredentialHash; + data.private_key_signature = kPrivateKeySignature; + return data; +} + +class MockAuthenticationTransport : public AuthenticationTransport { + public: + MOCK_METHOD(void, WriteMessage, (absl::string_view), (const, override)); + MOCK_METHOD(std::string, ReadMessage, (), (const, override)); +}; + +class PresenceDeviceProviderTest : public ::testing::Test { + public: + PresenceDeviceProviderTest() { + ON_CALL(mock_service_controller_, GetDeviceIdentityMetaData) + .WillByDefault(testing::Return(CreateTestDeviceIdentityMetaData())); + provider_ = std::make_unique( + &mock_service_controller_, &mock_connection_authenticator_); + } + + void SetUp() override { + auto key_pair_or_status = crypto::Ed25519Signer::CreateNewKeyPair(); + ASSERT_OK_AND_ASSIGN(key_pair_, key_pair_or_status); + } + + protected: + MockServiceController mock_service_controller_; + std::unique_ptr provider_; + crypto::Ed25519KeyPair key_pair_; + MockConnectionAuthenticator mock_connection_authenticator_; +}; + +TEST_F(PresenceDeviceProviderTest, ProviderIsNotTriviallyConstructible) { EXPECT_FALSE(std::is_trivially_constructible::value); } -TEST(PresenceDeviceProviderTest, DeviceProviderWorks) { - PresenceDeviceProvider provider(CreateTestMetadata()); - auto device = provider.GetLocalDevice(); +TEST_F(PresenceDeviceProviderTest, DeviceProviderWorks) { + auto device = provider_->GetLocalDevice(); ASSERT_EQ(device->GetType(), NearbyDevice::Type::kPresenceDevice); auto presence_device = static_cast(device); - EXPECT_EQ(presence_device->GetMetadata().SerializeAsString(), - CreateTestMetadata().SerializeAsString()); + EXPECT_EQ(presence_device->GetDeviceIdentityMetadata().SerializeAsString(), + CreateTestDeviceIdentityMetaData().SerializeAsString()); } -TEST(PresenceDeviceProviderTest, DeviceProviderCanUpdateDevice) { - PresenceDeviceProvider provider(CreateTestMetadata()); - auto device = provider.GetLocalDevice(); +TEST_F(PresenceDeviceProviderTest, DeviceProviderCanUpdateDevice) { + auto device = provider_->GetLocalDevice(); ASSERT_EQ(device->GetType(), NearbyDevice::Type::kPresenceDevice); auto presence_device = static_cast(device); - EXPECT_EQ(presence_device->GetMetadata().SerializeAsString(), - CreateTestMetadata().SerializeAsString()); - Metadata new_metadata = CreateTestMetadata(); + EXPECT_EQ(presence_device->GetDeviceIdentityMetadata().SerializeAsString(), + CreateTestDeviceIdentityMetaData().SerializeAsString()); + auto new_metadata = CreateTestDeviceIdentityMetaData(); new_metadata.set_device_name("NP interop device"); - provider.UpdateMetadata(new_metadata); - EXPECT_EQ(presence_device->GetMetadata().SerializeAsString(), + provider_->UpdateDeviceIdentityMetaData(new_metadata); + EXPECT_EQ(presence_device->GetDeviceIdentityMetadata().SerializeAsString(), new_metadata.SerializeAsString()); } +TEST_F(PresenceDeviceProviderTest, SetGetManagerAppId) { + provider_->SetManagerAppId(kManagerAppId); + EXPECT_EQ(provider_->GetManagerAppId(), kManagerAppId); +} + +TEST_F(PresenceDeviceProviderTest, + AuthenticateAsInitiatorFails_FailToFetchCredentials) { + EXPECT_CALL(mock_service_controller_, GetLocalCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + std::move(callback.credentials_fetched_cb)( + absl::Status(absl::StatusCode::kCancelled, /*msg=*/std::string())); + }); + + PresenceDevice remote_device(CreateTestDeviceIdentityMetaData()); + MockAuthenticationTransport authentication_transport; + auto status = provider_->AuthenticateAsInitiator( + /*remote_device=*/remote_device, /*shared_secret=*/kUkey2Secret, + /*authentication_transport=*/authentication_transport); + EXPECT_EQ(AuthenticationStatus::kFailure, status); +} + +TEST_F(PresenceDeviceProviderTest, + AuthenticateAsInitiatorFails_NoValidCredentials) { + EXPECT_CALL(mock_service_controller_, GetLocalCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + std::vector credentials; + credentials.push_back(CreateExpiredLocalCredential()); + std::move(callback.credentials_fetched_cb)(credentials); + }); + + PresenceDevice remote_device(CreateTestDeviceIdentityMetaData()); + MockAuthenticationTransport authentication_transport; + auto status = provider_->AuthenticateAsInitiator( + /*remote_device=*/remote_device, /*shared_secret=*/kUkey2Secret, + /*authentication_transport=*/authentication_transport); + EXPECT_EQ(AuthenticationStatus::kFailure, status); +} + +TEST_F(PresenceDeviceProviderTest, + AuthenticateAsInitiator_NoRemoteSharedCredential) { + EXPECT_CALL(mock_service_controller_, GetLocalCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + std::vector credentials; + credentials.push_back(CreateValidLocalCredential(key_pair_)); + std::move(callback.credentials_fetched_cb)(credentials); + }); + + PresenceDevice remote_device(CreateTestDeviceIdentityMetaData()); + MockAuthenticationTransport authentication_transport; + auto status = provider_->AuthenticateAsInitiator( + /*remote_device=*/remote_device, /*shared_secret=*/kUkey2Secret, + /*authentication_transport=*/authentication_transport); + + EXPECT_EQ(AuthenticationStatus::kFailure, status); +} + +TEST_F(PresenceDeviceProviderTest, AuthenticateAsInitiator_FailureToVerify) { + EXPECT_CALL(mock_service_controller_, GetLocalCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + std::vector credentials; + credentials.push_back(CreateValidLocalCredential(key_pair_)); + std::move(callback.credentials_fetched_cb)(credentials); + }); + EXPECT_CALL(mock_service_controller_, GetLocalPublicCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetPublicCredentialsResultCallback callback) { + std::vector credentials; + credentials.push_back(BuildSharedCredential(key_pair_)); + std::move(callback.credentials_fetched_cb)(credentials); + }); + + PresenceDevice remote_device(CreateTestDeviceIdentityMetaData()); + remote_device.SetDecryptSharedCredential(BuildSharedCredential(key_pair_)); + + MockAuthenticationTransport authentication_transport; + EXPECT_CALL(authentication_transport, WriteMessage) + .WillOnce([&](absl::string_view message) { + PresenceAuthenticationFrame authentication_frame; + EXPECT_TRUE(authentication_frame.ParseFromString(message)); + EXPECT_EQ(kPresenceVersion, authentication_frame.version()); + }); + EXPECT_CALL(authentication_transport, ReadMessage).WillOnce([&]() { + PresenceAuthenticationFrame authentication_frame; + return authentication_frame.SerializeAsString(); + }); + + EXPECT_CALL(mock_connection_authenticator_, BuildSignedMessageAsInitiator) + .WillOnce(testing::Return(BuildDefaultInitiatorData())); + EXPECT_CALL(mock_connection_authenticator_, VerifyMessageAsInitiator) + .WillOnce(testing::Return( + absl::Status(absl::StatusCode::kCancelled, /*msg=*/std::string()))); + + auto status = provider_->AuthenticateAsInitiator( + /*remote_device=*/remote_device, /*shared_secret=*/kUkey2Secret, + /*authentication_transport=*/authentication_transport); + EXPECT_EQ(AuthenticationStatus::kFailure, status); +} + +TEST_F(PresenceDeviceProviderTest, AuthenticateAsInitiator_Success) { + EXPECT_CALL(mock_service_controller_, GetLocalCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetLocalCredentialsResultCallback callback) { + std::vector credentials; + credentials.push_back(CreateValidLocalCredential(key_pair_)); + std::move(callback.credentials_fetched_cb)(credentials); + }); + EXPECT_CALL(mock_service_controller_, GetLocalPublicCredentials) + .WillOnce([&](const CredentialSelector& credential_selector, + GetPublicCredentialsResultCallback callback) { + std::vector credentials; + credentials.push_back(BuildSharedCredential(key_pair_)); + std::move(callback.credentials_fetched_cb)(std::move(credentials)); + }); + + PresenceDevice remote_device(CreateTestDeviceIdentityMetaData()); + remote_device.SetDecryptSharedCredential(BuildSharedCredential(key_pair_)); + + ON_CALL(mock_connection_authenticator_, BuildSignedMessageAsInitiator) + .WillByDefault(testing::Return(BuildDefaultInitiatorData())); + + MockAuthenticationTransport authentication_transport; + EXPECT_CALL(authentication_transport, WriteMessage) + .WillOnce([&](absl::string_view message) { + PresenceAuthenticationFrame authentication_frame; + EXPECT_TRUE(authentication_frame.ParseFromString(message)); + EXPECT_EQ(kPresenceVersion, authentication_frame.version()); + }); + + auto status = provider_->AuthenticateAsInitiator( + /*remote_device=*/remote_device, /*shared_secret=*/kUkey2Secret, + /*authentication_transport=*/authentication_transport); + + EXPECT_EQ(AuthenticationStatus::kSuccess, status); +} + } // namespace } // namespace presence } // namespace nearby diff --git a/presence/presence_device_test.cc b/presence/presence_device_test.cc index 8c6d1d71..e567d749 100644 --- a/presence/presence_device_test.cc +++ b/presence/presence_device_test.cc @@ -31,7 +31,7 @@ namespace nearby { namespace presence { namespace { -using ::nearby::internal::Metadata; +using ::nearby::internal::DeviceIdentityMetaData; using ::testing::Contains; constexpr DeviceMotion::MotionType kDefaultMotionType = @@ -41,65 +41,77 @@ constexpr float kTestConfidence = 0.1; constexpr absl::string_view kMacAddr = "\x4C\x8B\x1D\xCE\xBA\xD1"; constexpr int kDataElementType = DataElement::kBatteryFieldType; constexpr absl::string_view kDataElementValue = "15"; +constexpr char kEndpointId[] = "endpoint_id"; constexpr int kTestAction = 3; -Metadata CreateTestMetadata() { - Metadata metadata; - metadata.set_account_name("test_account"); - metadata.set_device_name("NP test device"); - metadata.set_device_profile_url("test_image.test.com"); - metadata.set_bluetooth_mac_address(kMacAddr); - metadata.set_device_type(internal::DEVICE_TYPE_LAPTOP); - return metadata; +DeviceIdentityMetaData CreateTestDeviceIdentityMetaData() { + DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_device_type( + internal::DeviceType::DEVICE_TYPE_LAPTOP); + device_identity_metadata.set_device_name("NP test device"); + device_identity_metadata.set_bluetooth_mac_address(kMacAddr); + device_identity_metadata.set_device_id("\x12\xab\xcd"); + return device_identity_metadata; +} +TEST(PresenceDeviceTest, EndpointIdConstructor) { + PresenceDevice device(kEndpointId); + EXPECT_EQ(device.GetEndpointId(), kEndpointId); } TEST(PresenceDeviceTest, DefaultMotionEquals) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device1(metadata); - PresenceDevice device2(metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device1(device_identity_metadata); + PresenceDevice device2(device_identity_metadata); EXPECT_EQ(device1, device2); } TEST(PresenceDeviceTest, ExplicitInitEquals) { - Metadata metadata = CreateTestMetadata(); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); internal::SharedCredential shared_credential; shared_credential.set_credential_type(internal::CREDENTIAL_TYPE_GAIA); PresenceDevice device1 = - PresenceDevice({kDefaultMotionType, kTestConfidence}, metadata, - internal::IDENTITY_TYPE_PUBLIC); + PresenceDevice({kDefaultMotionType, kTestConfidence}, + device_identity_metadata, internal::IDENTITY_TYPE_PUBLIC); device1.SetDecryptSharedCredential(shared_credential); PresenceDevice device2 = - PresenceDevice({kDefaultMotionType, kTestConfidence}, metadata, - internal::IDENTITY_TYPE_PUBLIC); + PresenceDevice({kDefaultMotionType, kTestConfidence}, + device_identity_metadata, internal::IDENTITY_TYPE_PUBLIC); device2.SetDecryptSharedCredential(shared_credential); EXPECT_EQ(device1, device2); } TEST(PresenceDeviceTest, ExplicitInitNotEquals) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device1 = PresenceDevice({kDefaultMotionType}, metadata, - internal::IDENTITY_TYPE_PUBLIC); - PresenceDevice device2 = - PresenceDevice({kDefaultMotionType, kTestConfidence}, metadata, - internal::IDENTITY_TYPE_PRIVATE); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device1 = + PresenceDevice({kDefaultMotionType}, device_identity_metadata, + internal::IDENTITY_TYPE_PUBLIC); + PresenceDevice device2 = PresenceDevice( + {kDefaultMotionType, kTestConfidence}, device_identity_metadata, + internal::IDENTITY_TYPE_PRIVATE_GROUP); EXPECT_NE(device1, device2); } TEST(PresenceDeviceTest, TestGetBleConnectionInfo) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = PresenceDevice({kDefaultMotionType}, metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = + PresenceDevice({kDefaultMotionType}, device_identity_metadata); device.AddAction(PresenceAction(kTestAction)); auto info = (device.GetConnectionInfos().at(0)); ASSERT_TRUE(std::holds_alternative(info)); auto ble_info = std::get(info); - EXPECT_EQ(ble_info.GetMacAddress(), - kMacAddr); + EXPECT_EQ(ble_info.GetMacAddress(), kMacAddr); EXPECT_EQ(ble_info.GetActions(), std::vector{kTestAction}); } TEST(PresenceDeviceTest, TestGetAddExtendedProperties) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = PresenceDevice({kDefaultMotionType}, metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = + PresenceDevice({kDefaultMotionType}, device_identity_metadata); device.AddExtendedProperty({kDataElementType, kDataElementValue}); ASSERT_EQ(device.GetExtendedProperties().size(), 1); EXPECT_EQ(device.GetExtendedProperties()[0], @@ -107,8 +119,10 @@ TEST(PresenceDeviceTest, TestGetAddExtendedProperties) { } TEST(PresenceDeviceTest, TestGetAddExtendedPropertiesVector) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = PresenceDevice({kDefaultMotionType}, metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = + PresenceDevice({kDefaultMotionType}, device_identity_metadata); device.AddExtendedProperties( {DataElement(kDataElementType, kDataElementValue)}); ASSERT_EQ(device.GetExtendedProperties().size(), 1); @@ -117,37 +131,45 @@ TEST(PresenceDeviceTest, TestGetAddExtendedPropertiesVector) { } TEST(PresenceDeviceTest, TestAddGetActions) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = PresenceDevice({kDefaultMotionType}, metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = + PresenceDevice({kDefaultMotionType}, device_identity_metadata); device.AddAction({kTestAction}); ASSERT_EQ(device.GetActions().size(), 1); EXPECT_EQ(device.GetActions()[0], PresenceAction(kTestAction)); } TEST(PresenceDeviceTest, TestEndpointIdIsCorrectLength) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = PresenceDevice({kDefaultMotionType}, metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = + PresenceDevice({kDefaultMotionType}, device_identity_metadata); EXPECT_EQ(device.GetEndpointId().length(), kEndpointIdLength); } TEST(PresenceDeviceTest, TestEndpointIdIsRandom) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = PresenceDevice({kDefaultMotionType}, metadata); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = + PresenceDevice({kDefaultMotionType}, device_identity_metadata); EXPECT_EQ(device.GetEndpointId().length(), kEndpointIdLength); EXPECT_NE(device.GetEndpointId(), std::string(kEndpointIdLength, 0)); } TEST(PresenceDeviceTest, TestGetIdentityType) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = - PresenceDevice(DeviceMotion(), metadata, internal::IDENTITY_TYPE_PUBLIC); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = PresenceDevice( + DeviceMotion(), device_identity_metadata, internal::IDENTITY_TYPE_PUBLIC); EXPECT_EQ(device.GetIdentityType(), internal::IDENTITY_TYPE_PUBLIC); } TEST(PresenceDeviceTest, TestGetDecryptSharedCredential) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = - PresenceDevice(DeviceMotion(), metadata, internal::IDENTITY_TYPE_PUBLIC); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = PresenceDevice( + DeviceMotion(), device_identity_metadata, internal::IDENTITY_TYPE_PUBLIC); EXPECT_EQ(device.GetDecryptSharedCredential(), std::nullopt); internal::SharedCredential shared_credential; shared_credential.set_credential_type(internal::CREDENTIAL_TYPE_GAIA); @@ -157,9 +179,10 @@ TEST(PresenceDeviceTest, TestGetDecryptSharedCredential) { } TEST(PresenceDeviceTest, TestToProtoBytes) { - Metadata metadata = CreateTestMetadata(); - PresenceDevice device = - PresenceDevice(DeviceMotion(), metadata, internal::IDENTITY_TYPE_PUBLIC); + DeviceIdentityMetaData device_identity_metadata = + CreateTestDeviceIdentityMetaData(); + PresenceDevice device = PresenceDevice( + DeviceMotion(), device_identity_metadata, internal::IDENTITY_TYPE_PUBLIC); std::string proto_bytes = device.ToProtoBytes(); location::nearby::connections::PresenceDevice device_frame; ASSERT_TRUE(device_frame.ParseFromString(proto_bytes)); @@ -171,7 +194,6 @@ TEST(PresenceDeviceTest, TestToProtoBytes) { EXPECT_EQ(device_frame.device_type(), location::nearby::connections::PresenceDevice::LAPTOP); EXPECT_EQ(device_frame.device_name(), "NP test device"); - EXPECT_EQ(device_frame.device_image_url(), "test_image.test.com"); } } // namespace diff --git a/presence/presence_identity_test.cc b/presence/presence_identity_test.cc index cab79e01..5b45704d 100644 --- a/presence/presence_identity_test.cc +++ b/presence/presence_identity_test.cc @@ -22,7 +22,8 @@ namespace presence { namespace { using ::nearby::internal::IdentityType; -constexpr IdentityType kTestIdentityType = IdentityType::IDENTITY_TYPE_TRUSTED; +constexpr IdentityType kTestIdentityType = + IdentityType::IDENTITY_TYPE_CONTACTS_GROUP; TEST(PresenceIdentityTest, ExplicitInitEquals) { IdentityType identity1 = {kTestIdentityType}; diff --git a/presence/presence_service.h b/presence/presence_service.h index acef7b46..8fe11637 100644 --- a/presence/presence_service.h +++ b/presence/presence_service.h @@ -1,4 +1,4 @@ -// Copyright 2020 Google LLC +// Copyright 2020-2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,10 +18,10 @@ #include #include +#include "internal/interop/device_provider.h" #include "internal/proto/metadata.pb.h" #include "presence/data_types.h" #include "presence/presence_client.h" -#include "presence/presence_device_provider.h" namespace nearby { namespace presence { @@ -41,14 +41,15 @@ class PresenceService { virtual void StopBroadcast(BroadcastSessionId session_id) = 0; - virtual void UpdateLocalDeviceMetadata( - const ::nearby::internal::Metadata& metadata, bool regen_credentials, - absl::string_view manager_app_id, + virtual void UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) = 0; - virtual PresenceDeviceProvider* GetLocalDeviceProvider() = 0; + virtual NearbyDeviceProvider* GetLocalDeviceProvider() = 0; virtual void GetLocalPublicCredentials( const CredentialSelector& credential_selector, @@ -61,7 +62,8 @@ class PresenceService { UpdateRemotePublicCredentialsCallback credentials_updated_cb) = 0; // Testing only. - virtual ::nearby::internal::Metadata GetLocalDeviceMetadata() = 0; + virtual ::nearby::internal::DeviceIdentityMetaData + GetDeviceIdentityMetaData() = 0; }; } // namespace presence diff --git a/presence/presence_service_impl.cc b/presence/presence_service_impl.cc index eac607b3..d107e618 100644 --- a/presence/presence_service_impl.cc +++ b/presence/presence_service_impl.cc @@ -20,66 +20,61 @@ #include "internal/platform/borrowable.h" #include "presence/data_types.h" -#include "presence/implementation/service_controller_impl.h" #include "presence/presence_client_impl.h" +#include "presence/presence_device_provider.h" namespace nearby { namespace presence { -PresenceServiceImpl::PresenceServiceImpl() { - service_controller_ = std::make_unique(); - provider_ = std::make_unique( - service_controller_->GetLocalDeviceMetadata()); -} - std::unique_ptr PresenceServiceImpl::CreatePresenceClient() { return PresenceClientImpl::Factory::Create(lender_.GetBorrowable()); } absl::StatusOr PresenceServiceImpl::StartScan( ScanRequest scan_request, ScanCallback callback) { - return service_controller_->StartScan(scan_request, std::move(callback)); + return service_controller_.StartScan(scan_request, std::move(callback)); } void PresenceServiceImpl::StopScan(ScanSessionId id) { - service_controller_->StopScan(id); + service_controller_.StopScan(id); } absl::StatusOr PresenceServiceImpl::StartBroadcast( BroadcastRequest broadcast_request, BroadcastCallback callback) { - return service_controller_->StartBroadcast(broadcast_request, - std::move(callback)); + return service_controller_.StartBroadcast(broadcast_request, + std::move(callback)); } void PresenceServiceImpl::StopBroadcast(BroadcastSessionId session) { - service_controller_->StopBroadcast(session); + service_controller_.StopBroadcast(session); } -void PresenceServiceImpl::UpdateLocalDeviceMetadata( - const ::nearby::internal::Metadata& metadata, bool regen_credentials, - absl::string_view manager_app_id, +void PresenceServiceImpl::UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) { - provider_->UpdateMetadata(metadata); - service_controller_->UpdateLocalDeviceMetadata( - metadata, regen_credentials, manager_app_id, identity_types, - credential_life_cycle_days, contiguous_copy_of_credentials, - std::move(credentials_generated_cb)); + provider_.UpdateDeviceIdentityMetaData(device_identity_metadata); + provider_.SetManagerAppId(manager_app_id); + service_controller_.UpdateDeviceIdentityMetaData( + device_identity_metadata, regen_credentials, manager_app_id, + identity_types, credential_life_cycle_days, + contiguous_copy_of_credentials, std::move(credentials_generated_cb)); } void PresenceServiceImpl::GetLocalPublicCredentials( const CredentialSelector& credential_selector, GetPublicCredentialsResultCallback callback) { - service_controller_->GetLocalPublicCredentials(credential_selector, - std::move(callback)); + service_controller_.GetLocalPublicCredentials(credential_selector, + std::move(callback)); } void PresenceServiceImpl::UpdateRemotePublicCredentials( absl::string_view manager_app_id, absl::string_view account_name, const std::vector& remote_public_creds, UpdateRemotePublicCredentialsCallback credentials_updated_cb) { - service_controller_->UpdateRemotePublicCredentials( + service_controller_.UpdateRemotePublicCredentials( manager_app_id, account_name, remote_public_creds, std::move(credentials_updated_cb)); } diff --git a/presence/presence_service_impl.h b/presence/presence_service_impl.h index ef8afeec..a8d5a219 100644 --- a/presence/presence_service_impl.h +++ b/presence/presence_service_impl.h @@ -16,16 +16,27 @@ #define THIRD_PARTY_NEARBY_PRESENCE_PRESENCE_SERVICE_IMPL_H_ #include -#include #include +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" #include "internal/platform/borrowable.h" +#include "internal/platform/implementation/credential_callbacks.h" +#include "internal/platform/single_thread_executor.h" #include "internal/proto/metadata.pb.h" +#include "presence/broadcast_request.h" #include "presence/data_types.h" -#include "presence/implementation/service_controller.h" +#include "presence/implementation/broadcast_manager.h" +#include "presence/implementation/connection_authenticator_impl.h" +#include "presence/implementation/credential_manager_impl.h" +#include "presence/implementation/mediums/mediums.h" +#include "presence/implementation/scan_manager.h" +#include "presence/implementation/service_controller_impl.h" #include "presence/presence_client.h" #include "presence/presence_device_provider.h" #include "presence/presence_service.h" +#include "presence/scan_request.h" +#include "internal/interop/device_provider.h" namespace nearby { namespace presence { @@ -37,7 +48,7 @@ namespace presence { */ class PresenceServiceImpl : public PresenceService { public: - PresenceServiceImpl(); + PresenceServiceImpl() = default; ~PresenceServiceImpl() override { lender_.Release(); } std::unique_ptr CreatePresenceClient() override; @@ -51,19 +62,21 @@ class PresenceServiceImpl : public PresenceService { void StopBroadcast(BroadcastSessionId session_id) override; - void UpdateLocalDeviceMetadata( - const ::nearby::internal::Metadata& metadata, bool regen_credentials, - absl::string_view manager_app_id, + void UpdateDeviceIdentityMetaData( + const ::nearby::internal::DeviceIdentityMetaData& + device_identity_metadata, + bool regen_credentials, absl::string_view manager_app_id, const std::vector& identity_types, int credential_life_cycle_days, int contiguous_copy_of_credentials, GenerateCredentialsResultCallback credentials_generated_cb) override; - PresenceDeviceProvider* GetLocalDeviceProvider() override { - return provider_.get(); + NearbyDeviceProvider* GetLocalDeviceProvider() override { + return &provider_; } - ::nearby::internal::Metadata GetLocalDeviceMetadata() override { - return service_controller_->GetLocalDeviceMetadata(); + ::nearby::internal::DeviceIdentityMetaData GetDeviceIdentityMetaData() + override { + return service_controller_.GetDeviceIdentityMetaData(); } void GetLocalPublicCredentials( @@ -77,9 +90,17 @@ class PresenceServiceImpl : public PresenceService { UpdateRemotePublicCredentialsCallback credentials_updated_cb) override; private: - std::unique_ptr service_controller_; + SingleThreadExecutor executor_; + Mediums mediums_; + CredentialManagerImpl credential_manager_{&executor_}; + ScanManager scan_manager_{mediums_, credential_manager_, executor_}; + BroadcastManager broadcast_manager_{mediums_, credential_manager_, executor_}; + ServiceControllerImpl service_controller_{ + &executor_, &credential_manager_, &scan_manager_, &broadcast_manager_}; + ConnectionAuthenticatorImpl connection_authenticator_; ::nearby::Lender lender_{this}; - std::unique_ptr provider_; + PresenceDeviceProvider provider_{&service_controller_, + &connection_authenticator_}; }; } // namespace presence diff --git a/presence/presence_service_test.cc b/presence/presence_service_test.cc index c022508b..1f24275b 100644 --- a/presence/presence_service_test.cc +++ b/presence/presence_service_test.cc @@ -22,6 +22,7 @@ #include "gmock/gmock.h" #include "protobuf-matchers/protocol-buffer-matchers.h" #include "gtest/gtest.h" +#include "absl/strings/string_view.h" #include "internal/platform/count_down_latch.h" #include "internal/platform/medium_environment.h" #include "presence/presence_client.h" @@ -30,31 +31,32 @@ namespace nearby { namespace presence { namespace { - -using Metadata = ::nearby::internal::Metadata; +using DeviceIdentityMetaData = ::nearby::internal::DeviceIdentityMetaData; constexpr absl::string_view kManagerAppId = "TEST_MANAGER_APP"; -constexpr absl::string_view kAccountName = "test account"; +constexpr absl::string_view kAccountName = "dummy account"; class PresenceServiceTest : public testing::Test { protected: nearby::MediumEnvironment& env_{nearby::MediumEnvironment::Instance()}; }; -Metadata CreateTestMetadata(absl::string_view account_name) { - Metadata metadata; - metadata.set_account_name(account_name); - metadata.set_device_name("NP test device"); - metadata.set_device_profile_url("test_image.test.com"); - metadata.set_bluetooth_mac_address("\xFF\xFF\xFF\xFF\xFF\xFF"); - return metadata; +DeviceIdentityMetaData CreateTestDeviceIdentityMetaData() { + DeviceIdentityMetaData device_identity_metadata; + device_identity_metadata.set_device_type( + internal::DeviceType::DEVICE_TYPE_PHONE); + device_identity_metadata.set_device_name("NP test device"); + device_identity_metadata.set_bluetooth_mac_address( + "\xFF\xFF\xFF\xFF\xFF\xFF"); + device_identity_metadata.set_device_id("\x12\xab\xcd"); + return device_identity_metadata; } CredentialSelector BuildDefaultCredentialSelector() { CredentialSelector credential_selector; credential_selector.manager_app_id = std::string(kManagerAppId); credential_selector.account_name = std::string(kAccountName); - credential_selector.identity_type = internal::IDENTITY_TYPE_PRIVATE; + credential_selector.identity_type = internal::IDENTITY_TYPE_PRIVATE_GROUP; return credential_selector; } @@ -89,12 +91,12 @@ TEST_F(PresenceServiceTest, StartThenStopScan) { env_.Stop(); } -TEST_F(PresenceServiceTest, UpdatingLocalMetadataWorks) { +TEST_F(PresenceServiceTest, UpdatingDeviceIdentityMetaDataWorks) { PresenceServiceImpl presence_service; - presence_service.UpdateLocalDeviceMetadata(CreateTestMetadata("Test account"), - false, "Test app", {}, 3, 1, {}); - EXPECT_EQ(presence_service.GetLocalDeviceMetadata().SerializeAsString(), - CreateTestMetadata("Test account").SerializeAsString()); + presence_service.UpdateDeviceIdentityMetaData( + CreateTestDeviceIdentityMetaData(), false, "Test app", {}, 3, 1, {}); + EXPECT_EQ(presence_service.GetDeviceIdentityMetaData().SerializeAsString(), + CreateTestDeviceIdentityMetaData().SerializeAsString()); } TEST_F(PresenceServiceTest, TestGetDeviceProvider) { @@ -124,7 +126,7 @@ TEST_F(PresenceServiceTest, TestUpdateRemotePublicCredentials) { PresenceServiceImpl presence_service; internal::SharedCredential public_credential_for_test; public_credential_for_test.set_identity_type( - internal::IdentityType::IDENTITY_TYPE_TRUSTED); + internal::IdentityType::IDENTITY_TYPE_CONTACTS_GROUP); std::vector public_credentials{ {public_credential_for_test}}; diff --git a/presence/proto/BUILD b/presence/proto/BUILD index 390eeab4..6831e1ed 100644 --- a/presence/proto/BUILD +++ b/presence/proto/BUILD @@ -1,4 +1,19 @@ +# Copyright 2022 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. + load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") proto_library( name = "presence_frame_proto", diff --git a/presence/proto/presence_frame.proto b/presence/proto/presence_frame.proto index 5b4ba2ff..1f18cbcd 100644 --- a/presence/proto/presence_frame.proto +++ b/presence/proto/presence_frame.proto @@ -1,9 +1,24 @@ +// Copyright 2023 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. + syntax = "proto2"; package nearby.presence; // import "storage/datapol/annotations/proto/semantic_annotations.proto"; +option optimize_for = LITE_RUNTIME; option java_package = "com.google.android.gms.nearby.presence"; option java_outer_classname = "PresenceFrameProtocol"; @@ -120,6 +135,7 @@ message UwbControleeCapabilities { repeated int32 supported_ranging_update_rates = 16 [packed = true]; optional int32 chip_count = 17 [default = 1]; repeated UwbMultiChipInfo multi_chip_info = 18; + optional bool is_background_ranging_supported = 19 [default = false]; } /* A frame containing info needed per chip in a multi-chip environment. */ diff --git a/presence/rust/README b/presence/rust/README new file mode 100644 index 00000000..9ca03064 --- /dev/null +++ b/presence/rust/README @@ -0,0 +1 @@ +This directory contains Rust implementation of Nearby Presence. diff --git a/presence/scan_request_builder_test.cc b/presence/scan_request_builder_test.cc index 9f9cbaa4..1d0fd6be 100644 --- a/presence/scan_request_builder_test.cc +++ b/presence/scan_request_builder_test.cc @@ -33,7 +33,7 @@ using ::nearby::internal::IdentityType; constexpr absl::string_view kAccountName = "Google User"; constexpr bool kUseBle = true; constexpr bool kOnlyScreenOnScan = true; -const IdentityType kIdentity = IdentityType::IDENTITY_TYPE_PRIVATE; +const IdentityType kIdentity = IdentityType::IDENTITY_TYPE_PRIVATE_GROUP; const ScanType kScanType = ScanType::kPresenceScan; const PowerMode powerMode = PowerMode::kLowLatency; constexpr absl::string_view kManagerAppId = "Google App Manager"; diff --git a/proto/BUILD b/proto/BUILD index 7abb0cd9..551a163d 100644 --- a/proto/BUILD +++ b/proto/BUILD @@ -14,8 +14,10 @@ # Proto for Nearby products -# Placeholder: load py_proto_library load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + +# Placeholder: load py_proto_library licenses(["notice"]) @@ -36,6 +38,16 @@ cc_proto_library( deps = [":connections_enums_proto"], ) +proto_library( + name = "connections_westworld_enums_proto", + srcs = ["connections_westworld_enums.proto"], +) + +java_proto_library( + name = "connections_westworld_enums_java_proto", + deps = [":connections_westworld_enums_proto"], +) + proto_library( name = "sharing_enums_proto", srcs = ["sharing_enums.proto"], @@ -44,7 +56,6 @@ proto_library( proto_library( name = "fast_pair_enums_proto", srcs = ["fast_pair_enums.proto"], - compatible_with = ["//buildenv/target:non_prod"], ) cc_proto_library( diff --git a/proto/connections_enums.proto b/proto/connections_enums.proto index 072b4625..5ac32be4 100644 --- a/proto/connections_enums.proto +++ b/proto/connections_enums.proto @@ -50,6 +50,8 @@ enum EventType { ERROR_CODE = 6; } +// LINT.IfChange + // The strategy used for a session of Nearby.Connections. // Values correspond to // http://cs/?q=symbol:com.google.android.gms.nearby.connection.Strategy @@ -62,6 +64,10 @@ enum ConnectionsStrategy { P2P_POINT_TO_POINT = 5; } +// LINT.ThenChange( +// //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto +// ) + // The role a device is playing in one StrategySession. enum SessionRole { UNKNOWN_SESSION_ROLE = 0; @@ -83,11 +89,12 @@ enum Medium { WEB_RTC = 9; BLE_L2CAP = 10; USB = 11; + WEB_RTC_NON_CELLULAR = 12; } // LINT.ThenChange( // //depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/connection/Medium.java, // //depot/google3/java/com/google/android/gms/nearby/internal/connection/api.proto, -// //depot/google3/third_party/nearby/connections/implementation/proto/offline_wire_formats.proto +// //depot/google3/third_party/nearby/connections/implementation/proto/offline_wire_formats.proto, // //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto // ) @@ -119,6 +126,16 @@ enum ConnectionBand { CONNECTION_BAND_CELLULAR_BAND_5G = 7; } +// LINT.IfChange +enum ConnectionMode { + LEGACY = 0; + INSTANT = 1; +} +// LINT.ThenChange( +// //depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/connection/ConnectionMode.java, +// //depot/google3/third_party/nearby/connections/implementation/proto/offline_wire_formats.proto +// ) + // The result of a ConnectionRequest. enum ConnectionRequestResponse { UNKNOWN_CONNECTION_REQUEST_RESPONSE = 0; @@ -148,9 +165,6 @@ enum ConnectionAttemptDirection { INCOMING = 1; OUTGOING = 2; } -// LINT.ThenChange( -// //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto -// ) // Whether this is an initial or upgrade connection attempt. enum ConnectionAttemptType { @@ -169,8 +183,14 @@ enum DisconnectionReason { UPGRADED = 4; SHUTDOWN = 5; UNFINISHED = 6; + PREV_CHANNEL_DISCONNECTION_IN_RECONNECT = 7; + AUTHENTICATION_FAILURE = 8; } +// LINT.ThenChange( +// //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto +// ) + // The type of a Payload. // Values correspond to // http://cs/?q=symbol:com.google.android.gms.nearby.connection.Payload.Type @@ -399,6 +419,14 @@ enum LogSource { OEM_DEVICES = 4; // Represents the device for debugging. DEBUG_DEVICES = 5; + // Represents the device for Nearby Module Food. + NEARBY_MODULE_FOOD_DEVICES = 6; + // Represents the device for BeTo Team Food. + BETO_DOGFOOD_DEVICES = 7; + // Represents the device for Nearby dog Food. + NEARBY_DOGFOOD_DEVICES = 8; + // Represents the device for Nearby Team Food. + NEARBY_TEAMFOOD_DEVICES = 9; } // LINT.IfChange @@ -419,6 +447,7 @@ enum PowerLevel { } // LINT.ThenChange( // //depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/connection/PowerLevel.java +// //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto // ) // LINT.IfChange @@ -439,7 +468,7 @@ enum OperationResultCategory { // This enum is not used to determine success rate, but for devs to understand // occurrences of and operation failure details -enum OperationResultDetail { +enum OperationResultCode { // Section of CATEGORY_UNKNOWN and CATEGORY_SUCCESS, from 0 to 499 // DETAIL_UNKNOWN should not happen in normal case DETAIL_UNKNOWN = 0; @@ -587,6 +616,22 @@ enum OperationResultDetail { MEDIUM_UNAVAILABLE_UPGRADE_ON_SAME_MEDIUM = 1537; // WEBRTC is unavailable due to framework not support MEDIUM_UNAVAILABLE_WEB_RTC_NO_INTERNET = 1538; + // Sta connection failure due to non-disruptive + MEDIUM_UNAVAILABLE_STA_DISRUPTIVE_FALSE = 1539; + // Sta connection failure due to user restriction + MEDIUM_UNAVAILABLE_STA_USER_NOT_ALLOW = 1540; + // Duplicate FastAdvertisement request + MEDIUM_UNAVAILABLE_DUPLICATE_FAST_ADVERTISING = 1541; + // Wifi LAN NsdManager is unavailable + MEDIUM_UNAVAILABLE_NSD_NOT_AVAILABLE = 1542; + // Wifi LAN MDNS is unavailable + MEDIUM_UNAVAILABLE_MDNS_NOT_AVAILABLE = 1543; + // LAN is unavailable due to AP in deny list + MEDIUM_UNAVAILABLE_LAN_BLOCKED = 1544; + // LAN is unavailable due to signal weak + MEDIUM_UNAVAILABLE_POOR_SIGNAL = 1545; + // Second outgoing BT connection is not available due to multiplex disabled. + MEDIUM_UNAVAILABLE_BT_MULTIPLEX_DISABLED = 1546; // Section of CATEGORY_CLIENT_ERROR, from 2000 to 2499 // NC already hosting a WFD group for this client (same service id) @@ -623,6 +668,44 @@ enum OperationResultDetail { CLIENT_DUPLICATE_WIFI_AWARE_SUBSCRIBING_REQUEST = 2015; // BLE and USB should not be upgrade mediums CLIENT_UNSUPPORTED_USB_TO_BE_UPGRADE_MEDIUM = 2016; + // Log the tie break loss symptom + CLIENT_PROCESS_TIE_BREAK_LOSS = 2017; + // Duplicated requesting to start advertising + CLIENT_BLE_DUPLICATE_ADVERTISING = 2018; + // Duplicated requesting to start advertising + CLIENT_BLUETOOTH_DUPLICATE_ADVERTISING = 2019; + // Duplicated requesting to start advertising + CLIENT_NFC_DUPLICATE_ADVERTISING = 2020; + // Duplicated requesting to start advertising + CLIENT_WIFI_LAN_DUPLICATE_ADVERTISING = 2021; + // Duplicated requesting to start advertising + CLIENT_USB_DUPLICATE_ADVERTISING = 2022; + // Duplicated requesting to start discovery + CLIENT_BLE_DUPLICATE_DISCOVERING = 2023; + // Duplicated requesting to start discovery + CLIENT_BLUETOOTH_DUPLICATE_DISCOVERING = 2024; + // Duplicated requesting to start discovery + CLIENT_NFC_DUPLICATE_DISCOVERING = 2025; + // Duplicated requesting to start discovery + CLIENT_WIFI_LAN_DUPLICATE_DISCOVERING = 2026; + // Duplicated requesting to start discovery + CLIENT_USB_DUPLICATE_DISCOVERING = 2027; + // Client not allowed to advertise or discover + CLIENT_PERMISSION_FAILURE = 2028; + // Client doesn't listen BLE + CLIENT_BLE_NO_LISTENING = 2029; + // Client already connected to the remote device + CLIENT_ALREADY_CONNECTED_TO_TARGET = 2030; + // Incoming connection failed due to topological limit + CLIENT_FAILED_INCOMING_CONNECTION_DUE_TO_TOPOLOGICAL_LIMIT = 2031; + // Client out of order API call + CLIENT_OUT_OF_ORDER_API_CALL = 2032; + // Client has wrong connecting permission + CLIENT_WRONG_CONNECTING_PERMISSIONS = 2033; + // Client already connected to endpoint + CLIENT_ALREADY_CONNECTED_TO_ENDPOINT = 2034; + // Client request connecting to unknown endpoint + CLIENT_CONNECT_TO_UNKNOWN_ENDPOINT = 2035; // Section of CATEGORY_MISCELLANEOUS, from 2500 to 2999 // BT MAC address is null @@ -651,6 +734,14 @@ enum OperationResultDetail { MISCELLEANEOUS_WEB_RTC_GET_DROIDGUARD_RESULT_FAILURE = 2511; // Tachyon signal messenger is null MISCELLEANEOUS_WEB_RTC_TACHYON_SIGNALING_MESSENGER_NULL = 2512; + // Failed to receive message + MISCELLEANEOUS_WEB_RTC_FAILED_TO_RECEIVE_MESSAGE = 2513; + // Failed to change the device name for advertising + MISCELLEANEOUS_BLUETOOTH_CHANGE_DEVICE_NAME_FAILURE = 2514; + // Failed to get the ICE server + MISCELLEANEOUS_WEB_RTC_ICE_SERVER_NULL = 2515; + // Failed to get the work source + MISCELLEANEOUS_WORK_SOURCE_NULL = 2516; // Section of CATEGORY_IO_ERROR, from 3000 to 3499 // Incoming payloads failure due to file opening error @@ -665,34 +756,34 @@ enum OperationResultDetail { IO_STREAM_CREATE_PIPE_FAILURE = 3004; // Payloads IOError due to endpoint get IOException on BLE medium (IOException // on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_BLE = 3005; + IO_ENDPOINT_IO_ERROR_ON_BLE = 3005 [deprecated = true]; // Payloads IOError due to endpoint get IOException on L2CAP medium // (IOException on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_L2CAP = 3006; + IO_ENDPOINT_IO_ERROR_ON_BLE_L2CAP = 3006 [deprecated = true]; // Payloads IOError due to endpoint get IOException on BT medium (IOException // on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_BT = 3007; + IO_ENDPOINT_IO_ERROR_ON_BT = 3007 [deprecated = true]; // Payloads IOError due to endpoint get IOException on WebRtc medium // (IOException on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_WEB_RTC = 3008; + IO_ENDPOINT_IO_ERROR_ON_WEB_RTC = 3008 [deprecated = true]; // Payloads IOError due to endpoint get IOException on Lan medium (IOException // on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_LAN = 3009; + IO_ENDPOINT_IO_ERROR_ON_LAN = 3009 [deprecated = true]; // Payloads IOError due to endpoint get IOException on WFD medium (IOException // on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_WIFI_DIRECT = 3010; + IO_ENDPOINT_IO_ERROR_ON_WIFI_DIRECT = 3010 [deprecated = true]; // Payloads IOError due to endpoint get IOException on Hotspot medium // (IOException on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_WIFI_HOTSPOT = 3011; + IO_ENDPOINT_IO_ERROR_ON_WIFI_HOTSPOT = 3011 [deprecated = true]; // Payloads IOError due to endpoint get IOException on Aware medium // (IOException on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_WIFI_AWARE = 3012; + IO_ENDPOINT_IO_ERROR_ON_WIFI_AWARE = 3012 [deprecated = true]; // Payloads IOError due to endpoint get IOException on NFC medium (IOException // on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_NFC = 3013; + IO_ENDPOINT_IO_ERROR_ON_NFC = 3013 [deprecated = true]; // Payloads IOError due to endpoint get IOException on USB medium (IOException // on Channel#write) - IO_ENDPOINT_IO_ERROR_ON_USB = 3014; + IO_ENDPOINT_IO_ERROR_ON_USB = 3014 [deprecated = true]; // Section of CATEGORY_CONNECTIVITY_ERROR, from 3500 to 4499 // Attach result of WifiAwareManager failure @@ -827,6 +918,108 @@ enum OperationResultDetail { CONNECTIVITY_L2CAP_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE = 3554; // BT server socket creation failure (SecurityException) CONNECTIVITY_BT_SERVER_SOCKET_CREATION_SECURITY_EXCEPTION_FAILURE = 3555; + // Failed to create L2CAP outgoing socket (TimeoutException on socket#connect) + CONNECTIVITY_L2CAP_CLIENT_SOCKET_CREATION_TIMEOUT_FAILURE = 3556; + // Failed to create connectionFlow + CONNECTIVITY_WEB_RTC_UNSATISFIED_LINK_ERROR = 3557; + // Different frequencies between group and AP frequencies + CONNECTIVITY_DIRECT_GROUP_MCC_FAILURE = 3558; + // Payloads IOError due to endpoint get IOException on BLE medium (IOException + // on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE = 3559; + // Payloads IOError due to endpoint get IOException on L2CAP medium + // (IOException on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_BLE_L2CAP = 3560; + // Payloads IOError due to endpoint get IOException on BT medium (IOException + // on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_BT = 3561; + // Payloads IOError due to endpoint get IOException on WebRtc medium + // (IOException on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WEB_RTC = 3562; + // Payloads IOError due to endpoint get IOException on Lan medium (IOException + // on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_LAN = 3563; + // Payloads IOError due to endpoint get IOException on WFD medium (IOException + // on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_DIRECT = 3564; + // Payloads IOError due to endpoint get IOException on Hotspot medium + // (IOException on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_HOTSPOT = 3565; + // Payloads IOError due to endpoint get IOException on Aware medium + // (IOException on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_WIFI_AWARE = 3566; + // Payloads IOError due to endpoint get IOException on NFC medium (IOException + // on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_NFC = 3567; + // Payloads IOError due to endpoint get IOException on USB medium (IOException + // on Channel#write) + CONNECTIVITY_CHANNEL_IO_ERROR_ON_USB = 3568; + // Payloads IOError due to endpoint get IOException on UNKNOWN medium + CONNECTIVITY_CHANNEL_IO_ERROR_ON_UNKNOWN_MEDIUM = 3569; + // IOException on bluetooth socket creation + CONNECTIVITY_BT_SOCKET_CREATION_IO_EXCEPTION = 3570; + // IOException on bluetooth socket connection + CONNECTIVITY_BT_SOCKET_CONNECT_IO_EXCEPTION = 3571; + // Interrupted exception on bluetooth socket connection + CONNECTIVITY_BT_CONNECTION_INTERRUPTED_EXCEPTION = 3572; + // Execution exception on bluetooth socket connection + CONNECTIVITY_BT_CONNECTION_EXECUTION_EXCEPTION = 3573; + // Timeout exception on bluetooth socket connection + CONNECTIVITY_BT_CONNECTION_TIMEOUT_EXCEPTION = 3574; + // Failure on WifiManager#connect + CONNECTIVITY_WIFI_DIRECT_P2P_CONNECTION_FAILURE = 3575; + // Interrupted exception on Wifi Direct socket connection + CONNECTIVITY_WFD_CONNECTION_INTERRUPTED_EXCEPTION = 3576; + // Execution exception on Wifi Direct socket connection + CONNECTIVITY_WFD_CONNECTION_EXECUTION_EXCEPTION = 3577; + // Timeout exception on Wifi Direct socket connection + CONNECTIVITY_WFD_CONNECTION_TIMEOUT_EXCEPTION = 3578; + // Hosted address is null in Wifi Direct group + CONNECTIVITY_WFD_CONNECTION_HOSTED_ADDRESS_NULL = 3579; + // Connect to Wifi Hotspot Specifier failure + CONNECTIVITY_WIFI_HOTSPOT_SPECIFIER_FAILURE = 3580; + // Connect to Wifi Hotspot failure + CONNECTIVITY_WIFI_HOTSPOT_LEGACY_STA_CONNECTION_FAILURE = 3581; + // Connect to Wifi LAN socket timeout + CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_TIMEOUT = 3582; + // IOException on bluetooth socket connection + CONNECTIVITY_WIFI_LAN_SOCKET_CONNECT_IO_EXCEPTION = 3583; + // Failed to start GATT server + CONNECTIVITY_BLE_START_GATT_SERVER_FAILURE = 3584; + // Failed to add GATT advertisement + CONNECTIVITY_BLE_ADD_GATT_ADVERTISEMENT_FAILURE = 3585; + // Failed to start BLE advertisement + CONNECTIVITY_BLE_START_ADVERTISING_FAILURE = 3586; + // Failed to start BT advertisement + CONNECTIVITY_BLUETOOTH_START_ADVERTISING_FAILURE = 3587; + // Failed to start WLAN advertisement + CONNECTIVITY_WIFI_LAN_START_ADVERTISING_FAILURE = 3588; + // Failed to start Wifi Aware advertisement + CONNECTIVITY_WIFI_AWARE_START_ADVERTISING_FAILURE = 3589; + // Failed to start Bluetooth scan + CONNECTIVITY_BLUETOOTH_SCAN_FAILURE = 3590; + // Failed to start BLE scan + CONNECTIVITY_BLE_SCAN_FAILURE = 3591; + // Failed to start MDNS scan + CONNECTIVITY_MDNS_SCAN_FAILURE = 3592; + // Failed to start NFC discovery + CONNECTIVITY_NFC_START_DISCOVERY_FAILURE = 3593; + // Failed to start WLAN discovery + CONNECTIVITY_WIFI_LAN_START_DISCOVERY_FAILURE = 3594; + // Failed to start Wifi Aware discovery + CONNECTIVITY_WIFI_AWARE_START_DISCOVERY_FAILURE = 3595; + // Failed to start UWB discovery + CONNECTIVITY_UWB_START_DISCOVERY_FAILURE = 3596; + // Failed to register MDNS listening + CONNECTIVITY_LAN_MDNS_REGISTER_FAILURE = 3597; + // Failed to change BT scan mode + CONNECTIVITY_BLUETOOTH_CHANGE_SCAN_MODE_FAILURE = 3598; + // Auto resume failure + CONNECTIVITY_AUTO_RESUME_FAILURE = 3599; + // Timeout when listening instant connection + CONNECTIVITY_INSTANT_CONNECTION_LISTENING_TIMEOUT = 3600; + // Invalid credential for connection + CONNECTIVITY_MEDIUM_INVALID_CREDENTIAL = 3601; // Section of CATEGORY_NEARBY_ERROR, from 4500 // NO BLE MAC address associated to the GATT advertisement @@ -900,7 +1093,7 @@ enum OperationResultDetail { // Methods calling with null password NEARBY_WIFI_DIRECT_NULL_PASSWORD = 4529; // Multiple BT socket is disabled - NEARBY_BT_MULTIPLEX_SOCKET_DISABLED = 4530; + NEARBY_BT_MULTIPLEX_SOCKET_DISABLED = 4530 [deprecated = true]; // Multiple LAN socket is disabled NEARBY_LAN_MULTIPLEX_SOCKET_DISABLED = 4531; // Channel of the new upgraded medium is null @@ -974,6 +1167,108 @@ enum OperationResultDetail { NEARBY_WIFI_LAN_IP_ADDRESS_ERROR = 4565; // PSM value less than 1 NEARBY_L2CAP_PSM_NOT_POSITIVE = 4566; + // Log the encryption failure case + NEARBY_ENCRYPTION_FAILURE = 4567; + // Log the authentication failure case + NEARBY_AUTHENTICATION_FAILURE = 4568; + // Failed to create multiple LAN socket + NEARBY_LAN_VIRTUAL_SOCKET_NULL = 4569; + // Failed to get new bluetooth name for advertising + NEARBY_BLUETOOTH_ADVERTISE_TO_BYTES_FAILURE = 4570; + // Failed to transform advertising info into bytes + NEARBY_BLE_ADVERTISE_TO_BYTES_FAILURE = 4571; + // Failed to transform advertising info into bytes + NEARBY_BLE_FAST_ADVERTISE_TO_BYTES_FAILURE = 4572; + // Failed to transform advertising info into bytes + NEARBY_NFC_ADVERTISE_TO_BYTES_FAILURE = 4573; + // Failed to transform advertising info into bytes + NEARBY_WIFI_LAN_ADVERTISE_TO_BYTES_FAILURE = 4574; + // Failed to transform advertising info into bytes + NEARBY_WIFI_AWARE_ADVERTISE_TO_BYTES_FAILURE = 4575; + // Failed to get new USB name for advertising + NEARBY_USB_ADVERTISE_TO_BYTES_FAILURE = 4576; + // AdvertisingPcpOptions is invalid for NFC + NEARBY_NFC_INVALID_PCP_OPTIONS = 4577; + // AdvertisingPcpOptions is invalid for Bluetooth + NEARBY_BLUETOOTH_INVALID_PCP_OPTIONS = 4578; + // AdvertisingPcpOptions is invalid for BLE + NEARBY_BLE_INVALID_PCP_OPTIONS = 4579; + // AdvertisingPcpOptions is invalid for Wifi LAN + NEARBY_WIFI_LAN_INVALID_PCP_OPTIONS = 4580; + // AdvertisingPcpOptions is invalid for Wifi Aware + NEARBY_WIFI_AWARE_INVALID_PCP_OPTIONS = 4581; + // AdvertisingPcpOptions is invalid for USB + NEARBY_USB_INVALID_PCP_OPTIONS = 4582; + // AdvertisingPcpOptions is invalid for UWB + NEARBY_UWB_INVALID_PCP_OPTIONS = 4583; + // AdvertisingPcpOptions is invalid for Web RTC + NEARBY_WEB_RTC_INVALID_PCP_OPTIONS = 4584; + // Bluetooth starts scanning without any client existed. + NEARBY_BLUETOOTH_NO_CLIENT_REGISTER_FOR_SCAN = 4585; + // TX Advertisement on a wrong connectivity info. + NEARBY_INSTANT_CONNECTION_WRONG_CONNECTIVITY_INFO = 4586; + // Need to override method + NEARBY_NEED_METHOD_OVERRIDE = 4587; + // Incoming payloads creation failure + NEARBY_GENERIC_INCOMING_PAYLOAD_CREATION_FAILURE = 4588; + // No listening peer found + NEARBY_WEB_RTC_NO_LISTENING_PEER_FOUND = 4589; + // Current medium not in upgrade available mediums + NEARBY_UPGRADE_PATH_ON_WRONG_MEDIUM = 4590; + // Connect to all medium failure + NEARBY_CONNECT_TO_ALL_MEDIUMS_FAILURE = 4591; + // MAC address null when reconnect to bluetooth + NEARBY_BLUETOOTH_RECONNECT_MAC_NULL = 4592; + // Connection info null when reconnect to wifi lan + NEARBY_LAN_RECONNECT_CONNECTION_INFO_NULL = 4593; + // Ip address null when reconnect to wifi lan + NEARBY_LAN_RECONNECT_IP_NULL = 4594; + // Meta data null when reconnect to wifi Direct + NEARBY_WIFI_DIRECT_RECONNECT_META_DATA_NULL = 4595; + // Connect meta data null when reconnect to wifi Direct + NEARBY_WIFI_DIRECT_RECONNECT_CONNECT_META_DATA_NULL = 4596; + // Meta data null when reconnect to wifi Hotspot + NEARBY_WIFI_HOTSPOT_RECONNECT_META_DATA_NULL = 4597; + // Connect meta data null when reconnect to wifi Hotspot + NEARBY_WIFI_HOTSPOT_RECONNECT_CONNECT_META_DATA_NULL = 4598; + // Peer id null when reconnect to Web RTC + NEARBY_WEB_RTC_RECONNECT_PEER_ID_NULL = 4599; + // Meta data null when reconnect to wifi Aware + NEARBY_WIFI_AWARE_RECONNECT_META_DATA_NULL = 4600; + // Client not advertising and not listening + NEARBY_NOT_ADVERTISING_OR_LISTENING = 4601; + // Can not obtain device provider + NEARBY_CAN_NOT_OBTAIN_DEVICE_PROVIDER = 4602; + // Failed to setup strategy + NEARBY_SETUP_STRATEGY_FAILURE = 4603; + // TxAdvertisement null + NEARBY_TX_ADVERTISEMENT_NULL = 4604; + // Endpoint id mismatch + NEARBY_ENDPOINT_ID_MISMATCH = 4605; + // Connectivity info null + NEARBY_CONNECTIVITY_INFO_NULL_OR_WRONG = 4606; + // Local client state wrong + NEARBY_LOCAL_CLIENT_STATE_WRONG = 4607; + // Remote exception when processing received payload + NEARBY_REMOTE_EXCEPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD = 4608; + // Bad file description when processing received payload + NEARBY_BAD_FILE_DESCRIPTION_WHEN_PROCESSING_RECEIVED_PAYLOAD = 4609; +} + +enum StopAdvertisingReason { + STOP_ADVERTISING_REASON_UNKNOWN = 0; + // Client call stopAdvertising() to stop advertising + CLIENT_STOP_ADVERTISING = 1; + // Session is finished and stop advertising + FINISH_SESSION_STOP_ADVERTISING = 2; +} + +enum StopDiscoveringReason { + STOP_DISCOVERING_REASON_UNKNOWN = 0; + // Client call stopDiscovering() to stop discovering + CLIENT_STOP_DISCOVERING = 1; + // Session is finished and stop discovering + FINISH_SESSION_STOP_DISCOVERING = 2; } // LINT.ThenChange( // //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto diff --git a/proto/connections_westworld_enums.proto b/proto/connections_westworld_enums.proto new file mode 100644 index 00000000..655bd10c --- /dev/null +++ b/proto/connections_westworld_enums.proto @@ -0,0 +1,106 @@ +// Copyright 2024 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. + +syntax = "proto2"; + +package location.nearby.proto.connections; + +// import "logs/proto/logs_annotations/logs_annotations.proto"; + +// option (logs_proto.file_not_used_for_logging_except_enums) = true; +option optimize_for = LITE_RUNTIME; +option java_package = "com.google.location.nearby.proto"; +option java_outer_classname = "ConnectionsWestworldEnums"; + +// LINT.IfChange + +// An indication of the client using the Nearby Connections library. +enum ConnectionsClient { + CONNECTIONS_CLIENT_UNKNOWN = 0; + CONNECTIONS_CLIENT_NEARBY_SHARE = 1; + CONNECTIONS_CLIENT_QUICK_START = 2; + CONNECTIONS_CLIENT_OTHER_FIRST_PARTY = 3; + CONNECTIONS_CLIENT_THIRD_PARTY = 4; +} + +// An identifier for the type of event being reported in a shared proto. +enum ReportedEventType { + NC_EVENT_TYPE_UNSPECIFIED = 0; + + // The client has started discovery. + NC_EVENT_TYPE_START_DISCOVERY = 1; + + // The client has stopped discovery. + NC_EVENT_TYPE_STOP_DISCOVERY = 2; + + // Logged when discovery is active and an endpoint matching the current + // discovery parameters has been found. + NC_EVENT_TYPE_ENDPOINT_FOUND = 3; + + // Logged when discovery is active and an endpoint which had previously + // matched the current discovery parameters is no longer detected. + NC_EVENT_TYPE_ENDPOINT_LOST = 4; + + // A call to the startAdvertising method. + NC_EVENT_TYPE_START_ADVERTISING = 5; + + // A call to the stopAdvertising method. + NC_EVENT_TYPE_STOP_ADVERTISING = 6; + + // The current discovery options have been modified, for instance to include + // a different power level or mediums. + NC_EVENT_TYPE_DISCOVERY_OPTIONS_UPDATED = 7; + + // The client has called requestConnection. + NC_EVENT_TYPE_ON_REQUEST_CONNECTION = 8; + + // The client has sent a connection request to another endpoint. + NC_EVENT_TYPE_ON_CONNECTION_REQUEST_SENT = 9; + + // The client has received a connection request from another endpoint. + NC_EVENT_TYPE_ON_CONNECTION_REQUEST_RECEIVED = 10; + + // During connection establishment, the local endpoint has accepted the + // connection. + NC_EVENT_TYPE_ON_LOCAL_ENDPOINT_ACCEPTED = 11; + + // During connection establishment, the local endpoint has rejected the + // connection. + NC_EVENT_TYPE_ON_LOCAL_ENDPOINT_REJECTED = 12; + + // During connection establishment, the remote endpoint has accepted the + // connection. + NC_EVENT_TYPE_ON_REMOTE_ENDPOINT_ACCEPTED = 13; + + // During connection establishment, the remote endpoint has rejected the + // connection. + NC_EVENT_TYPE_ON_REMOTE_ENDPOINT_REJECTED = 14; + + // A remote endpoint is attempting to connect to the client. + NC_EVENT_TYPE_ON_INCOMING_CONNECTION_ATTEMPT = 15; + + // The client is attempting to connect to a remote endpoint. + NC_EVENT_TYPE_ON_OUTGOING_CONNECTION_ATTEMPT = 16; + + // A connection has been established. + NC_EVENT_TYPE_ON_CONNECTION_ESTABLSHED = 17; + + // A connection has been closed. Note that sometimes a connection is closed + // because it is being upgraded to a higher bandwidth Medium. + NC_EVENT_TYPE_ON_CONNECTION_CLOSED = 18; +} + +// LINT.ThenChange( +// //depot/google3/wireless/android/stats/platform/westworld/public/protos/enums/android/nearby/connections/enums.proto +// ) diff --git a/proto/errorcode/BUILD b/proto/errorcode/BUILD index 1ec24aef..581da014 100644 --- a/proto/errorcode/BUILD +++ b/proto/errorcode/BUILD @@ -15,6 +15,7 @@ # Proto for Nearby products load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") licenses(["notice"]) diff --git a/proto/mediums/BUILD b/proto/mediums/BUILD index 7457b04e..125e8cf4 100644 --- a/proto/mediums/BUILD +++ b/proto/mediums/BUILD @@ -13,6 +13,7 @@ # limitations under the License. load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") licenses(["notice"]) @@ -25,6 +26,12 @@ proto_library( ], ) +cc_proto_library( + name = "multiplex_frames_cc_proto", + visibility = ["//:__subpackages__"], + deps = [":multiplex_frames_proto"], +) + proto_library( name = "nfc_frames_proto", srcs = [ diff --git a/proto/mediums/nfc_frames.proto b/proto/mediums/nfc_frames.proto index 521c6ec2..2f9d7278 100644 --- a/proto/mediums/nfc_frames.proto +++ b/proto/mediums/nfc_frames.proto @@ -24,13 +24,15 @@ option java_outer_classname = "NfcFramesProto"; option java_package = "com.google.location.nearby.mediums.proto"; // The data to be sent to scanning devices from advertising devices during -// adveritising. +// advertising. message AdvertisementData { // The tag in the advertisement. optional bytes tag = 1; // A public key associated with the advertisement. optional bytes public_key = 2 /* type = ST_SECURITY_KEY */; + + optional bytes rx_advertisement = 3; } // The data to be sent to advertisers from scanning device during discovery. diff --git a/proto/sharing_enums.proto b/proto/sharing_enums.proto index 89a8faf2..8995f606 100644 --- a/proto/sharing_enums.proto +++ b/proto/sharing_enums.proto @@ -17,6 +17,8 @@ syntax = "proto2"; package location.nearby.proto.sharing; // import "logs/proto/logs_annotations/logs_annotations.proto"; +// import "logs/proto/wireless/beto/beto_enums.proto"; +// import "logs/proto/wireless/beto/log_dimension_annotations.proto"; // option (logs_proto.file_not_used_for_logging_except_enums) = true; option optimize_for = LITE_RUNTIME; @@ -30,7 +32,7 @@ option objc_class_prefix = "GNSHP"; // in NearbyClearcutLogger (for android, or clearcut_event_logger as the // equivalence for Windows) for all events (may exclude settings), and // session_id for a pair of events (start and end of a session). -// Next id: 65 +// Next id: 71 enum EventType { UNKNOWN_EVENT_TYPE = 0; @@ -50,59 +52,93 @@ enum EventType { // Describe attachments immediately when Nearby Sharing is opened by another // app which is used to generate/attach attachments to be shared with other // devices. - DESCRIBE_ATTACHMENTS = 4; + DESCRIBE_ATTACHMENTS = 4 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // Start of a scanning phase at sender. - SCAN_FOR_SHARE_TARGETS_START = 5; + SCAN_FOR_SHARE_TARGETS_START = 5 /*[[*/ + /*( device_role = DEVICE_ROLE_INITIATOR, )*/ + /*( stage = STAGE_QS_DISCOVER_START )*/ + /*]]*/; // End of the scanning phase at sender. - SCAN_FOR_SHARE_TARGETS_END = 6; + SCAN_FOR_SHARE_TARGETS_END = 6 /*[[*/ + /*( device_role = DEVICE_ROLE_INITIATOR, )*/ + /*( stage = STAGE_QS_DISCOVER_END )*/ + /*]]*/; // Receiver advertises itself for presence (a pseudo session). - ADVERTISE_DEVICE_PRESENCE_START = 7; + ADVERTISE_DEVICE_PRESENCE_START = 7 /*[[*/ + /*( device_role = DEVICE_ROLE_REMOTE, )*/ + /*( stage = STAGE_QS_ADVERTISE_START )*/ + /*]]*/; // End of the advertising phase at receiver. - ADVERTISE_DEVICE_PRESENCE_END = 8; + ADVERTISE_DEVICE_PRESENCE_END = 8 /*[[*/ + /*( device_role = DEVICE_ROLE_REMOTE, )*/ + /*( stage = STAGE_QS_ADVERTISE_END )*/ + /*]]*/; // Sender sends a fast initialization to receiver. - SEND_FAST_INITIALIZATION = 9; + SEND_FAST_INITIALIZATION = 9 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // Receiver receives the fast initialization. - RECEIVE_FAST_INITIALIZATION = 10; + RECEIVE_FAST_INITIALIZATION = 10 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Sender discovers a share target. - DISCOVER_SHARE_TARGET = 11; + DISCOVER_SHARE_TARGET = 11 /*[[*/ + /*( device_role = DEVICE_ROLE_INITIATOR, )*/ + /*( stage = STAGE_QS_DISCOVERED )*/ + /*]]*/; // Sender sends introduction (before attachments being sent). - SEND_INTRODUCTION = 12; + SEND_INTRODUCTION = 12 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // Receiver receives introduction. - RECEIVE_INTRODUCTION = 13; + RECEIVE_INTRODUCTION = 13 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Receiver responds to introduction (before attachments being sent). // Actions: Accept, Reject, or (for some reason) Fail. - RESPOND_TO_INTRODUCTION = 14; + RESPOND_TO_INTRODUCTION = 14 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Start of the sending attachments phase at sender. - SEND_ATTACHMENTS_START = 15; + SEND_ATTACHMENTS_START = 15 /*[[*/ + /*( device_role = DEVICE_ROLE_INITIATOR, )*/ + /*( stage = STAGE_QS_TRANSFER_START )*/ + /*]]*/; // End of sending attachments phase at sender. - SEND_ATTACHMENTS_END = 16; + SEND_ATTACHMENTS_END = 16 /*[[*/ + /*( device_role = DEVICE_ROLE_INITIATOR, )*/ + /*( stage = STAGE_QS_TRANSFER_END )*/ + /*]]*/; // Start of the receiving attachments phase at receiver. - RECEIVE_ATTACHMENTS_START = 17; + RECEIVE_ATTACHMENTS_START = 17 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // End of receiving attachments phase at receiver. - RECEIVE_ATTACHMENTS_END = 18; + RECEIVE_ATTACHMENTS_END = 18 /*[[*/ + /*( device_role = DEVICE_ROLE_REMOTE, )*/ + /*( stage = STAGE_QS_TRANSFER_END )*/ + /*]]*/; // Sender cancels sending attachments. - CANCEL_SENDING_ATTACHMENTS = 19; + CANCEL_SENDING_ATTACHMENTS = 19 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // Receiver cancels receiving attachments. - CANCEL_RECEIVING_ATTACHMENTS = 20; + CANCEL_RECEIVING_ATTACHMENTS = 20 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Receiver opens received attachments. - OPEN_RECEIVED_ATTACHMENTS = 21; + OPEN_RECEIVED_ATTACHMENTS = 21 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // User opens the setup activity. LAUNCH_SETUP_ACTIVITY = 22 [deprecated = true]; @@ -117,19 +153,25 @@ enum EventType { FAST_SHARE_SERVER_RESPONSE = 25; // The start of a sending session. - SEND_START = 26; + SEND_START = 26 /*[[*/ + /*( device_role = DEVICE_ROLE_INITIATOR, )*/ + /*( stage = STAGE_QS_CONNECT_START )*/ + /*]]*/; // Receiver accepts a fast initialization. - ACCEPT_FAST_INITIALIZATION = 27; + ACCEPT_FAST_INITIALIZATION = 27 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Set data usage preference. SET_DATA_USAGE = 28; // Receiver dismisses a fast initialization - DISMISS_FAST_INITIALIZATION = 29; + DISMISS_FAST_INITIALIZATION = 29 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Cancel connection. - CANCEL_CONNECTION = 30; + CANCEL_CONNECTION = 30 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // User starts a chimera activity (e.g. ConsentsChimeraActivity, // DeviceVisibilityChimeraActivity...) @@ -163,10 +205,10 @@ enum EventType { TAP_QUICK_SETTINGS_TILE = 39; // Receiver Installation of APKs status. - INSTALL_APK = 40; + INSTALL_APK = 40 /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Receiver verification of APKs status. - VERIFY_APK = 41; + VERIFY_APK = 41 /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // User starts a consent. LAUNCH_CONSENT = 42; @@ -174,7 +216,8 @@ enum EventType { // After receiving payloads, Nearby Share still needs to transfer the payloads // to correct attachment formats and move files attachments from temporary // directory to final destination. - PROCESS_RECEIVED_ATTACHMENTS_END = 43; + PROCESS_RECEIVED_ATTACHMENTS_END = 43 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Toggle Show Notification setting item in Nearby Share setting. TOGGLE_SHOW_NOTIFICATION = 44; @@ -189,20 +232,22 @@ enum EventType { REQUEST_SETTING_PERMISSIONS = 47; // Set up a connection with the remote device. - ESTABLISH_CONNECTION = 48; + ESTABLISH_CONNECTION = 48 /*[ stage = STAGE_QS_CONNECT_END ]*/; // Track device states in Nearby Share setting. DEVICE_SETTINGS = 49; // Receiver auto dismisses a fast initialization notification. - AUTO_DISMISS_FAST_INITIALIZATION = 50; + AUTO_DISMISS_FAST_INITIALIZATION = 50 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // App Crash event. // Used only for Windows App now. APP_CRASH = 51; // Sender taps the Send button in quick settings - TAP_QUICK_SETTINGS_FILE_SHARE = 52; + TAP_QUICK_SETTINGS_FILE_SHARE = 52 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // Devices show a privacy notification DISPLAY_PRIVACY_NOTIFICATION = 53; @@ -218,16 +263,19 @@ enum EventType { SETUP_WIZARD = 57; // Sender taps a QR code - TAP_QR_CODE = 58; + TAP_QR_CODE = 58 /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // QR code link shown - QR_CODE_LINK_SHOWN = 59; + QR_CODE_LINK_SHOWN = 59 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // Sender failed to parse endpoint id. - PARSING_FAILED_ENDPOINT_ID = 60; + PARSING_FAILED_ENDPOINT_ID = 60 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; // The device is discovered by fast initialization - FAST_INIT_DISCOVER_DEVICE = 61; + FAST_INIT_DISCOVER_DEVICE = 61 + /*[ device_role = DEVICE_ROLE_REMOTE ]*/; // Send desktop notification. SEND_DESKTOP_NOTIFICATION = 62; @@ -238,6 +286,26 @@ enum EventType { // Decrypt certificate failure DECRYPT_CERTIFICATE_FAILURE = 64; + // Show allow permission auto access UI + SHOW_ALLOW_PERMISSION_AUTO_ACCESS = 65 + /*[ device_role = DEVICE_ROLE_INITIATOR ]*/; + + // UI events for transferring files with desktop applications. It includes + // event types such as DESKTOP_TRANSFER_EVENT_SEND_TYPE_SELECT_A_DEVICE. + SEND_DESKTOP_TRANSFER_EVENT = 66; + + // Show accept button on Quick Share receive UI + WAITING_FOR_ACCEPT = 67; + + // High quality event setup + HIGH_QUALITY_MEDIUM_SETUP = 68; + + // RPC call status + RPC_CALL_STATUS = 69; + + // A QR code sharing session has started + START_QR_CODE_SESSION = 70; + // LINT.ThenChange(//depot/google3/location/nearby/proto/nearby_event_codes.proto:SharingEventCode) } @@ -248,6 +316,7 @@ enum EventCategory { SENDING_EVENT = 1; RECEIVING_EVENT = 2; SETTINGS_EVENT = 3; + RPC_EVENT = 4; } // Status of nearby sharing. @@ -263,7 +332,7 @@ enum Visibility { CONTACTS_ONLY = 1; EVERYONE = 2; - SELECTED_CONTACTS_ONLY = 3; + SELECTED_CONTACTS_ONLY = 3 [deprecated = true]; HIDDEN = 4; SELF_SHARE = 5; } @@ -280,25 +349,38 @@ enum DataUsage { enum EstablishConnectionStatus { CONNECTION_STATUS_UNKNOWN = 0; - CONNECTION_STATUS_SUCCESS = 1; - CONNECTION_STATUS_FAILURE = 2; - CONNECTION_STATUS_CANCELLATION = 3; - CONNECTION_STATUS_MEDIA_UNAVAILABLE_ATTACHMENT = 4; - CONNECTION_STATUS_FAILED_PAIRED_KEYHANDSHAKE = 5; - CONNECTION_STATUS_FAILED_WRITE_INTRODUCTION = 6; - CONNECTION_STATUS_FAILED_NULL_CONNECTION = 7; - CONNECTION_STATUS_FAILED_NO_TRANSFER_UPDATE_CALLBACK = 8; - CONNECTION_STATUS_LOST_CONNECTIVITY = 9; + CONNECTION_STATUS_SUCCESS = 1 + /*[ status_bucket = STATUS_SUCCESSFUL ]*/; + CONNECTION_STATUS_FAILURE = 2 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; + CONNECTION_STATUS_CANCELLATION = 3 + /*[ status_bucket = STATUS_CANCELLED ]*/; + CONNECTION_STATUS_MEDIA_UNAVAILABLE_ATTACHMENT = 4 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; + CONNECTION_STATUS_FAILED_PAIRED_KEYHANDSHAKE = 5 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; + CONNECTION_STATUS_FAILED_WRITE_INTRODUCTION = 6 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; + CONNECTION_STATUS_FAILED_NULL_CONNECTION = 7 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; + CONNECTION_STATUS_FAILED_NO_TRANSFER_UPDATE_CALLBACK = 8 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; + CONNECTION_STATUS_LOST_CONNECTIVITY = 9 + /*[ status_bucket = STATUS_INTERRUPTION ]*/; + // TODO: b/341782941 - : Annote this status when it's confirmed by Nearby + // Connections team. + CONNECTION_STATUS_INVALID_ADVERTISEMENT = 10; } // The status of sending and receiving attachments. Used by SEND_ATTACHMENTS. enum AttachmentTransmissionStatus { UNKNOWN_ATTACHMENT_TRANSMISSION_STATUS = 0; - - COMPLETE_ATTACHMENT_TRANSMISSION_STATUS = 1; - CANCELED_ATTACHMENT_TRANSMISSION_STATUS = 2; - FAILED_ATTACHMENT_TRANSMISSION_STATUS = 3; - + COMPLETE_ATTACHMENT_TRANSMISSION_STATUS = 1 + /*[ status_bucket = STATUS_SUCCESSFUL ]*/; + CANCELED_ATTACHMENT_TRANSMISSION_STATUS = 2 + /*[ status_bucket = STATUS_CANCELLED ]*/; + FAILED_ATTACHMENT_TRANSMISSION_STATUS = 3 + /*[ status_bucket = STATUS_INTERNAL_ERROR ]*/; REJECTED_ATTACHMENT = 4 [deprecated = true]; TIMED_OUT_ATTACHMENT = 5 [deprecated = true]; AWAITING_REMOTE_ACCEPTANCE_FAILED_ATTACHMENT = 6 [deprecated = true]; @@ -329,7 +411,8 @@ enum AttachmentTransmissionStatus { REJECTED_ATTACHMENT_TRANSMISSION_STATUS = 22; TIMED_OUT_ATTACHMENT_TRANSMISSION_STATUS = 23; - NOT_ENOUGH_SPACE_ATTACHMENT_TRANSMISSION_STATUS = 24; + NOT_ENOUGH_SPACE_ATTACHMENT_TRANSMISSION_STATUS = 24 + /*[ status_bucket = STATUS_INTERRUPTION ]*/; UNSUPPORTED_ATTACHMENT_TYPE_ATTACHMENT_TRANSMISSION_STATUS = 25; FAILED_UNKNOWN_REMOTE_RESPONSE_TRANSMISSION_STATUS = 26; // Connection failed due to Wifi is disconnected or Bluetooth setting is off @@ -340,7 +423,8 @@ enum AttachmentTransmissionStatus { NO_RESPONSE_FRAME_CONNECTION_CLOSED_TRANSMISSION_STATUS = 28; // Connection failed due to Wifi is disconnected or Bluetooth setting is off // or user turn on airplane mode. - LOST_CONNECTIVITY_TRANSMISSION_STATUS = 29; + LOST_CONNECTIVITY_TRANSMISSION_STATUS = 29 + /*[ status_bucket = STATUS_INTERRUPTION ]*/; } // Generic result status of NearbyConnections API calls. @@ -414,8 +498,13 @@ enum ProcessReceivedAttachmentsStatus { // SCAN_FOR_SHARE_TARGETS and ADVERTISE_DEVICE_PRESENCE. enum SessionStatus { UNKNOWN_SESSION_STATUS = 0; + SUCCEEDED_SESSION_STATUS = 1 + /*[ status_bucket = STATUS_SUCCESSFUL ]*/; - SUCCEEDED_SESSION_STATUS = 1; + // TODO: b/341782941 - FAILED_SESSION_STATUS occurs when the status of + // advertising or discovering sessions is not successful. It can be + // due to STATUS_INTERNAL_ERROR, STATUS_INTERRUPTION, STATUS_CANCELLED. + // More session statuses should be logged to determine the status. FAILED_SESSION_STATUS = 2; } @@ -436,6 +525,7 @@ enum DeviceType { PHONE = 1; TABLET = 2; LAPTOP = 3; + CAR = 4; } // TODO(fdi): may eventually include windows, iOS, etc. @@ -447,6 +537,7 @@ enum OSType { CHROME_OS = 2; IOS = 3; WINDOWS = 4; + MACOS = 5; } // Relationship of remote device to sender device. @@ -480,6 +571,12 @@ enum LogSource { DEBUG_DEVICES = 5; // Represents the device for Nearby Module Food. NEARBY_MODULE_FOOD_DEVICES = 6; + // Represents the device for BeTo Team Food. + BETO_DOGFOOD_DEVICES = 7; + // Represents the device for Nearby dog Food. + NEARBY_DOGFOOD_DEVICES = 8; + // Represents the device for Nearby Team Food. + NEARBY_TEAMFOOD_DEVICES = 9; } // The Fast Share server action name. @@ -497,6 +594,9 @@ enum ServerActionName { LIST_REACHABLE_PHONE_NUMBERS = 9; LIST_MY_DEVICES = 10; LIST_CONTACT_PEOPLE = 11; + + // used for analytics logger to record action name. + DOWNLOAD_CERTIFICATES_INFO = 12; } // The Fast Share server response state. @@ -555,6 +655,10 @@ enum SyncPurpose { SYNC_PURPOSE_VISIBILITY_SELECTED_CONTACT_CHANGE = 14; // When switching account. SYNC_PURPOSE_ACCOUNT_CHANGE = 15; + // When regenerate certificates + SYNC_PURPOSE_REGENERATE_CERTIFICATES = 16; + // When Device Contacts consent changes + SYNC_PURPOSE_DEVICE_CONTACTS_CONSENT_CHANGE = 17; } // The device role to trigger the server request. @@ -769,7 +873,7 @@ enum FastInitType { FAST_INIT_SILENT_TYPE = 2; } -// LINT.IfChanged +// LINT.IfChange /** The type of desktop notification event. */ enum DesktopNotification { DESKTOP_NOTIFICATION_UNKNOWN = 0; @@ -806,6 +910,32 @@ enum DecryptCertificateFailureStatus { DECRYPT_CERT_ILLEGAL_BLOCK_SIZE_FAILURE = 5; DECRYPT_CERT_BAD_PADDING_FAILURE = 6; } + +// Refer to go/qs-contacts-consent-2024 for the detail. +enum ContactAccess { + CONTACT_ACCESS_UNKNOWN = 0; + + CONTACT_ACCESS_NO_CONTACT_UPLOADED = 1; + CONTACT_ACCESS_ONLY_UPLOAD_GOOGLE_CONTACT = 2; + CONTACT_ACCESS_UPLOAD_CONTACT_FOR_DEVICE_CONTACT_CONSENT = 3; + CONTACT_ACCESS_UPLOAD_CONTACT_FOR_QUICK_SHARE_CONSENT = 4; +} + +// Refer to go/qs-contacts-consent-2024 for the detail. +enum IdentityVerification { + IDENTITY_VERIFICATION_UNKNOWN = 0; + + IDENTITY_VERIFICATION_NO_PHONE_NUMBER_VERIFIED = 1; + IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_NOT_LINKED_TO_GAIA = 2; + IDENTITY_VERIFICATION_PHONE_NUMBER_VERIFIED_LINKED_TO_QS_GAIA = 3; +} + +enum ButtonStatus { + BUTTON_STATUS_UNKNOWN = 0; + BUTTON_STATUS_CLICK_ACCEPT = 1; + BUTTON_STATUS_CLICK_REJECT = 2; + BUTTON_STATUS_IGNORE = 3; +} // LINT.ThenChange( // //depot/google3/location/nearby/cpp/sharing/clients/dart/platform/lib/types/models.dart // ) diff --git a/sharing/BUILD b/sharing/BUILD new file mode 100644 index 00000000..eff7f304 --- /dev/null +++ b/sharing/BUILD @@ -0,0 +1,878 @@ +# Copyright 2024 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. + +licenses(["notice"]) + +cc_library( + name = "connection_types", + hdrs = ["nearby_connections_types.h"], + deps = [ + "//internal/base:files", + "//internal/crypto_cros", # buildcleaner: keep + "//internal/interop:authentication_status", + "//sharing/common:compatible_u8_string", + "@com_google_absl//absl/random", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + ], +) + +cc_library( + name = "attachments", + srcs = [ + "attachment.cc", + "attachment_container.cc", + "file_attachment.cc", + "text_attachment.cc", + "wifi_credentials_attachment.cc", + ], + hdrs = [ + "attachment.h", + "attachment_container.h", + "file_attachment.h", + "text_attachment.h", + "wifi_credentials_attachment.h", + ], + visibility = [ + "//location/nearby/cpp/sharing:__subpackages__", + "//location/nearby/sharing/sdk/quick_share_server:__pkg__", + "//location/nearby/testing/nearby_native:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + "//internal/network:url", + "//sharing/common:compatible_u8_string", + "//sharing/common:enum", + "//sharing/internal/base", + "//sharing/proto:wire_format_cc_proto", + "@com_google_absl//absl/random", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:string_view", + ], +) + +cc_library( + name = "types", + srcs = [ + "advertisement.cc", + "share_target.cc", + ], + hdrs = [ + "advertisement.h", + "constants.h", + "nearby_connection.h", + "nearby_connections_manager.h", + "share_target.h", + ], + visibility = [ + "//location/nearby/cpp/sharing:__subpackages__", + "//location/nearby/sharing/sdk/quick_share_server:__pkg__", + "//location/nearby/testing/nearby_native:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + ":connection_types", + "//internal/network:url", + "//sharing/common:enum", + "//sharing/internal/public:logging", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + ], +) + +cc_library( + name = "transfer_metadata", + srcs = [ + "transfer_metadata.cc", + "transfer_metadata_builder.cc", + ], + hdrs = [ + "transfer_metadata.h", + "transfer_metadata_builder.h", + ], + visibility = [ + "//location/nearby/cpp/sharing:__subpackages__", + "//location/nearby/sharing/sdk/quick_share_server:__pkg__", + "//location/nearby/testing/nearby_native:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + ], +) + +cc_library( + name = "nearby_sharing_decoder", + hdrs = ["nearby_sharing_decoder.h"], + visibility = [ + "//sharing/fuzzing:__pkg__", + ], + deps = [ + ":types", + "//sharing/proto:wire_format_cc_proto", + "@com_google_absl//absl/types:span", + ], +) + +cc_library( + name = "incoming_frame_reader", + srcs = ["incoming_frames_reader.cc"], + hdrs = ["incoming_frames_reader.h"], + deps = [ + ":thread_timer", + ":types", + "//internal/platform:types", + "//sharing/internal/public:logging", + "//sharing/proto:wire_format_cc_proto", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/memory", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + ], +) + +cc_library( + name = "paired_key_verification_runner", + srcs = ["paired_key_verification_runner.cc"], + hdrs = ["paired_key_verification_runner.h"], + deps = [ + ":incoming_frame_reader", + ":types", + "//internal/platform:types", + "//proto:sharing_enums_cc_proto", + "//sharing/certificates", + "//sharing/internal/public:logging", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:share_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "@com_google_absl//absl/time", + ], +) + +cc_library( + name = "thread_timer", + srcs = ["thread_timer.cc"], + hdrs = ["thread_timer.h"], + deps = [ + "//internal/platform:types", + "//sharing/internal/public:logging", + "@com_google_absl//absl/debugging:leak_check", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/time", + ], +) + +cc_library( + name = "share_session", + srcs = [ + "incoming_share_session.cc", + "nearby_file_handler.cc", + "outgoing_share_session.cc", + "payload_tracker.cc", + "share_session.cc", + ], + hdrs = [ + "incoming_share_session.h", + "nearby_file_handler.h", + "outgoing_share_session.h", + "payload_tracker.h", + "share_session.h", + ], + deps = [ + ":attachments", + ":connection_types", + ":incoming_frame_reader", + ":paired_key_verification_runner", + ":thread_timer", + ":transfer_metadata", + ":types", + "//internal/base:files", + "//internal/platform:types", + "//proto:sharing_enums_cc_proto", + "//sharing/analytics", + "//sharing/certificates", + "//sharing/common:compatible_u8_string", + "//sharing/internal/api:platform", + "//sharing/internal/public:logging", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + ], +) + +cc_library( + name = "nearby_connection_impl", + srcs = ["nearby_connection_impl.cc"], + hdrs = ["nearby_connection_impl.h"], + deps = [ + ":connection_types", + ":types", + "//internal/platform:types", + "//sharing/internal/public:logging", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + ], +) + +cc_library( + name = "nearby_sharing_service", + srcs = [ + "nearby_connections_manager.cc", + "nearby_connections_manager_factory.cc", + "nearby_connections_manager_impl.cc", + "nearby_connections_service.cc", + "nearby_connections_service_impl.cc", + "nearby_connections_stream_buffer_manager.cc", + "nearby_share_profile_info_provider_impl.cc", + "nearby_sharing_service.cc", + "nearby_sharing_service_factory.cc", + "nearby_sharing_service_impl.cc", + "nearby_sharing_settings.cc", + "nearby_sharing_util.cc", + "transfer_manager.cc", + "wrapped_share_target_discovered_callback.cc", + ], + hdrs = [ + "connection_lifecycle_listener.h", + "endpoint_discovery_listener.h", + "nearby_connections_manager_factory.h", + "nearby_connections_manager_impl.h", + "nearby_connections_service.h", + "nearby_connections_service_impl.h", + "nearby_connections_stream_buffer_manager.h", + "nearby_share_profile_info_provider_impl.h", + "nearby_sharing_service.h", + "nearby_sharing_service_extension.h", + "nearby_sharing_service_factory.h", + "nearby_sharing_service_impl.h", + "nearby_sharing_settings.h", + "nearby_sharing_util.h", + "payload_listener.h", + "share_target_discovered_callback.h", + "transfer_manager.h", + "transfer_update_callback.h", + "wrapped_share_target_discovered_callback.h", + ], + copts = [ + "-DNEARBY_SHARING_DLL", + ], + visibility = [ + "//location/nearby/cpp/sharing:__subpackages__", + "//location/nearby/sharing/sdk/quick_share_server:__pkg__", + "//location/nearby/testing/nearby_native:__subpackages__", + "//sharing:__subpackages__", + ], + deps = [ + ":attachments", + ":connection_types", + ":incoming_frame_reader", + ":nearby_connection_impl", + ":nearby_sharing_decoder", + ":paired_key_verification_runner", + ":share_session", + ":thread_timer", + ":transfer_metadata", + ":types", + "//connections:core", + "//connections:core_types", + "//connections/implementation:internal", + "//internal/analytics:event_logger", + "//internal/base", + "//internal/base:bluetooth_address", + "//internal/flags:nearby_flags", + "//internal/network:url", + "//internal/platform:base", + "//internal/platform:types", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation:types", + "//proto:sharing_enums_cc_proto", + "//sharing/analytics", + "//sharing/certificates", + "//sharing/common", + "//sharing/common:compatible_u8_string", + "//sharing/common:enum", + "//sharing/contacts", + "//sharing/fast_initiation:nearby_fast_initiation", + "//sharing/flags/generated:generated_flags", + "//sharing/internal/api:platform", + "//sharing/internal/base", + "//sharing/internal/public:logging", + "//sharing/internal/public:nearby_context", + "//sharing/internal/public:types", + "//sharing/local_device_data", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:share_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "//sharing/scheduling", + "@com_google_absl//absl/algorithm:container", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/functional:any_invocable", + "@com_google_absl//absl/functional:bind_front", + "@com_google_absl//absl/hash", + "@com_google_absl//absl/meta:type_traits", + "@com_google_absl//absl/random", + "@com_google_absl//absl/status:statusor", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + ], +) + +cc_library( + name = "test_support", + testonly = True, + srcs = [ + "fake_nearby_connection.cc", + "fake_nearby_connections_manager.cc", + "fake_nearby_sharing_service.cc", + ], + hdrs = [ + "fake_nearby_connection.h", + "fake_nearby_connections_manager.h", + "fake_nearby_sharing_service.h", + ], + visibility = ["//visibility:public"], + deps = [ + ":attachments", + ":connection_types", + ":nearby_sharing_service", + ":transfer_metadata", + ":types", + "//internal/base", + "//internal/platform:types", + "//sharing/common:enum", + "//sharing/internal/api:platform", + "//sharing/internal/public:logging", + "//sharing/local_device_data", + "//sharing/proto:enums_cc_proto", + "@com_google_absl//absl/algorithm:container", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + ], +) + +cc_library( + name = "attachment_compare", + testonly = True, + srcs = ["attachment_compare.cc"], + hdrs = ["attachment_compare.h"], + deps = [ + ":attachments", + "@com_google_absl//absl/strings", + ], +) + +cc_library( + name = "transfer_metadata_matchers", + testonly = True, + hdrs = ["transfer_metadata_matchers.h"], + deps = [ + ":transfer_metadata", + "@com_google_googletest//:gtest_for_library_testonly", + ], +) + +cc_test( + name = "advertisement_test", + srcs = ["advertisement_test.cc"], + deps = [ + ":types", + "//sharing/common:enum", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/types:span", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_connections_types_payload_test", + srcs = ["nearby_connections_types_payload_test.cc"], + deps = [ + ":connection_types", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "paired_key_verification_runner_test", + size = "small", + srcs = ["paired_key_verification_runner_test.cc"], + deps = [ + ":incoming_frame_reader", + ":paired_key_verification_runner", + ":test_support", + ":types", + "//internal/platform:types", + "//internal/test", + "//proto:sharing_enums_cc_proto", + "//sharing/certificates", + "//sharing/certificates:test_support", + "//sharing/internal/public:logging", + "//sharing/internal/public:types", + "//sharing/internal/test:nearby_test", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:share_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ] + select({ + "@platforms//os:windows": [ + "//internal/platform/implementation/windows", + ], + "//conditions:default": [ + "//internal/platform/implementation/g3", + ], + }), +) + +cc_test( + name = "nearby_sharing_service_test", + srcs = [ + "nearby_sharing_service_test.cc", + ], + deps = [ + ":nearby_sharing_service", + "//internal/platform/implementation/g3", # fixdeps: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "incoming_frames_reader_test", + srcs = ["incoming_frames_reader_test.cc"], + deps = [ + ":incoming_frame_reader", + ":nearby_connection_impl", + ":test_support", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/internal/public:logging", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_connection_impl_test", + srcs = ["nearby_connection_impl_test.cc"], + deps = [ + ":incoming_frame_reader", + ":nearby_connection_impl", + ":test_support", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_connections_manager_impl_test", + srcs = [ + "fake_nearby_connections_service.h", + "nearby_connections_manager_impl_test.cc", + ], + deps = [ + ":connection_types", + ":nearby_sharing_service", + ":types", + "//internal/flags:nearby_flags", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/common:enum", + "//sharing/flags/generated:generated_flags", + "//sharing/internal/public:types", + "//sharing/internal/test:nearby_test", + "//sharing/proto:enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/container:flat_hash_set", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:optional", + "@com_google_absl//absl/types:span", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_sharing_service_impl_test", + srcs = ["nearby_sharing_service_impl_test.cc"], + shard_count = 10, + deps = [ + ":attachments", + ":connection_types", + ":nearby_sharing_service", + ":share_session", + ":test_support", + ":transfer_metadata", + ":transfer_metadata_matchers", + ":types", + "//base:casts", + "//internal/analytics:mock_event_logger", + "//internal/flags:nearby_flags", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//internal/test:mocks", + "//sharing/analytics", + "//sharing/certificates", + "//sharing/certificates:test_support", + "//sharing/common", + "//sharing/common:compatible_u8_string", + "//sharing/common:enum", + "//sharing/contacts", + "//sharing/contacts:test_support", + "//sharing/fast_initiation:nearby_fast_initiation", + "//sharing/fast_initiation:test_support", + "//sharing/flags/generated:generated_flags", + "//sharing/internal/api:mock_sharing_platform", + "//sharing/internal/api:platform", + "//sharing/internal/public:types", + "//sharing/internal/test:nearby_test", + "//sharing/local_device_data", + "//sharing/local_device_data:test_support", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:share_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/memory", + "@com_google_absl//absl/status", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + "@com_google_googletest//:gtest_main", + "@com_google_protobuf//:protobuf_lite", + ], +) + +cc_test( + name = "nearby_connections_stream_buffer_manager_test", + srcs = ["nearby_connections_stream_buffer_manager_test.cc"], + deps = [ + ":nearby_sharing_service", + "//internal/platform/implementation/g3", # fixdeps: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_connections_types_test", + srcs = ["nearby_connections_types_test.cc"], + deps = [ + ":connection_types", + ":nearby_sharing_service", + ":types", + "//connections:core_types", + "//internal/platform/implementation/g3", # fixdeps: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_file_handler_test", + srcs = ["nearby_file_handler_test.cc"], + deps = [ + ":share_session", + "//internal/base:files", + "//internal/platform/implementation/g3", # fixdeps: keep + "//sharing/internal/api:mock_sharing_platform", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_share_profile_info_provider_impl_test", + srcs = ["nearby_share_profile_info_provider_impl_test.cc"], + deps = [ + ":nearby_sharing_service", + "//internal/platform/implementation:account_manager", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_sharing_service_extension_test", + srcs = ["nearby_sharing_service_extension_test.cc"], + deps = [ + ":attachments", + ":nearby_sharing_service", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/internal/test:nearby_test", + "//sharing/local_device_data:test_support", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_sharing_settings_test", + srcs = ["nearby_sharing_settings_test.cc"], + deps = [ + ":nearby_sharing_service", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/common", + "//sharing/common:compatible_u8_string", + "//sharing/common:enum", + "//sharing/internal/test:nearby_test", + "//sharing/local_device_data:test_support", + "//sharing/proto:enums_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_absl//absl/types:span", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "payload_tracker_test", + srcs = ["payload_tracker_test.cc"], + deps = [ + ":attachments", + ":connection_types", + ":share_session", + ":transfer_metadata", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/container:flat_hash_map", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "share_target_test", + srcs = ["share_target_test.cc"], + deps = [ + ":types", + "//internal/network:url", + "//sharing/common:enum", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "text_attachment_test", + srcs = ["text_attachment_test.cc"], + deps = [ + ":attachments", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "transfer_manager_test", + srcs = ["transfer_manager_test.cc"], + deps = [ + ":connection_types", + ":nearby_sharing_service", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/internal/test:nearby_test", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "transfer_metadata_test", + srcs = ["transfer_metadata_test.cc"], + deps = [ + ":transfer_metadata", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "share_session_test", + srcs = ["share_session_test.cc"], + deps = [ + ":paired_key_verification_runner", + ":share_session", + ":test_support", + ":transfer_metadata", + ":transfer_metadata_matchers", + ":types", + "//internal/analytics:mock_event_logger", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/analytics", + "//sharing/certificates:test_support", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "attachment_container_test", + srcs = ["attachment_container_test.cc"], + deps = [ + ":attachment_compare", + ":attachments", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "wrapped_share_target_discovered_callback_test", + srcs = ["wrapped_share_target_discovered_callback_test.cc"], + deps = [ + ":nearby_sharing_service", + ":types", + "//internal/platform/implementation/g3", # fixdeps: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "outgoing_share_session_test", + srcs = ["outgoing_share_session_test.cc"], + deps = [ + ":attachments", + ":connection_types", + ":paired_key_verification_runner", + ":share_session", + ":test_support", + ":transfer_metadata", + ":transfer_metadata_matchers", + ":types", + "//internal/analytics:mock_event_logger", + "//internal/network:url", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//sharing/analytics", + "//sharing/certificates:test_support", + "//sharing/common:enum", + "//sharing/proto:wire_format_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "incoming_share_session_test", + srcs = ["incoming_share_session_test.cc"], + deps = [ + ":attachment_compare", + ":attachments", + ":connection_types", + ":paired_key_verification_runner", + ":share_session", + ":test_support", + ":transfer_metadata", + ":transfer_metadata_matchers", + ":types", + "//internal/analytics:mock_event_logger", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "//proto:sharing_enums_cc_proto", + "//sharing/analytics", + "//sharing/internal/public:logging", + "//sharing/proto:wire_format_cc_proto", + "//sharing/proto/analytics:sharing_log_cc_proto", + "//third_party/protobuf", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "thread_timer_test", + srcs = ["thread_timer_test.cc"], + deps = [ + ":thread_timer", + "//internal/platform/implementation/g3", # fixdeps: keep + "//internal/test", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/synchronization", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + ], +) + +cc_test( + name = "nearby_connections_service_test", + srcs = ["nearby_connections_service_test.cc"], + deps = [ + ":connection_types", + ":nearby_sharing_service", + "//internal/platform:types", + "//internal/platform/implementation/g3", # fixdeps: keep + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/sharing/advertisement.cc b/sharing/advertisement.cc new file mode 100644 index 00000000..8bc20948 --- /dev/null +++ b/sharing/advertisement.cc @@ -0,0 +1,297 @@ +// Copyright 2022 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. + +#include "sharing/advertisement.h" + +#include + +#include +#include +#include +#include +#include + +#include "absl/types/span.h" +#include "sharing/common/nearby_share_enums.h" +#include "sharing/internal/public/logging.h" + +namespace nearby { +namespace sharing { +namespace { + +// v1 advertisements: +// - ParseVersion() --> 0 +// +// v2 advertisements: +// - ParseVersion() --> 1 +// - Backwards compatible; no changes in advertisement data--aside from the +// version number--or parsing logic compared to v1. +// - Only used by GmsCore at the moment. +constexpr int kMaxSupportedAdvertisementParsedVersionNumber = 1; + +// The bit mask for parsing and writing Version. +constexpr uint8_t kVersionBitmask = 0b111; + +// The bit mask for parsing and writing Visibility. +constexpr uint8_t kVisibilityBitmask = 0b1; + +// The bit mask for parsing and writing Device Type. +constexpr uint8_t kDeviceTypeBitmask = 0b111; + +// The minimum length of a TLV element. +// 1 byte for type and 1 byte for length, which can be 0. +constexpr uint8_t kTlvMinimumLength = 2; +// LINT.IfChange() +enum class TlvTypes : uint8_t { + kUnknown = 0, + kQrCode = 1, + kVendorId = 2, +}; +// The length in bytes of the vendor ID in the TLV advertisement. +constexpr uint8_t kVendorIdLength = 1; + +// Turns |vendor_id| into a supported vendor ID. +uint8_t ConvertVendorId(uint8_t vendor_id) { + switch (vendor_id) { + case 1: + return 1; + default: + return 0; + } +} +// LINT.ThenChange(//depot/google3/java/com/google/android/gmscore/integ/modules/nearby/src/com/google/android/gms/nearby/sharing/provider/connections/certificatemanager/Advertisement.java) + +const uint8_t kMinimumSize = + /* Version(3 bits)|Visibility(1 bit)|Device Type(3 bits)|Reserved(1 bits) */ + 1 + sharing::Advertisement::kSaltSize + + sharing::Advertisement::kMetadataEncryptionKeyHashByteSize; + +uint8_t ConvertVersion(int version) { + return static_cast((version & kVersionBitmask) << 5); +} + +uint8_t ConvertDeviceType(ShareTargetType type) { + return static_cast((static_cast(type) & kDeviceTypeBitmask) + << 1); +} + +uint8_t ConvertHasDeviceName(bool hasDeviceName) { + return static_cast((hasDeviceName ? 0 : 1) << 4); +} + +int ParseVersion(uint8_t b) { return (b >> 5) & kVersionBitmask; } + +// The values are in ShareTargetType. +bool IsKnownDeviceValue(int32_t value) { + switch (value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + return true; + default: + return false; + } +} + +ShareTargetType ParseDeviceType(uint8_t b) { + int32_t intermediate = static_cast(b >> 1 & kDeviceTypeBitmask); + if (IsKnownDeviceValue(intermediate)) { + return static_cast(intermediate); + } + + return ShareTargetType::kUnknown; +} + +bool ParseHasDeviceName(uint8_t b) { + return ((b >> 4) & kVisibilityBitmask) == 0; +} +} // namespace + +// static +std::unique_ptr Advertisement::NewInstance( + std::vector salt, std::vector encrypted_metadata_key, + ShareTargetType device_type, std::optional device_name, + uint8_t vendor_id) { + if (salt.size() != Advertisement::kSaltSize) { + NL_LOG(ERROR) << "Failed to create advertisement because the salt did " + "not match the expected length " + << salt.size(); + return nullptr; + } + + if (encrypted_metadata_key.size() != + Advertisement::kMetadataEncryptionKeyHashByteSize) { + NL_LOG(ERROR) << "Failed to create advertisement because the encrypted " + "metadata key did " + "not match the expected length " + << encrypted_metadata_key.size(); + return nullptr; + } + + if (device_name.has_value() && device_name->size() > UINT8_MAX) { + NL_LOG(ERROR) << "Failed to create advertisement because device name " + "was over UINT8_MAX: " + << device_name->size(); + return nullptr; + } + + // Using `new` to access a non-public constructor. + return std::make_unique( + /* version= */ 0, std::move(salt), std::move(encrypted_metadata_key), + device_type, std::move(device_name), vendor_id); +} + +std::vector Advertisement::ToEndpointInfo() const { + // We add 3 bytes for vendor ID because of type (1 byte), len (1 byte), and + // the ID itself (1 byte). + int size = kMinimumSize + (device_name_.has_value() ? 1 : 0) + + (device_name_.has_value() ? device_name_->size() : 0) + + (vendor_id_ != static_cast(BlockedVendorId::kNone) + ? (kTlvMinimumLength + kVendorIdLength) + : 0); + + std::vector endpoint_info; + endpoint_info.reserve(size); + endpoint_info.push_back( + static_cast(ConvertVersion(version_) | + ConvertHasDeviceName(device_name_.has_value()) | + ConvertDeviceType(device_type_))); + endpoint_info.insert(endpoint_info.end(), salt_.begin(), salt_.end()); + endpoint_info.insert(endpoint_info.end(), encrypted_metadata_key_.begin(), + encrypted_metadata_key_.end()); + + if (device_name_.has_value()) { + endpoint_info.push_back(static_cast(device_name_->size() & 0xff)); + endpoint_info.insert(endpoint_info.end(), device_name_->begin(), + device_name_->end()); + } + + // Add vendor ID if it is not the default |VendorId::kNone|. + if (vendor_id_ != static_cast(BlockedVendorId::kNone)) { + // Add vendor ID in TLV format. + endpoint_info.push_back(static_cast(TlvTypes::kVendorId)); + // Length is 1 byte. + endpoint_info.push_back(kVendorIdLength); + // The vendor ID itself. + endpoint_info.push_back(vendor_id_); + } + + return endpoint_info; +} + +std::unique_ptr Advertisement::FromEndpointInfo( + absl::Span endpoint_info) { + if (endpoint_info.size() < kMinimumSize) { + NL_LOG(ERROR) << "Failed to parse advertisement because it was too short."; + return nullptr; + } + + auto iter = endpoint_info.begin(); + uint8_t first_byte = *iter++; + + int version = ParseVersion(first_byte); + if (version < 0 || version > kMaxSupportedAdvertisementParsedVersionNumber) { + NL_LOG(ERROR) + << "Failed to parse advertisement; unsupported version number " + << version; + return nullptr; + } + + bool has_device_name = ParseHasDeviceName(first_byte); + ShareTargetType device_type = ParseDeviceType(first_byte); + + std::vector salt(iter, iter + Advertisement::kSaltSize); + iter += Advertisement::kSaltSize; + + std::vector encrypted_metadata_key( + iter, iter + Advertisement::kMetadataEncryptionKeyHashByteSize); + iter += Advertisement::kMetadataEncryptionKeyHashByteSize; + + std::optional optional_device_name; + if (has_device_name) { + int device_name_length = 0; + if (iter != endpoint_info.end()) device_name_length = *iter++ & 0xff; + + if (device_name_length == 0 || + (endpoint_info.end() - iter < device_name_length)) { + NL_LOG(ERROR) + << "Failed to parse advertisement because the device name did " + "not match the expected length " + << device_name_length; + return nullptr; + } + + optional_device_name = std::string(iter, iter + device_name_length); + iter += device_name_length; + } + + uint8_t vendor_id = static_cast(BlockedVendorId::kNone); + while (endpoint_info.end() - iter >= kTlvMinimumLength) { + // We will parse a TLV element now. + TlvTypes type = static_cast(*iter++); + uint8_t value_len = *iter++; + if (endpoint_info.end() - iter < value_len) { + NL_LOG(ERROR) << "Invalid length when parsing TLV element: " << value_len; + return nullptr; + } + switch (type) { + case TlvTypes::kVendorId: + if (value_len != kVendorIdLength) { + NL_LOG(ERROR) << "Invalid vendor_id_len: " << value_len; + return nullptr; + } + vendor_id = ConvertVendorId(*iter++); + break; + case TlvTypes::kQrCode: + NL_LOG(INFO) << "Found QR code data, skipping."; + // TODO: b/341984671 - Implement handling for this TLV type. + iter += value_len; + break; + default: + NL_LOG(ERROR) << "Unknown TLV type: " << static_cast(type); + iter += value_len; + break; + } + } + + return Advertisement::NewInstance( + std::move(salt), std::move(encrypted_metadata_key), device_type, + std::move(optional_device_name), vendor_id); +} + +bool Advertisement::operator==(const Advertisement& other) const { + return version_ == other.version_ && salt_ == other.salt_ && + encrypted_metadata_key_ == other.encrypted_metadata_key_ && + device_type_ == other.device_type_ && + device_name_ == other.device_name_ && vendor_id_ == other.vendor_id_; +} + +// private +Advertisement::Advertisement(int version, std::vector salt, + std::vector encrypted_metadata_key, + ShareTargetType device_type, + std::optional device_name, + uint8_t vendor_id) + : version_(version), + salt_(std::move(salt)), + encrypted_metadata_key_(std::move(encrypted_metadata_key)), + device_type_(device_type), + device_name_(std::move(device_name)), + vendor_id_(vendor_id) {} + +} // namespace sharing +} // namespace nearby diff --git a/sharing/advertisement.h b/sharing/advertisement.h new file mode 100644 index 00000000..3ea3dcf6 --- /dev/null +++ b/sharing/advertisement.h @@ -0,0 +1,109 @@ +// Copyright 2022 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_SHARING_ADVERTISEMENT_H_ +#define THIRD_PARTY_NEARBY_SHARING_ADVERTISEMENT_H_ + +#include + +#include +#include +#include +#include + +#include "absl/types/span.h" +#include "sharing/common/nearby_share_enums.h" + +namespace nearby { +namespace sharing { + +// An advertisement in the form of +// [VERSION|VISIBILITY][SALT][ACCOUNT_IDENTIFIER][LEN][DEVICE_NAME]. +// A device name indicates the advertisement is visible to everyone; +// a missing device name indicates the advertisement is contacts-only. +class Advertisement { + public: + static constexpr uint8_t kSaltSize = 2; + static constexpr uint8_t kMetadataEncryptionKeyHashByteSize = 14; + // LINT.IfChange() + // Lists supported vendors for target blocking. + enum class BlockedVendorId : uint8_t { + kNone = 0, + kSamsung = 1, + }; + // LINT.ThenChange(//depot/google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/sharing/SharingOptions.java:VendorId) + + static std::unique_ptr NewInstance( + std::vector salt, std::vector encrypted_metadata_key, + ShareTargetType device_type, std::optional device_name, + uint8_t vendor_id); + + // TODO: b/341967036 - Remove uses of std::optional for device name. Empty + // string should be enough. + Advertisement(int version, std::vector salt, + std::vector encrypted_metadata_key, + ShareTargetType device_type, + std::optional device_name, uint8_t vendor_id); + ~Advertisement() = default; + Advertisement(const Advertisement&) = default; + Advertisement& operator=(const Advertisement&) = default; + Advertisement(Advertisement&&) = default; + Advertisement& operator=(Advertisement&&) = default; + bool operator==(const Advertisement& other) const; + + std::vector ToEndpointInfo() const; + + int version() const { return version_; } + const std::vector& salt() const { return salt_; } + const std::vector& encrypted_metadata_key() const { + return encrypted_metadata_key_; + } + ShareTargetType device_type() const { return device_type_; } + const std::optional& device_name() const { return device_name_; } + bool HasDeviceName() const { return device_name_.has_value(); } + uint8_t vendor_id() const { return vendor_id_; } + + static std::unique_ptr FromEndpointInfo( + absl::Span endpoint_info); + + private: + // The version of the advertisement. Different versions can have different + // ways of parsing the endpoint id. + int version_; + + // Random bytes that were used as salt during encryption of public certificate + // metadata. + std::vector salt_ = {}; + + // An encrypted symmetric key that was used to encrypt public certificate + // metadata, including an account identifier signifying the remote device. + // The key can be decrypted using |salt| and the corresponding public + // certificate's secret/authenticity key. + std::vector encrypted_metadata_key_ = {}; + + // The type of device that the advertisement identifies. + ShareTargetType device_type_ = ShareTargetType::kUnknown; + + // The human-readable name of the remote device. + std::optional device_name_ = std::nullopt; + + // The vendor identifier of the remote device. Reference for vendor ID: + // google3/java/com/google/android/gmscore/integ/client/nearby/src/com/google/android/gms/nearby/sharing/SharingOptions.java + const uint8_t vendor_id_; +}; + +} // namespace sharing +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_SHARING_ADVERTISEMENT_H_ diff --git a/sharing/advertisement_test.cc b/sharing/advertisement_test.cc new file mode 100644 index 00000000..ff286518 --- /dev/null +++ b/sharing/advertisement_test.cc @@ -0,0 +1,155 @@ +// Copyright 2024 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. + +#include "sharing/advertisement.h" + +#include +#include +#include +#include + +#include "gtest/gtest.h" +#include "absl/types/span.h" +#include "sharing/common/nearby_share_enums.h" + +namespace nearby { +namespace sharing { +namespace { + +constexpr uint8_t kQrCodeTlvData[]{ + 0x01, // QrCode TLV type. + 0x0f, // QrCode data length. + 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, + 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, // QR Code data. +}; + +constexpr absl::Span kQrCodeTlvBytes = + absl::MakeConstSpan(kQrCodeTlvData); + +struct TestParameters { + std::vector salt; + std::vector encrypted_metadata_key; + ShareTargetType target_type; + std::optional target_name; + int vendor_id; +}; + +class AdvertisementTest : public testing::TestWithParam {}; + +TEST_P(AdvertisementTest, TestAdvertisementRoundTrip) { + auto params = GetParam(); + auto advertisement = Advertisement::NewInstance( + params.salt, params.encrypted_metadata_key, params.target_type, + params.target_name, params.vendor_id); + auto bytes = advertisement->ToEndpointInfo(); + auto advertisement_from_bytes = Advertisement::FromEndpointInfo(bytes); + EXPECT_EQ(*advertisement_from_bytes, *advertisement); +} + +TEST(BadAdvertisementTest, TestTlvParsingOnAdvertisement) { + auto advertisement = Advertisement::NewInstance( + std::vector(Advertisement::kSaltSize), + std::vector(Advertisement::kMetadataEncryptionKeyHashByteSize), + ShareTargetType::kLaptop, std::nullopt, /*vendor_id=*/1); + auto bytes = advertisement->ToEndpointInfo(); + // Add a TLV field for QR code. + bytes.insert(bytes.end(), kQrCodeTlvBytes.begin(), kQrCodeTlvBytes.end()); + auto advertisement_from_bytes = Advertisement::FromEndpointInfo(bytes); + EXPECT_EQ(*advertisement_from_bytes, *advertisement); +} + +INSTANTIATE_TEST_SUITE_P( + ShareTargetTypes, AdvertisementTest, + testing::Values( + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kLaptop, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kPhone, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kTablet, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kCar, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kFoldable, + .target_name = std::nullopt, + .vendor_id = 0})); +INSTANTIATE_TEST_SUITE_P( + VendorIds, AdvertisementTest, + testing::Values( + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kPhone, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kPhone, + .target_name = std::nullopt, + .vendor_id = 1})); +INSTANTIATE_TEST_SUITE_P( + TargetNames, AdvertisementTest, + testing::Values( + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kPhone, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kPhone, + .target_name = "Test device", + .vendor_id = 0})); + +INSTANTIATE_TEST_SUITE_P( + SaltAndKeyCombo, AdvertisementTest, + testing::Values( + TestParameters{.salt = std::vector(Advertisement::kSaltSize), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize), + .target_type = ShareTargetType::kLaptop, + .target_name = std::nullopt, + .vendor_id = 0}, + TestParameters{ + .salt = std::vector(Advertisement::kSaltSize, 255), + .encrypted_metadata_key = std::vector( + Advertisement::kMetadataEncryptionKeyHashByteSize, 255), + .target_type = ShareTargetType::kLaptop, + .target_name = std::nullopt, + .vendor_id = 0})); + +} // namespace +} // namespace sharing +} // namespace nearby diff --git a/sharing/analytics/BUILD b/sharing/analytics/BUILD new file mode 100644 index 00000000..467999a1 --- /dev/null +++ b/sharing/analytics/BUILD @@ -0,0 +1,64 @@ +# Copyright 2024 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. + +licenses(["notice"]) + +cc_library( + name = "analytics", + srcs = [ + "analytics_recorder.cc", + ], + hdrs = [ + "analytics_device_settings.h", + "analytics_information.h", + "analytics_recorder.h", + ], + visibility = ["//visibility:public"], + deps = [ + "//internal/analytics:event_logger", + "//proto:sharing_enums_cc_proto", + "//sharing:attachments", + "//sharing:types", + "//sharing/common:enum", + "//sharing/proto:enums_cc_proto", + "//sharing/proto/analytics:sharing_log_cc_proto", + "@com_google_absl//absl/random", + "@com_google_absl//absl/strings:string_view", + "@com_google_absl//absl/time", + "@com_google_protobuf//:protobuf", + "@com_google_protobuf//:protobuf_lite", + ], +) + +cc_test( + name = "analytics_test", + srcs = ["analytics_recorder_test.cc"], + deps = [ + ":analytics", + "//internal/analytics:mock_event_logger", + "//internal/platform/implementation/g3", # fixdeps: keep + "//proto:sharing_enums_cc_proto", + "//sharing:attachments", + "//sharing:types", + "//sharing/common:enum", + "//sharing/proto:enums_cc_proto", + "//sharing/proto:wire_format_cc_proto", + "//sharing/proto/analytics:sharing_log_cc_proto", + "@com_github_protobuf_matchers//protobuf-matchers", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/time", + "@com_google_googletest//:gtest_main", + "@com_google_protobuf//:protobuf", + ], +) diff --git a/connections/c/input_stream_w.h b/sharing/analytics/analytics_device_settings.h similarity index 50% rename from connections/c/input_stream_w.h rename to sharing/analytics/analytics_device_settings.h index 94c78a30..60fbd3da 100644 --- a/connections/c/input_stream_w.h +++ b/sharing/analytics/analytics_device_settings.h @@ -11,37 +11,26 @@ // 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_C_INPUT_STREAM_W_H_ -#define THIRD_PARTY_NEARBY_CONNECTIONS_C_INPUT_STREAM_W_H_ -#include +#ifndef THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_DEVICE_SETTINGS_H_ +#define THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_DEVICE_SETTINGS_H_ + +#include "sharing/common/nearby_share_enums.h" +#include "sharing/proto/enums.pb.h" namespace nearby { +namespace sharing { +namespace analytics { -class InputStream; -struct InputStreamDeleter { - void operator()(InputStream* p); -}; -} // namespace nearby - -namespace nearby { -namespace windows { - -class InputStreamW { - public: - char* Read(size_t size); - - // throws Exception::kIo - int64_t Skip(size_t offset); - - // throws Exception::kIo - int64_t Close(); - - private: - std::unique_ptr impl_; +struct AnalyticsDeviceSettings { + bool is_fast_init_notification_enabled; + int device_name_size; + ::nearby::sharing::proto::DataUsage data_usage; + ::nearby::sharing::proto::DeviceVisibility visibility; }; -} // namespace windows +} // namespace analytics +} // namespace sharing } // namespace nearby -#endif // THIRD_PARTY_NEARBY_CONNECTIONS_C_INPUT_STREAM_W_H_ +#endif // THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_DEVICE_SETTINGS_H_ diff --git a/sharing/analytics/analytics_information.h b/sharing/analytics/analytics_information.h new file mode 100644 index 00000000..00a24d65 --- /dev/null +++ b/sharing/analytics/analytics_information.h @@ -0,0 +1,47 @@ +// Copyright 2022 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_SHARING_ANALYTICS_ANALYTICS_INFORMATION_H_ +#define THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_INFORMATION_H_ + +namespace nearby { +namespace sharing { +namespace analytics { + +enum class SendSurfaceState : int { + // Default, invalid state. + kUnknown = -1, + // Background share sheet only listens to transfer update. + kBackground = 0, + // Foreground share sheet both scans and listens to transfer update. + kForeground = 1, + // Direct share service only scans and listens to share target onFound and + // onLost. + kDirectShareService = 2, + // Foreground share sheet both scans and listens to transfer update, but does + // not trigger FastInit HUN. + kForegroundRetry = 3, + // A foreground surface that is registered from 2nd and 3rd party apps. + kExternal = 4, +}; + +struct AnalyticsInformation { + SendSurfaceState send_surface_state; +}; + +} // namespace analytics +} // namespace sharing +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_INFORMATION_H_ diff --git a/sharing/analytics/analytics_recorder.cc b/sharing/analytics/analytics_recorder.cc new file mode 100644 index 00000000..c689354a --- /dev/null +++ b/sharing/analytics/analytics_recorder.cc @@ -0,0 +1,873 @@ +// Copyright 2022-2023 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. + +#include "sharing/analytics/analytics_recorder.h" + +#include +#include +#include +#include + +#include "google/protobuf/duration.pb.h" +#include "absl/random/random.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "proto/sharing_enums.pb.h" +#include "sharing/analytics/analytics_device_settings.h" +#include "sharing/analytics/analytics_information.h" +#include "sharing/attachment.h" +#include "sharing/attachment_container.h" +#include "sharing/common/nearby_share_enums.h" +#include "sharing/file_attachment.h" +#include "sharing/proto/analytics/nearby_sharing_log.pb.h" +#include "sharing/proto/enums.pb.h" +#include "sharing/share_target.h" +#include "sharing/wifi_credentials_attachment.h" +#include "google/protobuf/repeated_ptr_field.h" + +namespace nearby { +namespace sharing { +namespace analytics { +namespace { + +using ::location::nearby::proto::sharing::AttachmentSourceType; +using ::location::nearby::proto::sharing::DeviceRelationship; +using ::location::nearby::proto::sharing::DeviceType; +using ::location::nearby::proto::sharing::EstablishConnectionStatus; +using ::location::nearby::proto::sharing::EventCategory; +using ::location::nearby::proto::sharing::EventType; +using ::location::nearby::proto::sharing::OSType; +using ::location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus; +using ::location::nearby::proto::sharing::ShowNotificationStatus; +using ::location::nearby::proto::sharing::Visibility; + +using ::nearby::sharing::analytics::proto::SharingLog; +using ::nearby::sharing::proto::DataUsage; +using ::nearby::sharing::proto::DeviceVisibility; + +DeviceRelationship GetLoggerDeviceRelationship( + const ShareTarget& share_target) { + if (share_target.for_self_share) { + return DeviceRelationship::IS_SELF; + } else if (share_target.is_known) { + return DeviceRelationship::IS_CONTACT; + } else { + return DeviceRelationship::IS_STRANGER; + } +} + +DeviceType GetLoggerDeviceType(ShareTargetType type) { + switch (type) { + case ShareTargetType::kLaptop: + return DeviceType::LAPTOP; + case ShareTargetType::kPhone: + return DeviceType::PHONE; + case ShareTargetType::kTablet: + return DeviceType::TABLET; + default: + return DeviceType::UNKNOWN_DEVICE_TYPE; + } +} + +Visibility GetLoggerVisibility(DeviceVisibility visibility) { + switch (visibility) { + case DeviceVisibility::DEVICE_VISIBILITY_ALL_CONTACTS: + return Visibility::CONTACTS_ONLY; + case DeviceVisibility::DEVICE_VISIBILITY_SELECTED_CONTACTS: + return Visibility::SELECTED_CONTACTS_ONLY; + case DeviceVisibility::DEVICE_VISIBILITY_EVERYONE: + return Visibility::EVERYONE; + case DeviceVisibility::DEVICE_VISIBILITY_SELF_SHARE: + return Visibility::SELF_SHARE; + case DeviceVisibility::DEVICE_VISIBILITY_HIDDEN: + return Visibility::HIDDEN; + case DeviceVisibility::DEVICE_VISIBILITY_UNSPECIFIED: + default: + return Visibility::UNKNOWN_VISIBILITY; + } +} + +location::nearby::proto::sharing::DataUsage GetLoggerDataUsage( + DataUsage data_usage) { + switch (data_usage) { + case DataUsage::OFFLINE_DATA_USAGE: + return location::nearby::proto::sharing::DataUsage::OFFLINE; + case DataUsage::ONLINE_DATA_USAGE: + return location::nearby::proto::sharing::DataUsage::ONLINE; + case DataUsage::WIFI_ONLY_DATA_USAGE: + return location::nearby::proto::sharing::DataUsage::WIFI_ONLY; + default: + return location::nearby::proto::sharing::DataUsage::UNKNOWN_DATA_USAGE; + } +} + +AttachmentSourceType GetLoggerAttachmentSourceType( + Attachment::SourceType source_type) { + switch (source_type) { + case Attachment::SourceType::kContextMenu: + return AttachmentSourceType::ATTACHMENT_SOURCE_CONTEXT_MENU; + case Attachment::SourceType::kDragAndDrop: + return AttachmentSourceType::ATTACHMENT_SOURCE_DRAG_AND_DROP; + case Attachment::SourceType::kSelectFilesButton: + return AttachmentSourceType::ATTACHMENT_SOURCE_SELECT_FILES_BUTTON; + case Attachment::SourceType::kPaste: + return AttachmentSourceType::ATTACHMENT_SOURCE_PASTE; + case Attachment::SourceType::kSelectFoldersButton: + return AttachmentSourceType::ATTACHMENT_SOURCE_SELECT_FOLDERS_BUTTON; + default: + return AttachmentSourceType::ATTACHMENT_SOURCE_UNKNOWN; + } +} + +void SetShareTargetInfo(SharingLog::ShareTargetInfo* share_target_info, + ShareTargetType device_type, + DeviceRelationship relationship, + OSType os_type = OSType::UNKNOWN_OS_TYPE) { + share_target_info->set_device_relationship(relationship); + share_target_info->set_device_type(GetLoggerDeviceType(device_type)); + if (os_type == OSType::UNKNOWN_OS_TYPE && + device_type == ShareTargetType::kPhone) { + // If the device type is phone, just set the OS type to android because + // no other phone OS for now. + share_target_info->set_os_type(OSType::ANDROID); + } else { + share_target_info->set_os_type(os_type); + } +} + +void SetShareTargetInfo(SharingLog::ShareTargetInfo* share_target_info, + const ShareTarget& share_target, + OSType os_type = OSType::UNKNOWN_OS_TYPE) { + share_target_info->set_device_relationship( + GetLoggerDeviceRelationship(share_target)); + share_target_info->set_device_type(GetLoggerDeviceType(share_target.type)); + if (os_type == OSType::UNKNOWN_OS_TYPE && + share_target.type == ShareTargetType::kPhone) { + // If the device type is phone, just set the OS type to android because + // no other phone OS for now. + share_target_info->set_os_type(OSType::ANDROID); + } else { + share_target_info->set_os_type(os_type); + } +} + +void SetAttachmentInfo(SharingLog::AttachmentsInfo* attachments_info, + const AttachmentContainer& attachments) { + for (const auto& attachment : attachments.GetTextAttachments()) { + SharingLog::TextAttachment::Type type = + SharingLog::TextAttachment::UNKNOWN_TEXT_TYPE; + switch (attachment.GetShareType()) { + case ShareType::kPhone: + type = SharingLog::TextAttachment::PHONE_NUMBER; + break; + case ShareType::kUrl: + type = SharingLog::TextAttachment::URL; + break; + case ShareType::kAddress: + type = SharingLog::TextAttachment::ADDRESS; + break; + case ShareType::kText: + // Apply UNKNOWN_TEXT_TYPE for it based on analytics design. + break; + default: + break; + } + SharingLog::TextAttachment* text_attachment = + attachments_info->mutable_text_attachment()->Add(); + text_attachment->set_type(type); + text_attachment->set_size_bytes(attachment.size()); + text_attachment->set_source_type( + GetLoggerAttachmentSourceType(attachment.source_type())); + text_attachment->set_batch_id(attachment.batch_id()); + } + + for (const auto& attachment : attachments.GetFileAttachments()) { + SharingLog::FileAttachment::Type type = + SharingLog::FileAttachment::UNKNOWN_FILE_TYPE; + switch (attachment.GetShareType()) { + case ShareType::kImageFile: + type = SharingLog::FileAttachment::IMAGE; + break; + case ShareType::kVideoFile: + type = SharingLog::FileAttachment::VIDEO; + break; + case ShareType::kAudioFile: + type = SharingLog::FileAttachment::AUDIO; + break; + case ShareType::kPdfFile: + case ShareType::kTextFile: + case ShareType::kGoogleDocsFile: + case ShareType::kGoogleSheetsFile: + case ShareType::kGoogleSlidesFile: + type = SharingLog::FileAttachment::DOCUMENT; + break; + case ShareType::kUnknownFile: + // The default type is set to type. + break; + default: + break; + } + SharingLog::FileAttachment* file_attachment = + attachments_info->mutable_file_attachment()->Add(); + file_attachment->set_type(type); + file_attachment->set_size_bytes(attachment.size()); + file_attachment->set_offset_bytes(0); + file_attachment->set_source_type( + GetLoggerAttachmentSourceType(attachment.source_type())); + file_attachment->set_batch_id(attachment.batch_id()); + } + + for (const auto& attachment : attachments.GetWifiCredentialsAttachments()) { + SharingLog::WifiCredentialsAttachment* wifi_credentials_attachment = + attachments_info->mutable_wifi_credentials_attachment()->Add(); + wifi_credentials_attachment->set_source_type( + GetLoggerAttachmentSourceType(attachment.source_type())); + wifi_credentials_attachment->set_batch_id(attachment.batch_id()); + } +} + +} // namespace + +void AnalyticsRecorder::NewEstablishConnection( + int64_t session_id, EstablishConnectionStatus connection_status, + const ShareTarget& share_target, int transfer_position, + int concurrent_connections, int64_t duration_millis, + std::optional referrer_package) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::ESTABLISH_CONNECTION); + + auto* establish_connection = sharing_log->mutable_establish_connection(); + + establish_connection->set_session_id(session_id); + establish_connection->set_status(connection_status); + SetShareTargetInfo(establish_connection->mutable_share_target_info(), + share_target); + establish_connection->set_transfer_position(transfer_position); + establish_connection->set_concurrent_connections(concurrent_connections); + establish_connection->set_duration_millis(duration_millis); + if (referrer_package.has_value()) { + establish_connection->set_referrer_name(*referrer_package); + } + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewAcceptAgreements() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::ACCEPT_AGREEMENTS); + + sharing_log->mutable_accept_agreements(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewDeclineAgreements() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::DECLINE_AGREEMENTS); + + sharing_log->mutable_decline_agreements(); + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewAddContact() { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::SETTINGS_EVENT, EventType::ADD_CONTACT); + + sharing_log->mutable_add_contact(); + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewRemoveContact() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::REMOVE_CONTACT); + + sharing_log->mutable_remove_contact(); + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewTapFeedback() { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::SETTINGS_EVENT, EventType::TAP_FEEDBACK); + + sharing_log->mutable_tap_feedback(); + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewTapHelp() { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::SETTINGS_EVENT, EventType::TAP_HELP); + + sharing_log->mutable_tap_help(); + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewLaunchDeviceContactConsent( + ::location::nearby::proto::sharing::ConsentAcceptanceStatus status) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::LAUNCH_CONSENT); + + auto* launch_consent = sharing_log->mutable_launch_consent(); + launch_consent->set_status(status); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewAdvertiseDevicePresenceEnd(int64_t session_id) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::ADVERTISE_DEVICE_PRESENCE_END); + + auto* advertise_device_presence_end = + sharing_log->mutable_advertise_device_presence_end(); + advertise_device_presence_end->set_session_id(session_id); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewAdvertiseDevicePresenceStart( + int64_t session_id, DeviceVisibility visibility, + ::location::nearby::proto::sharing::SessionStatus status, + DataUsage data_usage, std::optional referrer_package) { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::RECEIVING_EVENT, + EventType::ADVERTISE_DEVICE_PRESENCE_START); + + auto* advertise_device_presence_start = + sharing_log->mutable_advertise_device_presence_start(); + advertise_device_presence_start->set_session_id(session_id); + advertise_device_presence_start->set_visibility( + GetLoggerVisibility(visibility)); + advertise_device_presence_start->set_status(status); + advertise_device_presence_start->set_data_usage( + GetLoggerDataUsage(data_usage)); + if (referrer_package.has_value()) { + advertise_device_presence_start->set_referrer_name(*referrer_package); + } + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewDescribeAttachments( + const AttachmentContainer& attachments) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::DESCRIBE_ATTACHMENTS); + + auto* describe_attachments = sharing_log->mutable_describe_attachments(); + SetAttachmentInfo(describe_attachments->mutable_attachments_info(), + attachments); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewDiscoverShareTarget( + const ShareTarget& share_target, int64_t session_id, + int64_t latency_since_scanning_start_millis, int64_t flow_id, + std::optional referrer_package, + int64_t latency_since_send_surface_registered_millis) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::DISCOVER_SHARE_TARGET); + + auto* discover_share_target = sharing_log->mutable_discover_share_target(); + discover_share_target->set_session_id(session_id); + auto* duration = discover_share_target->mutable_duration_since_scanning(); + duration->set_seconds(latency_since_scanning_start_millis / 1000); + duration->set_nanos((latency_since_scanning_start_millis % 1000) * 1000000); + SetShareTargetInfo(discover_share_target->mutable_share_target_info(), + share_target); + discover_share_target->set_session_id(session_id); + discover_share_target->set_flow_id(flow_id); + + discover_share_target->set_latency_since_activity_start_millis( + latency_since_send_surface_registered_millis > 0 + ? latency_since_send_surface_registered_millis + : -1); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewEnableNearbySharing( + ::location::nearby::proto::sharing::NearbySharingStatus status) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::ENABLE_NEARBY_SHARING); + + auto* enable_nearby_sharing = sharing_log->mutable_enable_nearby_sharing(); + enable_nearby_sharing->set_status(status); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewOpenReceivedAttachments( + const AttachmentContainer& attachments, int64_t session_id) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::OPEN_RECEIVED_ATTACHMENTS); + + auto* open_received_attachments = + sharing_log->mutable_open_received_attachments(); + SetAttachmentInfo(open_received_attachments->mutable_attachments_info(), + attachments); + open_received_attachments->set_session_id(session_id); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewProcessReceivedAttachmentsEnd( + int64_t session_id, ProcessReceivedAttachmentsStatus status) { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::RECEIVING_EVENT, + EventType::PROCESS_RECEIVED_ATTACHMENTS_END); + + auto* process_received_attachments_end = + sharing_log->mutable_process_received_attachments_end(); + process_received_attachments_end->set_status(status); + process_received_attachments_end->set_session_id(session_id); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewReceiveAttachmentsEnd( + int64_t session_id, int64_t received_bytes, + ::location::nearby::proto::sharing::AttachmentTransmissionStatus status, + std::optional referrer_package) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::RECEIVE_ATTACHMENTS_END); + + auto* receive_attachments_end = + sharing_log->mutable_receive_attachments_end(); + receive_attachments_end->set_session_id(session_id); + receive_attachments_end->set_received_bytes(received_bytes); + receive_attachments_end->set_status(status); + if (referrer_package.has_value()) { + receive_attachments_end->set_referrer_name(*referrer_package); + } + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewReceiveAttachmentsStart( + int64_t session_id, const AttachmentContainer& attachments) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::RECEIVE_ATTACHMENTS_START); + + auto* receive_attachments_start = + sharing_log->mutable_receive_attachments_start(); + SetAttachmentInfo(receive_attachments_start->mutable_attachments_info(), + attachments); + receive_attachments_start->set_session_id(session_id); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewReceiveFastInitialization( + int64_t timeElapseSinceScreenUnlockMillis) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::RECEIVE_FAST_INITIALIZATION); + + auto* receive_fast_initialization = + sharing_log->mutable_receive_initialization(); + + receive_fast_initialization->set_time_elapse_since_screen_unlock_millis( + timeElapseSinceScreenUnlockMillis); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewAcceptFastInitialization() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::ACCEPT_FAST_INITIALIZATION); + + sharing_log->mutable_accept_fast_initialization(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewDismissFastInitialization() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::DISMISS_FAST_INITIALIZATION); + + sharing_log->mutable_dismiss_fast_initialization(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewReceiveIntroduction( + int64_t session_id, const ShareTarget& share_target, + std::optional referrer_package, + ::location::nearby::proto::sharing::OSType share_target_os_type) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::RECEIVE_INTRODUCTION); + + auto* receive_introduction = sharing_log->mutable_receive_introduction(); + receive_introduction->set_session_id(session_id); + SetShareTargetInfo(receive_introduction->mutable_share_target_info(), + share_target, share_target_os_type); + if (referrer_package.has_value()) { + receive_introduction->set_referrer_name(*referrer_package); + } + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewRespondToIntroduction( + ::location::nearby::proto::sharing::ResponseToIntroduction action, + int64_t session_id) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::RESPOND_TO_INTRODUCTION); + + auto* respond_to_introduction = sharing_log->mutable_respond_introduction(); + respond_to_introduction->set_session_id(session_id); + respond_to_introduction->set_action(action); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewTapPrivacyNotification() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::TAP_PRIVACY_NOTIFICATION); + + sharing_log->mutable_tap_privacy_notification(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewDismissPrivacyNotification() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::RECEIVING_EVENT, EventType::DISMISS_PRIVACY_NOTIFICATION); + + sharing_log->mutable_dismiss_privacy_notification(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewScanForShareTargetsEnd(int64_t session_id) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SCAN_FOR_SHARE_TARGETS_END); + + auto* scan_for_share_targets_end = + sharing_log->mutable_scan_for_share_targets_end(); + scan_for_share_targets_end->set_session_id(session_id); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewScanForShareTargetsStart( + int64_t session_id, + ::location::nearby::proto::sharing::SessionStatus status, + AnalyticsInformation analytics_information, int64_t flow_id, + std::optional referrer_package) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SCAN_FOR_SHARE_TARGETS_START); + + auto* scan_for_share_targets_start = + sharing_log->mutable_scan_for_share_targets_start(); + scan_for_share_targets_start->set_session_id(session_id); + scan_for_share_targets_start->set_status(status); + scan_for_share_targets_start->set_scan_type( + static_cast<::location::nearby::proto::sharing::ScanType>( + analytics_information.send_surface_state)); + scan_for_share_targets_start->set_flow_id(flow_id); + if (referrer_package.has_value()) { + scan_for_share_targets_start->set_referrer_name(*referrer_package); + } + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSendAttachmentsEnd( + int64_t session_id, int64_t sent_bytes, const ShareTarget& share_target, + ::location::nearby::proto::sharing::AttachmentTransmissionStatus status, + int transfer_position, int concurrent_connections, int64_t duration_millis, + std::optional referrer_package, + ::location::nearby::proto::sharing::ConnectionLayerStatus + connection_layer_status, + ::location::nearby::proto::sharing::OSType share_target_os_type) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SEND_ATTACHMENTS_END); + + auto* send_attachments_end = sharing_log->mutable_send_attachments_end(); + send_attachments_end->set_session_id(session_id); + send_attachments_end->set_sent_bytes(sent_bytes); + SetShareTargetInfo(send_attachments_end->mutable_share_target_info(), + share_target, share_target_os_type); + send_attachments_end->set_status(status); + send_attachments_end->set_transfer_position(transfer_position); + send_attachments_end->set_concurrent_connections(concurrent_connections); + send_attachments_end->set_duration_millis(duration_millis); + if (referrer_package.has_value()) { + send_attachments_end->set_referrer_name(*referrer_package); + } + send_attachments_end->set_connection_layer_status(connection_layer_status); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSendAttachmentsStart( + int64_t session_id, const AttachmentContainer& attachments, + int transfer_position, int concurrent_connections) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SEND_ATTACHMENTS_START); + + auto* send_attachments_start = sharing_log->mutable_send_attachments_start(); + send_attachments_start->set_session_id(session_id); + SetAttachmentInfo(send_attachments_start->mutable_attachments_info(), + attachments); + send_attachments_start->set_transfer_position(transfer_position); + send_attachments_start->set_concurrent_connections(concurrent_connections); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSendFastInitialization() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SEND_FAST_INITIALIZATION); + + sharing_log->mutable_send_initialization(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSendStart(int64_t session_id, int transfer_position, + int concurrent_connections, + const ShareTarget& share_target) { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::SENDING_EVENT, EventType::SEND_START); + + auto* send_start = sharing_log->mutable_send_start(); + send_start->set_session_id(session_id); + send_start->set_transfer_position(transfer_position); + send_start->set_concurrent_connections(concurrent_connections); + SetShareTargetInfo(send_start->mutable_share_target_info(), share_target); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSendIntroduction( + ShareTargetType target_type, int64_t session_id, + DeviceRelationship relationship, + ::location::nearby::proto::sharing::OSType share_target_os_type) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SEND_INTRODUCTION); + auto* send_introduction = sharing_log->mutable_send_introduction(); + SetShareTargetInfo(send_introduction->mutable_share_target_info(), + target_type, relationship, share_target_os_type); + send_introduction->set_session_id(session_id); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSendIntroduction( + int64_t session_id, const ShareTarget& share_target, int transfer_position, + int concurrent_connections, + ::location::nearby::proto::sharing::OSType share_target_os_type) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SENDING_EVENT, EventType::SEND_INTRODUCTION); + + auto* send_introduction = sharing_log->mutable_send_introduction(); + SetShareTargetInfo(send_introduction->mutable_share_target_info(), + share_target, share_target_os_type); + send_introduction->set_session_id(session_id); + send_introduction->set_transfer_position(transfer_position); + send_introduction->set_concurrent_connections(concurrent_connections); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSetVisibility(DeviceVisibility src_visibility, + DeviceVisibility dst_visibility, + int64_t duration_millis) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::SET_VISIBILITY); + + auto* set_visibility = sharing_log->mutable_set_visibility(); + set_visibility->set_visibility(GetLoggerVisibility(dst_visibility)); + set_visibility->set_source_visibility(GetLoggerVisibility(src_visibility)); + set_visibility->set_duration_millis(duration_millis); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewDeviceSettings(AnalyticsDeviceSettings settings) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::DEVICE_SETTINGS); + + auto* device_settings = sharing_log->mutable_device_settings(); + device_settings->set_data_usage(GetLoggerDataUsage(settings.data_usage)); + device_settings->set_device_name_size(settings.device_name_size); + device_settings->set_is_show_notification_enabled( + settings.is_fast_init_notification_enabled); + device_settings->set_visibility(GetLoggerVisibility(settings.visibility)); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewFastShareServerResponse( + ::location::nearby::proto::sharing::ServerActionName name, + ::location::nearby::proto::sharing::ServerResponseState state, + int64_t latency_millis) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::FAST_SHARE_SERVER_RESPONSE); + + auto* fast_share_server_response = + sharing_log->mutable_fast_share_server_response(); + fast_share_server_response->set_name(name); + fast_share_server_response->set_status(state); + fast_share_server_response->set_latency_millis(latency_millis); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSetDataUsage(DataUsage original_preference, + DataUsage preference) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::SET_DATA_USAGE); + + auto* set_data_usage = sharing_log->mutable_set_data_usage(); + set_data_usage->set_original_preference( + GetLoggerDataUsage(original_preference)); + set_data_usage->set_preference(GetLoggerDataUsage(preference)); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewAddQuickSettingsTile() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::ADD_QUICK_SETTINGS_TILE); + + sharing_log->mutable_add_quick_settings_tile(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewRemoveQuickSettingsTile() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::REMOVE_QUICK_SETTINGS_TILE); + + sharing_log->mutable_remove_quick_settings_tile(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewTapQuickSettingsTile() { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::TAP_QUICK_SETTINGS_TILE); + + sharing_log->mutable_tap_quick_settings_tile(); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewToggleShowNotification( + ShowNotificationStatus prev_status, ShowNotificationStatus current_status) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::TOGGLE_SHOW_NOTIFICATION); + + auto* toggle_show_notification = + sharing_log->mutable_toggle_show_notification(); + toggle_show_notification->set_current_status(current_status); + toggle_show_notification->set_previous_status(prev_status); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewSetDeviceName(int device_name_size) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::SET_DEVICE_NAME); + + auto* set_device_name = sharing_log->mutable_set_device_name(); + set_device_name->set_device_name_size(device_name_size); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewRequestSettingPermissions( + ::location::nearby::proto::sharing::PermissionRequestType type, + ::location::nearby::proto::sharing::PermissionRequestResult result) { + std::unique_ptr sharing_log = CreateSharingLog( + EventCategory::SETTINGS_EVENT, EventType::REQUEST_SETTING_PERMISSIONS); + + auto* request_setting_permissions = + sharing_log->mutable_request_setting_permissions(); + request_setting_permissions->set_permission_type(type); + request_setting_permissions->set_permission_request_result(result); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewInstallAPKStatus( + ::location::nearby::proto::sharing::InstallAPKStatus status, + ::location::nearby::proto::sharing::ApkSource source) { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::RECEIVING_EVENT, EventType::INSTALL_APK); + + auto* install_apk_status = sharing_log->mutable_install_apk_status(); + install_apk_status->add_status(status); + install_apk_status->add_source(source); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewVerifyAPKStatus( + ::location::nearby::proto::sharing::VerifyAPKStatus status, + ::location::nearby::proto::sharing::ApkSource source) { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::RECEIVING_EVENT, EventType::VERIFY_APK); + + auto* verify_apk_status = sharing_log->mutable_verify_apk_status(); + verify_apk_status->add_status(status); + verify_apk_status->add_source(source); + + LogEvent(*sharing_log); +} + +void AnalyticsRecorder::NewRpcCallStatus( + absl::string_view rpc_name, + SharingLog::RpcCallStatus::RpcDirection direction, + int error_code, absl::Duration latency) { + std::unique_ptr sharing_log = + CreateSharingLog(EventCategory::RPC_EVENT, EventType::RPC_CALL_STATUS); + + auto* rpc_call_status = sharing_log->mutable_rpc_call_status(); + rpc_call_status->set_rpc_name(std::string(rpc_name)); + rpc_call_status->set_direction(direction); + rpc_call_status->set_error_code(error_code); + rpc_call_status->set_latency_millis(absl::ToInt64Milliseconds(latency)); + + LogEvent(*sharing_log); +} + +// Start private methods. + +std::unique_ptr AnalyticsRecorder::CreateSharingLog( + EventCategory event_category, EventType event_type) { + auto sharing_log = std::make_unique(); + sharing_log->set_event_category(event_category); + sharing_log->set_event_type(event_type); + sharing_log->mutable_event_metadata()->set_vendor_id(vendor_id_); + return sharing_log; +} + +void AnalyticsRecorder::LogEvent(const SharingLog& message) { + if (event_logger_ == nullptr) { + return; + } + + event_logger_->Log(message); +} + +int64_t AnalyticsRecorder::GenerateNextId() { + absl::BitGen bit_gen; + return absl::Uniform(bit_gen, 0, INT64_MAX - 1) + 1; +} + +} // namespace analytics +} // namespace sharing +} // namespace nearby diff --git a/sharing/analytics/analytics_recorder.h b/sharing/analytics/analytics_recorder.h new file mode 100644 index 00000000..fd9d8947 --- /dev/null +++ b/sharing/analytics/analytics_recorder.h @@ -0,0 +1,223 @@ +// Copyright 2022-2023 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_SHARING_ANALYTICS_ANALYTICS_RECORDER_H_ +#define THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_RECORDER_H_ + +#include +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "internal/analytics/event_logger.h" +#include "proto/sharing_enums.pb.h" +#include "sharing/analytics/analytics_device_settings.h" +#include "sharing/analytics/analytics_information.h" +#include "sharing/attachment_container.h" +#include "sharing/common/nearby_share_enums.h" +#include "sharing/proto/analytics/nearby_sharing_log.pb.h" +#include "sharing/proto/enums.pb.h" +#include "sharing/share_target.h" + +namespace nearby { +namespace sharing { +namespace analytics { + +class AnalyticsRecorder { + public: + explicit AnalyticsRecorder(int32_t vendor_id, + nearby::analytics::EventLogger* event_logger) + : vendor_id_(vendor_id), event_logger_(event_logger) {} + ~AnalyticsRecorder() = default; + + void NewEstablishConnection( + int64_t session_id, + location::nearby::proto::sharing::EstablishConnectionStatus + connection_status, + const ShareTarget& share_target, int transfer_position, + int concurrent_connections, int64_t duration_millis, + std::optional referrer_package); + + void NewAcceptAgreements(); + + void NewDeclineAgreements(); + + void NewAddContact(); + + void NewRemoveContact(); + + void NewTapFeedback(); + + void NewTapHelp(); + + void NewLaunchDeviceContactConsent( + location::nearby::proto::sharing::ConsentAcceptanceStatus status); + + void NewAdvertiseDevicePresenceEnd(int64_t session_id); + + void NewAdvertiseDevicePresenceStart( + int64_t session_id, nearby::sharing::proto::DeviceVisibility visibility, + location::nearby::proto::sharing::SessionStatus status, + nearby::sharing::proto::DataUsage data_usage, + std::optional referrer_package); + + void NewDescribeAttachments(const AttachmentContainer& attachments); + + void NewDiscoverShareTarget( + const ShareTarget& share_target, int64_t session_id, + int64_t latency_since_scanning_start_millis, int64_t flow_id, + std::optional referrer_package, + int64_t latency_since_send_surface_registered_millis); + + void NewEnableNearbySharing( + location::nearby::proto::sharing::NearbySharingStatus status); + + void NewOpenReceivedAttachments(const AttachmentContainer& attachments, + int64_t session_id); + + void NewProcessReceivedAttachmentsEnd( + int64_t session_id, + location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus + status); + + void NewReceiveAttachmentsEnd( + int64_t session_id, int64_t received_bytes, + location::nearby::proto::sharing::AttachmentTransmissionStatus status, + std::optional referrer_package); + + void NewReceiveAttachmentsStart(int64_t session_id, + const AttachmentContainer& attachments); + + void NewReceiveFastInitialization(int64_t timeElapseSinceScreenUnlockMillis); + + void NewAcceptFastInitialization(); + + void NewDismissFastInitialization(); + + void NewReceiveIntroduction( + int64_t session_id, const ShareTarget& share_target, + std::optional referrer_package, + location::nearby::proto::sharing::OSType share_target_os_type); + + void NewRespondToIntroduction( + location::nearby::proto::sharing::ResponseToIntroduction action, + int64_t session_id); + + void NewTapPrivacyNotification(); + + void NewDismissPrivacyNotification(); + + void NewScanForShareTargetsEnd(int64_t session_id); + + void NewScanForShareTargetsStart( + int64_t session_id, + location::nearby::proto::sharing::SessionStatus status, + AnalyticsInformation analytics_information, int64_t flow_id, + std::optional referrer_package); + + void NewSendAttachmentsEnd( + int64_t session_id, int64_t sent_bytes, const ShareTarget& share_target, + location::nearby::proto::sharing::AttachmentTransmissionStatus status, + int transfer_position, int concurrent_connections, + int64_t duration_millis, std::optional referrer_package, + location::nearby::proto::sharing::ConnectionLayerStatus + connection_layer_status, + location::nearby::proto::sharing::OSType share_target_os_type); + + void NewSendAttachmentsStart(int64_t session_id, + const AttachmentContainer& attachments, + int transfer_position, + int concurrent_connections); + + void NewSendFastInitialization(); + + void NewSendStart(int64_t session_id, int transfer_position, + int concurrent_connections, + const ShareTarget& share_target); + + void NewSendIntroduction( + ShareTargetType target_type, int64_t session_id, + location::nearby::proto::sharing::DeviceRelationship relationship, + location::nearby::proto::sharing::OSType share_target_os_type); + + void NewSendIntroduction( + int64_t session_id, const ShareTarget& share_target, + int transfer_position, int concurrent_connections, + location::nearby::proto::sharing::OSType share_target_os_type); + + void NewSetVisibility(nearby::sharing::proto::DeviceVisibility src_visibility, + nearby::sharing::proto::DeviceVisibility dst_visibility, + int64_t duration_millis); + + void NewDeviceSettings(AnalyticsDeviceSettings settings); + + void NewFastShareServerResponse( + location::nearby::proto::sharing::ServerActionName name, + location::nearby::proto::sharing::ServerResponseState state, + int64_t latency_millis); + + void NewSetDataUsage(nearby::sharing::proto::DataUsage original_preference, + nearby::sharing::proto::DataUsage preference); + + void NewAddQuickSettingsTile(); + + void NewRemoveQuickSettingsTile(); + + void NewTapQuickSettingsTile(); + + void NewToggleShowNotification( + location::nearby::proto::sharing::ShowNotificationStatus prev_status, + location::nearby::proto::sharing::ShowNotificationStatus current_status); + + void NewSetDeviceName(int device_name_size); + + void NewRequestSettingPermissions( + location::nearby::proto::sharing::PermissionRequestType type, + location::nearby::proto::sharing::PermissionRequestResult result); + + void NewInstallAPKStatus( + location::nearby::proto::sharing::InstallAPKStatus status, + location::nearby::proto::sharing::ApkSource source); + + void NewVerifyAPKStatus( + location::nearby::proto::sharing::VerifyAPKStatus status, + location::nearby::proto::sharing::ApkSource source); + + void NewRpcCallStatus( + absl::string_view rpc_name, + nearby::sharing::analytics::proto::SharingLog::RpcCallStatus::RpcDirection + direction, + int error_code, absl::Duration latency); + + // Generates a random number for session ID or flow ID. + int64_t GenerateNextId(); + + private: + std::unique_ptr + CreateSharingLog( + location::nearby::proto::sharing::EventCategory event_category, + location::nearby::proto::sharing::EventType event_type); + void LogEvent(const nearby::sharing::analytics::proto::SharingLog& message); + + const int32_t vendor_id_; + nearby::analytics::EventLogger* event_logger_ = nullptr; +}; + +} // namespace analytics +} // namespace sharing +} // namespace nearby + +#endif // THIRD_PARTY_NEARBY_SHARING_ANALYTICS_ANALYTICS_RECORDER_H_ diff --git a/sharing/analytics/analytics_recorder_test.cc b/sharing/analytics/analytics_recorder_test.cc new file mode 100644 index 00000000..91b30505 --- /dev/null +++ b/sharing/analytics/analytics_recorder_test.cc @@ -0,0 +1,918 @@ +// Copyright 2022-2023 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. + +#include "sharing/analytics/analytics_recorder.h" + +#include + +#include +#include + +#include "google/protobuf/duration.pb.h" +#include "gmock/gmock.h" +#include "protobuf-matchers/protocol-buffer-matchers.h" +#include "gtest/gtest.h" +#include "absl/strings/string_view.h" +#include "absl/time/time.h" +#include "internal/analytics/mock_event_logger.h" +#include "proto/sharing_enums.pb.h" +#include "sharing/analytics/analytics_device_settings.h" +#include "sharing/analytics/analytics_information.h" +#include "sharing/attachment_container.h" +#include "sharing/common/nearby_share_enums.h" +#include "sharing/file_attachment.h" +#include "sharing/proto/analytics/nearby_sharing_log.pb.h" +#include "sharing/proto/enums.pb.h" +#include "sharing/proto/wire_format.pb.h" +#include "sharing/share_target.h" +#include "sharing/text_attachment.h" + +namespace nearby { +namespace sharing { +namespace analytics { +namespace { + +using ::location::nearby::proto::sharing::EventCategory; +using ::location::nearby::proto::sharing::EventType; +using ::location::nearby::proto::sharing::OSType; +using ::nearby::analytics::MockEventLogger; +using ::nearby::sharing::analytics::proto::SharingLog; +using ::nearby::sharing::proto::DataUsage; +using ::nearby::sharing::proto::DeviceVisibility; +using ::testing::An; + +constexpr absl::string_view kFileName = "fileName"; +constexpr absl::string_view kTextBody = "textBody"; +constexpr absl::string_view kFileDocumentName = "abc.pdf"; +constexpr absl::string_view kFileMimeType = "application/pdf"; +constexpr absl::string_view kTextMimeType = "text/plain"; +constexpr absl::string_view kAppPackageName = "com.google.android.youtube"; + +class AnalyticsRecorderTest : public ::testing::Test { + public: + AnalyticsRecorderTest() = default; + ~AnalyticsRecorderTest() override = default; + + MockEventLogger& event_logger() { return event_logger_; } + + AnalyticsRecorder analytics_recoder() { return analytics_recorder_; } + + private: + MockEventLogger event_logger_; + AnalyticsRecorder analytics_recorder_{/*vendor_id=*/0, &event_logger_}; +}; + +TEST_F(AnalyticsRecorderTest, NewEstablishConnection) { + ShareTarget share_target; + share_target.device_name = "share_target"; + share_target.type = ShareTargetType::kPhone; + + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ESTABLISH_CONNECTION); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.establish_connection().status(), + location::nearby::proto::sharing::EstablishConnectionStatus:: + CONNECTION_STATUS_SUCCESS); + EXPECT_EQ(log.establish_connection().session_id(), 1); + EXPECT_EQ(log.establish_connection().transfer_position(), 1); + EXPECT_EQ(log.establish_connection().concurrent_connections(), 1); + EXPECT_EQ(log.establish_connection().duration_millis(), 100); + EXPECT_EQ(log.establish_connection().share_target_info().os_type(), + location::nearby::proto::sharing::OSType::ANDROID); + EXPECT_EQ(log.establish_connection().referrer_name(), kAppPackageName); + }); + + analytics_recoder().NewEstablishConnection( + 1, + location::nearby::proto::sharing::EstablishConnectionStatus:: + CONNECTION_STATUS_SUCCESS, + share_target, 1, 1, 100, std::string(kAppPackageName)); +} + +TEST_F(AnalyticsRecorderTest, NewAcceptAgreements) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ACCEPT_AGREEMENTS); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewAcceptAgreements(); +} + +TEST_F(AnalyticsRecorderTest, NewDeclineAgreements) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DECLINE_AGREEMENTS); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewDeclineAgreements(); +} + +TEST_F(AnalyticsRecorderTest, NewAddContact) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ADD_CONTACT); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewAddContact(); +} + +TEST_F(AnalyticsRecorderTest, NewRemoveContact) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::REMOVE_CONTACT); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewRemoveContact(); +} + +TEST_F(AnalyticsRecorderTest, NewTapFeedback) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::TAP_FEEDBACK); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewTapFeedback(); +} + +TEST_F(AnalyticsRecorderTest, NewTapHelp) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::TAP_HELP); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewTapHelp(); +} + +TEST_F(AnalyticsRecorderTest, NewLaunchDeviceContactConsent) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::LAUNCH_CONSENT); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.launch_consent().status(), + location::nearby::proto::sharing::ConsentAcceptanceStatus:: + CONSENT_ACCEPTED); + }); + + analytics_recoder().NewLaunchDeviceContactConsent( + ::location::nearby::proto::sharing::ConsentAcceptanceStatus:: + CONSENT_ACCEPTED); +} + +TEST_F(AnalyticsRecorderTest, NewAdvertiseDevicePresenceEnd) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ADVERTISE_DEVICE_PRESENCE_END); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.advertise_device_presence_end().session_id(), 100); + }); + + analytics_recoder().NewAdvertiseDevicePresenceEnd(100); +} + +TEST_F(AnalyticsRecorderTest, NewAdvertiseDevicePresenceStart) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ADVERTISE_DEVICE_PRESENCE_START); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.advertise_device_presence_start().visibility(), + location::nearby::proto::sharing::Visibility::CONTACTS_ONLY); + EXPECT_EQ(log.advertise_device_presence_start().status(), + location::nearby::proto::sharing::SessionStatus:: + SUCCEEDED_SESSION_STATUS); + EXPECT_EQ(log.advertise_device_presence_start().data_usage(), + location::nearby::proto::sharing::DataUsage::OFFLINE); + EXPECT_EQ(log.advertise_device_presence_start().referrer_name(), + kAppPackageName); + EXPECT_EQ(log.advertise_device_presence_start().session_id(), 100); + }); + + analytics_recoder().NewAdvertiseDevicePresenceStart( + 100, DeviceVisibility::DEVICE_VISIBILITY_ALL_CONTACTS, + location::nearby::proto::sharing::SessionStatus::SUCCEEDED_SESSION_STATUS, + DataUsage::OFFLINE_DATA_USAGE, std::string(kAppPackageName)); +} + +TEST_F(AnalyticsRecorderTest, NewDescribeAttachments) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DESCRIBE_ATTACHMENTS); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment_size(), + 5); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment(0) + .size_bytes(), + kTextBody.size()); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment(0) + .type(), + SharingLog::TextAttachment::UNKNOWN_TEXT_TYPE); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment(1) + .type(), + SharingLog::TextAttachment::PHONE_NUMBER); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment(2) + .type(), + SharingLog::TextAttachment::URL); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment(3) + .type(), + SharingLog::TextAttachment::ADDRESS); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment(4) + .type(), + SharingLog::TextAttachment::UNKNOWN_TEXT_TYPE); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment_size(), + 4); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment(0) + .size_bytes(), + 2); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment(0) + .type(), + SharingLog::FileAttachment::IMAGE); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment(1) + .type(), + SharingLog::FileAttachment::DOCUMENT); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment(2) + .type(), + SharingLog::FileAttachment::AUDIO); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment(3) + .type(), + SharingLog::FileAttachment::DOCUMENT); + }); + + AttachmentContainer attachments( + {TextAttachment(5, service::proto::TextMetadata::TEXT, + std::string(kTextBody), kTextBody.size()), + TextAttachment(6, service::proto::TextMetadata::PHONE_NUMBER, + std::string(kTextBody), kTextBody.size()), + TextAttachment(7, service::proto::TextMetadata::URL, + std::string(kTextBody), kTextBody.size()), + TextAttachment(8, service::proto::TextMetadata::ADDRESS, + std::string(kTextBody), kTextBody.size()), + TextAttachment(9, service::proto::TextMetadata::UNKNOWN, + std::string(kTextBody), kTextBody.size())}, + {FileAttachment(1, 2, std::string(kFileName), "", + service::proto::FileMetadata::IMAGE), + FileAttachment(2, 3, std::string(kFileDocumentName), + std::string(kFileMimeType), + service::proto::FileMetadata::DOCUMENT), + FileAttachment(3, 4, std::string(kFileName), "", + service::proto::FileMetadata::AUDIO), + FileAttachment(4, 5, std::string(kFileName), std::string(kTextMimeType), + service::proto::FileMetadata::DOCUMENT)}, + {}); + + analytics_recoder().NewDescribeAttachments(attachments); +} + +TEST_F(AnalyticsRecorderTest, EmptyDescribeAttachments) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DESCRIBE_ATTACHMENTS); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .text_attachment_size(), + 0); + EXPECT_EQ(log.describe_attachments() + .attachments_info() + .file_attachment_size(), + 0); + }); + + analytics_recoder().NewDescribeAttachments(AttachmentContainer()); +} + +TEST_F(AnalyticsRecorderTest, NewDiscoverShareTarget) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DISCOVER_SHARE_TARGET); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.discover_share_target().duration_since_scanning().nanos(), + (2100 % 1000) * 1000000); + EXPECT_EQ( + log.discover_share_target().duration_since_scanning().seconds(), + 2100 / 1000); + EXPECT_EQ( + log.discover_share_target() + .share_target_info() + .device_relationship(), + ::location::nearby::proto::sharing::DeviceRelationship::IS_CONTACT); + EXPECT_EQ(log.discover_share_target().share_target_info().device_type(), + ::location::nearby::proto::sharing::DeviceType::LAPTOP); + EXPECT_EQ(log.discover_share_target().share_target_info().os_type(), + ::location::nearby::proto::sharing::OSType::UNKNOWN_OS_TYPE); + EXPECT_EQ(log.discover_share_target().session_id(), 1); + EXPECT_EQ(log.discover_share_target().flow_id(), 100); + EXPECT_FALSE(log.discover_share_target().has_referrer_name()); + EXPECT_EQ( + log.discover_share_target().latency_since_activity_start_millis(), + 2); + }); + + ShareTarget share_target; + share_target.device_name = "share_target"; + share_target.type = ShareTargetType::kLaptop; + share_target.is_incoming = true; + share_target.is_known = true; + + analytics_recoder().NewDiscoverShareTarget(share_target, 1, 2100, 100, + std::nullopt, 2); +} + +TEST_F(AnalyticsRecorderTest, NewEnableNearbySharing) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ENABLE_NEARBY_SHARING); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.enable_nearby_sharing().status(), + location::nearby::proto::sharing::NearbySharingStatus::ON); + }); + + analytics_recoder().NewEnableNearbySharing( + ::location::nearby::proto::sharing::NearbySharingStatus::ON); +} + +TEST_F(AnalyticsRecorderTest, NewOpenReceivedAttachments) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::OPEN_RECEIVED_ATTACHMENTS); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.open_received_attachments() + .attachments_info() + .text_attachment_size(), + 0); + EXPECT_EQ(log.open_received_attachments() + .attachments_info() + .file_attachment_size(), + 0); + EXPECT_EQ(log.open_received_attachments().session_id(), 1); + }); + + analytics_recoder().NewOpenReceivedAttachments(AttachmentContainer(), 1); +} + +TEST_F(AnalyticsRecorderTest, NewProcessReceivedAttachmentsEnd) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), + EventType::PROCESS_RECEIVED_ATTACHMENTS_END); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.process_received_attachments_end().session_id(), 1); + EXPECT_EQ( + log.process_received_attachments_end().status(), + location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus:: + PROCESSING_STATUS_COMPLETE_PROCESSING_ATTACHMENTS); + }); + + analytics_recoder().NewProcessReceivedAttachmentsEnd( + 1, location::nearby::proto::sharing::ProcessReceivedAttachmentsStatus:: + PROCESSING_STATUS_COMPLETE_PROCESSING_ATTACHMENTS); +} + +TEST_F(AnalyticsRecorderTest, NewReceiveAttachmentsEnd) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::RECEIVE_ATTACHMENTS_END); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.receive_attachments_end().session_id(), 1); + EXPECT_EQ(log.receive_attachments_end().received_bytes(), 2); + EXPECT_EQ( + log.receive_attachments_end().status(), + ::location::nearby::proto::sharing::AttachmentTransmissionStatus:: + COMPLETE_ATTACHMENT_TRANSMISSION_STATUS); + EXPECT_EQ(log.receive_attachments_end().referrer_name(), + kAppPackageName); + }); + + analytics_recoder().NewReceiveAttachmentsEnd( + 1, 2, + ::location::nearby::proto::sharing::AttachmentTransmissionStatus:: + COMPLETE_ATTACHMENT_TRANSMISSION_STATUS, + std::string(kAppPackageName)); +} + +TEST_F(AnalyticsRecorderTest, NewReceiveAttachmentsStart) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::RECEIVE_ATTACHMENTS_START); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.receive_attachments_start().session_id(), 1); + EXPECT_EQ(log.receive_attachments_start() + .attachments_info() + .file_attachment_size(), + 0); + }); + + analytics_recoder().NewReceiveAttachmentsStart(1, AttachmentContainer()); +} + +TEST_F(AnalyticsRecorderTest, NewReceiveFastInitialization) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::RECEIVE_FAST_INITIALIZATION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.receive_initialization() + .time_elapse_since_screen_unlock_millis(), + 1); + }); + + analytics_recoder().NewReceiveFastInitialization(1); +} + +TEST_F(AnalyticsRecorderTest, NewAcceptFastInitialization) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ACCEPT_FAST_INITIALIZATION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + }); + + analytics_recoder().NewAcceptFastInitialization(); +} + +TEST_F(AnalyticsRecorderTest, NewDismissFastInitialization) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DISMISS_FAST_INITIALIZATION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + }); + + analytics_recoder().NewDismissFastInitialization(); +} + +TEST_F(AnalyticsRecorderTest, NewReceiveIntroduction) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::RECEIVE_INTRODUCTION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.receive_introduction().session_id(), 1); + EXPECT_EQ(log.receive_introduction().share_target_info().os_type(), + ::location::nearby::proto::sharing::OSType::WINDOWS); + EXPECT_EQ(log.receive_introduction().share_target_info().device_type(), + ::location::nearby::proto::sharing::DeviceType::PHONE); + EXPECT_EQ(log.receive_introduction().referrer_name(), kAppPackageName); + }); + + ShareTarget share_target; + share_target.device_name = "share_target"; + share_target.type = ShareTargetType::kPhone; + analytics_recoder().NewReceiveIntroduction( + 1, share_target, std::string(kAppPackageName), OSType::WINDOWS); +} + +TEST_F(AnalyticsRecorderTest, NewRespondToIntroduction) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::RESPOND_TO_INTRODUCTION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.respond_introduction().session_id(), 1); + EXPECT_EQ(log.respond_introduction().action(), + ::location::nearby::proto::sharing::ResponseToIntroduction:: + ACCEPT_INTRODUCTION); + }); + + analytics_recoder().NewRespondToIntroduction( + ::location::nearby::proto::sharing::ResponseToIntroduction:: + ACCEPT_INTRODUCTION, + 1); +} + +TEST_F(AnalyticsRecorderTest, NewTapPrivacyNotification) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::TAP_PRIVACY_NOTIFICATION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + }); + + analytics_recoder().NewTapPrivacyNotification(); +} + +TEST_F(AnalyticsRecorderTest, NewDismissPrivacyNotification) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DISMISS_PRIVACY_NOTIFICATION); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + }); + + analytics_recoder().NewDismissPrivacyNotification(); +} + +TEST_F(AnalyticsRecorderTest, NewScanForShareTargetsEnd) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SCAN_FOR_SHARE_TARGETS_END); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.scan_for_share_targets_end().session_id(), 100); + }); + + analytics_recoder().NewScanForShareTargetsEnd(100); +} + +TEST_F(AnalyticsRecorderTest, NewScanForShareTargetsStart) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SCAN_FOR_SHARE_TARGETS_START); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.scan_for_share_targets_start().session_id(), 3); + EXPECT_EQ(log.scan_for_share_targets_start().status(), + ::location::nearby::proto::sharing::SessionStatus:: + FAILED_SESSION_STATUS); + EXPECT_EQ(log.scan_for_share_targets_start().flow_id(), 100); + EXPECT_EQ( + log.scan_for_share_targets_start().scan_type(), + ::location::nearby::proto::sharing::ScanType::FOREGROUND_SCAN); + EXPECT_FALSE(log.scan_for_share_targets_start().has_referrer_name()); + }); + + analytics_recoder().NewScanForShareTargetsStart( + 3, + ::location::nearby::proto::sharing::SessionStatus::FAILED_SESSION_STATUS, + AnalyticsInformation{SendSurfaceState::kForeground}, 100, std::nullopt); +} + +TEST_F(AnalyticsRecorderTest, NewSendAttachmentsEnd) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SEND_ATTACHMENTS_END); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.send_attachments_end().session_id(), 1); + EXPECT_EQ(log.send_attachments_end().sent_bytes(), 2); + EXPECT_EQ(log.send_attachments_end().share_target_info().os_type(), + ::location::nearby::proto::sharing::OSType::ANDROID); + EXPECT_EQ(log.send_attachments_end().share_target_info().device_type(), + ::location::nearby::proto::sharing::DeviceType::PHONE); + EXPECT_EQ(log.send_attachments_end().transfer_position(), 1); + EXPECT_EQ(log.send_attachments_end().concurrent_connections(), 2); + EXPECT_EQ(log.send_attachments_end().duration_millis(), 100); + EXPECT_EQ( + log.send_attachments_end().status(), + ::location::nearby::proto::sharing::AttachmentTransmissionStatus:: + COMPLETE_ATTACHMENT_TRANSMISSION_STATUS); + EXPECT_EQ(log.send_attachments_end().referrer_name(), kAppPackageName); + }); + + ShareTarget share_target; + share_target.device_name = "share_target"; + share_target.type = ShareTargetType::kPhone; + analytics_recoder().NewSendAttachmentsEnd( + 1, 2, share_target, + ::location::nearby::proto::sharing::AttachmentTransmissionStatus:: + COMPLETE_ATTACHMENT_TRANSMISSION_STATUS, + 1, 2, 100, std::string(kAppPackageName), + ::location::nearby::proto::sharing::ConnectionLayerStatus:: + CONNECTION_LAYER_STATUS_UNKNOWN, + OSType::UNKNOWN_OS_TYPE); +} + +TEST_F(AnalyticsRecorderTest, NewSendAttachmentsStart) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SEND_ATTACHMENTS_START); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.send_attachments_start().session_id(), 1); + EXPECT_EQ(log.send_attachments_start() + .attachments_info() + .file_attachment_size(), + 0); + EXPECT_EQ(log.send_attachments_start().transfer_position(), 100); + EXPECT_EQ(log.send_attachments_start().concurrent_connections(), 200); + }); + + analytics_recoder().NewSendAttachmentsStart(1, AttachmentContainer(), 100, + 200); +} + +TEST_F(AnalyticsRecorderTest, NewSendFastInitialization) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SEND_FAST_INITIALIZATION); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + }); + + analytics_recoder().NewSendFastInitialization(); +} + +TEST_F(AnalyticsRecorderTest, NewSendStart) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SEND_START); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.send_start().session_id(), 123); + EXPECT_EQ(log.send_start().transfer_position(), 1); + EXPECT_EQ(log.send_start().concurrent_connections(), 2); + EXPECT_EQ(log.send_start().share_target_info().device_type(), + ::location::nearby::proto::sharing::DeviceType::LAPTOP); + EXPECT_EQ(log.send_start().share_target_info().os_type(), + ::location::nearby::proto::sharing::OSType::UNKNOWN_OS_TYPE); + }); + + ShareTarget share_target; + share_target.device_name = "share_target"; + share_target.type = ShareTargetType::kLaptop; + share_target.is_known = true; + share_target.is_incoming = true; + analytics_recoder().NewSendStart(123, 1, 2, share_target); +} + +TEST_F(AnalyticsRecorderTest, NewSendIntroductionWithRelationship) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SEND_INTRODUCTION); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.send_introduction().session_id(), 5); + EXPECT_EQ(log.send_introduction().share_target_info().device_type(), + ::location::nearby::proto::sharing::DeviceType::LAPTOP); + EXPECT_EQ(log.send_introduction().share_target_info().os_type(), + ::location::nearby::proto::sharing::OSType::MACOS); + EXPECT_EQ( + log.send_introduction().share_target_info().device_relationship(), + ::location::nearby::proto::sharing::DeviceRelationship::IS_CONTACT); + }); + + analytics_recoder().NewSendIntroduction( + ShareTargetType::kLaptop, 5, + ::location::nearby::proto::sharing::DeviceRelationship::IS_CONTACT, + OSType::MACOS); +} + +TEST_F(AnalyticsRecorderTest, NewSendIntroduction) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SEND_INTRODUCTION); + EXPECT_EQ(log.event_category(), EventCategory::SENDING_EVENT); + EXPECT_EQ(log.send_introduction().session_id(), 1); + EXPECT_EQ(log.send_introduction().transfer_position(), 2); + EXPECT_EQ(log.send_introduction().concurrent_connections(), 3); + EXPECT_EQ(log.send_introduction().share_target_info().device_type(), + ::location::nearby::proto::sharing::DeviceType::LAPTOP); + EXPECT_EQ(log.send_introduction().share_target_info().os_type(), + ::location::nearby::proto::sharing::OSType::UNKNOWN_OS_TYPE); + }); + + ShareTarget share_target; + share_target.device_name = "share_target"; + share_target.type = ShareTargetType::kLaptop; + analytics_recoder().NewSendIntroduction(1, share_target, 2, 3, + OSType::UNKNOWN_OS_TYPE); +} + +TEST_F(AnalyticsRecorderTest, NewSetVisibility) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SET_VISIBILITY); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.set_visibility().duration_millis(), 100); + EXPECT_EQ(log.set_visibility().source_visibility(), + ::location::nearby::proto::sharing::Visibility::EVERYONE); + EXPECT_EQ( + log.set_visibility().visibility(), + ::location::nearby::proto::sharing::Visibility::CONTACTS_ONLY); + }); + + analytics_recoder().NewSetVisibility( + DeviceVisibility::DEVICE_VISIBILITY_EVERYONE, + DeviceVisibility::DEVICE_VISIBILITY_ALL_CONTACTS, 100); +} + +TEST_F(AnalyticsRecorderTest, NewDeviceSettings) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::DEVICE_SETTINGS); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.device_settings().device_name_size(), 10); + EXPECT_EQ(log.device_settings().visibility(), + ::location::nearby::proto::sharing::Visibility::EVERYONE); + EXPECT_EQ(log.device_settings().data_usage(), + ::location::nearby::proto::sharing::DataUsage::WIFI_ONLY); + EXPECT_EQ(log.device_settings().is_show_notification_enabled(), true); + }); + + AnalyticsDeviceSettings device_settings; + device_settings.device_name_size = 10; + device_settings.data_usage = DataUsage::WIFI_ONLY_DATA_USAGE; + device_settings.is_fast_init_notification_enabled = true; + device_settings.visibility = DeviceVisibility::DEVICE_VISIBILITY_EVERYONE; + analytics_recoder().NewDeviceSettings(device_settings); +} + +TEST_F(AnalyticsRecorderTest, NewFastShareServerResponse) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::FAST_SHARE_SERVER_RESPONSE); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.fast_share_server_response().latency_millis(), 200); + EXPECT_EQ(log.fast_share_server_response().name(), + ::location::nearby::proto::sharing::ServerActionName:: + UPLOAD_CONTACTS); + EXPECT_EQ(log.fast_share_server_response().status(), + ::location::nearby::proto::sharing::ServerResponseState:: + SERVER_RESPONSE_SUCCESS); + }); + + analytics_recoder().NewFastShareServerResponse( + ::location::nearby::proto::sharing::ServerActionName::UPLOAD_CONTACTS, + ::location::nearby::proto::sharing::ServerResponseState:: + SERVER_RESPONSE_SUCCESS, + 200); +} + +TEST_F(AnalyticsRecorderTest, NewSetDataUsage) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SET_DATA_USAGE); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.set_data_usage().preference(), + ::location::nearby::proto::sharing::DataUsage::OFFLINE); + EXPECT_EQ(log.set_data_usage().original_preference(), + ::location::nearby::proto::sharing::DataUsage::WIFI_ONLY); + }); + + analytics_recoder().NewSetDataUsage(DataUsage::WIFI_ONLY_DATA_USAGE, + DataUsage::OFFLINE_DATA_USAGE); +} + +TEST_F(AnalyticsRecorderTest, NewAddQuickSettingsTile) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::ADD_QUICK_SETTINGS_TILE); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewAddQuickSettingsTile(); +} + +TEST_F(AnalyticsRecorderTest, NewRemoveQuickSettingsTile) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::REMOVE_QUICK_SETTINGS_TILE); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewRemoveQuickSettingsTile(); +} + +TEST_F(AnalyticsRecorderTest, NewTapQuickSettingsTile) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::TAP_QUICK_SETTINGS_TILE); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + }); + + analytics_recoder().NewTapQuickSettingsTile(); +} + +TEST_F(AnalyticsRecorderTest, NewToggleShowNotification) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::TOGGLE_SHOW_NOTIFICATION); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ( + log.toggle_show_notification().previous_status(), + ::location::nearby::proto::sharing::ShowNotificationStatus::SHOW); + EXPECT_EQ(log.toggle_show_notification().current_status(), + ::location::nearby::proto::sharing::ShowNotificationStatus:: + NOT_SHOW); + }); + + analytics_recoder().NewToggleShowNotification( + ::location::nearby::proto::sharing::ShowNotificationStatus::SHOW, + ::location::nearby::proto::sharing::ShowNotificationStatus::NOT_SHOW); +} + +TEST_F(AnalyticsRecorderTest, NewSetDeviceName) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::SET_DEVICE_NAME); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.set_device_name().device_name_size(), 16); + }); + + analytics_recoder().NewSetDeviceName(16); +} + +TEST_F(AnalyticsRecorderTest, NewRequestSettingPermissions) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::REQUEST_SETTING_PERMISSIONS); + EXPECT_EQ(log.event_category(), EventCategory::SETTINGS_EVENT); + EXPECT_EQ(log.request_setting_permissions().permission_type(), + ::location::nearby::proto::sharing::PermissionRequestType:: + PERMISSION_BLUETOOTH); + EXPECT_EQ( + log.request_setting_permissions().permission_request_result(), + ::location::nearby::proto::sharing::PermissionRequestResult:: + PERMISSION_GRANTED); + }); + + analytics_recoder().NewRequestSettingPermissions( + ::location::nearby::proto::sharing::PermissionRequestType:: + PERMISSION_BLUETOOTH, + ::location::nearby::proto::sharing::PermissionRequestResult:: + PERMISSION_GRANTED); +} + +TEST_F(AnalyticsRecorderTest, NewInstallAPKStatus) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::INSTALL_APK); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ(log.install_apk_status().status(0), + ::location::nearby::proto::sharing::InstallAPKStatus:: + SUCCESS_INSTALLATION); + EXPECT_EQ( + log.install_apk_status().source(0), + ::location::nearby::proto::sharing::ApkSource::APK_FROM_SD_CARD); + }); + + analytics_recoder().NewInstallAPKStatus( + ::location::nearby::proto::sharing::InstallAPKStatus:: + SUCCESS_INSTALLATION, + ::location::nearby::proto::sharing::ApkSource::APK_FROM_SD_CARD); +} + +TEST_F(AnalyticsRecorderTest, NewVerifyAPKStatus) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::VERIFY_APK); + EXPECT_EQ(log.event_category(), EventCategory::RECEIVING_EVENT); + EXPECT_EQ( + log.verify_apk_status().status(0), + ::location::nearby::proto::sharing::VerifyAPKStatus::INSTALLABLE); + EXPECT_EQ( + log.verify_apk_status().source(0), + ::location::nearby::proto::sharing::ApkSource::APK_FROM_SD_CARD); + }); + + analytics_recoder().NewVerifyAPKStatus( + ::location::nearby::proto::sharing::VerifyAPKStatus::INSTALLABLE, + ::location::nearby::proto::sharing::ApkSource::APK_FROM_SD_CARD); +} + +TEST_F(AnalyticsRecorderTest, NewRpcCallStatus) { + EXPECT_CALL(event_logger(), Log(An())) + .WillOnce([](const SharingLog& log) { + EXPECT_EQ(log.event_type(), EventType::RPC_CALL_STATUS); + EXPECT_EQ(log.event_category(), EventCategory::RPC_EVENT); + EXPECT_EQ(log.rpc_call_status().rpc_name(), "service.rpc_name"); + EXPECT_EQ(log.rpc_call_status().direction(), + SharingLog::RpcCallStatus::OUTGOING); + EXPECT_EQ(log.rpc_call_status().error_code(), 123); + EXPECT_EQ(log.rpc_call_status().latency_millis(), 456); + }); + + analytics_recoder().NewRpcCallStatus( + "service.rpc_name", SharingLog::RpcCallStatus::OUTGOING, 123, + absl::Milliseconds(456)); +} + +TEST_F(AnalyticsRecorderTest, GenerateID) { + int64_t id = analytics_recoder().GenerateNextId(); + EXPECT_GT(id, 0); + int64_t id2 = analytics_recoder().GenerateNextId(); + EXPECT_NE(id2, id); +} + +} // namespace +} // namespace analytics +} // namespace sharing +} // namespace nearby diff --git a/sharing/android/README.md b/sharing/android/README.md new file mode 100644 index 00000000..9b37525c --- /dev/null +++ b/sharing/android/README.md @@ -0,0 +1,147 @@ +# Nearby Sharing Android API + +## Checking if Quick Share (Google) is supported on your device + +Quick Share by Google has its own UI, and to use the below launch intents, the availability of these intents needs to be checked first. +This can be done by calling `PackageManager#queryIntentActivities()` with the intent required. A good rule of thumb to check if Quick Share is enabled is to run this check with the intent `com.google.android.gms.SHARE_NEARBY`. + +Example code: + +```kotlin +val shareIntent = Intent("com.google.android.gms.SHARE_NEARBY") + .setType("text/plain") + .putExtra(Intent.EXTRA_TEXT, "Hello Nearby"); + +val packageManager = context.packageManager; +val activities = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); +// If the activities list is not empty, the intent can be handled and the intent can be called! +``` + +## Launching the settings page + +The Google Quick Share settings page can be launched by sending an intent with the action `com.google.android.gms.settings.SHARING`. There are no extras to be provided. + +Example code: + +```kotlin +const val QUICK_SHARE_SETTINGS_INTENT = "com.google.android.gms.settings.SHARING" +context.startActivity(Intent(QUICK_SHARE_SETTINGS_INTENT)) +``` + +## Launching the receiving UI + +The Google Quick Share receiving UI can be launched by sending an intent with the action `com.google.android.gms.RECEIVE_NEARBY`. You will need to set the type of the intent to be `*/*` to match the filter. + +Example code: + +```kotlin +const val QUICK_SHARE_RECEIVE_INTENT = "com.google.android.gms.RECEIVE_NEARBY" +context.startActivity(Intent(QUICK_SHARE_RECEIVE_INTENT).setType("*/*")) +``` + +## Sending a file via Quick Share + +Quick Share responds to the `android.intent.action.SEND` intent. To send a file, attach a content URI to the Intent.EXTRA_STREAM when sending the intent to send a file via Quick Share. + +Example code: + +```kotlin +val sendIntent = Intent(Intent.ACTION_SEND) + .setType(/* Set your content mime type here */) + .putExtra(Intent.EXTRA_STREAM, /* your content URI here */) +``` + +## Sending a folder via Quick Share + +To send folders, Quick Share has a custom intent: `com.google.android.gms.nearby.SEND_FOLDER`. + +### Mandatory extras + +To place files in a parent folder, you can supply the following string extra: `com.google.android.gms.nearby.PARENT_FOLDER`. If this is not desirable, leave it as an empty string. + +To provide the file count of the number of the files in the folder, supply the following extra: `com.google.android.gms.nearby.FILE_COUNT`. If this is not supplied, Quick Share will assume 0 files are in the folder. + +To provide the actual content of the folder, supply the following extra: `com.google.android.gms.nearby.SEND_FOLDER_CONTENT_URI`. If not available, Quick Share will fail the transfer. + +### Content provider + +To share a folder, Quick Share expects the presence of a ContentProvider with the following columns: + +* `file_name` - The name of the file. +* `file_uri` - The URI of the file, as given by a file provider. +* `file_size` - The size in bytes of the file. +* `file_dir` - The directory that the file should be placed in (parent directory under `/sdcard/Download/Quick Share`). +* `file_mime_type` - The mime type of the file. + +Quick Share expects these columns to be populated for each file the user wants to share. The content URI provided is the URI to the content provider that can be queried for each file. + +Putting this all together, we have the following intent structure: + +```kotlin +val sendFolderIntent = Intent("com.google.android.gms.nearby.SEND_FOLDER") + .putExtra("com.google.android.gms.nearby.PARENT_FOLDER", /* The folder to save to under /sdcard/Download/Quick Share */) + .putExtra("com.google.android.gms.nearby.FILE_COUNT", /* The file count in the folder */) + .putExtra("com.google.android.gms.nearby.SEND_FOLDER_CONTENT_URI", /* Your content provider URI here */) +``` + + +## Slice API + +The nearby module in GMSCore provides a third-party accessible slice to bind to, to provide live data on nearby targets using Quick Share. Clicking on any of these targets will take you to the main Quick Share screen, where the transfer will begin and continually update the progress. + +The slice URI is `content://com.google.android.gms.nearby.sharing/scan`. Upon first launch after install, you will be prompted to grant permission to the client application. After that, the slice will be kept up to date with the latest targets nearby. + +### How to use the API + +Example code: + +```kotlin +// Derive the Slice URI. +val sliceUri = Uri.parse("content://com.google.android.gms.nearby.sharing/scan") +// Get the SliceViewManager +val sliceManager = SliceViewManager.getInstance(context) +// Pin the slice and register your callback. +sliceManager.registerSliceCallback(sliceUri, { slice: Slice? -> + if (slice == null) { + return + } + for (targetItem in slice.items.reversed()) { + // Each row containing a target has the hints LIST_ITEM and ACTIVITY. + if (!(targetItem.format == SLICE && targetItem.hints.containsAll(listOf(LIST_ITEM, ACTIVITY)))) { + continue + } + val targetSlice = targetItem.slice + var deviceName: String? = null + var action: PendingIntent? = null + var profileIcon: IconCompat? = null + + for (item in targetSlice.items) { + // The slice item of the target's device name contains the TITLE hint. + if (item.format == TEXT && item.hints.contains(TITLE)) { + deviceName = item.text.toString() + } + // The slice item of the target action contains the SHORTCUT and TITLE hints. + if (item.format == ACTION && item.hints.containsAll(listOf(SHORTCUT, TITLE))) { + action = item.action + + val iconSlice: Slice? = item.slice + if (iconSlice != null) { + for (iconitem in iconSlice.items) { + // The target's icon is indicated by the IMAGE slice item format and the NO_TINT hint. + if (iconitem.format == IMAGE && iconitem.hints.contains(NO_TINT)) { + profileIcon = iconitem.icon + } + } + } + } + } + // Returns null if the data parsed from the slice is incomplete. + if (deviceName == null || action == null || profileIcon == null) { + continue + } + } +}) +// Remember to bind the slice after you pin it to avoid race conditions! +val slice = sliceManager.bindSlice(sliceUri) +``` +Refer to the [SliceViewManager#registerSliceCallback() documentation](https://developer.android.com/reference/androidx/slice/SliceViewManager#registerSliceCallback(android.net.Uri,androidx.slice.SliceViewManager.SliceCallback)) for more information about the race condition described above. diff --git a/sharing/android/example/.gitignore b/sharing/android/example/.gitignore new file mode 100644 index 00000000..565a5412 --- /dev/null +++ b/sharing/android/example/.gitignore @@ -0,0 +1,16 @@ +*.iml +.gradle +.idea +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/sharing/android/example/README.md b/sharing/android/example/README.md new file mode 100644 index 00000000..24f43575 --- /dev/null +++ b/sharing/android/example/README.md @@ -0,0 +1,25 @@ +# Nearby Share sample app + +This app is a demonstration of how to bind to and use the Nearby Share slice. + +## Build instructions +From the root of the repository: +``` +// Run this before importing into Android Studio! +$ cd sharing/android/example +$ gradle wrapper +$ ./gradlew build +``` +For the gradle wrapper, we recommend Gradle 8.0+. + +## Key callouts +MainViewModel - contains the business logic for processing and binding to the slice, as well as the lifecycle of the slice. + +MainActivity - hosts the `MainView` composable and provides the intent to fill in the slice's PendingIntent action with, providing the data to send via Nearby Share. + +## Screenshots +

+ No devices available screenshot + Devices available screenshot + Consent prompt screenshot +

diff --git a/sharing/android/example/app/.gitignore b/sharing/android/example/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/sharing/android/example/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/sharing/android/example/app/build.gradle.kts b/sharing/android/example/app/build.gradle.kts new file mode 100644 index 00000000..2e69dbe7 --- /dev/null +++ b/sharing/android/example/app/build.gradle.kts @@ -0,0 +1,78 @@ +/* + * Copyright 2024 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. + */ + +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.google.nearby.sharedemo" + compileSdk = 33 + + defaultConfig { + applicationId = "com.google.nearby.sharedemo" + minSdk = 30 + targetSdk = 33 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.9.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") + implementation("androidx.activity:activity-compose:1.7.2") + implementation(platform("androidx.compose:compose-bom:2023.03.00")) + implementation("androidx.compose.ui:ui") + implementation("androidx.compose.ui:ui-graphics") + implementation("androidx.compose.ui:ui-tooling-preview") + implementation("androidx.compose.material3:material3") + implementation("androidx.slice:slice-core:1.1.0-alpha02") + implementation("androidx.slice:slice-view:1.1.0-alpha02") + debugImplementation("androidx.compose.ui:ui-tooling") + debugImplementation("androidx.compose.ui:ui-test-manifest") +} diff --git a/sharing/android/example/app/src/main/AndroidManifest.xml b/sharing/android/example/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..096bbb17 --- /dev/null +++ b/sharing/android/example/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + diff --git a/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/MainActivity.kt b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/MainActivity.kt new file mode 100644 index 00000000..c15d265c --- /dev/null +++ b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/MainActivity.kt @@ -0,0 +1,181 @@ +/* + * Copyright 2024 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. + */ + +package com.google.nearby.sharedemo + +import android.app.PendingIntent +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import android.provider.OpenableColumns +import androidx.activity.ComponentActivity +import androidx.activity.compose.rememberLauncherForActivityResult +import androidx.activity.compose.setContent +import androidx.activity.result.contract.ActivityResultContracts +import androidx.activity.viewModels +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items +import androidx.compose.material3.Button +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.dp +import androidx.compose.ui.viewinterop.AndroidView +import androidx.slice.Slice +import androidx.slice.widget.SliceView +import com.google.nearby.sharedemo.ui.theme.NearbyShareDemoTheme + +class MainActivity : ComponentActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + val viewModel: MainViewModel by viewModels(factoryProducer = { MainViewModel.Factory }) + setContent { + NearbyShareDemoTheme { + // A surface container using the 'background' color from the theme + val state by viewModel.targetsFlow.collectAsState() + Column( + modifier = Modifier + .fillMaxSize() + .background(MaterialTheme.colorScheme.background) + ) { + MainView( + state, + onShareTargetClicked = { data, intent -> + viewModel.onShareTargetClicked(data, this@MainActivity, intent) + }) + } + } + } + } +} + +@Composable +fun MainView( + state: SliceState, + onShareTargetClicked: (ShareTargetData, Intent) -> Unit, +) { + when (state) { + is SliceState.PermissionNeeded -> { + AndroidView(factory = { + val view = SliceView(it) + view.slice = state.slice + return@AndroidView view + }) + } + + is SliceState.Active -> { + var uris by rememberSaveable { mutableStateOf(listOf()) } + val launcher = + rememberLauncherForActivityResult(contract = ActivityResultContracts.GetMultipleContents()) { + uris = it + } + Column { + Button(onClick = { launcher.launch("*/*") }) { Text("Select files") } + if (uris.isNotEmpty()) { + for (uri in uris) { + Text( + uri.toString(), + style = MaterialTheme.typography.bodySmall + ) + } + val sendIntent = + Intent("com.google.android.gms.SHARE_NEARBY").apply { + if (uris.size == 1) { + putExtra(Intent.EXTRA_STREAM, uris[0]) + } else { + putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris.toArrayList()) + } + type = "*/*" + flags = Intent.FLAG_GRANT_READ_URI_PERMISSION + } + val context = LocalContext.current + // We need to call sendIntent.migrateExtraStreamToClipData() to show the preview images on + // Android Q and above but the method is hidden. Hence we call PendingIntent.getActivity as + // a proxy/wrapper which calls the above method. This method can throw exception if files + // are too large. + // We need to call sendIntent.migrateExtraStreamToClipData() to show the preview images on + // Android Q and above but the method is hidden. Hence we call PendingIntent.getActivity as + // a proxy/wrapper which calls the above method. This method can throw exception if files + // are too large. + val pendingIntentFlags = PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT + + PendingIntent.getActivity(context.applicationContext, 0, sendIntent, pendingIntentFlags) + ShareDestinations(sendIntent, state.targets, onShareTargetClicked = { data, intent -> + for (uri in uris) { + context.grantUriPermission( + "com.google.android.gms", + uri, + Intent.FLAG_GRANT_READ_URI_PERMISSION + ) + } + onShareTargetClicked(data, intent) + }) + } + } + } + } +} + +@Composable +fun ShareDestinations( + sendIntent: Intent, + targets: Set, + onShareTargetClicked: (ShareTargetData, Intent) -> Unit, +) { + Card( + modifier = Modifier.padding(16.dp), + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant) + ) { + if (targets.isEmpty()) { + Text("No devices nearby!") + return@Card + } + LazyVerticalGrid(columns = GridCells.Adaptive(minSize = 72.dp)) { + items(targets.toList()) { + ShareTarget(data = it, onShareTargetClicked = { data -> + onShareTargetClicked(data, sendIntent) + }) + } + } + } +} + +private fun List.toArrayList(): java.util.ArrayList { + val list = java.util.ArrayList() + list.addAll(this) + return list +} + +sealed class SliceState { + data class PermissionNeeded(val slice: Slice) : SliceState() + data class Active(val targets: Set) : SliceState() +} diff --git a/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/MainViewModel.kt b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/MainViewModel.kt new file mode 100644 index 00000000..980e9203 --- /dev/null +++ b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/MainViewModel.kt @@ -0,0 +1,139 @@ +/* + * Copyright 2024 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. + */ + +package com.google.nearby.sharedemo + +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.net.Uri +import androidx.core.graphics.drawable.IconCompat +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewmodel.initializer +import androidx.lifecycle.viewmodel.viewModelFactory +import androidx.slice.Slice +import androidx.slice.SliceViewManager +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow + +class MainViewModel(context: Context) : ViewModel() { + private val _targetsFlow: MutableStateFlow = MutableStateFlow(SliceState.Active(setOf())) + val targetsFlow: StateFlow = _targetsFlow.asStateFlow() + + private var targetMapping = mapOf() + + private val sliceManager = SliceViewManager.getInstance(context) + private val sliceCallback: (Slice?) -> Unit = { + targetMapping = parseSlice(it) + if (targetMapping.isEmpty() && it != null) { + _targetsFlow.value = SliceState.PermissionNeeded(it) + } else { + _targetsFlow.value = SliceState.Active(targetMapping.keys) + } + } + + init { + sliceManager.registerSliceCallback(SCAN_SLICE_URI, sliceCallback) + val slice = sliceManager.bindSlice(SCAN_SLICE_URI) + targetMapping = parseSlice(slice) + if (targetMapping.isEmpty() && slice != null) { + _targetsFlow.value = SliceState.PermissionNeeded(slice) + } else { + _targetsFlow.value = SliceState.Active(targetMapping.keys) + } + } + + /** + * This function is run just before the ViewModel is closed, allowing us to unpin the sharing + * slice. + */ + override fun onCleared() { + super.onCleared() + sliceManager.unregisterSliceCallback(SCAN_SLICE_URI, sliceCallback) + } + + /** + * Called when a slice's share target is tapped, as represented by [ShareTarget]. + */ + fun onShareTargetClicked(data: ShareTargetData, context: Context, sendIntent: Intent) { + targetMapping[data]!!.send(context, 0, sendIntent) + } + + private fun parseSlice(slice: Slice?): Map { + android.util.Log.d("NSDemo", "slice: $slice") + if (slice == null) { + return mapOf() + } + val ret = mutableMapOf() + for (targetItem in slice.items.reversed()) { + if (!(targetItem.format == SLICE && targetItem.hints.containsAll(listOf(LIST_ITEM, ACTIVITY)))) { + continue + } + val targetSlice = targetItem.slice + var deviceName: String? = null + var action: PendingIntent? = null + var profileIcon: IconCompat? = null + + for (item in targetSlice.items) { + if (item.format == TEXT && item.hints.contains(TITLE)) { + deviceName = item.text.toString() + } + if (item.format == ACTION && item.hints.containsAll(listOf(SHORTCUT, TITLE))) { + action = item.action + + val iconSlice: Slice? = item.slice + if (iconSlice != null) { + for (iconitem in iconSlice.items) { + if (iconitem.format == IMAGE && iconitem.hints.contains(NO_TINT)) { + profileIcon = iconitem.icon + } + } + } + } + } + // Returns null if the data parsed from the slice is incomplete. + if (deviceName == null || action == null || profileIcon == null) { + continue + } + ret[ShareTargetData(profileIcon, deviceName)] = action + } + return ret + } + + companion object { + private val SCAN_SLICE_URI: Uri = + Uri.parse("content://com.google.android.gms.nearby.sharing/scan") + + // Slice parsing. + private const val SLICE = "slice" + private const val LIST_ITEM = "list_item" + private const val ACTIVITY = "activity" + private const val TEXT = "text" + private const val TITLE = "title" + private const val ACTION = "action" + private const val SHORTCUT = "shortcut" + private const val IMAGE = "image" + private const val NO_TINT = "no_tint" + + val Factory: ViewModelProvider.Factory = viewModelFactory { + initializer { + MainViewModel(this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY]!!) + } + } + } +} diff --git a/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/ShareTarget.kt b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/ShareTarget.kt new file mode 100644 index 00000000..3fd97fc7 --- /dev/null +++ b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/ShareTarget.kt @@ -0,0 +1,59 @@ +/* + * Copyright 2024 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. + */ + +package com.google.nearby.sharedemo + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.asImageBitmap +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.unit.dp +import androidx.core.graphics.drawable.IconCompat +import androidx.core.graphics.drawable.toBitmap + +@Composable +fun ShareTarget(data: ShareTargetData, onShareTargetClicked: (ShareTargetData) -> Unit) { + val context = LocalContext.current + Column( + modifier = Modifier + .padding(8.dp) + .clickable { onShareTargetClicked(data) }, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + data.profileIcon.loadDrawable(context)!!.toBitmap().asImageBitmap(), + contentDescription = null, + tint = Color.Unspecified, + ) + Text( + data.deviceName, + style = MaterialTheme.typography.bodySmall, + ) + } +} + +data class ShareTargetData( + val profileIcon: IconCompat, + val deviceName: String, +) diff --git a/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/ui/theme/Theme.kt b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/ui/theme/Theme.kt new file mode 100644 index 00000000..7c641062 --- /dev/null +++ b/sharing/android/example/app/src/main/java/com/google/nearby/sharedemo/ui/theme/Theme.kt @@ -0,0 +1,67 @@ +/* + * Copyright 2024 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. + */ + +package com.google.nearby.sharedemo.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Typography +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.toArgb +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat + +private val DarkColorScheme = darkColorScheme() + +private val LightColorScheme = lightColorScheme() + +@Composable +fun NearbyShareDemoTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + dynamicLightColorScheme(context) + } + else -> LightColorScheme + } + val view = LocalView.current + if (!view.isInEditMode) { + SideEffect { + val window = (view.context as Activity).window + window.statusBarColor = colorScheme.primary.toArgb() + WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme + } + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography(), + content = content + ) +} diff --git a/sharing/android/example/app/src/main/res/drawable/ic_launcher_background.xml b/sharing/android/example/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 00000000..61bb79ed --- /dev/null +++ b/sharing/android/example/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sharing/android/example/app/src/main/res/drawable/ic_launcher_foreground.xml b/sharing/android/example/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 00000000..04d1a347 --- /dev/null +++ b/sharing/android/example/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/sharing/android/example/app/src/main/res/mipmap-anydpi/ic_launcher.xml b/sharing/android/example/app/src/main/res/mipmap-anydpi/ic_launcher.xml new file mode 100644 index 00000000..3fe24419 --- /dev/null +++ b/sharing/android/example/app/src/main/res/mipmap-anydpi/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/sharing/android/example/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/sharing/android/example/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml new file mode 100644 index 00000000..3fe24419 --- /dev/null +++ b/sharing/android/example/app/src/main/res/mipmap-anydpi/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/sharing/android/example/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/sharing/android/example/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..c209e78e Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/sharing/android/example/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..b2dfe3d1 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/sharing/android/example/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4f0f1d64 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/sharing/android/example/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..62b611da Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/sharing/android/example/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..948a3070 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/sharing/android/example/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..1b9a6956 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/sharing/android/example/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..28d4b77f Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/sharing/android/example/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9287f508 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/sharing/android/example/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..aa7d6427 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/sharing/android/example/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/sharing/android/example/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..9126ae37 Binary files /dev/null and b/sharing/android/example/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/sharing/android/example/app/src/main/res/values/colors.xml b/sharing/android/example/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..758655a2 --- /dev/null +++ b/sharing/android/example/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + diff --git a/sharing/android/example/app/src/main/res/values/strings.xml b/sharing/android/example/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..d31406f5 --- /dev/null +++ b/sharing/android/example/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Nearby Share Demo + diff --git a/sharing/android/example/app/src/main/res/values/themes.xml b/sharing/android/example/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..3632dee2 --- /dev/null +++ b/sharing/android/example/app/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +