| 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 | 
| 11 #import <IOBluetooth/IOBluetooth.h> | 11 #import <IOBluetooth/IOBluetooth.h> | 
| 12 #endif | 12 #endif | 
| 13 | 13 | 
| 14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" | 
| 15 #include "base/mac/sdk_forward_declarations.h" | 15 #include "base/mac/sdk_forward_declarations.h" | 
| 16 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device_mac.h" | 
| 17 | 17 | 
| 18 namespace device { | 18 namespace device { | 
| 19 | 19 | 
| 20 class BluetoothLowEnergyDiscoverManagerMac; | 20 class BluetoothLowEnergyDiscoverManagerMac; | 
| 21 | 21 | 
| 22 class BluetoothLowEnergyDeviceMac : public BluetoothDevice { | 22 class BluetoothLowEnergyDeviceMac : public BluetoothDeviceMac { | 
| 23  public: | 23  public: | 
| 24   BluetoothLowEnergyDeviceMac(CBPeripheral* peripheral, | 24   BluetoothLowEnergyDeviceMac(CBPeripheral* peripheral, | 
| 25                               NSDictionary* advertisementData, | 25                               NSDictionary* advertisementData, | 
| 26                               int rssi); | 26                               int rssi); | 
| 27   ~BluetoothLowEnergyDeviceMac() override; | 27   ~BluetoothLowEnergyDeviceMac() override; | 
| 28 | 28 | 
| 29   int GetRSSI() const; | 29   int GetRSSI() const; | 
| 30 | 30 | 
| 31   // BluetoothDevice overrides. | 31   // BluetoothDevice overrides. | 
| 32   std::string GetIdentifier() const override; | 32   std::string GetIdentifier() const override; | 
| (...skipping 30 matching lines...) Expand all  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   // BluetoothDeviceMac override. | 
|  | 74   NSDate* GetLastUpdateTime() const override; | 
|  | 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   base::scoped_nsobject<NSDate> last_update_time_; | 
|  | 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 | 
|---|