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

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: Fix mac test 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..2e25aab0800c1030a4ff20b2e6cba73e159e91b9 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -539,8 +539,18 @@ 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];
+ base::Optional<int8_t> clamped_tx_power =
+ tx_power == nil ? base::nullopt
+ : base::make_optional<int8_t>(
+ BluetoothDevice::ClampPower([tx_power intValue]));
Jeffrey Yasskin 2016/08/24 22:32:07 Same reminder here as on Android. I forget about t
ortuno 2016/08/25 16:42:34 Done. [tx_power intValue] is 0 when tx_power is ni
+
+ device_mac->UpdateAdvertisementData(
+ BluetoothDevice::ClampPower(rssi), std::move(advertised_uuids),
+ std::move(service_data_map),
+ clamped_tx_power ? &clamped_tx_power.value() : nullptr);
if (is_new_device) {
std::string device_address =

Powered by Google App Engine
This is Rietveld 408576698