Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: device/bluetooth/bluetooth_device_chromeos.h

Issue 735893002: Add GetConnectionInfo function for BluetoothDevice, replacing the existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 20 matching lines...) Expand all
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;
42 virtual int GetCurrentHostTransmitPower() const override;
43 virtual int GetMaximumHostTransmitPower() const override;
44 virtual bool IsPaired() const override; 41 virtual bool IsPaired() const override;
45 virtual bool IsConnected() const override; 42 virtual bool IsConnected() const override;
46 virtual bool IsConnectable() const override; 43 virtual bool IsConnectable() const override;
47 virtual bool IsConnecting() const override; 44 virtual bool IsConnecting() const override;
48 virtual UUIDList GetUUIDs() const override; 45 virtual UUIDList GetUUIDs() const override;
49 virtual bool ExpectingPinCode() const override; 46 virtual bool ExpectingPinCode() const override;
50 virtual bool ExpectingPasskey() const override; 47 virtual bool ExpectingPasskey() const override;
51 virtual bool ExpectingConfirmation() const override; 48 virtual bool ExpectingConfirmation() const override;
49 virtual void GetConnectionInfo(
50 const ConnectionInfoCallback& callback) override;
52 virtual void Connect( 51 virtual void Connect(
53 device::BluetoothDevice::PairingDelegate* pairing_delegate, 52 device::BluetoothDevice::PairingDelegate* pairing_delegate,
54 const base::Closure& callback, 53 const base::Closure& callback,
55 const ConnectErrorCallback& error_callback) override; 54 const ConnectErrorCallback& error_callback) override;
56 virtual void SetPinCode(const std::string& pincode) override; 55 virtual void SetPinCode(const std::string& pincode) override;
57 virtual void SetPasskey(uint32 passkey) override; 56 virtual void SetPasskey(uint32 passkey) override;
58 virtual void ConfirmPairing() override; 57 virtual void ConfirmPairing() override;
59 virtual void RejectPairing() override; 58 virtual void RejectPairing() override;
60 virtual void CancelPairing() override; 59 virtual void CancelPairing() override;
61 virtual void Disconnect( 60 virtual void Disconnect(
62 const base::Closure& callback, 61 const base::Closure& callback,
63 const ErrorCallback& error_callback) override; 62 const ErrorCallback& error_callback) override;
64 virtual void Forget(const ErrorCallback& error_callback) override; 63 virtual void Forget(const ErrorCallback& error_callback) override;
65 virtual void ConnectToService( 64 virtual void ConnectToService(
66 const device::BluetoothUUID& uuid, 65 const device::BluetoothUUID& uuid,
67 const ConnectToServiceCallback& callback, 66 const ConnectToServiceCallback& callback,
68 const ConnectToServiceErrorCallback& error_callback) override; 67 const ConnectToServiceErrorCallback& error_callback) override;
69 virtual void ConnectToServiceInsecurely( 68 virtual void ConnectToServiceInsecurely(
70 const device::BluetoothUUID& uuid, 69 const device::BluetoothUUID& uuid,
71 const ConnectToServiceCallback& callback, 70 const ConnectToServiceCallback& callback,
72 const ConnectToServiceErrorCallback& error_callback) override; 71 const ConnectToServiceErrorCallback& error_callback) override;
73 virtual void CreateGattConnection( 72 virtual void CreateGattConnection(
74 const GattConnectionCallback& callback, 73 const GattConnectionCallback& callback,
75 const ConnectErrorCallback& error_callback) override; 74 const ConnectErrorCallback& error_callback) override;
76 virtual void StartConnectionMonitor(
77 const base::Closure& callback,
78 const ErrorCallback& error_callback) override;
79 75
80 // Creates a pairing object with the given delegate |pairing_delegate| and 76 // Creates a pairing object with the given delegate |pairing_delegate| and
81 // establishes it as the pairing context for this device. All pairing-related 77 // establishes it as the pairing context for this device. All pairing-related
82 // method calls will be forwarded to this object until it is released. 78 // method calls will be forwarded to this object until it is released.
83 BluetoothPairingChromeOS* BeginPairing( 79 BluetoothPairingChromeOS* BeginPairing(
84 BluetoothDevice::PairingDelegate* pairing_delegate); 80 BluetoothDevice::PairingDelegate* pairing_delegate);
85 81
86 // Releases the current pairing object, any pairing-related method calls will 82 // Releases the current pairing object, any pairing-related method calls will
87 // be ignored. 83 // be ignored.
88 void EndPairing(); 84 void EndPairing();
(...skipping 15 matching lines...) Expand all
104 BluetoothAdapterChromeOS* adapter, 100 BluetoothAdapterChromeOS* adapter,
105 const dbus::ObjectPath& object_path, 101 const dbus::ObjectPath& object_path,
106 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, 102 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
107 scoped_refptr<device::BluetoothSocketThread> socket_thread); 103 scoped_refptr<device::BluetoothSocketThread> socket_thread);
108 virtual ~BluetoothDeviceChromeOS(); 104 virtual ~BluetoothDeviceChromeOS();
109 105
110 // BluetoothGattServiceClient::Observer overrides. 106 // BluetoothGattServiceClient::Observer overrides.
111 virtual void GattServiceAdded(const dbus::ObjectPath& object_path) override; 107 virtual void GattServiceAdded(const dbus::ObjectPath& object_path) override;
112 virtual void GattServiceRemoved(const dbus::ObjectPath& object_path) override; 108 virtual void GattServiceRemoved(const dbus::ObjectPath& object_path) override;
113 109
110 // Called by dbus:: on completion of the D-Bus method call to get the
111 // connection attributes of the current connection to the device.
112 void OnGetConnInfo(const ConnectionInfoCallback& callback,
113 int16 rssi,
114 int16 transmit_power,
115 int16 max_transmit_power);
116 void OnGetConnInfoError(const ConnectionInfoCallback& callback,
117 const std::string& error_name,
118 const std::string& error_message);
119
114 // Internal method to initiate a connection to this device, and methods called 120 // Internal method to initiate a connection to this device, and methods called
115 // by dbus:: on completion of the D-Bus method call. 121 // by dbus:: on completion of the D-Bus method call.
116 void ConnectInternal(bool after_pairing, 122 void ConnectInternal(bool after_pairing,
117 const base::Closure& callback, 123 const base::Closure& callback,
118 const ConnectErrorCallback& error_callback); 124 const ConnectErrorCallback& error_callback);
119 void OnConnect(bool after_pairing, 125 void OnConnect(bool after_pairing,
120 const base::Closure& callback); 126 const base::Closure& callback);
121 void OnCreateGattConnection(const GattConnectionCallback& callback); 127 void OnCreateGattConnection(const GattConnectionCallback& callback);
122 void OnConnectError(bool after_pairing, 128 void OnConnectError(bool after_pairing,
123 const ConnectErrorCallback& error_callback, 129 const ConnectErrorCallback& error_callback,
(...skipping 27 matching lines...) Expand all
151 const std::string& error_name, 157 const std::string& error_name,
152 const std::string& error_message); 158 const std::string& error_message);
153 159
154 // Called by dbus:: on failure of the D-Bus method call to unpair the device; 160 // Called by dbus:: on failure of the D-Bus method call to unpair the device;
155 // there is no matching completion call since this object is deleted in the 161 // there is no matching completion call since this object is deleted in the
156 // process of unpairing. 162 // process of unpairing.
157 void OnForgetError(const ErrorCallback& error_callback, 163 void OnForgetError(const ErrorCallback& error_callback,
158 const std::string& error_name, 164 const std::string& error_name,
159 const std::string& error_message); 165 const std::string& error_message);
160 166
161 // Called by dbus:: on completion of the D-Bus method call to start the
162 // connection monitor.
163 void OnStartConnectionMonitor(const base::Closure& callback);
164 void OnStartConnectionMonitorError(const ErrorCallback& error_callback,
165 const std::string& error_name,
166 const std::string& error_message);
167
168 // The adapter that owns this device instance. 167 // The adapter that owns this device instance.
169 BluetoothAdapterChromeOS* adapter_; 168 BluetoothAdapterChromeOS* adapter_;
170 169
171 // The dbus object path of the device object. 170 // The dbus object path of the device object.
172 dbus::ObjectPath object_path_; 171 dbus::ObjectPath object_path_;
173 172
174 // Number of ongoing calls to Connect(). 173 // Number of ongoing calls to Connect().
175 int num_connecting_calls_; 174 int num_connecting_calls_;
176 175
177 // True if the connection monitor has been started, tracking the connection 176 // True if the connection monitor has been started, tracking the connection
(...skipping 12 matching lines...) Expand all
190 // Note: This should remain the last member so it'll be destroyed and 189 // Note: This should remain the last member so it'll be destroyed and
191 // invalidate its weak pointers before any other members are destroyed. 190 // invalidate its weak pointers before any other members are destroyed.
192 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; 191 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_;
193 192
194 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); 193 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS);
195 }; 194 };
196 195
197 } // namespace chromeos 196 } // namespace chromeos
198 197
199 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H 198 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698