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
15syntax = "proto2";
16
17package rootcanal.configuration;
18option optimize_for = CODE_SIZE;
19
20enum ControllerPreset {
21  // Version 5.3, all features enabled, all quirks disabled.
22  DEFAULT = 0;
23  // Official PTS dongle, Laird BL654.
24  LAIRD_BL654 = 1;
25  // Official PTS dongle, CSR rck.
26  CSR_RCK_PTS_DONGLE = 2;
27}
28
29message ControllerFeatures {
30  optional bool le_extended_advertising = 1;
31  optional bool le_periodic_advertising = 2;
32  optional bool ll_privacy = 3;
33  optional bool le_2m_phy = 4;
34  optional bool le_coded_phy = 5;
35  // Enable the support for both LL Connected Isochronous Stream Central
36  // and LL Connected Isochronous Stream Peripheral.
37  optional bool le_connected_isochronous_stream = 6;
38}
39
40message ControllerQuirks {
41  // Randomly send ACL payloads before the Connection Complete event
42  // is sent to the Host stack.
43  optional bool send_acl_data_before_connection_complete = 1;
44  // Configure a default value for the LE random address.
45  optional bool has_default_random_address = 2;
46  // Send an Hardware Error event if any command is called before HCI Reset.
47  optional bool hardware_error_before_reset = 3;
48}
49
50message VendorFeatures {
51  // Enable the support for the CSR vendor command.
52  optional bool csr = 1;
53  // Enable the support for Android vendor commands.
54  // Note: not all required vendor commands are necessarily implemented
55  // in RootCanal, unimplemented commands will return a Command Status or
56  // Command Complete HCI event with the status Unsupported Opcode.
57  optional bool android = 2;
58}
59
60message Controller {
61  // Configure the controller preset. Presets come with a pre-selection
62  // of features and quirks, but these can be overridden with the next fields.
63  optional ControllerPreset preset = 1;
64  // Configure support for controller features.
65  optional ControllerFeatures features = 2;
66  // Enable controller quirks.
67  // Quirks are behaviors observed in real controllers that are not valid
68  // according to the specification.
69  optional ControllerQuirks quirks = 3;
70  // Enable strict mode (defaults to enabled).
71  // Activate assertion checks in RootCanal for missing RootCanal features
72  // or Host stack misbehavior.
73  optional bool strict = 4;
74  // Configure support for vendor features.
75  optional VendorFeatures vendor = 5;
76}
77
78message TcpServer {
79  // Configure the TCP port on which the controller with this defined
80  // configuration will be served.
81  required int32 tcp_port = 1;
82  // Controller configuration for this port.
83  optional Controller configuration = 2;
84}
85
86message Configuration {
87  repeated TcpServer tcp_server = 1;
88}
89