| Index: device/bluetooth/bluetooth_device_mac.mm
|
| diff --git a/device/bluetooth/bluetooth_device_mac.mm b/device/bluetooth/bluetooth_device_mac.mm
|
| index 2725faeab07dcecbf5806b9799fee147ece7b549..a2f3274dbf8ec525f52ebfb4acbf25b68012020b 100644
|
| --- a/device/bluetooth/bluetooth_device_mac.mm
|
| +++ b/device/bluetooth/bluetooth_device_mac.mm
|
| @@ -6,6 +6,8 @@
|
|
|
| #include "device/bluetooth/bluetooth_adapter_mac.h"
|
|
|
| +static NSString* const kErrorDomain = @"ConnectErrorCode";
|
| +
|
| namespace device {
|
|
|
| BluetoothDeviceMac::BluetoothDeviceMac(BluetoothAdapterMac* adapter)
|
| @@ -14,4 +16,26 @@ BluetoothDeviceMac::BluetoothDeviceMac(BluetoothAdapterMac* adapter)
|
| BluetoothDeviceMac::~BluetoothDeviceMac() {
|
| }
|
|
|
| +NSError* BluetoothDeviceMac::GetNSErrorFromConnectErrorCode(
|
| + BluetoothDevice::ConnectErrorCode error_code) {
|
| + // TODO(http://crbug.com/585894): Need to convert the error.
|
| + return [NSError errorWithDomain:kErrorDomain code:error_code userInfo:nil];
|
| +}
|
| +
|
| +BluetoothDevice::ConnectErrorCode
|
| +BluetoothDeviceMac::GetConnectErrorCodeFromNSError(NSError* error) {
|
| + if ([error.domain isEqualToString:kErrorDomain]) {
|
| + BluetoothDevice::ConnectErrorCode connect_error_code =
|
| + (BluetoothDevice::ConnectErrorCode)error.code;
|
| + if (connect_error_code >= 0 ||
|
| + connect_error_code < BluetoothDevice::NUM_CONNECT_ERROR_CODES) {
|
| + return connect_error_code;
|
| + }
|
| + DCHECK(false);
|
| + return BluetoothDevice::ERROR_FAILED;
|
| + }
|
| + // TODO(http://crbug.com/585894): Need to convert the error.
|
| + return BluetoothDevice::ERROR_FAILED;
|
| +}
|
| +
|
| } // namespace device
|
|
|