OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class BluetoothAdapterChromeOS; | 25 class BluetoothAdapterChromeOS; |
26 class BluetoothPairingChromeOS; | 26 class BluetoothPairingChromeOS; |
27 | 27 |
28 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the | 28 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the |
29 // Chrome OS platform. | 29 // Chrome OS platform. |
30 class BluetoothDeviceChromeOS | 30 class BluetoothDeviceChromeOS |
31 : public device::BluetoothDevice, | 31 : public device::BluetoothDevice, |
32 public BluetoothGattServiceClient::Observer { | 32 public BluetoothGattServiceClient::Observer { |
33 public: | 33 public: |
34 // BluetoothDevice override | 34 // BluetoothDevice override |
35 virtual uint32 GetBluetoothClass() const OVERRIDE; | 35 virtual uint32 GetBluetoothClass() const override; |
36 virtual std::string GetAddress() const OVERRIDE; | 36 virtual std::string GetAddress() const override; |
37 virtual VendorIDSource GetVendorIDSource() const OVERRIDE; | 37 virtual VendorIDSource GetVendorIDSource() const override; |
38 virtual uint16 GetVendorID() const OVERRIDE; | 38 virtual uint16 GetVendorID() const override; |
39 virtual uint16 GetProductID() const OVERRIDE; | 39 virtual uint16 GetProductID() const override; |
40 virtual uint16 GetDeviceID() const OVERRIDE; | 40 virtual uint16 GetDeviceID() const override; |
41 virtual int GetRSSI() const OVERRIDE; | 41 virtual int GetRSSI() const override; |
42 virtual int GetCurrentHostTransmitPower() const OVERRIDE; | 42 virtual int GetCurrentHostTransmitPower() const override; |
43 virtual int GetMaximumHostTransmitPower() const OVERRIDE; | 43 virtual int GetMaximumHostTransmitPower() const override; |
44 virtual bool IsPaired() const OVERRIDE; | 44 virtual bool IsPaired() const override; |
45 virtual bool IsConnected() const OVERRIDE; | 45 virtual bool IsConnected() const override; |
46 virtual bool IsConnectable() const OVERRIDE; | 46 virtual bool IsConnectable() const override; |
47 virtual bool IsConnecting() const OVERRIDE; | 47 virtual bool IsConnecting() const override; |
48 virtual UUIDList GetUUIDs() const OVERRIDE; | 48 virtual UUIDList GetUUIDs() const override; |
49 virtual bool ExpectingPinCode() const OVERRIDE; | 49 virtual bool ExpectingPinCode() const override; |
50 virtual bool ExpectingPasskey() const OVERRIDE; | 50 virtual bool ExpectingPasskey() const override; |
51 virtual bool ExpectingConfirmation() const OVERRIDE; | 51 virtual bool ExpectingConfirmation() const override; |
52 virtual void Connect( | 52 virtual void Connect( |
53 device::BluetoothDevice::PairingDelegate* pairing_delegate, | 53 device::BluetoothDevice::PairingDelegate* pairing_delegate, |
54 const base::Closure& callback, | 54 const base::Closure& callback, |
55 const ConnectErrorCallback& error_callback) OVERRIDE; | 55 const ConnectErrorCallback& error_callback) override; |
56 virtual void SetPinCode(const std::string& pincode) OVERRIDE; | 56 virtual void SetPinCode(const std::string& pincode) override; |
57 virtual void SetPasskey(uint32 passkey) OVERRIDE; | 57 virtual void SetPasskey(uint32 passkey) override; |
58 virtual void ConfirmPairing() OVERRIDE; | 58 virtual void ConfirmPairing() override; |
59 virtual void RejectPairing() OVERRIDE; | 59 virtual void RejectPairing() override; |
60 virtual void CancelPairing() OVERRIDE; | 60 virtual void CancelPairing() override; |
61 virtual void Disconnect( | 61 virtual void Disconnect( |
62 const base::Closure& callback, | 62 const base::Closure& callback, |
63 const ErrorCallback& error_callback) OVERRIDE; | 63 const ErrorCallback& error_callback) override; |
64 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE; | 64 virtual void Forget(const ErrorCallback& error_callback) override; |
65 virtual void ConnectToService( | 65 virtual void ConnectToService( |
66 const device::BluetoothUUID& uuid, | 66 const device::BluetoothUUID& uuid, |
67 const ConnectToServiceCallback& callback, | 67 const ConnectToServiceCallback& callback, |
68 const ConnectToServiceErrorCallback& error_callback) OVERRIDE; | 68 const ConnectToServiceErrorCallback& error_callback) override; |
69 virtual void CreateGattConnection( | 69 virtual void CreateGattConnection( |
70 const GattConnectionCallback& callback, | 70 const GattConnectionCallback& callback, |
71 const ConnectErrorCallback& error_callback) OVERRIDE; | 71 const ConnectErrorCallback& error_callback) override; |
72 virtual void StartConnectionMonitor( | 72 virtual void StartConnectionMonitor( |
73 const base::Closure& callback, | 73 const base::Closure& callback, |
74 const ErrorCallback& error_callback) OVERRIDE; | 74 const ErrorCallback& error_callback) override; |
75 | 75 |
76 // Attempts to initiate an insecure outgoing L2CAP or RFCOMM connection to the | 76 // Attempts to initiate an insecure outgoing L2CAP or RFCOMM connection to the |
77 // advertised service on this device matching |uuid|, performing an SDP lookup | 77 // advertised service on this device matching |uuid|, performing an SDP lookup |
78 // if necessary to determine the correct protocol and channel for the | 78 // if necessary to determine the correct protocol and channel for the |
79 // connection. Unlike ConnectToService, the outgoing connection will request | 79 // connection. Unlike ConnectToService, the outgoing connection will request |
80 // no bonding rather than general bonding. |callback| will be called on a | 80 // no bonding rather than general bonding. |callback| will be called on a |
81 // successful connection with a BluetoothSocket instance that is to be owned | 81 // successful connection with a BluetoothSocket instance that is to be owned |
82 // by the receiver. |error_callback| will be called on failure with a message | 82 // by the receiver. |error_callback| will be called on failure with a message |
83 // indicating the cause. | 83 // indicating the cause. |
84 void ConnectToServiceInsecurely( | 84 void ConnectToServiceInsecurely( |
(...skipping 12 matching lines...) Expand all Loading... |
97 void EndPairing(); | 97 void EndPairing(); |
98 | 98 |
99 // Returns the current pairing object or NULL if no pairing is in progress. | 99 // Returns the current pairing object or NULL if no pairing is in progress. |
100 BluetoothPairingChromeOS* GetPairing() const; | 100 BluetoothPairingChromeOS* GetPairing() const; |
101 | 101 |
102 // Returns the object path of the device. | 102 // Returns the object path of the device. |
103 const dbus::ObjectPath& object_path() const { return object_path_; } | 103 const dbus::ObjectPath& object_path() const { return object_path_; } |
104 | 104 |
105 protected: | 105 protected: |
106 // BluetoothDevice override | 106 // BluetoothDevice override |
107 virtual std::string GetDeviceName() const OVERRIDE; | 107 virtual std::string GetDeviceName() const override; |
108 | 108 |
109 private: | 109 private: |
110 friend class BluetoothAdapterChromeOS; | 110 friend class BluetoothAdapterChromeOS; |
111 | 111 |
112 BluetoothDeviceChromeOS( | 112 BluetoothDeviceChromeOS( |
113 BluetoothAdapterChromeOS* adapter, | 113 BluetoothAdapterChromeOS* adapter, |
114 const dbus::ObjectPath& object_path, | 114 const dbus::ObjectPath& object_path, |
115 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 115 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
116 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 116 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
117 virtual ~BluetoothDeviceChromeOS(); | 117 virtual ~BluetoothDeviceChromeOS(); |
118 | 118 |
119 // BluetoothGattServiceClient::Observer overrides. | 119 // BluetoothGattServiceClient::Observer overrides. |
120 virtual void GattServiceAdded(const dbus::ObjectPath& object_path) OVERRIDE; | 120 virtual void GattServiceAdded(const dbus::ObjectPath& object_path) override; |
121 virtual void GattServiceRemoved(const dbus::ObjectPath& object_path) OVERRIDE; | 121 virtual void GattServiceRemoved(const dbus::ObjectPath& object_path) override; |
122 | 122 |
123 // Internal method to initiate a connection to this device, and methods called | 123 // Internal method to initiate a connection to this device, and methods called |
124 // by dbus:: on completion of the D-Bus method call. | 124 // by dbus:: on completion of the D-Bus method call. |
125 void ConnectInternal(bool after_pairing, | 125 void ConnectInternal(bool after_pairing, |
126 const base::Closure& callback, | 126 const base::Closure& callback, |
127 const ConnectErrorCallback& error_callback); | 127 const ConnectErrorCallback& error_callback); |
128 void OnConnect(bool after_pairing, | 128 void OnConnect(bool after_pairing, |
129 const base::Closure& callback); | 129 const base::Closure& callback); |
130 void OnCreateGattConnection(const GattConnectionCallback& callback); | 130 void OnCreateGattConnection(const GattConnectionCallback& callback); |
131 void OnConnectError(bool after_pairing, | 131 void OnConnectError(bool after_pairing, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // Note: This should remain the last member so it'll be destroyed and | 199 // Note: This should remain the last member so it'll be destroyed and |
200 // invalidate its weak pointers before any other members are destroyed. | 200 // invalidate its weak pointers before any other members are destroyed. |
201 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 201 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 203 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace chromeos | 206 } // namespace chromeos |
207 | 207 |
208 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 208 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
OLD | NEW |