Chromium Code Reviews| Index: device/bluetooth/bluetooth_classic_device_mac.mm |
| diff --git a/device/bluetooth/bluetooth_classic_device_mac.mm b/device/bluetooth/bluetooth_classic_device_mac.mm |
| index 985596ecfc59873e8797f52d9690489597abda9c..f2f3ffaa76c6a5ba2162d774e8a0c9f059894a56 100644 |
| --- a/device/bluetooth/bluetooth_classic_device_mac.mm |
| +++ b/device/bluetooth/bluetooth_classic_device_mac.mm |
| @@ -145,13 +145,13 @@ BluetoothDevice::UUIDList BluetoothClassicDeviceMac::GetUUIDs() const { |
| return uuids; |
| } |
| -int16_t BluetoothClassicDeviceMac::GetInquiryRSSI() const { |
| - return kUnknownPower; |
| +base::Optional<int8_t> BluetoothClassicDeviceMac::GetInquiryRSSI() const { |
| + return base::Optional<int8_t>(); |
|
scheib
2016/05/07 02:06:52
return nullopt;
|
| } |
| -int16_t BluetoothClassicDeviceMac::GetInquiryTxPower() const { |
| +base::Optional<int8_t> BluetoothClassicDeviceMac::GetInquiryTxPower() const { |
| NOTIMPLEMENTED(); |
| - return kUnknownPower; |
| + return base::Optional<int8_t>(); |
| } |
| bool BluetoothClassicDeviceMac::ExpectingPinCode() const { |
| @@ -177,11 +177,12 @@ void BluetoothClassicDeviceMac::GetConnectionInfo( |
| return; |
| } |
| - connection_info.rssi = [device_ rawRSSI]; |
| + BluetoothHCIRSSIValue rssi = [device_ rawRSSI]; |
| + |
| // The API guarantees that +127 is returned in case the RSSI is not readable: |
| // http://goo.gl/bpURYv |
| - if (connection_info.rssi == 127) |
| - connection_info.rssi = kUnknownPower; |
| + if (rssi == 127) |
| + connection_info.rssi = base::make_optional(rssi); |
|
scheib
2016/05/07 02:06:52
In the event rssi is 127 we want to use nullopt, e
|
| connection_info.transmit_power = |
| GetHostTransmitPower(kReadCurrentTransmitPowerLevel); |
| @@ -256,7 +257,7 @@ NSDate* BluetoothClassicDeviceMac::GetLastUpdateTime() const { |
| return [device_ getLastInquiryUpdate]; |
| } |
| -int BluetoothClassicDeviceMac::GetHostTransmitPower( |
| +base::Optional<int8_t> BluetoothClassicDeviceMac::GetHostTransmitPower( |
| BluetoothHCITransmitPowerLevelType power_level_type) const { |
| IOBluetoothHostController* controller = |
| [IOBluetoothHostController defaultController]; |
| @@ -266,7 +267,7 @@ int BluetoothClassicDeviceMac::GetHostTransmitPower( |
| inType: |
| outTransmitPowerLevel:); |
| if (![controller respondsToSelector:selector]) |
| - return kUnknownPower; |
| + return base::nullopt; |
| BluetoothHCITransmitPowerLevel power_level; |
| IOReturn result = |
| @@ -274,9 +275,9 @@ int BluetoothClassicDeviceMac::GetHostTransmitPower( |
| inType:power_level_type |
| outTransmitPowerLevel:&power_level]; |
| if (result != kIOReturnSuccess) |
| - return kUnknownPower; |
| + return base::nullopt; |
| - return power_level; |
| + return base::make_optional(power_level); |
| } |
| // static |