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>
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
;
21 class BluetoothAdapterMac
;
23 class BluetoothClassicDeviceMac
: public BluetoothDeviceMac
{
25 explicit BluetoothClassicDeviceMac(BluetoothAdapterMac
* adapter
,
26 IOBluetoothDevice
* device
);
27 ~BluetoothClassicDeviceMac() override
;
29 // BluetoothDevice override
30 uint32
GetBluetoothClass() const override
;
31 std::string
GetAddress() const override
;
32 VendorIDSource
GetVendorIDSource() const override
;
33 uint16
GetVendorID() const override
;
34 uint16
GetProductID() const override
;
35 uint16
GetDeviceID() const override
;
36 bool IsPaired() const override
;
37 bool IsConnected() const override
;
38 bool IsConnectable() const override
;
39 bool IsConnecting() const override
;
40 UUIDList
GetUUIDs() const override
;
41 int16
GetInquiryRSSI() const override
;
42 int16
GetInquiryTxPower() const override
;
43 bool ExpectingPinCode() const override
;
44 bool ExpectingPasskey() const override
;
45 bool ExpectingConfirmation() const override
;
46 void GetConnectionInfo(const ConnectionInfoCallback
& callback
) override
;
47 void Connect(PairingDelegate
* pairing_delegate
,
48 const base::Closure
& callback
,
49 const ConnectErrorCallback
& error_callback
) override
;
50 void SetPinCode(const std::string
& pincode
) override
;
51 void SetPasskey(uint32 passkey
) override
;
52 void ConfirmPairing() override
;
53 void RejectPairing() override
;
54 void CancelPairing() override
;
55 void Disconnect(const base::Closure
& callback
,
56 const ErrorCallback
& error_callback
) override
;
57 void Forget(const ErrorCallback
& error_callback
) override
;
58 void ConnectToService(
59 const BluetoothUUID
& uuid
,
60 const ConnectToServiceCallback
& callback
,
61 const ConnectToServiceErrorCallback
& error_callback
) override
;
62 void ConnectToServiceInsecurely(
63 const BluetoothUUID
& uuid
,
64 const ConnectToServiceCallback
& callback
,
65 const ConnectToServiceErrorCallback
& error_callback
) override
;
66 void CreateGattConnection(
67 const GattConnectionCallback
& callback
,
68 const ConnectErrorCallback
& error_callback
) override
;
70 // BluetoothDeviceMac override.
71 NSDate
* GetLastUpdateTime() const override
;
73 // Returns the Bluetooth address for the |device|. The returned address has a
74 // normalized format (see below).
75 static std::string
GetDeviceAddress(IOBluetoothDevice
* device
);
78 // BluetoothDevice override
79 std::string
GetDeviceName() const override
;
82 friend class BluetoothAdapterMac
;
84 // Implementation to read the host's transmit power level of type
85 // |power_level_type|.
86 int GetHostTransmitPower(
87 BluetoothHCITransmitPowerLevelType power_level_type
) const;
89 base::scoped_nsobject
<IOBluetoothDevice
> device_
;
91 DISALLOW_COPY_AND_ASSIGN(BluetoothClassicDeviceMac
);
96 #endif // DEVICE_BLUETOOTH_BLUETOOTH_CLASSIC_DEVICE_MAC_H_