blob: d4c7c3d02805154d2444a1ae311222c3b7e670fe [file] [log] [blame]
weicesunb989a182021-11-04 14:14:54 -07001syntax = "proto3";
2package service.proto;
3import "src/fastpair/rpcs.proto";
weicesun421e0752021-11-11 18:25:00 -08004import "src/fastpair/fast_pair_string.proto";
weicesunb989a182021-11-04 14:14:54 -07005
6// db information for Fast Pair that gets from server.
7message ServerResponseDbItem {
8 // Device's model id.
9 string model_id = 1;
10
11 // Response was received from the server. Contains data needed to display
12 // FastPair notification such as device name, txPower of device, image used
13 // in the notification, etc.
14 GetObservedDeviceResponse get_observed_device_response = 2;
15
16 // The timestamp that make the server fetch.
17 int64 last_fetch_info_timestamp_millis = 3;
18
19 // Whether the item in the cache is expirable or not (when offline mode this
20 // will be false).
weicesun421e0752021-11-11 18:25:00 -080021 bool expirable = 4;
22}
23
24
25// Client side scan result.
26message StoredScanResult {
27 // REQUIRED
28 // Unique ID generated based on scan result
29 string id = 1;
30
31 // REQUIRED
32 NearbyType type = 2;
33
34 // REQUIRED
35 // The most recent all upper case mac associated with this item.
36 // (Mac-to-DiscoveryItem is a many-to-many relationship)
37 string mac_address = 4;
38
39 // Beacon's RSSI value
40 int32 rssi = 10;
41
42 // Beacon's tx power
43 int32 tx_power = 11;
44
45 // The mac address encoded in beacon advertisement. Currently only used by
46 // chromecast.
47 string device_setup_mac = 12;
48
49 // Uptime of the device in minutes. Stops incrementing at 255.
50 int32 uptime_minutes = 13;
51
52 // REQUIRED
53 // Client timestamp when the beacon was first observed in BLE scan.
54 int64 first_observation_timestamp_millis = 14;
55
56 // REQUIRED
57 // Client timestamp when the beacon was last observed in BLE scan.
58 int64 last_observation_timestamp_millis = 15;
59
60 // Deprecated fields.
61 reserved 3, 5, 6, 7, 8, 9;
62}
63
64
65// Data for a DiscoveryItem created from server response and client scan result.
66// Only caching original data from scan result, server response, timestamps
67// and user actions. Do not save generated data in this object.
68// Next ID: 50
69message StoredDiscoveryItem {
70 enum State {
71 // Default unknown state.
72 STATE_UNKNOWN = 0;
73
74 // The item is normal.
75 STATE_ENABLED = 1;
76
77 // The item has been muted by user.
78 STATE_MUTED = 2;
79
80 // The item has been disabled by us (likely temporarily).
81 STATE_DISABLED_BY_SYSTEM = 3;
82 }
83
84 // The status of the item.
85 // TODO(b/204409421) remove enum
86 enum DebugMessageCategory {
87 // Default unknown state.
88 STATUS_UNKNOWN = 0;
89
90 // The item is valid and visible in notification.
91 STATUS_VALID_NOTIFICATION = 1;
92
93 // The item made it to list but not to notification.
94 STATUS_VALID_LIST_VIEW = 2;
95
96 // The item is filtered out on client. Never made it to list view.
97 STATUS_DISABLED_BY_CLIENT = 3;
98
99 // The item is filtered out by server. Never made it to client.
100 STATUS_DISABLED_BY_SERVER = 4;
101 }
102
103 enum ExperienceType {
104 EXPERIENCE_UNKNOWN = 0;
105 EXPERIENCE_GOOD = 1;
106 EXPERIENCE_BAD = 2;
107 }
108
109 // REQUIRED
110 // Offline item: unique ID generated on client.
111 // Online item: unique ID generated on server.
112 string id = 1;
113
114 // REQUIRED
weicesun421e0752021-11-11 18:25:00 -0800115 // The most recent all upper case mac associated with this item.
116 // (Mac-to-DiscoveryItem is a many-to-many relationship)
117 string mac_address = 4;
118
119 // REQUIRED
120 string action_url = 5;
121
122 // The bluetooth device name from advertisment
123 string device_name = 6;
124
125 // REQUIRED
126 // Item's title
127 string title = 7;
128
129 // Item's description.
130 string description = 8;
131
132 // The URL for display
133 string display_url = 9;
134
135 // REQUIRED
136 // Client timestamp when the beacon was last observed in BLE scan.
137 int64 last_observation_timestamp_millis = 10;
138
139 // REQUIRED
140 // Client timestamp when the beacon was first observed in BLE scan.
141 int64 first_observation_timestamp_millis = 11;
142
143 // REQUIRED
144 // Item's current state. e.g. if the item is blocked.
145 State state = 17;
146
147 // The resolved url type for the action_url.
148 ResolvedUrlType action_url_type = 19;
149
150 // The timestamp when the user is redirected to Play Store after clicking on
151 // the item.
152 int64 pending_app_install_timestamp_millis = 20;
153
154 // Beacon's RSSI value
155 int32 rssi = 22;
156
157 // Beacon's tx power
158 int32 tx_power = 23;
159
160 // Human readable name of the app designated to open the uri
161 // Used in the second line of the notification, "Open in {} app"
162 string app_name = 25;
163
weicesun421e0752021-11-11 18:25:00 -0800164 // The timestamp when the attachment was created on PBS server. In case there
165 // are duplicate
166 // items with the same scanId/groupID, only show the one with the latest
167 // timestamp.
168 int64 attachment_creation_sec = 28;
169
weicesun421e0752021-11-11 18:25:00 -0800170 // Package name of the App that owns this item.
171 string package_name = 30;
172
173 // The average star rating of the app.
174 float star_rating = 31;
175
weicesun421e0752021-11-11 18:25:00 -0800176 // TriggerId identifies the trigger/beacon that is attached with a message.
177 // It's generated from server for online messages to synchronize formatting
178 // across client versions.
179 // Example:
180 // * BLE_UID: 3||deadbeef
181 // * BLE_URL: http://trigger.id
182 // See go/discovery-store-message-and-trigger-id for more details.
183 string trigger_id = 34;
184
185 // Bytes of item icon in PNG format displayed in Discovery item list.
186 bytes icon_png = 36;
187
188 // A FIFE URL of the item icon displayed in Discovery item list.
189 string icon_fife_url = 49;
190
weicesun421e0752021-11-11 18:25:00 -0800191 // See equivalent field in NearbyItem.
192 bytes authentication_public_key_secp256r1 = 45;
193
194 // See equivalent field in NearbyItem.
195 FastPairInformation fast_pair_information = 46;
196
197 // Companion app detail.
198 CompanionAppDetails companion_detail = 47;
199
200 // Fast pair strings
201 FastPairStrings fast_pair_strings = 48;
202
203 // Deprecated fields.
Chun Zhange4440de2022-03-24 22:40:56 -0700204 reserved 2, 3, 12, 13, 14, 15, 16, 18, 21, 24, 26, 27, 29, 32, 33, 35, 37, 38, 39, 40, 41, 42, 43, 44;
weicesun421e0752021-11-11 18:25:00 -0800205}
206enum ResolvedUrlType {
207 RESOLVED_URL_TYPE_UNKNOWN = 0;
208
209 // The url is resolved to a web page that is not a play store app.
210 // This can be considered as the default resolved type when it's
211 // not the other specific types.
212 WEBPAGE = 1;
213
214 // The url is resolved to the Google Play store app
215 // ie. play.google.com/store
216 APP = 2;
217}
218enum DiscoveryAttachmentType {
219 DISCOVERY_ATTACHMENT_TYPE_UNKNOWN = 0;
220
221 // The attachment is posted in the prod namespace (without "-debug")
222 DISCOVERY_ATTACHMENT_TYPE_NORMAL = 1;
223
224 // The attachment is posted in the debug namespace (with "-debug")
225 DISCOVERY_ATTACHMENT_TYPE_DEBUG = 2;
226}
227// Additional information relevant only for Fast Pair devices.
228message FastPairInformation {
229 // When true, Fast Pair will only create a bond with the device and not
230 // attempt to connect any profiles (for example, A2DP or HFP).
231 bool data_only_connection = 1;
232
233 // Additional images that are attached specifically for true wireless Fast
234 // Pair devices.
235 TrueWirelessHeadsetImages true_wireless_images = 3;
236
237 // When true, this device can support assistant function.
238 bool assistant_supported = 4;
239
240 // Features supported by the Fast Pair device.
241 repeated FastPairFeature features = 5;
242
243 // Optional, the name of the company producing this Fast Pair device.
244 string company_name = 6;
245
246 // Optional, the type of device.
247 DeviceType device_type = 7;
248
249 reserved 2;
250}
251
252
253enum NearbyType {
254 NEARBY_TYPE_UNKNOWN = 0;
255 // Proximity Beacon Service (PBS). This is the only type of nearbyItems which
256 // can be customized by 3p and therefore the intents passed should not be
257 // completely trusted. Deprecated already.
258 NEARBY_PROXIMITY_BEACON = 1;
259 // Physical Web URL beacon. Deprecated already.
260 NEARBY_PHYSICAL_WEB = 2;
261 // Chromecast beacon. Used on client-side only.
262 NEARBY_CHROMECAST = 3;
263 // Wear beacon. Used on client-side only.
264 NEARBY_WEAR = 4;
265 // A device (e.g. a Magic Pair device that needs to be set up). The special-
266 // case devices above (e.g. ChromeCast, Wear) might migrate to this type.
267 NEARBY_DEVICE = 6;
268 // Popular apps/urls based on user's current geo-location.
269 NEARBY_POPULAR_HERE = 7;
270
271 reserved 5;
weicesunb989a182021-11-04 14:14:54 -0700272}
Weicefcd891b2021-12-28 23:31:08 +0000273
274// A locally cached Fast Pair device associating an account key with the
275// bluetooth address of the device.
276message StoredFastPairItem {
277 // The device's public mac address.
278 string mac_address = 1;
279
280 // The account key written to the device.
281 bytes account_key = 2;
282
283 // When user need to update provider name, enable this value to trigger
284 // writing new name to provider.
285 bool need_to_update_provider_name = 3;
286
287 // The retry times to update name into provider.
288 int32 update_name_retries = 4;
289
290 // Latest firmware version from the server.
291 string latest_firmware_version = 5;
292
293 // The firmware version that is on the device.
294 string device_firmware_version = 6;
295
296 // The timestamp from the last time we fetched the firmware version from the
297 // device.
298 int64 last_check_firmware_timestamp_millis = 7;
299
300 // The timestamp from the last time we fetched the firmware version from
301 // server.
302 int64 last_server_query_timestamp_millis = 8;
303
304 // Only allows one bloom filter check process to create gatt connection and
305 // try to read the firmware version value.
306 bool can_read_firmware = 9;
307
308 // Device's model id.
309 string model_id = 10;
310
311 // Features that this Fast Pair device supports.
312 repeated FastPairFeature features = 11;
313
314 // Keeps the stored discovery item in local cache, we can have most
315 // information of fast pair device locally without through footprints, i.e. we
316 // can have most fast pair features locally.
317 StoredDiscoveryItem discovery_item = 12;
318
319 // When true, the latest uploaded event to FMA is connected. We use
320 // it as the previous ACL state when getting the BluetoothAdapter STATE_OFF to
321 // determine if need to upload the disconnect event to FMA.
322 bool fma_state_is_connected = 13;
323
324 // Device's buffer size range.
325 repeated BufferSizeRange buffer_size_range = 18;
326
327 // The additional account key if this device could be associated with multiple
328 // accounts. Notes that for this device, the account_key field is the basic
329 // one which will not be associated with the accounts.
330 repeated bytes additional_account_key = 19;
331
332 // Deprecated fields.
333 reserved 14, 15, 16, 17;
334}
335
336// Contains information about Fast Pair devices stored through our scanner.
337// Next ID: 29
338message ScanFastPairStoreItem {
339 // Device's model id.
340 string model_id = 1;
341
342 // Device's RSSI value
343 int32 rssi = 2;
344
345 // Device's tx power
346 int32 tx_power = 3;
347
348 // Bytes of item icon in PNG format displayed in Discovery item list.
349 bytes icon_png = 4;
350
351 // A FIFE URL of the item icon displayed in Discovery item list.
352 string icon_fife_url = 28;
353
354 // Device name like "Bose QC 35".
355 string device_name = 5;
356
357 // Client timestamp when user last saw Fast Pair device.
358 int64 last_observation_timestamp_millis = 6;
359
360 // Action url after user click the notification.
361 string action_url = 7;
362
363 // Device's bluetooth address.
364 string address = 8;
365
366 // The computed threshold rssi value that would trigger FastPair notifications
367 int32 threshold_rssi = 9;
368
369 // Populated with the contents of the bloom filter in the event that
370 // the scanned device is advertising a bloom filter instead of a model id
371 bytes bloom_filter = 10;
372
373 // Device name from the BLE scan record
374 string ble_device_name = 11;
375
376 // Strings used for the FastPair UI
377 FastPairStrings fast_pair_strings = 12;
378
379 // A key used to authenticate advertising device.
380 // See NearbyItem.authentication_public_key_secp256r1 for more information.
381 bytes anti_spoofing_public_key = 13;
382
383 // When true, Fast Pair will only create a bond with the device and not
384 // attempt to connect any profiles (for example, A2DP or HFP).
385 bool data_only_connection = 14;
386
387 // The type of the manufacturer (first party, third party, etc).
388 int32 manufacturer_type_num = 15;
389
390 // Additional images that are attached specifically for true wireless Fast
391 // Pair devices.
392 TrueWirelessHeadsetImages true_wireless_images = 16;
393
394 // When true, this device can support assistant function.
395 bool assistant_supported = 17;
396
397 // Optional, the name of the company producing this Fast Pair device.
398 string company_name = 18;
399
400 // Features supported by the Fast Pair device.
401 FastPairFeature features = 19;
402
403 // The interaction type that this scan should trigger
404 InteractionType interaction_type = 20;
405
406 // The copy of the advertisement bytes, used to pass along to other
407 // apps that use Fast Pair as the discovery vehicle.
408 bytes full_ble_record = 21;
409
410 // Companion app related information
411 CompanionAppDetails companion_detail = 22;
412
413 // Client timestamp when user first saw Fast Pair device.
414 int64 first_observation_timestamp_millis = 23;
415
416 // The type of the device (wearable, headphones, etc).
417 int32 device_type_num = 24;
418
419 // The type of notification (app launch smart setup, etc).
420 NotificationType notification_type = 25;
421
422 // The customized title.
423 string customized_title = 26;
424
425 // The customized description.
426 string customized_description = 27;
427}