mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Supports Multiplex transmission for Bluetooth to allow multiple clients reuse the existed connection. See go/nc_multiplex for more details.
PiperOrigin-RevId: 517028681
This commit is contained in:
@@ -119,6 +119,11 @@ message ConnectionResponseFrame {
|
||||
}
|
||||
optional ResponseStatus response = 3;
|
||||
optional OsInfo os_info = 4;
|
||||
// A bitmask value to indicate which medium supports Multiplex transmission
|
||||
// feature. Each supporting medium could utilize one bit starting from the
|
||||
// least significant bit in this field. Refer to ClientProxy.java for the bit
|
||||
// usages.
|
||||
optional int32 multiplex_socket_bitmask = 5;
|
||||
}
|
||||
|
||||
message PayloadTransferFrame {
|
||||
|
||||
@@ -563,4 +563,12 @@ enum Description {
|
||||
FEATURE_USB_HOST_NOT_SUPPORTED = 177;
|
||||
FEATURE_USB_ACCESSORY_NOT_SUPPORTED = 178;
|
||||
FEATURE_USB_PORTS_NOT_FOUND = 179;
|
||||
MULTIPLEX_SOCKET_UNKNOWN_ERROR = 180;
|
||||
MULTIPLEX_SOCKET_NOT_LISTENING = 181;
|
||||
MULTIPLEX_SOCKET_DISABLED = 182;
|
||||
MULTIPLEX_SOCKET_TIMEOUT = 183;
|
||||
MULTIPLEX_SOCKET_IOEXCEPTION = 184;
|
||||
MULTIPLEX_SOCKET_UNKNOWN_RESPONSE_CODE = 185;
|
||||
MULTIPLEX_SOCKET_EXECUTION_EXCEPTION = 186;
|
||||
MULTIPLEX_SOCKET_INTERRUPTED_EXCEPTION = 187;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,13 @@ licenses(["notice"])
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
proto_library(
|
||||
name = "multiplex_frames_proto",
|
||||
srcs = [
|
||||
"multiplex_frames.proto",
|
||||
],
|
||||
)
|
||||
|
||||
proto_library(
|
||||
name = "nfc_frames_proto",
|
||||
srcs = [
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
// 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 location.nearby.mediums;
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
option java_outer_classname = "MultiplexFramesProto";
|
||||
option java_package = "com.google.location.nearby.mediums.proto";
|
||||
option objc_class_prefix = "GNCM";
|
||||
|
||||
// The frame used to transmit any type of frame on a virtual socket.
|
||||
message MultiplexFrame {
|
||||
enum MultiplexFrameType {
|
||||
UNKNOWN_FRAME_TYPE = 0;
|
||||
CONTROL_FRAME = 1;
|
||||
DATA_FRAME = 2;
|
||||
}
|
||||
|
||||
optional MultiplexFrameHeader header = 1;
|
||||
optional MultiplexFrameType frame_type = 2;
|
||||
oneof Frame {
|
||||
MultiplexControlFrame control_frame = 3;
|
||||
MultiplexDataFrame data_frame = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message MultiplexFrameHeader {
|
||||
optional bytes service_id_hash = 1;
|
||||
}
|
||||
|
||||
// The control frame to establish, accept, reject or disconnect the virtual
|
||||
// socket.
|
||||
message MultiplexControlFrame {
|
||||
enum MultiplexControlFrameType {
|
||||
UNKNOWN_CONTROL_FRAME_TYPE = 0;
|
||||
CONNECTION_REQUEST = 1;
|
||||
CONNECTION_RESPONSE = 2;
|
||||
DISCONNECTION = 3;
|
||||
}
|
||||
|
||||
optional MultiplexControlFrameType control_frame_type = 1;
|
||||
|
||||
// Exactly one of the following fields will be set.
|
||||
oneof Frame {
|
||||
ConnectionRequestFrame connection_request_frame = 2;
|
||||
ConnectionResponseFrame connection_response_frame = 3;
|
||||
DisconnectFrame disconnect_frame = 4;
|
||||
}
|
||||
}
|
||||
|
||||
// The frame to request a virtual socket for the service ID.
|
||||
message ConnectionRequestFrame {}
|
||||
|
||||
// The frame to accept or reject the CONNECTION_REQUEST.
|
||||
message ConnectionResponseFrame {
|
||||
enum ConnectionResponseCode {
|
||||
UNKNOWN_RESPONSE_CODE = 0;
|
||||
CONNECTION_ACCEPTED = 1;
|
||||
NOT_LISTENING = 2;
|
||||
}
|
||||
|
||||
optional ConnectionResponseCode connection_response_code = 1;
|
||||
}
|
||||
|
||||
// The frame to disconnect the virtual socket.
|
||||
message DisconnectFrame {}
|
||||
|
||||
// The data frame used to transmit the data type bytes on a virtual socket.
|
||||
message MultiplexDataFrame {
|
||||
optional bytes data = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user