blob: 12731fb78ad9955cf08e1a07b1d41b3fea37bb5d [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
115 NearbyType type = 2;
116
117 // REQUIRED
118 // The most recent all upper case mac associated with this item.
119 // (Mac-to-DiscoveryItem is a many-to-many relationship)
120 string mac_address = 4;
121
122 // REQUIRED
123 string action_url = 5;
124
125 // The bluetooth device name from advertisment
126 string device_name = 6;
127
128 // REQUIRED
129 // Item's title
130 string title = 7;
131
132 // Item's description.
133 string description = 8;
134
135 // The URL for display
136 string display_url = 9;
137
138 // REQUIRED
139 // Client timestamp when the beacon was last observed in BLE scan.
140 int64 last_observation_timestamp_millis = 10;
141
142 // REQUIRED
143 // Client timestamp when the beacon was first observed in BLE scan.
144 int64 first_observation_timestamp_millis = 11;
145
146 // REQUIRED
147 // Item's current state. e.g. if the item is blocked.
148 State state = 17;
149
150 // The resolved url type for the action_url.
151 ResolvedUrlType action_url_type = 19;
152
153 // The timestamp when the user is redirected to Play Store after clicking on
154 // the item.
155 int64 pending_app_install_timestamp_millis = 20;
156
157 // Beacon's RSSI value
158 int32 rssi = 22;
159
160 // Beacon's tx power
161 int32 tx_power = 23;
162
163 // Human readable name of the app designated to open the uri
164 // Used in the second line of the notification, "Open in {} app"
165 string app_name = 25;
166
167 // ID used for associating several DiscoveryItems. These items may be
168 // visually displayed together.
169 string group_id = 26;
170
171 // The timestamp when the attachment was created on PBS server. In case there
172 // are duplicate
173 // items with the same scanId/groupID, only show the one with the latest
174 // timestamp.
175 int64 attachment_creation_sec = 28;
176
177 // Whether the attachment is created in debug namespace
178 DiscoveryAttachmentType attachment_type = 29;
179
180 // Package name of the App that owns this item.
181 string package_name = 30;
182
183 // The average star rating of the app.
184 float star_rating = 31;
185
186 // The "feature" graphic image url used for large sized list view entries.
187 string feature_graphic_url = 32;
188
189 // TriggerId identifies the trigger/beacon that is attached with a message.
190 // It's generated from server for online messages to synchronize formatting
191 // across client versions.
192 // Example:
193 // * BLE_UID: 3||deadbeef
194 // * BLE_URL: http://trigger.id
195 // See go/discovery-store-message-and-trigger-id for more details.
196 string trigger_id = 34;
197
198 // Bytes of item icon in PNG format displayed in Discovery item list.
199 bytes icon_png = 36;
200
201 // A FIFE URL of the item icon displayed in Discovery item list.
202 string icon_fife_url = 49;
203
204 // Message written to bugreport for 3P developers.(No sensitive info)
205 // null if the item is valid
206 string debug_message = 37;
207
208 // Weather the item is filtered out on server.
209 DebugMessageCategory debug_category = 38;
210
211 // Client timestamp when the trigger (e.g. beacon) was last lost (e.g. when
212 // Messages told us the beacon's no longer nearby).
213 int64 lost_millis = 41;
214
215 // The kind of expereince the user last had with this (e.g. if they dismissed
216 // the notification, that's bad; but if they tapped it, that's good).
217 ExperienceType last_user_experience = 42;
218
219 // The most recent BLE advertisement related to this item.
220 bytes ble_record_bytes = 43;
221
222 // An ID generated on the server to uniquely identify content.
223 string entity_id = 44;
224
225 // See equivalent field in NearbyItem.
226 bytes authentication_public_key_secp256r1 = 45;
227
228 // See equivalent field in NearbyItem.
229 FastPairInformation fast_pair_information = 46;
230
231 // Companion app detail.
232 CompanionAppDetails companion_detail = 47;
233
234 // Fast pair strings
235 FastPairStrings fast_pair_strings = 48;
236
237 // Deprecated fields.
238 reserved 3, 12, 13, 14, 15, 16, 18, 21, 24, 27, 33, 35, 39, 40;
239}
240enum ResolvedUrlType {
241 RESOLVED_URL_TYPE_UNKNOWN = 0;
242
243 // The url is resolved to a web page that is not a play store app.
244 // This can be considered as the default resolved type when it's
245 // not the other specific types.
246 WEBPAGE = 1;
247
248 // The url is resolved to the Google Play store app
249 // ie. play.google.com/store
250 APP = 2;
251}
252enum DiscoveryAttachmentType {
253 DISCOVERY_ATTACHMENT_TYPE_UNKNOWN = 0;
254
255 // The attachment is posted in the prod namespace (without "-debug")
256 DISCOVERY_ATTACHMENT_TYPE_NORMAL = 1;
257
258 // The attachment is posted in the debug namespace (with "-debug")
259 DISCOVERY_ATTACHMENT_TYPE_DEBUG = 2;
260}
261// Additional information relevant only for Fast Pair devices.
262message FastPairInformation {
263 // When true, Fast Pair will only create a bond with the device and not
264 // attempt to connect any profiles (for example, A2DP or HFP).
265 bool data_only_connection = 1;
266
267 // Additional images that are attached specifically for true wireless Fast
268 // Pair devices.
269 TrueWirelessHeadsetImages true_wireless_images = 3;
270
271 // When true, this device can support assistant function.
272 bool assistant_supported = 4;
273
274 // Features supported by the Fast Pair device.
275 repeated FastPairFeature features = 5;
276
277 // Optional, the name of the company producing this Fast Pair device.
278 string company_name = 6;
279
280 // Optional, the type of device.
281 DeviceType device_type = 7;
282
283 reserved 2;
284}
285
286
287enum NearbyType {
288 NEARBY_TYPE_UNKNOWN = 0;
289 // Proximity Beacon Service (PBS). This is the only type of nearbyItems which
290 // can be customized by 3p and therefore the intents passed should not be
291 // completely trusted. Deprecated already.
292 NEARBY_PROXIMITY_BEACON = 1;
293 // Physical Web URL beacon. Deprecated already.
294 NEARBY_PHYSICAL_WEB = 2;
295 // Chromecast beacon. Used on client-side only.
296 NEARBY_CHROMECAST = 3;
297 // Wear beacon. Used on client-side only.
298 NEARBY_WEAR = 4;
299 // A device (e.g. a Magic Pair device that needs to be set up). The special-
300 // case devices above (e.g. ChromeCast, Wear) might migrate to this type.
301 NEARBY_DEVICE = 6;
302 // Popular apps/urls based on user's current geo-location.
303 NEARBY_POPULAR_HERE = 7;
304
305 reserved 5;
weicesunb989a182021-11-04 14:14:54 -0700306}
Weicefcd891b2021-12-28 23:31:08 +0000307
308// A locally cached Fast Pair device associating an account key with the
309// bluetooth address of the device.
310message StoredFastPairItem {
311 // The device's public mac address.
312 string mac_address = 1;
313
314 // The account key written to the device.
315 bytes account_key = 2;
316
317 // When user need to update provider name, enable this value to trigger
318 // writing new name to provider.
319 bool need_to_update_provider_name = 3;
320
321 // The retry times to update name into provider.
322 int32 update_name_retries = 4;
323
324 // Latest firmware version from the server.
325 string latest_firmware_version = 5;
326
327 // The firmware version that is on the device.
328 string device_firmware_version = 6;
329
330 // The timestamp from the last time we fetched the firmware version from the
331 // device.
332 int64 last_check_firmware_timestamp_millis = 7;
333
334 // The timestamp from the last time we fetched the firmware version from
335 // server.
336 int64 last_server_query_timestamp_millis = 8;
337
338 // Only allows one bloom filter check process to create gatt connection and
339 // try to read the firmware version value.
340 bool can_read_firmware = 9;
341
342 // Device's model id.
343 string model_id = 10;
344
345 // Features that this Fast Pair device supports.
346 repeated FastPairFeature features = 11;
347
348 // Keeps the stored discovery item in local cache, we can have most
349 // information of fast pair device locally without through footprints, i.e. we
350 // can have most fast pair features locally.
351 StoredDiscoveryItem discovery_item = 12;
352
353 // When true, the latest uploaded event to FMA is connected. We use
354 // it as the previous ACL state when getting the BluetoothAdapter STATE_OFF to
355 // determine if need to upload the disconnect event to FMA.
356 bool fma_state_is_connected = 13;
357
358 // Device's buffer size range.
359 repeated BufferSizeRange buffer_size_range = 18;
360
361 // The additional account key if this device could be associated with multiple
362 // accounts. Notes that for this device, the account_key field is the basic
363 // one which will not be associated with the accounts.
364 repeated bytes additional_account_key = 19;
365
366 // Deprecated fields.
367 reserved 14, 15, 16, 17;
368}
369
370// Contains information about Fast Pair devices stored through our scanner.
371// Next ID: 29
372message ScanFastPairStoreItem {
373 // Device's model id.
374 string model_id = 1;
375
376 // Device's RSSI value
377 int32 rssi = 2;
378
379 // Device's tx power
380 int32 tx_power = 3;
381
382 // Bytes of item icon in PNG format displayed in Discovery item list.
383 bytes icon_png = 4;
384
385 // A FIFE URL of the item icon displayed in Discovery item list.
386 string icon_fife_url = 28;
387
388 // Device name like "Bose QC 35".
389 string device_name = 5;
390
391 // Client timestamp when user last saw Fast Pair device.
392 int64 last_observation_timestamp_millis = 6;
393
394 // Action url after user click the notification.
395 string action_url = 7;
396
397 // Device's bluetooth address.
398 string address = 8;
399
400 // The computed threshold rssi value that would trigger FastPair notifications
401 int32 threshold_rssi = 9;
402
403 // Populated with the contents of the bloom filter in the event that
404 // the scanned device is advertising a bloom filter instead of a model id
405 bytes bloom_filter = 10;
406
407 // Device name from the BLE scan record
408 string ble_device_name = 11;
409
410 // Strings used for the FastPair UI
411 FastPairStrings fast_pair_strings = 12;
412
413 // A key used to authenticate advertising device.
414 // See NearbyItem.authentication_public_key_secp256r1 for more information.
415 bytes anti_spoofing_public_key = 13;
416
417 // When true, Fast Pair will only create a bond with the device and not
418 // attempt to connect any profiles (for example, A2DP or HFP).
419 bool data_only_connection = 14;
420
421 // The type of the manufacturer (first party, third party, etc).
422 int32 manufacturer_type_num = 15;
423
424 // Additional images that are attached specifically for true wireless Fast
425 // Pair devices.
426 TrueWirelessHeadsetImages true_wireless_images = 16;
427
428 // When true, this device can support assistant function.
429 bool assistant_supported = 17;
430
431 // Optional, the name of the company producing this Fast Pair device.
432 string company_name = 18;
433
434 // Features supported by the Fast Pair device.
435 FastPairFeature features = 19;
436
437 // The interaction type that this scan should trigger
438 InteractionType interaction_type = 20;
439
440 // The copy of the advertisement bytes, used to pass along to other
441 // apps that use Fast Pair as the discovery vehicle.
442 bytes full_ble_record = 21;
443
444 // Companion app related information
445 CompanionAppDetails companion_detail = 22;
446
447 // Client timestamp when user first saw Fast Pair device.
448 int64 first_observation_timestamp_millis = 23;
449
450 // The type of the device (wearable, headphones, etc).
451 int32 device_type_num = 24;
452
453 // The type of notification (app launch smart setup, etc).
454 NotificationType notification_type = 25;
455
456 // The customized title.
457 string customized_title = 26;
458
459 // The customized description.
460 string customized_description = 27;
461}