| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 const dbus::ObjectPath& device_path); | 108 const dbus::ObjectPath& device_path); |
| 109 | 109 |
| 110 // Called by BluetoothAdapterClient when a call to CreateDevice() or | 110 // Called by BluetoothAdapterClient when a call to CreateDevice() or |
| 111 // CreatePairedDevice() fails with the error named |error_name| and | 111 // CreatePairedDevice() fails with the error named |error_name| and |
| 112 // optional message |error_message|, |error_callback| is the callback | 112 // optional message |error_message|, |error_callback| is the callback |
| 113 // provided to Connect(). | 113 // provided to Connect(). |
| 114 void OnCreateDeviceError(const ConnectErrorCallback& error_callback, | 114 void OnCreateDeviceError(const ConnectErrorCallback& error_callback, |
| 115 const std::string& error_name, | 115 const std::string& error_name, |
| 116 const std::string& error_message); | 116 const std::string& error_message); |
| 117 | 117 |
| 118 // Called by BluetoothAdapterClient when a call to DiscoverServices() | 118 // Called by BluetoothAdapterClient when a call to GetServiceRecords() |
| 119 // completes. |callback| and |error_callback| are the callbacks provided to | 119 // completes. |callback| and |error_callback| are the callbacks provided to |
| 120 // GetServiceRecords. | 120 // GetServiceRecords. |
| 121 void CollectServiceRecordsCallback( | 121 void CollectServiceRecordsCallback( |
| 122 const ServiceRecordsCallback& callback, | 122 const ServiceRecordsCallback& callback, |
| 123 const ErrorCallback& error_callback, | 123 const ErrorCallback& error_callback, |
| 124 const dbus::ObjectPath& device_path, | 124 const dbus::ObjectPath& device_path, |
| 125 const BluetoothDeviceClient::ServiceMap& service_map, | 125 const BluetoothDeviceClient::ServiceMap& service_map, |
| 126 bool success); | 126 bool success); |
| 127 | 127 |
| 128 // Called by CollectServiceRecordsCallback() every time |service_records_| is |
| 129 // updated. |OnServiceRecordsChanged| updates the derived properties that |
| 130 // depend on |service_records_|. |
| 131 void OnServiceRecordsChanged(void); |
| 132 |
| 128 // Called by BluetoothProperty when the call to Set() for the Trusted | 133 // Called by BluetoothProperty when the call to Set() for the Trusted |
| 129 // property completes. |success| indicates whether or not the request | 134 // property completes. |success| indicates whether or not the request |
| 130 // succeeded, |callback| and |error_callback| are the callbacks provided to | 135 // succeeded. |
| 131 // Connect(). | 136 void OnSetTrusted(bool success); |
| 132 void OnSetTrusted(const base::Closure& callback, | 137 |
| 133 const ErrorCallback& error_callback, | 138 // Called by BluetoothAdapterClient when a call to GetServiceRecords() |
| 134 bool success); | 139 // fails. |callback| and |error_callback| are the callbacks provided to |
| 140 // GetServiceRecords(). |
| 141 void OnGetServiceRecordsError(const ServiceRecordsCallback& callback, |
| 142 const ErrorCallback& error_callback); |
| 143 |
| 144 // Called by BluetoothAdapterClient when the initial call to |
| 145 // GetServiceRecords() after pairing completes. |callback| and |
| 146 // |error_callback| are the callbacks provided to Connect(). |
| 147 void OnInitialGetServiceRecords(const base::Closure& callback, |
| 148 const ConnectErrorCallback& error_callback, |
| 149 const ServiceRecordList& list); |
| 150 |
| 151 // Called by BluetoothAdapterClient when the initial call to |
| 152 // GetServiceRecords() after pairing fails. |callback| and |error_callback| |
| 153 // are the callbacks provided to Connect(). |
| 154 void OnInitialGetServiceRecordsError( |
| 155 const base::Closure& callback, |
| 156 const ConnectErrorCallback& error_callback); |
| 135 | 157 |
| 136 // Connect application-level protocols of the device to the system, called | 158 // Connect application-level protocols of the device to the system, called |
| 137 // on a successful connection or to reconnect to a device that is already | 159 // on a successful connection or to reconnect to a device that is already |
| 138 // paired or previously connected. |error_callback| is called on failure. | 160 // paired or previously connected. |error_callback| is called on failure. |
| 139 // Otherwise, |callback| is called when the request is complete. | 161 // Otherwise, |callback| is called when the request is complete. |
| 140 void ConnectApplications(const base::Closure& callback, | 162 void ConnectApplications(const base::Closure& callback, |
| 141 const ConnectErrorCallback& error_callback); | 163 const ConnectErrorCallback& error_callback); |
| 142 | 164 |
| 143 // Called by IntrospectableClient when a call to Introspect() completes. | 165 // Called by IntrospectableClient when a call to Introspect() completes. |
| 144 // |success| indicates whether or not the request succeeded, |callback| and | 166 // |success| indicates whether or not the request succeeded, |callback| and |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // During pairing these callbacks are set to those provided by method calls | 383 // During pairing these callbacks are set to those provided by method calls |
| 362 // made on us by |agent_| and are called by our own method calls such as | 384 // made on us by |agent_| and are called by our own method calls such as |
| 363 // SetPinCode() and SetPasskey(). | 385 // SetPinCode() and SetPasskey(). |
| 364 PinCodeCallback pincode_callback_; | 386 PinCodeCallback pincode_callback_; |
| 365 PasskeyCallback passkey_callback_; | 387 PasskeyCallback passkey_callback_; |
| 366 ConfirmationCallback confirmation_callback_; | 388 ConfirmationCallback confirmation_callback_; |
| 367 | 389 |
| 368 // Used to keep track of pending application connection requests. | 390 // Used to keep track of pending application connection requests. |
| 369 int connecting_applications_counter_; | 391 int connecting_applications_counter_; |
| 370 | 392 |
| 393 // A service records cache. |
| 394 ServiceRecordList service_records_; |
| 395 |
| 396 // This says whether the |service_records_| cache is initialized. Note that an |
| 397 // empty |service_records_| list can be a valid list. |
| 398 bool service_records_loaded_; |
| 399 |
| 371 // Note: This should remain the last member so it'll be destroyed and | 400 // Note: This should remain the last member so it'll be destroyed and |
| 372 // invalidate its weak pointers before any other members are destroyed. | 401 // invalidate its weak pointers before any other members are destroyed. |
| 373 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 402 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
| 374 | 403 |
| 375 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 404 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
| 376 }; | 405 }; |
| 377 | 406 |
| 378 } // namespace chromeos | 407 } // namespace chromeos |
| 379 | 408 |
| 380 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ | 409 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ |
| OLD | NEW |