| Index: device/bluetooth/bluetooth_adapter_mac.mm
|
| diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
| index 72554ed21b458129818ec0f12243a6be8a58cd7a..ece07d663e19524dc59fbabb5cca40d8828a80a1 100644
|
| --- a/device/bluetooth/bluetooth_adapter_mac.mm
|
| +++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
| @@ -232,6 +232,10 @@ void BluetoothAdapterMac::SetCentralManagerForTesting(
|
| low_energy_central_manager_.get());
|
| }
|
|
|
| +CBCentralManager* BluetoothAdapterMac::GetCentralManagerForTesting() {
|
| + return low_energy_central_manager_;
|
| +}
|
| +
|
| void BluetoothAdapterMac::RemovePairingDelegateInternal(
|
| BluetoothDevice::PairingDelegate* pairing_delegate) {
|
| }
|
| @@ -537,4 +541,31 @@ void BluetoothAdapterMac::AddPairedDevices() {
|
| }
|
| }
|
|
|
| +void BluetoothAdapterMac::CreateGattConnection(
|
| + BluetoothLowEnergyDeviceMac* device_mac) {
|
| + [low_energy_central_manager_ connectPeripheral:device_mac->peripheral_
|
| + options:nil];
|
| +}
|
| +
|
| +void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) {
|
| + std::string device_address =
|
| + BluetoothLowEnergyDeviceMac::GetPeripheralHashAddress(peripheral);
|
| + // Try to find device from |devices_| with key |device_address|,
|
| + // if has no entry in the map, disconnect the peripheral.
|
| + DevicesMap::const_iterator iter = devices_.find(device_address);
|
| + if (iter == devices_.end()) {
|
| + [low_energy_central_manager_ cancelPeripheralConnection:peripheral];
|
| + return;
|
| + }
|
| + BluetoothLowEnergyDeviceMac* device_mac =
|
| + static_cast<BluetoothLowEnergyDeviceMac*>(iter->second);
|
| + device_mac->GattConnected();
|
| +}
|
| +
|
| +void BluetoothAdapterMac::DisconnectGatt(
|
| + BluetoothLowEnergyDeviceMac* device_mac) {
|
| + [low_energy_central_manager_
|
| + cancelPeripheralConnection:device_mac->peripheral_];
|
| +}
|
| +
|
| } // namespace device
|
|
|