35 Commits
Author SHA1 Message Date
hai007 00a2999269 Format all the files in CL786733783
PiperOrigin-RevId: 786873870
2025-07-24 16:25:18 -07:00
hai007 71cdf84236 Replace NEARBY_LOGS with LOG for all coding under google3/third_party/nearby/
PiperOrigin-RevId: 786733783
2025-07-24 09:34:17 -07:00
Francis Tsui b48b943275 Remove reference to BlePeripheral.
PiperOrigin-RevId: 757830081
2025-05-12 10:55:38 -07:00
Crisrael Lucero acc38a809b [Nearby Presence] Update ScanManager to trigger changed and lost events
PiperOrigin-RevId: 644072733
2024-06-17 11:17:00 -07:00
hai007 bba1ca540f Remove provisioned identity type from proto
PiperOrigin-RevId: 629178167
2024-04-29 13:59:55 -07:00
hai007 0b04994f71 Update identity type name
PiperOrigin-RevId: 629163344
2024-04-29 13:12:45 -07:00
hai007 a1b80ff649 Update identity type name
PiperOrigin-RevId: 628545355
2024-04-26 16:57:25 -07:00
hai007 54eff829b5 Update identity type name
PiperOrigin-RevId: 628513553
2024-04-26 14:40:17 -07:00
hai007 734014a841 Add build flag to switch between C++ and rust implemented parser
- Both implementations implement `AdvertisementDecoder` interface and provide the
   concrete implementation for AdvertisementDecoderImpl
 - cleanup missing includes as complained about by clang-tidy

PiperOrigin-RevId: 621187625
2024-04-02 08:43:31 -07:00
hai007 112da5e64a Refactor, remove scan_request dependency from AdvertisementDecoder
- Removes banned_data_types_, PUBLIC identity advertisements will never have
   any corresponding credentials anyways, so decryption will always be skipped
   and this is now guarenteed by asserts in UpdatePublicCredentials
 - Filtering adv based on identity is moved into advertisement Filter which
   already contains the requested identity info from scan_request
 - LegacyPresenceScanFilter is no longer used by AdvertisementDecoder since
   this is not being used anywhere at the moment
 - Cleanup miscellaneous clang-tidy lints about missing or unused includes

PiperOrigin-RevId: 620086399
2024-03-28 16:15:37 -07:00
hai007 5bc1c83472 Pure Refactor: move filtering logic into AdvertisementFilter class
- this decouples filtering logic from advertisement decoding logic
   in preparation for introducing a Rust backed impl of
   AdvertisementDecoder
 - this change is only a refactor and does not change functionality
   in any way

PiperOrigin-RevId: 618978564
2024-03-25 15:33:20 -07:00
Suet-Fei Li 989efcf2c5 Metadata to DeviceIdentityMetaData Migration
PiperOrigin-RevId: 616182462
2024-03-15 10:57:58 -07:00
Anay Wadhera 33faa84aca add shared credential to PresenceDevice.
This field stores the shared credential that this PresenceDevice was decrypted with (if applicable).

PiperOrigin-RevId: 549720833
2023-07-20 13:20:21 -07:00
Anay Wadhera 95f070796f Add identity type field to PresenceDevice
PiperOrigin-RevId: 543824854
2023-06-27 12:49:28 -07:00
Anay Wadhera 0e1170c52e remove obsolete todo
PiperOrigin-RevId: 532176213
2023-05-15 11:39:30 -07:00
Suet-Fei Li 31f3f53000 Fix crypto include path for Chromium.
PiperOrigin-RevId: 524452486
2023-04-14 20:56:29 -07:00
Hai Shang 97fe0be263 scan_manager clean up.
PiperOrigin-RevId: 523538897
2023-04-11 16:39:55 -07:00
Janusz Sobczak 5f4144cd0b Update SharedCredential definition
PiperOrigin-RevId: 507568902
2023-02-06 13:33:23 -08:00
Anay Wadhera c58b45eb50 Rename PublicCredential to SharedCredential and PrivateCredential to LocalCredential
PiperOrigin-RevId: 503221477
2023-01-24 12:09:21 -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 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
Suet-Fei Li 084f7ebd88 Remove location namespace in third_party/nearby.
PiperOrigin-RevId: 500023196
2023-01-06 02:53:57 -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
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 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 40e391b33d Explicitly convert absl::string_view to std::string
PiperOrigin-RevId: 492260785
2022-12-01 12:01:09 -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 b7415ecd40 Implement NearbyDevice for PresenceDevice.
PiperOrigin-RevId: 491705794
2022-11-29 12:19:47 -08:00
Anay Wadhera 52d81710a2 Add fields to PresenceDevice
PiperOrigin-RevId: 490345719
2022-11-22 15:03:09 -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
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 c4dc132f50 Add ScanManager class for bookkeeping BLE v2 scans
PiperOrigin-RevId: 485675999
2022-11-02 13:15:31 -07:00