| 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 // Update the internal service records cache. On success, |callback| is called |
| 119 // with the updated list. In other case, the internal cache remains intact and |
| 120 // |error_callback| is called. |
| 121 void UpdateServiceRecords(const ServiceRecordsCallback& callback, |
| 122 const ErrorCallback& error_callback); |
| 123 |
| 118 // Called by BluetoothAdapterClient when a call to DiscoverServices() | 124 // Called by BluetoothAdapterClient when a call to DiscoverServices() |
| 119 // completes. |callback| and |error_callback| are the callbacks provided to | 125 // completes. |callback| and |error_callback| are the callbacks provided to |
| 120 // GetServiceRecords. | 126 // GetServiceRecords. |
| 121 void CollectServiceRecordsCallback( | 127 void CollectServiceRecordsCallback( |
| 122 const ServiceRecordsCallback& callback, | 128 const ServiceRecordsCallback& callback, |
| 123 const ErrorCallback& error_callback, | 129 const ErrorCallback& error_callback, |
| 124 const dbus::ObjectPath& device_path, | 130 const dbus::ObjectPath& device_path, |
| 125 const BluetoothDeviceClient::ServiceMap& service_map, | 131 const BluetoothDeviceClient::ServiceMap& service_map, |
| 126 bool success); | 132 bool success); |
| 127 | 133 |
| 128 // Called by BluetoothProperty when the call to Set() for the Trusted | 134 // Called by BluetoothProperty when the call to Set() for the Trusted |
| 129 // property completes. |success| indicates whether or not the request | 135 // property completes. |success| indicates whether or not the request |
| 130 // succeeded, |callback| and |error_callback| are the callbacks provided to | 136 // succeeded, |callback| and |error_callback| are the callbacks provided to |
| 131 // Connect(). | 137 // Connect(). |
| 132 void OnSetTrusted(const base::Closure& callback, | 138 void OnSetTrusted(const base::Closure& callback, |
| 133 const ErrorCallback& error_callback, | 139 const ConnectErrorCallback& error_callback, |
| 134 bool success); | 140 bool success); |
| 135 | 141 |
| 142 // Called by UpdateServiceRecords on success, after a CreateDevice or |
| 143 // CreatePaired device success. |
| 144 void OnServicesUpdatedAfterPair(const base::Closure& callback, |
| 145 const ServiceRecordList& list); |
| 146 |
| 136 // Connect application-level protocols of the device to the system, called | 147 // 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 | 148 // on a successful connection or to reconnect to a device that is already |
| 138 // paired or previously connected. |error_callback| is called on failure. | 149 // paired or previously connected. |error_callback| is called on failure. |
| 139 // Otherwise, |callback| is called when the request is complete. | 150 // Otherwise, |callback| is called when the request is complete. |
| 140 void ConnectApplications(const base::Closure& callback, | 151 void ConnectApplications(const base::Closure& callback, |
| 141 const ConnectErrorCallback& error_callback); | 152 const ConnectErrorCallback& error_callback); |
| 142 | 153 |
| 143 // Called by IntrospectableClient when a call to Introspect() completes. | 154 // Called by IntrospectableClient when a call to Introspect() completes. |
| 144 // |success| indicates whether or not the request succeeded, |callback| and | 155 // |success| indicates whether or not the request succeeded, |callback| and |
| 145 // |error_callback| are the callbacks provided to ConnectApplications(), | 156 // |error_callback| are the callbacks provided to ConnectApplications(), |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // During pairing these callbacks are set to those provided by method calls | 372 // 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 | 373 // made on us by |agent_| and are called by our own method calls such as |
| 363 // SetPinCode() and SetPasskey(). | 374 // SetPinCode() and SetPasskey(). |
| 364 PinCodeCallback pincode_callback_; | 375 PinCodeCallback pincode_callback_; |
| 365 PasskeyCallback passkey_callback_; | 376 PasskeyCallback passkey_callback_; |
| 366 ConfirmationCallback confirmation_callback_; | 377 ConfirmationCallback confirmation_callback_; |
| 367 | 378 |
| 368 // Used to keep track of pending application connection requests. | 379 // Used to keep track of pending application connection requests. |
| 369 int connecting_applications_counter_; | 380 int connecting_applications_counter_; |
| 370 | 381 |
| 382 // A service records cache. |
| 383 ServiceRecordList service_records_; |
| 384 |
| 385 // This says wether the |service_records_| cache is initialized. Note that an |
| 386 // empty |service_records_| list can be a valid list. |
| 387 bool service_records_loaded_; |
| 388 |
| 371 // Note: This should remain the last member so it'll be destroyed and | 389 // Note: This should remain the last member so it'll be destroyed and |
| 372 // invalidate its weak pointers before any other members are destroyed. | 390 // invalidate its weak pointers before any other members are destroyed. |
| 373 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 391 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
| 374 | 392 |
| 375 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 393 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
| 376 }; | 394 }; |
| 377 | 395 |
| 378 } // namespace chromeos | 396 } // namespace chromeos |
| 379 | 397 |
| 380 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ | 398 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ |
| OLD | NEW |