Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / device / bluetooth / bluetooth_device_win.h
blobf1019a099282e4430182459835e020a04d4a6ad3
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 "base/observer_list.h"
13 #include "device/bluetooth/bluetooth_device.h"
14 #include "device/bluetooth/bluetooth_export.h"
15 #include "device/bluetooth/bluetooth_task_manager_win.h"
17 namespace device {
19 class BluetoothAdapterWin;
20 class BluetoothServiceRecordWin;
21 class BluetoothSocketThread;
23 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceWin : public BluetoothDevice {
24 public:
25 explicit BluetoothDeviceWin(
26 BluetoothAdapterWin* adapter,
27 const BluetoothTaskManagerWin::DeviceState& device_state,
28 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner,
29 const scoped_refptr<BluetoothSocketThread>& socket_thread,
30 net::NetLog* net_log,
31 const net::NetLog::Source& net_log_source);
32 ~BluetoothDeviceWin() override;
34 // BluetoothDevice override
35 uint32 GetBluetoothClass() const override;
36 std::string GetAddress() const override;
37 VendorIDSource GetVendorIDSource() const override;
38 uint16 GetVendorID() const override;
39 uint16 GetProductID() const override;
40 uint16 GetDeviceID() const override;
41 bool IsPaired() const override;
42 bool IsConnected() const override;
43 bool IsGattConnected() const override;
44 bool IsConnectable() const override;
45 bool IsConnecting() const override;
46 UUIDList GetUUIDs() const override;
47 int16 GetInquiryRSSI() const override;
48 int16 GetInquiryTxPower() const override;
49 bool ExpectingPinCode() const override;
50 bool ExpectingPasskey() const override;
51 bool ExpectingConfirmation() const override;
52 void GetConnectionInfo(const ConnectionInfoCallback& callback) override;
53 void Connect(PairingDelegate* pairing_delegate,
54 const base::Closure& callback,
55 const ConnectErrorCallback& error_callback) override;
56 void SetPinCode(const std::string& pincode) override;
57 void SetPasskey(uint32 passkey) override;
58 void ConfirmPairing() override;
59 void RejectPairing() override;
60 void CancelPairing() override;
61 void Disconnect(const base::Closure& callback,
62 const ErrorCallback& error_callback) override;
63 void Forget(const ErrorCallback& error_callback) override;
64 void ConnectToService(
65 const BluetoothUUID& uuid,
66 const ConnectToServiceCallback& callback,
67 const ConnectToServiceErrorCallback& error_callback) override;
68 void ConnectToServiceInsecurely(
69 const BluetoothUUID& uuid,
70 const ConnectToServiceCallback& callback,
71 const ConnectToServiceErrorCallback& error_callback) override;
72 void CreateGattConnection(
73 const GattConnectionCallback& callback,
74 const ConnectErrorCallback& error_callback) override;
76 // Used by BluetoothProfileWin to retrieve the service record for the given
77 // |uuid|.
78 const BluetoothServiceRecordWin* GetServiceRecord(
79 const device::BluetoothUUID& uuid) const;
81 // Returns true if all fields and services of this instance are equal to the
82 // fields and services stored in |device_state|.
83 bool IsEqual(const BluetoothTaskManagerWin::DeviceState& device_state);
85 // Updates this instance with all fields and properties stored in
86 // |device_state|.
87 void Update(const BluetoothTaskManagerWin::DeviceState& device_state);
89 protected:
90 // BluetoothDevice override
91 std::string GetDeviceName() const override;
92 void CreateGattConnectionImpl() override;
93 void DisconnectGatt() override;
95 private:
96 friend class BluetoothAdapterWin;
98 typedef ScopedVector<BluetoothServiceRecordWin> ServiceRecordList;
100 // Used by BluetoothAdapterWin to update the visible state during
101 // discovery.
102 void SetVisible(bool visible);
104 // Updates the services with services stored in |device_state|.
105 void UpdateServices(const BluetoothTaskManagerWin::DeviceState& device_state);
107 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
108 scoped_refptr<BluetoothSocketThread> socket_thread_;
109 net::NetLog* net_log_;
110 net::NetLog::Source net_log_source_;
112 // The Bluetooth class of the device, a bitmask that may be decoded using
113 // https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm
114 uint32 bluetooth_class_;
116 // The name of the device, as supplied by the remote device.
117 std::string name_;
119 // The Bluetooth address of the device.
120 std::string address_;
122 // Tracked device state, updated by the adapter managing the lifecycle of
123 // the device.
124 bool paired_;
125 bool connected_;
127 // Used to send change notifications when a device disappears during
128 // discovery.
129 bool visible_;
131 // The services (identified by UUIDs) that this device provides.
132 UUIDList uuids_;
134 // The service records retrieved from SDP.
135 ServiceRecordList service_record_list_;
137 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin);
140 } // namespace device
142 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_