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

Unified Diff: device/bluetooth/bluetooth_device.h

Issue 2248913002: bluetooth: Implement RSSI and Tx Power on macOS and Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-refactor-adv-data
Patch Set: Address jyasskin's comments Created 4 years, 4 months 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
Index: device/bluetooth/bluetooth_device.h
diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h
index 6b27bd05ec1d63a74eb2500def8364043d909915..2a5389c4f2b363a78ea4a01414b6db50c9748909 100644
--- a/device/bluetooth/bluetooth_device.h
+++ b/device/bluetooth/bluetooth_device.h
@@ -216,6 +216,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
virtual ~BluetoothDevice();
+ // Clamps numbers less than -128 to -128 and numbers greater than 127 to 127.
+ static int8_t ClampPower(int power);
+
// Returns the Bluetooth class of the device, used by GetDeviceType()
// and metrics logging,
virtual uint32_t GetBluetoothClass() const = 0;
@@ -331,12 +334,15 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
// The received signal strength, in dBm. This field is avaliable and valid
// only during discovery.
- virtual base::Optional<int8_t> GetInquiryRSSI() const = 0;
+ // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets inquiry_rssi_.
+ virtual base::Optional<int8_t> GetInquiryRSSI() const;
// The transmitted power level. This field is avaliable only for LE devices
// that include this field in AD. It is avaliable and valid only during
// discovery.
- virtual base::Optional<int8_t> GetInquiryTxPower() const = 0;
+ // TODO(http://crbug.com/580406): Devirtualize once BlueZ sets
+ // inquiry_tx_power_.
+ virtual base::Optional<int8_t> GetInquiryTxPower() const;
// The ErrorCallback is used for methods that can fail in which case it
// is called, in the success case the callback is simply not called.
@@ -512,8 +518,10 @@ 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(UUIDList advertised_uuids,
- ServiceDataMap service_data);
+ void UpdateAdvertisementData(int8_t rssi,
+ UUIDList advertised_uuids,
+ ServiceDataMap service_data,
+ const int8_t* tx_power);
// Called by BluetoothAdapter when it stops discoverying.
void ClearAdvertisementData();
@@ -617,6 +625,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothDevice {
GattServiceMap gatt_services_;
bool gatt_services_discovery_complete_;
+ // Received Signal Strength Indicator of the advertisement received.
+ base::Optional<int8_t> inquiry_rssi_;
+
+ // Tx Power advertised by the device.
+ base::Optional<int8_t> inquiry_tx_power_;
+
// Class that holds the union of Advertised UUIDs and Service UUIDs.
DeviceUUIDs device_uuids_;

Powered by Google App Engine
This is Rietveld 408576698