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

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

Issue 1538173003: Implementing GATT connection/disconnect on OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing chromium.gyp_env Created 4 years, 11 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
OLDNEW
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_central_manager_delegate.h" 5 #include "device/bluetooth/bluetooth_low_energy_central_manager_delegate.h"
6 6
7 #include "device/bluetooth/bluetooth_adapter_mac.h" 7 #include "device/bluetooth/bluetooth_adapter_mac.h"
8 #include "device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h" 8 #include "device/bluetooth/bluetooth_low_energy_discovery_manager_mac.h"
9 9
10 namespace device { 10 namespace device {
(...skipping 15 matching lines...) Expand all
26 int rssi) { 26 int rssi) {
27 discovery_manager_->DiscoveredPeripheral(peripheral, advertisementData, 27 discovery_manager_->DiscoveredPeripheral(peripheral, advertisementData,
28 rssi); 28 rssi);
29 } 29 }
30 30
31 virtual void UpdatedState() { 31 virtual void UpdatedState() {
32 discovery_manager_->TryStartDiscovery(); 32 discovery_manager_->TryStartDiscovery();
33 adapter_->LowEnergyCentralManagerUpdatedState(); 33 adapter_->LowEnergyCentralManagerUpdatedState();
34 } 34 }
35 35
36 virtual void DidConnectPeripheral(CBPeripheral* peripheral) {
37 adapter_->DidConnectPeripheral(peripheral);
38 }
39
36 private: 40 private:
37 BluetoothLowEnergyDiscoveryManagerMac* discovery_manager_; 41 BluetoothLowEnergyDiscoveryManagerMac* discovery_manager_;
38 BluetoothAdapterMac* adapter_; 42 BluetoothAdapterMac* adapter_;
39 }; 43 };
40 44
41 } // namespace device 45 } // namespace device
42 46
43 @implementation BluetoothLowEnergyCentralManagerDelegate 47 @implementation BluetoothLowEnergyCentralManagerDelegate
44 48
45 - (id)initWithDiscoveryManager: 49 - (id)initWithDiscoveryManager:
(...skipping 12 matching lines...) Expand all
58 RSSI:(NSNumber*)RSSI { 62 RSSI:(NSNumber*)RSSI {
59 // Notifies the discovery of a device. 63 // Notifies the discovery of a device.
60 bridge_->DiscoveredPeripheral(peripheral, advertisementData, [RSSI intValue]); 64 bridge_->DiscoveredPeripheral(peripheral, advertisementData, [RSSI intValue]);
61 } 65 }
62 66
63 - (void)centralManagerDidUpdateState:(CBCentralManager*)central { 67 - (void)centralManagerDidUpdateState:(CBCentralManager*)central {
64 // Notifies when the powered state of the central manager changed. 68 // Notifies when the powered state of the central manager changed.
65 bridge_->UpdatedState(); 69 bridge_->UpdatedState();
66 } 70 }
67 71
72 - (void)centralManager:(CBCentralManager*)central
73 didConnectPeripheral:(CBPeripheral*)peripheral {
74 bridge_->DidConnectPeripheral(peripheral);
75 }
76
68 @end 77 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698