[BackgroundSync] Hang the BackgroundSyncManager off of the StoragePartition
[chromium-blink-merge.git] / device / bluetooth / bluetooth_device_mac.h
blob7dd1baedff6f529f43bfaeb81d0d8f30d4fb0c37
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>
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.h"
17 @class IOBluetoothDevice;
19 namespace device {
21 class BluetoothDeviceMac : public BluetoothDevice {
22 public:
23 explicit BluetoothDeviceMac(IOBluetoothDevice* device);
24 ~BluetoothDeviceMac() 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 bool ExpectingPinCode() const override;
39 bool ExpectingPasskey() const override;
40 bool ExpectingConfirmation() const override;
41 void GetConnectionInfo(const ConnectionInfoCallback& callback) override;
42 void Connect(PairingDelegate* pairing_delegate,
43 const base::Closure& callback,
44 const ConnectErrorCallback& error_callback) override;
45 void SetPinCode(const std::string& pincode) override;
46 void SetPasskey(uint32 passkey) override;
47 void ConfirmPairing() override;
48 void RejectPairing() override;
49 void CancelPairing() override;
50 void Disconnect(const base::Closure& callback,
51 const ErrorCallback& error_callback) override;
52 void Forget(const ErrorCallback& error_callback) override;
53 void ConnectToService(
54 const BluetoothUUID& uuid,
55 const ConnectToServiceCallback& callback,
56 const ConnectToServiceErrorCallback& error_callback) override;
57 void ConnectToServiceInsecurely(
58 const BluetoothUUID& uuid,
59 const ConnectToServiceCallback& callback,
60 const ConnectToServiceErrorCallback& error_callback) override;
61 void CreateGattConnection(
62 const GattConnectionCallback& callback,
63 const ConnectErrorCallback& error_callback) override;
65 // Returns the timestamp when the device was last seen during an inquiry.
66 // Returns nil if the device has never been seen during an inquiry.
67 NSDate* GetLastInquiryUpdate();
69 // Returns the Bluetooth address for the |device|. The returned address has a
70 // normalized format (see below).
71 static std::string GetDeviceAddress(IOBluetoothDevice* device);
73 protected:
74 // BluetoothDevice override
75 std::string GetDeviceName() const override;
77 private:
78 friend class BluetoothAdapterMac;
80 // Implementation to read the host's transmit power level of type
81 // |power_level_type|.
82 int GetHostTransmitPower(
83 BluetoothHCITransmitPowerLevelType power_level_type) const;
85 base::scoped_nsobject<IOBluetoothDevice> device_;
87 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceMac);
90 } // namespace device
92 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_MAC_H_