| 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_DEVICE_MAC_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_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.h" |
| 16 | 16 |
| 17 @class IOBluetoothDevice; | 17 @class IOBluetoothDevice; |
| 18 | 18 |
| 19 namespace device { | 19 namespace device { |
| 20 | 20 |
| 21 class BluetoothDeviceMac : public BluetoothDevice { | 21 class BluetoothDeviceMac : public BluetoothDevice { |
| 22 public: | 22 public: |
| 23 explicit BluetoothDeviceMac(IOBluetoothDevice* device); | 23 explicit BluetoothDeviceMac(IOBluetoothDevice* device); |
| 24 virtual ~BluetoothDeviceMac(); | 24 virtual ~BluetoothDeviceMac(); |
| 25 | 25 |
| 26 // BluetoothDevice override | 26 // BluetoothDevice override |
| 27 virtual uint32 GetBluetoothClass() const OVERRIDE; | 27 virtual uint32 GetBluetoothClass() const override; |
| 28 virtual std::string GetAddress() const OVERRIDE; | 28 virtual std::string GetAddress() const override; |
| 29 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; | 29 virtual VendorIDSource GetVendorIDSource() const override; |
| 30 virtual uint16 GetVendorID() const OVERRIDE; | 30 virtual uint16 GetVendorID() const override; |
| 31 virtual uint16 GetProductID() const OVERRIDE; | 31 virtual uint16 GetProductID() const override; |
| 32 virtual uint16 GetDeviceID() const OVERRIDE; | 32 virtual uint16 GetDeviceID() const override; |
| 33 virtual int GetRSSI() const OVERRIDE; | 33 virtual int GetRSSI() const override; |
| 34 virtual int GetCurrentHostTransmitPower() const OVERRIDE; | 34 virtual int GetCurrentHostTransmitPower() const override; |
| 35 virtual int GetMaximumHostTransmitPower() const OVERRIDE; | 35 virtual int GetMaximumHostTransmitPower() const override; |
| 36 virtual bool IsPaired() const OVERRIDE; | 36 virtual bool IsPaired() const override; |
| 37 virtual bool IsConnected() const OVERRIDE; | 37 virtual bool IsConnected() const override; |
| 38 virtual bool IsConnectable() const OVERRIDE; | 38 virtual bool IsConnectable() const override; |
| 39 virtual bool IsConnecting() const OVERRIDE; | 39 virtual bool IsConnecting() const override; |
| 40 virtual UUIDList GetUUIDs() const OVERRIDE; | 40 virtual UUIDList GetUUIDs() const override; |
| 41 virtual bool ExpectingPinCode() const OVERRIDE; | 41 virtual bool ExpectingPinCode() const override; |
| 42 virtual bool ExpectingPasskey() const OVERRIDE; | 42 virtual bool ExpectingPasskey() const override; |
| 43 virtual bool ExpectingConfirmation() const OVERRIDE; | 43 virtual bool ExpectingConfirmation() const override; |
| 44 virtual void Connect( | 44 virtual void Connect( |
| 45 PairingDelegate* pairing_delegate, | 45 PairingDelegate* pairing_delegate, |
| 46 const base::Closure& callback, | 46 const base::Closure& callback, |
| 47 const ConnectErrorCallback& error_callback) OVERRIDE; | 47 const ConnectErrorCallback& error_callback) override; |
| 48 virtual void SetPinCode(const std::string& pincode) OVERRIDE; | 48 virtual void SetPinCode(const std::string& pincode) override; |
| 49 virtual void SetPasskey(uint32 passkey) OVERRIDE; | 49 virtual void SetPasskey(uint32 passkey) override; |
| 50 virtual void ConfirmPairing() OVERRIDE; | 50 virtual void ConfirmPairing() override; |
| 51 virtual void RejectPairing() OVERRIDE; | 51 virtual void RejectPairing() override; |
| 52 virtual void CancelPairing() OVERRIDE; | 52 virtual void CancelPairing() override; |
| 53 virtual void Disconnect( | 53 virtual void Disconnect( |
| 54 const base::Closure& callback, | 54 const base::Closure& callback, |
| 55 const ErrorCallback& error_callback) OVERRIDE; | 55 const ErrorCallback& error_callback) override; |
| 56 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE; | 56 virtual void Forget(const ErrorCallback& error_callback) override; |
| 57 virtual void ConnectToService( | 57 virtual void ConnectToService( |
| 58 const BluetoothUUID& uuid, | 58 const BluetoothUUID& uuid, |
| 59 const ConnectToServiceCallback& callback, | 59 const ConnectToServiceCallback& callback, |
| 60 const ConnectToServiceErrorCallback& error_callback) OVERRIDE; | 60 const ConnectToServiceErrorCallback& error_callback) override; |
| 61 virtual void CreateGattConnection( | 61 virtual void CreateGattConnection( |
| 62 const GattConnectionCallback& callback, | 62 const GattConnectionCallback& callback, |
| 63 const ConnectErrorCallback& error_callback) OVERRIDE; | 63 const ConnectErrorCallback& error_callback) override; |
| 64 virtual void StartConnectionMonitor( | 64 virtual void StartConnectionMonitor( |
| 65 const base::Closure& callback, | 65 const base::Closure& callback, |
| 66 const ErrorCallback& error_callback) OVERRIDE; | 66 const ErrorCallback& error_callback) override; |
| 67 | 67 |
| 68 // Returns the timestamp when the device was last seen during an inquiry. | 68 // Returns the timestamp when the device was last seen during an inquiry. |
| 69 // Returns nil if the device has never been seen during an inquiry. | 69 // Returns nil if the device has never been seen during an inquiry. |
| 70 NSDate* GetLastInquiryUpdate(); | 70 NSDate* GetLastInquiryUpdate(); |
| 71 | 71 |
| 72 // Returns the Bluetooth address for the |device|. The returned address has a | 72 // Returns the Bluetooth address for the |device|. The returned address has a |
| 73 // normalized format (see below). | 73 // normalized format (see below). |
| 74 static std::string GetDeviceAddress(IOBluetoothDevice* device); | 74 static std::string GetDeviceAddress(IOBluetoothDevice* device); |
| 75 | 75 |
| 76 protected: | 76 protected: |
| 77 // BluetoothDevice override | 77 // BluetoothDevice override |
| 78 virtual std::string GetDeviceName() const OVERRIDE; | 78 virtual std::string GetDeviceName() const override; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 friend class BluetoothAdapterMac; | 81 friend class BluetoothAdapterMac; |
| 82 | 82 |
| 83 // Implementation to read the host's transmit power level of type | 83 // Implementation to read the host's transmit power level of type |
| 84 // |power_level_type|. | 84 // |power_level_type|. |
| 85 int GetHostTransmitPower( | 85 int GetHostTransmitPower( |
| 86 BluetoothHCITransmitPowerLevelType power_level_type) const; | 86 BluetoothHCITransmitPowerLevelType power_level_type) const; |
| 87 | 87 |
| 88 base::scoped_nsobject<IOBluetoothDevice> device_; | 88 base::scoped_nsobject<IOBluetoothDevice> device_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); | 90 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace device | 93 } // namespace device |
| 94 | 94 |
| 95 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ | 95 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_ |
| OLD | NEW |