| 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 | 10 #else |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 const ConnectToServiceCallback& callback, | 63 const ConnectToServiceCallback& callback, |
| 64 const ConnectToServiceErrorCallback& error_callback) override; | 64 const ConnectToServiceErrorCallback& error_callback) override; |
| 65 void ConnectToServiceInsecurely( | 65 void ConnectToServiceInsecurely( |
| 66 const device::BluetoothUUID& uuid, | 66 const device::BluetoothUUID& uuid, |
| 67 const ConnectToServiceCallback& callback, | 67 const ConnectToServiceCallback& callback, |
| 68 const ConnectToServiceErrorCallback& error_callback) override; | 68 const ConnectToServiceErrorCallback& error_callback) override; |
| 69 void CreateGattConnection( | 69 void CreateGattConnection( |
| 70 const GattConnectionCallback& callback, | 70 const GattConnectionCallback& callback, |
| 71 const ConnectErrorCallback& error_callback) override; | 71 const ConnectErrorCallback& error_callback) override; |
| 72 | 72 |
| 73 // Returns the time of the most recent call to Update(). |
| 74 NSDate* GetLastCallToUpdate(); |
| 75 |
| 73 protected: | 76 protected: |
| 74 // BluetoothDevice override. | 77 // BluetoothDevice override. |
| 75 std::string GetDeviceName() const override; | 78 std::string GetDeviceName() const override; |
| 76 | 79 |
| 77 // Updates information about the device. | 80 // Updates information about the device. |
| 78 virtual void Update(CBPeripheral* peripheral, | 81 virtual void Update(CBPeripheral* peripheral, |
| 79 NSDictionary* advertisementData, | 82 NSDictionary* advertisementData, |
| 80 int rssi); | 83 int rssi); |
| 81 | 84 |
| 82 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); | 85 static std::string GetPeripheralIdentifier(CBPeripheral* peripheral); |
| 83 | 86 |
| 84 private: | 87 private: |
| 85 friend class BluetoothAdapterMac; | 88 friend class BluetoothAdapterMac; |
| 86 | 89 |
| 87 // CoreBluetooth data structure. | 90 // CoreBluetooth data structure. |
| 88 base::scoped_nsobject<CBPeripheral> peripheral_; | 91 base::scoped_nsobject<CBPeripheral> peripheral_; |
| 89 | 92 |
| 90 // RSSI value. | 93 // RSSI value. |
| 91 int rssi_; | 94 int rssi_; |
| 92 | 95 |
| 93 // Whether the device is connectable. | 96 // Whether the device is connectable. |
| 94 bool connectable_; | 97 bool connectable_; |
| 95 | 98 |
| 99 // Stores the time of the most recent call to Update(). |
| 100 NSDate* last_call_to_update_ = nil; |
| 101 |
| 96 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); | 102 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyDeviceMac); |
| 97 }; | 103 }; |
| 98 | 104 |
| 99 } // namespace device | 105 } // namespace device |
| 100 | 106 |
| 101 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ | 107 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOW_ENERGY_DEVICE_MAC_H_ |
| OLD | NEW |