Commit Graph
83 Commits
Author SHA1 Message Date
Guogang Li 2c90a61fca Fixed crash when flag update in peripheral tracker
PiperOrigin-RevId: 540294615
2023-06-14 09:35:47 -07:00
Juliet Levesque 6f69e97421 [Nearby Connections] Stop 3 AttemptsToConnect over BluetoothClassic for CancellationFlag
CancellationFlags will be used to prevent crashes during the shutdown of Nearby Connections from pending tasks taking too long during the shutdown period. By using CancellationFlags, we can prevent the retries occuring during the Shutdown by short-circuiting an in flight AttemptToConnect, and checking for Cancellation before retries.

Because BluetoothClassic does not use futures, the short circuit only requires a check after ConnectToService, and returning an empty
socket.

PiperOrigin-RevId: 539755631
2023-06-12 14:05:36 -07:00
Juliet Levesque 240159e872 [Nearby Connections] Stop 3 AttemptsToConnect over WebRTC for CancellationFlag
CancellationFlags will be used to prevent crashes during the shutdown of Nearby Connections from pending tasks taking too long during the shutdown period. WebRTC using 3 x 10s retries to connect, which means we are potentially waiting for 30 seconds of retries to execute during shutdown (which is longer than the 10s duration alloted for Core shutdown).

By using CancellationFlags, we can prevent the retries occuring during the Shutdown by short-circuiting an in flight AttemptToConnect, and checking for Cancellation before retries.

PiperOrigin-RevId: 539690403
2023-06-12 10:16:36 -07:00
Guogang Li dbd42b0de3 Handle GATT query in separate thread
PiperOrigin-RevId: 538819295
2023-06-08 10:10:00 -07:00
Guogang Li 19bc10ff26 Fixed the issue to initialize discovery tracker
PiperOrigin-RevId: 537995407
2023-06-05 15:22:40 -07:00
Janusz Sobczak 0901aec6e2 Add BleMedium::GetRemotePeripheral
Added:
nearby::api::ble_v2::BlePeripheral::GetUniqueId()
nearby::api::ble_v2::BleMedium::GetRemotePeripheral(...)

Moved BlePeripheral implementation from bluetooth_adapter_* to ble_v2.*
Added G3 (test) implementation for the new methods.

PiperOrigin-RevId: 531023568
2023-05-10 15:40:38 -07:00
Guogang Li 072d24238b Made kPeripheralLostTimeout as flag
PiperOrigin-RevId: 530408275
2023-05-08 14:29:02 -07:00
Nick Bourdakos 58772e95f9 Internal change
PiperOrigin-RevId: 529464527
2023-05-04 11:24:39 -07:00
hai007 388c96d125 Close webrtc socket before closing the PeerConnection.
PiperOrigin-RevId: 522140908
2023-04-05 13:36:30 -07:00
hai007 f8f9c4fd4e Don't unregister an observer while inside an observer callback.
PiperOrigin-RevId: 521860015
2023-04-04 14:05:32 -07:00
Hai Shang c312442f3d internal clean up
PiperOrigin-RevId: 521555239
2023-04-03 14:00:22 -07:00
Hai Shang 47b7a04939 minor clean up
PiperOrigin-RevId: 520734787
2023-03-30 13:56:57 -07:00
Nick Bourdakos 14e7832be0 Internal change
PiperOrigin-RevId: 520638739
2023-03-30 12:34:53 -07:00
Nick Bourdakos a933a91413 Internal Change
PiperOrigin-RevId: 520165614
2023-03-28 16:26:40 -07:00
Guogang Li 9130b61f15 Only handle possible advertising advertising packet for BLE V2
PiperOrigin-RevId: 519292612
2023-03-24 19:23:09 -07:00
Nick Bourdakos 0b3c759aa3 Remove unneeded WebRTC flags
PiperOrigin-RevId: 518629654
2023-03-22 11:44:12 -07:00
Nick Bourdakos ec025502dc Refactor WebRTC code to avoid use of select for stubs
PiperOrigin-RevId: 518491132
2023-03-22 00:25:54 -07:00
Janusz Sobczak a7a3eb8a92 Use consistent return value in Pipe read.
Previously reading from an empty, closed Pipe returned:
* IO exception if there were no writes to the pipe,
* Empty byte array if there were writes to the pipe.
With this change, we return an empty byte array on both paths.

This also fixes a subtle race condition in the following flow:
1. Pipe is empty
2. Thread A is reading from the pipe (blocking call).
3. Thread B writes to the pipe and immediately closes it.
4. Thread A is unblocked and returns IO error. The data written by thread B is
   ignored!

The new test in bluetooth_classic_test triggered that defect consistently.

PiperOrigin-RevId: 518107700
2023-03-20 16:26:52 -07:00
Edwin Wu 94ff506d1e Fixes HelloConnections that can't discover Pixel device from iPhone for Ble_v2 medium.
PiperOrigin-RevId: 517318035
2023-03-16 22:25:21 -07:00
Guogang Li 335c07624e Fixed the issue to encode BLE V2 advertisement header
PiperOrigin-RevId: 517267592
2023-03-16 17:06:02 -07:00
Guogang Li fd5430764f Created NearbyFlags to avoid create multiple classes
PiperOrigin-RevId: 516885843
2023-03-15 11:44:25 -07:00
Guogang Li e539d021a3 Added flag for BLE v2 in nearby connections
PiperOrigin-RevId: 516585139
2023-03-14 11:35:49 -07:00
Qin Wang 0c078b3528 Convet ByteArray to std::string in ble_gatt_client
PiperOrigin-RevId: 514786088
2023-03-07 11:10:34 -08:00
Guogang Li 4f7b61ad79 Added flag to control whether enable base64 in BLE advertisement header
PiperOrigin-RevId: 513924031
2023-03-06 07:03:30 -08:00
Edwin Wu 517ff0f52e [Nearby Connections] Add control packet in BlePacket
PiperOrigin-RevId: 513573452
2023-03-02 10:21:07 -08:00
Qin Wang 4727861f5d Refactor GattCharactristic to support bitwise combination of Permission and Property
PiperOrigin-RevId: 513339751
2023-03-01 14:21:04 -08:00
Aaron Yu fc1811f966 Set g3 bluetooth adapter to be enabled by default and remove Toggle()
PiperOrigin-RevId: 509962396
2023-02-15 16:25:43 -08:00
hai007 c80dd182e2 Automated visibility attribute cleanup.
PiperOrigin-RevId: 507844899
2023-02-07 11:53:54 -08:00
Janusz Sobczak f4d85f9b90 Migrate to AnyInvocable in platform code
PiperOrigin-RevId: 504104740
2023-01-23 16:04:21 -08:00
Janusz Sobczak 4fc1583b94 Migrate to absl::AnyInvocable
PiperOrigin-RevId: 501392167
2023-01-11 15:19:33 -08:00
hai007 32ace29ccf Change wifi_hotspot_credential.h to wifi_credential.h
PiperOrigin-RevId: 500223301
2023-01-06 15:05:22 -08:00
Suet-Fei Li 084f7ebd88 Remove location namespace in third_party/nearby.
PiperOrigin-RevId: 500023196
2023-01-06 02:53:57 -08:00
hai007 f7f0a266fe WIFI Direct implementation (5)
Part 5: Add WifiDirect Server/Client Socket and Credential

PiperOrigin-RevId: 499401159
2023-01-03 23:10:15 -08:00
Nick Bourdakos 682813388f Disable WebRTC for ARM based CPUs
PiperOrigin-RevId: 495707681
2022-12-15 15:15:00 -08:00
hai007 fa7c8a2ec8 WIFI Direct implementation (2)
Part 2: Connection common code for WIFI Direct

PiperOrigin-RevId: 493153750
2022-12-05 17:14:26 -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
Adam Cozzette b1d1019541 Internal change
PiperOrigin-RevId: 489671461
2022-11-19 05:04:29 -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
Eiden Kim 7350643c36 Update Prng usage so that it can generate random values on different threads.
PiperOrigin-RevId: 478025630
2022-09-30 10:31:27 -07:00
John Carroll 55c4714b99 Cleanup the code. Change inputs on ImplementationPlatform::GetDownloadPath from std::string& to absl::string_view.
PiperOrigin-RevId: 472770249
2022-09-07 11:22:24 -07:00
Nick Bourdakos c48e27d754 Add GitHub Action for testing Linux build.
PiperOrigin-RevId: 466797648
2022-08-10 15:18:44 -07:00
jfcarroll 5b3d443815 Remove the call to Toggle from the BluetoothRadio destructor. https://buganizer.corp.google.com/issues/237492358
PiperOrigin-RevId: 465451962
2022-08-04 18:22:51 -07:00
jfcarroll 778c77eacd Persist the original radio name, and restore it on app start if the radio name is our radio name.
PiperOrigin-RevId: 464148898
2022-07-29 13:43:35 -07:00
edwinwu 12dcd319e0 [BLE Refactor] Implement iOS BLE outgoing(request) connection.
PiperOrigin-RevId: 459381179
2022-07-06 17:13:14 -07:00
edwinwu 9ce81d8534 [BLE Refactor] Implement iOS BLE incoming connection.
PiperOrigin-RevId: 457110588
2022-06-24 15:58:47 -07:00
hai007 2d4cc75dfa Fix miscellaneous typos in the comments or logging.
PiperOrigin-RevId: 454649199
2022-06-13 10:55:57 -07:00
edwinwu 67b318fa6f [BLE Refactor] Refactor GATTClient implementation.
PiperOrigin-RevId: 454290863
2022-06-10 20:20:40 -07:00
jfcarroll 88ee3ba338 This needs to be declared in order to build on windows (and since it's declared that way in the header)
PiperOrigin-RevId: 454077812
2022-06-09 21:09:31 -07:00
edwinwu 9069451c08 [BLE Refactor] Add Base64 encoder to BleAdvertisementHeader
PiperOrigin-RevId: 453567012
2022-06-07 17:59:33 -07:00
hai007 37b0c31319 Add Wifi Hotspot AP and Client validation check
PiperOrigin-RevId: 451492039
2022-05-27 15:20:36 -07:00