1syntax = "proto3";
2
3package bluetooth.l2cap.classic;
4
5import "google/protobuf/empty.proto";
6import "facade/common.proto";
7
8service L2capClassicModuleFacade {
9  rpc FetchConnectionComplete(google.protobuf.Empty) returns (stream ConnectionCompleteEvent) {
10    // Testing Android Bluetooth stack only. Optional for other stack.
11  }
12  rpc FetchConnectionClose(google.protobuf.Empty) returns (stream ConnectionCloseEvent) {
13    // Testing Android Bluetooth stack only. Optional for other stack.
14  }
15  rpc OpenChannel(OpenChannelRequest) returns (google.protobuf.Empty) {}
16  rpc CloseChannel(CloseChannelRequest) returns (google.protobuf.Empty) {}
17  rpc FetchL2capData(google.protobuf.Empty) returns (stream L2capPacket) {}
18  rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (google.protobuf.Empty) {}
19  rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (google.protobuf.Empty) {}
20  rpc SetTrafficPaused(SetTrafficPausedRequest) returns (google.protobuf.Empty) {}
21  rpc GetChannelQueueDepth(google.protobuf.Empty) returns (GetChannelQueueDepthResponse) {
22    // Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer
23    // before L2CAP user dequeues.
24  }
25}
26
27message RegisterChannelRequest {
28  uint32 channel = 1;
29}
30
31message ConnectionCompleteEvent {
32  facade.BluetoothAddress remote = 1;
33}
34
35message ConnectionCloseEvent {
36  facade.BluetoothAddress remote = 1;
37  uint32 reason = 2;
38}
39
40enum RetransmissionFlowControlMode {
41  BASIC = 0;
42  ERTM = 1;
43  ERTM_OPTIONAL = 2;
44}
45
46message OpenChannelRequest {
47  facade.BluetoothAddress remote = 1;
48  uint32 psm = 2;
49  RetransmissionFlowControlMode mode = 3;
50}
51
52message CloseChannelRequest {
53  uint32 psm = 1;
54}
55
56enum ChannelSignalEventType {
57  OPEN = 0;
58  CLOSE = 1;
59  CONFIGURE = 2;
60}
61
62message ChannelSignalEvent {
63  uint32 cid = 1;
64  ChannelSignalEventType type = 2;
65}
66
67enum SendL2capPacketResultType {
68  OK = 0;
69  BAD_CID = 1;
70}
71
72message SendL2capPacketResult {
73  SendL2capPacketResultType result_type = 1;
74}
75
76message L2capPacket {
77  oneof channel_type {
78    uint32 psm = 1;
79    uint32 fixed_cid = 2;
80  }
81  bytes payload = 3;
82}
83
84message SetEnableDynamicChannelRequest {
85  uint32 psm = 1;
86  bool enable = 2;
87  RetransmissionFlowControlMode retransmission_mode = 3;
88}
89
90message DynamicChannelPacket {
91  facade.BluetoothAddress remote = 1;
92  uint32 psm = 2;
93  bytes payload = 3;
94}
95
96message SetTrafficPausedRequest {
97  bool paused = 1;
98  uint32 psm = 2;
99}
100
101message GetChannelQueueDepthResponse {
102  uint32 size = 1;
103}
104
105enum ClassicSecurityPolicy {
106  ENCRYPTED_TRANSPORT = 0;
107  AUTHENTICATED_ENCRYPTED_TRANSPORT = 1;
108  BEST = 2;
109  _SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3;
110}
111