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

Unified Diff: device/bluetooth/bluetooth_adapter_mac.mm

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_adapter_mac.mm
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index ef4a20dee2da1156e992a84add68576b47755754..06f11a27a82534ee850ee0307daa3d03d9a020af 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -539,8 +539,15 @@ void BluetoothAdapterMac::LowEnergyDeviceUpdated(
std::vector<uint8_t>(bytes, bytes + length));
}
- device_mac->UpdateAdvertisementData(std::move(advertised_uuids),
- std::move(service_data_map));
+ // Get Tx Power.
+ NSNumber* tx_power =
+ [advertisement_data objectForKey:CBAdvertisementDataTxPowerLevelKey];
+ int8_t clamped_tx_power = BluetoothDevice::ClampPower([tx_power intValue]);
+
+ device_mac->UpdateAdvertisementData(
+ BluetoothDevice::ClampPower(rssi), std::move(advertised_uuids),
+ std::move(service_data_map),
+ tx_power == nil ? nullptr : &clamped_tx_power);
if (is_new_device) {
std::string device_address =

Powered by Google App Engine
This is Rietveld 408576698