| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CLASSIC_DEVICE_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #import <IOBluetooth/IOBluetooth.h> | 8 #import <IOBluetooth/IOBluetooth.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "device/bluetooth/bluetooth_device.h" | 15 #include "device/bluetooth/bluetooth_device_mac.h" |
| 16 | 16 |
| 17 @class IOBluetoothDevice; | 17 @class IOBluetoothDevice; |
| 18 | 18 |
| 19 namespace device { | 19 namespace device { |
| 20 | 20 |
| 21 class BluetoothClassicDeviceMac : public BluetoothDevice { | 21 class BluetoothClassicDeviceMac : public BluetoothDeviceMac { |
| 22 public: | 22 public: |
| 23 explicit BluetoothClassicDeviceMac(IOBluetoothDevice* device); | 23 explicit BluetoothClassicDeviceMac(IOBluetoothDevice* device); |
| 24 ~BluetoothClassicDeviceMac() override; | 24 ~BluetoothClassicDeviceMac() override; |
| 25 | 25 |
| 26 // BluetoothDevice override | 26 // BluetoothDevice override |
| 27 uint32 GetBluetoothClass() const override; | 27 uint32 GetBluetoothClass() const override; |
| 28 std::string GetAddress() const override; | 28 std::string GetAddress() const override; |
| 29 VendorIDSource GetVendorIDSource() const override; | 29 VendorIDSource GetVendorIDSource() const override; |
| 30 uint16 GetVendorID() const override; | 30 uint16 GetVendorID() const override; |
| 31 uint16 GetProductID() const override; | 31 uint16 GetProductID() const override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 57 const ConnectToServiceCallback& callback, | 57 const ConnectToServiceCallback& callback, |
| 58 const ConnectToServiceErrorCallback& error_callback) override; | 58 const ConnectToServiceErrorCallback& error_callback) override; |
| 59 void ConnectToServiceInsecurely( | 59 void ConnectToServiceInsecurely( |
| 60 const BluetoothUUID& uuid, | 60 const BluetoothUUID& uuid, |
| 61 const ConnectToServiceCallback& callback, | 61 const ConnectToServiceCallback& callback, |
| 62 const ConnectToServiceErrorCallback& error_callback) override; | 62 const ConnectToServiceErrorCallback& error_callback) override; |
| 63 void CreateGattConnection( | 63 void CreateGattConnection( |
| 64 const GattConnectionCallback& callback, | 64 const GattConnectionCallback& callback, |
| 65 const ConnectErrorCallback& error_callback) override; | 65 const ConnectErrorCallback& error_callback) override; |
| 66 | 66 |
| 67 // Returns the timestamp when the device was last seen during an inquiry. | 67 // BluetoothDeviceMac override. |
| 68 // Returns nil if the device has never been seen during an inquiry. | 68 NSDate* GetLastUpdateTime() const override; |
| 69 NSDate* GetLastInquiryUpdate(); | |
| 70 | 69 |
| 71 // Returns the Bluetooth address for the |device|. The returned address has a | 70 // Returns the Bluetooth address for the |device|. The returned address has a |
| 72 // normalized format (see below). | 71 // normalized format (see below). |
| 73 static std::string GetDeviceAddress(IOBluetoothDevice* device); | 72 static std::string GetDeviceAddress(IOBluetoothDevice* device); |
| 74 | 73 |
| 75 protected: | 74 protected: |
| 76 // BluetoothDevice override | 75 // BluetoothDevice override |
| 77 std::string GetDeviceName() const override; | 76 std::string GetDeviceName() const override; |
| 78 | 77 |
| 79 private: | 78 private: |
| 80 friend class BluetoothAdapterMac; | 79 friend class BluetoothAdapterMac; |
| 81 | 80 |
| 82 // Implementation to read the host's transmit power level of type | 81 // Implementation to read the host's transmit power level of type |
| 83 // |power_level_type|. | 82 // |power_level_type|. |
| 84 int GetHostTransmitPower( | 83 int GetHostTransmitPower( |
| 85 BluetoothHCITransmitPowerLevelType power_level_type) const; | 84 BluetoothHCITransmitPowerLevelType power_level_type) const; |
| 86 | 85 |
| 87 base::scoped_nsobject<IOBluetoothDevice> device_; | 86 base::scoped_nsobject<IOBluetoothDevice> device_; |
| 88 | 87 |
| 89 DISALLOW_COPY_AND_ASSIGN(BluetoothClassicDeviceMac); | 88 DISALLOW_COPY_AND_ASSIGN(BluetoothClassicDeviceMac); |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 } // namespace device | 91 } // namespace device |
| 93 | 92 |
| 94 #endif // DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_ | 93 #endif // DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_ |
| OLD | NEW |