Relanding this change. The bug 332430 which caused this to be reverted will be addres...
[chromium-blink-merge.git] / device / bluetooth / bluetooth_device_win.h
blob0ba0796f3d8fe7b89596c74fd4edaa9bca7daff3
1 // Copyright (c) 2012 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_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "device/bluetooth/bluetooth_device.h"
13 #include "device/bluetooth/bluetooth_task_manager_win.h"
15 namespace device {
17 class BluetoothAdapterWin;
18 class BluetoothServiceRecord;
20 class BluetoothDeviceWin : public BluetoothDevice {
21 public:
22 explicit BluetoothDeviceWin(
23 const BluetoothTaskManagerWin::DeviceState& state);
24 virtual ~BluetoothDeviceWin();
26 // BluetoothDevice override
27 virtual uint32 GetBluetoothClass() const OVERRIDE;
28 virtual std::string GetAddress() const OVERRIDE;
29 virtual VendorIDSource GetVendorIDSource() const OVERRIDE;
30 virtual uint16 GetVendorID() const OVERRIDE;
31 virtual uint16 GetProductID() const OVERRIDE;
32 virtual uint16 GetDeviceID() const OVERRIDE;
33 virtual bool IsPaired() const OVERRIDE;
34 virtual bool IsConnected() const OVERRIDE;
35 virtual bool IsConnectable() const OVERRIDE;
36 virtual bool IsConnecting() const OVERRIDE;
37 virtual UUIDList GetUUIDs() const OVERRIDE;
38 virtual bool ExpectingPinCode() const OVERRIDE;
39 virtual bool ExpectingPasskey() const OVERRIDE;
40 virtual bool ExpectingConfirmation() const OVERRIDE;
41 virtual void Connect(
42 PairingDelegate* pairing_delegate,
43 const base::Closure& callback,
44 const ConnectErrorCallback& error_callback) OVERRIDE;
45 virtual void SetPinCode(const std::string& pincode) OVERRIDE;
46 virtual void SetPasskey(uint32 passkey) OVERRIDE;
47 virtual void ConfirmPairing() OVERRIDE;
48 virtual void RejectPairing() OVERRIDE;
49 virtual void CancelPairing() OVERRIDE;
50 virtual void Disconnect(
51 const base::Closure& callback,
52 const ErrorCallback& error_callback) OVERRIDE;
53 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE;
54 virtual void ConnectToService(
55 const device::BluetoothUUID& service_uuid,
56 const SocketCallback& callback) OVERRIDE;
57 virtual void ConnectToProfile(
58 device::BluetoothProfile* profile,
59 const base::Closure& callback,
60 const ErrorCallback& error_callback) OVERRIDE;
61 virtual void SetOutOfBandPairingData(
62 const BluetoothOutOfBandPairingData& data,
63 const base::Closure& callback,
64 const ErrorCallback& error_callback) OVERRIDE;
65 virtual void ClearOutOfBandPairingData(
66 const base::Closure& callback,
67 const ErrorCallback& error_callback) OVERRIDE;
69 // Used by BluetoothProfileWin to retrieve the service record for the given
70 // |uuid|.
71 const BluetoothServiceRecord* GetServiceRecord(
72 const device::BluetoothUUID& uuid) const;
74 protected:
75 // BluetoothDevice override
76 virtual std::string GetDeviceName() const OVERRIDE;
78 private:
79 friend class BluetoothAdapterWin;
81 // Used by BluetoothAdapterWin to update the visible state during
82 // discovery.
83 void SetVisible(bool visible);
85 // The Bluetooth class of the device, a bitmask that may be decoded using
86 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
87 uint32 bluetooth_class_;
89 // The name of the device, as supplied by the remote device.
90 std::string name_;
92 // The Bluetooth address of the device.
93 std::string address_;
95 // Tracked device state, updated by the adapter managing the lifecycle of
96 // the device.
97 bool paired_;
98 bool connected_;
100 // Used to send change notifications when a device disappears during
101 // discovery.
102 bool visible_;
104 // The services (identified by UUIDs) that this device provides.
105 UUIDList uuids_;
107 // The service records retrieved from SDP.
108 typedef ScopedVector<BluetoothServiceRecord> ServiceRecordList;
109 ServiceRecordList service_record_list_;
111 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin);
114 } // namespace device
116 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_