Create dart proto for transferring the data from C++ to flutter app.

- callback: transfer device C++ proto to dart proto
 - device: transfer metadata that get from the observer to dart proto
 - enum: transfer Discovery Action class to dart proto

PiperOrigin-RevId: 538935072
This commit is contained in:
hai007
2023-06-08 17:36:11 -07:00
committed by Copybara-Service
parent 0f59872587
commit 589c126725
6 changed files with 155 additions and 2 deletions
+63
View File
@@ -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.
load("//dart:build_defs.bzl", "dart_proto_library")
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
licenses(["notice"])
proto_library(
name = "fastpair_callback_proto",
srcs = [
"callbacks.proto",
],
deps = [
"//fastpair/proto:fastpair_proto",
],
)
proto_library(
name = "fastpair_device_proto",
srcs = [
"device.proto",
],
)
proto_library(
name = "fastpair_enum_proto",
srcs = [
"enum.proto",
],
)
proto_library(
name = "fastpair_proto",
deps = [
":fastpair_callback_proto",
":fastpair_device_proto",
":fastpair_enum_proto",
],
)
cc_proto_library(
name = "fastpair_cc_proto",
visibility = ["//visibility:public"],
deps = [":fastpair_proto"],
)
dart_proto_library(
name = "fastpair_dart_proto",
visibility = ["//visibility:public"],
deps = [":fastpair_proto"],
)
+29
View File
@@ -0,0 +1,29 @@
// 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 nearby.fastpair.dart.proto;
import "third_party/nearby/fastpair/proto/fastpair_rpcs.proto";
// NextId: 2
message CallbackData {
string message = 1;
}
// NextId: 2
message DeviceDownloadedCallbackData {
repeated nearby.fastpair.proto.Device devices = 1;
}
+26
View File
@@ -0,0 +1,26 @@
// 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 nearby.fastpair.dart.proto;
// Describes a FastPair scanned device. The device class will have more
// properties and methods in the future based on the new feature added.
// NextId: 4
message Device {
string id = 1; // The unique identifier of the device.
string name = 2;
string image_url = 3;
}
+34
View File
@@ -0,0 +1,34 @@
// 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 nearby.fastpair.dart.proto;
// Represents the action after discovery
enum DiscoveryAction {
// Uknown
DISCOVERY_ACTION_UNKNOWN = 0;
// User is willing to pair the discovered device and clicks the connect button
DISCOVERY_ACTION_PAIR_TO_DEVICE = 1;
// User is not willing to pair the discovered device and manually dismiss the
// notification
DISCOVERY_ACTION_DISMISSED_BY_USER = 2;
// OS dismissed
DISCOVERY_ACTION_DISSMISSED_BY_OS = 3;
// User clicks the learn more button
DISCOVERY_ACTION_LEARN_MORE = 4;
// Time out and dismissed automatically
DISCOVERY_ACTION_DISMISSED_BY_TIMEOUT = 5;
}
+3
View File
@@ -8,6 +8,9 @@ proto_library(
"data.proto",
"fastpair_rpcs.proto",
],
visibility = [
"//fastpair:__subpackages__",
],
)
cc_proto_library(
-2
View File
@@ -18,8 +18,6 @@ package nearby.fastpair.proto;
import "third_party/nearby/fastpair/proto/data.proto";
option optimize_for = LITE_RUNTIME;
// Represents the type of device that is being registered.
enum DeviceType {
// Unspecified device type.