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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_device_mac.h

Issue 2853933002: bluetooth: macOS: Support for extra didConnectPeripheral event from macOS. (Closed)
Patch Set: Fixing test for observer.device_changed_count() Created 3 years, 7 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_
7 7
8 #if defined(OS_IOS) 8 #if defined(OS_IOS)
9 #import <CoreBluetooth/CoreBluetooth.h> 9 #import <CoreBluetooth/CoreBluetooth.h>
10 #else // !defined(OS_IOS) 10 #else // !defined(OS_IOS)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); 103 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral);
104 104
105 private: 105 private:
106 friend class BluetoothAdapterMac; 106 friend class BluetoothAdapterMac;
107 friend class BluetoothAdapterMacTest; 107 friend class BluetoothAdapterMacTest;
108 friend class BluetoothLowEnergyPeripheralBridge; 108 friend class BluetoothLowEnergyPeripheralBridge;
109 friend class BluetoothRemoteGattServiceMac; 109 friend class BluetoothRemoteGattServiceMac;
110 friend class BluetoothTestMac; 110 friend class BluetoothTestMac;
111 friend class BluetoothRemoteGattServiceMac; 111 friend class BluetoothRemoteGattServiceMac;
112 112
113 // Calls the macOS to discover primary services. 113 // Called by the adapter when the device is connected.
114 void DidConnectPeripheral();
115
116 // Calls macOS to discover primary services.
114 void DiscoverPrimaryServices(); 117 void DiscoverPrimaryServices();
115 118
116 // Sends notification if this device is ready with all services discovered. 119 // Sends notification if this device is ready with all services discovered.
117 void SendNotificationIfDiscoveryComplete(); 120 void SendNotificationIfDiscoveryComplete();
118 121
119 // Returns the Bluetooth adapter. 122 // Returns the Bluetooth adapter.
120 BluetoothAdapterMac* GetMacAdapter(); 123 BluetoothAdapterMac* GetMacAdapter();
121 124
122 // Returns the CoreBluetooth Peripheral. 125 // Returns the CoreBluetooth Peripheral.
123 CBPeripheral* GetPeripheral(); 126 CBPeripheral* GetPeripheral();
(...skipping 12 matching lines...) Expand all
136 // CoreBluetooth data structure. 139 // CoreBluetooth data structure.
137 base::scoped_nsobject<CBPeripheral> peripheral_; 140 base::scoped_nsobject<CBPeripheral> peripheral_;
138 141
139 // Objective-C delegate for the CBPeripheral. 142 // Objective-C delegate for the CBPeripheral.
140 base::scoped_nsobject<BluetoothLowEnergyPeripheralDelegate> 143 base::scoped_nsobject<BluetoothLowEnergyPeripheralDelegate>
141 peripheral_delegate_; 144 peripheral_delegate_;
142 145
143 // Whether the device is connectable. 146 // Whether the device is connectable.
144 bool connectable_; 147 bool connectable_;
145 148
149 // Whether the device is connected.
150 bool connected_;
151
146 // The peripheral's identifier, as returned by [CBPeripheral identifier]. 152 // The peripheral's identifier, as returned by [CBPeripheral identifier].
147 std::string identifier_; 153 std::string identifier_;
148 154
149 // A local address for the device created by hashing the peripheral 155 // A local address for the device created by hashing the peripheral
150 // identifier. 156 // identifier.
151 std::string hash_address_; 157 std::string hash_address_;
152 158
153 // Increases each time -[CBPeripheral discoverServices:] is called, and 159 // Increases each time -[CBPeripheral discoverServices:] is called, and
154 // decreases each time DidDiscoverPrimaryServices() is called. Once the 160 // decreases each time DidDiscoverPrimaryServices() is called. Once the
155 // value is set to 0, characteristics and properties are discovered. 161 // value is set to 0, characteristics and properties are discovered.
156 int discovery_pending_count_; 162 int discovery_pending_count_;
157 163
158 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); 164 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac);
159 }; 165 };
160 166
161 // Stream operator for logging. 167 // Stream operator for logging.
162 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<( 168 DEVICE_BLUETOOTH_EXPORT std::ostream& operator<<(
163 std::ostream& out, 169 std::ostream& out,
164 const BluetoothLowEnergyDeviceMac& device); 170 const BluetoothLowEnergyDeviceMac& device);
165 171
166 } // namespace device 172 } // namespace device
167 173
168 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ 174 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698