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

Unified Diff: device/bluetooth/bluetooth_classic_device_mac.mm

Issue 1941923002: bluetooth: Return int8_t and use -128 for unknown tx power. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Fix extensions tests Created 4 years, 7 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
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698