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