OLD | NEW |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 protected: | 89 protected: |
90 // BluetoothDevice override. | 90 // BluetoothDevice override. |
91 std::string GetDeviceName() const override; | 91 std::string GetDeviceName() const override; |
92 void CreateGattConnectionImpl() override; | 92 void CreateGattConnectionImpl() override; |
93 void DisconnectGatt() override; | 93 void DisconnectGatt() override; |
94 | 94 |
95 // Methods used by BluetoothLowEnergyPeripheralBridge. | 95 // Methods used by BluetoothLowEnergyPeripheralBridge. |
96 void DidDiscoverPrimaryServices(NSError* error); | 96 void DidDiscoverPrimaryServices(NSError* error); |
97 void DidModifyServices(NSArray* invalidatedServices); | 97 void DidModifyServices(NSArray* invalidatedServices); |
98 void DidDiscoverCharacteristics(CBService* cb_service, NSError* error); | 98 void DidDiscoverCharacteristics(CBService* cb_service, NSError* error); |
| 99 void DidUpdateValue(CBCharacteristic* characteristic, NSError* error); |
99 | 100 |
100 // Updates information about the device. | 101 // Updates information about the device. |
101 virtual void Update(NSDictionary* advertisement_data, int rssi); | 102 virtual void Update(NSDictionary* advertisement_data, int rssi); |
102 | 103 |
103 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); | 104 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); |
104 | 105 |
105 // Hashes and truncates the peripheral identifier to deterministically | 106 // Hashes and truncates the peripheral identifier to deterministically |
106 // construct an address. The use of fake addresses is a temporary fix before | 107 // construct an address. The use of fake addresses is a temporary fix before |
107 // we switch to using bluetooth identifiers throughout Chrome. | 108 // we switch to using bluetooth identifiers throughout Chrome. |
108 // http://crbug.com/507824 | 109 // http://crbug.com/507824 |
109 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); | 110 static std::string GetPeripheralHashAddress(CBPeripheral* peripheral); |
110 | 111 |
111 private: | 112 private: |
112 friend class BluetoothAdapterMac; | 113 friend class BluetoothAdapterMac; |
113 friend class BluetoothAdapterMacTest; | 114 friend class BluetoothAdapterMacTest; |
114 friend class BluetoothLowEnergyPeripheralBridge; | 115 friend class BluetoothLowEnergyPeripheralBridge; |
115 friend class BluetoothRemoteGattServiceMac; | 116 friend class BluetoothRemoteGattServiceMac; |
116 friend class BluetoothTestMac; | 117 friend class BluetoothTestMac; |
| 118 friend class BluetoothRemoteGattServiceMac; |
117 | 119 |
118 // Returns the Bluetooth adapter. | 120 // Returns the Bluetooth adapter. |
119 BluetoothAdapterMac* GetMacAdapter(); | 121 BluetoothAdapterMac* GetMacAdapter(); |
120 | 122 |
121 // Returns the CoreBluetooth Peripheral. | 123 // Returns the CoreBluetooth Peripheral. |
122 CBPeripheral* GetPeripheral(); | 124 CBPeripheral* GetPeripheral(); |
123 | 125 |
124 // Returns BluetoothRemoteGattServiceMac based on the CBService. | 126 // Returns BluetoothRemoteGattServiceMac based on the CBService. |
125 BluetoothRemoteGattServiceMac* GetBluetoothRemoteGattService( | 127 BluetoothRemoteGattServiceMac* GetBluetoothRemoteGattService( |
126 CBService* service) const; | 128 CBService* service) const; |
(...skipping 26 matching lines...) Expand all Loading... |
153 | 155 |
154 // The services (identified by UUIDs) that this device provides. | 156 // The services (identified by UUIDs) that this device provides. |
155 std::set<BluetoothUUID> advertised_uuids_; | 157 std::set<BluetoothUUID> advertised_uuids_; |
156 | 158 |
157 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 159 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
158 }; | 160 }; |
159 | 161 |
160 } // namespace device | 162 } // namespace device |
161 | 163 |
162 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 164 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
OLD | NEW |