| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" | 5 #include "device/bluetooth/bluetooth_low_energy_device_mac.h" |
| 6 | 6 |
| 7 #import <CoreFoundation/CoreFoundation.h> | 7 #import <CoreFoundation/CoreFoundation.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 void BluetoothLowEnergyDeviceMac::ConnectToServiceInsecurely( | 170 void BluetoothLowEnergyDeviceMac::ConnectToServiceInsecurely( |
| 171 const device::BluetoothUUID& uuid, | 171 const device::BluetoothUUID& uuid, |
| 172 const ConnectToServiceCallback& callback, | 172 const ConnectToServiceCallback& callback, |
| 173 const ConnectToServiceErrorCallback& error_callback) { | 173 const ConnectToServiceErrorCallback& error_callback) { |
| 174 NOTIMPLEMENTED(); | 174 NOTIMPLEMENTED(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void BluetoothLowEnergyDeviceMac::CreateGattConnectionImpl() { | 177 void BluetoothLowEnergyDeviceMac::CreateGattConnectionImpl() { |
| 178 if (!IsGattConnected()) { | 178 if (!IsGattConnected()) { |
| 179 VLOG(1) << *this << ": CreateGattConnection."; | |
| 180 GetMacAdapter()->CreateGattConnection(this); | 179 GetMacAdapter()->CreateGattConnection(this); |
| 181 } | 180 } |
| 182 } | 181 } |
| 183 | 182 |
| 184 void BluetoothLowEnergyDeviceMac::DisconnectGatt() { | 183 void BluetoothLowEnergyDeviceMac::DisconnectGatt() { |
| 185 VLOG(1) << *this << ": Disconnect."; | |
| 186 GetMacAdapter()->DisconnectGatt(this); | 184 GetMacAdapter()->DisconnectGatt(this); |
| 187 } | 185 } |
| 188 | 186 |
| 189 void BluetoothLowEnergyDeviceMac::DidDiscoverPrimaryServices(NSError* error) { | 187 void BluetoothLowEnergyDeviceMac::DidDiscoverPrimaryServices(NSError* error) { |
| 190 --discovery_pending_count_; | 188 --discovery_pending_count_; |
| 191 if (discovery_pending_count_ < 0) { | 189 if (discovery_pending_count_ < 0) { |
| 192 // This should never happens, just in case it happens with a device, | 190 // This should never happens, just in case it happens with a device, |
| 193 // discovery_pending_count_ is set back to 0. | 191 // discovery_pending_count_ is set back to 0. |
| 194 VLOG(1) << *this | 192 VLOG(1) << *this |
| 195 << ": BluetoothLowEnergyDeviceMac::discovery_pending_count_ " | 193 << ": BluetoothLowEnergyDeviceMac::discovery_pending_count_ " |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 std::ostream& operator<<(std::ostream& out, | 428 std::ostream& operator<<(std::ostream& out, |
| 431 const BluetoothLowEnergyDeviceMac& device) { | 429 const BluetoothLowEnergyDeviceMac& device) { |
| 432 // TODO(crbug.com/703878): Should use | 430 // TODO(crbug.com/703878): Should use |
| 433 // BluetoothLowEnergyDeviceMac::GetNameForDisplay() instead. | 431 // BluetoothLowEnergyDeviceMac::GetNameForDisplay() instead. |
| 434 base::Optional<std::string> name = device.GetName(); | 432 base::Optional<std::string> name = device.GetName(); |
| 435 const char* name_cstr = name ? name->c_str() : ""; | 433 const char* name_cstr = name ? name->c_str() : ""; |
| 436 return out << "<BluetoothLowEnergyDeviceMac " << device.GetAddress() << "/" | 434 return out << "<BluetoothLowEnergyDeviceMac " << device.GetAddress() << "/" |
| 437 << &device << ", \"" << name_cstr << "\">"; | 435 << &device << ", \"" << name_cstr << "\">"; |
| 438 } | 436 } |
| 439 } // namespace device | 437 } // namespace device |
| OLD | NEW |