Skip to content

Commit 134e3d5

Browse files
committed
Add RFCOMM service
1 parent ab8427a commit 134e3d5

1 file changed

Lines changed: 125 additions & 0 deletions

File tree

pandora/rfcomm.proto

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package pandora.rfcomm;
18+
19+
import "google/protobuf/any.proto";
20+
import "google/protobuf/empty.proto";
21+
import "pandora/host.proto";
22+
23+
option java_outer_classname = "RFCOMMProto";
24+
25+
service RFCOMM {
26+
// List registered RFCOMM channels. (Server only)
27+
rpc ListChannels(ListChannelsRequest) returns (ListChannelsResponse);
28+
// Establish an RFCOMM channel on an ACL connection.
29+
rpc Connect(ConnectRequest) returns (ConnectResponse);
30+
// Wait and accept incoming RFCOMM channels.
31+
rpc OnConnection(OnConnectionRequest) returns (stream OnConnectionResponse);
32+
// Disconnect an RFCOMM channel.
33+
rpc Disconnect(DisconnectRequest) returns (DisconnectResponse);
34+
// Wait an RFCOMM channel to be disconnected.
35+
rpc WaitDisconnection(WaitDisconnectionRequest)
36+
returns (WaitDisconnectionResponse);
37+
// Receive data from an RFCOMM channel.
38+
rpc Receive(ReceiveRequest) returns (stream ReceiveResponse);
39+
// Send data to an RFCOMM channel.
40+
rpc Send(SendRequest) returns (SendResponse);
41+
}
42+
43+
message Channel {
44+
google.protobuf.Any cookie = 1;
45+
}
46+
47+
message ConnectRequest {
48+
// BR/EDR connection.
49+
Connection connection = 1;
50+
oneof type {
51+
// Connect to the given RFCOMM server channel
52+
uint32 channel = 2;
53+
// Discover service with the given UUID, and connect to its included channel
54+
string uuid = 3;
55+
}
56+
}
57+
58+
message ConnectResponse {
59+
oneof result {
60+
Channel channel = 1;
61+
}
62+
}
63+
64+
message OnConnectionRequest {
65+
oneof type {
66+
// Listen on the given RFCOMM server channel
67+
uint32 channel = 1;
68+
// Register SDP entries with given UUID, and allocate an RFCOMM server
69+
// channel
70+
string uuid = 2;
71+
}
72+
}
73+
74+
message OnConnectionResponse {
75+
// BR/EDR connection.
76+
Connection connection = 1;
77+
oneof result {
78+
Channel channel = 2;
79+
}
80+
}
81+
82+
message ListChannelsRequest {}
83+
84+
message ListChannelsResponse {
85+
repeated uint32 channels = 1;
86+
}
87+
88+
message DisconnectRequest {
89+
Channel channel = 1;
90+
}
91+
92+
message DisconnectResponse {
93+
oneof result {
94+
google.protobuf.Empty success = 1;
95+
}
96+
}
97+
98+
message WaitDisconnectionRequest {
99+
Channel channel = 1;
100+
}
101+
102+
message WaitDisconnectionResponse {
103+
oneof result {
104+
google.protobuf.Empty success = 1;
105+
}
106+
}
107+
108+
message ReceiveRequest {
109+
Channel channel = 1;
110+
}
111+
112+
message ReceiveResponse {
113+
bytes data = 1;
114+
}
115+
116+
message SendRequest {
117+
Channel channel = 1;
118+
bytes data = 2;
119+
}
120+
121+
message SendResponse {
122+
oneof result {
123+
google.protobuf.Empty success = 1;
124+
}
125+
}

0 commit comments

Comments
 (0)