| Index: device/bluetooth/bluetooth_adapter_mac.mm
|
| diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
| index 1d51e702226fe5ba1ea92833b8c2b1b6705e746d..a4680b0a57f84669559a556a4fbc330e3436bf0e 100644
|
| --- a/device/bluetooth/bluetooth_adapter_mac.mm
|
| +++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
| @@ -536,4 +536,31 @@ void BluetoothAdapterMac::AddPairedDevices() {
|
| }
|
| }
|
|
|
| +void BluetoothAdapterMac::CreateGattConnection(
|
| + BluetoothLowEnergyDeviceMac* deviceMac) {
|
| + [low_energy_central_manager_ connectPeripheral:deviceMac->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* deviceMac) {
|
| + [low_energy_central_manager_
|
| + cancelPeripheralConnection:deviceMac->peripheral_];
|
| +}
|
| +
|
| } // namespace device
|
|
|