Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: device/bluetooth/bluetooth_adapter_mac.mm

Issue 2641133003: Bluetooth: macOS: Adding counter for service discovery callbacks. (Closed)
Patch Set: Adding comment Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_adapter_mac.h" 5 #include "device/bluetooth/bluetooth_adapter_mac.h"
6 6
7 #import <IOBluetooth/objc/IOBluetoothDevice.h> 7 #import <IOBluetooth/objc/IOBluetoothDevice.h>
8 #import <IOBluetooth/objc/IOBluetoothHostController.h> 8 #import <IOBluetooth/objc/IOBluetoothHostController.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 644
645 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) { 645 void BluetoothAdapterMac::DidConnectPeripheral(CBPeripheral* peripheral) {
646 BluetoothLowEnergyDeviceMac* device_mac = 646 BluetoothLowEnergyDeviceMac* device_mac =
647 GetBluetoothLowEnergyDeviceMac(peripheral); 647 GetBluetoothLowEnergyDeviceMac(peripheral);
648 if (!device_mac) { 648 if (!device_mac) {
649 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; 649 [low_energy_central_manager_ cancelPeripheralConnection:peripheral];
650 return; 650 return;
651 } 651 }
652 device_mac->DidConnectGatt(); 652 device_mac->DidConnectGatt();
653 [device_mac->GetPeripheral() discoverServices:nil]; 653 device_mac->DiscoverPrimaryServices();
654 } 654 }
655 655
656 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral, 656 void BluetoothAdapterMac::DidFailToConnectPeripheral(CBPeripheral* peripheral,
657 NSError* error) { 657 NSError* error) {
658 BluetoothLowEnergyDeviceMac* device_mac = 658 BluetoothLowEnergyDeviceMac* device_mac =
659 GetBluetoothLowEnergyDeviceMac(peripheral); 659 GetBluetoothLowEnergyDeviceMac(peripheral);
660 if (!device_mac) { 660 if (!device_mac) {
661 [low_energy_central_manager_ cancelPeripheralConnection:peripheral]; 661 [low_energy_central_manager_ cancelPeripheralConnection:peripheral];
662 return; 662 return;
663 } 663 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 // hash the probability of this occuring with 10,000 devices 716 // hash the probability of this occuring with 10,000 devices
717 // simultaneously present is 1e-6 (see 717 // simultaneously present is 1e-6 (see
718 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We 718 // https://en.wikipedia.org/wiki/Birthday_problem#Probability_table). We
719 // ignore the second device by returning. 719 // ignore the second device by returning.
720 return true; 720 return true;
721 } 721 }
722 return false; 722 return false;
723 } 723 }
724 724
725 } // namespace device 725 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698