Remove ConnectionsLog proto.

PiperOrigin-RevId: 925117791
This commit is contained in:
Francis Tsui
2026-06-01 22:33:25 -07:00
committed by Copybara-Service
parent 0e96ed9795
commit 28b1118c53
3 changed files with 0 additions and 952 deletions
-76
View File
@@ -1,76 +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.
load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
load("@com_google_protobuf//bazel:java_lite_proto_library.bzl", "java_lite_proto_library")
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@com_google_protobuf//rust:defs.bzl", "rust_proto_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
proto_library(
name = "connections_log_proto",
srcs = [
"connections_log.proto",
],
compatible_with = ["//buildenv/target:non_prod"],
deps = [
"//proto:connections_enums_proto",
"//proto/errorcode:error_code_enums_proto",
"//storage/datapol/annotations/proto:datapol_annotations",
],
)
cc_proto_library(
name = "connections_log_cc_proto",
compatible_with = ["//buildenv/target:non_prod"],
visibility = [
"//connections:__subpackages__",
"//internal/analytics:__pkg__",
"//location/nearby/analytics/cpp:__subpackages__",
],
deps = [":connections_log_proto"],
)
cc_test(
name = "proto_analytics_test",
size = "small",
srcs = [
"connections_log_test.cc",
],
shard_count = 16,
deps = [
":connections_log_cc_proto",
"//internal/platform:logging",
"//internal/platform/implementation/g3", # build_cleaner: keep
"//logs/proto/location/nearby:nearby_client_log_cc_proto",
"//proto:connections_enums_cc_proto",
"@com_github_protobuf_matchers//protobuf-matchers",
"@com_google_googletest//:gtest_main",
"@com_google_protobuf//:protobuf",
],
)
rust_proto_library(
name = "connections_log_rust_proto",
deps = [":connections_log_proto"],
)
java_lite_proto_library(
name = "connections_log_java_proto_lite",
deps = [":connections_log_proto"],
)
@@ -1,752 +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.
syntax = "proto2";
package location.nearby.analytics.proto;
// import "storage/datapol/annotations/proto/semantic_annotations.proto";
import "proto/connections_enums.proto";
import "proto/errorcode/error_code_enums.proto";
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.location.nearby.analytics.proto";
option java_outer_classname = "ConnectionsLogProto";
option objc_class_prefix = "GNCP";
// Top-level log proto for Nearby Connections.
// LINT.IfChange(ConnectionsLog)
// Next Tag: 7
message ConnectionsLog {
// The type of this log.
optional location.nearby.proto.connections.EventType event_type = 1;
// Non-null for EventType.CLIENT_SESSION.
// Encapsulates all client activity between connecting to and disconnecting
// from the Nearby Connections API via Client.
optional ClientSession client_session = 2;
// The version of Nearby Connections. E.g. "v1.0.4".
optional string version = 3 /* type = ST_SOFTWARE_ID */;
// For EventType.ERROR_CODE
optional ErrorCode error_code = 4;
// Indicates the source of the log.
optional location.nearby.proto.connections.LogSource log_source = 5;
// This is a temporary logging field for FilesGo migration phase based on
// device geolocation. Example values are "P1", "P2", "PA" etc.
// In files migration, we have different phases to rollout Files-> Nearby
// migration on different list of countries. For example, at phase A (PA),
// the migration happens in Asian countries; P1 for Europe countries; P2
// for North and South Americas.
// Reference: http://shortn/_9smZZ8CTD6, http://shortn/_Y08gVwZRKc
optional string files_migration_phase = 6;
// Encapsulates one session of a client connected to Nearby Connections API.
message ClientSession {
// Elapsed time in milliseconds between Client connect and
// disconnect.
optional int64 duration_millis = 1;
// 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 */;
reserved 5; // device type isdeprecated and moved to StrategySession
}
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.
message StrategySession {
// Elapsed time in milliseconds between a call to startAdvertising/Discovery
// and the end of this particular Strategy. A StrategySession may end due to
// - the client disconnecting from Client;
// - a call to stopAllEndpoints, which disconnects all endpoints and
// stops any advertising/discovery;
// - a new call to startAdvertising/Discovery.
optional int64 duration_millis = 1;
// The Strategy used for this session.
optional location.nearby.proto.connections.ConnectionsStrategy strategy = 2;
// The role(s) played by this device during this StrategySession.
repeated location.nearby.proto.connections.SessionRole role = 3;
// One or more of the following *Phase is present, depending on the role(s).
// Encapsulates discovery information.
repeated DiscoveryPhase discovery_phase = 4;
// Encapsulates advertising information.
repeated AdvertisingPhase advertising_phase = 5;
// Attempts at establishing a connection to another device.
repeated ConnectionAttempt connection_attempt = 6;
// Successful and accepted connections to another device.
repeated EstablishedConnection established_connection = 7;
// Attempts to upgrade a connection from one medium to another.
repeated BandwidthUpgradeAttempt upgrade_attempt = 9;
// The build version of the user's device (Same value as the Build number in
// Settings -> about phone).
optional string build_version = 10
/* type = ST_SOFTWARE_ID */;
}
// Encapsulates activity during a period of discovery.
message DiscoveryPhase {
// Elapsed time in milliseconds between startDiscovery and stopDiscovery.
optional int64 duration_millis = 1;
// The Medium(s) used for discovery.
repeated location.nearby.proto.connections.Medium medium = 2;
// Discovered endpoints during this round of discovery.
repeated DiscoveredEndpoint discovered_endpoint = 3;
// Attempted ConnectionRequests (requested by the client). They may or
// may not reach the other endpoint.
repeated ConnectionRequest sent_connection_request = 4;
// UWB ranging related data during discovery (May range with multiple
// endpoints)
repeated UwbRangingProcess uwb_ranging = 5;
// The SendingEvent flow id.
optional int64 client_flow_id = 6 /* type = ST_SESSION_ID */;
// 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;
// The type of the device.
optional location.nearby.proto.connections.DeviceType device_type = 10;
// The supported service.
optional location.nearby.proto.connections.SupportedService
supported_service = 11;
}
// An endpoint discovered on a particular medium during discovery.
message DiscoveredEndpoint {
// The medium on which this endpoint was discovered.
optional location.nearby.proto.connections.Medium medium = 1;
// Elapsed time between the call to startDiscovery() and the time at which
// this endpoint was discovered.
optional int64 latency_millis = 2;
}
// Encapsulates activity during UWB ranging.
message UwbRangingProcess {
// Elapsed time in milliseconds between startRanging and stopRanging.
optional int64 duration_millis = 1;
// UWB raw ranging data received during discovery. This is optional. Only
// certain devices (Debug/Testing etc.) will log the raw data.
repeated RawUwbRangingEvent uwb_ranging_data = 2;
// Number of ranging data received
optional int32 number_of_ranging_data = 3;
// The minimum distance during a UWB ranging session
optional int32 distance_min = 4;
// The maximum distance during a UWB ranging session
optional int32 distance_max = 5;
// The average distance during a UWB ranging session
optional int32 distance_ave = 6;
// The distance variance during a UWB ranging session
optional int32 distance_variance = 7;
// The minimum AoA during a UWB ranging session
optional int32 azimuth_min = 8;
// The maximum AoA during a UWB ranging session
optional int32 azimuth_max = 9;
// The average AoA during a UWB ranging session
optional int32 azimuth_ave = 10;
// The AoA variance during a UWB ranging session
optional int32 azimuth_variance = 11;
}
// Ranging data received during discovery phase.
message RawUwbRangingEvent {
// Distance in cm
optional int32 distance = 1;
// Azimuth angle in degree
optional int32 azimuth_angle = 2;
// Polar angle in degree (0 if the device doesn't support it)
optional int32 polar_angle = 3;
}
// Encapsulates activity during a period of advertising.
message AdvertisingPhase {
// Elapsed time in milliseconds between startAdvertising and
// stopAdvertising.
optional int64 duration_millis = 1;
// The Medium(s) used for advertising.
repeated location.nearby.proto.connections.Medium medium = 2;
// Received ConnectionRequests from remote endpoints.
repeated ConnectionRequest received_connection_request = 3;
// The ReceivingEvent flow id.
optional int64 client_flow_id = 4 /* type = ST_SESSION_ID */;
// 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;
// The type of the device.
optional location.nearby.proto.connections.DeviceType device_type = 8;
// The supported service.
optional location.nearby.proto.connections.SupportedService
supported_service = 9;
}
// A request to connect, corresponding to the API's concept of
// request/accept/rejectConnection().
message ConnectionRequest {
// Elapsed time in milliseconds between the connection request being
// initiated and the responses being received.
optional int64 duration_millis = 1;
// Elapsed time in milliseconds between the start of the containing
// Advertising/DiscoveryPhase and the start of this ConnectionRequest, i.e.
// the time at which the request is sent (on the discoverer, at the request
// of the client) or received (on the advertiser, over the wire from the
// remote endpoint).
optional int64 request_delay_millis = 2;
// The local endpoint's response to this connection request.
optional location.nearby.proto.connections.ConnectionRequestResponse
local_response = 3;
// The remote endpoint's response to this connection request.
optional location.nearby.proto.connections.ConnectionRequestResponse
remote_response = 4;
// The SendingEvent flow id.
optional int64 client_flow_id = 5 /* type = ST_SESSION_ID */;
}
// An attempt to connect to an endpoint over a particular medium.
message ConnectionAttempt {
// Elapsed time in milliseconds between starting the connection attempt
// and succeeding/failing.
optional int64 duration_millis = 1;
// The type of connection attempt.
optional location.nearby.proto.connections.ConnectionAttemptType type = 2;
// The direction (incoming vs outgoing) of this attempt.
optional location.nearby.proto.connections.ConnectionAttemptDirection
direction = 3;
// The Medium of this connection attempt.
optional location.nearby.proto.connections.Medium medium = 4;
// The result of the connection attempt.
optional location.nearby.proto.connections.ConnectionAttemptResult
attempt_result = 5;
// The ReceivingEvent flow id.
optional int64 client_flow_id = 6 /* type = ST_SESSION_ID */;
// The token used to identify this connection pair.
optional string connection_token = 7
/* type = ST_SESSION_ID */;
// 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;
// The type of the device.
optional location.nearby.proto.connections.DeviceType device_type = 11;
// The supported service.
optional location.nearby.proto.connections.SupportedService
supported_service = 12;
// The latency of the wifi connection in milliseconds, starting from when
// the wifi credentials are received from the remote device, to the moment
// wifi connection is established with internet access.
optional int64 wifi_connection_latency_millis = 13;
// The latency of the device attestation in milliseconds, starting from when
// the device attestation is initiated, to the moment the device attestation
// is finished.
optional int64 device_attestation_latency_millis = 14;
// The error code returned by Play Integrity API during device attestation.
optional int64 play_integrity_error_code = 15;
// If this connection is forced over USB.
optional bool is_forced_usb = 16;
}
message DeviceInfo {
enum Platform {
UNKNOWN = 0;
ANDROID = 1;
IOS = 2;
CROS = 3;
WINDOWS = 4;
}
optional string device_model = 1;
optional Platform device_platform = 2;
optional string country_code = 3;
optional string manufacturer = 4;
}
message DisconnectionReasonDetail {
enum DisconnectionReason {
UNKNOWN_DISCONNECTION_REASON = 0;
DCT_ERROR_MDNS_DISCOVERY_TIMEOUT = 1;
DCT_ERROR_MDNS_REGISTER_SERVICE = 2;
DCT_ERROR_SUBSEQUENT_TLS_SPAKE = 3;
DCT_ERROR_REQUEST_FAILED = 4;
DCT_ERROR_RESPONSE_FAILED = 5;
DCT_ERROR_CONTROL_MESSAGE_EXCHANGE = 6;
DCT_ERROR_CAPABILITY_MISMATCH = 7;
DCT_ERROR_HIGH_SPEED_MEDIUM_UNAVAILABLE = 8;
DCT_ERROR_WIFI_DISABLED = 9;
DCT_ERROR_WIFI_DISCONNECTED = 10;
DCT_ERROR_WIFI_CREDENTIAL_TRANSFER = 11;
DCT_ERROR_WIFI_INTERNET_CONNECTION = 12;
DCT_ERROR_UPGRADE_HIGH_SPEED_MEDIUM_FAILED = 13;
DCT_ERROR_USER_CANCELLED = 14;
DCT_ERROR_SERVICE_CANCELLED = 15;
DCT_ERROR_UNVERIFIED_INTEGRITY = 16;
SESSION_SUCCESS = 17;
}
optional bool is_local_disconnection = 1;
optional DisconnectionReason disconnection_reason = 2;
}
// A successfully-established connection over a particular medium.
message EstablishedConnection {
enum SafeDisconnectionResult {
UNKNOWN_SAFE_DISCONNECTION_RESULT = 0;
SAFE_DISCONNECTION = 1;
UNSAFE_DISCONNECTION = 2;
}
// Elapsed time in milliseconds that the connection is active.
optional int64 duration_millis = 1;
// The Medium of this connection.
optional location.nearby.proto.connections.Medium medium = 2;
// Payloads sent over this connection.
repeated Payload sent_payload = 3;
// Payloads received over this connection.
repeated Payload received_payload = 4;
// The reason this connection was disconnected.
optional location.nearby.proto.connections.DisconnectionReason
disconnection_reason = 5;
// The SendingEvent flow id.
optional int64 client_flow_id = 6 /* type = ST_SESSION_ID */;
// The token use to identify this established connection.
optional string connection_token = 7
/* type = ST_SESSION_ID */;
// The type of established connection.
optional location.nearby.proto.connections.ConnectionAttemptType type = 8;
// If this is a safe disconnection.
optional SafeDisconnectionResult safe_disconnection_result = 9;
// The result code of this established connection
optional OperationResult operation_result = 10;
// The remote device info
optional DeviceInfo remote_device_info = 11;
// The disconnection reason details
optional DisconnectionReasonDetail disconnection_reason_detail = 12;
// The type of the device.
optional location.nearby.proto.connections.DeviceType device_type = 13;
// The supported service.
optional location.nearby.proto.connections.SupportedService
supported_service = 14;
// The speed test report.
optional SpeedTestReport speed_test_report = 15;
// The count of long inactivity events without any payload transfer.
optional int32 inactivity_count = 16;
// The RSSI (radio signal strength indicator) in dBm.
// INTERNET_RSSI_UNKNOWN (-127) if unknown.
optional int32 rssi = 17;
// If this connection is forced over USB.
optional bool is_forced_usb = 18;
}
message SpeedTestReport {
// The throughput in kbytes per second.
optional int32 throughput_kbytes_per_sec = 1;
// Whether the throughput is incoming or outgoing.
optional bool is_incoming = 2;
}
// Contains the transfer statistics for a DCT payload.
message DctPayloadTransferStats {
// The type of the DCT payload.
// Note: For legacy payloads, the type is logged in the Payload message
// instead.
optional location.nearby.proto.connections.DctPayloadType type = 1;
// Indicates whether the payload was sent using the multipart protocol.
// True if multipart was used, false otherwise.
optional bool is_multipart = 2;
// The number of parts that were successfully transferred.
// This field is only meaningful when is_multipart is true.
// The counting method differs for outgoing and incoming multipart payloads:
// - OUTGOING: All parts associated with the same request are treated as one
// payload. This field increments by 1 if the payload transfers
// successfully.
// - INCOMING: Each part of the incoming multipart payload is logged
// individually. This field increments for each successfully received
// part.
optional int32 num_parts_success = 3;
// The number of parts that failed to transfer.
// This field is only meaningful when is_multipart is true.
// The counting method differs for outgoing and incoming multipart payloads:
// - OUTGOING: All parts associated with the same request are treated as one
// payload. This field increments by 1 if the payload fails to transfer.
// - INCOMING: Each part of the incoming multipart payload is logged
// individually. This field increments for each part that fails to be
// received.
optional int32 num_parts_failure = 4;
// True if this payload transfer is an attempt to resume an interrupted
// payload after a reconnection. False if it's a new payload transfer.
optional bool is_resumption = 5;
// The data speed report in kbyte per second using global bytes counter
optional int32 data_speed_report_kbyte_per_sec = 6;
}
// A Payload transferred (or attempted to be transferred) between devices.
message Payload {
// Elapsed time in milliseconds that num_bytes_transferred took to transfer.
optional int64 duration_millis = 1;
// The type of this payload.
optional location.nearby.proto.connections.PayloadType type = 2;
// Total size of the payload in bytes.
optional int64 total_size_bytes = 3;
// Total number of bytes transferred successfully.
optional int64 num_bytes_transferred = 4;
// The number of chunks used to transfer num_bytes_transferred.
optional int32 num_chunks = 5;
// The end status of the payload transfer.
optional location.nearby.proto.connections.PayloadStatus status = 6;
// 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;
// Statistics for DCT payloads, e.g., type, multipart details. Populated
// only for DCT payloads.
optional DctPayloadTransferStats dct_payload_transfer_stats = 10;
}
// An attempt to upgrade an existing connection from one medium to another.
message BandwidthUpgradeAttempt {
// The direction (incoming vs outgoing) of the upgrade attempt.
optional location.nearby.proto.connections.ConnectionAttemptDirection
direction = 1;
// Elapsed time in milliseconds of the upgrade attempt.
optional int64 duration_millis = 2;
// The original medium (e.g. bluetooth).
optional location.nearby.proto.connections.Medium from_medium = 3;
// The new medium that we're hoping to upgrade to (e.g. wifi).
optional location.nearby.proto.connections.Medium to_medium = 4;
// The result of the upgrade attempt.
optional location.nearby.proto.connections.BandwidthUpgradeResult
upgrade_result = 5;
// If upgrade_result is not success, the stage at which the error occurred.
optional location.nearby.proto.connections.BandwidthUpgradeErrorStage
error_stage = 6;
// The SendingEvent flow id.
optional int64 client_flow_id = 7 /* type = ST_SESSION_ID */;
// 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;
optional location.nearby.proto.connections.DeviceType device_type = 10;
// The supported service.
optional location.nearby.proto.connections.SupportedService
supported_service = 11;
// The number of network interfaces on the device for the upgrade medium
// that can be used for bandwidth upgrade.
optional int32 num_interfaces = 12;
// The number of network interfaces on the device for the upgrade medium
// that can be used for bandwidth upgrade and are IPv6 only.
optional int32 num_ipv6_only_interfaces = 13;
// The number of times the upgrade attempt is tried.
// This count is reset to 0 when the upgrade is successful.
optional int32 try_count = 14;
// If true, the upgrade attempt is forced to use the USB medium, regardless
// of the available mediums.
optional bool is_forced_usb = 15;
}
// Next Id: 22
message ErrorCode {
// The direction (incoming vs outgoing) of this error.
optional location.nearby.proto.connections.ConnectionAttemptDirection
direction = 1;
optional string service_id = 2;
// The error medium (e.g. bluetooth).
optional location.nearby.proto.connections.Medium medium = 3;
// The event which the error occurs on.
optional location.nearby.errorcode.proto.Event event = 4;
// The error description.
optional location.nearby.errorcode.proto.Description description = 5;
// The flow id which the error occurs on.
optional int64 flow_id = 6 /* type = ST_SESSION_ID */;
// Error code value
oneof ErrorCodeDetail {
location.nearby.errorcode.proto.CommonError common_error = 7;
location.nearby.errorcode.proto.StartAdvertisingError
start_advertising_error = 8;
location.nearby.errorcode.proto.StartDiscoveringError
start_discovering_error = 9;
location.nearby.errorcode.proto.StopAdvertisingError
stop_advertising_error = 10;
location.nearby.errorcode.proto.StopDiscoveringError
stop_discovering_error = 11;
location.nearby.errorcode.proto.StartListeningIncomingConnectionError
start_listening_incoming_connection_error = 12;
location.nearby.errorcode.proto.StopListeningIncomingConnectionError
stop_listening_incoming_connection_error = 13;
location.nearby.errorcode.proto.ConnectError connect_error = 14;
location.nearby.errorcode.proto.DisconnectError disconnect_error = 15;
location.nearby.errorcode.proto.SendPayloadError send_payload_error = 17;
location.nearby.errorcode.proto.ReceivePayloadError
receive_payload_error = 18;
location.nearby.errorcode.proto.UpgradeError upgrade_error = 19;
location.nearby.errorcode.proto.AcceptConnectionError
accept_connection_error = 20;
location.nearby.errorcode.proto.RejectConnectionError
reject_connection_error = 21;
}
// The token use to identify this established connection.
optional string connection_token = 16
/* type = ST_SESSION_ID */;
}
// Some additional information to keep with the advertising phase.
message AdvertisingMetadata {
// The bluetooth low energy extended advertisement support status.
optional bool supports_extended_ble_advertisements = 1;
// The frequency of the connected WiFi AP.
optional int32 connected_ap_frequency = 2;
// The NFC (Near Field Communication) support status
optional bool supports_nfc_technology = 3;
// The Bluetooth multiple advertisement support status.
optional bool multiple_advertisement_supported = 4;
// 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.
message DiscoveryMetadata {
// The bluetooth low energy extended advertisement support status.
optional bool supports_extended_ble_advertisements = 1;
// The frequency of the connected WiFi AP.
optional int32 connected_ap_frequency = 2;
// The NFC (Near Field Communication) support status
optional bool supports_nfc_technology = 3;
// The power level of this discovering
optional location.nearby.proto.connections.PowerLevel power_level = 4;
}
// Some additional information to keep with the connection attempt.
message ConnectionAttemptMetadata {
// The technology used by the mediums.
optional location.nearby.proto.connections.ConnectionTechnology technology =
1;
// The wifi band used by the wifi mediums.
optional location.nearby.proto.connections.ConnectionBand band = 2;
// The frequency used by the wifi mediums.
optional int32 frequency = 3;
// The MCC (Mobile country code) MNC (Mobile network code) of the network
// operator.
optional string network_operator = 4
/* type = ST_LOCATION */;
// The upper-case ISO 3166-1 alpha-2 country code of:
// 1. the current connected WiFi network
// 2. or the current registered operator's MCC (Mobile Country Code)
// 3. or empty string.
optional string country_code = 5 /* type = ST_LOCATION */;
// The TDLS status used by the wifi lan medium,
// TDLS, shortened from Tunneled Direct Link Setup, is "a seamless way to
// stream media and other data faster between devices already on the same
// Wi-Fi network." Devices using it communicate directly with one another,
// without involving the wireless network's router.
optional bool is_tdls_used = 6;
// The try times for this hosted group or connection operation.
optional int32 try_counts = 7;
// The enabled status of the wifi hotspot(tethering) when doing this
// connection attempt.
optional bool wifi_hotspot_status = 8;
// The MAX supported TX link speed (Mbps).
optional int32 max_tx_speed = 9;
// The MAX supported RX link speed (Mbps).
optional int32 max_rx_speed = 10;
// The connected wifi channel width.
optional int32 wifi_channel_width = 11;
// The send buffer size of the created socket
optional int32 send_buffer_size = 12;
// The receive buffer size of the created socket
optional int32 receive_buffer_size = 13;
// The frequency of the connected WiFi AP.
optional int32 connected_ap_frequency = 14;
// The connectivity MCC mode
optional bool is_mcc_mode = 15;
}
}
// LINT.ThenChange()
@@ -1,124 +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 "logs/proto/location/nearby/nearby_client_log.proto.h"
#include "google/protobuf/descriptor.h"
#include "gtest/gtest.h"
#include "internal/platform/logging.h"
#include "internal/proto/analytics/connections_log.pb.h"
#include "proto/connections_enums.pb.h"
namespace nearby {
namespace analytics {
namespace proto {
namespace {
using G3ConnectionsLog = ::location::nearby::analytics::proto::ConnectionsLog;
using P3ConnectionsLog = ::location::nearby::analytics::proto::ConnectionsLog;
using ::proto2::Descriptor;
using ::proto2::FieldDescriptor;
// Forward declaration.
bool Compare(const Descriptor* desc1, const Descriptor* desc2);
// Compares the two field descriptors and return false if name, number, label,
// or type is different.
bool Compare(const FieldDescriptor* field1, const FieldDescriptor* field2) {
if (field1->name() != field2->name()) {
LOG(WARNING) << "Field name diff: " << field1->name() << " <=> "
<< field2->name();
return false;
}
if (field1->number() != field2->number()) {
LOG(WARNING) << "Field " << field1->name()
<< " number diff: " << field1->number() << " <=> "
<< field2->number();
return false;
}
if (field1->label() != field2->label()) {
LOG(WARNING) << "Field " << field1->name()
<< " label diff: " << field1->label() << " <=> "
<< field2->label();
return false;
}
bool bRet = false;
if (field1->type() != field2->type()) {
LOG(WARNING) << "Field " << field1->name()
<< " type diff: " << field1->type() << " <=> "
<< field2->type();
return bRet;
} else if (field1->type() == FieldDescriptor::TYPE_MESSAGE) {
const Descriptor* msg1 = field1->message_type();
const Descriptor* msg2 = field2->message_type();
bRet = Compare(msg1, msg2);
} else {
bRet = true;
}
return bRet;
}
// Compares the two descriptors and return false immediately if different.
bool Compare(const Descriptor* desc1, const Descriptor* desc2) {
LOG(INFO) << "Descriptor1 full name: " << desc1->full_name() << " <=> "
<< desc2->full_name();
for (int i = 0; i < desc1->field_count(); ++i) {
const FieldDescriptor* field1 = desc1->field(i);
const FieldDescriptor* field2 = desc2->FindFieldByName(field1->name());
bool bRet = false;
if (field2) {
bRet = Compare(field1, field2);
} else {
LOG(ERROR) << "Descriptor1 full name: " << desc1->full_name()
<< "=> Extra field1 name=" << field1->name()
<< ", number=" << field1->number()
<< ", label=" << field1->label()
<< ", type=" << field1->type();
}
if (!bRet) {
return false;
}
}
for (int i = 0; i < desc2->field_count(); ++i) {
const FieldDescriptor* field2 = desc2->field(i);
const FieldDescriptor* field1 = desc1->FindFieldByName(field2->name());
if (!field1) {
LOG(ERROR) << "Descriptor2 full name: " << desc2->full_name()
<< "=> Extra field2 name=" << field2->name()
<< ", number=" << field2->number()
<< ", label=" << field2->label()
<< ", type=" << field2->type();
return false;
}
}
return true;
}
TEST(ConnectionsLogTest, TwoMessagesAreIdentical) {
const proto2::Descriptor* descriptor1 = G3ConnectionsLog::descriptor();
const proto2::Descriptor* descriptor2 = P3ConnectionsLog::descriptor();
EXPECT_TRUE(Compare(descriptor1, descriptor2));
}
} // namespace
} // namespace proto
} // namespace analytics
} // namespace nearby