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

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

Issue 1538173003: Implementing GATT connection/disconnect on OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void Forget(const base::Closure& callback, 67 void Forget(const base::Closure& callback,
68 const ErrorCallback& error_callback) override; 68 const ErrorCallback& error_callback) override;
69 void ConnectToService( 69 void ConnectToService(
70 const BluetoothUUID& uuid, 70 const BluetoothUUID& uuid,
71 const ConnectToServiceCallback& callback, 71 const ConnectToServiceCallback& callback,
72 const ConnectToServiceErrorCallback& error_callback) override; 72 const ConnectToServiceErrorCallback& error_callback) override;
73 void ConnectToServiceInsecurely( 73 void ConnectToServiceInsecurely(
74 const device::BluetoothUUID& uuid, 74 const device::BluetoothUUID& uuid,
75 const ConnectToServiceCallback& callback, 75 const ConnectToServiceCallback& callback,
76 const ConnectToServiceErrorCallback& error_callback) override; 76 const ConnectToServiceErrorCallback& error_callback) override;
77 void CreateGattConnection(
78 const GattConnectionCallback& callback,
79 const ConnectErrorCallback& error_callback) override;
80 77
81 // BluetoothDeviceMac override. 78 // BluetoothDeviceMac override.
82 NSDate* GetLastUpdateTime() const override; 79 NSDate* GetLastUpdateTime() const override;
83 80
84 protected: 81 protected:
85 // BluetoothDevice override. 82 // BluetoothDevice override.
86 std::string GetDeviceName() const override; 83 std::string GetDeviceName() const override;
87 void CreateGattConnectionImpl() override; 84 void CreateGattConnectionImpl() override;
88 void DisconnectGatt() override; 85 void DisconnectGatt() override;
89 86
(...skipping 10 matching lines...) Expand all
100 // http://crbug.com/507824 97 // http://crbug.com/507824
101 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); 98 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral);
102 99
103 private: 100 private:
104 friend class BluetoothAdapterMac; 101 friend class BluetoothAdapterMac;
105 friend class BluetoothAdapterMacTest; 102 friend class BluetoothAdapterMacTest;
106 103
107 // Equivalent to [peripheral_ state]. Allows compilation on OS X 10.6. 104 // Equivalent to [peripheral_ state]. Allows compilation on OS X 10.6.
108 CBPeripheralState GetPeripheralState() const; 105 CBPeripheralState GetPeripheralState() const;
109 106
107 // Called by the adapter when CoreBluetooth calls CBCentralManager's delegate.
108 void GattConnected();
109
110 // CoreBluetooth data structure. 110 // CoreBluetooth data structure.
111 base::scoped_nsobject<CBPeripheral> peripheral_; 111 base::scoped_nsobject<CBPeripheral> peripheral_;
112 112
113 // RSSI value. 113 // RSSI value.
114 int rssi_; 114 int rssi_;
115 115
116 // Whether the device is connectable. 116 // Whether the device is connectable.
117 bool connectable_; 117 bool connectable_;
118 118
119 // The peripheral's identifier, as returned by [CBPeripheral identifier]. 119 // The peripheral's identifier, as returned by [CBPeripheral identifier].
120 std::string identifier_; 120 std::string identifier_;
121 121
122 // A local address for the device created by hashing the peripheral 122 // A local address for the device created by hashing the peripheral
123 // identifier. 123 // identifier.
124 std::string hash_address_; 124 std::string hash_address_;
125 125
126 // Stores the time of the most recent call to Update(). 126 // Stores the time of the most recent call to Update().
127 base::scoped_nsobject<NSDate> last_update_time_; 127 base::scoped_nsobject<NSDate> last_update_time_;
128 128
129 // The services (identified by UUIDs) that this device provides. 129 // The services (identified by UUIDs) that this device provides.
130 std::set<BluetoothUUID> advertised_uuids_; 130 std::set<BluetoothUUID> advertised_uuids_;
131 131
132 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); 132 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac);
133 }; 133 };
134 134
135 } // namespace device 135 } // namespace device
136 136
137 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ 137 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698