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

Unified Diff: device/bluetooth/bluetooth_adapter_mac.h

Issue 1538173003: Implementing GATT connection/disconnect on OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updating comment. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_adapter_mac.h
diff --git a/device/bluetooth/bluetooth_adapter_mac.h b/device/bluetooth/bluetooth_adapter_mac.h
index 472c2f9bd104fc65cdf9e53719324d8612bc1069..7bd221d425fb0099e4af4dc4850547c6408ae0ee 100644
--- a/device/bluetooth/bluetooth_adapter_mac.h
+++ b/device/bluetooth/bluetooth_adapter_mac.h
@@ -97,10 +97,16 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
// (crbug.com/506287).
static bool IsLowEnergyAvailable();
- // Resets |low_energy_central_manager_| to |central_manager| and sets
- // |low_energy_central_manager_delegate_| as the manager's delegate. Should
- // be called only when |IsLowEnergyAvailable()|.
- void SetCentralManagerForTesting(CBCentralManager* central_manager);
+ // Creates a GATT connection by calling CoreBluetooth APIs.
+ void CreateGattConnection(BluetoothLowEnergyDeviceMac* device_mac);
+
+ // Closes the GATT connection by calling CoreBluetooth APIs.
+ void DisconnectGatt(BluetoothLowEnergyDeviceMac* device_mac);
+
+ // Methods called from CBCentralManager delegate.
+ void DidConnectPeripheral(CBPeripheral* peripheral);
+ void DidFailToConnectPeripheral(CBPeripheral* peripheral, NSError* error);
+ void DidDisconnectPeripheral(CBPeripheral* peripheral, NSError* error);
protected:
// BluetoothAdapter override:
@@ -108,6 +114,12 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
device::BluetoothDevice::PairingDelegate* pairing_delegate) override;
private:
+ // Resets |low_energy_central_manager_| to |central_manager| and sets
+ // |low_energy_central_manager_delegate_| as the manager's delegate. Should
+ // be called only when |IsLowEnergyAvailable()|.
+ void SetCentralManagerForTesting(CBCentralManager* central_manager);
+ CBCentralManager* GetCentralManagerForTesting();
+
// The length of time that must elapse since the last Inquiry response (on
// Classic devices) or call to BluetoothLowEnergyDevice::Update() (on Low
// Energy) before a discovered device is considered to be no longer available.
@@ -162,6 +174,10 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterMac
// observers.
void AddPairedDevices();
+ // Returns the BLE device associated with the CoreBluetooth peripheral.
+ BluetoothLowEnergyDeviceMac* GetBluetoothLowEnergyDeviceMac(
+ CBPeripheral* peripheral);
+
std::string address_;
std::string name_;
bool classic_powered_;

Powered by Google App Engine
This is Rietveld 408576698