blob: 80c82062c329c7f26cce0229d9a1d19226510d56 [file] [log] [blame]
[email protected]0ae97592012-10-22 22:06:051// 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.
4
5#ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
6#define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_
7
8#include <string>
[email protected]d7ba43752013-02-21 22:27:059#include <vector>
[email protected]0ae97592012-10-22 22:06:0510
11#include "base/basictypes.h"
12#include "device/bluetooth/bluetooth_device.h"
[email protected]d7ba43752013-02-21 22:27:0513#include "device/bluetooth/bluetooth_task_manager_win.h"
[email protected]0ae97592012-10-22 22:06:0514
15namespace device {
16
[email protected]d7ba43752013-02-21 22:27:0517class BluetoothAdapterWin;
[email protected]e55a50f2013-05-05 03:37:0918class BluetoothServiceRecord;
[email protected]d7ba43752013-02-21 22:27:0519
[email protected]0ae97592012-10-22 22:06:0520class BluetoothDeviceWin : public BluetoothDevice {
21 public:
[email protected]6cc9b8d2013-03-18 21:07:0322 explicit BluetoothDeviceWin(
23 const BluetoothTaskManagerWin::DeviceState& state);
[email protected]0ae97592012-10-22 22:06:0524 virtual ~BluetoothDeviceWin();
25
[email protected]d7ba43752013-02-21 22:27:0526 // BluetoothDevice override
[email protected]611ae29a2013-04-29 21:32:1927 virtual uint32 GetBluetoothClass() const OVERRIDE;
[email protected]320447d72013-04-05 03:32:2628 virtual std::string GetAddress() const OVERRIDE;
[email protected]c81543192014-03-11 22:44:4829 virtual VendorIDSource GetVendorIDSource() const OVERRIDE;
[email protected]611ae29a2013-04-29 21:32:1930 virtual uint16 GetVendorID() const OVERRIDE;
31 virtual uint16 GetProductID() const OVERRIDE;
32 virtual uint16 GetDeviceID() const OVERRIDE;
[email protected]0ae97592012-10-22 22:06:0533 virtual bool IsPaired() const OVERRIDE;
[email protected]320447d72013-04-05 03:32:2634 virtual bool IsConnected() const OVERRIDE;
35 virtual bool IsConnectable() const OVERRIDE;
36 virtual bool IsConnecting() const OVERRIDE;
[email protected]9bf562c2014-03-20 19:11:5737 virtual UUIDList GetUUIDs() const OVERRIDE;
[email protected]0ae97592012-10-22 22:06:0538 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,
[email protected]eb72b662012-12-18 06:55:4144 const ConnectErrorCallback& error_callback) OVERRIDE;
[email protected]0ae97592012-10-22 22:06:0545 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 std::string& service_uuid,
56 const SocketCallback& callback) OVERRIDE;
[email protected]2862df462013-04-19 21:07:2157 virtual void ConnectToProfile(
58 device::BluetoothProfile* profile,
[email protected]476f29d2013-04-24 09:06:5159 const base::Closure& callback,
[email protected]2862df462013-04-19 21:07:2160 const ErrorCallback& error_callback) OVERRIDE;
[email protected]0ae97592012-10-22 22:06:0561 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;
68
[email protected]9bf562c2014-03-20 19:11:5769 // Used by BluetoothProfileWin to retrieve the service record for the given
70 // |uuid|.
71 const BluetoothServiceRecord* GetServiceRecord(
72 const std::string& uuid) const;
[email protected]e55a50f2013-05-05 03:37:0973
[email protected]320447d72013-04-05 03:32:2674 protected:
75 // BluetoothDevice override
[email protected]320447d72013-04-05 03:32:2676 virtual std::string GetDeviceName() const OVERRIDE;
77
[email protected]0ae97592012-10-22 22:06:0578 private:
[email protected]d7ba43752013-02-21 22:27:0579 friend class BluetoothAdapterWin;
80
[email protected]320447d72013-04-05 03:32:2681 // Used by BluetoothAdapterWin to update the visible state during
82 // discovery.
83 void SetVisible(bool visible);
84
[email protected]320447d72013-04-05 03:32:2685 // 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_;
88
89 // The name of the device, as supplied by the remote device.
90 std::string name_;
91
92 // The Bluetooth address of the device.
93 std::string address_;
94
[email protected]69b68382013-07-31 15:49:3695 // Tracked device state, updated by the adapter managing the lifecycle of
[email protected]320447d72013-04-05 03:32:2696 // the device.
97 bool paired_;
98 bool connected_;
99
100 // Used to send change notifications when a device disappears during
101 // discovery.
102 bool visible_;
103
104 // The services (identified by UUIDs) that this device provides.
[email protected]9bf562c2014-03-20 19:11:57105 UUIDList uuids_;
106
107 // The service records retrieved from SDP.
108 typedef ScopedVector<BluetoothServiceRecord> ServiceRecordList;
[email protected]d7ba43752013-02-21 22:27:05109 ServiceRecordList service_record_list_;
[email protected]d7ba43752013-02-21 22:27:05110
111 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceWin);
[email protected]0ae97592012-10-22 22:06:05112};
113
114} // namespace device
115
116#endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_WIN_H_