Commit f8301da7 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

Specific case for CBErrorMaxConnection in 10.12 or before

In enum CBError, for 10.13, CBErrorMaxConnection has been removed,
and CBErrorConnectionFailed and CBErrorConnectionLimitReached have
added.

10.12:
  * CBErrorMaxConnection (value 10): The device already has the
                                     maximum number of connections.
10.13:
  * CBErrorConnectionFailed (value 10): The connection failed.
  * CBErrorLimitReached (value 11): The device already has the
                                    maximum number of connections.
So for 10.12 or earlier, CBErrorMaxConnection should be counted as
CBERROR_CONNECTION_LIMIT_REACHED. 

Bug: 
Change-Id: I3f9dac126b5701639d7b5ed7984e414ddcc02d29
Reviewed-on: https://chromium-review.googlesource.com/680215
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarVincent Scheib <scheib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504367}
parent dc10ba2a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import <CoreBluetooth/CoreBluetooth.h> #import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#include "base/mac/mac_util.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
namespace { namespace {
...@@ -51,7 +52,15 @@ MacOSBluetoothOperationsResult GetMacOSOperationResultFromNSError( ...@@ -51,7 +52,15 @@ MacOSBluetoothOperationsResult GetMacOSOperationResultFromNSError(
case CBErrorAlreadyAdvertising: case CBErrorAlreadyAdvertising:
return MacOSBluetoothOperationsResult::CBERROR_ALREADY_ADVERTISING; return MacOSBluetoothOperationsResult::CBERROR_ALREADY_ADVERTISING;
case CBErrorConnectionFailed: case CBErrorConnectionFailed:
return MacOSBluetoothOperationsResult::CBERROR_CONNECTION_FAILED; if (base::mac::IsAtLeastOS10_13()) {
return MacOSBluetoothOperationsResult::CBERROR_CONNECTION_FAILED;
} else {
// For macOS 10.12 or before, the value CBErrorMaxConnection has the
// same value than CBErrorConnectionFailed and the same description
// than CBErrorConnectionLimitReached.
return MacOSBluetoothOperationsResult::
CBERROR_CONNECTION_LIMIT_REACHED;
}
case CBErrorConnectionLimitReached: case CBErrorConnectionLimitReached:
return MacOSBluetoothOperationsResult::CBERROR_CONNECTION_LIMIT_REACHED; return MacOSBluetoothOperationsResult::CBERROR_CONNECTION_LIMIT_REACHED;
case CBErrorUnkownDevice: case CBErrorUnkownDevice:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment