Janusz Sobczak
eb282a64da
Set credential start&end times
...
PiperOrigin-RevId: 504880260
2023-01-26 10:33:22 -08:00
Anay Wadhera
c58b45eb50
Rename PublicCredential to SharedCredential and PrivateCredential to LocalCredential
...
PiperOrigin-RevId: 503221477
2023-01-24 12:09:21 -08:00
Anay Wadhera
43ec97b13b
Add missing die_if_null.h include
...
PiperOrigin-RevId: 503504149
2023-01-20 12:55:38 -08:00
Janusz Sobczak
a29be214a3
Migrate to absl::AnyInvocable in NP.
...
Replaces a bunch of std::function uses with absl::AnyInvocable.
PiperOrigin-RevId: 502960326
2023-01-18 13:16:29 -08:00
Janusz Sobczak
ca547df4d7
Subscribe for public credentials update
...
Nearby Presence scanning sessions may be very long. We need a way to notify the scanner that new credentials were added during scanning.
`SubscribeForPublicCredentials()` allows us to subscribe for such updates.
PiperOrigin-RevId: 502699345
2023-01-17 15:07:14 -08:00
Anay Wadhera
44fb63f498
Use CredentialSelector for GenerateCredentials()
...
PiperOrigin-RevId: 501951868
2023-01-13 15:23:35 -08:00
Janusz Sobczak
0e2111afc2
Collapse success&failure callbacks into one
...
Instead of two callbacks:
- void on_success(Result result)
- void on_failure(Status status)
use just one callback:
void on_result(StatusOr<Result> result)
PiperOrigin-RevId: 501912034
2023-01-13 12:28:47 -08:00
Anay Wadhera
7667420e2b
Use CredentialSelector for GenerateCredentials()
...
PiperOrigin-RevId: 501622339
2023-01-12 11:36:37 -08:00
Suet-Fei Li
084f7ebd88
Remove location namespace in third_party/nearby.
...
PiperOrigin-RevId: 500023196
2023-01-06 02:53:57 -08:00
Anay Wadhera
7afea00649
Internal change
...
PiperOrigin-RevId: 499997190
2023-01-06 02:49:53 -08:00
Janusz Sobczak
e64f9859e1
Replace BleOperationStatus with absl::Status
...
PiperOrigin-RevId: 497191477
2022-12-22 10:20:15 -08:00
Janusz Sobczak
0d14b885ea
Use absl::Status instead of custom status
...
PiperOrigin-RevId: 497054898
2022-12-21 19:11:55 -08:00
Janusz Sobczak
b3f8534226
Use Rand instead of absl::Random
...
Use Nearby's common Rand() util instead of absl::Random
PiperOrigin-RevId: 495386054
2022-12-14 12:30:56 -08:00
Anay Wadhera
228e52e979
Refactor broadcasting code into BroadcastManager
...
PiperOrigin-RevId: 495021310
2022-12-13 07:57:04 -08:00
Janusz Sobczak
337e1f41b0
Clarify CredentialStorage interface.
...
SaveCredentials does not to return the credentials that it has just saved. Returning a status will do.
Improved documentation.
PiperOrigin-RevId: 494280108
2022-12-09 15:41:12 -08:00
Janusz Sobczak
0fb81f2b27
Enable LDT by default
...
PiperOrigin-RevId: 494227035
2022-12-09 11:50:36 -08:00
Janusz Sobczak
5ce2485694
Replace .proto.h with .pb.h
...
We should be using public .pb.h files
PiperOrigin-RevId: 494011872
2022-12-08 15:32:02 -08:00
Janusz Sobczak
a92abac83a
Update advertisement encoder/decoder
...
1. Update the API to accept the credentials on input instead of credential manager.
2. Update the test with values using the LDT encryption.
These changes allow us to have a more asynchronous implementaion.
When broadcasting we can:
1. Fetch the private credentials asynchronously.
2. Create the advertisement and start broadcasting when the credentials have been fetched.
When scanning we can:
1. Fetch public credentials asynchronously.
2. Start scanning for advertisements.
3. Update the decoder when new credentials are fetched.
PiperOrigin-RevId: 493998041
2022-12-08 14:36:44 -08:00
Anay Wadhera
87c57534a4
Include check.h header to fix Github presence build
...
PiperOrigin-RevId: 493067786
2022-12-05 11:43:05 -08:00
Anay Wadhera
40e391b33d
Explicitly convert absl::string_view to std::string
...
PiperOrigin-RevId: 492260785
2022-12-01 12:01:09 -08:00
Janusz Sobczak
3aa109a29b
Add NoDeviceFoundAfterStopScan test
...
PiperOrigin-RevId: 492260183
2022-12-01 11:57:13 -08:00
Anay Wadhera
109458b7ad
Add missing header to service_controller.h
...
PiperOrigin-RevId: 492193352
2022-12-01 07:44:48 -08:00
Janusz Sobczak
255bdb6139
Add StopScan method.
...
Add StopScan and refactor StartScan to return a sesssion id.
Move handling of StartScan, StopScan and NotifyFoundBle to the same thread to avoid race conditions.
Implement start advertising in service controller.
PiperOrigin-RevId: 492016697
2022-11-30 14:21:26 -08:00
Anay Wadhera
fb544f7900
Add missing headers to service_controller_impl.h to fix Chrome
...
PiperOrigin-RevId: 491969884
2022-11-30 11:17:49 -08:00
Janusz Sobczak
e44f7eac61
Aynchronous start and stop broadcast
...
PiperOrigin-RevId: 491772964
2022-11-29 16:59:41 -08:00
Janusz Sobczak
f0d36f8d8d
Add StopBroadcast
...
Use explicit StopBroadcast API instead of a callback in BoroadcastSession.
PiperOrigin-RevId: 491759852
2022-11-29 16:00:28 -08:00
Anay Wadhera
b7415ecd40
Implement NearbyDevice for PresenceDevice.
...
PiperOrigin-RevId: 491705794
2022-11-29 12:19:47 -08:00
Hai Shang
6871b9d5a6
Add initial impl for UpdateRemotePublicCredentials in CredentialManager.
...
PiperOrigin-RevId: 491458184
2022-11-28 15:24:26 -08:00
Janusz Sobczak
8bd3d34580
Link with Rust NP LDT
...
Add conditional dependency on Rust NP LDT.
By default, we will use an empty stub.
PiperOrigin-RevId: 490554102
2022-11-23 11:55:52 -08:00
Anay Wadhera
52d81710a2
Add fields to PresenceDevice
...
PiperOrigin-RevId: 490345719
2022-11-22 15:03:09 -08:00
Janusz Sobczak
9e61866ee3
Sync with Rust LDT changes
...
PiperOrigin-RevId: 490288278
2022-11-22 11:16:21 -08:00
Janusz Sobczak
a3b6058753
Fully qualify ::location::nearby imports.
...
Find and replace exercise.
Replace
`using location::nearby`
with
`using ::location::nearby`
and
`using <Name> = location::nearby`
with
`using <Name> = ::location::nearby`
PiperOrigin-RevId: 490087051
2022-11-21 15:33:21 -08:00
Janusz Sobczak
a11733988f
Implement start advertising in service controller.
...
PiperOrigin-RevId: 489584407
2022-11-18 16:17:55 -08:00
Anay Wadhera
beb67fc02a
Call StopScan() when ScanSession goes out of scope and make sure stop can only be called once.
...
PiperOrigin-RevId: 488717591
2022-11-15 11:46:34 -08:00
Anay Wadhera
b7de5f4097
Resolve unique_ptr being thrown away and potential deadlock issue
...
PiperOrigin-RevId: 487979164
2022-11-11 20:30:27 -08:00
Nick Bourdakos
4fb6ba318c
Internal change
...
PiperOrigin-RevId: 486691317
2022-11-07 09:59:14 -08:00
Janusz Sobczak
a90b7f85fc
Disable medium env by default.
...
MediumEnvironment's initial state will now match the state after calling `Stop()`.
Cleaned up tests that were calling Stop() before test start.
PiperOrigin-RevId: 486277290
2022-11-04 18:56:30 -07:00
Janusz Sobczak
5faa395f24
Change enum PublicCredentialType to enum class.
...
PiperOrigin-RevId: 486243753
2022-11-04 15:26:34 -07:00
Janusz Sobczak
23c9b106b1
Remove dependency on tink.
...
PiperOrigin-RevId: 486232030
2022-11-04 14:32:56 -07:00
Janusz Sobczak
951945dd5c
Add AdvertisementData struct.
...
Define and use an NP private AdvertisementData structure instead of the low level BleAdvertisementData,
The APIs look cleaner this way.
PiperOrigin-RevId: 486224840
2022-11-04 14:03:24 -07:00
Hai Shang
de4e7a66dc
Utilize ScanManager for scan operation in service controller.
...
PiperOrigin-RevId: 486208283
2022-11-04 12:50:19 -07:00
Anay Wadhera
c0531d556c
Explicitly convert absl::string_view to std::string for chromium
...
PiperOrigin-RevId: 485990008
2022-11-03 15:34:38 -07:00
Anay Wadhera
8028821593
Switch to .pb.h and explicit conversions to std::string
...
PiperOrigin-RevId: 485942813
2022-11-03 12:31:18 -07:00
Anay Wadhera
373a694b32
Add missing die_if_null and flat_hash_map dependency to fix build error
...
PiperOrigin-RevId: 485938749
2022-11-03 12:14:16 -07:00
Janusz Sobczak
d268b077c9
Save scan callbacks before starting scan session.
...
This reduces flakiness. We can start receiving advertisements before StartScan() has finished.
PiperOrigin-RevId: 485904791
2022-11-03 10:13:02 -07:00
Anay Wadhera
74f7f5ec5c
Fix visibility rules
...
PiperOrigin-RevId: 485897261
2022-11-03 09:44:47 -07:00
Anay Wadhera
fa983e304a
Allow tink to be fetched and compile presence in bazel builds.
...
PiperOrigin-RevId: 485876571
2022-11-03 08:15:15 -07:00
Anay Wadhera
c4dc132f50
Add ScanManager class for bookkeeping BLE v2 scans
...
PiperOrigin-RevId: 485675999
2022-11-02 13:15:31 -07:00
Janusz Sobczak
81f6b547bb
Add StartAdvertising to BLE medium.
...
StartAdvertising allows us to broadcast Nearby Presence advertisements.
We can now test scanning and advertising with the MediumEnvironment rather than mocking platform code.
PiperOrigin-RevId: 484662211
2022-10-28 18:23:30 -07:00
Janusz Sobczak
5d742558a4
Add advertisement filtering
...
PiperOrigin-RevId: 484616133
2022-10-28 14:07:29 -07:00