1syntax = "proto3";
2
3package blueberry.facade.hci;
4
5import "google/protobuf/empty.proto";
6import "blueberry/facade/common.proto";
7
8service LeAdvertisingManagerFacade {
9  rpc CreateAdvertiser(CreateAdvertiserRequest) returns (CreateAdvertiserResponse) {}
10  rpc ExtendedCreateAdvertiser(ExtendedCreateAdvertiserRequest) returns (ExtendedCreateAdvertiserResponse) {}
11  rpc EnableAdvertiser(EnableAdvertiserRequest) returns (google.protobuf.Empty) {}
12  rpc SetData(SetDataRequest) returns (google.protobuf.Empty) {}
13  rpc SetParameters(SetParametersRequest) returns (google.protobuf.Empty) {}
14  rpc SetPeriodicParameters(SetPeriodicParametersRequest) returns (google.protobuf.Empty) {}
15  rpc SetPeriodicData(SetPeriodicDataRequest) returns (google.protobuf.Empty) {}
16  rpc EnablePeriodicAdvertising(EnablePeriodicAdvertisingRequest) returns (google.protobuf.Empty) {}
17  rpc GetOwnAddress(GetOwnAddressRequest) returns (google.protobuf.Empty) {}
18  rpc GetNumberOfAdvertisingInstances(google.protobuf.Empty) returns (GetNumberOfAdvertisingInstancesResponse) {}
19  rpc RemoveAdvertiser(RemoveAdvertiserRequest) returns (google.protobuf.Empty) {}
20  rpc FetchCallbackEvents(google.protobuf.Empty) returns (stream AdvertisingCallbackMsg) {}
21  rpc FetchAddressEvents(google.protobuf.Empty) returns (stream AddressMsg) {}
22}
23
24message GapDataMsg {
25  bytes data = 1;
26}
27
28enum AdvertisingEventType {
29  ADV_IND = 0x0;
30  ADV_DIRECT_IND = 0x1;
31  ADV_SCAN_IND = 0x2;
32  ADV_NONCONN_IND = 0x3;
33  ADV_DIRECT_IND_LOW = 0x4;
34}
35
36enum AdvertisingFilterPolicy {
37  ALL_DEVICES = 0x0;
38  LISTED_SCAN = 0x1;
39  LISTED_CONNECT = 0x2;
40  LISTED_SCAN_AND_CONNECT = 0x3;
41};
42
43enum AdvertisingProperty {
44  NONE = 0x00;
45  INCLUDE_TX_POWER = 0x06;
46};
47
48enum AdvertisingStatus {
49  ADV_SUCCESS = 0x00;
50  ADV_DATA_TOO_LARGE = 0x01;
51  ADV_TOO_MANY_ADVERTISERS = 0x02;
52  ADV_ALREADY_STARTED = 0x03;
53  ADV_INTERNAL_ERROR = 0x04;
54  ADV_FEATURE_UNSUPPORTED = 0x05;
55};
56
57message AdvertisingConfig {
58  repeated GapDataMsg advertisement = 1;
59  repeated GapDataMsg scan_response = 2;
60  // Unit: number of Bluetooth slots in 0.125 ms increment
61  int32 interval_min = 4;
62  // Unit: number of Bluetooth slots in 0.125 ms increment
63  int32 interval_max = 5;
64  AdvertisingEventType advertising_type = 6;
65  blueberry.facade.BluetoothOwnAddressTypeEnum own_address_type = 7;
66  blueberry.facade.BluetoothPeerAddressTypeEnum peer_address_type = 8;
67  blueberry.facade.BluetoothAddress peer_address = 9;
68  int32 channel_map = 10;
69  AdvertisingFilterPolicy filter_policy = 11;
70  int32 tx_power = 12;
71}
72
73message ExtendedAdvertisingConfig {
74  AdvertisingConfig advertising_config = 1;
75  bool connectable = 2;
76  bool scannable = 3;
77  bool directed = 4;
78  bool high_duty_directed_connectable = 5;
79  bool legacy_pdus = 6;
80  bool anonymous = 7;
81  bool include_tx_power = 8;
82  bool use_le_coded_phy = 9;
83  int32 secondary_max_skip = 10;
84  int32 secondary_advertising_phy = 11;
85  int32 sid = 12;
86  bool enable_scan_request_notifications = 13;
87}
88
89message PeriodicAdvertisingParameters {
90  int32 min_interval = 1;
91  int32 max_interval = 2;
92  AdvertisingProperty advertising_property = 3;
93}
94
95message CreateAdvertiserRequest {
96  AdvertisingConfig config = 1;
97}
98
99message CreateAdvertiserResponse {
100  // -1 on error
101  int32 advertiser_id = 1;
102}
103
104message ExtendedCreateAdvertiserRequest {
105  ExtendedAdvertisingConfig config = 1;
106}
107
108message ExtendedCreateAdvertiserResponse {
109  // -1 on error
110  int32 advertiser_id = 1;
111}
112
113message EnableAdvertiserRequest {
114  int32 advertiser_id = 1;
115  bool enable = 2;
116}
117
118message SetDataRequest {
119  int32 advertiser_id = 1;
120  bool set_scan_rsp = 2;
121  repeated GapDataMsg data = 3;
122}
123
124message SetParametersRequest {
125  int32 advertiser_id = 1;
126  AdvertisingConfig config = 2;
127}
128
129message SetPeriodicParametersRequest {
130  int32 advertiser_id = 1;
131  PeriodicAdvertisingParameters config = 2;
132}
133
134message SetPeriodicDataRequest {
135  int32 advertiser_id = 1;
136  repeated GapDataMsg data = 2;
137}
138
139message EnablePeriodicAdvertisingRequest {
140  int32 advertiser_id = 1;
141  bool enable = 2;
142  bool include_adi = 3;
143}
144
145message GetOwnAddressRequest {
146  int32 advertiser_id = 1;
147}
148
149message GetNumberOfAdvertisingInstancesResponse {
150  int32 num_advertising_instances = 1;
151}
152
153message RemoveAdvertiserRequest {
154  int32 advertiser_id = 1;
155}
156
157enum AdvertisingCallbackMsgType {
158  ADVERTISING_SET_STARTED = 0;
159  ADVERTISING_ENABLED = 1;
160  ADVERTISING_DATA_SET = 2;
161  SCAN_RESPONSE_DATA_SET = 3;
162  ADVERTISING_PARAMETERS_UPDATED = 4;
163  PERIODIC_ADVERTISING_PARAMETERS_UPDATED = 5;
164  PERIODIC_ADVERTISING_DATA_SET = 6;
165  PERIODIC_ADVERTISING_ENABLED = 7;
166  OWN_ADDRESS_READ = 8;
167}
168
169message AdvertisingCallbackMsg {
170  AdvertisingCallbackMsgType message_type = 1;
171  uint32 advertiser_id = 2;
172  AdvertisingStatus status = 3;
173  uint32 data = 4;
174}
175
176message AddressMsg {
177  AdvertisingCallbackMsgType message_type = 1;
178  uint32 advertiser_id = 2;
179  blueberry.facade.BluetoothAddressWithType address = 3;
180}
181