OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PAIRING_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_BLUEZ_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_BLUEZ_H_ |
7 | 7 |
8 #include "device/bluetooth/bluetooth_device.h" | 8 #include "device/bluetooth/bluetooth_device.h" |
9 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" | 9 #include "device/bluetooth/dbus/bluetooth_agent_service_provider.h" |
10 | 10 |
11 namespace chromeos { | 11 namespace bluez { |
12 | 12 |
13 class BluetoothDeviceChromeOS; | 13 class BluetoothDeviceBlueZ; |
14 | 14 |
15 // The BluetoothPairingChromeOS class encapsulates the logic for an individual | 15 // The BluetoothPairingBlueZ class encapsulates the logic for an individual |
16 // device pairing, acting as a bridge between BluetoothAdapterChromeOS which | 16 // device pairing, acting as a bridge between BluetoothAdapterBlueZ which |
17 // communicates with the underlying Controller and Host Subsystem, and | 17 // communicates with the underlying Controller and Host Subsystem, and |
18 // BluetoothDeviceChromeOS which presents the pairing logic to the application. | 18 // BluetoothDeviceBlueZ which presents the pairing logic to the application. |
19 class BluetoothPairingChromeOS { | 19 class BluetoothPairingBlueZ { |
20 public: | 20 public: |
21 BluetoothPairingChromeOS( | 21 BluetoothPairingBlueZ( |
22 BluetoothDeviceChromeOS* device, | 22 BluetoothDeviceBlueZ* device, |
23 device::BluetoothDevice::PairingDelegate* pairing_delegate); | 23 device::BluetoothDevice::PairingDelegate* pairing_delegate); |
24 ~BluetoothPairingChromeOS(); | 24 ~BluetoothPairingBlueZ(); |
25 | 25 |
26 // Indicates whether the device is currently pairing and expecting a | 26 // Indicates whether the device is currently pairing and expecting a |
27 // Passkey to be returned. | 27 // Passkey to be returned. |
28 bool ExpectingPasskey() const; | 28 bool ExpectingPasskey() const; |
29 | 29 |
30 // Indicates whether the device is currently pairing and expecting | 30 // Indicates whether the device is currently pairing and expecting |
31 // confirmation of a displayed passkey. | 31 // confirmation of a displayed passkey. |
32 bool ExpectingConfirmation() const; | 32 bool ExpectingConfirmation() const; |
33 | 33 |
34 // Requests a PIN code for the current device from the current pairing | 34 // Requests a PIN code for the current device from the current pairing |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 private: | 110 private: |
111 // Internal method to reset the current set of callbacks because a new | 111 // Internal method to reset the current set of callbacks because a new |
112 // request has arrived that supersedes them. | 112 // request has arrived that supersedes them. |
113 void ResetCallbacks(); | 113 void ResetCallbacks(); |
114 | 114 |
115 // Internal method to respond to the relevant callback for a RejectPairing | 115 // Internal method to respond to the relevant callback for a RejectPairing |
116 // or CancelPairing call. | 116 // or CancelPairing call. |
117 bool RunPairingCallbacks( | 117 bool RunPairingCallbacks( |
118 bluez::BluetoothAgentServiceProvider::Delegate::Status status); | 118 bluez::BluetoothAgentServiceProvider::Delegate::Status status); |
119 | 119 |
120 // The underlying BluetoothDeviceChromeOS that owns this pairing context. | 120 // The underlying BluetoothDeviceBlueZ that owns this pairing context. |
121 BluetoothDeviceChromeOS* device_; | 121 BluetoothDeviceBlueZ* device_; |
122 | 122 |
123 // UI Pairing Delegate to make method calls on, this must live as long as | 123 // UI Pairing Delegate to make method calls on, this must live as long as |
124 // the object capturing the PairingContext. | 124 // the object capturing the PairingContext. |
125 device::BluetoothDevice::PairingDelegate* pairing_delegate_; | 125 device::BluetoothDevice::PairingDelegate* pairing_delegate_; |
126 | 126 |
127 // Flag to indicate whether any pairing delegate method has been called | 127 // Flag to indicate whether any pairing delegate method has been called |
128 // during pairing. Used to determine whether we need to log the | 128 // during pairing. Used to determine whether we need to log the |
129 // "no pairing interaction" metric. | 129 // "no pairing interaction" metric. |
130 bool pairing_delegate_used_; | 130 bool pairing_delegate_used_; |
131 | 131 |
132 // During pairing these callbacks are set to those provided by method calls | 132 // During pairing these callbacks are set to those provided by method calls |
133 // made on the BluetoothAdapterChromeOS instance by its respective | 133 // made on the BluetoothAdapterBlueZ instance by its respective |
134 // bluez::BluetoothAgentServiceProvider instance, and are called by our own | 134 // bluez::BluetoothAgentServiceProvider instance, and are called by our own |
135 // method calls such as SetPinCode() and SetPasskey(). | 135 // method calls such as SetPinCode() and SetPasskey(). |
136 bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback | 136 bluez::BluetoothAgentServiceProvider::Delegate::PinCodeCallback |
137 pincode_callback_; | 137 pincode_callback_; |
138 bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback | 138 bluez::BluetoothAgentServiceProvider::Delegate::PasskeyCallback |
139 passkey_callback_; | 139 passkey_callback_; |
140 bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback | 140 bluez::BluetoothAgentServiceProvider::Delegate::ConfirmationCallback |
141 confirmation_callback_; | 141 confirmation_callback_; |
142 | 142 |
143 DISALLOW_COPY_AND_ASSIGN(BluetoothPairingChromeOS); | 143 DISALLOW_COPY_AND_ASSIGN(BluetoothPairingBlueZ); |
144 }; | 144 }; |
145 | 145 |
146 } // namespace chromeos | 146 } // namespace bluez |
147 | 147 |
148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_CHROMEOS_H_ | 148 #endif // DEVICE_BLUETOOTH_BLUETOOTH_PAIRING_BLUEZ_H_ |
OLD | NEW |