Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1620)

Unified Diff: device/bluetooth/bluetooth_device.h

Issue 2377513004: bluetooth:android: Return the advertised name if advertising (Closed)
Patch Set: Format' Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device.h
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 1dc6bcd658d6c8f8aaccd556da6cea8673ef76c7..5f3b37e3bef42f4900dd8d58334cf9cc3c97fc22 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -238,6 +238,11 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
virtual uint16_t GetAppearance() const = 0;
// Returns the name of the device, which may be empty.
+ //
+ // On Android: If the device is connected we retrieve the name from the system
+ // but if the device is not connected we use the name in the last advertising
+ // packet. We do this because the function to retrieve the name takes several
+ // ms on Android.
virtual base::Optional<std::string> GetName() const = 0;
// Returns the name of the device suitable for displaying, this may
@@ -549,6 +554,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// Called by BluetoothAdapter when a new Advertisement is seen for this
// device. This replaces previously seen Advertisement Data.
void UpdateAdvertisementData(int8_t rssi,
+ const std::string* advertised_name,
UUIDList advertised_uuids,
ServiceDataMap service_data,
const int8_t* tx_power);
@@ -649,6 +655,8 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// BluetoothGattConnection objects keeping the GATT connection alive.
std::set<BluetoothGattConnection*> gatt_connections_;
+ base::Optional<std::string> advertised_name_;
+
GattServiceMap gatt_services_;
bool gatt_services_discovery_complete_;
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698