| Index: device/bluetooth/bluetooth_device_mac.mm
|
| diff --git a/device/bluetooth/bluetooth_device_mac.mm b/device/bluetooth/bluetooth_device_mac.mm
|
| index 24c2b45664655a671b79ede15c794208dd7f2c08..12c3e272b93d897faeb3a953aabf436cabf74a39 100644
|
| --- a/device/bluetooth/bluetooth_device_mac.mm
|
| +++ b/device/bluetooth/bluetooth_device_mac.mm
|
| @@ -4,11 +4,6 @@
|
|
|
| #include "device/bluetooth/bluetooth_device_mac.h"
|
|
|
| -#include <IOBluetooth/Bluetooth.h>
|
| -#import <IOBluetooth/objc/IOBluetoothDevice.h>
|
| -#import <IOBluetooth/objc/IOBluetoothSDPServiceRecord.h>
|
| -#import <IOBluetooth/objc/IOBluetoothSDPUUID.h>
|
| -
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| @@ -35,6 +30,15 @@
|
|
|
| #endif // MAC_OS_X_VERSION_10_7
|
|
|
| +// TODO(isherman): Check with Mac experts as to whether this sort of thing is ok
|
| +// or not in Chromium.
|
| +@interface IOBluetoothHostController (PrivateOSAPIThatIProbablyShouldntMessWith)
|
| +- (IOReturn)
|
| + BluetoothHCIReadTransmitPowerLevel:(BluetoothConnectionHandle)
|
| + inType:(BluetoothHCITransmitPowerLevelType)
|
| + outTransmitPowerLevel:(BluetoothHCITransmitPowerLevel*);
|
| +@end
|
| +
|
| namespace device {
|
|
|
| BluetoothDeviceMac::BluetoothDeviceMac(IOBluetoothDevice* device)
|
| @@ -84,6 +88,24 @@ uint16 BluetoothDeviceMac::GetDeviceID() const {
|
| return 0;
|
| }
|
|
|
| +int BluetoothDeviceMac::GetRSSI() const {
|
| + int rssi = [device_ rawRSSI];
|
| +
|
| + // The API guarantees that +127 is returned in case the RSSI is not readable.
|
| + if (rssi == 127)
|
| + return kUnknownPower;
|
| +
|
| + return rssi;
|
| +}
|
| +
|
| +int BluetoothDeviceMac::GetCurrentHostTransmitPower() const {
|
| + return GetHostTransmitPower(kReadCurrentTransmitPowerLevel);
|
| +}
|
| +
|
| +int BluetoothDeviceMac::GetMaximumHostTransmitPower() const {
|
| + return GetHostTransmitPower(kReadMaximumTransmitPowerLevel);
|
| +}
|
| +
|
| bool BluetoothDeviceMac::IsPaired() const {
|
| return [device_ isPaired];
|
| }
|
| @@ -183,4 +205,19 @@ void BluetoothDeviceMac::ClearOutOfBandPairingData(
|
| NOTIMPLEMENTED();
|
| }
|
|
|
| +int BluetoothDeviceMac::GetHostTransmitPower(
|
| + BluetoothHCITransmitPowerLevelType power_level_type) const {
|
| + IOBluetoothHostController* controller =
|
| + [IOBluetoothHostController defaultController];
|
| + BluetoothHCITransmitPowerLevel power_level;
|
| + IOReturn result =
|
| + [controller BluetoothHCIReadTransmitPowerLevel:[device_ connectionHandle]
|
| + inType:power_level_type
|
| + outTransmitPowerLevel:&power_level];
|
| + if (result != kIOReturnSuccess)
|
| + return kUnknownPower;
|
| +
|
| + return power_level;
|
| +}
|
| +
|
| } // namespace device
|
|
|