Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / device / bluetooth / bluetooth_classic_device_mac.h
blobba6e8063fb49a96ed0221d85201062acf8635bec
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.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_
8 #import <IOBluetooth/IOBluetooth.h>
10 #include <string>
12 #include "base/basictypes.h"
13 #include "base/mac/scoped_nsobject.h"
14 #include "base/observer_list.h"
15 #include "device/bluetooth/bluetooth_device_mac.h"
17 @class IOBluetoothDevice;
19 namespace device {
21 class BluetoothClassicDeviceMac : public BluetoothDeviceMac {
22 public:
23 explicit BluetoothClassicDeviceMac(IOBluetoothDevice* device);
24 ~BluetoothClassicDeviceMac() override;
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;
67 // BluetoothDeviceMac override.
68 NSDate* GetLastUpdateTime() const override;
70 // Returns the Bluetooth address for the |device|. The returned address has a
71 // normalized format (see below).
72 static std::string GetDeviceAddress(IOBluetoothDevice* device);
74 protected:
75 // BluetoothDevice override
76 std::string GetDeviceName() const override;
78 private:
79 friend class BluetoothAdapterMac;
81 // Implementation to read the host's transmit power level of type
82 // |power_level_type|.
83 int GetHostTransmitPower(
84 BluetoothHCITransmitPowerLevelType power_level_type) const;
86 base::scoped_nsobject<IOBluetoothDevice> device_;
88 DISALLOW_COPY_AND_ASSIGN(BluetoothClassicDeviceMac);
91 } // namespace device
93 #endif // DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_