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_DEVICE_MAC_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_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.h"
17 @
class IOBluetoothDevice
;
21 class BluetoothDeviceMac
: public BluetoothDevice
{
23 explicit BluetoothDeviceMac(IOBluetoothDevice
* device
);
24 virtual ~BluetoothDeviceMac();
26 // BluetoothDevice override
27 virtual void AddObserver(
28 device::BluetoothDevice::Observer
* observer
) OVERRIDE
;
29 virtual void RemoveObserver(
30 device::BluetoothDevice::Observer
* observer
) OVERRIDE
;
31 virtual uint32
GetBluetoothClass() const OVERRIDE
;
32 virtual std::string
GetAddress() const OVERRIDE
;
33 virtual VendorIDSource
GetVendorIDSource() const OVERRIDE
;
34 virtual uint16
GetVendorID() const OVERRIDE
;
35 virtual uint16
GetProductID() const OVERRIDE
;
36 virtual uint16
GetDeviceID() const OVERRIDE
;
37 virtual int GetRSSI() const OVERRIDE
;
38 virtual int GetCurrentHostTransmitPower() const OVERRIDE
;
39 virtual int GetMaximumHostTransmitPower() const OVERRIDE
;
40 virtual bool IsPaired() const OVERRIDE
;
41 virtual bool IsConnected() const OVERRIDE
;
42 virtual bool IsConnectable() const OVERRIDE
;
43 virtual bool IsConnecting() const OVERRIDE
;
44 virtual UUIDList
GetUUIDs() const OVERRIDE
;
45 virtual bool ExpectingPinCode() const OVERRIDE
;
46 virtual bool ExpectingPasskey() const OVERRIDE
;
47 virtual bool ExpectingConfirmation() const OVERRIDE
;
49 PairingDelegate
* pairing_delegate
,
50 const base::Closure
& callback
,
51 const ConnectErrorCallback
& error_callback
) OVERRIDE
;
52 virtual void SetPinCode(const std::string
& pincode
) OVERRIDE
;
53 virtual void SetPasskey(uint32 passkey
) OVERRIDE
;
54 virtual void ConfirmPairing() OVERRIDE
;
55 virtual void RejectPairing() OVERRIDE
;
56 virtual void CancelPairing() OVERRIDE
;
57 virtual void Disconnect(
58 const base::Closure
& callback
,
59 const ErrorCallback
& error_callback
) OVERRIDE
;
60 virtual void Forget(const ErrorCallback
& error_callback
) OVERRIDE
;
61 virtual void ConnectToProfile(
62 BluetoothProfile
* profile
,
63 const base::Closure
& callback
,
64 const ConnectToProfileErrorCallback
& error_callback
) OVERRIDE
;
65 virtual void ConnectToService(
66 const BluetoothUUID
& uuid
,
67 const ConnectToServiceCallback
& callback
,
68 const ConnectToServiceErrorCallback
& error_callback
) OVERRIDE
;
69 virtual void StartConnectionMonitor(
70 const base::Closure
& callback
,
71 const ErrorCallback
& error_callback
) 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 virtual 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 // List of observers interested in event notifications from us.
90 ObserverList
<Observer
> observers_
;
92 base::scoped_nsobject
<IOBluetoothDevice
> device_
;
94 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac
);
99 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_