| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 const ErrorCallback& error_callback) override; | 73 const ErrorCallback& error_callback) override; |
| 74 void ConnectToService( | 74 void ConnectToService( |
| 75 const BluetoothUUID& uuid, | 75 const BluetoothUUID& uuid, |
| 76 const ConnectToServiceCallback& callback, | 76 const ConnectToServiceCallback& callback, |
| 77 const ConnectToServiceErrorCallback& error_callback) override; | 77 const ConnectToServiceErrorCallback& error_callback) override; |
| 78 void ConnectToServiceInsecurely( | 78 void ConnectToServiceInsecurely( |
| 79 const device::BluetoothUUID& uuid, | 79 const device::BluetoothUUID& uuid, |
| 80 const ConnectToServiceCallback& callback, | 80 const ConnectToServiceCallback& callback, |
| 81 const ConnectToServiceErrorCallback& error_callback) override; | 81 const ConnectToServiceErrorCallback& error_callback) override; |
| 82 | 82 |
| 83 // BluetoothDeviceMac override. | |
| 84 NSDate* GetLastUpdateTime() const override; | |
| 85 | |
| 86 protected: | 83 protected: |
| 87 // BluetoothDevice override. | 84 // BluetoothDevice override. |
| 88 std::string GetDeviceName() const override; | 85 std::string GetDeviceName() const override; |
| 89 void CreateGattConnectionImpl() override; | 86 void CreateGattConnectionImpl() override; |
| 90 void DisconnectGatt() override; | 87 void DisconnectGatt() override; |
| 91 | 88 |
| 92 // Updates information about the device. | 89 // Updates information about the device. |
| 93 virtual void Update(NSDictionary* advertisement_data, int rssi); | 90 virtual void Update(NSDictionary* advertisement_data, int rssi); |
| 94 | 91 |
| 95 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); | 92 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 123 // Whether the device is connectable. | 120 // Whether the device is connectable. |
| 124 bool connectable_; | 121 bool connectable_; |
| 125 | 122 |
| 126 // The peripheral's identifier, as returned by [CBPeripheral identifier]. | 123 // The peripheral's identifier, as returned by [CBPeripheral identifier]. |
| 127 std::string identifier_; | 124 std::string identifier_; |
| 128 | 125 |
| 129 // A local address for the device created by hashing the peripheral | 126 // A local address for the device created by hashing the peripheral |
| 130 // identifier. | 127 // identifier. |
| 131 std::string hash_address_; | 128 std::string hash_address_; |
| 132 | 129 |
| 133 // Stores the time of the most recent call to Update(). | |
| 134 base::scoped_nsobject<NSDate> last_update_time_; | |
| 135 | |
| 136 // The services (identified by UUIDs) that this device provides. | 130 // The services (identified by UUIDs) that this device provides. |
| 137 std::set<BluetoothUUID> advertised_uuids_; | 131 std::set<BluetoothUUID> advertised_uuids_; |
| 138 | 132 |
| 139 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 133 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
| 140 }; | 134 }; |
| 141 | 135 |
| 142 } // namespace device | 136 } // namespace device |
| 143 | 137 |
| 144 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 138 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| OLD | NEW |